mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Key snapping
This commit is contained in:
parent
5436410162
commit
f275ed90ae
101 changed files with 253 additions and 117 deletions
|
@ -95,8 +95,8 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
else
|
||||
{
|
||||
stageTick = Workspace.StageWindowSize;
|
||||
isAnimating = false;
|
||||
//stageTick = Workspace.StageWindowSize;
|
||||
//isAnimating = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,10 +132,10 @@ namespace RimWorldAnimationStudio
|
|||
for (int actorID = 0; actorID < _actorBodies.Count; actorID++)
|
||||
{
|
||||
if (Workspace.stageID >= Workspace.animationDef?.animationStages.Count)
|
||||
{ /*Debug.Log("Waiting for animation stage data to initialize...");*/ return; }
|
||||
{ return; }
|
||||
|
||||
if (actorID >= Workspace.animationDef?.animationStages[Workspace.stageID]?.animationClips.Count)
|
||||
{ /*Debug.Log("Waiting for animation clip data to initialize...");*/ return; }
|
||||
{ return; }
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[actorID];
|
||||
PawnAnimationClip clip = Workspace.animationDef?.animationStages[Workspace.stageID]?.animationClips[actorID];
|
||||
|
@ -146,6 +146,9 @@ namespace RimWorldAnimationStudio
|
|||
float clipPercent = (float)(stageTick % clip.duration) / clip.duration;
|
||||
if (stageTick == clip.duration) clipPercent = 1f;
|
||||
|
||||
if (Workspace.animationDef.animationStages[Workspace.stageID].isLooping == false)
|
||||
{ clipPercent = (float)stageTick / clip.duration; }
|
||||
|
||||
AlienRaceDef alienRaceDef = actor.GetAlienRaceDef();
|
||||
ActorBody actorBody = _actorBodies[actorID];
|
||||
string bodyType = alienRaceDef.isHumanoid ? actor.bodyType : "None";
|
||||
|
@ -155,15 +158,6 @@ namespace RimWorldAnimationStudio
|
|||
float bodyAngle = clip.BodyAngle.Evaluate(clipPercent);
|
||||
float headAngle = clip.HeadAngle.Evaluate(clipPercent);
|
||||
|
||||
/*if (bodyAngle < 0) bodyAngle = 360 - ((-1f * bodyAngle) % 360);
|
||||
if (bodyAngle > 360) bodyAngle %= 360;
|
||||
|
||||
if (headAngle < 0) headAngle = 360 - ((-1f * headAngle) % 360);
|
||||
if (headAngle > 360) headAngle %= 360;
|
||||
|
||||
bodyAngle = bodyAngle > 180 ? 180 - bodyAngle : bodyAngle;
|
||||
headAngle = headAngle > 180 ? 180 - headAngle : headAngle;*/
|
||||
|
||||
int bodyFacing = (int)clip.BodyFacing.Evaluate(clipPercent);
|
||||
int headFacing = (int)clip.HeadFacing.Evaluate(clipPercent);
|
||||
|
||||
|
@ -233,7 +227,9 @@ namespace RimWorldAnimationStudio
|
|||
public void InitializeAnimationTimeline()
|
||||
{
|
||||
cyclesNormalField.text = Mathf.Max(Mathf.CeilToInt((float)Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicks / Workspace.StageWindowSize), 1).ToString();
|
||||
cyclesFastField.text = Mathf.Max(Mathf.CeilToInt((float)Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicksQuick / Workspace.StageWindowSize), 1).ToString();
|
||||
cyclesFastField.text = Mathf.Max(Mathf.CeilToInt((float)Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicksQuick / Workspace.StageWindowSize), 0).ToString();
|
||||
|
||||
Workspace.animationDef.animationStages[Workspace.stageID].isLooping = int.Parse(cyclesNormalField.text) > 1 ? true : false;
|
||||
|
||||
for (int actorID = 0; actorID < Workspace.animationDef.actors.Count; actorID++)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue