@@ -5356,6 +5356,11 @@ bool EditorNode::is_object_of_custom_type(const Object *p_object, const StringNa
5356
5356
// Used to track the progress of tasks in the CLI output (since we don't have any other frame of reference).
5357
5357
static HashMap<String, int > progress_total_steps;
5358
5358
5359
+ static String last_progress_task;
5360
+ static String last_progress_state;
5361
+ static int last_progress_step = 0 ;
5362
+ static double last_progress_time = 0 ;
5363
+
5359
5364
void EditorNode::progress_add_task (const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) {
5360
5365
if (!singleton) {
5361
5366
return ;
@@ -5371,8 +5376,18 @@ bool EditorNode::progress_task_step(const String &p_task, const String &p_state,
5371
5376
if (!singleton) {
5372
5377
return false ;
5373
5378
} else if (singleton->cmdline_mode ) {
5374
- const int percent = (p_step / float (progress_total_steps[p_task] + 1 )) * 100 ;
5375
- print_line_rich (vformat (" [%4d%% ] [color=gray][b]%s[/b] | %s[/color]" , percent, p_task, p_state));
5379
+ double current_time = USEC_TO_SEC (OS::get_singleton ()->get_ticks_usec ());
5380
+ double elapsed_time = current_time - last_progress_time;
5381
+ if (p_task != last_progress_task || p_state != last_progress_state || p_step != last_progress_step || elapsed_time >= 1.0 ) {
5382
+ // Only print the progress if it's changed since the last print, or if one second has passed.
5383
+ // This prevents multithreaded import from printing the same progress too often, which would bloat the log file.
5384
+ const int percent = (p_step / float (progress_total_steps[p_task] + 1 )) * 100 ;
5385
+ print_line_rich (vformat (" [%4d%% ] [color=gray][b]%s[/b] | %s[/color]" , percent, p_task, p_state));
5386
+ last_progress_task = p_task;
5387
+ last_progress_state = p_state;
5388
+ last_progress_step = p_step;
5389
+ last_progress_time = current_time;
5390
+ }
5376
5391
return false ;
5377
5392
} else if (singleton->progress_dialog ) {
5378
5393
return singleton->progress_dialog ->task_step (p_task, p_state, p_step, p_force_refresh);
0 commit comments