public static void DrawProjectConfigInspector(OVRProjectConfig projectConfig)
    {
        bool hasModified = false;

        EditorGUI.BeginDisabledGroup(!projectConfig.targetDeviceTypes.Contains(OVRProjectConfig.DeviceType.Quest));
        EditorGUILayout.LabelField("Quest Features", EditorStyles.boldLabel);

        // Show overlay support option
        OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Focus Aware",
                                                                   "If checked, the new overlay will be displayed when the user presses the home button. The game will not be paused, but will now receive InputFocusLost and InputFocusAcquired events."),
                                     ref projectConfig.focusAware, ref hasModified);

        // Color Gamut selection
        OVREditorUtil.SetupEnumField(projectConfig, new GUIContent(
                                         "Color Gamut",
                                         "The target color gamut when displayed on the Oculus Quest. Quest default is Rec. 2020"),
                                     ref projectConfig.colorGamut, ref hasModified);

        // Hand Tracking Support
        OVREditorUtil.SetupEnumField(projectConfig, "Hand Tracking Support", ref projectConfig.handTrackingSupport, ref hasModified);

        EditorGUI.EndDisabledGroup();
        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Security", EditorStyles.boldLabel);
        OVREditorUtil.SetupBoolField(projectConfig, "Disable Backups", ref projectConfig.disableBackups, ref hasModified);
        OVREditorUtil.SetupBoolField(projectConfig, "Enable NSC Configuration", ref projectConfig.enableNSCConfig, ref hasModified);

        // apply any pending changes to project config
        if (hasModified)
        {
            OVRProjectConfig.CommitProjectConfig(projectConfig);
        }
    }
    public static void DrawTargetDeviceInspector(OVRProjectConfig projectConfig)
    {
        bool hasModified = false;

        // Target Devices
        EditorGUILayout.LabelField("Target Devices", EditorStyles.boldLabel);

        foreach (OVRProjectConfig.DeviceType deviceType in System.Enum.GetValues(typeof(OVRProjectConfig.DeviceType)))
        {
            bool oldSupportsDevice = projectConfig.targetDeviceTypes.Contains(deviceType);
            bool newSupportsDevice = oldSupportsDevice;
            OVREditorUtil.SetupBoolField(projectConfig, ObjectNames.NicifyVariableName(deviceType.ToString()), ref newSupportsDevice, ref hasModified);

            if (newSupportsDevice && !oldSupportsDevice)
            {
                projectConfig.targetDeviceTypes.Add(deviceType);
            }
            else if (oldSupportsDevice && !newSupportsDevice)
            {
                projectConfig.targetDeviceTypes.Remove(deviceType);
            }
        }

        if (hasModified)
        {
            OVRProjectConfig.CommitProjectConfig(projectConfig);
        }
    }
Beispiel #3
0
    public static void DrawProjectConfigInspector(OVRProjectConfig projectConfig)
    {
        bool hasModified = false;

        EditorGUI.BeginDisabledGroup(!projectConfig.targetDeviceTypes.Contains(OVRProjectConfig.DeviceType.Quest));
        EditorGUILayout.LabelField("Quest Features", EditorStyles.boldLabel);

        // Show overlay support option
        OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Focus Aware",
                                                                   "If checked, the new overlay will be displayed when the user presses the home button. The game will not be paused, but will now receive InputFocusLost and InputFocusAcquired events."),
                                     ref projectConfig.focusAware, ref hasModified);

        if (!projectConfig.focusAware && projectConfig.requiresSystemKeyboard)
        {
            projectConfig.requiresSystemKeyboard = false;
            hasModified = true;
        }

        // Hand Tracking Support
        OVREditorUtil.SetupEnumField(projectConfig, "Hand Tracking Support", ref projectConfig.handTrackingSupport, ref hasModified);


        // System Keyboard Support
        OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Requires System Keyboard",
                                                                   "*Requires Focus Awareness* If checked, the Oculus System keyboard will be enabled for Unity input fields and any calls to open/close the Unity TouchScreenKeyboard."),
                                     ref projectConfig.requiresSystemKeyboard, ref hasModified);

        if (projectConfig.requiresSystemKeyboard && !projectConfig.focusAware)
        {
            projectConfig.focusAware = true;
            hasModified = true;
        }

        EditorGUI.EndDisabledGroup();
        EditorGUILayout.Space();

        EditorGUI.BeginDisabledGroup(false);
        EditorGUILayout.LabelField("Android Build Settings", EditorStyles.boldLabel);

        // Show overlay support option
        OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Skip Unneeded Shaders",
                                                                   "If checked, prevent building shaders that are not used by default to reduce time spent when building."),
                                     ref projectConfig.skipUnneededShaders, ref hasModified);

        EditorGUI.EndDisabledGroup();
        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Security", EditorStyles.boldLabel);
        OVREditorUtil.SetupInputField(projectConfig, "Custom Security XML Path", ref projectConfig.securityXmlPath, ref hasModified);
        OVREditorUtil.SetupBoolField(projectConfig, "Disable Backups", ref projectConfig.disableBackups, ref hasModified);
        OVREditorUtil.SetupBoolField(projectConfig, "Enable NSC Configuration", ref projectConfig.enableNSCConfig, ref hasModified);

        // apply any pending changes to project config
        if (hasModified)
        {
            OVRProjectConfig.CommitProjectConfig(projectConfig);
        }
    }
Beispiel #4
0
        public void OnPreprocessBuild(BuildReport report)
        {
            //Debug.Log("MyCustomBuildProcessor.OnPreprocessBuild for target " + report.summary.platform + " at path " + report.summary.outputPath);
            OVRProjectConfig ovrConfig = OVRProjectConfig.GetProjectConfig();

            if (ovrConfig.handTrackingSupport != OVRProjectConfig.HandTrackingSupport.ControllersAndHands)
            {
                ovrConfig.handTrackingSupport   = OVRProjectConfig.HandTrackingSupport.ControllersAndHands;
                ovrConfig.handTrackingFrequency = OVRProjectConfig.HandTrackingFrequency.MAX;
                OVRProjectConfig.CommitProjectConfig(ovrConfig);
            }
        }
        internal static void InitializeOculusProjectConfig()
        {
#if OCULUSINTEGRATION_PRESENT
            // Updating the oculus project config to allow for handtracking and system keyboard usage
            OVRProjectConfig defaultOculusProjectConfig = OVRProjectConfig.GetProjectConfig();
            if (defaultOculusProjectConfig != null)
            {
                defaultOculusProjectConfig.handTrackingSupport    = OVRProjectConfig.HandTrackingSupport.ControllersAndHands;
                defaultOculusProjectConfig.requiresSystemKeyboard = true;

                OVRProjectConfig.CommitProjectConfig(defaultOculusProjectConfig);

                Debug.Log("Enabled Oculus Quest Keyboard and Handtracking in the Oculus Project Config");
            }
#endif
        }
    public static void DrawProjectConfigInspector(OVRProjectConfig projectConfig)
    {
        bool hasModified = false;

        EditorGUI.BeginDisabledGroup(!projectConfig.targetDeviceTypes.Contains(OVRProjectConfig.DeviceType.Quest));
        EditorGUILayout.LabelField("Quest Features", EditorStyles.boldLabel);

        // Show overlay support option
        OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Focus Aware",
                                                                   "If checked, the new overlay will be displayed when the user presses the home button. The game will not be paused, but will now receive InputFocusLost and InputFocusAcquired events."),
                                     ref projectConfig.focusAware, ref hasModified);

        // Hand Tracking Support
        OVREditorUtil.SetupEnumField(projectConfig, "Hand Tracking Support", ref projectConfig.handTrackingSupport, ref hasModified);

        EditorGUI.EndDisabledGroup();
        EditorGUILayout.Space();

#if UNITY_2018_2_OR_NEWER
        EditorGUI.BeginDisabledGroup(false);
        EditorGUILayout.LabelField("Android Build Settings", EditorStyles.boldLabel);

        // Show overlay support option
        OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Skip Unneeded Shaders",
                                                                   "If checked, prevent building shaders that are not used by default to reduce time spent when building."),
                                     ref projectConfig.skipUnneededShaders, ref hasModified);

        EditorGUI.EndDisabledGroup();
        EditorGUILayout.Space();
#endif

        EditorGUILayout.LabelField("Security", EditorStyles.boldLabel);
        OVREditorUtil.SetupInputField(projectConfig, "Custom Security XML Path", ref projectConfig.securityXmlPath, ref hasModified);
        OVREditorUtil.SetupBoolField(projectConfig, "Disable Backups", ref projectConfig.disableBackups, ref hasModified);
        OVREditorUtil.SetupBoolField(projectConfig, "Enable NSC Configuration", ref projectConfig.enableNSCConfig, ref hasModified);

        // apply any pending changes to project config
        if (hasModified)
        {
            OVRProjectConfig.CommitProjectConfig(projectConfig);
        }
    }
        private void SetOVRProjectConfig(TargetPlatform targetPlatform)
        {
#if UNITY_ANDROID
            var targetDeviceTypes = new List <OVRProjectConfig.DeviceType>();

            if (targetPlatform == TargetPlatform.Quest && !OVRDeviceSelector.isTargetDeviceQuest)
            {
                targetDeviceTypes.Add(OVRProjectConfig.DeviceType.Quest);
            }
            else if (targetPlatform == TargetPlatform.OculusGoGearVR && !OVRDeviceSelector.isTargetDeviceGearVrOrGo)
            {
                targetDeviceTypes.Add(OVRProjectConfig.DeviceType.GearVrOrGo);
            }

            if (targetDeviceTypes.Count != 0)
            {
                OVRProjectConfig projectConfig = OVRProjectConfig.GetProjectConfig();
                projectConfig.targetDeviceTypes = targetDeviceTypes;
                OVRProjectConfig.CommitProjectConfig(projectConfig);
            }
#endif
        }
Beispiel #8
0
    public static void DrawTargetDeviceInspector(OVRProjectConfig projectConfig)
    {
        // Target Devices
        EditorGUILayout.LabelField("Target Devices", EditorStyles.boldLabel);
#if PRIORITIZE_OCULUS_XR_SETTINGS
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Configure Target Devices in Oculus XR Plugin Settings.", GUILayout.Width(320));
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Open Settings"))
        {
            SettingsService.OpenProjectSettings("Project/XR Plug-in Management/Oculus");
        }
        EditorGUILayout.EndHorizontal();
#else
        bool hasModified = false;

        foreach (OVRProjectConfig.DeviceType deviceType in System.Enum.GetValues(typeof(OVRProjectConfig.DeviceType)))
        {
            bool oldSupportsDevice = projectConfig.targetDeviceTypes.Contains(deviceType);
            bool newSupportsDevice = oldSupportsDevice;
            OVREditorUtil.SetupBoolField(projectConfig, ObjectNames.NicifyVariableName(deviceType.ToString()), ref newSupportsDevice, ref hasModified);

            if (newSupportsDevice && !oldSupportsDevice)
            {
                projectConfig.targetDeviceTypes.Add(deviceType);
            }
            else if (oldSupportsDevice && !newSupportsDevice)
            {
                projectConfig.targetDeviceTypes.Remove(deviceType);
            }
        }

        if (hasModified)
        {
            OVRProjectConfig.CommitProjectConfig(projectConfig);
        }
#endif
    }
    public static void DrawProjectConfigInspector(OVRProjectConfig projectConfig)
    {
        bool hasModified = false;

        EditorGUILayout.LabelField("Quest Features", EditorStyles.boldLabel);

        // Show overlay support option
        OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Focus Aware",
                                                                   "If checked, the new overlay will be displayed when the user presses the home button. The game will not be paused, but will now receive InputFocusLost and InputFocusAcquired events."),
                                     ref projectConfig.focusAware, ref hasModified);

        if (!projectConfig.focusAware && projectConfig.requiresSystemKeyboard)
        {
            projectConfig.requiresSystemKeyboard = false;
            hasModified = true;
        }

        // Hand Tracking Support
        OVREditorUtil.SetupEnumField(projectConfig, "Hand Tracking Support", ref projectConfig.handTrackingSupport, ref hasModified);

        OVREditorUtil.SetupEnumField(projectConfig, new GUIContent("Hand Tracking Frequency",
                                                                   "Note that a higher tracking frequency will reserve some performance headroom from the application's budget."),
                                     ref projectConfig.handTrackingFrequency, ref hasModified, "https://developer.intern.oculus.com/documentation/unity/unity-handtracking/#enable-hand-tracking");


        // System Keyboard Support
        OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Requires System Keyboard",
                                                                   "*Requires Focus Awareness* If checked, the Oculus System keyboard will be enabled for Unity input fields and any calls to open/close the Unity TouchScreenKeyboard."),
                                     ref projectConfig.requiresSystemKeyboard, ref hasModified);

        // System Splash Screen
        OVREditorUtil.SetupTexture2DField(projectConfig, new GUIContent("System Splash Screen",
                                                                        "*System Splash Screen* If set, the Splash Screen will be presented by the Operating System as a high quality composition layer at launch time."),
                                          ref projectConfig.systemSplashScreen, ref hasModified);

        // Allow optional 3-dof head-tracking
        OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Allow Optional 3DoF Head Tracking",
                                                                   "If checked, application can work in both 6DoF and 3DoF modes. It's highly recommended to keep it unchecked unless your project strongly needs the 3DoF head tracking."),
                                     ref projectConfig.allowOptional3DofHeadTracking, ref hasModified);

        if (projectConfig.requiresSystemKeyboard && !projectConfig.focusAware)
        {
            projectConfig.focusAware = true;
            hasModified = true;
        }

        EditorGUI.EndDisabledGroup();
        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Android Build Settings", EditorStyles.boldLabel);

        // Show overlay support option
        OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Skip Unneeded Shaders",
                                                                   "If checked, prevent building shaders that are not used by default to reduce time spent when building."),
                                     ref projectConfig.skipUnneededShaders, ref hasModified);

        EditorGUI.EndDisabledGroup();
        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Security", EditorStyles.boldLabel);
        OVREditorUtil.SetupInputField(projectConfig, "Custom Security XML Path", ref projectConfig.securityXmlPath, ref hasModified);
        OVREditorUtil.SetupBoolField(projectConfig, "Disable Backups", ref projectConfig.disableBackups, ref hasModified);
        OVREditorUtil.SetupBoolField(projectConfig, "Enable NSC Configuration", ref projectConfig.enableNSCConfig, ref hasModified);

        // apply any pending changes to project config
        if (hasModified)
        {
            OVRProjectConfig.CommitProjectConfig(projectConfig);
        }
    }
Beispiel #10
0
    override public void OnInspectorGUI()
    {
#if UNITY_ANDROID
        EditorGUILayout.LabelField("Target Devices");
        EditorGUI.indentLevel++;
        OVRProjectConfig projectConfig = OVRProjectConfig.GetProjectConfig();
        List <OVRProjectConfig.DeviceType> oldTargetDeviceTypes = projectConfig.targetDeviceTypes;
        List <OVRProjectConfig.DeviceType> targetDeviceTypes    = new List <OVRProjectConfig.DeviceType>(oldTargetDeviceTypes);
        bool hasModified = false;
        int  newCount    = Mathf.Max(0, EditorGUILayout.IntField("Size", targetDeviceTypes.Count));
        while (newCount < targetDeviceTypes.Count)
        {
            targetDeviceTypes.RemoveAt(targetDeviceTypes.Count - 1);
            hasModified = true;
        }
        while (newCount > targetDeviceTypes.Count)
        {
            targetDeviceTypes.Add(OVRProjectConfig.DeviceType.GearVrOrGo);
            hasModified = true;
        }
        for (int i = 0; i < targetDeviceTypes.Count; i++)
        {
            var deviceType = (OVRProjectConfig.DeviceType)EditorGUILayout.EnumPopup(string.Format("Element {0}", i), targetDeviceTypes[i]);
            if (deviceType != targetDeviceTypes[i])
            {
                targetDeviceTypes[i] = deviceType;
                hasModified          = true;
            }
        }
        if (hasModified)
        {
            projectConfig.targetDeviceTypes = targetDeviceTypes;
            OVRProjectConfig.CommitProjectConfig(projectConfig);
        }
        EditorGUI.indentLevel--;
        EditorGUILayout.Space();
#endif

        DrawDefaultInspector();

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
        OVRManager manager = (OVRManager)target;
        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Mixed Reality Capture", EditorStyles.boldLabel);
        SetupBoolField("Show Properties", ref manager.expandMixedRealityCapturePropertySheet);
        if (manager.expandMixedRealityCapturePropertySheet)
        {
            string[] layerMaskOptions = new string[32];
            for (int i = 0; i < 32; ++i)
            {
                layerMaskOptions[i] = LayerMask.LayerToName(i);
                if (layerMaskOptions[i].Length == 0)
                {
                    layerMaskOptions[i] = "<Layer " + i.ToString() + ">";
                }
            }

            EditorGUI.indentLevel++;

            EditorGUILayout.Space();
            SetupBoolField("enableMixedReality", ref manager.enableMixedReality);
            SetupCompositoinMethodField("compositionMethod", ref manager.compositionMethod);
            SetupLayerMaskField("extraHiddenLayers", ref manager.extraHiddenLayers, layerMaskOptions);

            if (manager.compositionMethod == OVRManager.CompositionMethod.Direct || manager.compositionMethod == OVRManager.CompositionMethod.Sandwich)
            {
                EditorGUILayout.Space();
                if (manager.compositionMethod == OVRManager.CompositionMethod.Direct)
                {
                    EditorGUILayout.LabelField("Direct Composition", EditorStyles.boldLabel);
                }
                else
                {
                    EditorGUILayout.LabelField("Sandwich Composition", EditorStyles.boldLabel);
                }
                EditorGUI.indentLevel++;

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Camera", EditorStyles.boldLabel);
                SetupCameraDeviceField("capturingCameraDevice", ref manager.capturingCameraDevice);
                SetupBoolField("flipCameraFrameHorizontally", ref manager.flipCameraFrameHorizontally);
                SetupBoolField("flipCameraFrameVertically", ref manager.flipCameraFrameVertically);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Chroma Key", EditorStyles.boldLabel);
                SetupColorField("chromaKeyColor", ref manager.chromaKeyColor);
                SetupFloatField("chromaKeySimilarity", ref manager.chromaKeySimilarity);
                SetupFloatField("chromaKeySmoothRange", ref manager.chromaKeySmoothRange);
                SetupFloatField("chromaKeySpillRange", ref manager.chromaKeySpillRange);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Dynamic Lighting", EditorStyles.boldLabel);
                SetupBoolField("useDynamicLighting", ref manager.useDynamicLighting);
                SetupDepthQualityField("depthQuality", ref manager.depthQuality);
                SetupFloatField("dynamicLightingSmoothFactor", ref manager.dynamicLightingSmoothFactor);
                SetupFloatField("dynamicLightingDepthVariationClampingValue", ref manager.dynamicLightingDepthVariationClampingValue);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Virtual Green Screen", EditorStyles.boldLabel);
                SetupVirtualGreenTypeField("virtualGreenScreenType", ref manager.virtualGreenScreenType);
                SetupFloatField("virtualGreenScreenTopY", ref manager.virtualGreenScreenTopY);
                SetupFloatField("virtualGreenScreenBottomY", ref manager.virtualGreenScreenBottomY);
                SetupBoolField("virtualGreenScreenApplyDepthCulling", ref manager.virtualGreenScreenApplyDepthCulling);
                SetupFloatField("virtualGreenScreenDepthTolerance", ref manager.virtualGreenScreenDepthTolerance);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Latency Control", EditorStyles.boldLabel);
                SetupFloatField("handPoseStateLatency", ref manager.handPoseStateLatency);
                if (manager.compositionMethod == OVRManager.CompositionMethod.Sandwich)
                {
                    SetupFloatField("sandwichCompositionRenderLatency", ref manager.sandwichCompositionRenderLatency);
                    SetupIntField("sandwichCompositionBufferedFrames", ref manager.sandwichCompositionBufferedFrames);
                }
                EditorGUI.indentLevel--;
            }

            EditorGUI.indentLevel--;
        }
#endif
    }
Beispiel #11
0
    override public void OnInspectorGUI()
    {
#if UNITY_ANDROID
        OVRProjectConfig projectConfig = OVRProjectConfig.GetProjectConfig();
        bool             hasModified   = false;

        // Target Devices
        EditorGUILayout.LabelField("Target Devices");
        EditorGUI.indentLevel++;
        List <OVRProjectConfig.DeviceType> oldTargetDeviceTypes = projectConfig.targetDeviceTypes;
        List <OVRProjectConfig.DeviceType> targetDeviceTypes    = new List <OVRProjectConfig.DeviceType>(oldTargetDeviceTypes);
        int newCount = Mathf.Max(0, EditorGUILayout.IntField("Size", targetDeviceTypes.Count));
        while (newCount < targetDeviceTypes.Count)
        {
            targetDeviceTypes.RemoveAt(targetDeviceTypes.Count - 1);
            hasModified = true;
        }
        while (newCount > targetDeviceTypes.Count)
        {
            targetDeviceTypes.Add(OVRProjectConfig.DeviceType.Quest);
            hasModified = true;
        }
        for (int i = 0; i < targetDeviceTypes.Count; i++)
        {
            var deviceType = (OVRProjectConfig.DeviceType)EditorGUILayout.EnumPopup(string.Format("Element {0}", i), targetDeviceTypes[i]);
            if (deviceType != targetDeviceTypes[i])
            {
                targetDeviceTypes[i] = deviceType;
                hasModified          = true;
            }
        }
        if (hasModified)
        {
            projectConfig.targetDeviceTypes = targetDeviceTypes;
        }
        EditorGUI.indentLevel--;

        EditorGUILayout.Space();

        // Hand Tracking Support
        EditorGUI.BeginDisabledGroup(!targetDeviceTypes.Contains(OVRProjectConfig.DeviceType.Quest));
        EditorGUILayout.LabelField("Input", EditorStyles.boldLabel);
        OVRProjectConfig.HandTrackingSupport oldHandTrackingSupport = projectConfig.handTrackingSupport;
        OVRProjectConfig.HandTrackingSupport newHandTrackingSupport = (OVRProjectConfig.HandTrackingSupport)EditorGUILayout.EnumPopup(
            "Hand Tracking Support", oldHandTrackingSupport);
        if (newHandTrackingSupport != oldHandTrackingSupport)
        {
            projectConfig.handTrackingSupport = newHandTrackingSupport;
            hasModified = true;
        }
        EditorGUILayout.Space();
        EditorGUI.EndDisabledGroup();

        // apply any pending changes to project config
        if (hasModified)
        {
            OVRProjectConfig.CommitProjectConfig(projectConfig);
        }
#endif

        DrawDefaultInspector();

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_ANDROID
        OVRManager manager = (OVRManager)target;
#endif

#if UNITY_ANDROID
        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Security", EditorStyles.boldLabel);
        EditorGUI.BeginChangeCheck();

        bool disableBackups  = projectConfig.disableBackups;
        bool enableNSCConfig = projectConfig.enableNSCConfig;
        SetupBoolField("Disable Backups", ref disableBackups);
        SetupBoolField("Enable NSC Configuration", ref enableNSCConfig);

        if (EditorGUI.EndChangeCheck())
        {
            projectConfig.disableBackups  = disableBackups;
            projectConfig.enableNSCConfig = enableNSCConfig;
            OVRProjectConfig.CommitProjectConfig(projectConfig);
        }

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Mixed Reality Capture for Quest (experimental)", EditorStyles.boldLabel);
        EditorGUI.indentLevel++;
        SetupMrcActivationModeField("ActivationMode", ref manager.mrcActivationMode);
        EditorGUI.indentLevel--;
#endif

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Mixed Reality Capture", EditorStyles.boldLabel);
        SetupBoolField("Show Properties", ref manager.expandMixedRealityCapturePropertySheet);
        if (manager.expandMixedRealityCapturePropertySheet)
        {
            string[] layerMaskOptions = new string[32];
            for (int i = 0; i < 32; ++i)
            {
                layerMaskOptions[i] = LayerMask.LayerToName(i);
                if (layerMaskOptions[i].Length == 0)
                {
                    layerMaskOptions[i] = "<Layer " + i.ToString() + ">";
                }
            }

            EditorGUI.indentLevel++;

            EditorGUILayout.Space();
            SetupBoolField("enableMixedReality", ref manager.enableMixedReality);
            SetupCompositoinMethodField("compositionMethod", ref manager.compositionMethod);
            SetupLayerMaskField("extraHiddenLayers", ref manager.extraHiddenLayers, layerMaskOptions);

            if (manager.compositionMethod == OVRManager.CompositionMethod.External)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("External Composition", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;

                SetupColorField("backdropColor (Rift)", ref manager.externalCompositionBackdropColorRift);
                SetupColorField("backdropColor (Quest)", ref manager.externalCompositionBackdropColorQuest);
            }

            if (manager.compositionMethod == OVRManager.CompositionMethod.Direct)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Direct Composition", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Camera", EditorStyles.boldLabel);
                SetupCameraDeviceField("capturingCameraDevice", ref manager.capturingCameraDevice);
                SetupBoolField("flipCameraFrameHorizontally", ref manager.flipCameraFrameHorizontally);
                SetupBoolField("flipCameraFrameVertically", ref manager.flipCameraFrameVertically);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Chroma Key", EditorStyles.boldLabel);
                SetupColorField("chromaKeyColor", ref manager.chromaKeyColor);
                SetupFloatField("chromaKeySimilarity", ref manager.chromaKeySimilarity);
                SetupFloatField("chromaKeySmoothRange", ref manager.chromaKeySmoothRange);
                SetupFloatField("chromaKeySpillRange", ref manager.chromaKeySpillRange);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Dynamic Lighting", EditorStyles.boldLabel);
                SetupBoolField("useDynamicLighting", ref manager.useDynamicLighting);
                SetupDepthQualityField("depthQuality", ref manager.depthQuality);
                SetupFloatField("dynamicLightingSmoothFactor", ref manager.dynamicLightingSmoothFactor);
                SetupFloatField("dynamicLightingDepthVariationClampingValue", ref manager.dynamicLightingDepthVariationClampingValue);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Virtual Green Screen", EditorStyles.boldLabel);
                SetupVirtualGreenTypeField("virtualGreenScreenType", ref manager.virtualGreenScreenType);
                SetupFloatField("virtualGreenScreenTopY", ref manager.virtualGreenScreenTopY);
                SetupFloatField("virtualGreenScreenBottomY", ref manager.virtualGreenScreenBottomY);
                SetupBoolField("virtualGreenScreenApplyDepthCulling", ref manager.virtualGreenScreenApplyDepthCulling);
                SetupFloatField("virtualGreenScreenDepthTolerance", ref manager.virtualGreenScreenDepthTolerance);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Latency Control", EditorStyles.boldLabel);
                SetupFloatField("handPoseStateLatency", ref manager.handPoseStateLatency);
                EditorGUI.indentLevel--;
            }

            EditorGUI.indentLevel--;
        }
#endif
    }
Beispiel #12
0
    public static void DrawProjectConfigInspector(OVRProjectConfig projectConfig)
    {
        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
        EditorGUILayout.LabelField("Quest Features", EditorStyles.boldLabel);

        if (projectConfigTabStrs == null)
        {
            projectConfigTabStrs = Enum.GetNames(typeof(eProjectConfigTab));
            for (int i = 0; i < projectConfigTabStrs.Length; ++i)
            {
                projectConfigTabStrs[i] = ObjectNames.NicifyVariableName(projectConfigTabStrs[i]);
            }
        }

        selectedTab = (eProjectConfigTab)GUILayout.SelectionGrid((int)selectedTab, projectConfigTabStrs, 3, GUI.skin.button);
        EditorGUILayout.Space(5);
        bool hasModified = false;

        switch (selectedTab)
        {
        case eProjectConfigTab.General:

            // Show overlay support option
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.Toggle(new GUIContent("Focus Aware (Required)",
                                                  "If checked, the new overlay will be displayed when the user presses the home button. The game will not be paused, but will now receive InputFocusLost and InputFocusAcquired events."), true);
            EditorGUI.EndDisabledGroup();

            // Hand Tracking Support
            OVREditorUtil.SetupEnumField(projectConfig, "Hand Tracking Support", ref projectConfig.handTrackingSupport, ref hasModified);

            OVREditorUtil.SetupEnumField(projectConfig, new GUIContent("Hand Tracking Frequency",
                                                                       "Note that a higher tracking frequency will reserve some performance headroom from the application's budget."),
                                         ref projectConfig.handTrackingFrequency, ref hasModified, "https://developer.oculus.com/documentation/unity/unity-handtracking/#enable-hand-tracking");


            // System Keyboard Support
            OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Requires System Keyboard",
                                                                       "If checked, the Oculus System keyboard will be enabled for Unity input fields and any calls to open/close the Unity TouchScreenKeyboard."),
                                         ref projectConfig.requiresSystemKeyboard, ref hasModified);

            // System Splash Screen
            OVREditorUtil.SetupTexture2DField(projectConfig, new GUIContent("System Splash Screen",
                                                                            "If set, the Splash Screen will be presented by the Operating System as a high quality composition layer at launch time."),
                                              ref projectConfig.systemSplashScreen, ref hasModified,
                                              "https://developer.oculus.com/documentation/unity/unity-splash-screen/");

            // Allow optional 3-dof head-tracking
            OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Allow Optional 3DoF Head Tracking",
                                                                       "If checked, application can work in both 6DoF and 3DoF modes. It's highly recommended to keep it unchecked unless your project strongly needs the 3DoF head tracking."),
                                         ref projectConfig.allowOptional3DofHeadTracking, ref hasModified);

            // Enable passthrough capability
            OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Passthrough Capability Enabled",
                                                                       "If checked, this application can use passthrough functionality. This option must be enabled at build time, otherwise initializing passthrough and creating passthrough layers in application scenes will fail."),
                                         ref projectConfig.insightPassthroughEnabled, ref hasModified);

            break;

        case eProjectConfigTab.BuildSettings:

            OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Skip Unneeded Shaders",
                                                                       "If checked, prevent building shaders that are not used by default to reduce time spent when building."),
                                         ref projectConfig.skipUnneededShaders, ref hasModified,
                                         "https://developer.oculus.com/documentation/unity/unity-strip-shaders/");

            break;

        case eProjectConfigTab.Security:

            OVREditorUtil.SetupBoolField(projectConfig, "Disable Backups", ref projectConfig.disableBackups, ref hasModified,
                                         "https://developer.android.com/guide/topics/data/autobackup#EnablingAutoBackup");
            OVREditorUtil.SetupBoolField(projectConfig, "Enable NSC Configuration", ref projectConfig.enableNSCConfig, ref hasModified,
                                         "https://developer.android.com/training/articles/security-config");
            EditorGUI.BeginDisabledGroup(!projectConfig.enableNSCConfig);
            ++EditorGUI.indentLevel;
            OVREditorUtil.SetupInputField(projectConfig, "Custom Security XML Path", ref projectConfig.securityXmlPath, ref hasModified);
            --EditorGUI.indentLevel;
            EditorGUI.EndDisabledGroup();

            break;

        case eProjectConfigTab.Experimental:

            // Experimental Features Enabled
            OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Experimental Features Enabled",
                                                                       "If checked, this application can use experimental features. Note that such features are for developer use only. This option must be disabled when submitting to the Oculus Store."),
                                         ref projectConfig.experimentalFeaturesEnabled, ref hasModified);

            // Spatial Anchors Support
            OVREditorUtil.SetupEnumField(projectConfig, "Spatial Anchors Support", ref projectConfig.spatialAnchorsSupport, ref hasModified);

            break;
        }
        EditorGUILayout.EndVertical();

        // apply any pending changes to project config
        if (hasModified)
        {
            OVRProjectConfig.CommitProjectConfig(projectConfig);
        }
    }