aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/progress_dialog.cpp
diff options
context:
space:
mode:
authorreduz2015-12-26 10:27:04 -0300
committerreduz2015-12-26 10:27:04 -0300
commit9d9520f227d58c2499e906d72002cf631e40f4c8 (patch)
treed2f238c5048c4aeb199e28b39117559ccd42318c /tools/editor/progress_dialog.cpp
parent13964f59c1359473980916ea1f930fef1c28331a (diff)
parentdfd7bdb00528eb9a45e21a5c99d0e76bd642e74c (diff)
downloadgodot-9d9520f227d58c2499e906d72002cf631e40f4c8.tar.gz
godot-9d9520f227d58c2499e906d72002cf631e40f4c8.tar.zst
godot-9d9520f227d58c2499e906d72002cf631e40f4c8.zip
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'tools/editor/progress_dialog.cpp')
-rw-r--r--tools/editor/progress_dialog.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/editor/progress_dialog.cpp b/tools/editor/progress_dialog.cpp
index c8b87486c..90398767e 100644
--- a/tools/editor/progress_dialog.cpp
+++ b/tools/editor/progress_dialog.cpp
@@ -29,7 +29,7 @@
#include "progress_dialog.h"
#include "main/main.h"
#include "message_queue.h"
-
+#include "os/os.h"
void BackgroundProgress::_add_task(const String& p_task,const String& p_label, int p_steps) {
@@ -191,10 +191,16 @@ void ProgressDialog::add_task(const String& p_task,const String& p_label,int p_s
}
-void ProgressDialog::task_step(const String& p_task, const String& p_state, int p_step){
+void ProgressDialog::task_step(const String& p_task, const String& p_state, int p_step,bool p_force_redraw){
ERR_FAIL_COND(!tasks.has(p_task));
+ if (!p_force_redraw) {
+ uint64_t tus = OS::get_singleton()->get_ticks_usec();
+ if (tus-last_progress_tick < 50000) //50ms
+ return;
+ }
+
Task &t=tasks[p_task];
if (p_step<0)
t.progress->set_val(t.progress->get_val()+1);
@@ -202,6 +208,7 @@ void ProgressDialog::task_step(const String& p_task, const String& p_state, int
t.progress->set_val(p_step);
t.state->set_text(p_state);
+ last_progress_tick=OS::get_singleton()->get_ticks_usec();
Main::iteration(); // this will not work on a lot of platforms, so it's only meant for the editor
}
@@ -229,4 +236,5 @@ ProgressDialog::ProgressDialog() {
add_child(main);
main->set_area_as_parent_rect();
set_exclusive(true);
+ last_progress_tick=0;
}