public override Module Init(MotionData data) { Data = data; Bones = new bool[Data.Root.Bones.Length]; Record = Data.Mirrored; Phases[0] = new LocalPhaseFunction("Head", new int[2] { 4, 5 }, this); if (Data.Mirrored) { Phases[1] = new LocalPhaseFunction("Left Hand", new int[5] { 7, 8, 9, 10, 11 }, this); Phases[2] = new LocalPhaseFunction("Right Hand", new int[5] { 12, 13, 14, 15, 16 }, this); } else { Phases[1] = new LocalPhaseFunction("Left Hand", new int[5] { 12, 13, 14, 15, 16 }, this); Phases[2] = new LocalPhaseFunction("Right Hand", new int[5] { 7, 8, 9, 10, 11 }, this); } Compute(); return(this); }
public override void DerivedInspector(MotionEditor editor) { ShowVelocities = EditorGUILayout.Toggle("Show Velocities", ShowVelocities); ShowPositions = EditorGUILayout.Toggle("Show Positions", ShowPositions); ShowKeys = EditorGUILayout.Toggle("Show Keys", ShowKeys); Window = EditorGUILayout.FloatField("Window Time", Window); VelocityThreshold = EditorGUILayout.FloatField("Velocity Threshold", VelocityThreshold); PositionThreshold = EditorGUILayout.FloatField("Position Threshold", PositionThreshold); if (Phases[0] == null || Phases[0].LocalPhase == null || Record != Data.Mirrored) { Phases[0] = new LocalPhaseFunction("Head", new int[2] { 4, 5 }, this); if (Data.Mirrored) { Phases[1] = new LocalPhaseFunction("Left Hand", new int[5] { 7, 8, 9, 10, 11 }, this); Phases[2] = new LocalPhaseFunction("Right Hand", new int[5] { 12, 13, 14, 15, 16 }, this); } else { Phases[1] = new LocalPhaseFunction("Left Hand", new int[5] { 12, 13, 14, 15, 16 }, this); Phases[2] = new LocalPhaseFunction("Right Hand", new int[5] { 7, 8, 9, 10, 11 }, this); } Record = Data.Mirrored; Compute(); } if (GUILayout.Button("Compute")) { Compute(); } for (int i = 0; i < Phases.Length; i++) { EditorGUILayout.BeginHorizontal(); Phases[i].Visiable = EditorGUILayout.Toggle(Phases[i].Visiable, GUILayout.Width(20.0f)); EditorGUILayout.LabelField(Phases[i].Name); EditorGUILayout.EndHorizontal(); if (Phases[i].Visiable) { Phases[i].LocalPhase.Inspector(editor); } } }