void OutputFragmentSelected(AnimationFragment fragment) { if (fragment == null) { ActiveFragmentSlot.UpdatePossibleValues(null); } else { ActiveFragmentSlot.UpdatePossibleValues(fragment.Fragments.Select(x => new FragmentStatusSlotItem(x))); } UpdateCanSaveAndPreviewStates(); }
public void AddAnimationToFragment() { // Find stuff in active slot. var selectedAnimationSlot = MountLinkController.SelectedRiderTag.SelectedItem; AnimationClip newRiderClip = null; if (MountAnimationGeneratorService.IsCopyOnlyAnimation(selectedAnimationSlot.Entry.Value.Slot.Value)) { newRiderClip = _rider.AnimationClip; } else { newRiderClip = CreateAnimationGenerator().GenerateMountAnimation(_mount.AnimationClip, _rider.AnimationClip); } var fileResult = MountAnimationGeneratorService.SaveAnimation(_pfs, _rider.AnimationName.AnimationFile, SavePrefixText.Value, EnsureUniqeFileName.Value, newRiderClip, _newAnimation.Skeleton); if (fileResult == null) { return; } var newAnimSlot = selectedAnimationSlot.Entry.Value.Clone(); newAnimSlot.AnimationFile = _pfs.GetFullPath(fileResult); newAnimSlot.Slot = ActiveFragmentSlot.SelectedItem.Entry.Value.Slot.Clone(); var toRemove = ActiveOutputFragment.SelectedItem.Fragments.FirstOrDefault(x => x.Slot.Id == ActiveFragmentSlot.SelectedItem.Entry.Value.Slot.Id); ActiveOutputFragment.SelectedItem.Fragments.Remove(toRemove); ActiveOutputFragment.SelectedItem.Fragments.Add(newAnimSlot); var bytes = ActiveOutputFragment.SelectedItem.ParentAnimationPack.ToByteArray(); SaveHelper.Save(_pfs, "animations\\animation_tables\\" + ActiveOutputFragment.SelectedItem.ParentAnimationPack.FileName, null, bytes, false); // Update status for the slot thing var possibleValues = ActiveOutputFragment.SelectedItem.Fragments.Select(x => new FragmentStatusSlotItem(x)); ActiveFragmentSlot.UpdatePossibleValues(possibleValues); MountLinkController.ReloadFragments(true, false); }