예제 #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            if (target != null)
            {
                InspectorUIUtility.RenderHelpURL(target.GetType());
            }

            bool trackedObjectChanged = false;

            EditorGUI.BeginChangeCheck();

            InspectorUIUtility.DrawEnumSerializedProperty(trackedTargetProperty, TrackedTypeLabel, solverHandler.TrackedTargetType);

            if (!SolverHandler.IsValidTrackedObjectType(solverHandler.TrackedTargetType))
            {
                InspectorUIUtility.DrawWarning(" Current Tracked Target Type value of \""
                                               + Enum.GetName(typeof(TrackedObjectType), solverHandler.TrackedTargetType)
                                               + "\" is obsolete. Select MotionController or HandJoint values instead");
            }

            if (trackedTargetProperty.enumValueIndex == (int)TrackedObjectType.HandJoint ||
                trackedTargetProperty.enumValueIndex == (int)TrackedObjectType.MotionController)
            {
                EditorGUILayout.PropertyField(trackedHandnessProperty);
                if (trackedHandnessProperty.enumValueIndex > (int)Handedness.Both)
                {
                    InspectorUIUtility.DrawWarning("Only Handedness values of None, Left, Right, and Both are valid");
                }
            }

            if (trackedTargetProperty.enumValueIndex == (int)TrackedObjectType.HandJoint)
            {
                EditorGUILayout.PropertyField(trackedHandJointProperty);
            }
            else if (trackedTargetProperty.enumValueIndex == (int)TrackedObjectType.CustomOverride)
            {
                EditorGUILayout.PropertyField(transformOverrideProperty);
            }

            EditorGUILayout.PropertyField(additionalOffsetProperty);
            EditorGUILayout.PropertyField(additionalRotationProperty);

            trackedObjectChanged = EditorGUI.EndChangeCheck();

            EditorGUILayout.PropertyField(updateSolversProperty);

            serializedObject.ApplyModifiedProperties();

            if (EditorApplication.isPlaying && trackedObjectChanged)
            {
                solverHandler.RefreshTrackedObject();
            }
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorGUILayout.Space();

            bool trackedObjectChanged = false;

            if (transformTargetProperty.objectReferenceValue == null || Application.isPlaying)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(trackedObjectProperty);
                if (trackedObjectProperty.enumValueIndex == (int)TrackedObjectType.HandJointLeft ||
                    trackedObjectProperty.enumValueIndex == (int)TrackedObjectType.HandJointRight)
                {
                    EditorGUILayout.PropertyField(trackedHandJointProperty);
                }
                else if (trackedObjectProperty.enumValueIndex == (int)TrackedObjectType.MotionControllerLeft ||
                         trackedObjectProperty.enumValueIndex == (int)TrackedObjectType.MotionControllerRight)
                {
                    // TODO: Add tracked controller element back in. Pending visualization system updates.
                    // EditorGUILayout.PropertyField(trackedControllerElementProperty);
                }

                trackedObjectChanged = EditorGUI.EndChangeCheck();
            }

            EditorGUILayout.PropertyField(transformTargetProperty, trackedTransformGUIContent);

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(additionalOffsetProperty);
            EditorGUILayout.PropertyField(additionalRotationProperty);
            bool additionalOffsetChanged = EditorGUI.EndChangeCheck();

            EditorGUILayout.PropertyField(updateSolversProperty);

            serializedObject.ApplyModifiedProperties();

            if (Application.isPlaying && trackedObjectChanged)
            {
                solverHandler.RefreshTrackedObject();
            }

            if (Application.isPlaying && additionalOffsetChanged)
            {
                solverHandler.AdditionalOffset   = additionalOffsetProperty.vector3Value;
                solverHandler.AdditionalRotation = additionalRotationProperty.vector3Value;
            }
        }
예제 #3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorGUILayout.Space();

            bool trackedObjectChanged = false;

            if (transformTargetProperty.objectReferenceValue == null || Application.isPlaying)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(trackedObjectProperty);
                trackedObjectChanged = EditorGUI.EndChangeCheck();
            }

            EditorGUILayout.PropertyField(transformTargetProperty, trackedTransformGUIContent);

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(additionalOffsetProperty);
            EditorGUILayout.PropertyField(additionalRotationProperty);
            bool additionalOffsetChanged = EditorGUI.EndChangeCheck();

            EditorGUILayout.PropertyField(updateSolversProperty);

            serializedObject.ApplyModifiedProperties();

            if (Application.isPlaying && trackedObjectChanged)
            {
                solverHandler.RefreshTrackedObject();
            }

            if (Application.isPlaying && additionalOffsetChanged)
            {
                solverHandler.AdditionalOffset   = additionalOffsetProperty.vector3Value;
                solverHandler.AdditionalRotation = additionalRotationProperty.vector3Value;
            }
        }