Basic keybinds plus multi key selection

This commit is contained in:
AbstractConcept 2022-10-02 17:39:03 -05:00
parent 518a912ef1
commit 842c954455
89 changed files with 977 additions and 164 deletions

View file

@ -12,7 +12,7 @@ namespace RimWorldAnimationStudio
public static AnimationDef animationDef;
public static int stageID = 0;
public static int keyframeID = 0;
public static List<int> keyframeID = new List<int>();
[SerializeField] private List<HistoricRecord> workspaceHistory = new List<HistoricRecord>();
[SerializeField] private int maxHistoryDepth = 100;
@ -61,9 +61,49 @@ namespace RimWorldAnimationStudio
public PawnKeyframe GetPawnKeyframe(int actorID, int keyframeID)
{
if (stageID < 0) return null;
if (actorID < 0) return null;
if (stageID >= animationDef.animationStages.Count) return null;
if (actorID >= animationDef.animationStages[stageID].animationClips.Count) return null;
return animationDef.animationStages[stageID].animationClips[actorID].keyframes.FirstOrDefault(x => x.keyframeID == keyframeID);
}
public List<PawnKeyframe> GetPawnKeyframes(List<int> keyframeIDs)
{
List<PawnKeyframe> pawnKeyframes = new List<PawnKeyframe>();
foreach (PawnAnimationClip clip in animationDef.animationStages[stageID].animationClips)
{
foreach (PawnKeyframe keyframe in clip.keyframes)
{
if (keyframeIDs.Contains(keyframe.keyframeID))
{ pawnKeyframes.Add(keyframe); }
}
}
return pawnKeyframes;
}
public PawnAnimationClip GetAnimationClipThatOwnsKeyframe(int keyframeID, out int clipID)
{
clipID = -1;
for (int i = 0; i < animationDef.animationStages[stageID].animationClips.Count; i++)
{
PawnAnimationClip clip = animationDef.animationStages[stageID].animationClips[i];
if (clip.keyframes.Any(x => x.keyframeID == keyframeID))
{
clipID = i;
return clip;
}
}
return null;
}
[SerializeField]
public LinkedList<HistoricRecord> pastSnapshots = new LinkedList<HistoricRecord>();
public LinkedList<HistoricRecord> futureSnapshots = new LinkedList<HistoricRecord>();