2
0
Эх сурвалжийг харах

-only save scripts if changed, takes less time to run projects and does not confuse you with changed dates.

Juan Linietsky 9 жил өмнө
parent
commit
f026838cbc

+ 11 - 6
tools/editor/plugins/script_editor_plugin.cpp

@@ -935,6 +935,9 @@ void ScriptEditor::_menu_option(int p_option) {
 			if (!_test_script_times_on_disk())
 			if (!_test_script_times_on_disk())
 				return;
 				return;
 
 
+			save_all_scripts();
+
+#if 0
 			for(int i=0;i<tab_container->get_child_count();i++) {
 			for(int i=0;i<tab_container->get_child_count();i++) {
 
 
 				ScriptTextEditor *ste = tab_container->get_child(i)->cast_to<ScriptTextEditor>();
 				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 );
 				editor->save_resource( script );
 			}
 			}
 
 
-
+#endif
 		} break;
 		} break;
 		case SEARCH_HELP: {
 		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++) {
 	for(int i=0;i<tab_container->get_child_count();i++) {
@@ -1949,9 +1950,13 @@ void ScriptEditor::save_external_data() {
 		if (!ste)
 		if (!ste)
 			continue;
 			continue;
 
 
+		if (ste->get_text_edit()->get_version()==ste->get_text_edit()->get_saved_version())
+			continue;
+
 		Ref<Script> script = ste->get_edited_script();
 		Ref<Script> script = ste->get_edited_script();
 		if (script->get_path()!="" && script->get_path().find("local://")==-1 &&script->get_path().find("::")==-1) {
 		if (script->get_path()!="" && script->get_path().find("local://")==-1 &&script->get_path().find("::")==-1) {
 			//external script, save it
 			//external script, save it
+			ste->apply_code();
 			editor->save_resource(script);
 			editor->save_resource(script);
 			//ResourceSaver::save(script->get_path(),script);
 			//ResourceSaver::save(script->get_path(),script);
 		}
 		}
@@ -2063,7 +2068,7 @@ void ScriptEditor::_editor_settings_changed() {
 void ScriptEditor::_autosave_scripts() {
 void ScriptEditor::_autosave_scripts() {
 
 
 	print_line("autosaving");
 	print_line("autosaving");
-	save_external_data();
+	save_all_scripts();
 }
 }
 
 
 void ScriptEditor::_tree_changed() {
 void ScriptEditor::_tree_changed() {
@@ -2628,7 +2633,7 @@ void ScriptEditorPlugin::clear() {
 
 
 void ScriptEditorPlugin::save_external_data() {
 void ScriptEditorPlugin::save_external_data() {
 
 
-	script_editor->save_external_data();
+	script_editor->save_all_scripts();
 }
 }
 
 
 void ScriptEditorPlugin::apply_changes() {
 void ScriptEditorPlugin::apply_changes() {

+ 1 - 1
tools/editor/plugins/script_editor_plugin.h

@@ -295,7 +295,7 @@ public:
 
 
 	void swap_lines(TextEdit *tx, int line1, int line2);
 	void swap_lines(TextEdit *tx, int line1, int line2);
 
 
-	void save_external_data();
+	void save_all_scripts();
 
 
 	void set_window_layout(Ref<ConfigFile> p_layout);
 	void set_window_layout(Ref<ConfigFile> p_layout);
 	void get_window_layout(Ref<ConfigFile> p_layout);
 	void get_window_layout(Ref<ConfigFile> p_layout);