MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / progress_task_step

Method progress_task_step

editor/editor_node.cpp:5384–5406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5382}
5383
5384bool EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) {
5385 if (!singleton) {
5386 return false;
5387 } else if (singleton->cmdline_mode) {
5388 double current_time = USEC_TO_SEC(OS::get_singleton()->get_ticks_usec());
5389 double elapsed_time = current_time - last_progress_time;
5390 if (p_task != last_progress_task || p_state != last_progress_state || p_step != last_progress_step || elapsed_time >= 1.0) {
5391 // Only print the progress if it's changed since the last print, or if one second has passed.
5392 // This prevents multithreaded import from printing the same progress too often, which would bloat the log file.
5393 const int percent = (p_step / float(progress_total_steps[p_task] + 1)) * 100;
5394 print_line_rich(vformat("[%4d%% ] [color=gray][b]%s[/b] | %s[/color]", percent, p_task, p_state));
5395 last_progress_task = p_task;
5396 last_progress_state = p_state;
5397 last_progress_step = p_step;
5398 last_progress_time = current_time;
5399 }
5400 return false;
5401 } else if (singleton->progress_dialog) {
5402 return singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_refresh);
5403 } else {
5404 return false;
5405 }
5406}
5407
5408void EditorNode::progress_end_task(const String &p_task) {
5409 if (!singleton) {

Callers 2

_find_filesMethod · 0.80
_detect_from_projectMethod · 0.80

Calls 4

print_line_richFunction · 0.85
vformatFunction · 0.85
task_stepMethod · 0.80
get_ticks_usecMethod · 0.45

Tested by

no test coverage detected