diff options
author | Juan Linietsky <juan@godotengine.org> | 2019-03-04 19:37:05 -0300 |
---|---|---|
committer | Juan Linietsky <juan@godotengine.org> | 2019-03-04 19:39:06 -0300 |
commit | 5b77aa6bea291b0c2233f222b50f160ee1c63ac4 (patch) | |
tree | a8f574278d3976b1aab9fca81975de55292d2ee0 /editor/plugins | |
parent | 26c1d1aec8aeb8024bcb885906fcf011dc7aac68 (diff) |
Ensure shader is not set if code did not change
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/shader_editor_plugin.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 020a68a7ed..033a6c56d9 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -47,6 +47,9 @@ Ref<Shader> ShaderTextEditor::get_edited_shader() const { } void ShaderTextEditor::set_edited_shader(const Ref<Shader> &p_shader) { + if (shader == p_shader) { + return; + } shader = p_shader; _load_theme_settings(); @@ -415,6 +418,9 @@ void ShaderEditor::edit(const Ref<Shader> &p_shader) { if (p_shader.is_null() || !p_shader->is_text_shader()) return; + if (shader == p_shader) + return; + shader = p_shader; shader_editor->set_edited_shader(p_shader); @@ -438,8 +444,12 @@ void ShaderEditor::save_external_data() { void ShaderEditor::apply_shaders() { if (shader.is_valid()) { - shader->set_code(shader_editor->get_text_edit()->get_text()); - shader->set_edited(true); + String shader_code = shader->get_code(); + String editor_code = shader_editor->get_text_edit()->get_text(); + if (shader_code != editor_code) { + shader->set_code(editor_code); + shader->set_edited(true); + } } } |