mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Bug fixes
This commit is contained in:
parent
7e1680a7fb
commit
73f7e32e0c
69 changed files with 107 additions and 91 deletions
|
@ -361,20 +361,22 @@ namespace RimWorldAnimationStudio
|
|||
public void RemovePawnKeyframe(int actorID, int keyframeID)
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetPawnKeyframe(actorID, keyframeID);
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[actorID];
|
||||
|
||||
if (keyframe != null && keyframe.atTick == 1)
|
||||
{ Debug.LogWarning("Cannot delete key frame - the first key frame of an animation cannot be deleted"); return; }
|
||||
if (keyframe == null || clip == null) return;
|
||||
|
||||
if (keyframe != null)
|
||||
{
|
||||
animationTimelines.GetComponentsInChildren<AnimationTimeline>()[Workspace.actorID].RemovePawnKeyFrame(keyframe.keyframeID);
|
||||
if (keyframe.atTick == 1)
|
||||
{ Debug.LogWarning("Cannot delete key frame - the first key frame of an animation clip cannot be deleted"); return; }
|
||||
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[actorID];
|
||||
clip.keyframes.Remove(keyframe);
|
||||
clip.BuildSimpleCurves();
|
||||
if (clip.keyframes.Count <= 2)
|
||||
{ Debug.LogWarning("Cannot delete key frame - an animation clip must have two or more keyframes"); return; }
|
||||
|
||||
Workspace.Instance.RecordEvent("Keyframe deletion");
|
||||
}
|
||||
animationTimelines.GetComponentsInChildren<AnimationTimeline>()[Workspace.actorID].RemovePawnKeyFrame(keyframe.keyframeID);
|
||||
|
||||
clip.keyframes.Remove(keyframe);
|
||||
clip.BuildSimpleCurves();
|
||||
|
||||
Workspace.Instance.RecordEvent("Keyframe deletion");
|
||||
}
|
||||
|
||||
public void ToggleAnimation()
|
||||
|
@ -453,8 +455,6 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
foreach (PawnKeyframe keyframe in clip.keyframes)
|
||||
{
|
||||
if (keyframe.atTick == 1) continue;
|
||||
|
||||
keyframe.tickDuration = Mathf.RoundToInt(keyframe.tickDuration * scale);
|
||||
keyframe.atTick = null;
|
||||
}
|
||||
|
@ -468,7 +468,13 @@ namespace RimWorldAnimationStudio
|
|||
if (Workspace.animationDef == null) return;
|
||||
|
||||
if (int.TryParse(cyclesNormalField.text, out int cycles))
|
||||
{ Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicks = cycles * Workspace.StageWindowSize; }
|
||||
{
|
||||
Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicks = cycles * Workspace.StageWindowSize;
|
||||
Workspace.animationDef.animationStages[Workspace.stageID].isLooping = cycles > 1;
|
||||
|
||||
foreach(AnimationTimeline animationTimeline in animationTimelines.GetComponentsInChildren<AnimationTimeline>())
|
||||
{ animationTimeline.InitiateUpdateOfGhostFrames(); }
|
||||
}
|
||||
|
||||
Workspace.Instance.RecordEvent("Cycle count (normal)");
|
||||
}
|
||||
|
@ -477,8 +483,14 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
if (int.TryParse(cyclesFastField.text, out int cycles))
|
||||
{ Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicksQuick = cycles * Workspace.StageWindowSize; }
|
||||
if (int.TryParse(cyclesFastField.text, out int fastCycles))
|
||||
{
|
||||
int.TryParse(cyclesNormalField.text, out int cycles);
|
||||
if (fastCycles > cycles) fastCycles = cycles;
|
||||
cyclesFastField.text = fastCycles.ToString();
|
||||
|
||||
Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicksQuick = fastCycles * Workspace.StageWindowSize;
|
||||
}
|
||||
|
||||
Workspace.Instance.RecordEvent("Cycle count (fast)");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue