Code refactor

This commit is contained in:
AbstractConcept 2022-10-28 00:28:51 -05:00
parent 757badf4f6
commit a55ba7b95b
232 changed files with 1282 additions and 936 deletions

View file

@ -204,7 +204,7 @@ namespace RimWorldAnimationStudio
public void ToggleAnimationPreview()
{
if (Workspace.animationDef == null) return;
AnimationController.Instance.ToggleAnimation();
Workspace.isAnimating = !Workspace.isAnimating;
}
public void AddKeyframe()
@ -228,7 +228,9 @@ namespace RimWorldAnimationStudio
public void DeleteKeyframes()
{
if (Workspace.animationDef == null) return;
Workspace.GetCurrentPawnAnimationClip().RemovePawnKeyframe();
foreach (int keyframeID in Workspace.keyframeID)
{ Workspace.GetAnimationClipThatOwnsKeyframe(keyframeID).RemovePawnKeyframe(keyframeID); }
}
public void ActorMovementMode()
@ -249,49 +251,65 @@ namespace RimWorldAnimationStudio
public void AdjustActorUpward()
{
if (Workspace.animationDef == null) return;
ActorKeyframeCard.Instance.AdjustActor(Vector2.up * largeStep);
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
keyframe.AdjustActor(Vector2.up * largeStep);
}
public void AdjustActorDownward()
{
if (Workspace.animationDef == null) return;
ActorKeyframeCard.Instance.AdjustActor(Vector2.down * largeStep);
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
keyframe.AdjustActor(Vector2.down * largeStep);
}
public void AdjustActorLeftward()
{
if (Workspace.animationDef == null) return;
ActorKeyframeCard.Instance.AdjustActor(Vector2.left * largeStep);
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
keyframe.AdjustActor(Vector2.left * largeStep);
}
public void AdjustActorRightward()
{
if (Workspace.animationDef == null) return;
ActorKeyframeCard.Instance.AdjustActor(Vector2.right * largeStep);
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
keyframe.AdjustActor(Vector2.right * largeStep);
}
public void AdjustActorUpwardSmall()
{
if (Workspace.animationDef == null) return;
ActorKeyframeCard.Instance.AdjustActor(Vector2.up * smallStep);
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
keyframe.AdjustActor(Vector2.up * smallStep);
}
public void AdjustActorDownwardSmall()
{
if (Workspace.animationDef == null) return;
ActorKeyframeCard.Instance.AdjustActor(Vector2.down * smallStep);
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
keyframe.AdjustActor(Vector2.down * smallStep);
}
public void AdjustActorLeftwardSmall()
{
if (Workspace.animationDef == null) return;
ActorKeyframeCard.Instance.AdjustActor(Vector2.left * smallStep);
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
keyframe.AdjustActor(Vector2.left * smallStep);
}
public void AdjustActorRightwardSmall()
{
if (Workspace.animationDef == null) return;
ActorKeyframeCard.Instance.AdjustActor(Vector2.right * smallStep);
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
keyframe.AdjustActor(Vector2.right * smallStep);
}
public void CycleActorBodyPartSelecion()
@ -407,7 +425,7 @@ namespace RimWorldAnimationStudio
public void StretchKeyframesToggle()
{
AnimationController.Instance.stretchKeyframesToggle.isOn = !AnimationController.Instance.stretchKeyframesToggle.isOn;
Workspace.stretchKeyframes = !Workspace.stretchKeyframes;
}
public void OpenProjectHome()
@ -435,5 +453,26 @@ namespace RimWorldAnimationStudio
Workspace.animationDef.RemoveActor();
}
public void AddStage()
{
if (Workspace.animationDef == null) return;
Workspace.animationDef.AddAnimationStage();
}
public void CloneStage()
{
if (Workspace.animationDef == null) return;
Workspace.animationDef.CloneAnimationStage();
}
public void RemoveStage()
{
if (Workspace.animationDef == null) return;
Workspace.animationDef.RemoveAnimationStage();
}
}
}