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

@ -35,12 +35,12 @@ namespace RimWorldAnimationStudio
{
this.timeline = timeline;
this.clip = Workspace.GetPawnAnimationClip(actorID);
this.keyframe = Workspace.GetPawnKeyframe(actorID, keyframeID);
this.keyframe = Workspace.GetPawnKeyframe(keyframeID);
this.actorID = actorID;
this.keyframeID = keyframeID;
PawnKeyframe keyframe = Workspace.GetPawnKeyframe(actorID, keyframeID);
PawnKeyframe keyframe = Workspace.GetPawnKeyframe(keyframeID);
maxValue = Workspace.StageWindowSize;
value = keyframe.atTick.Value;
@ -132,7 +132,7 @@ namespace RimWorldAnimationStudio
if (unlinkedSlider != null)
{
if (AnimationController.Instance.stretchKeyframesToggle.isOn && unlinkedSlider.keyframe.atTick == pivotKeyframe.atTick) continue;
if (Workspace.stretchKeyframes && unlinkedSlider.keyframe.atTick == pivotKeyframe.atTick) continue;
unlinkedSlider.linkedSlider = this;
unlinkedSlider.linkedOffset = unlinkedSlider.keyframe.atTick.Value - keyframe.atTick.Value;
@ -176,7 +176,7 @@ namespace RimWorldAnimationStudio
foreach (PawnKeyframe _keyframe in keyframesToCheck)
{
if (_keyframe != keyframe)
{ Workspace.GetCurrentPawnAnimationClip().RemovePawnKeyframe(actorID, _keyframe.keyframeID); }
{ Workspace.GetAnimationClipThatOwnsKeyframe(_keyframe.keyframeID).RemovePawnKeyframe(_keyframe.keyframeID); }
}
}
@ -196,7 +196,7 @@ namespace RimWorldAnimationStudio
foreach (PawnKeyframe _keyframe in keyframesToCheck)
{
if (_keyframe.keyframeID != linkedKeyframe.keyframeID)
{ Workspace.GetCurrentPawnAnimationClip().RemovePawnKeyframe(actorID, _keyframe.keyframeID); Debug.Log("delete"); }
{ Workspace.GetAnimationClipThatOwnsKeyframe(_keyframe.keyframeID).RemovePawnKeyframe(_keyframe.keyframeID); }
}
}
}
@ -219,10 +219,10 @@ namespace RimWorldAnimationStudio
if (Workspace.keyframeID.NullOrEmpty() || Workspace.keyframeID.Contains(keyframeID) == false)
{ linkedSlider = null; }
else if (AnimationController.Instance.stretchKeyframesToggle.isOn && linkedSlider != null)
else if (Workspace.stretchKeyframes && linkedSlider != null)
{ value = Mathf.CeilToInt(linkedSlider.keyframe.atTick.Value + linkedOffset * linkedSlider.ScaledOffsetFromPivot()); }
else if (AnimationController.Instance.stretchKeyframesToggle.isOn == false && linkedSlider != null)
else if (Workspace.stretchKeyframes == false && linkedSlider != null)
{ value = Mathf.Clamp(linkedSlider.keyframe.atTick.Value + linkedOffset, Constants.minTick + 1, Workspace.StageWindowSize); }
else if (keyframe.atTick.Value != value)
@ -242,7 +242,7 @@ namespace RimWorldAnimationStudio
{ handleImage.color = Constants.ColorGrey; }
// Show sound symbol
string soundDef = Workspace.GetPawnKeyframe(actorID, keyframeID)?.SoundEffect;
string soundDef = Workspace.GetPawnKeyframe(keyframeID)?.SoundEffect;
soundIcon.SetActive(soundDef != null && soundDef != "" && soundDef != "None");
}