summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-09-21 10:49:10 +0200
committerGitHub <noreply@github.com>2021-09-21 10:49:10 +0200
commitbe63fdff8031bf5fdb0b068cb10b22566f98f7d0 (patch)
tree96be93238d61a55ea8cf089b5a0c3f9761aba977
parent40eabbb12055acc7b35f6480aed9c6cfc9375561 (diff)
parent662da453a40f3e153357ec59f4055508ef4cebd9 (diff)
Merge pull request #52605 from TokageItLab/fixed-vtype-in-node-oneshot
Fixed value type and applied small change in `AnimationNodeOneShot`
-rw-r--r--scene/animation/animation_blend_tree.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 91755b5824..af186072ac 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -248,27 +248,26 @@ double AnimationNodeOneShot::process(double p_time, bool p_seek) {
if (fade_in > 0) {
blend = time / fade_in;
} else {
- blend = 0; //wtf
+ blend = 0;
}
-
- } else if (!do_start && remaining < fade_out) {
- if (fade_out) {
+ } else if (!do_start && remaining <= fade_out) {
+ if (fade_out > 0) {
blend = (remaining / fade_out);
} else {
- blend = 1.0;
+ blend = 0;
}
} else {
blend = 1.0;
}
- float main_rem;
+ double main_rem;
if (mix == MIX_MODE_ADD) {
main_rem = blend_input(0, p_time, p_seek, 1.0, FILTER_IGNORE, !sync);
} else {
main_rem = blend_input(0, p_time, p_seek, 1.0 - blend, FILTER_BLEND, !sync);
}
- float os_rem = blend_input(1, os_seek ? time : p_time, os_seek, blend, FILTER_PASS, false);
+ double os_rem = blend_input(1, os_seek ? time : p_time, os_seek, blend, FILTER_PASS, false);
if (do_start) {
remaining = os_rem;