mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Block Tween custom_step() during step
This commit is contained in:
parent
9a3976097f
commit
b615c7b3db
2 changed files with 8 additions and 2 deletions
|
|
@ -303,6 +303,8 @@ Ref<Tween> Tween::chain() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Tween::custom_step(double p_delta) {
|
bool Tween::custom_step(double p_delta) {
|
||||||
|
ERR_FAIL_COND_V_MSG(in_step, true, "Can't call custom_step() during another Tween step.");
|
||||||
|
|
||||||
bool r = running;
|
bool r = running;
|
||||||
running = true;
|
running = true;
|
||||||
bool ret = step(p_delta);
|
bool ret = step(p_delta);
|
||||||
|
|
@ -329,6 +331,7 @@ bool Tween::step(double p_delta) {
|
||||||
if (!running) {
|
if (!running) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
in_step = true;
|
||||||
|
|
||||||
if (!started) {
|
if (!started) {
|
||||||
if (tweeners.is_empty()) {
|
if (tweeners.is_empty()) {
|
||||||
|
|
@ -339,6 +342,7 @@ bool Tween::step(double p_delta) {
|
||||||
} else {
|
} else {
|
||||||
tween_id = to_string();
|
tween_id = to_string();
|
||||||
}
|
}
|
||||||
|
in_step = false;
|
||||||
ERR_FAIL_V_MSG(false, tween_id + ": started with no Tweeners.");
|
ERR_FAIL_V_MSG(false, tween_id + ": started with no Tweeners.");
|
||||||
}
|
}
|
||||||
current_step = 0;
|
current_step = 0;
|
||||||
|
|
@ -357,7 +361,7 @@ bool Tween::step(double p_delta) {
|
||||||
bool potential_infinite = false;
|
bool potential_infinite = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (rem_delta > 0 && running) {
|
while (running && rem_delta > 0) {
|
||||||
double step_delta = rem_delta;
|
double step_delta = rem_delta;
|
||||||
step_active = false;
|
step_active = false;
|
||||||
|
|
||||||
|
|
@ -392,6 +396,7 @@ bool Tween::step(double p_delta) {
|
||||||
potential_infinite = true;
|
potential_infinite = true;
|
||||||
} else {
|
} else {
|
||||||
// Looped twice without using any time, this is 100% certain infinite loop.
|
// Looped twice without using any time, this is 100% certain infinite loop.
|
||||||
|
in_step = false;
|
||||||
ERR_FAIL_V_MSG(false, "Infinite loop detected. Check set_loops() description for more info.");
|
ERR_FAIL_V_MSG(false, "Infinite loop detected. Check set_loops() description for more info.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -402,7 +407,7 @@ bool Tween::step(double p_delta) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
in_step = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ private:
|
||||||
bool is_bound = false;
|
bool is_bound = false;
|
||||||
bool started = false;
|
bool started = false;
|
||||||
bool running = true;
|
bool running = true;
|
||||||
|
bool in_step = false;
|
||||||
bool dead = false;
|
bool dead = false;
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
bool default_parallel = false;
|
bool default_parallel = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue