Showing the changes to interface/src/scripting/ControllerScriptingInterface.cpp (1 of 10 files). Show all
Unified · Split
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <avatar/MyAvatar.h> |
| 16 | 16 | #include <HandData.h> |
| 17 | 17 | #include <HFBackEvent.h> |
| 18 | +#include <plugins/PluginManager.h> | |
| 18 | 19 | |
| 19 | 20 | #include "Application.h" |
| 20 | 21 | #include "devices/MotionTracker.h" |
| @@ -115,7 +116,7 @@ void inputPairFromScriptValue(const QScriptValue& object, UserInputMapper::Input · 94 unmodified lines | ||
| 115 | 116 | inputPair.second = QString(object.property("inputName").toVariant().toString()); |
| 116 | 117 | } |
| 117 | 118 | |
| 118 | −void ControllerScriptingInterface::registerControllerTypes(ScriptEngine* engine) { | |
| 119 | +void ControllerScriptingInterface::registerControllerTypes(QScriptEngine* engine) { | |
| 119 | 120 | qScriptRegisterSequenceMetaType<QVector<UserInputMapper::Action> >(engine); |
| 120 | 121 | qScriptRegisterSequenceMetaType<QVector<UserInputMapper::InputChannel> >(engine); |
| 121 | 122 | qScriptRegisterSequenceMetaType<QVector<UserInputMapper::InputPair> >(engine); |
| @@ -426,11 +427,25 @@ void ControllerScriptingInterface::releaseInputController(controller::InputContr · 304 unmodified lines | ||
| 426 | 427 | } |
| 427 | 428 | |
| 428 | 429 | void ControllerScriptingInterface::update() { |
| 429 | − controller::ScriptingInterface::update(); | |
| 430 | + static float last = secTimestampNow(); | |
| 431 | + float now = secTimestampNow(); | |
| 432 | + float delta = now - last; | |
| 433 | + last = now; | |
| 434 | + | |
| 435 | + for(auto inputPlugin : PluginManager::getInstance()->getInputPlugins()) { | |
| 436 | + if (inputPlugin->isActive()) { | |
| 437 | + inputPlugin->pluginUpdate(delta, false); | |
| 438 | + } | |
| 439 | + } | |
| 440 | + | |
| 441 | + auto userInputMapper = DependencyManager::get<UserInputMapper>(); | |
| 442 | + userInputMapper->update(delta); | |
| 430 | 443 | |
| 431 | 444 | for (auto entry : _inputControllers) { |
| 432 | 445 | entry.second->update(); |
| 433 | 446 | } |
| 447 | + | |
| 448 | + controller::ScriptingInterface::update(); | |
| 434 | 449 | } |
| 435 | 450 | |
| 436 | 451 | QVector<UserInputMapper::Action> ControllerScriptingInterface::getAllActions() { |