From 623164408a6dc475b88bed56f8abcd0a873a6d84 Mon Sep 17 00:00:00 2001 From: LuoZhihao Date: Tue, 17 Jun 2025 20:24:35 +0800 Subject: [PATCH] Fix editing `ShaderInclude` causes a `Shader` to be edited --- editor/plugins/shader_editor_plugin.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 618888e079..101c23d46f 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -382,6 +382,13 @@ void ShaderEditorPlugin::_shader_selected(int p_index) { shader_tabs->set_current_tab(p_index); shader_list->select(p_index); + + // Avoid `Shader` being edited when editing `ShaderInclude` due to inspector refreshing. + if (edited_shaders[p_index].shader.is_valid()) { + EditorNode::get_singleton()->push_item_no_inspector(edited_shaders[p_index].shader.ptr()); + } else { + EditorNode::get_singleton()->push_item_no_inspector(edited_shaders[p_index].shader_inc.ptr()); + } } void ShaderEditorPlugin::_shader_list_clicked(int p_item, Vector2 p_local_mouse_pos, MouseButton p_mouse_button_index) {