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

Method save_current_script

editor/script/script_editor_plugin.cpp:2773–2810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2771}
2772
2773void ScriptEditor::save_current_script() {
2774 ScriptEditorBase *current = _get_current_editor();
2775 if (!current || _test_script_times_on_disk()) {
2776 return;
2777 }
2778
2779 if (trim_trailing_whitespace_on_save) {
2780 current->trim_trailing_whitespace();
2781 }
2782
2783 if (trim_final_newlines_on_save) {
2784 current->trim_final_newlines();
2785 }
2786
2787 if (convert_indent_on_save) {
2788 current->convert_indent();
2789 }
2790
2791 Ref<Resource> resource = current->get_edited_resource();
2792 Ref<TextFile> text_file = resource;
2793 Ref<Script> scr = resource;
2794
2795 if (text_file.is_valid()) {
2796 current->apply_code();
2797 _save_text_file(text_file, text_file->get_path());
2798 return;
2799 }
2800
2801 if (scr.is_valid()) {
2802 clear_docs_from_script(scr);
2803 }
2804
2805 EditorNode::get_singleton()->save_resource(resource);
2806
2807 if (scr.is_valid()) {
2808 update_docs_from_script(scr);
2809 }
2810}
2811
2812void ScriptEditor::save_all_scripts() {
2813 HashSet<String> scenes_to_save;

Callers 1

_menu_option_confirmMethod · 0.80

Calls 8

save_resourceMethod · 0.80
trim_final_newlinesMethod · 0.45
convert_indentMethod · 0.45
get_edited_resourceMethod · 0.45
is_validMethod · 0.45
apply_codeMethod · 0.45
get_pathMethod · 0.45

Tested by

no test coverage detected