Basic actor timelines and keyframe tweaking

This commit is contained in:
AbstractConcept 2022-09-16 09:18:06 -05:00
parent 0364322d46
commit dfa564759b
246 changed files with 1918 additions and 150 deletions

View file

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
namespace RimWorldAnimationStudio
{
public class AnimationTimeline : MonoBehaviour
{
public int actorID;
public KeyframeSlider keyframeSliderPrefab;
public void Initialize(int actorID)
{
this.actorID = actorID;
PawnAnimationClip clip = Workspace.Instance.GetPawnAnimationClip(actorID);
if (clip == null || clip.keyframes.NullOrEmpty())
{
Debug.Log("Clip was empty");
clip = new PawnAnimationClip();
clip.keyframes.Add(new PawnKeyframe());
clip.BuildSimpleCurves();
}
foreach (PawnKeyframe keyframe in clip.keyframes)
{
KeyframeSlider keyframeSlider = Instantiate(keyframeSliderPrefab, transform);
keyframeSlider.Initialize(this, actorID, keyframe.keyframeID);
}
}
public void AddKeyFrame(int atTick)
{
}
public bool CanAddKeyFrameAtTick(int atTick)
{
foreach (Transform child in transform)
{
KeyframeSlider keyframeSlider = child.GetComponent<KeyframeSlider>();
if (keyframeSlider != null && Workspace.Instance.GetPawnKeyframe(keyframeSlider.actorID, keyframeSlider.keyframeID).atTick == atTick)
{ return false; }
}
return true;
}
}
}