| 1399 | } |
| 1400 | |
| 1401 | void EditorNode::_scan_external_changes() { |
| 1402 | disk_changed_list->clear(); |
| 1403 | TreeItem *r = disk_changed_list->create_item(); |
| 1404 | disk_changed_list->set_hide_root(true); |
| 1405 | bool need_reload = false; |
| 1406 | |
| 1407 | disk_changed_scenes.clear(); |
| 1408 | disk_changed_project = false; |
| 1409 | |
| 1410 | // Check if any edited scene has changed. |
| 1411 | for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { |
| 1412 | Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES); |
| 1413 | |
| 1414 | const String scene_path = editor_data.get_scene_path(i); |
| 1415 | |
| 1416 | if (scene_path == "" || !da->file_exists(scene_path)) { |
| 1417 | continue; |
| 1418 | } |
| 1419 | |
| 1420 | uint64_t last_date = editor_data.get_scene_modified_time(i); |
| 1421 | uint64_t date = FileAccess::get_modified_time(scene_path); |
| 1422 | |
| 1423 | if (date > last_date) { |
| 1424 | TreeItem *ti = disk_changed_list->create_item(r); |
| 1425 | ti->set_text(0, scene_path.get_file()); |
| 1426 | need_reload = true; |
| 1427 | disk_changed_scenes.push_back(scene_path); |
| 1428 | } |
| 1429 | } |
| 1430 | |
| 1431 | String project_settings_path = ProjectSettings::get_singleton()->get_resource_path().path_join("project.godot"); |
| 1432 | if (FileAccess::get_modified_time(project_settings_path) > ProjectSettings::get_singleton()->get_last_saved_time()) { |
| 1433 | TreeItem *ti = disk_changed_list->create_item(r); |
| 1434 | ti->set_text(0, "project.godot"); |
| 1435 | need_reload = true; |
| 1436 | disk_changed_project = true; |
| 1437 | } |
| 1438 | |
| 1439 | if (need_reload) { |
| 1440 | callable_mp((Window *)disk_changed, &Window::popup_centered_ratio).call_deferred(0.3); |
| 1441 | } |
| 1442 | } |
| 1443 | |
| 1444 | void EditorNode::_resave_externally_modified_scenes(String p_str) { |
| 1445 | for (const String &scene_path : disk_changed_scenes) { |
nothing calls this directly
no test coverage detected