You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Update script modified times when saved in EditorNode
(cherry picked from commit dade8bd66f)
This commit is contained in:
@@ -1867,6 +1867,7 @@ int EditorNode::_save_external_resources(bool p_also_save_external_data) {
|
|||||||
res->set_edited(false);
|
res->set_edited(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool script_was_saved = false;
|
||||||
for (const String &E : edited_resources) {
|
for (const String &E : edited_resources) {
|
||||||
Ref<Resource> res = ResourceCache::get_ref(E);
|
Ref<Resource> res = ResourceCache::get_ref(E);
|
||||||
if (res.is_null()) {
|
if (res.is_null()) {
|
||||||
@@ -1876,10 +1877,18 @@ int EditorNode::_save_external_resources(bool p_also_save_external_data) {
|
|||||||
if (ps.is_valid()) {
|
if (ps.is_valid()) {
|
||||||
continue; // Do not save PackedScenes, this will mess up the editor.
|
continue; // Do not save PackedScenes, this will mess up the editor.
|
||||||
}
|
}
|
||||||
|
if (!script_was_saved) {
|
||||||
|
Ref<Script> scr = res;
|
||||||
|
script_was_saved = scr.is_valid();
|
||||||
|
}
|
||||||
ResourceSaver::save(res, res->get_path(), flg);
|
ResourceSaver::save(res, res->get_path(), flg);
|
||||||
saved++;
|
saved++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (script_was_saved) {
|
||||||
|
ScriptEditor::get_singleton()->update_script_times();
|
||||||
|
}
|
||||||
|
|
||||||
if (p_also_save_external_data) {
|
if (p_also_save_external_data) {
|
||||||
for (int i = 0; i < editor_data.get_editor_plugin_count(); i++) {
|
for (int i = 0; i < editor_data.get_editor_plugin_count(); i++) {
|
||||||
EditorPlugin *plugin = editor_data.get_editor_plugin(i);
|
EditorPlugin *plugin = editor_data.get_editor_plugin(i);
|
||||||
|
|||||||
@@ -2817,6 +2817,15 @@ void ScriptEditor::save_all_scripts() {
|
|||||||
_update_script_names();
|
_update_script_names();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptEditor::update_script_times() {
|
||||||
|
for (int i = 0; i < tab_container->get_tab_count(); i++) {
|
||||||
|
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
|
||||||
|
if (se) {
|
||||||
|
se->edited_file_data.last_modified_time = FileAccess::get_modified_time(se->edited_file_data.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptEditor::apply_scripts() const {
|
void ScriptEditor::apply_scripts() const {
|
||||||
for (int i = 0; i < tab_container->get_tab_count(); i++) {
|
for (int i = 0; i < tab_container->get_tab_count(); i++) {
|
||||||
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
|
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
|
||||||
|
|||||||
@@ -569,6 +569,7 @@ public:
|
|||||||
PackedStringArray get_unsaved_scripts() const;
|
PackedStringArray get_unsaved_scripts() const;
|
||||||
void save_current_script();
|
void save_current_script();
|
||||||
void save_all_scripts();
|
void save_all_scripts();
|
||||||
|
void update_script_times();
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user