History

add Controler.Actions

Brad Hefta-Gaub committed 11 years ago

Commit 63f31561 parent f55b6113 files · +17 −1Browse files

Showing the changes to interface/src/scripting/ControllerScriptingInterface.cpp (1 of 3 files). Show all

Unified · Split

interface/src/scripting/ControllerScriptingInterface.cpp+11−1
@@ -390,8 +390,9 @@ QString ControllerScriptingInterface::sanatizeName(const QString& name) { · 389 unmodified lines
390390 }
391391
392392 void ControllerScriptingInterface::wireUpControllers(ScriptEngine* engine) {
393− auto devices = DependencyManager::get<UserInputMapper>()->getDevices();
394393
394+ // Controller.Hardware.*
395+ auto devices = DependencyManager::get<UserInputMapper>()->getDevices();
395396 for(const auto& deviceMapping : devices) {
396397 auto device = deviceMapping.second.get();
397398 auto deviceName = sanatizeName(device->getName());
@@ -403,6 +404,15 @@ void ControllerScriptingInterface::wireUpControllers(ScriptEngine* engine) { · 5 unmodified lines
403404 engine->registerValue(deviceInputName, input.getID());
404405 }
405406 }
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+ }
406416 }
407417
408418 AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) {