Fix HipsTarget animator setting not being persistent
This commit is contained in:
parent
165378cb6e
commit
e09ad0b2e3
@ -59,9 +59,9 @@ namespace Passer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Disable
|
#region Disable
|
||||||
public void OnDisable() {
|
public void OnDisable() {
|
||||||
if (humanoid == null) {
|
if (humanoid == null) {
|
||||||
// This target is not connected to a humanoid, so we delete it
|
// This target is not connected to a humanoid, so we delete it
|
||||||
@ -78,9 +78,9 @@ namespace Passer {
|
|||||||
foreach (TargetProps props in allProps)
|
foreach (TargetProps props in allProps)
|
||||||
props.SetSensor2Target();
|
props.SetSensor2Target();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Inspector
|
#region Inspector
|
||||||
|
|
||||||
public override void OnInspectorGUI() {
|
public override void OnInspectorGUI() {
|
||||||
if (hipsTarget == null || humanoid == null)
|
if (hipsTarget == null || humanoid == null)
|
||||||
@ -109,7 +109,8 @@ namespace Passer {
|
|||||||
return foundHumanoid;
|
return foundHumanoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Sensors
|
#region Sensors
|
||||||
|
|
||||||
public bool showSensors = true;
|
public bool showSensors = true;
|
||||||
private void SensorInspectors(HipsTarget hipsTarget) {
|
private void SensorInspectors(HipsTarget hipsTarget) {
|
||||||
showSensors = EditorGUILayout.Foldout(showSensors, "Controllers", true);
|
showSensors = EditorGUILayout.Foldout(showSensors, "Controllers", true);
|
||||||
@ -119,14 +120,27 @@ namespace Passer {
|
|||||||
foreach (TargetProps props in allProps)
|
foreach (TargetProps props in allProps)
|
||||||
props.Inspector();
|
props.Inspector();
|
||||||
|
|
||||||
if (humanoid.animatorEnabled)
|
AnimatorInspector(hipsTarget);
|
||||||
hipsTarget.torsoAnimator.enabled = EditorGUILayout.ToggleLeft("Procedural Animation", hipsTarget.torsoAnimator.enabled, GUILayout.MinWidth(80));
|
|
||||||
EditorGUI.indentLevel--;
|
EditorGUI.indentLevel--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Configuration
|
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
|
||||||
private void InitConfiguration(HipsTarget target) {
|
private void InitConfiguration(HipsTarget target) {
|
||||||
if (target.humanoid.avatarRig == null)
|
if (target.humanoid.avatarRig == null)
|
||||||
return;
|
return;
|
||||||
@ -161,7 +175,7 @@ namespace Passer {
|
|||||||
UpdateChestBones(target.chest);
|
UpdateChestBones(target.chest);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Chest
|
#region Chest
|
||||||
private void InitChestConfiguration(HipsTarget.TargetedChestBone upperLeg) {
|
private void InitChestConfiguration(HipsTarget.TargetedChestBone upperLeg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,9 +198,9 @@ namespace Passer {
|
|||||||
private void UpdateChestBones(HipsTarget.TargetedChestBone chest) {
|
private void UpdateChestBones(HipsTarget.TargetedChestBone chest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Spine
|
#region Spine
|
||||||
private void InitSpineConfiguration(HipsTarget.TargetedSpineBone spine) {
|
private void InitSpineConfiguration(HipsTarget.TargetedSpineBone spine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,9 +222,9 @@ namespace Passer {
|
|||||||
|
|
||||||
private void UpdateSpineBones(HipsTarget.TargetedSpineBone spine) {
|
private void UpdateSpineBones(HipsTarget.TargetedSpineBone spine) {
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Hips
|
#region Hips
|
||||||
private void InitHipsConfiguration(HipsTarget.TargetedHipsBone hips) {
|
private void InitHipsConfiguration(HipsTarget.TargetedHipsBone hips) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,11 +234,11 @@ namespace Passer {
|
|||||||
|
|
||||||
private void UpdateHipsBones(HipsTarget.TargetedHipsBone hips) {
|
private void UpdateHipsBones(HipsTarget.TargetedHipsBone hips) {
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Settings
|
#region Settings
|
||||||
|
|
||||||
protected SerializedProperty bodyRotationProp;
|
protected SerializedProperty bodyRotationProp;
|
||||||
|
|
||||||
@ -245,11 +259,11 @@ namespace Passer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Scene
|
#region Scene
|
||||||
|
|
||||||
public void OnSceneGUI() {
|
public void OnSceneGUI() {
|
||||||
if (Application.isPlaying)
|
if (Application.isPlaying)
|
||||||
@ -279,7 +293,7 @@ namespace Passer {
|
|||||||
humanoid.UpdateSensorsFromTargets();
|
humanoid.UpdateSensorsFromTargets();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public abstract class TargetProps {
|
public abstract class TargetProps {
|
||||||
public SerializedProperty enabledProp;
|
public SerializedProperty enabledProp;
|
||||||
|
@ -57,6 +57,9 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
#region Sensors
|
#region Sensors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Controls the hips when no tracking is active
|
||||||
|
/// </summary>
|
||||||
public TorsoAnimator torsoAnimator = new TorsoAnimator();
|
public TorsoAnimator torsoAnimator = new TorsoAnimator();
|
||||||
public override Passer.Sensor animator { get { return torsoAnimator; } }
|
public override Passer.Sensor animator { get { return torsoAnimator; } }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user