Showing the changes to libraries/script-engine/src/EventTypes.cpp (1 of 5 files). Show all
Unified · Split
| @@ -9,11 +9,9 @@ · 8 unmodified lines | ||
| 9 | 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| 10 | 10 | // |
| 11 | 11 | |
| 12 | −#include <QDebug> | |
| 13 | −#include <RegisteredMetaTypes.h> | |
| 14 | − | |
| 15 | 12 | #include "KeyEvent.h" |
| 16 | 13 | #include "MouseEvent.h" |
| 14 | +#include "SpatialEvent.h" | |
| 17 | 15 | #include "TouchEvent.h" |
| 18 | 16 | #include "WheelEvent.h" |
| 19 | 17 | |
| @@ -24,36 +22,5 @@ void registerEventTypes(QScriptEngine* engine) { · 4 unmodified lines | ||
| 24 | 22 | qScriptRegisterMetaType(engine, MouseEvent::toScriptValue, MouseEvent::fromScriptValue); |
| 25 | 23 | qScriptRegisterMetaType(engine, TouchEvent::toScriptValue, TouchEvent::fromScriptValue); |
| 26 | 24 | qScriptRegisterMetaType(engine, WheelEvent::toScriptValue, WheelEvent::fromScriptValue); |
| 27 | − qScriptRegisterMetaType(engine, spatialEventToScriptValue, spatialEventFromScriptValue); | |
| 28 | −} | |
| 29 | − | |
| 30 | −SpatialEvent::SpatialEvent() : | |
| 31 | − locTranslation(0.0f), | |
| 32 | − locRotation(), | |
| 33 | − absTranslation(0.0f), | |
| 34 | − absRotation() | |
| 35 | −{ | |
| 36 | −}; | |
| 37 | − | |
| 38 | −SpatialEvent::SpatialEvent(const SpatialEvent& event) { | |
| 39 | − locTranslation = event.locTranslation; | |
| 40 | − locRotation = event.locRotation; | |
| 41 | − absTranslation = event.absTranslation; | |
| 42 | − absRotation = event.absRotation; | |
| 43 | −} | |
| 44 | − | |
| 45 | − | |
| 46 | −QScriptValue spatialEventToScriptValue(QScriptEngine* engine, const SpatialEvent& event) { | |
| 47 | − QScriptValue obj = engine->newObject(); | |
| 48 | − | |
| 49 | − obj.setProperty("locTranslation", vec3toScriptValue(engine, event.locTranslation) ); | |
| 50 | − obj.setProperty("locRotation", quatToScriptValue(engine, event.locRotation) ); | |
| 51 | − obj.setProperty("absTranslation", vec3toScriptValue(engine, event.absTranslation) ); | |
| 52 | − obj.setProperty("absRotation", quatToScriptValue(engine, event.absRotation) ); | |
| 53 | − | |
| 54 | − return obj; | |
| 55 | −} | |
| 56 | − | |
| 57 | −void spatialEventFromScriptValue(const QScriptValue& object,SpatialEvent& event) { | |
| 58 | − // nothing for now... | |
| 25 | + qScriptRegisterMetaType(engine, SpatialEvent::toScriptValue, SpatialEvent::fromScriptValue); | |
| 59 | 26 | } |