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

Method _resave_scripts

editor/script/script_editor_plugin.cpp:1047–1086  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1045}
1046
1047void ScriptEditor::_resave_scripts(const String &p_str) {
1048 apply_scripts();
1049
1050 for (int i = 0; i < tab_container->get_tab_count(); i++) {
1051 ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
1052 if (!se) {
1053 continue;
1054 }
1055
1056 Ref<Resource> scr = se->get_edited_resource();
1057
1058 if (scr->is_built_in()) {
1059 continue; // Internal script, who cares.
1060 }
1061
1062 if (trim_trailing_whitespace_on_save) {
1063 se->trim_trailing_whitespace();
1064 }
1065
1066 if (trim_final_newlines_on_save) {
1067 se->trim_final_newlines();
1068 }
1069
1070 if (convert_indent_on_save) {
1071 se->convert_indent();
1072 }
1073
1074 Ref<TextFile> text_file = scr;
1075 if (text_file.is_valid()) {
1076 se->apply_code();
1077 _save_text_file(text_file, text_file->get_path());
1078 break;
1079 } else {
1080 EditorNode::get_singleton()->save_resource(scr);
1081 }
1082 se->tag_saved_version();
1083 }
1084
1085 disk_changed->hide();
1086}
1087
1088void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
1089 for (int i = 0; i < tab_container->get_tab_count(); i++) {

Callers

nothing calls this directly

Calls 13

get_tab_controlMethod · 0.80
is_built_inMethod · 0.80
save_resourceMethod · 0.80
get_tab_countMethod · 0.45
get_edited_resourceMethod · 0.45
trim_final_newlinesMethod · 0.45
convert_indentMethod · 0.45
is_validMethod · 0.45
apply_codeMethod · 0.45
get_pathMethod · 0.45
tag_saved_versionMethod · 0.45

Tested by

no test coverage detected