Expanded menus and bug fixes

This commit is contained in:
AbstractConcept 2022-10-15 01:00:47 -05:00
parent cc28ac4bd4
commit 721443592f
146 changed files with 5891 additions and 269 deletions

View file

@ -421,11 +421,14 @@ namespace RimWorldAnimationStudio
public void PastePawnKeyframes()
{
MakeTimelineDirty();
int originalWindowSize = Workspace.StageWindowSize;
List<int> actorsInvolved = Workspace.copiedKeyframes.Select(x => x.actorID)?.ToList();
actorsInvolved = actorsInvolved?.Distinct()?.ToList();
foreach (int i in actorsInvolved) { Debug.Log("Actor: " + i); }
if (actorsInvolved.NullOrEmpty()) { Debug.Log("Cannot paste keyframes - there were no copied keyframes to paste"); return; }
if (actorsInvolved.Count > 1 && actorsInvolved.Contains(Workspace.actorID) == false) { Debug.Log("Cannot paste keyframes - keyframes copied across multiple timelines can only be pasted back into these source timelines"); return; }
@ -458,7 +461,7 @@ namespace RimWorldAnimationStudio
clonedKeyframe.atTick = tickToPasteAt;
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[targetActorID];
PawnKeyframe nextKeyframe = clip.keyframes.FirstOrDefault(x => x.atTick > stageTick);
PawnKeyframe nextKeyframe = clip.keyframes.FirstOrDefault(x => x.atTick > tickToPasteAt);
if (nextKeyframe != null)
{ clip.keyframes.Insert(clip.keyframes.IndexOf(nextKeyframe), clonedKeyframe); }
@ -467,10 +470,15 @@ namespace RimWorldAnimationStudio
{ clip.keyframes.Add(clonedKeyframe); }
clip.BuildSimpleCurves();
animationTimelines.GetComponentsInChildren<AnimationTimeline>()[clonedKeyframe.actorID].AddPawnKeyFrame(clonedKeyframe.keyframeID);
}
if (originalWindowSize != Workspace.StageWindowSize)
{
StretchKeyframes(originalWindowSize);
ResizeStageWindowSize(originalWindowSize);
}
Workspace.Instance.RecordEvent("Keyframe pasted");
}
@ -567,6 +575,7 @@ namespace RimWorldAnimationStudio
}
ResizeStageWindowSize(newStageWindowSize);
Workspace.Instance.RecordEvent("Stage length");
}
public void StretchKeyframes(int newStageWindowSize)
@ -592,8 +601,6 @@ namespace RimWorldAnimationStudio
Workspace.animationDef.animationStages[Workspace.stageID].stageWindowSize = newStageWindowSize;
Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicks = newStageWindowSize * int.Parse(cyclesNormalField.text);
Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicksQuick = newStageWindowSize * int.Parse(cyclesFastField.text);
Workspace.Instance.RecordEvent("Stage length");
}
public void OnCycleNormalFieldChange()