Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 9 files). Show all
Unified · Split
| @@ -44,6 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | #include <PathUtils.h> |
| 45 | 45 | #include <ResourceScriptingInterface.h> |
| 46 | 46 | #include <NodeList.h> |
| 47 | +#include <ScriptAvatarData.h> | |
| 47 | 48 | #include <udt/PacketHeaders.h> |
| 48 | 49 | #include <UUID.h> |
| 49 | 50 | #include <ui/Menu.h> |
| @@ -535,6 +536,16 @@ static QScriptValue createScriptableResourcePrototype(QScriptEngine* engine) { · 485 unmodified lines | ||
| 535 | 536 | return prototype; |
| 536 | 537 | } |
| 537 | 538 | |
| 539 | +QScriptValue avatarDataToScriptValue(QScriptEngine* engine, ScriptAvatarData* const& in) { | |
| 540 | + return engine->newQObject(in, QScriptEngine::ScriptOwnership, DEFAULT_QOBJECT_WRAP_OPTIONS); | |
| 541 | +} | |
| 542 | + | |
| 543 | +void avatarDataFromScriptValue(const QScriptValue& object, ScriptAvatarData*& out) { | |
| 544 | + // This is not implemented because there are no slots/properties that take an AvatarSharedPointer from a script | |
| 545 | + assert(false); | |
| 546 | + out = nullptr; | |
| 547 | +} | |
| 548 | + | |
| 538 | 549 | void ScriptEngine::resetModuleCache(bool deleteScriptCache) { |
| 539 | 550 | if (QThread::currentThread() != thread()) { |
| 540 | 551 | executeOnScriptThread([=]() { resetModuleCache(deleteScriptCache); }); |
| @@ -614,6 +625,7 @@ void ScriptEngine::init() { · 73 unmodified lines | ||
| 614 | 625 | |
| 615 | 626 | qScriptRegisterMetaType(this, injectorToScriptValue, injectorFromScriptValue); |
| 616 | 627 | qScriptRegisterMetaType(this, inputControllerToScriptValue, inputControllerFromScriptValue); |
| 628 | + qScriptRegisterMetaType(this, avatarDataToScriptValue, avatarDataFromScriptValue); | |
| 617 | 629 | qScriptRegisterMetaType(this, animationDetailsToScriptValue, animationDetailsFromScriptValue); |
| 618 | 630 | qScriptRegisterMetaType(this, webSocketToScriptValue, webSocketFromScriptValue); |
| 619 | 631 | qScriptRegisterMetaType(this, qWSCloseCodeToScriptValue, qWSCloseCodeFromScriptValue); |