summaryrefslogtreecommitdiff
path: root/editor/plugins/visual_shader_editor_plugin.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-17 13:10:04 +0200
committerGitHub <noreply@github.com>2022-05-17 13:10:04 +0200
commit350682593067b310843fe069a676fbc62f5978a9 (patch)
tree86657eb2e95b7593bd5b338571e11a4ddc3e11dc /editor/plugins/visual_shader_editor_plugin.cpp
parentccdd85d8e709e27a173fff9bc314cc4e31240d7b (diff)
parentc84d05098020db943223b552a281935ee7a32e12 (diff)
Merge pull request #61112 from Chaosus/graph_edit_delete_nodes_param
Diffstat (limited to 'editor/plugins/visual_shader_editor_plugin.cpp')
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 9ad49e32af..c5669f3eda 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -3409,16 +3409,23 @@ void VisualShaderEditor::_delete_node_request(int p_type, int p_node) {
undo_redo->commit_action();
}
-void VisualShaderEditor::_delete_nodes_request() {
+void VisualShaderEditor::_delete_nodes_request(const TypedArray<StringName> &p_nodes) {
List<int> to_erase;
- for (int i = 0; i < graph->get_child_count(); i++) {
- GraphNode *gn = Object::cast_to<GraphNode>(graph->get_child(i));
- if (gn) {
- if (gn->is_selected() && gn->is_close_button_visible()) {
- to_erase.push_back(gn->get_name().operator String().to_int());
+ if (p_nodes.is_empty()) {
+ // Called from context menu.
+ for (int i = 0; i < graph->get_child_count(); i++) {
+ GraphNode *gn = Object::cast_to<GraphNode>(graph->get_child(i));
+ if (gn) {
+ if (gn->is_selected() && gn->is_close_button_visible()) {
+ to_erase.push_back(gn->get_name().operator String().to_int());
+ }
}
}
+ } else {
+ for (int i = 0; i < p_nodes.size(); i++) {
+ to_erase.push_back(p_nodes[i].operator String().to_int());
+ }
}
if (to_erase.is_empty()) {
@@ -4411,7 +4418,7 @@ void VisualShaderEditor::_node_menu_id_pressed(int p_idx) {
_paste_nodes(true, menu_point);
break;
case NodeMenuOptions::DELETE:
- _delete_nodes_request();
+ _delete_nodes_request(TypedArray<StringName>());
break;
case NodeMenuOptions::DUPLICATE:
_duplicate_nodes();