MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / update_progress_bg

Method update_progress_bg

utility/task_manager.cpp:330–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330bool TaskManager::update_progress_bg(bool p_force_refresh, bool called_from_process, bool *r_did_redraw) {
331 if (updating_bg || (group_id_to_description.empty() && !Thread::is_main_thread())) {
332 if (r_did_redraw) {
333 *r_did_redraw = false;
334 }
335 return false;
336 }
337 updating_bg = true;
338 bool main_loop_iterating = false;
339 bool canceled = false;
340 Vector<TaskManagerID> task_ids_to_erase;
341 group_id_to_description.for_each_m([&](auto &v) {
342 if (v.second->_is_aborted()) {
343 if (v.second->is_done()) {
344 task_ids_to_erase.push_back(v.first);
345 }
346 } else {
347 if (v.second->is_progress_enabled() && v.second->is_started()) {
348 main_loop_iterating = true;
349 v.second->update_progress(false);
350 }
351 if (v.second->is_canceled()) {
352 canceled = true;
353 }
354 }
355 });
356 for (auto &task_id : task_ids_to_erase) {
357 group_id_to_description.erase(task_id);
358 }
359 if (p_force_refresh && main_loop_iterating && GDREProgressDialog::is_safe_to_redraw() && GDREProgressDialog::get_singleton()) {
360 bool did_redraw = GDREProgressDialog::get_singleton()->main_thread_update();
361 if (r_did_redraw) {
362 *r_did_redraw = did_redraw;
363 }
364 }
365 // TODO: remove this, move it into main loop
366 // this should only be called if this wasn't called from `GodotREEditorStandalone::process()` and there are tasks in the queue and none of them have progress enabled
367 if (!called_from_process && !main_loop_iterating && Thread::is_main_thread() && !MessageQueue::get_singleton()->is_flushing() && group_id_to_description.size() > 0) {
368 GDRESettings::main_iteration();
369 if (r_did_redraw) {
370 *r_did_redraw = true;
371 }
372 }
373 updating_bg = false;
374 return canceled;
375}
376
377void TaskManager::set_thread_task_id(TaskManagerID p_task_manager_id) {
378 if (Thread::is_main_thread()) {

Callers 4

list_dirMethod · 0.80
list_dirMethod · 0.80
batch_export_filesMethod · 0.80
_notificationMethod · 0.80

Calls 12

for_each_mMethod · 0.80
_is_abortedMethod · 0.80
push_backMethod · 0.80
is_progress_enabledMethod · 0.80
is_startedMethod · 0.80
update_progressMethod · 0.80
main_thread_updateMethod · 0.80
emptyMethod · 0.45
is_doneMethod · 0.45
is_canceledMethod · 0.45
eraseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected