Bug fixes

This commit is contained in:
AbstractConcept 2022-09-26 00:50:26 -05:00
parent 7e1680a7fb
commit 73f7e32e0c
69 changed files with 107 additions and 91 deletions

View file

@ -221,7 +221,7 @@ MonoBehaviour:
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 0
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_FillRect: {fileID: 0}
m_HandleRect: {fileID: 4629009613275671144}

View file

@ -12899,7 +12899,7 @@ MonoBehaviour:
currentMessage: {fileID: 1308919825}
logMessagePrefab: {fileID: 7082774796440540818, guid: a29caea8e4b276d4c861e9eb083562fc,
type: 3}
maxMessages: 100
maxMessages: 500
--- !u!222 &1059017488
CanvasRenderer:
m_ObjectHideFlags: 0

View file

@ -41,6 +41,8 @@ namespace RimWorldAnimationStudio
int keyframePosition = 0;
keyframes[keyframes.Count - 1].tickDuration = 1;
for (int i = 0; i < keyframes.Count; i++)
{
PawnKeyframe keyframe = keyframes[i];
@ -84,8 +86,6 @@ namespace RimWorldAnimationStudio
keyframePosition += keyframe.tickDuration;
}
}
keyframes[keyframes.Count - 1].tickDuration = 1;
}
public override void ValidateData() { }

View file

@ -34,11 +34,6 @@ namespace RimWorldAnimationStudio
// Sort keyframes by atTick
foreach (PawnAnimationClip clip in animationClips)
{ clip.keyframes = clip.keyframes.OrderBy(x => x.atTick).ToList(); }
// Check if looping
stageWindowSize = stageWindowSize > 0 ? stageWindowSize : animationClips.Select(x => x.duration).Max();
int cycles = Mathf.CeilToInt(playTimeTicks / stageWindowSize);
isLooping = cycles > 1;
}
public bool MakeNew()

View file

@ -91,6 +91,7 @@ namespace RimWorldAnimationStudio
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
ActorBody actorBody = AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>()[Workspace.actorID];
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
string bodyType = actorBody.bodyType;
bodyType = bodyType == null || bodyType == "" ? "Male" : bodyType;
@ -110,6 +111,21 @@ namespace RimWorldAnimationStudio
{ raceOffsetZField.text = actor.GetAlienRaceOffset().z.ToString(); }
initiatorToggle.isOn = actor.initiator;
if (actor.requiredGender.Contains("Female"))
{ genderDropdown.SetValueWithoutNotify(0); }
else if (actor.requiredGender.Contains("Male"))
{ genderDropdown.SetValueWithoutNotify(2); }
else
{ genderDropdown.SetValueWithoutNotify(1); }
for (int i = 0; i < selectActorLayerDropdown.options.Count; i++)
{
if (selectActorLayerDropdown.options[i].text == clip.layer)
{ selectActorLayerDropdown.SetValueWithoutNotify(i); }
}
}
}
}

View file

@ -107,15 +107,13 @@ namespace RimWorldAnimationStudio
AnimationController.Instance.stageTick = keyframe.atTick.Value;
Workspace.actorID = actorID;
Workspace.keyframeID = keyframeID;
if (keyframe.atTick == 1)
{ return; }
interactable = true;
}
public override void OnDrag(PointerEventData eventData)
{
if (keyframe.atTick == 1)
{ value = 1; return; }
base.OnDrag(eventData);
AnimationController.Instance.stageTick = keyframe.atTick.Value;
@ -124,7 +122,8 @@ namespace RimWorldAnimationStudio
public void OnEndDrag(PointerEventData eventData)
{
interactable = false;
if (keyframe.atTick == 1)
{ value = 1; return; }
Workspace.Instance.RecordEvent("Keyframe tick");
}

View file

@ -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)");
}

View file

@ -88,7 +88,7 @@ namespace RimWorldAnimationStudio
foreach (string bodyType in allTags)
{
path = alienRaceDef.GetBodyTypeGraphicPath(facing, bodyType);
Debug.Log(path);
if (path != null && path != "")
{ alienRaceDef.SetBodyTypeGraphicPath(path, facing, bodyType); }
}

View file

@ -31,18 +31,12 @@ namespace RimWorldAnimationStudio
{ return -1; }
if (animationDef.animationStages[stageID].stageWindowSize < 0)
{ return animationDef.animationStages[stageID].animationClips.Select(x => x.duration).Max(); }
{ animationDef.animationStages[stageID].stageWindowSize = animationDef.animationStages[stageID].animationClips.Select(x => x.duration).Max(); }
return animationDef.animationStages[stageID].stageWindowSize;
}
}
public void Update()
{
//if (isDirty)
//{ TrackChanges(); }
}
public PawnKeyframe GetCurrentPawnKeyframe(bool makeKeyframe = false)
{
int stageTick = AnimationController.Instance.stageTick;