@@ -1304,21 +1304,28 @@ void EditorNode::_scan_external_changes() {
1304
1304
disk_changed_list->set_hide_root (true );
1305
1305
bool need_reload = false ;
1306
1306
1307
- // Check if any edited scene has changed.
1307
+ disk_changed_scenes.clear ();
1308
+ disk_changed_project = false ;
1308
1309
1310
+ // Check if any edited scene has changed.
1309
1311
for (int i = 0 ; i < editor_data.get_edited_scene_count (); i++) {
1310
1312
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))) {
1313
+
1314
+ String scene_path = editor_data.get_scene_path (i);
1315
+
1316
+ if (scene_path == " " || !da->file_exists (scene_path)) {
1312
1317
continue ;
1313
1318
}
1314
1319
1315
1320
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) );
1321
+ uint64_t date = FileAccess::get_modified_time (scene_path );
1317
1322
1318
1323
if (date > last_date) {
1319
1324
TreeItem *ti = disk_changed_list->create_item (r);
1320
- ti->set_text (0 , editor_data. get_scene_path (i) .get_file ());
1325
+ ti->set_text (0 , scene_path .get_file ());
1321
1326
need_reload = true ;
1327
+
1328
+ disk_changed_scenes.push_back (scene_path);
1322
1329
}
1323
1330
}
1324
1331
@@ -1327,16 +1334,25 @@ void EditorNode::_scan_external_changes() {
1327
1334
TreeItem *ti = disk_changed_list->create_item (r);
1328
1335
ti->set_text (0 , " project.godot" );
1329
1336
need_reload = true ;
1337
+
1338
+ disk_changed_project = true ;
1330
1339
}
1331
1340
1332
1341
if (need_reload) {
1333
1342
callable_mp ((Window *)disk_changed, &Window::popup_centered_ratio).call_deferred (0.3 );
1334
1343
}
1335
1344
}
1336
1345
1337
- void EditorNode::_resave_scenes (String p_str) {
1338
- save_all_scenes ();
1339
- ProjectSettings::get_singleton ()->save ();
1346
+ void EditorNode::_resave_externally_modified_scenes (String p_str) {
1347
+ for (uint32_t i = 0 ; i < disk_changed_scenes.size (); i++) {
1348
+ String scene_path = disk_changed_scenes[i];
1349
+ _save_scene (scene_path);
1350
+ }
1351
+
1352
+ if (disk_changed_project) {
1353
+ ProjectSettings::get_singleton ()->save ();
1354
+ }
1355
+
1340
1356
disk_changed->hide ();
1341
1357
}
1342
1358
@@ -8293,7 +8309,7 @@ EditorNode::EditorNode() {
8293
8309
disk_changed->set_ok_button_text (TTR (" Reload from disk" ));
8294
8310
8295
8311
disk_changed->add_button (TTR (" Ignore external changes" ), !DisplayServer::get_singleton ()->get_swap_cancel_ok (), " resave" );
8296
- disk_changed->connect (" custom_action" , callable_mp (this , &EditorNode::_resave_scenes ));
8312
+ disk_changed->connect (" custom_action" , callable_mp (this , &EditorNode::_resave_externally_modified_scenes ));
8297
8313
}
8298
8314
8299
8315
gui_base->add_child (disk_changed);
0 commit comments