summaryrefslogtreecommitdiff
path: root/scene/animation/animation_tree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation/animation_tree.cpp')
-rw-r--r--scene/animation/animation_tree.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 011c4eb470..83ec9f819b 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -1041,7 +1041,22 @@ void AnimationTree::_process_graph(float p_delta) {
t->start = time;
}
} else if (t->playing) {
- if (t->start > time || (t->len > 0 && time - t->start < t->len)) {
+
+ bool loop = a->has_loop();
+
+ bool stop = false;
+
+ if (!loop && time < t->start) {
+ stop = true;
+ } else if (t->len > 0) {
+ float len = t->start > time ? (a->get_length() - t->start) + time : time - t->start;
+
+ if (len > t->len) {
+ stop=true;
+ }
+ }
+
+ if (stop) {
//time to stop
t->object->call("stop");
t->playing = false;
@@ -1050,6 +1065,12 @@ void AnimationTree::_process_graph(float p_delta) {
}
}
+ float db = Math::linear2db(MAX(blend,0.00001));
+ if (t->object->has_method("set_unit_db")) {
+ t->object->call("set_unit_db", db);
+ } else {
+ t->object->call("set_volume_db", db);
+ }
} break;
case Animation::TYPE_ANIMATION: {