Skip to content

Commit 9d84f3d

Browse files
authored
Merge pull request godotengine#112382 from KoBeWi/visual_update
Update VisualShader on theme changes
2 parents 630938a + 44358a5 commit 9d84f3d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

editor/shader/visual_shader_editor_plugin.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,6 +2630,10 @@ void VisualShaderEditor::_update_graph() {
26302630
return;
26312631
}
26322632

2633+
if (!is_inside_tree()) {
2634+
return;
2635+
}
2636+
26332637
VisualShader::Type type = get_current_shader_type();
26342638

26352639
graph->clear_connections();
@@ -5343,12 +5347,18 @@ void VisualShaderEditor::_notification(int p_what) {
53435347

53445348
if (is_visible_in_tree()) {
53455349
_update_graph();
5350+
} else {
5351+
theme_dirty = true;
53465352
}
53475353
update_toggle_files_button();
53485354
} break;
53495355

53505356
case NOTIFICATION_VISIBILITY_CHANGED: {
53515357
update_toggle_files_button();
5358+
if (theme_dirty && is_visible_in_tree()) {
5359+
theme_dirty = false;
5360+
_update_graph();
5361+
}
53525362
} break;
53535363

53545364
case NOTIFICATION_DRAG_BEGIN: {

editor/shader/visual_shader_editor_plugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ class VisualShaderEditor : public ShaderEditor {
235235
CheckBox *custom_mode_box = nullptr;
236236
bool custom_mode_enabled = false;
237237

238+
bool theme_dirty = false;
238239
bool pending_update_preview = false;
239240
bool shader_error = false;
240241
AcceptDialog *code_preview_window = nullptr;

0 commit comments

Comments
 (0)