Merge pull request #94263 from Arnklit/collapse_expand_remote_scene_view

Add Expand/Collapse Branch right click option to remote scene view
This commit is contained in:
Rémi Verschelde 2024-09-03 16:13:41 +02:00
commit 5a374548fa
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 17 additions and 0 deletions

View File

@ -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();
}
}
}

View File

@ -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;