Suppress surface upgrade warnings when showing SurfaceUpgradeTool warning

Also ensure the EditorProgress dialogue shows correct numbers
This commit is contained in:
clayjohn 2023-11-22 15:35:50 -07:00
parent fa4a65387e
commit 549a83eee2
1 changed files with 7 additions and 3 deletions

View File

@ -76,6 +76,7 @@ void SurfaceUpgradeTool::_try_show_popup() {
} else { } else {
singleton->_show_popup(); singleton->_show_popup();
} }
RS::get_singleton()->set_warn_on_surface_upgrade(false);
} }
void SurfaceUpgradeTool::_show_popup() { void SurfaceUpgradeTool::_show_popup() {
@ -122,11 +123,13 @@ void SurfaceUpgradeTool::finish_upgrade() {
// Update all meshes here. // Update all meshes here.
Vector<String> resave_paths = EditorSettings::get_singleton()->get_project_metadata("surface_upgrade_tool", "resave_paths", Vector<String>()); Vector<String> resave_paths = EditorSettings::get_singleton()->get_project_metadata("surface_upgrade_tool", "resave_paths", Vector<String>());
EditorProgress ep("surface_upgrade_resave", TTR("Upgrading All Meshes in Project"), resave_paths.size()); Vector<String> reimport_paths = EditorSettings::get_singleton()->get_project_metadata("surface_upgrade_tool", "reimport_paths", Vector<String>());
EditorProgress ep("surface_upgrade_resave", TTR("Upgrading All Meshes in Project"), resave_paths.size() + reimport_paths.size());
int step = 0;
for (const String &file_path : resave_paths) { for (const String &file_path : resave_paths) {
Ref<Resource> res = ResourceLoader::load(file_path); Ref<Resource> res = ResourceLoader::load(file_path);
ep.step(TTR("Attempting to re-save ") + file_path); ep.step(TTR("Attempting to re-save ") + file_path, step++);
if (res.is_valid()) { if (res.is_valid()) {
// Ignore things that fail to load. // Ignore things that fail to load.
ResourceSaver::save(res); ResourceSaver::save(res);
@ -135,7 +138,6 @@ void SurfaceUpgradeTool::finish_upgrade() {
EditorSettings::get_singleton()->set_project_metadata("surface_upgrade_tool", "resave_paths", Vector<String>()); EditorSettings::get_singleton()->set_project_metadata("surface_upgrade_tool", "resave_paths", Vector<String>());
// Remove the imported scenes/meshes from .import so they will be reimported automatically after this. // Remove the imported scenes/meshes from .import so they will be reimported automatically after this.
Vector<String> reimport_paths = EditorSettings::get_singleton()->get_project_metadata("surface_upgrade_tool", "reimport_paths", Vector<String>());
for (const String &file_path : reimport_paths) { for (const String &file_path : reimport_paths) {
Ref<ConfigFile> config; Ref<ConfigFile> config;
config.instantiate(); config.instantiate();
@ -150,6 +152,8 @@ void SurfaceUpgradeTool::finish_upgrade() {
continue; continue;
} }
ep.step(TTR("Attempting to remove ") + remap_path, step++);
String path = OS::get_singleton()->get_resource_dir() + remap_path.replace_first("res://", "/"); String path = OS::get_singleton()->get_resource_dir() + remap_path.replace_first("res://", "/");
print_verbose("Moving to trash: " + path); print_verbose("Moving to trash: " + path);
err = OS::get_singleton()->move_to_trash(path); err = OS::get_singleton()->move_to_trash(path);