From 0f312ecc40e5113bb44bb988f4c3d1db9062cf28 Mon Sep 17 00:00:00 2001 From: Chris Cranford Date: Sun, 30 Jun 2024 18:12:39 -0400 Subject: [PATCH] GH-463 Support bulk frame detachments --- src/editor/graph/graph_node.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/editor/graph/graph_node.cpp b/src/editor/graph/graph_node.cpp index ec51aa6b..841290ab 100644 --- a/src/editor/graph/graph_node.cpp +++ b/src/editor/graph/graph_node.cpp @@ -480,7 +480,10 @@ void OrchestratorGraphNode::_show_context_menu(const Vector2& p_position) { // Anything but comments if (GraphFrame* frame = get_graph()->get_element_frame(get_name())) - _context_menu->add_item("Detach from comment frame", CM_DETACH_FRAME); + { + bool multiple = get_graph()->get_selected_nodes().size() > 1; + _context_menu->add_item(vformat("Detach %s from comment frame", multiple ? "selected nodes" : "node"), CM_DETACH_FRAME); + } } if (!multi_selections) @@ -792,7 +795,8 @@ void OrchestratorGraphNode::_handle_context_menu(int p_id) } case CM_DETACH_FRAME: { - get_graph()->detach_graph_element_from_frame(get_name()); + for (OrchestratorGraphNode* selected : get_graph()->get_selected_nodes()) + get_graph()->detach_graph_element_from_frame(selected->get_name()); break; } #endif