diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-03 16:13:41 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-03 16:13:41 +0200 |
commit | 5a374548fa80bef1745392196c6755547012ba9b (patch) | |
tree | d886b3e7da8e0b5b75272631390f4a9d447eef7e /editor/debugger | |
parent | ec7fc9797234ccdee67e5e289ce4d47bb86601b8 (diff) | |
parent | 5ad7cd33bda68019cdd710807e6df7a20718ca64 (diff) | |
download | redot-engine-5a374548fa80bef1745392196c6755547012ba9b.tar.gz |
Merge pull request #94263 from Arnklit/collapse_expand_remote_scene_view
Add Expand/Collapse Branch right click option to remote scene view
Diffstat (limited to 'editor/debugger')
-rw-r--r-- | editor/debugger/editor_debugger_tree.cpp | 16 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_tree.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index f8ffce0c83..c4d7899b2d 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -124,6 +124,7 @@ void EditorDebuggerTree::_scene_tree_rmb_selected(const Vector2 &p_position, Mou item_menu->clear(); item_menu->add_icon_item(get_editor_theme_icon(SNAME("CreateNewSceneFrom")), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE); item_menu->add_icon_item(get_editor_theme_icon(SNAME("CopyNodePath")), TTR("Copy Node Path"), ITEM_MENU_COPY_NODE_PATH); + item_menu->add_icon_item(get_editor_theme_icon(SNAME("Collapse")), TTR("Expand/Collapse Branch"), ITEM_MENU_EXPAND_COLLAPSE); item_menu->set_position(get_screen_position() + get_local_mouse_position()); item_menu->reset_size(); item_menu->popup(); @@ -359,6 +360,21 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) { } DisplayServer::get_singleton()->clipboard_set(text); } break; + case ITEM_MENU_EXPAND_COLLAPSE: { + TreeItem *s_item = get_selected(); + + if (!s_item) { + s_item = get_root(); + if (!s_item) { + break; + } + } + + bool collapsed = s_item->is_any_collapsed(); + s_item->set_collapsed_recursive(!collapsed); + + ensure_cursor_is_visible(); + } } } diff --git a/editor/debugger/editor_debugger_tree.h b/editor/debugger/editor_debugger_tree.h index dbffb0f219..705df17baf 100644 --- a/editor/debugger/editor_debugger_tree.h +++ b/editor/debugger/editor_debugger_tree.h @@ -43,6 +43,7 @@ private: enum ItemMenu { ITEM_MENU_SAVE_REMOTE_NODE, ITEM_MENU_COPY_NODE_PATH, + ITEM_MENU_EXPAND_COLLAPSE, }; ObjectID inspected_object_id; |