Improvements to timeline

This commit is contained in:
AbstractConcept 2022-09-18 01:52:54 -05:00
parent d2ca61c61c
commit 591b176924
99 changed files with 460 additions and 359 deletions

View file

@ -66,12 +66,10 @@ namespace RimWorldAnimationStudio
if (ghostSliders.childCount <= i)
{ Instantiate(ghostSliderPrefab, ghostSliders); }
GameObject ghostSliderObject = ghostSliders.GetChild(i).gameObject;
Debug.Log(ghostSliderObject);
GameObject ghostSliderObject = ghostSliders.GetChild(i).gameObject;
ghostSliderObject.SetActive(true);
Slider ghostSlider = ghostSliderObject.GetComponent<Slider>();
Debug.Log(ghostSlider);
ghostSlider.value = (int)((i + 1) * clip.duration + keyframe.atTick);
float mult = 1f - Mathf.Pow((float)i / maxGhosts, 2);
@ -96,12 +94,20 @@ namespace RimWorldAnimationStudio
public void OnPointerClick(PointerEventData eventData)
{
Activate();
Workspace.actorID = actorID;
Workspace.keyframeID = keyframeID;
if (eventData.clickCount >= 2)
{
AnimationController.Instance.stageTick = keyframe.atTick.Value;
}
}
public void OnBeginDrag(PointerEventData eventData)
{
Activate();
AnimationController.Instance.stageTick = keyframe.atTick.Value;
Workspace.actorID = actorID;
Workspace.keyframeID = keyframeID;
if (keyframe.atTick == 1)
{ return; }
@ -113,7 +119,8 @@ namespace RimWorldAnimationStudio
{
base.OnDrag(eventData);
Activate();
AnimationController.Instance.stageTick = keyframe.atTick.Value;
Workspace.actorID = actorID;
}
public void OnEndDrag(PointerEventData eventData)
@ -121,23 +128,21 @@ namespace RimWorldAnimationStudio
interactable = false;
}
public void Activate()
protected override void Update()
{
AnimationController.Instance.stageTick = keyframe.atTick.Value;
base.Update();
Workspace.keyframeID = keyframeID;
if (Workspace.keyframeID == keyframeID && AnimationController.Instance.stageTick == keyframe.atTick.Value)
{ transform.FindDeepChild("Handle").GetComponent<Image>().color = Constants.ColorPurple; }
foreach (AnimationTimeline _timeline in AnimationController.Instance.animationTimelines.GetComponentsInChildren<AnimationTimeline>())
{
foreach (KeyframeSlider keyframeSlider in _timeline.GetComponentsInChildren<KeyframeSlider>())
{
if (keyframeSlider.keyframe.atTick.Value == keyframe.atTick.Value)
{ keyframeSlider.transform.FindDeepChild("Handle").GetComponent<Image>().color = new Color(0f, 1f, 0f); }
else if (Workspace.keyframeID == keyframeID)
{ transform.FindDeepChild("Handle").GetComponent<Image>().color = Constants.ColorCyan; }
else
{ keyframeSlider.transform.FindDeepChild("Handle").GetComponent<Image>().color = new Color(1f, 1f, 1f); }
}
}
else if (AnimationController.Instance.stageTick == keyframe.atTick.Value)
{ transform.FindDeepChild("Handle").GetComponent<Image>().color = Constants.ColorPink; }
else
{ transform.FindDeepChild("Handle").GetComponent<Image>().color = Constants.ColorWhite; }
}
}
}