@@ -1304,21 +1304,27 @@ 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+ const 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+ disk_changed_scenes.push_back (scene_path);
13221328 }
13231329 }
13241330
@@ -1327,16 +1333,23 @@ void EditorNode::_scan_external_changes() {
13271333 TreeItem *ti = disk_changed_list->create_item (r);
13281334 ti->set_text (0 , " project.godot" );
13291335 need_reload = true ;
1336+ disk_changed_project = true ;
13301337 }
13311338
13321339 if (need_reload) {
13331340 callable_mp ((Window *)disk_changed, &Window::popup_centered_ratio).call_deferred (0.3 );
13341341 }
13351342}
13361343
1337- void EditorNode::_resave_scenes (String p_str) {
1338- save_all_scenes ();
1339- ProjectSettings::get_singleton ()->save ();
1344+ void EditorNode::_resave_externally_modified_scenes (String p_str) {
1345+ for (const String &scene_path : disk_changed_scenes) {
1346+ _save_scene (scene_path);
1347+ }
1348+
1349+ if (disk_changed_project) {
1350+ ProjectSettings::get_singleton ()->save ();
1351+ }
1352+
13401353 disk_changed->hide ();
13411354}
13421355
@@ -8304,7 +8317,7 @@ EditorNode::EditorNode() {
83048317 disk_changed->set_ok_button_text (TTR (" Reload from disk" ));
83058318
83068319 disk_changed->add_button (TTR (" Ignore external changes" ), !DisplayServer::get_singleton ()->get_swap_cancel_ok (), " resave" );
8307- disk_changed->connect (" custom_action" , callable_mp (this , &EditorNode::_resave_scenes ));
8320+ disk_changed->connect (" custom_action" , callable_mp (this , &EditorNode::_resave_externally_modified_scenes ));
83088321 }
83098322
83108323 gui_base->add_child (disk_changed);
0 commit comments