Showing the changes to interface/src/scripting/ControllerScriptingInterface.cpp (1 of 3 files). Show all
Unified · Split
| @@ -390,8 +390,9 @@ QString ControllerScriptingInterface::sanatizeName(const QString& name) { · 389 unmodified lines | |||
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | void ControllerScriptingInterface::wireUpControllers(ScriptEngine* engine) { | 392 | void ControllerScriptingInterface::wireUpControllers(ScriptEngine* engine) { |
| 393 | auto devices = DependencyManager::get<UserInputMapper>()->getDevices(); | ||
| 394 | 393 | ||
| 394 | // Controller.Hardware.* | ||
| 395 | auto devices = DependencyManager::get<UserInputMapper>()->getDevices(); | ||
| 395 | for(const auto& deviceMapping : devices) { | 396 | for(const auto& deviceMapping : devices) { |
| 396 | auto device = deviceMapping.second.get(); | 397 | auto device = deviceMapping.second.get(); |
| 397 | auto deviceName = sanatizeName(device->getName()); | 398 | auto deviceName = sanatizeName(device->getName()); |
| @@ -403,6 +404,15 @@ void ControllerScriptingInterface::wireUpControllers(ScriptEngine* engine) { · 5 unmodified lines | |||
| 403 | engine->registerValue(deviceInputName, input.getID()); | 404 | engine->registerValue(deviceInputName, input.getID()); |
| 404 | } | 405 | } |
| 405 | } | 406 | } |
| 407 | |||
| 408 | // Controller.Actions.* | ||
| 409 | auto actionNames = DependencyManager::get<UserInputMapper>()->getActionNames(); | ||
| 410 | int actionNumber = 0; | ||
| 411 | for (const auto& actionName : actionNames) { | ||
| 412 | QString safeActionName { "Controller.Actions." + sanatizeName(actionName) }; | ||
| 413 | engine->registerValue(safeActionName, actionNumber); | ||
| 414 | actionNumber++; | ||
| 415 | } | ||
| 406 | } | 416 | } |
| 407 | 417 | ||
| 408 | AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) { | 418 | AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) { |