| 220 | } |
| 221 | |
| 222 | bool GDREProgressDialog::Task::update() { |
| 223 | ERR_FAIL_COND_V(!initialized, false); |
| 224 | if (!vb) { |
| 225 | return false; |
| 226 | } |
| 227 | // 1 frame at 60fps |
| 228 | constexpr uint64_t REDRAW_THRESHOLD = 1000000 / 60; |
| 229 | auto curr_time_us = OS::get_singleton()->get_ticks_usec(); |
| 230 | if (!should_redraw(curr_time_us)) { |
| 231 | if (!is_headless && !(curr_time_us - last_progress_tick >= REDRAW_THRESHOLD && (progress->get_value() != current_step.step || state->get_text() != current_step.state || indeterminate != progress->is_indeterminate() || steps != progress->get_max()))) { |
| 232 | return false; |
| 233 | } |
| 234 | } |
| 235 | force_next_redraw = false; |
| 236 | |
| 237 | if (!is_headless) { |
| 238 | if (indeterminate != progress->is_indeterminate()) { |
| 239 | progress->set_indeterminate(indeterminate); |
| 240 | } |
| 241 | if (steps != progress->get_max()) { |
| 242 | progress->set_max(steps); |
| 243 | } |
| 244 | if (!indeterminate) { |
| 245 | if (progress->get_value() != current_step.step) { |
| 246 | progress->set_value(current_step.step); |
| 247 | } |
| 248 | } |
| 249 | if (state->get_text() != current_step.state) { |
| 250 | state->set_text(current_step.state); |
| 251 | } |
| 252 | } |
| 253 | last_progress_tick = OS::get_singleton()->get_ticks_usec(); |
| 254 | return true; |
| 255 | } |
| 256 | |
| 257 | void GDREProgressDialog::_popup() { |
| 258 | // if (GodotREEditorStandalone::get_singleton()) { |
no test coverage detected