mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-19 19:39:30 -06:00
User Properties (#2064)
Add the ability to add user-defined properties using a new `openspace.addCustomProperty` function that takes an identifier and a type and creates a new property of that type. The new property is then available under `UserProperties.<identifier>`
This commit is contained in:
@@ -98,6 +98,7 @@ namespace {
|
||||
sizeof(interaction::SessionRecording) +
|
||||
sizeof(properties::PropertyOwner) +
|
||||
sizeof(properties::PropertyOwner) +
|
||||
sizeof(properties::PropertyOwner) +
|
||||
sizeof(scripting::ScriptEngine) +
|
||||
sizeof(scripting::ScriptScheduler) +
|
||||
sizeof(Profile);
|
||||
@@ -345,6 +346,14 @@ void create() {
|
||||
screenSpaceRootPropertyOwner = new properties::PropertyOwner({ "ScreenSpace" });
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
userPropertyOwner = new (currentPos) properties::PropertyOwner({ "UserProperties" });
|
||||
ghoul_assert(userPropertyOwner, "No userPropertyOwner");
|
||||
currentPos += sizeof(properties::PropertyOwner);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
userPropertyOwner = new properties::PropertyOwner({ "UserProperties" });
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
scriptEngine = new (currentPos) scripting::ScriptEngine;
|
||||
ghoul_assert(scriptEngine, "No scriptEngine");
|
||||
@@ -375,7 +384,6 @@ void initialize() {
|
||||
|
||||
rootPropertyOwner->addPropertySubOwner(global::moduleEngine);
|
||||
|
||||
navigationHandler->setPropertyOwner(global::rootPropertyOwner);
|
||||
// New property subowners also have to be added to the ImGuiModule callback!
|
||||
rootPropertyOwner->addPropertySubOwner(global::navigationHandler);
|
||||
rootPropertyOwner->addPropertySubOwner(global::interactionMonitor);
|
||||
@@ -390,6 +398,8 @@ void initialize() {
|
||||
rootPropertyOwner->addPropertySubOwner(global::luaConsole);
|
||||
rootPropertyOwner->addPropertySubOwner(global::dashboard);
|
||||
|
||||
rootPropertyOwner->addPropertySubOwner(global::userPropertyOwner);
|
||||
|
||||
syncEngine->addSyncable(global::scriptEngine);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user