Nate Ah yeah so I dug a bit deeper to try and capture the full chain and as many variables as possible but it seems I still can't get it to match properly during mix. I also realized I was not applying <empty> animations as well, but fixing that didn't change the outcome. And I did confirm that there was a linked list of mixingFrom going on.
On the sending client I changed to this:
foreach (var track in cachedSkeletonAnimationRef.AnimationState.Tracks) {
if (track != null && track.Animation != null) {
var animStruct = new AnimationIndexTimeTrack();
animStruct.trackIndex = (byte) track.TrackIndex;
animStruct.animName = track.Animation.Name;
animStruct.animTime = track.TrackTime;
animStruct.looping = track.Loop;
animStruct.mixDuration = track.MixDuration;
animStruct.mixTime = track.MixTime;
reuseableArrayAnimIndexesHitReg.Add(animStruct);
var mixingFrom = track.MixingFrom;
while (mixingFrom != null) {
var animStruct2 = new AnimationIndexTimeTrack();
animStruct2.trackIndex = (byte) track.TrackIndex;
animStruct2.animName = mixingFrom.Animation.Name;
animStruct2.animTime = mixingFrom.MixTime;
animStruct2.looping = mixingFrom.Loop;
animStruct2.isMixingFrom = true;
animStruct2.mixDuration = mixingFrom.MixDuration;
reuseableArrayAnimIndexesHitReg.Add(animStruct2);
mixingFrom = mixingFrom.MixingFrom;
}
}
}
and on receiving end for each received entry:
Animation foundAnim;
if (animationsByName.TryGetValue(animInfo.animName, out foundAnim)) {
if (animInfo.isMixingFrom) {
var trackMain = state.GetCurrent(animInfo.trackIndex);
if (trackMain != null) {
TrackEntry addMixFromEntry = state.NewTrackEntry(animInfo.trackIndex, foundAnim, animInfo.looping, trackMain);
addMixFromEntry.mixDuration = animInfo.mixDuration;
var mixingParent = trackMain;
while (mixingParent.mixingFrom != null)
mixingParent = mixingParent.mixingFrom;
mixingParent.mixingFrom = addMixFromEntry;
mixingParent.MixTime = animInfo.animTime;
addMixFromEntry.mixingTo = mixingParent;
}
} else {
var trackEntry = state.SetAnimation(animInfo.trackIndex, foundAnim, animInfo.looping);
trackEntry.mixDuration = animInfo.mixDuration;
trackEntry.TrackTime = animInfo.animTime;
trackEntry.mixTime = animInfo.mixTime;
}
} else if (animInfo.animName == "<empty>") {
if (animInfo.isMixingFrom) {
var trackMain = state.GetCurrent(animInfo.trackIndex);
if (trackMain != null) {
TrackEntry addMixFromEntry = state.NewTrackEntry(animInfo.trackIndex, AnimationState.EmptyAnimation, false, trackMain);
addMixFromEntry.mixDuration = animInfo.mixDuration;
var mixingParent = trackMain;
while (mixingParent.mixingFrom != null)
mixingParent = mixingParent.mixingFrom;
mixingParent.mixingFrom = addMixFromEntry;
mixingParent.MixTime = animInfo.animTime;
addMixFromEntry.mixingTo = mixingParent;
}
} else {
var trackEntry = state.SetEmptyAnimation(animInfo.trackIndex, animInfo.mixDuration);
trackEntry.TrackTime = animInfo.animTime;
trackEntry.mixTime = animInfo.mixTime;
}
}
I had to make NewTrackEntry a public method to do this code so probably not the best... I wonder if I missed any variables or if I should try another approach like using SetAnimation several times to simulate the chain of mixing, as opposed to trying to force variables.