Merge pull request #81410 from bitsawer/fix_shader_include_reload
Fix shader text editor include file reloading
This commit is contained in:
commit
074931a3aa
@ -179,7 +179,14 @@ void ShaderTextEditor::set_edited_code(const String &p_code) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ShaderTextEditor::reload_text() {
|
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();
|
CodeEdit *te = get_text_editor();
|
||||||
int column = te->get_caret_column();
|
int column = te->get_caret_column();
|
||||||
@ -187,7 +194,7 @@ void ShaderTextEditor::reload_text() {
|
|||||||
int h = te->get_h_scroll();
|
int h = te->get_h_scroll();
|
||||||
int v = te->get_v_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_line(row);
|
||||||
te->set_caret_column(column);
|
te->set_caret_column(column);
|
||||||
te->set_h_scroll(h);
|
te->set_h_scroll(h);
|
||||||
|
Loading…
Reference in New Issue
Block a user