diff --git a/data/assets/scene/digitaluniverse/grids.asset b/data/assets/scene/digitaluniverse/grids.asset index 56ae14703a..c0b5341290 100644 --- a/data/assets/scene/digitaluniverse/grids.asset +++ b/data/assets/scene/digitaluniverse/grids.asset @@ -270,7 +270,8 @@ local Plane1lh = { }, GUI = { Name = "1lh Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = LightHour } } @@ -301,7 +302,8 @@ local Plane1ld = { }, GUI = { Name = "1ld Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = LightDay } } @@ -332,7 +334,8 @@ local Plane1lm = { }, GUI = { Name = "1lm Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = LightMonth } } @@ -363,7 +366,8 @@ local Plane1ly = { }, GUI = { Name = "1ly Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = LightYear } } @@ -394,7 +398,8 @@ local Plane10ly = { }, GUI = { Name = "10ly Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = 10 * LightYear } } @@ -425,7 +430,8 @@ local Plane100ly = { }, GUI = { Name = "100ly Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = 100 * LightYear } } @@ -456,7 +462,8 @@ local Plane1kly = { }, GUI = { Name = "1kly Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = 1000 * LightYear } } @@ -487,7 +494,8 @@ local Plane10kly = { }, GUI = { Name = "10kly Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = 10000 * LightYear } } @@ -513,7 +521,8 @@ local Plane100kly = { }, GUI = { Name = "100kly Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = 100000 * LightYear } } @@ -539,7 +548,8 @@ local Plane1Mly = { }, GUI = { Name = "1Mly Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = 1E6 * LightYear } } @@ -565,7 +575,8 @@ local Plane10Mly = { }, GUI = { Name = "10Mly Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = 10E6 * LightYear } } @@ -591,7 +602,8 @@ local Plane100Mly = { }, GUI = { Name = "100Mly Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = 100E6 * LightYear } } @@ -617,7 +629,8 @@ local Plane20Gly = { }, GUI = { Name = "20Gly Grid", - Path = "/Other/Grids" + Path = "/Other/Grids", + OrderingNumber = 20E9 * LightYear } } diff --git a/data/assets/util/webgui.asset b/data/assets/util/webgui.asset index 3ee09e3a7c..36dae8ce95 100644 --- a/data/assets/util/webgui.asset +++ b/data/assets/util/webgui.asset @@ -4,7 +4,7 @@ local guiCustomization = asset.require("customization/gui") -- Select which commit hashes to use for the frontend and backend -local frontendHash = "67262b3edb3c33580d73e0bb5a61a0321a0b218e" +local frontendHash = "654c79e7f30e61249b93be509758ac675022e5f3" local frontend = asset.resource({ Identifier = "WebGuiFrontend", diff --git a/include/openspace/scene/scenegraphnode.h b/include/openspace/scene/scenegraphnode.h index fbd426ab14..edb3a9558f 100644 --- a/include/openspace/scene/scenegraphnode.h +++ b/include/openspace/scene/scenegraphnode.h @@ -170,15 +170,17 @@ private: std::vector _onRecedeAction; std::vector _onExitAction; + ghoul::mm_unique_ptr _renderable; + // If this value is 'true' GUIs are asked to hide this node from collections, as it // might be a node that is not very interesting (for example barycenters) properties::BoolProperty _guiHidden; - ghoul::mm_unique_ptr _renderable; - properties::StringProperty _guiPath; properties::StringProperty _guiDisplayName; properties::StringProperty _guiDescription; + properties::FloatProperty _guiOrderingNumber; + properties::BoolProperty _useGuiOrdering; // Transformation defined by translation, rotation and scale struct { diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index 9c72936bb1..55f8064813 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -175,6 +175,23 @@ namespace { openspace::properties::Property::Visibility::Hidden }; + constexpr openspace::properties::Property::PropertyInfo GuiOrderInfo = { + "GuiOrderingNumber", + "Gui Ordering Number", + "This is an optional numerical value that will affect the sorting of this scene " + "graph node in relation to its neighbors in the GUI. Nodes with the same value " + "will be sorted alphabetically.", + openspace::properties::Property::Visibility::Hidden + }; + + constexpr openspace::properties::Property::PropertyInfo UseGuiOrderInfo = { + "UseGuiOrdering", + "Use Gui Ordering", + "If true, use the 'GuiOrderingNumber' to place this scene graph node in a " + "sorted way in relation to its neighbors in the GUI", + openspace::properties::Property::Visibility::Hidden + }; + constexpr openspace::properties::Property::PropertyInfo ShowDebugSphereInfo = { "ShowDebugSphere", "Show Debug Sphere", @@ -309,6 +326,15 @@ namespace { // scene graph node. This is most useful to trim collective lists of nodes and // not display, for example, barycenters std::optional hidden; + + // If this value is specified, the scene graph node will be ordered in + // relation to its neighbors in the GUI based on this value, so that nodes + // with a higher value appear later in the list. Scene graph nodes with the + // same value will be sorted alphabetically. + // + // The nodes without a given value will be placed at the bottom of the list + // and sorted alphabetically. + std::optional orderingNumber; }; // Additional information that is passed to GUI applications. These are all hints // and do not have any impact on the actual function of the scene graph node @@ -362,6 +388,11 @@ ghoul::mm_unique_ptr SceneGraphNode::createFromDictionary( } result->_guiPath = *p.gui->path; } + + result->_useGuiOrdering = p.gui->orderingNumber.has_value(); + if (p.gui->orderingNumber.has_value()) { + result->_guiOrderingNumber = *p.gui->orderingNumber; + } } result->_boundingSphere = p.boundingSphere.value_or(result->_boundingSphere); @@ -512,6 +543,8 @@ SceneGraphNode::SceneGraphNode() , _guiPath(GuiPathInfo, "/") , _guiDisplayName(GuiNameInfo) , _guiDescription(GuiDescriptionInfo) + , _guiOrderingNumber(GuiOrderInfo, 0.f) + , _useGuiOrdering(UseGuiOrderInfo, false) , _transform { ghoul::mm_unique_ptr( global::memoryManager->PersistentMemory.alloc() @@ -593,6 +626,8 @@ SceneGraphNode::SceneGraphNode() addProperty(_guiDescription); addProperty(_guiHidden); addProperty(_guiPath); + addProperty(_guiOrderingNumber); + addProperty(_useGuiOrdering); } SceneGraphNode::~SceneGraphNode() {}