mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Ghost frames fix plus undo redo system
This commit is contained in:
parent
591b176924
commit
b0a965e0b2
163 changed files with 948 additions and 214 deletions
|
@ -9,8 +9,10 @@ namespace RimWorldAnimationStudio
|
|||
public string layer = "Pawn";
|
||||
public List<string> tags;
|
||||
|
||||
[XmlIgnore] public int duration;
|
||||
[XmlIgnore] public Dictionary<int, string> SoundEffects = new Dictionary<int, string>();
|
||||
//[XmlIgnore] public Dictionary<int, string> SoundEffects = new Dictionary<int, string>();
|
||||
//[XmlIgnore] public int duration;
|
||||
|
||||
public virtual int duration { get { return 0; } }
|
||||
|
||||
public abstract void BuildSimpleCurves();
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using UnityEngine;
|
||||
|
@ -20,6 +21,8 @@ namespace RimWorldAnimationStudio
|
|||
[XmlIgnore] public SimpleCurve HeadFacing = new SimpleCurve();
|
||||
[XmlIgnore] public SimpleCurve BodyFacing = new SimpleCurve();
|
||||
|
||||
public override int duration { get { return keyframes.Max(x => x.atTick.Value); } }
|
||||
|
||||
public override void BuildSimpleCurves()
|
||||
{
|
||||
BodyAngle.Clear();
|
||||
|
@ -36,7 +39,6 @@ namespace RimWorldAnimationStudio
|
|||
foreach (PawnKeyframe frame in keyframes)
|
||||
{ duration += frame.tickDuration; }
|
||||
|
||||
this.duration = duration;
|
||||
int keyframePosition = 0;
|
||||
|
||||
for (int i = 0; i < keyframes.Count; i++)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
|
@ -13,9 +14,12 @@ namespace RimWorldAnimationStudio
|
|||
[XmlIgnore] public SimpleCurve PositionZ = new SimpleCurve();
|
||||
[XmlIgnore] public SimpleCurve Rotation = new SimpleCurve();
|
||||
|
||||
public override int duration { get { return keyframes.Max(x => x.atTick.Value); } }
|
||||
|
||||
public override void BuildSimpleCurves()
|
||||
{
|
||||
int duration = 0;
|
||||
|
||||
//getting the length of the whole clip
|
||||
foreach (ThingKeyframe frame in keyframes)
|
||||
{
|
||||
|
@ -23,7 +27,7 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
|
||||
//guarantees loops don't get cut off mid-anim
|
||||
this.duration = duration;
|
||||
//this.duration = duration;
|
||||
|
||||
int keyframePosition = 0;
|
||||
foreach (ThingKeyframe frame in keyframes)
|
||||
|
@ -33,9 +37,6 @@ namespace RimWorldAnimationStudio
|
|||
PositionX.Add((float)frame.atTick / (float)duration, frame.positionX, true);
|
||||
PositionZ.Add((float)frame.atTick / (float)duration, frame.positionZ, true);
|
||||
Rotation.Add((float)frame.atTick / (float)duration, frame.rotation, true);
|
||||
|
||||
if (frame.soundEffect != null)
|
||||
{ SoundEffects.Add((int)frame.atTick, frame.soundEffect); }
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -44,9 +45,6 @@ namespace RimWorldAnimationStudio
|
|||
PositionZ.Add((float)keyframePosition / (float)duration, frame.positionZ, true);
|
||||
Rotation.Add((float)keyframePosition / (float)duration, frame.rotation, true);
|
||||
|
||||
if (frame.soundEffect != null)
|
||||
{ SoundEffects.Add(keyframePosition, frame.soundEffect); }
|
||||
|
||||
keyframePosition += frame.tickDuration;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
|
@ -27,5 +29,53 @@ namespace RimWorldAnimationStudio
|
|||
animationTimeTicks += stage.playTimeTicks;
|
||||
}
|
||||
}
|
||||
|
||||
public void RunPreSaveOperations()
|
||||
{
|
||||
// Stage edits
|
||||
for (int i = 0; i < animationStages.Count; i++)
|
||||
{
|
||||
AnimationStage stage = animationStages[i];
|
||||
|
||||
// Sort keyframes by atTick
|
||||
foreach (PawnAnimationClip clip in stage.animationClips)
|
||||
{ clip.keyframes = clip.keyframes.OrderBy(x => x.atTick).ToList(); }
|
||||
|
||||
// Check if looping
|
||||
int stageWindowSize = animationStages[i].stageWindowSize > 0 ? animationStages[i].stageWindowSize : animationStages[i].animationClips.Select(x => x.duration).Max();
|
||||
int cycles = Mathf.CeilToInt(animationStages[i].playTimeTicks / stageWindowSize);
|
||||
|
||||
Debug.Log(animationStages[i].playTimeTicks);
|
||||
Debug.Log(animationStages[i].stageWindowSize);
|
||||
Debug.Log(cycles);
|
||||
stage.isLooping = cycles > 1;
|
||||
}
|
||||
|
||||
// Body part list edit
|
||||
foreach (Actor actor in actors)
|
||||
{
|
||||
actor.isFucking = actor.requiredGenitals.Contains("Any appendage");
|
||||
|
||||
if (actor.isFucking == true)
|
||||
{ actor.requiredGenitals.Remove("Any appendage"); }
|
||||
|
||||
actor.isFucked= actor.requiredGenitals.Contains("Any orifice");
|
||||
|
||||
if (actor.isFucked == true)
|
||||
{ actor.requiredGenitals.Remove("Any orifice"); }
|
||||
}
|
||||
}
|
||||
|
||||
public void RunPostLoadOperations()
|
||||
{
|
||||
foreach (Actor actor in actors)
|
||||
{
|
||||
if (actor.isFucking == true)
|
||||
{ actor.requiredGenitals.Add("Any appendage"); }
|
||||
|
||||
if (actor.isFucked == true)
|
||||
{ actor.requiredGenitals.Add("Any orifice"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void Initialize()
|
||||
{
|
||||
foreach (AnimationClip clip in animationClips)
|
||||
foreach (PawnAnimationClip clip in animationClips)
|
||||
{
|
||||
clip.BuildSimpleCurves();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue