summaryrefslogtreecommitdiff
path: root/scene/animation/animation_player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation/animation_player.cpp')
-rw-r--r--scene/animation/animation_player.cpp65
1 files changed, 29 insertions, 36 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index d8db1973d2..7d91703cf8 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -30,8 +30,8 @@
#include "animation_player.h"
-#include "engine.h"
-#include "message_queue.h"
+#include "core/engine.h"
+#include "core/message_queue.h"
#include "scene/scene_string_names.h"
#include "servers/audio/audio_stream.h"
#ifdef TOOLS_ENABLED
@@ -263,43 +263,36 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
key.id = id;
key.bone_idx = bone_idx;
- if (node_cache_map.has(key)) {
-
- p_anim->node_cache.write[i] = &node_cache_map[key];
- } else {
-
+ if (!node_cache_map.has(key))
node_cache_map[key] = TrackNodeCache();
- p_anim->node_cache.write[i] = &node_cache_map[key];
- p_anim->node_cache[i]->path = a->track_get_path(i);
- p_anim->node_cache[i]->node = child;
- p_anim->node_cache[i]->resource = resource;
- p_anim->node_cache[i]->node_2d = Object::cast_to<Node2D>(child);
- if (a->track_get_type(i) == Animation::TYPE_TRANSFORM) {
- // special cases and caches for transform tracks
-
- // cache spatial
- p_anim->node_cache[i]->spatial = Object::cast_to<Spatial>(child);
- // cache skeleton
- p_anim->node_cache[i]->skeleton = Object::cast_to<Skeleton>(child);
- if (p_anim->node_cache[i]->skeleton) {
-
- if (a->track_get_path(i).get_subname_count() == 1) {
- StringName bone_name = a->track_get_path(i).get_subname(0);
-
- p_anim->node_cache[i]->bone_idx = p_anim->node_cache[i]->skeleton->find_bone(bone_name);
- if (p_anim->node_cache[i]->bone_idx < 0) {
- // broken track (nonexistent bone)
- p_anim->node_cache[i]->skeleton = NULL;
- p_anim->node_cache[i]->spatial = NULL;
- printf("bone is %ls\n", String(bone_name).c_str());
- ERR_CONTINUE(p_anim->node_cache[i]->bone_idx < 0);
- } else {
- }
- } else {
- // no property, just use spatialnode
+ p_anim->node_cache.write[i] = &node_cache_map[key];
+ p_anim->node_cache[i]->path = a->track_get_path(i);
+ p_anim->node_cache[i]->node = child;
+ p_anim->node_cache[i]->resource = resource;
+ p_anim->node_cache[i]->node_2d = Object::cast_to<Node2D>(child);
+ if (a->track_get_type(i) == Animation::TYPE_TRANSFORM) {
+ // special cases and caches for transform tracks
+
+ // cache spatial
+ p_anim->node_cache[i]->spatial = Object::cast_to<Spatial>(child);
+ // cache skeleton
+ p_anim->node_cache[i]->skeleton = Object::cast_to<Skeleton>(child);
+ if (p_anim->node_cache[i]->skeleton) {
+ if (a->track_get_path(i).get_subname_count() == 1) {
+ StringName bone_name = a->track_get_path(i).get_subname(0);
+
+ p_anim->node_cache[i]->bone_idx = p_anim->node_cache[i]->skeleton->find_bone(bone_name);
+ if (p_anim->node_cache[i]->bone_idx < 0) {
+ // broken track (nonexistent bone)
p_anim->node_cache[i]->skeleton = NULL;
+ p_anim->node_cache[i]->spatial = NULL;
+ printf("bone is %ls\n", String(bone_name).c_str());
+ ERR_CONTINUE(p_anim->node_cache[i]->bone_idx < 0);
}
+ } else {
+ // no property, just use spatialnode
+ p_anim->node_cache[i]->skeleton = NULL;
}
}
}
@@ -426,7 +419,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
if (first_key_time == 0.0) {
//ignore, use for transition
if (key_count == 1)
- continue; //with one key we cant do anything
+ continue; //with one key we can't do anything
transition = a->track_get_key_transition(i, 0);
first_key_time = a->track_get_key_time(i, 1);
first_key = 1;