@@ -61,6 +61,7 @@ class interactor_impl::internals
6161 documentation_callback_t DocumentationCallback;
6262 BindingType Type;
6363 bool Notify;
64+ bool Repeat;
6465 };
6566
6667 struct CommandCallbacks
@@ -519,36 +520,39 @@ class interactor_impl::internals
519520 // invalidating any references/iterators into it.
520521 const BindingCommands binding = commandsIt->second ;
521522
522- for ( const std::string& command : binding. CommandVector )
523+ if (binding. Repeat || rwi-> GetRepeatCount () <= 1 )
523524 {
524- std::string commandWithArgs = command;
525- if (!argsString.empty ())
525+ for (const std::string& command : binding.CommandVector )
526526 {
527- commandWithArgs.push_back (' ' );
528- commandWithArgs.append (argsString);
529- };
530- try
531- {
532- // XXX: Ignore the boolean return of triggerCommand,
533- // error is already logged by triggerCommand
534- this ->Interactor .triggerCommand (commandWithArgs);
535- }
536- catch (const f3d::interactor::command_runtime_exception& ex)
537- {
538- log::error (
539- " Interaction: error running command: \" " + commandWithArgs + " \" : " + ex.what ());
527+ std::string commandWithArgs = command;
528+ if (!argsString.empty ())
529+ {
530+ commandWithArgs.push_back (' ' );
531+ commandWithArgs.append (argsString);
532+ };
533+ try
534+ {
535+ // XXX: Ignore the boolean return of triggerCommand,
536+ // error is already logged by triggerCommand
537+ this ->Interactor .triggerCommand (commandWithArgs);
538+ }
539+ catch (const f3d::interactor::command_runtime_exception& ex)
540+ {
541+ log::error (
542+ " Interaction: error running command: \" " + commandWithArgs + " \" : " + ex.what ());
543+ }
540544 }
541- }
542545
543- if (binding.Notify && binding.DocumentationCallback )
544- {
545- // trigger notification
546- vtkRenderWindow* renWin = this ->Window .GetRenderWindow ();
547- vtkF3DRenderer* ren =
548- vtkF3DRenderer::SafeDownCast (renWin->GetRenderers ()->GetFirstRenderer ());
546+ if (binding.Notify && binding.DocumentationCallback )
547+ {
548+ // trigger notification
549+ vtkRenderWindow* renWin = this ->Window .GetRenderWindow ();
550+ vtkF3DRenderer* ren =
551+ vtkF3DRenderer::SafeDownCast (renWin->GetRenderers ()->GetFirstRenderer ());
549552
550- auto [desc, value] = binding.DocumentationCallback ();
551- ren->AddNotification (desc, value, bind.format (), 3.0 );
553+ auto [desc, value] = binding.DocumentationCallback ();
554+ ren->AddNotification (desc, value, bind.format (), 3.0 );
555+ }
552556 }
553557 }
554558
@@ -1734,10 +1738,10 @@ interactor& interactor_impl::initBindings()
17341738// ----------------------------------------------------------------------------
17351739interactor& interactor_impl::addBinding (const interaction_bind_t & bind,
17361740 std::vector<std::string> commands, std::string group,
1737- documentation_callback_t documentationCallback, BindingType type, bool notify)
1741+ documentation_callback_t documentationCallback, BindingType type, bool notify, bool repeat )
17381742{
17391743 const auto [it, success] = this ->Internals ->Bindings .insert (
1740- { bind, { std::move (commands), std::move (documentationCallback), type, notify } });
1744+ { bind, { std::move (commands), std::move (documentationCallback), type, notify, repeat } });
17411745 if (!success)
17421746 {
17431747 throw interactor::already_exists_exception (
@@ -1759,10 +1763,10 @@ interactor& interactor_impl::addBinding(const interaction_bind_t& bind,
17591763
17601764// ----------------------------------------------------------------------------
17611765interactor& interactor_impl::addBinding (const interaction_bind_t & bind, std::string command,
1762- std::string group, documentation_callback_t documentationCallback, BindingType type, bool notify)
1766+ std::string group, documentation_callback_t documentationCallback, BindingType type, bool notify, bool repeat )
17631767{
17641768 return this ->addBinding (bind, std::vector<std::string>{ std::move (command) }, std::move (group),
1765- std::move (documentationCallback), type, notify);
1769+ std::move (documentationCallback), type, notify, repeat );
17661770}
17671771
17681772// ----------------------------------------------------------------------------
0 commit comments