From db04860653552475158484e8afdbb4f593e189e1 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 24 Jul 2021 22:06:12 +0200 Subject: [PATCH] Only print message about lightmap baking if it took at least 1 second --- editor/plugins/baked_lightmap_editor_plugin.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp index cf47d5b6d5f..7f53b4bd0b4 100644 --- a/editor/plugins/baked_lightmap_editor_plugin.cpp +++ b/editor/plugins/baked_lightmap_editor_plugin.cpp @@ -135,11 +135,17 @@ void BakedLightmapEditorPlugin::bake_func_end(uint32_t p_time_started) { } const int time_taken = (OS::get_singleton()->get_ticks_msec() - p_time_started) * 0.001; - print_line(vformat("Done baking lightmaps in %02d:%02d:%02d.", time_taken / 3600, (time_taken % 3600) / 60, time_taken % 60)); - // Request attention in case the user was doing something else. - // Baking lightmaps is likely the editor task that can take the most time, - // so only request the attention for baking lightmaps. - OS::get_singleton()->request_attention(); + if (time_taken >= 1) { + // Only print a message and request attention if baking lightmaps took at least 1 second. + // Otherwise, attempting to bake in an erroneous situation (e.g. no meshes to bake) + // would print the "done baking lightmaps" message and request attention for no good reason. + print_line(vformat("Done baking lightmaps in %02d:%02d:%02d.", time_taken / 3600, (time_taken % 3600) / 60, time_taken % 60)); + + // Request attention in case the user was doing something else. + // Baking lightmaps is likely the editor task that can take the most time, + // so only request the attention for baking lightmaps. + OS::get_singleton()->request_attention(); + } } void BakedLightmapEditorPlugin::_bind_methods() {