Bläddra i källkod

Allocate unique track_blends vector for animation states.
Quick fix for a bug which occurs when blending the result of multiple instanced state machines outputting the same animation, but using filter tracks.

SaracenOne 4 år sedan
förälder
incheckning
18c792fe42
2 ändrade filer med 3 tillägg och 3 borttagningar
  1. 2 2
      scene/animation/animation_tree.cpp
  2. 1 1
      scene/animation/animation_tree.h

+ 2 - 2
scene/animation/animation_tree.cpp

@@ -116,7 +116,7 @@ void AnimationNode::blend_animation(const StringName &p_animation, double p_time
 
 	AnimationState anim_state;
 	anim_state.blend = p_blend;
-	anim_state.track_blends = &blends;
+	anim_state.track_blends = blends;
 	anim_state.delta = p_delta;
 	anim_state.time = p_time;
 	anim_state.animation = animation;
@@ -1124,7 +1124,7 @@ void AnimationTree::_process_graph(double p_delta) {
 				ERR_CONTINUE(!state.track_map.has(path));
 				int blend_idx = state.track_map[path];
 				ERR_CONTINUE(blend_idx < 0 || blend_idx >= state.track_count);
-				real_t blend = (*as.track_blends)[blend_idx] * weight;
+				real_t blend = (as.track_blends)[blend_idx] * weight;
 
 				Animation::TrackType ttype = a->track_get_type(i);
 				if (ttype != Animation::TYPE_POSITION_3D && ttype != Animation::TYPE_ROTATION_3D && ttype != Animation::TYPE_SCALE_3D && track->type != ttype) {

+ 1 - 1
scene/animation/animation_tree.h

@@ -68,7 +68,7 @@ public:
 		Ref<Animation> animation;
 		double time = 0.0;
 		double delta = 0.0;
-		const Vector<real_t> *track_blends = nullptr;
+		Vector<real_t> track_blends;
 		real_t blend = 0.0;
 		bool seeked = false;
 		bool is_external_seeking = false;