Skip to content

Commit 06908bf

Browse files
author
Adrien GIVRY
committed
Expand hierarchy on actor selection
The hierarchy now automatically expand itself to show the selected actor. Recursive TreeNode parents of the select actor will expand.
1 parent d433bce commit 06908bf

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Sources/Overload/OvEditor/src/OvEditor/Panels/Hierarchy.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,26 @@ void OvEditor::Panels::Hierarchy::SelectActorByInstance(OvCore::ECS::Actor& p_ac
223223
SelectActorByWidget(*result->second);
224224
}
225225

226+
void ExpandTreeNode(OvUI::Widgets::Layout::TreeNode& p_toExpand, const OvUI::Widgets::Layout::TreeNode* p_root)
227+
{
228+
p_toExpand.Open();
229+
230+
if (&p_toExpand != p_root && p_toExpand.HasParent())
231+
{
232+
ExpandTreeNode(*static_cast<OvUI::Widgets::Layout::TreeNode*>(p_toExpand.GetParent()), p_root);
233+
}
234+
}
235+
226236
void OvEditor::Panels::Hierarchy::SelectActorByWidget(OvUI::Widgets::Layout::TreeNode & p_widget)
227237
{
228238
UnselectActorsWidgets();
229239

230240
p_widget.selected = true;
241+
242+
if (p_widget.HasParent())
243+
{
244+
ExpandTreeNode(*static_cast<OvUI::Widgets::Layout::TreeNode*>(p_widget.GetParent()), m_sceneRoot);
245+
}
231246
}
232247

233248
void OvEditor::Panels::Hierarchy::AttachActorToParent(OvCore::ECS::Actor & p_actor)

0 commit comments

Comments
 (0)