summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbitsawer <sawerduster@gmail.com>2023-09-07 14:35:26 +0300
committerbitsawer <sawerduster@gmail.com>2023-09-07 14:35:26 +0300
commitd50595c0e90f496e0b67c3d7ea46e69044259fc7 (patch)
tree4d7e0862baf553043ea83dfd84764f66bab1c482
parent8449592d92eaeef990f5502b419d491ee3eeb7a6 (diff)
downloadredot-engine-d50595c0e90f496e0b67c3d7ea46e69044259fc7.tar.gz
Fix shader text editor include file reloading
-rw-r--r--editor/plugins/text_shader_editor.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp
index 935f2250c6..27e32cc8f7 100644
--- a/editor/plugins/text_shader_editor.cpp
+++ b/editor/plugins/text_shader_editor.cpp
@@ -179,7 +179,14 @@ void ShaderTextEditor::set_edited_code(const String &p_code) {
}
void ShaderTextEditor::reload_text() {
- ERR_FAIL_COND(shader.is_null());
+ ERR_FAIL_COND(shader.is_null() && shader_inc.is_null());
+
+ String code;
+ if (shader.is_valid()) {
+ code = shader->get_code();
+ } else {
+ code = shader_inc->get_code();
+ }
CodeEdit *te = get_text_editor();
int column = te->get_caret_column();
@@ -187,7 +194,7 @@ void ShaderTextEditor::reload_text() {
int h = te->get_h_scroll();
int v = te->get_v_scroll();
- te->set_text(shader->get_code());
+ te->set_text(code);
te->set_caret_line(row);
te->set_caret_column(column);
te->set_h_scroll(h);