diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-12-09 21:45:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-09 21:45:05 +0100 |
commit | dc54ee18ae34338d40dd44a55414c7f3ffc54f2d (patch) | |
tree | 9535afdcbf395b7305e11585a2f5228090cc3257 /editor | |
parent | 05905b08e79e9d65fac47b571dd611f9ec846d17 (diff) | |
parent | 86eb6951c76550ee2a8e874019e15e27a4d20c42 (diff) |
Merge pull request #24236 from Xrayez/fix-20212
Fix duplicating visual shader nodes
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index b084fe1915..f55adf6c7d 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -636,13 +636,15 @@ void VisualShaderEditor::_duplicate_nodes() { for (int i = 0; i < graph->get_child_count(); i++) { - if (Object::cast_to<GraphNode>(graph->get_child(i))) { - int id = String(graph->get_child(i)->get_name()).to_int(); + GraphNode *gn = Object::cast_to<GraphNode>(graph->get_child(i)); + if (gn) { + int id = String(gn->get_name()).to_int(); Ref<VisualShaderNode> node = visual_shader->get_node(type, id); Ref<VisualShaderNodeOutput> output = node; - if (output.is_valid()) //can't duplicate output + if (output.is_valid()) { // can't duplicate output continue; - if (node.is_valid()) { + } + if (node.is_valid() && gn->is_selected()) { nodes.push_back(id); } } |