Fix HipsTarget animator setting not being persistent

This commit is contained in:
Pascal Serrarens 2022-01-17 17:43:17 +01:00
parent 165378cb6e
commit e09ad0b2e3
2 changed files with 38 additions and 21 deletions

View File

@ -110,6 +110,7 @@ namespace Passer {
}
#region Sensors
public bool showSensors = true;
private void SensorInspectors(HipsTarget hipsTarget) {
showSensors = EditorGUILayout.Foldout(showSensors, "Controllers", true);
@ -119,11 +120,24 @@ namespace Passer {
foreach (TargetProps props in allProps)
props.Inspector();
if (humanoid.animatorEnabled)
hipsTarget.torsoAnimator.enabled = EditorGUILayout.ToggleLeft("Procedural Animation", hipsTarget.torsoAnimator.enabled, GUILayout.MinWidth(80));
AnimatorInspector(hipsTarget);
EditorGUI.indentLevel--;
}
}
private void AnimatorInspector(HipsTarget hipsTarget) {
SerializedProperty animatorProp = serializedObject.FindProperty(nameof(HipsTarget.torsoAnimator) + "." + nameof(HipsTarget.torsoAnimator.enabled));
if (animatorProp == null || hipsTarget.humanoid == null || hipsTarget.humanoid.animatorEnabled)
return;
GUIContent text = new GUIContent(
"Procedural Animation",
"Controls the hips when no tracking is active"
);
animatorProp.boolValue = EditorGUILayout.ToggleLeft(text, animatorProp.boolValue, GUILayout.MinWidth(80));
}
#endregion
#region Configuration

View File

@ -57,6 +57,9 @@ namespace Passer.Humanoid {
#region Sensors
/// <summary>
/// Controls the hips when no tracking is active
/// </summary>
public TorsoAnimator torsoAnimator = new TorsoAnimator();
public override Passer.Sensor animator { get { return torsoAnimator; } }