void CopyAnimations(string riderSlot, ErrorListViewModel.ErrorList resultInfo) { var fragmentEntry = _riderFragment.Fragments.First(x => x.Slot.Value == riderSlot); _riderOutputFragment.Fragments.Add(fragmentEntry.Clone()); resultInfo.Ok(riderSlot, "Animation copied from rider"); }
void CreateAnimation(string riderSlot, string mountSlot, ErrorListViewModel.ErrorList resultInfo) { // Does the rider have this? var riderHasAnimation = _riderFragment.Fragments.FirstOrDefault(x => x.Slot.Value == riderSlot) != null; if (riderHasAnimation) { // Create a copy of the animation fragment entry var riderFragment = _riderFragment.Fragments.First(x => x.Slot.Value == riderSlot); var newRiderFragment = riderFragment.Clone(); var newAnimationName = GenerateNewAnimationName(newRiderFragment.AnimationFile, _animationPrefix); newRiderFragment.AnimationFile = newAnimationName; _riderOutputFragment.Fragments.Add(newRiderFragment); var mountFragment = _mountFragment.Fragments.First(x => x.Slot.Value == mountSlot); // Generate new animation var riderAnim = LoadAnimation(riderFragment.AnimationFile); var mountAnim = LoadAnimation(mountFragment.AnimationFile); var newAnimation = _animationGenerator.GenerateMountAnimation(mountAnim, riderAnim); // Save the new animation var animFile = newAnimation.ConvertToFileFormat(_animationGenerator.GetRiderSkeleton()); var bytes = AnimationFile.GetBytes(animFile); SaveHelper.Save(_pfs, newAnimationName, null, bytes); resultInfo.Ok(mountSlot, "Matching animation found in rider (" + riderSlot + "). New animation created"); } else { // Add an empty fragment entry _riderOutputFragment.Fragments.Add(new AnimationFragmentEntry() { Slot = AnimationSlotTypeHelper.GetfromValue(riderSlot), Skeleton = _riderFragment.Skeletons.Values.First() }); resultInfo.Error(mountSlot, "Expected slot missing in rider (" + riderSlot + "), this need to be resolved!"); } }