Skip to content

Implement notification window and binding feedback on interaction#2893

Closed
davidwuluetang wants to merge 13 commits intof3d-app:masterfrom
davidwuluetang:binding-feedback
Closed

Implement notification window and binding feedback on interaction#2893
davidwuluetang wants to merge 13 commits intof3d-app:masterfrom
davidwuluetang:binding-feedback

Conversation

@davidwuluetang
Copy link
Copy Markdown
Contributor

@davidwuluetang davidwuluetang commented Feb 17, 2026

Describe your changes

Implement binding notification window to bottom left

  • Added APIs to libf3d.interactor
  • Modified interactor_impl::TriggerBinding()
  • Added RenderNotifications() on vtkF3DImguiActor

Issue ticket number and link if any

#2578

Checklist for finalizing the PR

  • I have performed a self-review of my code
  • I have added tests for new features and bugfixes
  • I have added documentation for new features
  • If it is a modifying the libf3d API, I have updated bindings
  • If it is a modifying the .github/workflows/versions.json, I have updated docker_timestamp

Continuous integration

Please write a comment to run CI, eg: \ci fast.
See here for more info.

Screenshot

scene_14

@github-actions
Copy link
Copy Markdown

You are modifying libf3d public API! ⚠️Please update bindings accordingly⚠️!
You can find them in their respective directories: c, python, java, webassembly.

@mwestphal mwestphal self-requested a review February 17, 2026 21:37
Copy link
Copy Markdown
Member

@mwestphal mwestphal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please share a screenshot of how it looks.

@mwestphal
Copy link
Copy Markdown
Member

Still working on this @davidwuluetang ?

@mwestphal mwestphal linked an issue Mar 22, 2026 that may be closed by this pull request
@davidwuluetang
Copy link
Copy Markdown
Contributor Author

For the feature itself, the work is basically done. For the event loop freeze and slow down problem, I tried some workaround. Which adding another observer to VTKInteractor watch for InteractionEvent, but this require a timer feeding real delta time to event loop (not longer use a fix delta time). So, Idk this is a good solution or not.

@mwestphal
Copy link
Copy Markdown
Member

For the feature itself, the work is basically done. For the event loop freeze and slow down problem, I tried some workaround. Which adding another observer to VTKInteractor watch for InteractionEvent, but this require a timer feeding real delta time to event loop (not longer use a fix delta time). So, Idk this is a good solution or not.

Ok, let us know if you need help with that.

@davidwuluetang
Copy link
Copy Markdown
Contributor Author

I just push all code, maybe you guys can try it out, it work but Idk how this solution can effect other things. If this is not a acceptable solution, you can unassign me from this issue, cus I really don't think I can come up a solution for this problem.

@mwestphal
Copy link
Copy Markdown
Member

I just push all code, maybe you guys can try it out, it work but Idk how this solution can effect other things. If this is not a acceptable solution, you can unassign me from this issue, cus I really don't think I can come up a solution for this problem.

Got it, we will take a look.

@mwestphal mwestphal requested a review from Meakk March 23, 2026 16:03
interactor.addBinding({mod_t::CTRL, "Q"}, "exit", "Others", std::bind(docString, "Quit"));
// clang-format on

interactor.initBindNotificationMap();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API name is too implementation oriented. We should use Map because the user doesn't care and we may change impl details.
What about initNotificationSystem()? Or just initialize it automatically with the interactor if possible?

Copy link
Copy Markdown
Contributor Author

@davidwuluetang davidwuluetang Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have opinion with name change.

Or just initialize it automatically with the interactor if possible?

This function do more than init, it clear the map and reload the callback as well. So, if users make change on the binding naming or callback, they need to call this function after the change in order for the change reflect on binding notifications. That why I make it public.

* Add or modify binding documentation callback to binding notification map using command string
* as key.
*/
void setBindNotiCallback(std::string command, documentation_callback_t doc_callback);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implementation only functions starts with an upper case letter.

Comment on lines +902 to +905
if (elapsed > duration)
{
it = Notifications.erase(it);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move the logic of notification cleanup to vtkF3DUIActor::SetTotalTime? That way you ensure that the map is not growing infinitely if imgui is not enabled.

this->EventLoopObserverId =
this->EventLoopObserverId[0] =
this->VTKInteractor->AddObserver(vtkCommand::TimerEvent, timerCallBack);
this->EventLoopObserverId[1] =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed? If the goal is to update the time when pressing a binding, we could just update the time in TriggerBinding function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is the workaround I mention for event loop freeze issue on Windows system when interacting with camera, not really relate to the binding notification feature itself. It freeze the animation and the UITotalTime update, make the notification stay on screen if you interacting the camera.

internals* that = static_cast<internals*>(clientData);
that->EventLoop(that->CallbackDeltaTime);
double now = vtkTimerLog::GetUniversalTime();
double dt = now - that->LastTime;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use deltaTime instead of computing dt here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will work as well, but animation will look slightly faster when deltaTime is 1/30. I tested on my machine it stay constant on 36-37 loops per second when interacting.

Comment thread library/src/interactor_impl.cxx
@davidwuluetang
Copy link
Copy Markdown
Contributor Author

So, you guys decided to take out the work from here?

@Meakk
Copy link
Copy Markdown
Member

Meakk commented Mar 25, 2026

Yes, see #2970

@Meakk
Copy link
Copy Markdown
Member

Meakk commented Mar 25, 2026

Closing this one in favor of #2970
I'll keep you as co-author on this one.
Please feel free to make comments on it if I missed something important.

@Meakk Meakk closed this Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

binding feedback on interaction

3 participants