diff options
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/animation_player.cpp | 2 | ||||
-rw-r--r-- | scene/animation/animation_player.h | 10 | ||||
-rw-r--r-- | scene/animation/animation_tree.cpp | 9 | ||||
-rw-r--r-- | scene/animation/animation_tree.h | 1 |
4 files changed, 9 insertions, 13 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 7ec7037dd7..740dad9a1a 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -249,7 +249,7 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) { Vector<StringName> leftover_path; Node *child = parent->get_node_and_resource(a->track_get_path(i), resource, leftover_path); ERR_CONTINUE_MSG(!child, "On Animation: '" + p_anim->name + "', couldn't resolve track: '" + String(a->track_get_path(i)) + "'."); // couldn't find the child node - uint32_t id = resource.is_valid() ? resource->get_instance_id() : child->get_instance_id(); + ObjectID id = resource.is_valid() ? resource->get_instance_id() : child->get_instance_id(); int bone_idx = -1; if (a->track_get_path(i).get_subname_count() == 1 && Object::cast_to<Skeleton>(child)) { diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 06f762e63e..48829b02b9 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -159,17 +159,15 @@ private: struct TrackNodeCacheKey { - uint32_t id; + ObjectID id; int bone_idx; inline bool operator<(const TrackNodeCacheKey &p_right) const { - if (id < p_right.id) - return true; - else if (id > p_right.id) - return false; - else + if (id == p_right.id) return bone_idx < p_right.bone_idx; + else + return id < p_right.id; } }; diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index c28f8dc824..a08cc0927b 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -767,7 +767,7 @@ void AnimationTree::_process_graph(float p_delta) { AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player)); - ObjectID current_animation_player = 0; + ObjectID current_animation_player; if (player) { current_animation_player = player->get_instance_id(); @@ -775,7 +775,7 @@ void AnimationTree::_process_graph(float p_delta) { if (last_animation_player != current_animation_player) { - if (last_animation_player) { + if (last_animation_player.is_valid()) { Object *old_player = ObjectDB::get_instance(last_animation_player); if (old_player) { old_player->disconnect("caches_cleared", this, "_clear_caches"); @@ -1296,7 +1296,7 @@ void AnimationTree::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { _clear_caches(); - if (last_animation_player) { + if (last_animation_player.is_valid()) { Object *player = ObjectDB::get_instance(last_animation_player); if (player) { @@ -1304,7 +1304,7 @@ void AnimationTree::_notification(int p_what) { } } } else if (p_what == NOTIFICATION_ENTER_TREE) { - if (last_animation_player) { + if (last_animation_player.is_valid()) { Object *player = ObjectDB::get_instance(last_animation_player); if (player) { @@ -1584,7 +1584,6 @@ AnimationTree::AnimationTree() { process_pass = 1; started = true; properties_dirty = true; - last_animation_player = 0; } AnimationTree::~AnimationTree() { diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index 0a8dc8109f..8769e2c61d 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -187,7 +187,6 @@ private: setup_pass = 0; process_pass = 0; object = NULL; - object_id = 0; } virtual ~TrackCache() {} }; |