Add new property hint to determine if a scene graph node should focusable (#3508)

This commit is contained in:
Alexander Bock
2025-02-10 17:57:31 +01:00
committed by GitHub
parent b93c284551
commit bc4a137040
2 changed files with 16 additions and 0 deletions

View File

@@ -181,6 +181,7 @@ private:
properties::StringProperty _guiDisplayName;
properties::StringProperty _guiDescription;
properties::BoolProperty _useGuiOrdering;
properties::BoolProperty _guiFocusable;
properties::FloatProperty _guiOrderingNumber;
// Transformation defined by translation, rotation and scale

View File

@@ -193,6 +193,15 @@ namespace {
openspace::properties::Property::Visibility::Hidden
};
constexpr openspace::properties::Property::PropertyInfo GuiFocusableInfo = {
"IsFocusable",
"Focusable Hint",
"This value serves as a hint to determine if it makes sense to focus the camera "
"on this scene graph node. It only serves as a hint and does not actually "
"prevent the focussing. The default value is `true`.",
openspace::properties::Property::Visibility::Hidden
};
constexpr openspace::properties::Property::PropertyInfo ShowDebugSphereInfo = {
"ShowDebugSphere",
"Show Debug Sphere",
@@ -330,6 +339,9 @@ namespace {
// not display, for example, barycenters
std::optional<bool> hidden;
// [[codegen::verbatim(GuiFocusableInfo.description)]]
std::optional<bool> focusable;
// 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
@@ -396,6 +408,7 @@ ghoul::mm_unique_ptr<SceneGraphNode> SceneGraphNode::createFromDictionary(
if (p.gui->orderingNumber.has_value()) {
result->_guiOrderingNumber = *p.gui->orderingNumber;
}
result->_guiFocusable = p.gui->focusable.value_or(result->_guiFocusable);
}
result->_boundingSphere = p.boundingSphere.value_or(result->_boundingSphere);
@@ -541,6 +554,7 @@ SceneGraphNode::SceneGraphNode()
, _guiDisplayName(GuiNameInfo)
, _guiDescription(GuiDescriptionInfo)
, _useGuiOrdering(UseGuiOrderInfo, false)
, _guiFocusable(GuiFocusableInfo, true)
, _guiOrderingNumber(GuiOrderInfo, 0.f)
, _transform {
ghoul::mm_unique_ptr<Translation>(
@@ -625,6 +639,7 @@ SceneGraphNode::SceneGraphNode()
addProperty(_guiPath);
addProperty(_guiOrderingNumber);
addProperty(_useGuiOrdering);
addProperty(_guiFocusable);
}
SceneGraphNode::~SceneGraphNode() {}