mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Stage and anim lengths display
This commit is contained in:
parent
ab5a2a4c02
commit
cc28ac4bd4
174 changed files with 604 additions and 245 deletions
|
@ -21,14 +21,10 @@ namespace RimWorldAnimationStudio
|
|||
anchorTransform = transform.parent;
|
||||
this.actorID = actorID;
|
||||
|
||||
Reset();
|
||||
|
||||
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();
|
||||
|
@ -39,12 +35,27 @@ namespace RimWorldAnimationStudio
|
|||
KeyframeSlider keyframeSlider = Instantiate(keyframeSliderPrefab, transform);
|
||||
keyframeSlider.Initialize(this, actorID, keyframe.keyframeID);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
foreach(KeyframeSlider keyframeSlider in GetComponentsInChildren<KeyframeSlider>())
|
||||
{ Destroy(keyframeSlider.gameObject); }
|
||||
int keyframeCount = clip.keyframes.Count;
|
||||
int childCount = GetComponentsInChildren<KeyframeSlider>().Count();
|
||||
|
||||
for (int i = 0; i < Mathf.Max(keyframeCount, childCount); i++)
|
||||
{
|
||||
// Add new keyframe sliders as required
|
||||
if (i >= childCount)
|
||||
{ Instantiate(keyframeSliderPrefab, transform); }
|
||||
|
||||
// Get objects to update
|
||||
KeyframeSlider keyframeSlider = GetComponentsInChildren<KeyframeSlider>()[i];
|
||||
|
||||
// Update values
|
||||
if (i < keyframeCount)
|
||||
{ keyframeSlider.Initialize(this, actorID, clip.keyframes[i].keyframeID); }
|
||||
|
||||
// Remove excess objects as required
|
||||
else
|
||||
{ Destroy(keyframeSlider.gameObject); }
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPawnKeyFrame(int keyframeID)
|
||||
|
@ -70,6 +81,8 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void InitiateUpdateOfGhostFrames()
|
||||
{
|
||||
if (AnimationController.Instance.IsTimelineDirty()) return;
|
||||
|
||||
BroadcastMessage("UpdateGhostFrames");
|
||||
}
|
||||
|
||||
|
@ -79,12 +92,7 @@ namespace RimWorldAnimationStudio
|
|||
int? siblingCount = anchorTransform.parent.GetComponentsInChildren<AnimationTimeline>()?.ToList()?.Count();
|
||||
|
||||
if (siblingIndex != null && siblingCount != null && MoveAnimationTimeline(siblingIndex.Value, delta))
|
||||
{
|
||||
//siblingIndex = Mathf.Clamp(siblingCount.Value + delta, 0, siblingCount.Value - 1);
|
||||
//transform.SetSiblingIndex(transform.GetSiblingIndex() + delta);
|
||||
AnimationController.Instance.ResetAnimationTimeline();
|
||||
AnimationController.Instance.InitializeAnimationTimeline();
|
||||
}
|
||||
{ AnimationController.Instance.InitializeAnimationTimeline(); }
|
||||
}
|
||||
|
||||
public bool MoveAnimationTimeline(int startIndex, int delta)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue