Improvements to timeline

This commit is contained in:
AbstractConcept 2022-09-18 01:52:54 -05:00
parent d2ca61c61c
commit 591b176924
99 changed files with 460 additions and 359 deletions

View file

@ -41,12 +41,12 @@ namespace RimWorldAnimationStudio
}
}
public PawnKeyframe GetCurrentPawnKeyframe(bool makeNewIfNull = true)
public PawnKeyframe GetCurrentPawnKeyframe()
{
int stageTick = AnimationController.Instance.stageTick;
PawnKeyframe keyframe = animationDef?.animationStages[stageID]?.animationClips[actorID]?.keyframes.FirstOrDefault(x => x.atTick == stageTick);
if (keyframe != null || makeNewIfNull == false)
if (keyframe != null)
{ return keyframe; }
AnimationController.Instance.AddPawnKeyframe();
@ -105,5 +105,41 @@ namespace RimWorldAnimationStudio
// All other data
}
private int lastactorCount = 0;
private int lastStageID = 0;
private int lastStageCount = 0;
private int lastStageWindowSize = 0;
public bool AnimationTimelinesNeedUpdate()
{
if (animationDef == null) return false;
bool update = false;
if (lastStageID != stageID)
{ update = true; }
if (lastStageCount != animationDef.animationStages.Count)
{ update = true; }
if (lastactorCount != animationDef.actors.Count)
{ update = true; }
if (lastStageWindowSize != StageWindowSize)
{ update = true; }
if (update)
{
lastStageID = stageID;
lastStageCount = animationDef.animationStages.Count;
lastactorCount = animationDef.actors.Count;
lastStageWindowSize = StageWindowSize;
return true;
}
return false;
}
}
}