Beispiel #1
0
        private void InspectJoint(BioJoint joint)
        {
            Undo.RecordObject(joint, joint.name);

            SetGUIColor(Color13);
            using (new EditorGUILayout.VerticalScope("Box")) {
                SetGUIColor(Color5);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                EditorGUILayout.HelpBox("                    Joint                    ", MessageType.None);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                SetGUIColor(Color1);
                joint.enabled = EditorGUILayout.Toggle("Enabled", joint.enabled);

                SetGUIColor(Color4);
                EditorGUILayout.HelpBox("Geometry", MessageType.None);
                SetGUIColor(Color1);
                joint.JointType = (JointType)EditorGUILayout.EnumPopup("Joint Type", joint.JointType);
                SetGUIColor(Color1);
                joint.SetAnchor(EditorGUILayout.Vector3Field("Anchor", joint.GetAnchor()));
                SetGUIColor(Color1);
                joint.SetOrientation(EditorGUILayout.Vector3Field("Orientation", joint.GetOrientation()));
                SetGUIColor(Color4);
                EditorGUILayout.HelpBox("Default Frame", MessageType.None);
                SetGUIColor(Color1);
                Vector3 defaultPosition = EditorGUILayout.Vector3Field("Position", joint.GetDefaultPosition());
                SetGUIColor(Color1);
                Quaternion defaultRotation = Quaternion.Euler(EditorGUILayout.Vector3Field("Rotation", joint.GetDefaultRotation().eulerAngles));
                joint.SetDefaultFrame(defaultPosition, defaultRotation);

                InspectMotion(joint.X, "     X Motion     ");
                InspectMotion(joint.Y, "     Y Motion     ");
                InspectMotion(joint.Z, "     Z Motion     ");

                GUI.skin.button.alignment = TextAnchor.MiddleCenter;
                SetGUIColor(Color7);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Remove", GUILayout.Width(100f)))
                {
                    joint.Remove();
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }

            if (joint != null)
            {
                joint.PrecaptureAnimation();
                joint.PostcaptureAnimation();
                joint.UpdateData();
                joint.ProcessMotion();
                EditorUtility.SetDirty(joint);
            }
        }
Beispiel #2
0
 private void DrawJoint(BioJoint joint, bool final)
 {
     if (!final)
     {
         DoF += joint.GetDoF();
     }
     //DrawDottedLine(joint.Segment.Transform.position, joint.GetAnchorInWorldSpace(), 5f, Color.magenta);
     DrawCube(joint.GetAnchorInWorldSpace(), joint.Segment.Transform.rotation * Quaternion.Euler(joint.GetOrientation()), 0.025f, Color.magenta);
     DrawMotion(joint.X, Color.red, final);
     DrawMotion(joint.Y, Color.green, final);
     DrawMotion(joint.Z, Color.blue, final);
 }