MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / set_edited_resource

Method set_edited_resource

editor/script/text_editor.cpp:107–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void TextEditor::set_edited_resource(const Ref<Resource> &p_res) {
108 ERR_FAIL_COND(edited_res.is_valid());
109 ERR_FAIL_COND(p_res.is_null());
110
111 edited_res = p_res;
112
113 Ref<TextFile> text_file = edited_res;
114 if (text_file.is_valid()) {
115 code_editor->get_text_editor()->set_text(text_file->get_text());
116 }
117
118 Ref<JSON> json_file = edited_res;
119 if (json_file.is_valid()) {
120 code_editor->get_text_editor()->set_text(json_file->get_parsed_text());
121 }
122
123 code_editor->get_text_editor()->clear_undo_history();
124 code_editor->get_text_editor()->tag_saved_version();
125
126 emit_signal(SNAME("name_changed"));
127 code_editor->update_line_and_column();
128}
129
130void TextEditor::enable_editor(Control *p_shortcut_context) {
131 if (editor_enabled) {

Callers 2

_update_type_itemsMethod · 0.45
editMethod · 0.45

Calls 9

get_text_editorMethod · 0.80
clear_undo_historyMethod · 0.80
is_validMethod · 0.45
is_nullMethod · 0.45
set_textMethod · 0.45
get_textMethod · 0.45
get_parsed_textMethod · 0.45
tag_saved_versionMethod · 0.45

Tested by

no test coverage detected