summaryrefslogtreecommitdiff
path: root/scene/animation
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/animation_player.cpp17
-rw-r--r--scene/animation/animation_player.h1
-rw-r--r--scene/animation/animation_tree_player.cpp7
-rw-r--r--scene/animation/animation_tree_player.h2
4 files changed, 15 insertions, 12 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 9db4a5fb04..eca7caeaf0 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -182,8 +182,8 @@ void AnimationPlayer::_notification(int p_what) {
if (!processing) {
//make sure that a previous process state was not saved
//only process if "processing" is set
- set_physics_process(false);
- set_process(false);
+ set_physics_process_internal(false);
+ set_process_internal(false);
}
//_set_process(false);
clear_caches();
@@ -590,9 +590,7 @@ void AnimationPlayer::_animation_update_transforms() {
Transform t;
t.origin = nc->loc_accum;
- t.basis = nc->rot_accum;
- t.basis.scale(nc->scale_accum);
-
+ t.basis.set_quat_scale(nc->rot_accum, nc->scale_accum);
if (nc->skeleton && nc->bone_idx >= 0) {
nc->skeleton->set_bone_pose(nc->bone_idx, t);
@@ -1010,6 +1008,7 @@ void AnimationPlayer::stop(bool p_reset) {
c.blend.clear();
if (p_reset) {
c.current.from = NULL;
+ c.current.speed_scale = 1;
}
_set_process(false);
queued.clear();
@@ -1024,6 +1023,13 @@ float AnimationPlayer::get_speed_scale() const {
return speed_scale;
}
+float AnimationPlayer::get_playing_speed() const {
+
+ if (!playing) {
+ return 0;
+ }
+ return speed_scale * playback.current.speed_scale;
+}
void AnimationPlayer::seek(float p_time, bool p_update) {
@@ -1315,6 +1321,7 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_speed_scale", "speed"), &AnimationPlayer::set_speed_scale);
ClassDB::bind_method(D_METHOD("get_speed_scale"), &AnimationPlayer::get_speed_scale);
+ ClassDB::bind_method(D_METHOD("get_playing_speed"), &AnimationPlayer::get_playing_speed);
ClassDB::bind_method(D_METHOD("set_autoplay", "name"), &AnimationPlayer::set_autoplay);
ClassDB::bind_method(D_METHOD("get_autoplay"), &AnimationPlayer::get_autoplay);
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index ef758bac44..af2022ddac 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -293,6 +293,7 @@ public:
void set_speed_scale(float p_speed);
float get_speed_scale() const;
+ float get_playing_speed() const;
void set_autoplay(const String &p_name);
String get_autoplay() const;
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp
index 89f0e43a86..afdb8b6f71 100644
--- a/scene/animation/animation_tree_player.cpp
+++ b/scene/animation/animation_tree_player.cpp
@@ -812,8 +812,6 @@ void AnimationTreePlayer::_process_animation(float p_delta) {
t.value = t.object->get_indexed(t.subpath);
t.value.zero();
-
- t.skip = false;
}
/* STEP 2 PROCESS ANIMATIONS */
@@ -886,7 +884,7 @@ void AnimationTreePlayer::_process_animation(float p_delta) {
Track &t = E->get();
- if (t.skip || !t.object)
+ if (!t.object)
continue;
if (t.subpath.size()) { // value track
@@ -895,13 +893,12 @@ void AnimationTreePlayer::_process_animation(float p_delta) {
}
Transform xform;
- xform.basis = t.rot;
xform.origin = t.loc;
t.scale.x += 1.0;
t.scale.y += 1.0;
t.scale.z += 1.0;
- xform.basis.scale(t.scale);
+ xform.basis.set_quat_scale(t.rot, t.scale);
if (t.bone_idx >= 0) {
if (t.skeleton)
diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h
index 09d6f6fcb4..873ff8a9da 100644
--- a/scene/animation/animation_tree_player.h
+++ b/scene/animation/animation_tree_player.h
@@ -107,8 +107,6 @@ private:
Vector3 scale;
Variant value;
-
- bool skip;
};
typedef Map<TrackKey, Track> TrackMap;