Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 34 files). Show all
Unified · Split
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | // | 4 | // |
| 5 | // Created by Brad Hefta-Gaub on 12/6/13. | 5 | // Created by Brad Hefta-Gaub on 12/6/13. |
| 6 | // Copyright 2013 High Fidelity, Inc. | 6 | // Copyright 2013 High Fidelity, Inc. |
| 7 | // Copyright 2022 Overte e.V. | ||
| 7 | // | 8 | // |
| 8 | // Distributed under the Apache License, Version 2.0. | 9 | // Distributed under the Apache License, Version 2.0. |
| 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | 10 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| @@ -48,13 +49,9 @@ · 38 unmodified lines | |||
| 48 | const QString GRABBABLE_USER_DATA = "{\"grabbableKey\":{\"grabbable\":true}}"; | 49 | const QString GRABBABLE_USER_DATA = "{\"grabbableKey\":{\"grabbable\":true}}"; |
| 49 | const QString NOT_GRABBABLE_USER_DATA = "{\"grabbableKey\":{\"grabbable\":false}}"; | 50 | const QString NOT_GRABBABLE_USER_DATA = "{\"grabbableKey\":{\"grabbable\":false}}"; |
| 50 | 51 | ||
| 51 | void staticEntityScriptInitializer(ScriptManager* manager) { | 52 | void staticEntityScriptTypesInitializer(ScriptManager* manager) { |
| 52 | auto scriptEngine = manager->engine().get(); | 53 | auto scriptEngine = manager->engine().get(); |
| 53 | 54 | ||
| 54 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); | ||
| 55 | entityScriptingInterface->init(); | ||
| 56 | auto interfacePtr = entityScriptingInterface.data(); // using this when we don't want to leak a reference | ||
| 57 | |||
| 58 | registerMetaTypes(scriptEngine); | 55 | registerMetaTypes(scriptEngine); |
| 59 | 56 | ||
| 60 | scriptRegisterMetaType(scriptEngine, EntityPropertyFlagsToScriptValue, EntityPropertyFlagsFromScriptValue); | 57 | scriptRegisterMetaType(scriptEngine, EntityPropertyFlagsToScriptValue, EntityPropertyFlagsFromScriptValue); |
| @@ -62,6 +59,15 @@ void staticEntityScriptInitializer(ScriptManager* manager) { · 1 unmodified line | |||
| 62 | scriptRegisterMetaType(scriptEngine, EntityPropertyInfoToScriptValue, EntityPropertyInfoFromScriptValue); | 59 | scriptRegisterMetaType(scriptEngine, EntityPropertyInfoToScriptValue, EntityPropertyInfoFromScriptValue); |
| 63 | scriptRegisterMetaType(scriptEngine, EntityItemIDtoScriptValue, EntityItemIDfromScriptValue); | 60 | scriptRegisterMetaType(scriptEngine, EntityItemIDtoScriptValue, EntityItemIDfromScriptValue); |
| 64 | scriptRegisterMetaType(scriptEngine, RayToEntityIntersectionResultToScriptValue, RayToEntityIntersectionResultFromScriptValue); | 61 | scriptRegisterMetaType(scriptEngine, RayToEntityIntersectionResultToScriptValue, RayToEntityIntersectionResultFromScriptValue); |
| 62 | } | ||
| 63 | STATIC_SCRIPT_TYPES_INITIALIZER(staticEntityScriptTypesInitializer); | ||
| 64 | |||
| 65 | void staticEntityScriptInitializer(ScriptManager* manager) { | ||
| 66 | auto scriptEngine = manager->engine().get(); | ||
| 67 | |||
| 68 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); | ||
| 69 | entityScriptingInterface->init(); | ||
| 70 | auto interfacePtr = entityScriptingInterface.data(); // using this when we don't want to leak a reference | ||
| 65 | 71 | ||
| 66 | scriptEngine->registerGlobalObject("Entities", entityScriptingInterface.data()); | 72 | scriptEngine->registerGlobalObject("Entities", entityScriptingInterface.data()); |
| 67 | scriptEngine->registerFunction("Entities", "getMultipleEntityProperties", EntityScriptingInterface::getMultipleEntityProperties); | 73 | scriptEngine->registerFunction("Entities", "getMultipleEntityProperties", EntityScriptingInterface::getMultipleEntityProperties); |