@@ -1304,21 +1304,28 @@ void EditorNode::_scan_external_changes() {
13041304 disk_changed_list->set_hide_root (true );
13051305 bool need_reload = false ;
13061306
1307- // Check if any edited scene has changed.
1307+ disk_changed_scenes.clear ();
1308+ disk_changed_project = false ;
13081309
1310+ // Check if any edited scene has changed.
13091311 for (int i = 0 ; i < editor_data.get_edited_scene_count (); i++) {
13101312 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)) {
13121317 continue ;
13131318 }
13141319
13151320 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 );
13171322
13181323 if (date > last_date) {
13191324 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 ());
13211326 need_reload = true ;
1327+
1328+ disk_changed_scenes.push_back (scene_path);
13221329 }
13231330 }
13241331
@@ -1327,16 +1334,25 @@ void EditorNode::_scan_external_changes() {
13271334 TreeItem *ti = disk_changed_list->create_item (r);
13281335 ti->set_text (0 , " project.godot" );
13291336 need_reload = true ;
1337+
1338+ disk_changed_project = true ;
13301339 }
13311340
13321341 if (need_reload) {
13331342 callable_mp ((Window *)disk_changed, &Window::popup_centered_ratio).call_deferred (0.3 );
13341343 }
13351344}
13361345
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+
13401356 disk_changed->hide ();
13411357}
13421358
@@ -8293,7 +8309,7 @@ EditorNode::EditorNode() {
82938309 disk_changed->set_ok_button_text (TTR (" Reload from disk" ));
82948310
82958311 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 ));
82978313 }
82988314
82998315 gui_base->add_child (disk_changed);
0 commit comments