summaryrefslogtreecommitdiffstats
path: root/editor/debugger/editor_debugger_tree.cpp
diff options
context:
space:
mode:
authorKasper Frandsen <kasper.arnklit@gmail.com>2024-07-12 14:33:34 +0100
committerKasper Frandsen <kasper.arnklit@gmail.com>2024-07-12 14:33:34 +0100
commit5ad7cd33bda68019cdd710807e6df7a20718ca64 (patch)
tree2282af7a4079f7a900efa331dd36b387dee65c4b /editor/debugger/editor_debugger_tree.cpp
parent97b8ad1af0f2b4a216f6f1263bef4fbc69e56c7b (diff)
downloadredot-engine-5ad7cd33bda68019cdd710807e6df7a20718ca64.tar.gz
Add collapse/expand right click option to remote scene view
Diffstat (limited to 'editor/debugger/editor_debugger_tree.cpp')
-rw-r--r--editor/debugger/editor_debugger_tree.cpp16
1 files changed, 16 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();
+ }
}
}