@@ -1081,24 +1081,23 @@ void AnimationMixer::_blend_calc_total_weight() {
1081
1081
Ref<Animation> a = ai.animation_data .animation ;
1082
1082
real_t weight = ai.playback_info .weight ;
1083
1083
Vector<real_t > track_weights = ai.playback_info .track_weights ;
1084
- Vector<int > processed_indices ;
1084
+ Vector<int > processed_hashes ;
1085
1085
for (int i = 0 ; i < a->get_track_count (); i++) {
1086
1086
if (!a->track_is_enabled (i)) {
1087
1087
continue ;
1088
1088
}
1089
1089
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 ;
1092
1094
}
1093
1095
TrackCache *track = track_cache[thash];
1094
1096
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
- }
1098
1097
ERR_CONTINUE (blend_idx < 0 || blend_idx >= track_count);
1099
1098
real_t blend = blend_idx < track_weights.size () ? track_weights[blend_idx] * weight : weight;
1100
1099
track->total_weight += blend;
1101
- processed_indices .push_back (blend_idx );
1100
+ processed_hashes .push_back (thash );
1102
1101
}
1103
1102
}
1104
1103
}
0 commit comments