-
-
Notifications
You must be signed in to change notification settings - Fork 441
ISSUE-2082: Add repeat support for bindings API #3318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
CPerry26
wants to merge
14
commits into
f3d-app:master
Choose a base branch
from
CPerry26:issue-2082
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7a8f1bc
ISSUE-2082: Add repeat support for bindings API
CPerry26 6ae3b95
ISSUE-2082: Add testing for no repeats
CPerry26 533dacd
ISSUE-2082: Styling
CPerry26 0a8c563
Improved testing
CPerry26 7d789a9
Styling
CPerry26 9a49d62
ISSUE-2082: Test cleanup, PR feedback, bindings
CPerry26 872e330
Styling
CPerry26 a0b7770
ISSUE-2082: Missing EOL
CPerry26 50a222e
ISSUE-2082: Switch to decrease command
CPerry26 1eff92c
ISSUE-2082: Missing EOL?
CPerry26 66e67d5
ISSUE-2082: PR feedback
CPerry26 dbf952d
ISSUE-2082: Add bindings tests
CPerry26 27064f3
ISSUE-2082: Styling
CPerry26 3913a3f
ISSUE-2082: Recordings feedback
CPerry26 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
mwestphal marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,7 @@ class interactor_impl::internals | |
| documentation_callback_t DocumentationCallback; | ||
| BindingType Type; | ||
| bool Notify; | ||
| bool Repeat; | ||
| }; | ||
|
|
||
| struct CommandCallbacks | ||
|
|
@@ -496,33 +497,36 @@ class interactor_impl::internals | |
| // invalidating any references/iterators into it. | ||
| const BindingCommands binding = commandsIt->second; | ||
|
|
||
| for (const std::string& command : binding.CommandVector) | ||
| if (binding.Repeat || rwi->GetRepeatCount() <= 1) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Went with <= here in case VTK can support starting the repeat count at 0. Can switch the logic if we'd like.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will need updated once VTK changes indeed. |
||
| { | ||
| std::string commandWithArgs = command; | ||
| if (!argsString.empty()) | ||
| for (const std::string& command : binding.CommandVector) | ||
| { | ||
| commandWithArgs.push_back(' '); | ||
| commandWithArgs.append(argsString); | ||
| }; | ||
| try | ||
| { | ||
| // XXX: Ignore the boolean return of triggerCommand, | ||
| // error is already logged by triggerCommand | ||
| this->Interactor.triggerCommand(commandWithArgs); | ||
| std::string commandWithArgs = command; | ||
| if (!argsString.empty()) | ||
| { | ||
| commandWithArgs.push_back(' '); | ||
| commandWithArgs.append(argsString); | ||
| }; | ||
| try | ||
| { | ||
| // XXX: Ignore the boolean return of triggerCommand, | ||
| // error is already logged by triggerCommand | ||
| this->Interactor.triggerCommand(commandWithArgs); | ||
| } | ||
| catch (const f3d::interactor::command_runtime_exception& ex) | ||
| { | ||
| log::error( | ||
| "Interaction: error running command: \"" + commandWithArgs + "\": " + ex.what()); | ||
| } | ||
| } | ||
| catch (const f3d::interactor::command_runtime_exception& ex) | ||
|
|
||
| if (binding.Notify && binding.DocumentationCallback) | ||
| { | ||
| log::error( | ||
| "Interaction: error running command: \"" + commandWithArgs + "\": " + ex.what()); | ||
| // trigger notification | ||
| auto [desc, value] = binding.DocumentationCallback(); | ||
| this->AddNotification(desc, value, bind.format(), 3.0); | ||
| } | ||
| } | ||
|
|
||
| if (binding.Notify && binding.DocumentationCallback) | ||
| { | ||
| // trigger notification | ||
| auto [desc, value] = binding.DocumentationCallback(); | ||
| this->AddNotification(desc, value, bind.format(), 3.0); | ||
| } | ||
| } | ||
|
|
||
| // Update the dynamic options of the animation manager so check if the cheatsheet needs an | ||
|
|
@@ -1707,10 +1711,10 @@ interactor& interactor_impl::initBindings() | |
| //---------------------------------------------------------------------------- | ||
| interactor& interactor_impl::addBinding(const interaction_bind_t& bind, | ||
| std::vector<std::string> commands, std::string group, | ||
| documentation_callback_t documentationCallback, BindingType type, bool notify) | ||
| documentation_callback_t documentationCallback, BindingType type, bool notify, bool repeat) | ||
| { | ||
| const auto [it, success] = this->Internals->Bindings.insert( | ||
| { bind, { std::move(commands), std::move(documentationCallback), type, notify } }); | ||
| { bind, { std::move(commands), std::move(documentationCallback), type, notify, repeat } }); | ||
| if (!success) | ||
| { | ||
| throw interactor::already_exists_exception( | ||
|
|
@@ -1732,10 +1736,11 @@ interactor& interactor_impl::addBinding(const interaction_bind_t& bind, | |
|
|
||
| //---------------------------------------------------------------------------- | ||
| interactor& interactor_impl::addBinding(const interaction_bind_t& bind, std::string command, | ||
| std::string group, documentation_callback_t documentationCallback, BindingType type, bool notify) | ||
| std::string group, documentation_callback_t documentationCallback, BindingType type, bool notify, | ||
| bool repeat) | ||
| { | ||
| return this->addBinding(bind, std::vector<std::string>{ std::move(command) }, std::move(group), | ||
| std::move(documentationCallback), type, notify); | ||
| std::move(documentationCallback), type, notify, repeat); | ||
| } | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.