Showing the changes to interface/src/scripting/ControllerScriptingInterface.cpp (1 of 4 files). Show all
Unified · Split
| @@ -472,6 +472,18 @@ float ControllerScriptingInterface::getActionValue(int action) { · 471 unmodified lines | ||
| 472 | 472 | return DependencyManager::get<UserInputMapper>()->getActionState(UserInputMapper::Action(action)); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | +int ControllerScriptingInterface::findAction(QString actionName) { | |
| 476 | + auto userInputMapper = DependencyManager::get<UserInputMapper>(); | |
| 477 | + auto actions = getAllActions(); | |
| 478 | + for (auto action : actions) { | |
| 479 | + if (userInputMapper->getActionName(action) == actionName) { | |
| 480 | + return action; | |
| 481 | + } | |
| 482 | + } | |
| 483 | + // If the action isn't found, return -1 | |
| 484 | + return -1; | |
| 485 | +} | |
| 486 | + | |
| 475 | 487 | InputController::InputController(int deviceTrackerId, int subTrackerId, QObject* parent) : |
| 476 | 488 | AbstractInputController(), |
| 477 | 489 | _deviceTrackerId(deviceTrackerId), |