Expanded menus and bug fixes

This commit is contained in:
AbstractConcept 2022-10-15 01:00:47 -05:00
parent cc28ac4bd4
commit 721443592f
146 changed files with 5891 additions and 269 deletions

View file

@ -421,11 +421,14 @@ namespace RimWorldAnimationStudio
public void PastePawnKeyframes()
{
MakeTimelineDirty();
int originalWindowSize = Workspace.StageWindowSize;
List<int> actorsInvolved = Workspace.copiedKeyframes.Select(x => x.actorID)?.ToList();
actorsInvolved = actorsInvolved?.Distinct()?.ToList();
foreach (int i in actorsInvolved) { Debug.Log("Actor: " + i); }
if (actorsInvolved.NullOrEmpty()) { Debug.Log("Cannot paste keyframes - there were no copied keyframes to paste"); return; }
if (actorsInvolved.Count > 1 && actorsInvolved.Contains(Workspace.actorID) == false) { Debug.Log("Cannot paste keyframes - keyframes copied across multiple timelines can only be pasted back into these source timelines"); return; }
@ -458,7 +461,7 @@ namespace RimWorldAnimationStudio
clonedKeyframe.atTick = tickToPasteAt;
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[targetActorID];
PawnKeyframe nextKeyframe = clip.keyframes.FirstOrDefault(x => x.atTick > stageTick);
PawnKeyframe nextKeyframe = clip.keyframes.FirstOrDefault(x => x.atTick > tickToPasteAt);
if (nextKeyframe != null)
{ clip.keyframes.Insert(clip.keyframes.IndexOf(nextKeyframe), clonedKeyframe); }
@ -467,10 +470,15 @@ namespace RimWorldAnimationStudio
{ clip.keyframes.Add(clonedKeyframe); }
clip.BuildSimpleCurves();
animationTimelines.GetComponentsInChildren<AnimationTimeline>()[clonedKeyframe.actorID].AddPawnKeyFrame(clonedKeyframe.keyframeID);
}
if (originalWindowSize != Workspace.StageWindowSize)
{
StretchKeyframes(originalWindowSize);
ResizeStageWindowSize(originalWindowSize);
}
Workspace.Instance.RecordEvent("Keyframe pasted");
}
@ -567,6 +575,7 @@ namespace RimWorldAnimationStudio
}
ResizeStageWindowSize(newStageWindowSize);
Workspace.Instance.RecordEvent("Stage length");
}
public void StretchKeyframes(int newStageWindowSize)
@ -592,8 +601,6 @@ namespace RimWorldAnimationStudio
Workspace.animationDef.animationStages[Workspace.stageID].stageWindowSize = newStageWindowSize;
Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicks = newStageWindowSize * int.Parse(cyclesNormalField.text);
Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicksQuick = newStageWindowSize * int.Parse(cyclesFastField.text);
Workspace.Instance.RecordEvent("Stage length");
}
public void OnCycleNormalFieldChange()

View file

@ -71,7 +71,7 @@ namespace RimWorldAnimationStudio
public void ResetCamera()
{
cam.transform.position = new Vector3(-1, 0, -10);
cam.transform.position = new Vector3(1, 0, -10);
curZoom = zoom;
mouseDragActive = false;

View file

@ -15,7 +15,6 @@ namespace RimWorldAnimationStudio
public GameObject keyframeSelector;
private float lastUpdate = -1f;
private float timeBetweenUpdates = 0.15f;
private float largeStep = 0.1f;
private float smallStep = 0.03f;
@ -24,7 +23,7 @@ namespace RimWorldAnimationStudio
public bool CanRepeatThisUpdate()
{
if (Time.unscaledTime > lastUpdate + timeBetweenUpdates)
if (Time.unscaledTime > lastUpdate + Constants.actionRepeatSpeed)
{
lastUpdate = Time.unscaledTime;
return true;
@ -402,5 +401,22 @@ namespace RimWorldAnimationStudio
{
Camera.main.GetComponent<CameraController>().ResetCamera();
}
public void StretchKeyframesToggle()
{
AnimationController.Instance.stretchKeyframesToggle.isOn = !AnimationController.Instance.stretchKeyframesToggle.isOn;
}
public void OpenProjectHome()
{
if (Uri.IsWellFormedUriString(Constants.projectHome, UriKind.RelativeOrAbsolute))
{ Application.OpenURL(Constants.projectHome); }
}
public void OpenProjectWiki()
{
if (Uri.IsWellFormedUriString(Constants.projectWiki, UriKind.RelativeOrAbsolute))
{ Application.OpenURL(Constants.projectWiki); }
}
}
}