diff options
author | Yuri Roubinsky <chaosus89@gmail.com> | 2019-05-03 11:32:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-03 11:32:13 +0300 |
commit | 184bd3f6e51b674cb53fa30ddbcfd5034d3d0347 (patch) | |
tree | 5cddc8a33a13562ab0357f5fa9d71a402c3892d4 /editor/plugins | |
parent | d9628204533348552fb18c3f28f7b088cb846ca0 (diff) | |
parent | 8a8b7af6380d538827ba89263b920c5357f604a5 (diff) |
Merge pull request #28641 from Chaosus/fix_vs_collapse
Fixed incorrect collapsing visual shader tree
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 2ed2ce4085..f3eb5d1483 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -58,9 +58,15 @@ void VisualShaderNodePlugin::_bind_methods() { void VisualShaderEditor::edit(VisualShader *p_visual_shader) { - bool first_init = false; + bool changed = false; if (p_visual_shader) { - first_init = true; + if (visual_shader.is_null()) { + changed = true; + } else { + if (visual_shader.ptr() != p_visual_shader) { + changed = true; + } + } visual_shader = Ref<VisualShader>(p_visual_shader); } else { visual_shader.unref(); @@ -69,7 +75,7 @@ void VisualShaderEditor::edit(VisualShader *p_visual_shader) { if (visual_shader.is_null()) { hide(); } else { - if (first_init) { // to avoid tree collapse + if (changed) { // to avoid tree collapse _update_options_menu(); } _update_graph(); |