@@ -1298,24 +1298,27 @@ void EditorNode::_remove_lock_file() {
1298
1298
OS::get_singleton ()->remove_lock_file ();
1299
1299
}
1300
1300
1301
+ bool EditorNode::_is_scene_externally_modified (int scene_index) {
1302
+ Ref<DirAccess> dir_access = DirAccess::create (DirAccess::ACCESS_RESOURCES);
1303
+ if (editor_data.get_scene_path (scene_index) == " " || !dir_access->file_exists (editor_data.get_scene_path (scene_index))) {
1304
+ return false ;
1305
+ }
1306
+
1307
+ uint64_t last_date = editor_data.get_scene_modified_time (scene_index);
1308
+ uint64_t date = FileAccess::get_modified_time (editor_data.get_scene_path (scene_index));
1309
+
1310
+ return date > last_date;
1311
+ }
1312
+
1301
1313
void EditorNode::_scan_external_changes () {
1302
1314
disk_changed_list->clear ();
1303
1315
TreeItem *r = disk_changed_list->create_item ();
1304
1316
disk_changed_list->set_hide_root (true );
1305
1317
bool need_reload = false ;
1306
1318
1307
1319
// Check if any edited scene has changed.
1308
-
1309
1320
for (int i = 0 ; i < editor_data.get_edited_scene_count (); i++) {
1310
- Ref<DirAccess> da = DirAccess::create (DirAccess::ACCESS_RESOURCES);
1311
- if (editor_data.get_scene_path (i) == " " || !da->file_exists (editor_data.get_scene_path (i))) {
1312
- continue ;
1313
- }
1314
-
1315
- uint64_t last_date = editor_data.get_scene_modified_time (i);
1316
- uint64_t date = FileAccess::get_modified_time (editor_data.get_scene_path (i));
1317
-
1318
- if (date > last_date) {
1321
+ if (_is_scene_externally_modified (i)) {
1319
1322
TreeItem *ti = disk_changed_list->create_item (r);
1320
1323
ti->set_text (0 , editor_data.get_scene_path (i).get_file ());
1321
1324
need_reload = true ;
@@ -2152,7 +2155,7 @@ void EditorNode::restart_editor(bool p_goto_project_manager) {
2152
2155
void EditorNode::_save_all_scenes () {
2153
2156
scenes_to_save_as.clear (); // In case saving was canceled before.
2154
2157
for (int i = 0 ; i < editor_data.get_edited_scene_count (); i++) {
2155
- if (!_is_scene_unsaved (i)) {
2158
+ if (!_is_scene_unsaved (i) && ! _is_scene_externally_modified (i) ) {
2156
2159
continue ;
2157
2160
}
2158
2161
0 commit comments