mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Code refactor
This commit is contained in:
parent
cd4711a8e5
commit
757badf4f6
517 changed files with 2534 additions and 2221 deletions
|
@ -192,13 +192,13 @@ namespace RimWorldAnimationStudio
|
|||
public void UndoAction()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
Workspace.Instance.Undo();
|
||||
Workspace.Undo();
|
||||
}
|
||||
|
||||
public void RedoAction()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
Workspace.Instance.Redo();
|
||||
Workspace.Redo();
|
||||
}
|
||||
|
||||
public void ToggleAnimationPreview()
|
||||
|
@ -210,43 +210,40 @@ namespace RimWorldAnimationStudio
|
|||
public void AddKeyframe()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.AddPawnKeyframe();
|
||||
Workspace.GetCurrentPawnAnimationClip().AddPawnKeyframe();
|
||||
}
|
||||
|
||||
public void CopyKeyframes()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.CopyPawnKeyframes();
|
||||
Workspace.GetCurrentPawnAnimationClip().CopyPawnKeyframes();
|
||||
}
|
||||
|
||||
public void PasteKeyframes()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.PastePawnKeyframes();
|
||||
Workspace.GetCurrentPawnAnimationClip().PastePawnKeyframes();
|
||||
}
|
||||
|
||||
public void DeleteKeyframes()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.RemovePawnKeyframe();
|
||||
Workspace.GetCurrentPawnAnimationClip().RemovePawnKeyframe();
|
||||
}
|
||||
|
||||
public void ActorMovementMode()
|
||||
{
|
||||
//if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.ToggleActorManipulationMode(0);
|
||||
Workspace.actorManipulationMode = (ActorManipulationMode)0;
|
||||
}
|
||||
|
||||
public void ActorRotateMode()
|
||||
{
|
||||
//if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.ToggleActorManipulationMode(1);
|
||||
Workspace.actorManipulationMode = (ActorManipulationMode)1;
|
||||
}
|
||||
|
||||
public void ActorFacingMode()
|
||||
{
|
||||
//if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.ToggleActorManipulationMode(2);
|
||||
Workspace.actorManipulationMode = (ActorManipulationMode)2;
|
||||
}
|
||||
|
||||
public void AdjustActorUpward()
|
||||
|
@ -301,7 +298,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
ActorBody actorBody = AnimationController.Instance.actorBodies.GetChild(Workspace.actorID).GetComponent<ActorBody>();
|
||||
ActorBody actorBody = AnimationController.Instance.actorBodies.GetChild(Workspace.ActorID).GetComponent<ActorBody>();
|
||||
List<ActorBodyPart> actorBodyParts = actorBody.GetComponentsInChildren<ActorBodyPart>().Where(x => x.gameObject.activeInHierarchy)?.ToList();
|
||||
|
||||
if (actorBodyParts.NullOrEmpty()) return;
|
||||
|
@ -332,7 +329,7 @@ namespace RimWorldAnimationStudio
|
|||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Workspace.selectedBodyPart = null;
|
||||
Workspace.actorID = Mathf.Clamp(Workspace.actorID - 1, 0, Workspace.animationDef.actors.Count - 1);
|
||||
Workspace.ActorID = Mathf.Clamp(Workspace.ActorID - 1, 0, Workspace.animationDef.Actors.Count - 1);
|
||||
}
|
||||
|
||||
public void ToNextActor()
|
||||
|
@ -340,67 +337,67 @@ namespace RimWorldAnimationStudio
|
|||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Workspace.selectedBodyPart = null;
|
||||
Workspace.actorID = Mathf.Clamp(Workspace.actorID + 1, 0, Workspace.animationDef.actors.Count - 1);
|
||||
Workspace.ActorID = Mathf.Clamp(Workspace.ActorID + 1, 0, Workspace.animationDef.Actors.Count - 1);
|
||||
}
|
||||
|
||||
public void ToPreviousTick()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.stageTick = Mathf.Clamp(AnimationController.Instance.stageTick - 1, Constants.minTick, Workspace.StageWindowSize);
|
||||
Workspace.StageTick = Mathf.Clamp(Workspace.StageTick - 1, Constants.minTick, Workspace.StageWindowSize);
|
||||
}
|
||||
|
||||
public void ToNextTick()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.stageTick = Mathf.Clamp(AnimationController.Instance.stageTick + 1, Constants.minTick, Workspace.StageWindowSize);
|
||||
Workspace.StageTick = Mathf.Clamp(Workspace.StageTick + 1, Constants.minTick, Workspace.StageWindowSize);
|
||||
}
|
||||
|
||||
public void ToFirstTick()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.stageTick = Constants.minTick;
|
||||
Workspace.StageTick = Constants.minTick;
|
||||
}
|
||||
|
||||
public void ToLastTick()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.stageTick = Workspace.StageWindowSize;
|
||||
Workspace.StageTick = Workspace.StageWindowSize;
|
||||
}
|
||||
|
||||
public void ToPreviousKey()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetPreviousKeyframe(Workspace.actorID);
|
||||
if (keyframe != null) AnimationController.Instance.stageTick = keyframe.atTick.Value;
|
||||
PawnKeyframe keyframe = Workspace.GetPreviousKeyframe(Workspace.ActorID);
|
||||
if (keyframe != null) Workspace.StageTick = keyframe.atTick.Value;
|
||||
}
|
||||
|
||||
public void ToNextKey()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetNextKeyframe(Workspace.actorID);
|
||||
if (keyframe != null) AnimationController.Instance.stageTick = keyframe.atTick.Value;
|
||||
PawnKeyframe keyframe = Workspace.GetNextKeyframe(Workspace.ActorID);
|
||||
if (keyframe != null) Workspace.StageTick = keyframe.atTick.Value;
|
||||
}
|
||||
|
||||
public void ToPreviousStage()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
int prevStageID = Workspace.stageID;
|
||||
Workspace.stageID = Mathf.Clamp(Workspace.stageID - 1, 0, Workspace.animationDef.animationStages.Count - 1);
|
||||
int prevStageID = Workspace.StageID;
|
||||
Workspace.StageID = Mathf.Clamp(Workspace.StageID - 1, 0, Workspace.animationDef.AnimationStages.Count - 1);
|
||||
|
||||
if (Workspace.stageID != prevStageID)
|
||||
{ Workspace.Instance.RecordEvent("Stage selected"); }
|
||||
if (Workspace.StageID != prevStageID)
|
||||
{ Workspace.RecordEvent("Stage selected"); }
|
||||
}
|
||||
|
||||
public void ToNextStage()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
int prevStageID = Workspace.stageID;
|
||||
Workspace.stageID = Mathf.Clamp(Workspace.stageID + 1, 0, Workspace.animationDef.animationStages.Count - 1);
|
||||
int prevStageID = Workspace.StageID;
|
||||
Workspace.StageID = Mathf.Clamp(Workspace.StageID + 1, 0, Workspace.animationDef.AnimationStages.Count - 1);
|
||||
|
||||
if (Workspace.stageID != prevStageID)
|
||||
{ Workspace.Instance.RecordEvent("Stage selected"); }
|
||||
if (Workspace.StageID != prevStageID)
|
||||
{ Workspace.RecordEvent("Stage selected"); }
|
||||
}
|
||||
|
||||
public void CenterView()
|
||||
|
@ -424,5 +421,19 @@ namespace RimWorldAnimationStudio
|
|||
if (Uri.IsWellFormedUriString(Constants.projectWiki, UriKind.RelativeOrAbsolute))
|
||||
{ Application.OpenURL(Constants.projectWiki); }
|
||||
}
|
||||
|
||||
public void AddActor()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Workspace.animationDef.AddActor();
|
||||
}
|
||||
|
||||
public void RemoveActor()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Workspace.animationDef.RemoveActor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue