mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Squashed commit of the following:
commitaf4dab5546
Author: AbstractConcept <abstract.concept@mail.com> Date: Mon Oct 31 19:58:41 2022 -0500 Code refactor commite14a12f2ab
Author: AbstractConcept <abstract.concept@mail.com> Date: Mon Oct 31 00:44:53 2022 -0500 Code refactor commit5ca7e486f8
Author: AbstractConcept <abstract.concept@mail.com> Date: Fri Oct 28 19:52:58 2022 -0500 Code refactor commita55ba7b95b
Author: AbstractConcept <abstract.concept@mail.com> Date: Fri Oct 28 00:28:51 2022 -0500 Code refactor commit757badf4f6
Author: AbstractConcept <abstract.concept@mail.com> Date: Thu Oct 27 00:56:04 2022 -0500 Code refactor
This commit is contained in:
parent
cd4711a8e5
commit
bb2cc29393
603 changed files with 9200 additions and 7528 deletions
87
Assets/Scripts/GUI/Cards/ActorKeyframeCard.cs
Normal file
87
Assets/Scripts/GUI/Cards/ActorKeyframeCard.cs
Normal file
|
@ -0,0 +1,87 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class ActorKeyframeCard : Singleton<ActorKeyframeCard>
|
||||
{
|
||||
public InputField positionXField;
|
||||
public InputField positionZField;
|
||||
public InputField rotationField;
|
||||
public InputField headBobField;
|
||||
public InputField headRotationField;
|
||||
public InputField appendageRotationField;
|
||||
|
||||
public ActorAddonCard actorAddonCardPrefab;
|
||||
public ActorAddonKeyframeCard actorAddonKeyframeCardPrefab;
|
||||
|
||||
public Transform actorAddonCards;
|
||||
public Transform actorKeyframeCards;
|
||||
|
||||
public SelectActorAddonsDialog selectActorAddonsDialog;
|
||||
|
||||
private Actor actor { get { return Workspace.GetCurrentActor(); } }
|
||||
|
||||
private void Start()
|
||||
{
|
||||
EventsManager.onAnimationChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onStageIDChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onActorIDChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onStageTickChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onKeyframeCountChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onPawnKeyframeChanged.AddListener(delegate { UpdateGUI(); });
|
||||
|
||||
positionXField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
positionZField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
rotationField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
headBobField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
headRotationField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
appendageRotationField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
|
||||
foreach (ActorAddonDef actorAddonDef in ActorAddonDefs.allDefs)
|
||||
{
|
||||
ActorAddonKeyframeCard actorAddonKeyframeCard = Instantiate(actorAddonKeyframeCardPrefab, actorKeyframeCards);
|
||||
actorAddonKeyframeCard.Initialize(actorAddonDef);
|
||||
|
||||
ActorAddonCard actorAddonCard = Instantiate(actorAddonCardPrefab, actorAddonCards);
|
||||
actorAddonCard.Initialize(actorAddonDef, actorAddonKeyframeCard);
|
||||
|
||||
selectActorAddonsDialog.AddActorAddonCard(actorAddonCard);
|
||||
}
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
public void OnValueChanged()
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
keyframe.BodyOffsetX = float.Parse(positionXField.text);
|
||||
keyframe.BodyOffsetZ = float.Parse(positionZField.text);
|
||||
keyframe.BodyAngle = float.Parse(rotationField.text);
|
||||
keyframe.HeadBob = float.Parse(headBobField.text);
|
||||
keyframe.HeadAngle = float.Parse(headRotationField.text);
|
||||
keyframe.GenitalAngle = float.Parse(appendageRotationField.text);
|
||||
|
||||
Workspace.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
public void UpdateGUI()
|
||||
{
|
||||
ActorPosition actorPosition = actor.GetCurrentPosition();
|
||||
|
||||
positionXField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.bodyOffsetX));
|
||||
positionZField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.bodyOffsetZ));
|
||||
rotationField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.bodyAngle));
|
||||
headBobField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.headBob));
|
||||
headRotationField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.headAngle));
|
||||
appendageRotationField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.genitalAngle));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue