protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled ||
                MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile == null)
            {
                return;
            }

            controllerMappingProfiles = serializedObject.FindProperty("controllerMappingProfiles");
        }
        public override void OnInspectorGUI()
        {
            MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled)
            {
                EditorGUILayout.HelpBox("No input system is enabled, or you need to specify the type in the main configuration profile.", MessageType.Error);

                if (GUILayout.Button("Back to Configuration Profile"))
                {
                    Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile;
                }

                return;
            }

            if (GUILayout.Button("Back to Input Profile"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile;
            }

            (target as BaseMixedRealityProfile).CheckProfileLock();

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Speech Commands", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Speech Commands are any/all spoken keywords your users will be able say to raise an Input Action in your application.", MessageType.Info);

            if (MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile == null)
            {
                EditorGUILayout.HelpBox("No input actions found, please specify a input action profile in the main configuration.", MessageType.Error);
                return;
            }

            serializedObject.Update();

            EditorGUILayout.PropertyField(recognizerStartBehaviour);
            EditorGUILayout.PropertyField(recognitionConfidenceLevel);

            RenderList(speechCommands);
            serializedObject.ApplyModifiedProperties();
        }
        /// <inheritdoc />
        protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            meshPhysicsLayerOverride   = serializedObject.FindProperty("meshPhysicsLayerOverride");
            meshLevelOfDetail          = serializedObject.FindProperty("meshLevelOfDetail");
            meshTrianglesPerCubicMeter = serializedObject.FindProperty("meshTrianglesPerCubicMeter");
            meshRecalculateNormals     = serializedObject.FindProperty("meshRecalculateNormals");
            meshDisplayOption          = serializedObject.FindProperty("meshDisplayOption");
            meshVisibleMaterial        = serializedObject.FindProperty("meshVisibleMaterial");
            meshOcclusionMaterial      = serializedObject.FindProperty("meshOcclusionMaterial");
        }
        // todo: coming soon
        // private static bool showDebugPanelSettings = true;
        // private SerializedProperty isDebugPanelVisible;

        protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            showDiagnostics   = serializedObject.FindProperty("showDiagnostics");
            showProfiler      = serializedObject.FindProperty("showProfiler");
            frameSampleRate   = serializedObject.FindProperty("frameSampleRate");
            windowAnchor      = serializedObject.FindProperty("windowAnchor");
            windowOffset      = serializedObject.FindProperty("windowOffset");
            windowScale       = serializedObject.FindProperty("windowScale");
            windowFollowSpeed = serializedObject.FindProperty("windowFollowSpeed");
        }
Пример #5
0
        protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled ||
                MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile == null)
            {
                return;
            }

            controllerDataProviders = serializedObject.FindProperty("registeredControllerDataProviders");
            foldouts = new bool[controllerDataProviders.arraySize];
        }
Пример #6
0
        protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            visible      = serializedObject.FindProperty("visible");
            handlerType  = serializedObject.FindProperty("handlerType");
            showCpu      = serializedObject.FindProperty("showCpu");
            cpuBuffer    = serializedObject.FindProperty("cpuBuffer");
            showFps      = serializedObject.FindProperty("showFps");
            fpsBuffer    = serializedObject.FindProperty("fpsBuffer");
            showMemory   = serializedObject.FindProperty("showMemory");
            memoryBuffer = serializedObject.FindProperty("memoryBuffer");
        }
Пример #7
0
        public override void OnInspectorGUI()
        {
            MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();
            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (GUILayout.Button("Back to Input Profile"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Pointer Options", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Pointers attach themselves onto controllers as they are initialized.", MessageType.Info);
            EditorGUILayout.Space();

            (target as BaseMixedRealityProfile).CheckProfileLock();
            serializedObject.Update();
            currentlySelectedPointerOption = -1;

            EditorGUILayout.PropertyField(pointingExtent);
            EditorGUILayout.PropertyField(pointingRaycastLayerMasks, true);
            EditorGUILayout.PropertyField(debugDrawPointingRays);
            EditorGUILayout.PropertyField(debugDrawPointingRayColors, true);

            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("The gaze provider uses the default settings above, but further customization of the gaze can be done on the Gaze Provider.", MessageType.Info);

            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(gazeCursorPrefab);
            EditorGUILayout.PropertyField(gazeProviderType);

            EditorGUILayout.Space();
            if (GUILayout.Button("Customize Gaze Provider Settings"))
            {
                Selection.activeObject = CameraCache.Main.gameObject;
            }

            EditorGUILayout.Space();
            pointerOptionList.DoLayoutList();
            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled)
            {
                EditorGUILayout.HelpBox("No input system is enabled, or you need to specify the type in the main configuration profile.", MessageType.Error);

                if (GUILayout.Button("Back to Configuration Profile"))
                {
                    Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile;
                }

                return;
            }

            if (GUILayout.Button("Back to Input Profile"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Gesture Input", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("This gesture map is any and all movements of part the user's body, especially a hand or the head, that raise actions through the input system.\n\nNote: Defined controllers can look up the list of gestures and raise the events based on specific criteria.", MessageType.Info);

            if (MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile == null)
            {
                EditorGUILayout.HelpBox("No input actions found, please specify a input action profile in the main configuration.", MessageType.Error);
                return;
            }

            (target as BaseMixedRealityProfile).CheckProfileLock();

            serializedObject.Update();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Defined Recognizable Gestures", EditorStyles.boldLabel);
            RenderList(gestures);
            serializedObject.ApplyModifiedProperties();
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            focusProviderType              = serializedObject.FindProperty("focusProviderType");
            inputActionsProfile            = serializedObject.FindProperty("inputActionsProfile");
            inputActionRulesProfile        = serializedObject.FindProperty("inputActionRulesProfile");
            pointerProfile                 = serializedObject.FindProperty("pointerProfile");
            gesturesProfile                = serializedObject.FindProperty("gesturesProfile");
            speechCommandsProfile          = serializedObject.FindProperty("speechCommandsProfile");
            controllerMappingProfile       = serializedObject.FindProperty("controllerMappingProfile");
            enableControllerMapping        = serializedObject.FindProperty("enableControllerMapping");
            controllerVisualizationProfile = serializedObject.FindProperty("controllerVisualizationProfile");
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            isCameraPersistent    = serializedObject.FindProperty("isCameraPersistent");
            opaqueNearClip        = serializedObject.FindProperty("nearClipPlaneOpaqueDisplay");
            opaqueClearFlags      = serializedObject.FindProperty("cameraClearFlagsOpaqueDisplay");
            opaqueBackgroundColor = serializedObject.FindProperty("backgroundColorOpaqueDisplay");
            opaqueQualityLevel    = serializedObject.FindProperty("opaqueQualityLevel");

            transparentNearClip        = serializedObject.FindProperty("nearClipPlaneTransparentDisplay");
            transparentClearFlags      = serializedObject.FindProperty("cameraClearFlagsTransparentDisplay");
            transparentBackgroundColor = serializedObject.FindProperty("backgroundColorTransparentDisplay");
            holoLensQualityLevel       = serializedObject.FindProperty("holoLensQualityLevel");
        }
Пример #11
0
        /// <inheritdoc />
        protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            surfacePhysicsLayerOverride = serializedObject.FindProperty("surfacePhysicsLayerOverride");
            surfaceFindingMinimumArea   = serializedObject.FindProperty("surfaceFindingMinimumArea");
            displayFloorSurfaces        = serializedObject.FindProperty("displayFloorSurfaces");
            floorSurfaceMaterial        = serializedObject.FindProperty("floorSurfaceMaterial");
            displayCeilingSurfaces      = serializedObject.FindProperty("displayCeilingSurfaces");
            ceilingSurfaceMaterial      = serializedObject.FindProperty("ceilingSurfaceMaterial");
            displayWallSurfaces         = serializedObject.FindProperty("displayWallSurfaces");
            wallSurfaceMaterial         = serializedObject.FindProperty("wallSurfaceMaterial");
            displayPlatformSurfaces     = serializedObject.FindProperty("displayPlatformSurfaces");
            platformSurfaceMaterial     = serializedObject.FindProperty("platformSurfaceMaterial");
        }
        public override void OnInspectorGUI()
        {
            RenderMixedRealityToolkitLogo();
            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (GUILayout.Button("Back to Configuration Profile"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile;
            }

            CheckProfileLock(target);

            serializedObject.Update();

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Diagnostic Visualization Options", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Diagnostic visualizations can help monitor system resources and performance inside an application.", MessageType.Info);

            EditorGUILayout.Space();
            showGeneralSettings = EditorGUILayout.Foldout(showGeneralSettings, "General Settings", true);
            if (showGeneralSettings)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(showDiagnostics);
                    if (!showDiagnostics.boolValue)
                    {
                        EditorGUILayout.Space();
                        EditorGUILayout.HelpBox("Diagnostic visualizations have been globally disabled.", MessageType.Info);
                        EditorGUILayout.Space();
                    }

                    EditorGUILayout.PropertyField(showProfiler);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            defaultLabelWidth = EditorGUIUtility.labelWidth;
            defaultFieldWidth = EditorGUIUtility.fieldWidth;

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            thisProfile = target as MixedRealityControllerVisualizationProfile;

            renderMotionControllers         = serializedObject.FindProperty("renderMotionControllers");
            controllerVisualizationType     = serializedObject.FindProperty("controllerVisualizationType");
            useDefaultModels                = serializedObject.FindProperty("useDefaultModels");
            globalLeftHandModel             = serializedObject.FindProperty("globalLeftHandModel");
            globalRightHandModel            = serializedObject.FindProperty("globalRightHandModel");
            controllerVisualizationSettings = serializedObject.FindProperty("controllerVisualizationSettings");
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled ||
                MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile == null)
            {
                return;
            }

            recognizerStartBehaviour   = serializedObject.FindProperty("startBehavior");
            recognitionConfidenceLevel = serializedObject.FindProperty("recognitionConfidenceLevel");
            speechCommands             = serializedObject.FindProperty("speechCommands");
            actionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions.Select(action => new GUIContent(action.Description)).Prepend(new GUIContent("None")).ToArray();
            actionIds    = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions.Select(action => (int)action.Id).Prepend(0).ToArray();
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            mixedRealityControllerMappingProfiles = serializedObject.FindProperty("mixedRealityControllerMappingProfiles");

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled ||
                MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile == null)
            {
                return;
            }

            thisProfile       = target as MixedRealityControllerMappingProfile;
            defaultLabelWidth = EditorGUIUtility.labelWidth;
            defaultFieldWidth = EditorGUIUtility.fieldWidth;
        }
        /// <summary>
        /// Helper function to render header correctly for all profiles
        /// </summary>
        /// <param name="title">Title of profile</param>
        /// <param name="description">profile tooltip describing purpose</param>
        /// <param name="backText">Text for back button if not rendering as sub-profile</param>
        /// <param name="backProfile">Target profile to return to if not rendering as sub-profile</param>
        /// <returns>true to render rest of profile as-is or false if profile/MRTK is in a state to not render rest of profile contents</returns>
        protected bool RenderProfileHeader(string title, string description, BackProfileType returnProfileTarget = BackProfileType.Configuration)
        {
            RenderMixedRealityToolkitLogo();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return(false);
            }

            if (DrawBacktrackProfileButton(returnProfileTarget))
            {
                return(false);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(title, description), EditorStyles.boldLabel, GUILayout.ExpandWidth(true));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField(string.Empty, GUI.skin.horizontalSlider);

            return(true);
        }
Пример #17
0
        public override void OnInspectorGUI()
        {
            MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (GUILayout.Button("Back to Configuration Profile"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile;
            }

            (target as BaseMixedRealityProfile).CheckProfileLock();

            serializedObject.Update();

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Diagnostic Visualization Options", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Diagnostic visualizations can help monitor system resources and performance inside an application.", MessageType.Info);
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(visible);
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(handlerType);
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(showCpu);
            EditorGUILayout.PropertyField(cpuBuffer);
            EditorGUILayout.PropertyField(showFps);
            EditorGUILayout.PropertyField(fpsBuffer);
            EditorGUILayout.PropertyField(showMemory);
            EditorGUILayout.PropertyField(memoryBuffer);

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled)
            {
                EditorGUILayout.HelpBox("No input system is enabled, or you need to specify the type in the main configuration profile.", MessageType.Error);

                if (GUILayout.Button("Back to Configuration Profile"))
                {
                    Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile;
                }

                return;
            }

            if (GUILayout.Button("Back to Input Profile"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Input Actions", EditorStyles.boldLabel);

            EditorGUILayout.HelpBox("Input Actions are any/all actions your users will be able to make when interacting with your application.\n\n" +
                                    "After defining all your actions, you can then wire up these actions to hardware sensors, controllers, and other input devices.", MessageType.Info);

            (target as BaseMixedRealityProfile).CheckProfileLock();

            serializedObject.Update();
            RenderList(inputActionList);
            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            RenderMixedRealityToolkitLogo();
            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (GUILayout.Button("Back to Configuration Profile"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Registered Service Providers Profile", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("This profile defines any additional Services like systems, features, and managers to register with the Mixed Reality Toolkit.", MessageType.Info);

            CheckProfileLock(target);

            serializedObject.Update();
            RenderList(configurations);
            serializedObject.ApplyModifiedProperties();
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            dataProviderConfigurations     = serializedObject.FindProperty("dataProviderConfigurations");
            focusProviderType              = serializedObject.FindProperty("focusProviderType");
            inputActionsProfile            = serializedObject.FindProperty("inputActionsProfile");
            inputActionRulesProfile        = serializedObject.FindProperty("inputActionRulesProfile");
            pointerProfile                 = serializedObject.FindProperty("pointerProfile");
            gesturesProfile                = serializedObject.FindProperty("gesturesProfile");
            speechCommandsProfile          = serializedObject.FindProperty("speechCommandsProfile");
            controllerMappingProfile       = serializedObject.FindProperty("controllerMappingProfile");
            enableControllerMapping        = serializedObject.FindProperty("enableControllerMapping");
            controllerVisualizationProfile = serializedObject.FindProperty("controllerVisualizationProfile");
            handTrackingProfile            = serializedObject.FindProperty("handTrackingProfile");

            providerFoldouts = new bool[dataProviderConfigurations.arraySize];
        }
        public override void OnInspectorGUI()
        {
            RenderProfileHeader(ProfileTitle, ProfileDescription, target, isInitialized, BackProfileType.Input);

            RenderMixedRealityInputConfigured();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
            {
                return;
            }

            if (MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile == null)
            {
                EditorGUILayout.HelpBox("No input actions found, please specify a input action profile in the main configuration.", MessageType.Error);
                return;
            }

            using (new GUIEnabledWrapper(!IsProfileLock((BaseMixedRealityProfile)target), false))
            {
                serializedObject.Update();

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Windows Gesture Settings", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(windowsManipulationGestureSettings);
                EditorGUILayout.PropertyField(windowsNavigationGestureSettings);
                EditorGUILayout.PropertyField(useRailsNavigation);
                EditorGUILayout.PropertyField(windowsRailsNavigationGestures);
                EditorGUILayout.PropertyField(windowsGestureAutoStart);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Defined Recognizable Gestures", EditorStyles.boldLabel);

                RenderList(gestures);

                serializedObject.ApplyModifiedProperties();
            }
        }
        public override void OnInspectorGUI()
        {
            RenderMixedRealityToolkitLogo();
            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (GUILayout.Button("Back to Configuration Profile"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Input System Profile", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("The Input System Profile helps developers configure input no matter what platform you're building for.", MessageType.Info);

            CheckProfileLock(target);

            var previousLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 160f;

            serializedObject.Update();
            EditorGUI.BeginChangeCheck();
            bool changed = false;

            EditorGUILayout.Space();
            showFocusProperties = EditorGUILayout.Foldout(showFocusProperties, "Focus Settings", true);
            if (showFocusProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(focusProviderType);
                }
            }

            EditorGUILayout.Space();
            showPointerProperties = EditorGUILayout.Foldout(showPointerProperties, "Pointer Settings", true);
            if (showPointerProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    changed |= RenderProfile(pointerProfile);
                }
            }

            EditorGUILayout.Space();
            showActionsProperties = EditorGUILayout.Foldout(showActionsProperties, "Action Settings", true);
            if (showActionsProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    changed |= RenderProfile(inputActionsProfile);
                    changed |= RenderProfile(inputActionRulesProfile);
                }
            }

            EditorGUILayout.Space();
            showControllerProperties = EditorGUILayout.Foldout(showControllerProperties, "Controller Settings", true);
            if (showControllerProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(enableControllerMapping);
                    changed |= RenderProfile(controllerMappingProfile);
                    changed |= RenderProfile(controllerVisualizationProfile);
                }
            }

            EditorGUILayout.Space();
            showGestureProperties = EditorGUILayout.Foldout(showGestureProperties, "Gesture Settings", true);
            if (showGestureProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    changed |= RenderProfile(gesturesProfile);
                }
            }

            EditorGUILayout.Space();
            showSpeechCommandsProperties = EditorGUILayout.Foldout(showSpeechCommandsProperties, "Speech Command Settings", true);
            if (showSpeechCommandsProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    changed |= RenderProfile(speechCommandsProfile);
                }
            }

            if (!changed)
            {
                changed |= EditorGUI.EndChangeCheck();
            }

            EditorGUIUtility.labelWidth = previousLabelWidth;
            serializedObject.ApplyModifiedProperties();

            if (changed)
            {
                EditorApplication.delayCall += () => MixedRealityToolkit.Instance.ResetConfiguration(MixedRealityToolkit.Instance.ActiveProfile);
            }
        }
        public override void OnInspectorGUI()
        {
            RenderMixedRealityToolkitLogo();
            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (DrawBacktrackProfileButton("Back to Configuration Profile", MixedRealityToolkit.Instance.ActiveProfile))
            {
                return;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Camera Profile", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("The Camera Profile helps configure cross platform camera settings.", MessageType.Info);

            CheckProfileLock(target);

            serializedObject.Update();

            EditorGUILayout.Space();
            showGeneralProperties = EditorGUILayout.Foldout(showGeneralProperties, "General Settings", true);
            if (showGeneralProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(isCameraPersistent);
                }
            }

            EditorGUILayout.Space();
            showOpaqueProperties = EditorGUILayout.Foldout(showOpaqueProperties, "Opaque Display Settings", true);
            if (showOpaqueProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(opaqueNearClip, nearClipTitle);
                    EditorGUILayout.PropertyField(opaqueClearFlags, clearFlagsTitle);

                    if ((CameraClearFlags)opaqueClearFlags.intValue == CameraClearFlags.Color)
                    {
                        opaqueBackgroundColor.colorValue = EditorGUILayout.ColorField("Background Color", opaqueBackgroundColor.colorValue);
                    }

                    opaqueQualityLevel.intValue = EditorGUILayout.Popup("Quality Setting", opaqueQualityLevel.intValue, QualitySettings.names);
                }
            }

            EditorGUILayout.Space();
            showTransparentProperties = EditorGUILayout.Foldout(showTransparentProperties, "Transparent Display Settings", true);
            if (showTransparentProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(transparentNearClip, nearClipTitle);
                    EditorGUILayout.PropertyField(transparentClearFlags, clearFlagsTitle);

                    if ((CameraClearFlags)transparentClearFlags.intValue == CameraClearFlags.Color)
                    {
                        transparentBackgroundColor.colorValue = EditorGUILayout.ColorField("Background Color", transparentBackgroundColor.colorValue);
                    }

                    holoLensQualityLevel.intValue = EditorGUILayout.Popup("Quality Setting", holoLensQualityLevel.intValue, QualitySettings.names);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
Пример #24
0
        public override void OnInspectorGUI()
        {
            MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled)
            {
                EditorGUILayout.HelpBox("No input system is enabled, or you need to specify the type in the main configuration profile.", MessageType.Error);

                if (GUILayout.Button("Back to Configuration Profile"))
                {
                    Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile;
                }

                return;
            }

            if (MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile == null)
            {
                EditorGUILayout.HelpBox("No Input Actions profile was specified.", MessageType.Error);

                if (GUILayout.Button("Back to Input Profile"))
                {
                    Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile;
                }

                return;
            }

            if (GUILayout.Button("Back to Input Profile"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Input Action Rules Profile", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Input Action Rules help define alternative Actions that will be raised based on specific criteria.\n\n" +
                                    "You can create new rules by assigning a base Input Action below, then assigning the criteria you'd like to meet. When the criteria is met, the Rule's Action will be raised with the criteria value.\n\n" +
                                    "Note: Rules can only be created for the same axis constraints.", MessageType.Info);

            EditorGUILayout.Space();

            (target as BaseMixedRealityProfile).CheckProfileLock();

            var isGuiLocked = !(MixedRealityPreferences.LockProfiles && !((BaseMixedRealityProfile)target).IsCustomProfile);

            GUI.enabled = isGuiLocked;

            serializedObject.Update();

            selectedBaseActionId = RenderBaseInputAction(selectedBaseActionId, out currentBaseAction);
            GUI.enabled          = isGuiLocked && currentBaseAction != MixedRealityInputAction.None;
            RenderCriteriaField(currentBaseAction);

            if (selectedBaseActionId == selectedRuleActionId)
            {
                selectedRuleActionId = 0;
            }

            selectedRuleActionId = RenderRuleInputAction(selectedRuleActionId, out currentRuleAction);

            EditorGUILayout.Space();

            GUI.enabled = isGuiLocked &&
                          !RuleExists() &&
                          currentBaseAction != MixedRealityInputAction.None &&
                          currentRuleAction != MixedRealityInputAction.None &&
                          currentBaseAction.AxisConstraint != AxisType.None &&
                          currentBaseAction.AxisConstraint != AxisType.Raw;

            if (GUILayout.Button(RuleAddButtonContent, EditorStyles.miniButton))
            {
                AddRule();
                ResetCriteria();
            }

            GUI.enabled = isGuiLocked;

            EditorGUILayout.Space();

            var isWideMode = EditorGUIUtility.wideMode;

            EditorGUIUtility.wideMode = true;

            RenderList(inputActionRulesDigital, digitalFoldouts);
            RenderList(inputActionRulesSingleAxis, singleAxisFoldouts);
            RenderList(inputActionRulesDualAxis, dualAxisFoldouts);
            RenderList(inputActionRulesVectorAxis, vectorFoldouts);
            RenderList(inputActionRulesQuaternionAxis, quaternionFoldouts);
            RenderList(inputActionRulesPoseAxis, poseFoldouts);

            EditorGUIUtility.wideMode = isWideMode;
            serializedObject.ApplyModifiedProperties();
        }
Пример #25
0
        public override void OnInspectorGUI()
        {
            MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled)
            {
                EditorGUILayout.HelpBox("No input system is enabled, or you need to specify the type in the main configuration profile.", MessageType.Error);

                if (GUILayout.Button("Back to Configuration Profile"))
                {
                    Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile;
                }

                return;
            }

            if (GUILayout.Button("Back to Input Profile"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Controller Data Providers", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Use this profile to define all the input sources your application can get input data from.", MessageType.Info);

            (target as BaseMixedRealityProfile).CheckProfileLock();

            serializedObject.Update();

            EditorGUILayout.Space();

            bool changed = false;

            if (GUILayout.Button(AddControllerDataProviderContent, EditorStyles.miniButton))
            {
                controllerDataProviders.arraySize += 1;
                var newConfiguration = controllerDataProviders.GetArrayElementAtIndex(controllerDataProviders.arraySize - 1);
                var dataProviderType = newConfiguration.FindPropertyRelative("dataProviderType");
                var dataProviderName = newConfiguration.FindPropertyRelative("dataProviderName");
                var priority         = newConfiguration.FindPropertyRelative("priority");
                var runtimePlatform  = newConfiguration.FindPropertyRelative("runtimePlatform");

                serializedObject.ApplyModifiedProperties();
                dataProviderType.FindPropertyRelative("reference").stringValue = string.Empty;
                dataProviderName.stringValue = "New Controller Data Provider";
                priority.intValue            = 5;
                runtimePlatform.intValue     = 0;
                serializedObject.ApplyModifiedProperties();
                foldouts = new bool[controllerDataProviders.arraySize];
                changed  = true;
            }

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical();

            for (int i = 0; i < controllerDataProviders.arraySize; i++)
            {
                var controllerConfiguration = controllerDataProviders.GetArrayElementAtIndex(i);
                var dataProviderName        = controllerConfiguration.FindPropertyRelative("dataProviderName");
                var dataProviderType        = controllerConfiguration.FindPropertyRelative("dataProviderType");
                var priority        = controllerConfiguration.FindPropertyRelative("priority");
                var runtimePlatform = controllerConfiguration.FindPropertyRelative("runtimePlatform");

                EditorGUILayout.BeginHorizontal();
                foldouts[i] = EditorGUILayout.Foldout(foldouts[i], dataProviderName.stringValue, true);

                if (GUILayout.Button(RemoveControllerDataProviderContent, EditorStyles.miniButtonRight, GUILayout.Width(24f)))
                {
                    controllerDataProviders.DeleteArrayElementAtIndex(i);
                    serializedObject.ApplyModifiedProperties();
                    foldouts = new bool[controllerDataProviders.arraySize];
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.EndVertical();
                    return;
                }

                EditorGUILayout.EndHorizontal();

                if (foldouts[i])
                {
                    EditorGUI.indentLevel++;
                    EditorGUI.BeginChangeCheck();

                    EditorGUILayout.PropertyField(dataProviderType);
                    EditorGUILayout.PropertyField(dataProviderName);
                    EditorGUILayout.PropertyField(priority);
                    EditorGUILayout.PropertyField(runtimePlatform);

                    if (EditorGUI.EndChangeCheck())
                    {
                        changed = true;
                    }

                    EditorGUI.indentLevel--;
                }

                EditorGUILayout.Space();
            }

            EditorGUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();

            if (changed)
            {
                EditorApplication.delayCall += () => MixedRealityToolkit.Instance.ResetConfiguration(MixedRealityToolkit.Instance.ActiveProfile);
            }
        }
 protected virtual void OnEnable()
 {
     MixedRealityInspectorUtility.CheckMixedRealityConfigured(false);
     isFocusRequiredProperty = serializedObject.FindProperty("isFocusRequired");
 }
        public override void OnInspectorGUI()
        {
            RenderMixedRealityToolkitLogo();
            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (DrawBacktrackProfileButton("Back to Configuration Profile", MixedRealityToolkit.Instance.ActiveProfile))
            {
                return;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Spatial Awareness Mesh Observer Profile", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Configuration settings for how the real-world environment will be perceived and displayed.", MessageType.Info);
            EditorGUILayout.Space();
            serializedObject.Update();

            if (MixedRealityPreferences.LockProfiles && !((BaseMixedRealityProfile)target).IsCustomProfile)
            {
                GUI.enabled = false;
            }

            showGeneralProperties = EditorGUILayout.Foldout(showGeneralProperties, "General Settings", true);
            if (showGeneralProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(startupBehavior);
                    EditorGUILayout.Space();
                    EditorGUILayout.PropertyField(updateInterval);
                    EditorGUILayout.Space();
                    EditorGUILayout.PropertyField(isStationaryObserver);
                    EditorGUILayout.PropertyField(observerVolumeType, volumeTypeContent);
                    string message = string.Empty;
                    if (observerVolumeType.intValue == (int)VolumeType.AxisAlignedCube)
                    {
                        message = "Observed meshes will be aligned to the world coordinate space.";
                    }
                    else if (observerVolumeType.intValue == (int)VolumeType.UserAlignedCube)
                    {
                        message = "Observed meshes will be aligned to the user's coordinate space.";
                    }
                    else if (observerVolumeType.intValue == (int)VolumeType.Sphere)
                    {
                        message = "The X value of the Observation Extents will be used as the sphere radius.";
                    }
                    EditorGUILayout.HelpBox(message, MessageType.Info);
                    EditorGUILayout.PropertyField(observationExtents);
                }
            }

            EditorGUILayout.Space();
            showPhysicsProperties = EditorGUILayout.Foldout(showPhysicsProperties, "Physics Settings", true);
            if (showPhysicsProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(meshPhysicsLayer, physicsLayerContent);
                    EditorGUILayout.PropertyField(recalculateNormals);
                }
            }

            EditorGUILayout.Space();
            showLevelOfDetailProperties = EditorGUILayout.Foldout(showLevelOfDetailProperties, "Level of Detail Settings", true);
            if (showLevelOfDetailProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(levelOfDetail, lodContent);
                    EditorGUILayout.PropertyField(trianglesPerCubicMeter, trianglesPerCubicMeterContent);
                    EditorGUILayout.HelpBox("The value of Triangles per Cubic Meter is ignored unless Level of Detail is set to Custom.", MessageType.Info);
                }
            }

            EditorGUILayout.Space();
            showDisplayProperties = EditorGUILayout.Foldout(showDisplayProperties, "Display Settings", true);
            if (showDisplayProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(displayOption, displayOptionContent);
                    EditorGUILayout.PropertyField(visibleMaterial);
                    EditorGUILayout.PropertyField(occlusionMaterial);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            RenderMixedRealityToolkitLogo();
            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled)
            {
                EditorGUILayout.HelpBox("No input system is enabled, or you need to specify the type in the main configuration profile.", MessageType.Error);

                DrawBacktrackProfileButton("Back to Configuration Profile", MixedRealityToolkit.Instance.ActiveProfile);

                return;
            }

            if (DrawBacktrackProfileButton("Back to Input Profile", MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile))
            {
                return;
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Controller Visualizations", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Define all the custom controller visualizations you'd like to use for each controller type when they're rendered in the scene.\n\n" +
                                    "Global settings are the default fallback, and any specific controller definitions take precedence.", MessageType.Info);
            serializedObject.Update();

            CheckProfileLock(target);

            EditorGUIUtility.labelWidth = 168f;

            EditorGUILayout.Space();
            showVisualizationProperties = EditorGUILayout.Foldout(showVisualizationProperties, "Visualization Settings", true);
            if (showVisualizationProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(renderMotionControllers);

                    EditorGUILayout.PropertyField(defaultControllerVisualizationType);

                    if (thisProfile.DefaultControllerVisualizationType == null ||
                        thisProfile.DefaultControllerVisualizationType.Type == null)
                    {
                        EditorGUILayout.HelpBox("A default controller visualization type must be defined!", MessageType.Error);
                    }
                }
            }

            var leftHandModelPrefab  = globalLeftHandedControllerModel.objectReferenceValue as GameObject;
            var rightHandModelPrefab = globalRightHandedControllerModel.objectReferenceValue as GameObject;

            EditorGUILayout.Space();
            showModelProperties = EditorGUILayout.Foldout(showModelProperties, "Controller Model Settings", true);
            if (showModelProperties)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(useDefaultModels);

                    if (useDefaultModels.boolValue && (leftHandModelPrefab != null || rightHandModelPrefab != null))
                    {
                        EditorGUILayout.HelpBox("When default models are used, an attempt is made to obtain controller models from the platform sdk. The global left and right models are only shown if no model can be obtained.", MessageType.Warning);
                    }

                    EditorGUI.BeginChangeCheck();
                    leftHandModelPrefab = EditorGUILayout.ObjectField(new GUIContent(globalLeftHandedControllerModel.displayName, "Note: If the default model is not found, the fallback is the global left hand model."), leftHandModelPrefab, typeof(GameObject), false) as GameObject;

                    if (EditorGUI.EndChangeCheck() && CheckVisualizer(leftHandModelPrefab))
                    {
                        globalLeftHandedControllerModel.objectReferenceValue = leftHandModelPrefab;
                    }

                    EditorGUI.BeginChangeCheck();
                    rightHandModelPrefab = EditorGUILayout.ObjectField(new GUIContent(globalRightHandedControllerModel.displayName, "Note: If the default model is not found, the fallback is the global right hand model."), rightHandModelPrefab, typeof(GameObject), false) as GameObject;

                    if (EditorGUI.EndChangeCheck() && CheckVisualizer(rightHandModelPrefab))
                    {
                        globalRightHandedControllerModel.objectReferenceValue = rightHandModelPrefab;
                    }

                    EditorGUILayout.PropertyField(globalLeftHandModel);
                    EditorGUILayout.PropertyField(globalRightHandModel);
                }
            }

            EditorGUIUtility.labelWidth = defaultLabelWidth;

            EditorGUILayout.Space();
            showControllerDefinitions = EditorGUILayout.Foldout(showControllerDefinitions, "Controller Definitions", true);
            if (showControllerDefinitions)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    RenderControllerList(controllerVisualizationSettings);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            if (!MixedRealityToolkit.IsInitialized)
            {
                return;
            }

            RenderProfileHeader(ProfileTitle, ProfileDescription, target);

            MixedRealityInspectorUtility.CheckMixedRealityConfigured(true);

            serializedObject.Update();

            MixedRealitySceneSystemProfile profile = (MixedRealitySceneSystemProfile)target;

            RenderFoldout(ref showEditorProperties, "Editor Settings", () =>
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(editorManageBuildSettings);
                    EditorGUILayout.PropertyField(editorManageLoadedScenes);
                    EditorGUILayout.PropertyField(editorEnforceSceneOrder);
                    EditorGUILayout.PropertyField(editorEnforceLightingSceneTypes);

                    if (editorEnforceLightingSceneTypes.boolValue)
                    {
                        EditorGUILayout.Space();
                        EditorGUILayout.HelpBox("Below are the component types that will be allowed in lighting scenes. Types not found in this list will be moved to another scene.", MessageType.Info);
                        EditorGUIUtility.labelWidth = LightingSceneTypesLabelWidth;
                        EditorGUILayout.PropertyField(permittedLightingSceneComponentTypes, true);
                        EditorGUIUtility.labelWidth = 0;
                    }
                }
            }, ShowSceneSystem_Editor_PreferenceKey);

            RenderFoldout(ref showManagerProperties, "Manager Scene Settings", () =>
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.HelpBox(managerSceneContent, MessageType.Info);

                    // Disable the tag field since we're drawing manager scenes
                    SceneInfoDrawer.DrawTagProperty = false;
                    EditorGUILayout.PropertyField(useManagerScene);

                    if (useManagerScene.boolValue && profile.ManagerScene.IsEmpty && !Application.isPlaying)
                    {
                        EditorGUILayout.HelpBox("You haven't created a manager scene yet. Click the button below to create one.", MessageType.Warning);
                        var buttonRect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(new GUILayoutOption[] { }));
                        if (GUI.Button(buttonRect, "Create Manager Scene", EditorStyles.miniButton))
                        {
                            // Create a new manager scene and add it to build settings
                            SceneInfo newManagerScene = EditorSceneUtils.CreateAndSaveScene("ManagerScene");
                            SerializedObjectUtils.SetStructValue <SceneInfo>(managerScene, newManagerScene);
                            EditorSceneUtils.AddSceneToBuildSettings(newManagerScene, EditorBuildSettings.scenes, EditorSceneUtils.BuildIndexTarget.First);
                        }
                        EditorGUILayout.Space();
                    }

                    if (useManagerScene.boolValue)
                    {
                        EditorGUILayout.PropertyField(managerScene, includeChildren: true);
                    }
                }
            }, ShowSceneSystem_Manager_PreferenceKey);

            RenderFoldout(ref showLightingProperties, "Lighting Scene Settings", () =>
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.HelpBox(lightingSceneContent, MessageType.Info);

                    EditorGUILayout.PropertyField(useLightingScene);

                    if (useLightingScene.boolValue && profile.NumLightingScenes < 1 && !Application.isPlaying)
                    {
                        EditorGUILayout.HelpBox("You haven't created a lighting scene yet. Click the button below to create one.", MessageType.Warning);
                        var buttonRect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(new GUILayoutOption[] { }));
                        if (GUI.Button(buttonRect, "Create Lighting Scene", EditorStyles.miniButton))
                        {
                            // Create a new lighting scene and add it to build settings
                            SceneInfo newLightingScene = EditorSceneUtils.CreateAndSaveScene("LightingScene");
                            // Create an element in the array
                            lightingScenes.arraySize = 1;
                            serializedObject.ApplyModifiedProperties();
                            SerializedObjectUtils.SetStructValue <SceneInfo>(lightingScenes.GetArrayElementAtIndex(0), newLightingScene);
                            EditorSceneUtils.AddSceneToBuildSettings(newLightingScene, EditorBuildSettings.scenes, EditorSceneUtils.BuildIndexTarget.Last);
                        }
                        EditorGUILayout.Space();
                    }

                    if (useLightingScene.boolValue)
                    {
                        // Disable the tag field since we're drawing lighting scenes
                        SceneInfoDrawer.DrawTagProperty = false;

                        if (profile.NumLightingScenes > 0)
                        {
                            string[] lightingSceneNames        = profile.LightingScenes.Select(l => l.Name).ToArray <string>();
                            defaultLightingSceneIndex.intValue = EditorGUILayout.Popup("Default Lighting Scene", defaultLightingSceneIndex.intValue, lightingSceneNames);
                        }

                        EditorGUILayout.PropertyField(lightingScenes, includeChildren: true);
                        //DrawSceneInfoDragAndDrop(lightingScenes);

                        EditorGUILayout.Space();

                        if (profile.NumLightingScenes > 0)
                        {
                            if (profile.EditorLightingCacheOutOfDate)
                            {
                                EditorGUILayout.HelpBox("Your cached lighting settings may be out of date. This could result in unexpected appearances at runtime.", MessageType.Warning);
                            }
                            if (InspectorUIUtility.RenderIndentedButton(new GUIContent("Update Cached Lighting Settings"), EditorStyles.miniButton))
                            {
                                profile.EditorLightingCacheUpdateRequested = true;
                            }
                        }
                        EditorGUILayout.Space();
                    }
                }
            }, ShowSceneSystem_Lighting_PreferenceKey);

            RenderFoldout(ref showContentProperties, "Content Scene Settings", () =>
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.HelpBox(contentSceneContent, MessageType.Info);

                    // Enable the tag field since we're drawing content scenes
                    SceneInfoDrawer.DrawTagProperty = true;
                    EditorGUILayout.PropertyField(contentScenes, includeChildren: true);
                    //DrawSceneInfoDragAndDrop(contentScenes);
                }
            }, ShowSceneSystem_Content_PreferenceKey);

            serializedObject.ApplyModifiedProperties();

            // Keep this inspector perpetually refreshed
            EditorUtility.SetDirty(target);
        }
Пример #30
0
        public override void OnInspectorGUI()
        {
            MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();

            if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured())
            {
                return;
            }

            if (!MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled)
            {
                EditorGUILayout.HelpBox("No input system is enabled, or you need to specify the type in the main configuration profile.", MessageType.Error);

                if (GUILayout.Button("Back to Configuration Profile"))
                {
                    Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile;
                }

                return;
            }

            if (GUILayout.Button("Back to controller mapping list"))
            {
                Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.ControllerMappingProfiles;
            }

            EditorGUILayout.Space();
            var deviceName = profile.ControllerType == SupportedControllerType.None ? "Custom Device" : profile.ControllerType.ToString();

            EditorGUILayout.LabelField($"{deviceName} Mappings", EditorStyles.boldLabel);

            if (MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile == null)
            {
                EditorGUILayout.HelpBox("No input actions found, please specify a input action profile in the main configuration.", MessageType.Error);
                return;
            }

            (target as BaseMixedRealityProfile).CheckProfileLock(false);

            if (controllerButtonStyle == null)
            {
                controllerButtonStyle = new GUIStyle("LargeButton")
                {
                    imagePosition = ImagePosition.ImageAbove,
                    fontStyle     = FontStyle.Bold,
                    stretchHeight = true,
                    stretchWidth  = true,
                    wordWrap      = true,
                    fontSize      = 10,
                };
            }

            serializedObject.Update();
            controllerItems.Clear();

            GUILayout.BeginVertical();

            if (controllerMappings.arraySize == 0)
            {
                EditorGUILayout.HelpBox("You must override the controller mappings in your custom implementation to see a list of mappings for your device.", MessageType.Error);
            }

            for (int i = 0; i < controllerMappings?.arraySize; i++)
            {
                var supportedControllerType = profile.ControllerType;
                var controllerMapping       = controllerMappings.GetArrayElementAtIndex(i);
                var handednessValue         = controllerMapping.FindPropertyRelative("handedness");
                var handedness   = (Handedness)handednessValue.intValue;
                var description  = controllerMapping.FindPropertyRelative("description");
                var interactions = controllerMapping.FindPropertyRelative("interactions");

                bool skip = false;

                for (int j = 0; j < controllerItems.Count; j++)
                {
                    if (controllerItems[j].ControllerType == supportedControllerType &&
                        controllerItems[j].Handedness == handedness)
                    {
                        profile.ControllerMappings[i].SynchronizeInputActions(controllerItems[j].Interactions);
                        serializedObject.ApplyModifiedProperties();
                        skip = true;
                    }
                }

                if (skip)
                {
                    continue;
                }

                controllerItems.Add(new ControllerItem(supportedControllerType, handedness, profile.ControllerMappings[i].Interactions));

                string handednessContent = string.Empty;

                switch (handedness)
                {
                case Handedness.Left:
                case Handedness.Right:
                case Handedness.Other:
                    handednessContent = $" {handedness.ToString()} hand";
                    break;

                case Handedness.Both:
                    handednessContent = $" {handedness.ToString()} hands";
                    break;
                }

                if (handedness != Handedness.Right)
                {
                    GUILayout.BeginHorizontal();
                }

                var buttonContent = new GUIContent($"Edit {description.stringValue}{handednessContent}", ControllerMappingLibrary.GetControllerTextureScaled(supportedControllerType, handedness));

                if (GUILayout.Button(buttonContent, controllerButtonStyle, GUILayout.Height(128f), GUILayout.MinWidth(32f), GUILayout.ExpandWidth(true)))
                {
                    serializedObject.ApplyModifiedProperties();
                    ControllerPopupWindow.Show(profile.ControllerType, interactions, handedness, MixedRealityPreferences.LockProfiles && !((BaseMixedRealityProfile)target).IsCustomProfile);
                }

                if (handedness != Handedness.Left)
                {
                    GUILayout.EndHorizontal();
                }
            }

            GUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();
        }