@@ -1081,24 +1081,23 @@ void AnimationMixer::_blend_calc_total_weight() {
10811081 Ref<Animation> a = ai.animation_data .animation ;
10821082 real_t weight = ai.playback_info .weight ;
10831083 Vector<real_t > track_weights = ai.playback_info .track_weights ;
1084- Vector<int > processed_indices ;
1084+ Vector<int > processed_hashes ;
10851085 for (int i = 0 ; i < a->get_track_count (); i++) {
10861086 if (!a->track_is_enabled (i)) {
10871087 continue ;
10881088 }
10891089 Animation::TypeHash thash = a->track_get_type_hash (i);
1090- if (!track_cache.has (thash)) {
1091- continue ; // No path, but avoid error spamming.
1090+ if (!track_cache.has (thash) || processed_hashes.has (thash)) {
1091+ // No path, but avoid error spamming.
1092+ // Or, there is the case different track type with same path; These can be distinguished by hash. So don't add the weight doubly.
1093+ continue ;
10921094 }
10931095 TrackCache *track = track_cache[thash];
10941096 int blend_idx = track_map[track->path ];
1095- if (processed_indices.has (blend_idx)) {
1096- continue ; // There is the case different track type with same path... Is there more faster iterating way than has()?
1097- }
10981097 ERR_CONTINUE (blend_idx < 0 || blend_idx >= track_count);
10991098 real_t blend = blend_idx < track_weights.size () ? track_weights[blend_idx] * weight : weight;
11001099 track->total_weight += blend;
1101- processed_indices .push_back (blend_idx );
1100+ processed_hashes .push_back (thash );
11021101 }
11031102 }
11041103}
0 commit comments