From 44358a586b8b44d4ba7b626c0be010c01f971346 Mon Sep 17 00:00:00 2001 From: kobewi Date: Tue, 4 Nov 2025 11:44:49 +0100 Subject: [PATCH] Update VisualShader on theme changes --- editor/shader/visual_shader_editor_plugin.cpp | 10 ++++++++++ editor/shader/visual_shader_editor_plugin.h | 1 + 2 files changed, 11 insertions(+) diff --git a/editor/shader/visual_shader_editor_plugin.cpp b/editor/shader/visual_shader_editor_plugin.cpp index 3383a855674..a1ad835996b 100644 --- a/editor/shader/visual_shader_editor_plugin.cpp +++ b/editor/shader/visual_shader_editor_plugin.cpp @@ -2630,6 +2630,10 @@ void VisualShaderEditor::_update_graph() { return; } + if (!is_inside_tree()) { + return; + } + VisualShader::Type type = get_current_shader_type(); graph->clear_connections(); @@ -5343,12 +5347,18 @@ void VisualShaderEditor::_notification(int p_what) { if (is_visible_in_tree()) { _update_graph(); + } else { + theme_dirty = true; } update_toggle_files_button(); } break; case NOTIFICATION_VISIBILITY_CHANGED: { update_toggle_files_button(); + if (theme_dirty && is_visible_in_tree()) { + theme_dirty = false; + _update_graph(); + } } break; case NOTIFICATION_DRAG_BEGIN: { diff --git a/editor/shader/visual_shader_editor_plugin.h b/editor/shader/visual_shader_editor_plugin.h index e35a6d08adc..54af23a15c5 100644 --- a/editor/shader/visual_shader_editor_plugin.h +++ b/editor/shader/visual_shader_editor_plugin.h @@ -235,6 +235,7 @@ class VisualShaderEditor : public ShaderEditor { CheckBox *custom_mode_box = nullptr; bool custom_mode_enabled = false; + bool theme_dirty = false; bool pending_update_preview = false; bool shader_error = false; AcceptDialog *code_preview_window = nullptr;