Skip to content

Commit ce04e24

Browse files
authored
Merge pull request #36 from adriengivry/feature/expand_hierarchy_on_selection
Expand hierarchy on actor selection
2 parents 55f38df + 06908bf commit ce04e24

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)