mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Basic actor timelines and keyframe tweaking
This commit is contained in:
parent
0364322d46
commit
dfa564759b
246 changed files with 1918 additions and 150 deletions
56
Assets/Scripts/GUI/AnimationTimeline.cs
Normal file
56
Assets/Scripts/GUI/AnimationTimeline.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue