mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Extra keybinds
This commit is contained in:
parent
e210923733
commit
c3c0a05ac0
139 changed files with 586 additions and 233 deletions
|
@ -143,6 +143,7 @@ namespace RimWorldAnimationStudio
|
|||
{ continue; }
|
||||
|
||||
bool quiver = isAnimating && Workspace.Instance.GetCurrentOrPreviousKeyframe(actorID).quiver == true;
|
||||
bool requiresGenitals = actor.requiredGenitals.Any(x => x == "Penis") || Workspace.animationDef.actors[actorID].isFucking;
|
||||
|
||||
float clipPercent = (float)(stageTick % clip.duration) / clip.duration;
|
||||
if (stageTick == clip.duration) clipPercent = 1f;
|
||||
|
@ -184,7 +185,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
actorBody.bodyRenderer.sprite = alienRaceDef.GetBodyTypeGraphic((CardinalDirection)bodyFacing, bodyType);
|
||||
actorBody.headRenderer.sprite = alienRaceDef.isHumanoid ? alienRaceDef.GetHeadGraphic((CardinalDirection)headFacing) : null;
|
||||
actorBody.appendageRenderer.sprite = alienRaceDef.isHumanoid && bodyFacing != 0 ? Resources.Load<Sprite>("Textures/Humanlike/Appendages/Appendage" + bodyFacing) : null;
|
||||
actorBody.appendageRenderer.sprite = requiresGenitals && alienRaceDef.isHumanoid && bodyFacing != 0 ? Resources.Load<Sprite>("Textures/Humanlike/Appendages/Appendage" + bodyFacing) : null;
|
||||
|
||||
actorBody.bodyRenderer.gameObject.SetActive(actorBody.bodyRenderer.sprite != null);
|
||||
actorBody.headRenderer.gameObject.SetActive(actorBody.headRenderer.sprite != null);
|
||||
|
@ -352,7 +353,7 @@ namespace RimWorldAnimationStudio
|
|||
{ Debug.LogWarning("Cannot clone pawn keyframe - a keyframe already exists at this tick"); return; }
|
||||
|
||||
PawnKeyframe cloneFrame = keyframe.Copy();
|
||||
cloneFrame.GenerateKeyframeID();
|
||||
cloneFrame.GenerateKeyframeID(clipID);
|
||||
cloneFrame.atTick = stageTick;
|
||||
|
||||
PawnKeyframe nextKeyframe = clip.keyframes.FirstOrDefault(x => x.atTick > stageTick);
|
||||
|
@ -371,6 +372,48 @@ namespace RimWorldAnimationStudio
|
|||
Workspace.Instance.RecordEvent("Keyframe clone");
|
||||
}
|
||||
|
||||
public void CopyPawnKeyframes()
|
||||
{
|
||||
Workspace.copiedKeyframes.Clear();
|
||||
|
||||
List<PawnKeyframe> keyframesToClone = Workspace.Instance.GetPawnKeyframes(Workspace.keyframeID);
|
||||
|
||||
foreach (PawnKeyframe keyframe in keyframesToClone)
|
||||
{ Workspace.copiedKeyframes.Add(keyframe.Copy()); }
|
||||
}
|
||||
|
||||
public void PastePawnKeyframes()
|
||||
{
|
||||
foreach (PawnKeyframe keyframe in Workspace.copiedKeyframes)
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[keyframe.actorID];
|
||||
|
||||
if (Workspace.Instance.DoesPawnKeyframeExistAtTick(Workspace.stageID, keyframe.actorID, stageTick))
|
||||
{
|
||||
PawnKeyframe oldKeyframe = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[keyframe.actorID].keyframes.First(x => x.atTick == stageTick);
|
||||
|
||||
RemovePawnKeyframe(keyframe.actorID, oldKeyframe.keyframeID, true);
|
||||
}
|
||||
|
||||
keyframe.GenerateKeyframeID(keyframe.actorID);
|
||||
keyframe.atTick = stageTick;
|
||||
|
||||
PawnKeyframe nextKeyframe = clip.keyframes.FirstOrDefault(x => x.atTick > stageTick);
|
||||
|
||||
if (nextKeyframe != null)
|
||||
{ clip.keyframes.Insert(clip.keyframes.IndexOf(nextKeyframe), keyframe); }
|
||||
|
||||
else
|
||||
{ clip.keyframes.Add(keyframe); }
|
||||
|
||||
clip.BuildSimpleCurves();
|
||||
|
||||
animationTimelines.GetComponentsInChildren<AnimationTimeline>()[keyframe.actorID].AddPawnKeyFrame(keyframe.keyframeID);
|
||||
|
||||
clip.BuildSimpleCurves();
|
||||
}
|
||||
}
|
||||
|
||||
public void RemovePawnKeyframe()
|
||||
{
|
||||
foreach (int keyframeID in Workspace.keyframeID)
|
||||
|
@ -380,17 +423,17 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
}
|
||||
|
||||
public void RemovePawnKeyframe(int actorID, int keyframeID)
|
||||
public void RemovePawnKeyframe(int actorID, int keyframeID, bool force = false)
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetPawnKeyframe(actorID, keyframeID);
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[actorID];
|
||||
|
||||
if (keyframe == null || clip == null) return;
|
||||
|
||||
if (keyframe.atTick == 1)
|
||||
if (keyframe.atTick == 1 && force == false)
|
||||
{ Debug.LogWarning("Cannot delete key frame - the first key frame of an animation clip cannot be deleted"); return; }
|
||||
|
||||
if (clip.keyframes.Count <= 2)
|
||||
if (clip.keyframes.Count <= 2 && force == false)
|
||||
{ Debug.LogWarning("Cannot delete key frame - an animation clip must have two or more keyframes"); return; }
|
||||
|
||||
animationTimelines.GetComponentsInChildren<AnimationTimeline>()[actorID].RemovePawnKeyFrame(keyframe.keyframeID);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue