public override void OnInspectorGUI()
    {
        serializedObject.Update();
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(firstDevice, new GUIContent("First Calibration Device (Mannequin)", ""));
        EditorGUILayout.PropertyField(secondDevice, new GUIContent("Second Calibration Device (Wand)", ""));
        EditorGUILayout.PropertyField(numberOfSamplesToTake, new GUIContent("Number Of Samples To Take", ""));
        EditorGUILayout.PropertyField(samplesPerSecond, new GUIContent("Samples Per Second", ""));

        RUISEditorUtility.HorizontalRuler();
        EditorGUILayout.PropertyField(xmlFilename, new GUIContent("Calibration XML File Name", ""));
        RUISEditorUtility.HorizontalRuler();
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(sampleCube, new GUIContent("Cube prefab", "Prefab of a cube that is used to visualize device samples"));
        EditorGUILayout.PropertyField(sampleSphere, new GUIContent("Sphere prefab", "Prefab of a sphere that is used to visualize device samples"));
        serializedObject.ApplyModifiedProperties();
    }
Example #2
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.PropertyField(displaySchema, new GUIContent("XML Schema", "Do not modify this unless you know what you're doing"));
        EditorGUILayout.PropertyField(xmlFilename, new GUIContent("XML filename", "The XML file with the display specifications"));
        EditorGUILayout.PropertyField(loadFromFileInEditor, new GUIContent("Load from File in Editor", "Load the information from the xml file while in editor mode."));

        EditorGUILayout.PropertyField(resolutionX, new GUIContent("Resolution X", "The pixel width of the display"));
        EditorGUILayout.PropertyField(resolutionY, new GUIContent("Resolution Y", "The pixel height of the display"));

        EditorGUILayout.PropertyField(isStereo, new GUIContent("Stereo Display", "Is this display stereo?"));
        if (isStereo.boolValue)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(eyeSeparation, new GUIContent("Eye Separation", "Eye separation for the stereo image"));
            EditorGUILayout.PropertyField(stereoType, new GUIContent("Stereo Type", "The type of stereo to use"));
            EditorGUILayout.PropertyField(useDoubleTheSpace, new GUIContent("Double the Space used", "Calculate the total resolution of the display based on stereo type. \nSideBySide: Double horizontal resolution \nTopAndBottom: Double vertical resolution."));
            EditorGUI.indentLevel--;
        }

        EditorGUILayout.PropertyField(camera, new GUIContent("Attached Camera", "The RUISCamera that renders to this display"));



        EditorGUILayout.PropertyField(enableOculusRift, new GUIContent("Enable Oculus Rift", "Is this display an Oculus Rift?"));

        // TODO: Depends on OVR version
        EditorGUI.indentLevel++;
        GUI.enabled = enableOculusRift.boolValue;
        EditorGUILayout.PropertyField(oculusLowPersistence, new GUIContent("Low Persistence", "Low persistence reduces pixel blur. Try disabling this option if "
                                                                           + "the Oculus Rift view suffers from 'judder' when rotating your head. NOTE: Disabling "
                                                                           + "this option might cause issues with Oculus runtime 0.4.4 if you're using DX11!"));
        EditorGUILayout.PropertyField(oculusMirrorMode, new GUIContent("Mirror Mode", "Draw the Oculus viewports also to the main display when Direct Display Mode "
                                                                       + "(Direct HMD Access) is enabled from the Oculus Configuration Utility. This setting has no "
                                                                       + "effect when your application is playing inside the Unity Editor."));
        if (enableOculusRift.boolValue && EditorApplication.isPlaying)
        {
            if (previousOculusLowPersistenceValue != oculusLowPersistence.boolValue && displayManager)
            {
                // Low Persistence value changed, enforce it if application is running in Editor
                displayManager.setOculusLowPersistence(oculusLowPersistence.boolValue);
            }
        }

        EditorGUI.indentLevel--;

        GUI.enabled = !enableOculusRift.boolValue;

        RUISEditorUtility.HorizontalRuler();
        EditorGUILayout.PropertyField(isObliqueFrustum, new GUIContent("Head Tracked CAVE Display", "Should the projection matrix be skewed to use this display "
                                                                       + "as a head tracked CAVE viewport"));

        GUI.enabled = true;

        if (!enableOculusRift.boolValue)
        {
            //disabled for now EditorGUILayout.PropertyField(isKeystoneCorrected, new GUIContent("Keystone Correction", "Should this display be keystone corrected?"));
            if (isObliqueFrustum.boolValue)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(headTracker, new GUIContent("CAVE Head Tracker", "The head tracker object to use for perspective "
                                                                          + "distortion with CAVE-like displays. This is used only if the associated "
                                                                          + "RUISDisplay has 'Head Tracked CAVE Display' enabled."));
                EditorGUILayout.PropertyField(displayWidth, new GUIContent("Display Width", "The real-world width of the display"));
                EditorGUILayout.PropertyField(displayHeight, new GUIContent("Display Height", "The real-world height of the display"));
                EditorGUILayout.PropertyField(displayCenterPosition, new GUIContent("Display Center Position", "The location of the screen center in Unity coordinates"));
                EditorGUILayout.PropertyField(displayNormal, new GUIContent("Display Normal Vector", "The normal vector of the display (will be normalized)"));
                EditorGUILayout.PropertyField(displayUp, new GUIContent("Display Up Vector", "The up vector of the display (will be normalized)"));
                EditorGUI.indentLevel--;
            }
        }
        else
        {
            isObliqueFrustum.boolValue    = false;
            isKeystoneCorrected.boolValue = false;
        }

        previousOculusLowPersistenceValue = oculusLowPersistence.boolValue;

        serializedObject.ApplyModifiedProperties();


        int optimalWidth  = Screen.width - 4;
        int optimalHeight = (int)((float)resolutionY.intValue / resolutionX.intValue * optimalWidth);

        EditorGUILayout.Space();
        EditorGUILayout.BeginHorizontal(GUILayout.Height(optimalHeight));


        if (isStereo.boolValue)
        {
            displayBoxStyle.normal.background = stereoDisplayTexture;
        }
        else
        {
            displayBoxStyle.normal.background = monoDisplayTexture;
        }

        RUISDisplay display   = target as RUISDisplay;
        int         requiredX = display.rawResolutionX;
        int         requiredY = display.rawResolutionY;
        string      boxText   = string.Format("{0}\nTotal required resolution {1}x{2}", target.name, requiredX, requiredY);

        GUILayout.Box(boxText, displayBoxStyle, GUILayout.Width(optimalWidth), GUILayout.Height(optimalHeight));

        EditorGUILayout.EndHorizontal();

        displayManager.CalculateTotalResolution();
        PlayerSettings.defaultScreenWidth  = displayManager.totalRawResolutionX;
        PlayerSettings.defaultScreenHeight = displayManager.totalRawResolutionY;
    }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.Space();

        EditorGUILayout.PropertyField(bodyTrackingDevice, new GUIContent("Body Tracking Device", "The source device for body tracking."));

        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(playerId, new GUIContent("Skeleton ID", "The player ID number"));
        if (bodyTrackingDevice.enumValueIndex == RUISSkeletonManager.kinect1SensorID || bodyTrackingDevice.enumValueIndex == RUISSkeletonManager.kinect2SensorID)
        {
            EditorGUILayout.PropertyField(switchToAvailableKinect, new GUIContent("Switch To Available Kinect", "Examine RUIS InputManager settings, and "
                                                                                  + "switch Body Tracking Device from Kinect 1 to Kinect 2 in run-time if "
                                                                                  + "the latter is enabled but the former is not, and vice versa."));
        }

        RUISEditorUtility.HorizontalRuler();

        EditorGUILayout.PropertyField(useHierarchicalModel, new GUIContent("Hierarchical Model", "Is the model rig hierarchical (a tree) "
                                                                           + "instead of non-hierarchical (all bones are on same level)?"));

        EditorGUILayout.PropertyField(updateRootPosition, new GUIContent("Update Root Position", "Update the position of this GameObject according "
                                                                         + "to the skeleton root position"));

        GUI.enabled = updateRootPosition.boolValue;
        EditorGUI.indentLevel++;
        EditorGUILayout.PropertyField(rootSpeedScaling, new GUIContent("Root Speed Scaling", "Multiply Kinect root position, making the character move "
                                                                       + "larger distances than Kinect tracking area allows. This is not propagated to "
                                                                       + "Skeleton Wands or other devices (e.g. head trackers) even if they are calibrated "
                                                                       + "with Kinect's coordinate system. Default and recommended value is (1,1,1)."));
        EditorGUI.indentLevel--;
        GUI.enabled = true;

        GUI.enabled = !useHierarchicalModel.boolValue;
        EditorGUILayout.PropertyField(updateJointPositions, new GUIContent("Update Joint Positions", "Unavailable for hierarchical "
                                                                           + "models, since there the skeleton structure already "
                                                                           + "handles positions with joint rotations."));
        if (useHierarchicalModel.boolValue)
        {
            updateJointPositions.boolValue = false;
        }
        GUI.enabled = true;

        EditorGUILayout.PropertyField(updateJointRotations, new GUIContent("Update Joint Rotations", "Enabling this is especially "
                                                                           + "important for hierarchical models."));


        EditorGUI.indentLevel++;

        EditorGUILayout.PropertyField(filterRotations, new GUIContent("Filter Rotations", "Smoothen rotations with a basic Kalman filter. For now this is "
                                                                      + "only done for the arm joints of Kinect 2 tracked skeletons."));
        EditorGUILayout.PropertyField(rotationNoiseCovariance, new GUIContent("Rotation Smoothness", "Sets the magnitude of rotation smoothing. "
                                                                              + "Larger values make the rotation smoother, but makes it less "
                                                                              + "responsive. Default value is 500."));

        if (Application.isEditor && skeletonController && skeletonController.skeletonManager &&
            skeletonController.skeletonManager.skeletons [skeletonController.bodyTrackingDeviceID, skeletonController.playerId] != null)
        {
            skeletonController.skeletonManager.skeletons [skeletonController.bodyTrackingDeviceID, skeletonController.playerId].filterRotations         = filterRotations.boolValue;
            skeletonController.skeletonManager.skeletons [skeletonController.bodyTrackingDeviceID, skeletonController.playerId].rotationNoiseCovariance =
                rotationNoiseCovariance.floatValue;
        }

        EditorGUILayout.PropertyField(oculusRotatesHead, new GUIContent("Oculus Rotates Head", "Rotate character head with Oculus Rift."));


        EditorGUI.indentLevel--;

        GUI.enabled = useHierarchicalModel.boolValue;
        EditorGUILayout.PropertyField(scaleHierarchicalModelBones, new GUIContent("Scale Bones", "Scale the bones of the model based on the "
                                                                                  + "real-life lengths of the player bones. This option is only "
                                                                                  + "available for hierarchical models."));

        GUI.enabled = scaleHierarchicalModelBones.boolValue;
        EditorGUI.indentLevel++;
        EditorGUILayout.PropertyField(boneLengthAxis, new GUIContent("Bone Length Axis", "Determines the axis that points the bone direction in each "
                                                                     + "joint transform of the animation rig. This value depends on your rig, and it is "
                                                                     + "only used if you have 'Scale Length Only' enabled or you are using Kinect 2 to "
                                                                     + "curl fingers (fist clenching). You can discover the correct axis by examining "
                                                                     + "the animation rig hierarchy, by looking at the directional axis between parent "
                                                                     + "joints and their child joints in local coordinate system. IMPORTANT: Disable the "
                                                                     + "below 'Scale Length Only' option if the same localScale axis is not consistently "
                                                                     + "used in all the joints of the animation rig."));
        EditorGUILayout.PropertyField(scaleBoneLengthOnly, new GUIContent("Scale Length Only", "Scale the bone length (localScale.x/y/z) but not the "
                                                                          + "bone thickness (localScale.yz/xz/xy). WARNING: Enabling this option could "
                                                                          + "lead to peculiar results, depending on the animation rig."));

        if (scaleBoneLengthOnly.boolValue)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(torsoThickness, new GUIContent("Torso Thickness", "Thickness scale for torso around its Length Axis."));
            EditorGUILayout.PropertyField(rightArmThickness, new GUIContent("Right Arm Thickness", "Thickness scale for right arm around its Length Axis."));
            EditorGUILayout.PropertyField(leftArmThickness, new GUIContent("Left Arm Thickness", "Thickness scale for left arm around its Length Axis."));
            EditorGUILayout.PropertyField(rightLegThickness, new GUIContent("Right Leg Thickness", "Thickness scale for right leg around its Length Axis."));
            EditorGUILayout.PropertyField(leftLegThickness, new GUIContent("Left Leg Thickness", "Thickness scale for left leg around its Length Axis."));
            EditorGUI.indentLevel--;
        }

        EditorGUI.indentLevel--;

        if (!useHierarchicalModel.boolValue)
        {
            scaleHierarchicalModelBones.boolValue = false;
        }
        if (!scaleHierarchicalModelBones.boolValue)
        {
            scaleBoneLengthOnly.boolValue = false;
        }

        GUI.enabled = true;

        EditorGUILayout.Space();


        if (bodyTrackingDevice.enumValueIndex == RUISSkeletonManager.customSensorID)
        {
            EditorGUILayout.Space();

            EditorGUILayout.TextArea("Place your custom motion tracker transforms below.", GUILayout.Height(20));

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Source for Torso and Head", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(customRoot, new GUIContent("Root Joint", "The skeleton hierarchy root bone"));
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(customTorso, new GUIContent("Torso", "The torso bone, has to be parent or grandparent of the hips"));
            EditorGUILayout.PropertyField(customNeck, new GUIContent("Neck", "The neck bone"));
            EditorGUILayout.PropertyField(customHead, new GUIContent("Head", "The head bone"));

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Source for Arms", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
            EditorGUILayout.PropertyField(customLeftShoulder, new GUIContent("Left Shoulder", "The left shoulder bone (upper arm)"));
            EditorGUILayout.PropertyField(customLeftElbow, new GUIContent("Left Elbow", "The left elbow bone (forearm)"));
            EditorGUILayout.PropertyField(customLeftHand, new GUIContent("Left Hand", "The left wrist bone (hand)"));
            EditorGUILayout.EndVertical();
            EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
            EditorGUILayout.PropertyField(customRightShoulder, new GUIContent("Right Shoulder", "The right shoulder bone (upper arm)"));
            EditorGUILayout.PropertyField(customRightElbow, new GUIContent("Right Elbow", "The right elbow bone (forearm)"));
            EditorGUILayout.PropertyField(customRightHand, new GUIContent("Right Hand", "The right wrist bone (hand)"));
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Source for Legs", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
            EditorGUILayout.PropertyField(customLeftHip, new GUIContent("Left Hip", "The left hip bone (thigh)"));
            EditorGUILayout.PropertyField(customLeftKnee, new GUIContent("Left Knee", "The left knee bone (shin)"));
            EditorGUILayout.PropertyField(customLeftFoot, new GUIContent("Left Foot", "The left ankle bone (foot)"));
            EditorGUILayout.EndVertical();
            EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
            EditorGUILayout.PropertyField(customRightHip, new GUIContent("Right Hip", "The right hip bone (thigh)"));
            EditorGUILayout.PropertyField(customRightKnee, new GUIContent("Right Knee", "The right knee bone (shin)"));
            EditorGUILayout.PropertyField(customRightFoot, new GUIContent("Right Foot", "The right ankle bone (foot)"));
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Source for Fingers", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
            EditorGUILayout.PropertyField(customLeftThumb, new GUIContent("Left Thumb", "The thumb of the left hand"));
            EditorGUILayout.EndVertical();
            EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
            EditorGUILayout.PropertyField(customRightThumb, new GUIContent("Right Thumb", "The thumb of the right hand"));
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
        }
        RUISEditorUtility.HorizontalRuler();
        EditorGUILayout.LabelField("Torso and Head Joints", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(rootBone, new GUIContent("Root Joint", "The skeleton hierarchy root bone"));
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(torsoBone, new GUIContent("Torso", "The torso bone, has to be parent or grandparent of the hips"));
        EditorGUILayout.PropertyField(neckBone, new GUIContent("Neck", "The neck bone"));
        EditorGUILayout.PropertyField(headBone, new GUIContent("Head", "The head bone"));

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Arm Joints", EditorStyles.boldLabel);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
        EditorGUILayout.PropertyField(leftShoulderBone, new GUIContent("Left Shoulder", "The left shoulder bone (upper arm)"));
        EditorGUILayout.PropertyField(leftElbowBone, new GUIContent("Left Elbow", "The left elbow bone (forearm)"));
        EditorGUILayout.PropertyField(leftHandBone, new GUIContent("Left Hand", "The left wrist bone (hand)"));
        EditorGUILayout.EndVertical();
        EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
        EditorGUILayout.PropertyField(rightShoulderBone, new GUIContent("Right Shoulder", "The right shoulder bone (upper arm)"));
        EditorGUILayout.PropertyField(rightElbowBone, new GUIContent("Right Elbow", "The right elbow bone (forearm)"));
        EditorGUILayout.PropertyField(rightHandBone, new GUIContent("Right Hand", "The right wrist bone (hand)"));
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();

        if (bodyTrackingDevice.enumValueIndex == RUISSkeletonManager.kinect2SensorID || bodyTrackingDevice.enumValueIndex == RUISSkeletonManager.customSensorID)
        {
            EditorGUILayout.PropertyField(trackWrist, new GUIContent("Track Wrist", "Track the rotation of the hand bone"));
        }

        // TODO: Restore this when implementation is fixed
//		if (bodyTrackingDevice.enumValueIndex == RUISSkeletonManager.kinect2SensorID)
//			EditorGUILayout.PropertyField(rotateWristFromElbow, new GUIContent("Wrist Rotates Lower Arm", "Should wrist rotate whole lower arm or just the hand?"));

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Leg Joints", EditorStyles.boldLabel);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
        EditorGUILayout.PropertyField(leftHipBone, new GUIContent("Left Hip", "The left hip bone (thigh)"));
        EditorGUILayout.PropertyField(leftKneeBone, new GUIContent("Left Knee", "The left knee bone (shin)"));
        EditorGUILayout.PropertyField(leftFootBone, new GUIContent("Left Foot", "The left ankle bone (foot)"));
        EditorGUILayout.EndVertical();
        EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
        EditorGUILayout.PropertyField(rightHipBone, new GUIContent("Right Hip", "The right hip bone (thigh)"));
        EditorGUILayout.PropertyField(rightKneeBone, new GUIContent("Right Knee", "The right knee bone (shin)"));
        EditorGUILayout.PropertyField(rightFootBone, new GUIContent("Right Foot", "The right ankle bone (foot)"));
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();

        if (bodyTrackingDevice.enumValueIndex == RUISSkeletonManager.kinect2SensorID || bodyTrackingDevice.enumValueIndex == RUISSkeletonManager.customSensorID)
        {
            EditorGUILayout.PropertyField(trackAnkle, new GUIContent("Track Ankle", "Track the rotation of the ankle bone"));
        }

        EditorGUILayout.Space();

        if (bodyTrackingDevice.enumValueIndex == RUISSkeletonManager.kinect2SensorID || bodyTrackingDevice.enumValueIndex == RUISSkeletonManager.customSensorID)
        {
            EditorGUILayout.LabelField("Finger Joints", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
            EditorGUILayout.PropertyField(leftThumb, new GUIContent("Left Thumb", "The thumb of the left hand"));
            EditorGUILayout.EndVertical();
            EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width / 2 - 20));
            EditorGUILayout.PropertyField(rightThumb, new GUIContent("Right Thumb", "The thumb of the right hand"));
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.PropertyField(fistCurlFingers, new GUIContent("Track Fist Clenching", "When user is making a fist, curl finger joints "
                                                                          + "(child gameObjects under 'Left Hand' and 'Right Hand' whose name include "
                                                                          + "the substring 'finger' or 'Finger'.). If you have assigned 'Left Thumb' " +
                                                                          "and 'Right Thumb', they will receive a slightly different finger curling."));
            EditorGUILayout.PropertyField(trackThumbs, new GUIContent("Track Thumbs", "Track thumb movement."));

            if (trackThumbs.boolValue)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(thumbZRotationOffset, new GUIContent("Z Rotation Offset", "Offset Z rotation of the thumb. Default value is "
                                                                                   + "45, but it might depend on your avatar rig."));
                EditorGUI.indentLevel--;
                if (Application.isEditor && skeletonController && skeletonController.skeletonManager &&
                    skeletonController.skeletonManager.skeletons [skeletonController.bodyTrackingDeviceID, skeletonController.playerId] != null)
                {
                    skeletonController.skeletonManager.skeletons [skeletonController.bodyTrackingDeviceID, skeletonController.playerId].thumbZRotationOffset =
                        thumbZRotationOffset.floatValue;
                }
            }
        }

        RUISEditorUtility.HorizontalRuler();

        EditorGUILayout.LabelField("Tweaking", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(minimumConfidenceToUpdate, new GUIContent("Min Confidence to Update", "The minimum confidence in joint "
                                                                                + "positions and rotations needed to update these values. "
                                                                                + "The confidence is either 0; 0,5; or 1."));
        EditorGUILayout.PropertyField(rotationDamping, new GUIContent("Max Joint Angular Velocity", "Maximum joint angular velocity can be used "
                                                                      + "for damping character bone movement (smaller values)"));

        GUI.enabled = scaleHierarchicalModelBones.boolValue;
        EditorGUILayout.PropertyField(maxScaleFactor, new GUIContent("Max Scale Rate", "The maximum amount the scale of a bone can "
                                                                     + "change per second when using Hierarchical Model and Scale Bones"));

        EditorGUILayout.PropertyField(adjustVerticalHipsPosition, new GUIContent("Hips Vertical Tweaker", "Offset the tracked hip center point "
                                                                                 + "position in the spine direction (usually vertical axis) "
                                                                                 + "when using Hierarchical Model and Scale Bones is enabled."));

        EditorGUILayout.PropertyField(neckHeightTweaker, new GUIContent("Neck Height Tweaker", "Offset the tracked neck position in the spine "
                                                                        + "direction (usually vertical axis) when using Hierarchical Model and "
                                                                        + "Scale Bones is enabled."));
        GUI.enabled = true;

        GUI.enabled = useHierarchicalModel.boolValue;
        EditorGUILayout.PropertyField(forearmLengthTweaker, new GUIContent("Forearm Length Tweaker", "The forearm length ratio "
                                                                           + "compared to the real-world value, use this to lengthen "
                                                                           + "or shorten the forearms. Only used if Hierarchical Model is enabled"));
        EditorGUILayout.PropertyField(shinLengthTweaker, new GUIContent("Shin Length Tweaker", "The shin length ratio compared to the "
                                                                        + "real-world value, use this to lengthen or shorten the "
                                                                        + "shins. Only used if Hierarchical Model is enabled"));
        EditorGUILayout.Space();

        GUI.enabled = true;

        serializedObject.ApplyModifiedProperties();
    }
Example #4
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.PropertyField(displaySchema, new GUIContent("XML Schema", "Do not modify this unless you know what you're doing"));
        EditorGUILayout.PropertyField(xmlFilename, new GUIContent("XML filename", "The XML file with the display specifications"));
        EditorGUILayout.PropertyField(loadFromFileInEditor, new GUIContent("Load from File in Editor", "Load the information from the xml file while in editor mode."));

        EditorGUILayout.PropertyField(resolutionX, new GUIContent("Resolution X", "The pixel width of the display"));
        EditorGUILayout.PropertyField(resolutionY, new GUIContent("Resolution Y", "The pixel height of the display"));

        EditorGUILayout.PropertyField(isStereo, new GUIContent("Split Stereo Display", "Set the display as a split screen stereo (Top And Bottom / Side By Side). The "
                                                               + "implementation of this stereo functionality does not use Unity's stereographic "
                                                               + "rendering. Enable this option only if you want to use stereo 3D with RUIS "
                                                               + "keystone correction or Head Tracked CAVE Display."));
        if (isStereo.boolValue)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(eyeSeparation, new GUIContent("Eye Separation", "Eye separation for the stereo image"));
            EditorGUILayout.PropertyField(stereoType, new GUIContent("Stereo Type", "The type of stereo to use"));
            EditorGUILayout.PropertyField(useDoubleTheSpace, new GUIContent("Double the Space used", "Calculate the total resolution of the "
                                                                            + "display based on stereo type. \nSideBySide: Double horizontal resolution \nTopAndBottom: "
                                                                            + "Double vertical resolution."));
            EditorGUI.indentLevel--;
        }

        EditorGUILayout.PropertyField(camera, new GUIContent("Attached Camera", "The RUISCamera that renders to this display"));



//		EditorGUILayout.PropertyField(isHmdDisplay, new GUIContent("Head-mounted Display", "Designate this display as a Head-mounted Display."));

//		EditorGUI.indentLevel++;
//		GUI.enabled = isHmdDisplay.boolValue;

//		EditorGUILayout.PropertyField(HmdMirrorMode, new GUIContent("HMD Mirror Mode", "Draw the head-mounted display view also to the main display."));

//		EditorGUI.indentLevel--;
//		GUI.enabled = !isHmdDisplay.boolValue;

        RUISEditorUtility.HorizontalRuler();
        EditorGUILayout.PropertyField(isObliqueFrustum, new GUIContent("Head Tracked CAVE Display", "Should the projection matrix be skewed to use this display "
                                                                       + "as a head tracked CAVE viewport"));

        GUI.enabled = true;

//		if(!isHmdDisplay.boolValue)
        {
            //disabled for now EditorGUILayout.PropertyField(isKeystoneCorrected, new GUIContent("Keystone Correction", "Should this display be keystone corrected?"));
            if (isObliqueFrustum.boolValue)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(headTracker, new GUIContent("CAVE Head Tracker", "The head tracker object to use for perspective "
                                                                          + "distortion with CAVE-like displays. This is used only if the associated "
                                                                          + "RUISDisplay has 'Head Tracked CAVE Display' enabled."));
                EditorGUILayout.PropertyField(displayWidth, new GUIContent("Display Width", "The real-world width of the display"));
                EditorGUILayout.PropertyField(displayHeight, new GUIContent("Display Height", "The real-world height of the display"));
                EditorGUILayout.PropertyField(displayCenterPosition, new GUIContent("Display Center Position", "The location of the screen center in Unity coordinates"));
                EditorGUILayout.PropertyField(displayNormal, new GUIContent("Display Normal Vector", "The normal vector of the display (will be normalized)"));
                EditorGUILayout.PropertyField(displayUp, new GUIContent("Display Up Vector", "The up vector of the display (will be normalized)"));
                EditorGUI.indentLevel--;
            }
        }
//		else
//		{
//			isObliqueFrustum.boolValue = false;
//			isKeystoneCorrected.boolValue = false;
//		}

        serializedObject.ApplyModifiedProperties();


        int optimalWidth  = Screen.width - 4;
        int optimalHeight = (int)((float)resolutionY.intValue / resolutionX.intValue * optimalWidth);

        EditorGUILayout.Space();
        EditorGUILayout.BeginHorizontal(GUILayout.Height(optimalHeight));


        if (isStereo.boolValue)
        {
            displayBoxStyle.normal.background = stereoDisplayTexture;
        }
        else
        {
            displayBoxStyle.normal.background = monoDisplayTexture;
        }

        RUISDisplay display   = target as RUISDisplay;
        int         requiredX = display.rawResolutionX;
        int         requiredY = display.rawResolutionY;
        string      boxText   = string.Format("{0}\nTotal required resolution {1}x{2}", target.name, requiredX, requiredY);

        GUILayout.Box(boxText, displayBoxStyle, GUILayout.Width(optimalWidth), GUILayout.Height(optimalHeight));

        EditorGUILayout.EndHorizontal();

        displayManager.CalculateTotalResolution();

        if (!PlayerSettings.virtualRealitySupported)
        {
            PlayerSettings.defaultScreenWidth  = displayManager.totalRawResolutionX;
            PlayerSettings.defaultScreenHeight = displayManager.totalRawResolutionY;
        }
    }
Example #5
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Import from XML"))
        {
            if (Import())
            {
                //success
            }
            else
            {
                //failure
            }
        }
        if (GUILayout.Button("Export to XML"))
        {
            if (Export())
            {
                //success
            }
            else
            {
                //failure
            }
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.PropertyField(filename, new GUIContent("Filename", "Name of the XML file where RUIS InputManager settings will be loaded/saved. If the file doesn't exist "
                                                               + "it will be created. In Unity Editor the file will be located in the project root folder, and in a built project "
                                                               + "the file it will be located in the same folder where the executable file is."));
        EditorGUILayout.PropertyField(xmlSchema, new GUIContent("XML Schema", "Location of the file that defines the XML format of the above file. You should not change this "
                                                                + "value, which should always point to inputManager.xsd."));

        EditorGUILayout.PropertyField(loadFromTextFileInEditor, new GUIContent("Load from File in Editor", "Load RUIS InputManager settings (which devices are enabled and "
                                                                               + "their configuration) from the above defined XML file while in Unity Editor. Otherwise use the "
                                                                               + "values specified below. In built projects the values are always loaded from the external file."));


        RUISEditorUtility.HorizontalRuler();

        EditorGUILayout.PropertyField(psMoveEnabled, new GUIContent("PS Move Enabled"));

        if (psMoveEnabled.boolValue)
        {
            EditorGUI.indentLevel += 2;

            EditorGUILayout.PropertyField(psMoveIp, new GUIContent("PS Move IP", "PS Move IP address"));
            EditorGUILayout.PropertyField(psMovePort, new GUIContent("PS Move Port", "In most cases you should use the default value of 7899."));

            EditorGUILayout.PropertyField(connectToMoveOnStartup, new GUIContent("Auto-connect to Move.Me", "Connect to the Move.me server on startup."));

            EditorGUILayout.PropertyField(inGameMoveCalibration, new GUIContent("In-game Move calibration", "Enables the default Move Calibration by pressing the home button. Caution: Recalibration may change the coordinate system! Recommended setting is to keep this unchecked."));

            EditorGUILayout.PropertyField(amountOfPSMoveControllers, new GUIContent("Max amount of controllers connected", "Maximum amount of controllers connected. All RUISPSMoveControllers with a controller id outside of the range will get disabled to prevent accidents."));
            amountOfPSMoveControllers.intValue = Mathf.Clamp(amountOfPSMoveControllers.intValue, 0, 4);

            EditorGUILayout.PropertyField(delayedWandActivation, new GUIContent("Delayed Wand Activation", "Delayed PS Move Wand activation is useful when "
                                                                                + "you do not know beforehand how many PS Move controllers the user has calibrated. "
                                                                                + "If you mark a controller as delayed, then all GameObjects with a RUISPSMoveWand "
                                                                                + "script that has the same controller ID will be disabled at the beginning, and "
                                                                                + "re-activated after delay if the said controller is connected. Effectively this "
                                                                                + "disables those objects whose associated PS Move controller is not connected, "
                                                                                + "removing 'dead' input device representations."));
            if (delayedWandActivation.boolValue)
            {
                EditorGUI.indentLevel += 1;
                if (delayTime.floatValue < 5)
                {
                    delayTime.floatValue = 5;
                }
                EditorGUILayout.PropertyField(delayTime, new GUIContent("Delay Duration", "Number of seconds from the start of the scene (minimum of 5)"));
                EditorGUILayout.PropertyField(moveWand0, new GUIContent("PS Move #0", "Delayed wand activation for PS Move controller 0"));
                EditorGUILayout.PropertyField(moveWand1, new GUIContent("PS Move #1", "Delayed wand activation for PS Move controller 1"));
                EditorGUILayout.PropertyField(moveWand2, new GUIContent("PS Move #2", "Delayed wand activation for PS Move controller 2"));
                EditorGUILayout.PropertyField(moveWand3, new GUIContent("PS Move #3", "Delayed wand activation for PS Move controller 3"));
                EditorGUI.indentLevel -= 1;
            }

            EditorGUI.indentLevel -= 2;
        }

        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(enableRazerHydra, new GUIContent("Razer Hydra Enabled"));

        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(kinectEnabled, new GUIContent("Kinect Enabled"));
        if (kinectEnabled.boolValue)
        {
            EditorGUI.indentLevel += 2;

            EditorGUILayout.PropertyField(maxNumberOfKinectPlayers, new GUIContent("Max Kinect Players", "Number of concurrently tracked skeletons"));
            EditorGUILayout.PropertyField(kinect1FloorDetectionOnSceneStart, new GUIContent("Floor Detection On Scene Start", "Kinect tries to detect "
                                                                                            + "floor and adjusts the coordinate system automatically when "
                                                                                            + "the scene is run. You should DISABLE this if you intend to "
                                                                                            + "use Kinect and another sensor (e.g. PS Move) in a calibrated "
                                                                                            + "coordinate system. Enabling this setting ignores whatever normal "
                                                                                            + "is stored in 'calibration.xml'."));
            EditorGUI.indentLevel -= 2;
        }
        EditorGUILayout.Space();

        EditorGUILayout.PropertyField(kinect2Enabled, new GUIContent("Kinect 2 Enabled"));

        if (kinect2Enabled.boolValue)
        {
            EditorGUI.indentLevel += 2;

            EditorGUILayout.PropertyField(kinect2FloorDetectionOnSceneStart, new GUIContent("Floor Detection On Scene Start", "Kinect 2 tries to detect "
                                                                                            + "floor and adjusts the coordinate system automatically when "
                                                                                            + "the scene is run. You should DISABLE this if you intend to "
                                                                                            + "use Kinect 2 and another sensor (e.g. PS Move) in a calibrated "
                                                                                            + "coordinate system. Enabling this setting ignores whatever normal "
                                                                                            + "is stored in 'calibration.xml'."));
            EditorGUI.indentLevel -= 2;
        }

        EditorGUILayout.Space();

//        EditorGUILayout.PropertyField(riftMagnetometerMode, new GUIContent("Rift Drift Correction", "Choose whether Oculus Rift's "
//                                                                   + "magnetometer is calibrated at the beginning of the scene (for yaw "
//                                                                  + "drift correction). It can always be (re)calibrated in-game with the "
//                                                                 + "buttons defined in RUISOculusHUD component of RUISMenu."));


        serializedObject.ApplyModifiedProperties();
    }