From 549a83eee2b29b51646a6c319552f45781dcd281 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Wed, 22 Nov 2023 15:35:50 -0700 Subject: [PATCH] Suppress surface upgrade warnings when showing SurfaceUpgradeTool warning Also ensure the EditorProgress dialogue shows correct numbers --- editor/surface_upgrade_tool.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/editor/surface_upgrade_tool.cpp b/editor/surface_upgrade_tool.cpp index 0c0f8555b56..78ebe43c96a 100644 --- a/editor/surface_upgrade_tool.cpp +++ b/editor/surface_upgrade_tool.cpp @@ -76,6 +76,7 @@ void SurfaceUpgradeTool::_try_show_popup() { } else { singleton->_show_popup(); } + RS::get_singleton()->set_warn_on_surface_upgrade(false); } void SurfaceUpgradeTool::_show_popup() { @@ -122,11 +123,13 @@ void SurfaceUpgradeTool::finish_upgrade() { // Update all meshes here. Vector resave_paths = EditorSettings::get_singleton()->get_project_metadata("surface_upgrade_tool", "resave_paths", Vector()); - EditorProgress ep("surface_upgrade_resave", TTR("Upgrading All Meshes in Project"), resave_paths.size()); + Vector reimport_paths = EditorSettings::get_singleton()->get_project_metadata("surface_upgrade_tool", "reimport_paths", Vector()); + 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) { Ref 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()) { // Ignore things that fail to load. ResourceSaver::save(res); @@ -135,7 +138,6 @@ void SurfaceUpgradeTool::finish_upgrade() { EditorSettings::get_singleton()->set_project_metadata("surface_upgrade_tool", "resave_paths", Vector()); // Remove the imported scenes/meshes from .import so they will be reimported automatically after this. - Vector reimport_paths = EditorSettings::get_singleton()->get_project_metadata("surface_upgrade_tool", "reimport_paths", Vector()); for (const String &file_path : reimport_paths) { Ref config; config.instantiate(); @@ -150,6 +152,8 @@ void SurfaceUpgradeTool::finish_upgrade() { continue; } + ep.step(TTR("Attempting to remove ") + remap_path, step++); + String path = OS::get_singleton()->get_resource_dir() + remap_path.replace_first("res://", "/"); print_verbose("Moving to trash: " + path); err = OS::get_singleton()->move_to_trash(path);