Implement notification window and binding feedback on interaction#2893
Implement notification window and binding feedback on interaction#2893davidwuluetang wants to merge 13 commits intof3d-app:masterfrom
Conversation
|
You are modifying libf3d public API! |
mwestphal
left a comment
There was a problem hiding this comment.
please share a screenshot of how it looks.
|
Still working on this @davidwuluetang ? |
|
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 |
Ok, let us know if you need help with that. |
|
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. |
| interactor.addBinding({mod_t::CTRL, "Q"}, "exit", "Others", std::bind(docString, "Quit")); | ||
| // clang-format on | ||
|
|
||
| interactor.initBindNotificationMap(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
implementation only functions starts with an upper case letter.
| if (elapsed > duration) | ||
| { | ||
| it = Notifications.erase(it); | ||
| } |
There was a problem hiding this comment.
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] = |
There was a problem hiding this comment.
Is it needed? If the goal is to update the time when pressing a binding, we could just update the time in TriggerBinding function
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Can you use deltaTime instead of computing dt here?
There was a problem hiding this comment.
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.
|
So, you guys decided to take out the work from here? |
|
Yes, see #2970 |
|
Closing this one in favor of #2970 |
Describe your changes
Implement binding notification window to bottom left
interactor_impl::TriggerBinding()RenderNotifications()onvtkF3DImguiActorIssue ticket number and link if any
#2578
Checklist for finalizing the PR
.github/workflows/versions.json, I have updateddocker_timestampContinuous integration
Please write a comment to run CI, eg:
\ci fast.See here for more info.
Screenshot