diff options
Diffstat (limited to 'tools/editor/plugins/script_editor_plugin.cpp')
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index e6e90eb0db..5b1dd37a61 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -935,6 +935,9 @@ void ScriptEditor::_menu_option(int p_option) { if (!_test_script_times_on_disk()) return; + save_all_scripts(); + +#if 0 for(int i=0;i<tab_container->get_child_count();i++) { ScriptTextEditor *ste = tab_container->get_child(i)->cast_to<ScriptTextEditor>(); @@ -951,7 +954,7 @@ void ScriptEditor::_menu_option(int p_option) { editor->save_resource( script ); } - +#endif } break; case SEARCH_HELP: { @@ -1938,9 +1941,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { } } -void ScriptEditor::save_external_data() { - - apply_scripts(); +void ScriptEditor::save_all_scripts() { for(int i=0;i<tab_container->get_child_count();i++) { @@ -1949,9 +1950,13 @@ void ScriptEditor::save_external_data() { if (!ste) continue; + if (ste->get_text_edit()->get_version()==ste->get_text_edit()->get_saved_version()) + continue; + Ref<Script> script = ste->get_edited_script(); if (script->get_path()!="" && script->get_path().find("local://")==-1 &&script->get_path().find("::")==-1) { //external script, save it + ste->apply_code(); editor->save_resource(script); //ResourceSaver::save(script->get_path(),script); } @@ -2063,7 +2068,7 @@ void ScriptEditor::_editor_settings_changed() { void ScriptEditor::_autosave_scripts() { print_line("autosaving"); - save_external_data(); + save_all_scripts(); } void ScriptEditor::_tree_changed() { @@ -2628,7 +2633,7 @@ void ScriptEditorPlugin::clear() { void ScriptEditorPlugin::save_external_data() { - script_editor->save_external_data(); + script_editor->save_all_scripts(); } void ScriptEditorPlugin::apply_changes() { |