internal void RenderControllerMappingButton(MixedRealityControllerMappingProfile controllerMappingProfile)
        {
            var controllerType = controllerMappingProfile.ControllerType.Type;

            var handedness = controllerMappingProfile.Handedness;

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

            var typeName = controllerType?.Name.ToProperCase();

            if (controllerType?.Name == "WindowsMixedRealityMotionController" && controllerMappingProfile.Handedness == Handedness.None)
            {
                typeName = "HoloLens 1";
            }

            var buttonContent = new GUIContent($"Edit {typeName} Action Mapping", ControllerMappingLibrary.GetControllerTextureScaled(controllerMappingProfile));

            if (GUILayout.Button(buttonContent, ControllerButtonStyle, GUILayout.Height(128f), GUILayout.MinWidth(32f), GUILayout.ExpandWidth(true)))
            {
                EditorApplication.delayCall += () => ControllerPopupWindow.Show(controllerMappingProfile, new SerializedObject(controllerMappingProfile).FindProperty("interactionMappingProfiles"));
            }

            if (handedness != Handedness.Left)
            {
                GUILayout.EndHorizontal();
            }
        }
Esempio n. 2
0
        private void OnFocus()
        {
            if (window.IsNull())
            {
                Close();
            }

            currentControllerTexture = ControllerMappingLibrary.GetControllerTexture(controllerDataProviderProfile);
        }
        private void RenderControllerList(SerializedProperty controllerList)
        {
            if (thisProfile.MixedRealityControllerMappingProfiles.Length != controllerList.arraySize)
            {
                return;
            }

            EditorGUILayout.Space();

            if (GUILayout.Button(ControllerAddButtonContent, EditorStyles.miniButton))
            {
                AddController(controllerList, typeof(GenericJoystickController));
                return;
            }

            controllerRenderList.Clear();

            GUILayout.Space(12f);

            using (var outerVerticalScope = new GUILayout.VerticalScope())
            {
                GUILayout.HorizontalScope horizontalScope = null;

                for (int i = 0; i < thisProfile.MixedRealityControllerMappingProfiles.Length; i++)
                {
                    MixedRealityControllerMapping controllerMapping = thisProfile.MixedRealityControllerMappingProfiles[i];
                    Type controllerType = controllerMapping.ControllerType;
                    if (controllerType == null)
                    {
                        continue;
                    }

                    Handedness handedness = controllerMapping.Handedness;
                    bool       useCustomInteractionMappings         = controllerMapping.HasCustomInteractionMappings;
                    SupportedControllerType supportedControllerType = controllerMapping.SupportedControllerType;

                    var controllerMappingProperty = controllerList.GetArrayElementAtIndex(i);
                    var handednessProperty        = controllerMappingProperty.FindPropertyRelative("handedness");

                    if (!useCustomInteractionMappings)
                    {
                        bool skip = false;

                        // Merge controllers with the same supported controller type.
                        for (int j = 0; j < controllerRenderList.Count; j++)
                        {
                            if (controllerRenderList[j].SupportedControllerType == supportedControllerType &&
                                controllerRenderList[j].Handedness == handedness)
                            {
                                thisProfile.MixedRealityControllerMappingProfiles[i].SynchronizeInputActions(controllerRenderList[j].Interactions);
                                serializedObject.ApplyModifiedProperties();
                                skip = true;
                            }
                        }

                        if (skip)
                        {
                            continue;
                        }
                    }

                    controllerRenderList.Add(new ControllerRenderProfile(supportedControllerType, handedness, thisProfile.MixedRealityControllerMappingProfiles[i].Interactions));

                    string controllerTitle      = thisProfile.MixedRealityControllerMappingProfiles[i].Description;
                    var    interactionsProperty = controllerMappingProperty.FindPropertyRelative("interactions");

                    if (useCustomInteractionMappings)
                    {
                        if (horizontalScope != null)
                        {
                            horizontalScope.Dispose(); horizontalScope = null;
                        }

                        GUILayout.Space(24f);

                        using (var verticalScope = new GUILayout.VerticalScope())
                        {
                            using (horizontalScope = new GUILayout.HorizontalScope())
                            {
                                EditorGUIUtility.labelWidth = 64f;
                                EditorGUIUtility.fieldWidth = 64f;
                                EditorGUILayout.LabelField(controllerTitle);
                                EditorGUIUtility.fieldWidth = defaultFieldWidth;
                                EditorGUIUtility.labelWidth = defaultLabelWidth;

                                if (GUILayout.Button(ControllerMinusButtonContent, EditorStyles.miniButtonRight, GUILayout.Width(24f)))
                                {
                                    controllerList.DeleteArrayElementAtIndex(i);
                                    return;
                                }
                            }
                            EditorGUI.indentLevel++;

                            EditorGUIUtility.labelWidth = 128f;
                            EditorGUIUtility.fieldWidth = 64f;

                            EditorGUI.BeginChangeCheck();

                            // Generic Type dropdown
                            Type[] genericTypes           = MixedRealityControllerMappingProfile.CustomControllerMappingTypes;
                            var    genericTypeListContent = new GUIContent[genericTypes.Length];
                            var    genericTypeListIds     = new int[genericTypes.Length];
                            int    currentGenericType     = -1;
                            for (int genericTypeIdx = 0; genericTypeIdx < genericTypes.Length; genericTypeIdx++)
                            {
                                var attribute = MixedRealityControllerAttribute.Find(genericTypes[genericTypeIdx]);
                                if (attribute != null)
                                {
                                    genericTypeListContent[genericTypeIdx] = new GUIContent(attribute.SupportedControllerType.ToString().Replace("Generic", "").ToProperCase() + " Controller");
                                }
                                else
                                {
                                    genericTypeListContent[genericTypeIdx] = new GUIContent("Unknown Controller");
                                }

                                genericTypeListIds[genericTypeIdx] = genericTypeIdx;

                                if (controllerType == genericTypes[genericTypeIdx])
                                {
                                    currentGenericType = genericTypeIdx;
                                }
                            }
                            Debug.Assert(currentGenericType != -1);

                            currentGenericType = EditorGUILayout.IntPopup(GenericTypeContent, currentGenericType, genericTypeListContent, genericTypeListIds);
                            controllerType     = genericTypes[currentGenericType];

                            {
                                // Handedness dropdown
                                var attribute = MixedRealityControllerAttribute.Find(controllerType);
                                if (attribute != null && attribute.SupportedHandedness.Length >= 1)
                                {
                                    // Make sure handedness is valid for the selected controller type.
                                    if (Array.IndexOf(attribute.SupportedHandedness, (Handedness)handednessProperty.intValue) < 0)
                                    {
                                        handednessProperty.intValue = (int)attribute.SupportedHandedness[0];
                                    }

                                    if (attribute.SupportedHandedness.Length >= 2)
                                    {
                                        var handednessListContent = new GUIContent[attribute.SupportedHandedness.Length];
                                        var handednessListIds     = new int[attribute.SupportedHandedness.Length];
                                        for (int handednessIdx = 0; handednessIdx < attribute.SupportedHandedness.Length; handednessIdx++)
                                        {
                                            handednessListContent[handednessIdx] = new GUIContent(attribute.SupportedHandedness[handednessIdx].ToString());
                                            handednessListIds[handednessIdx]     = (int)attribute.SupportedHandedness[handednessIdx];
                                        }

                                        handednessProperty.intValue = EditorGUILayout.IntPopup(HandednessTypeContent, handednessProperty.intValue, handednessListContent, handednessListIds);
                                    }
                                }
                                else
                                {
                                    handednessProperty.intValue = (int)Handedness.None;
                                }
                            }

                            if (EditorGUI.EndChangeCheck())
                            {
                                interactionsProperty.ClearArray();
                                serializedObject.ApplyModifiedProperties();
                                thisProfile.MixedRealityControllerMappingProfiles[i].ControllerType.Type = genericTypes[currentGenericType];
                                thisProfile.MixedRealityControllerMappingProfiles[i].SetDefaultInteractionMapping(true);
                                serializedObject.ApplyModifiedProperties();
                                return;
                            }

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

                            EditorGUI.indentLevel--;

                            if (GUILayout.Button("Edit Input Action Map"))
                            {
                                ControllerPopupWindow.Show(controllerMapping, interactionsProperty, handedness);
                            }

                            if (GUILayout.Button("Reset Input Actions"))
                            {
                                interactionsProperty.ClearArray();
                                serializedObject.ApplyModifiedProperties();
                                thisProfile.MixedRealityControllerMappingProfiles[i].SetDefaultInteractionMapping(true);
                                serializedObject.ApplyModifiedProperties();
                            }
                        }
                    }
                    else
                    {
                        if (supportedControllerType == SupportedControllerType.WindowsMixedReality &&
                            handedness == Handedness.None)
                        {
                            controllerTitle = "HoloLens Gestures";
                        }

                        if (handedness != Handedness.Right)
                        {
                            if (horizontalScope != null)
                            {
                                horizontalScope.Dispose(); horizontalScope = null;
                            }
                            horizontalScope = new GUILayout.HorizontalScope();
                        }

                        var buttonContent = new GUIContent(controllerTitle, ControllerMappingLibrary.GetControllerTextureScaled(controllerType, handedness));

                        if (GUILayout.Button(buttonContent, controllerButtonStyle, GUILayout.Height(128f), GUILayout.MinWidth(32f), GUILayout.ExpandWidth(true)))
                        {
                            ControllerPopupWindow.Show(controllerMapping, interactionsProperty, handedness);
                        }
                    }
                }

                if (horizontalScope != null)
                {
                    horizontalScope.Dispose(); horizontalScope = null;
                }
            }
        }
Esempio n. 4
0
        private void OnFocus()
        {
            currentControllerTexture = ControllerMappingLibrary.GetControllerTexture(currentControllerMapping.ControllerType, currentControllerMapping.Handedness);

            #region Interaction Constraint Setup

            actionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                        .Select(action => (int)action.Id)
                        .Prepend(0).ToArray();

            axisLabels = ControllerMappingLibrary.UnityInputManagerAxes
                         .Select(axis => new GUIContent(axis.Name))
                         .Prepend(new GUIContent("None")).ToArray();

            actionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                        .Where(inputAction => inputAction.AxisConstraint == AxisType.None)
                        .Select(action => (int)action.Id)
                        .Prepend(0).ToArray();

            actionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                           .Where(inputAction => inputAction.AxisConstraint == AxisType.None)
                           .Select(inputAction => new GUIContent(inputAction.Description))
                           .Prepend(new GUIContent("None")).ToArray();

            rawActionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                           .Where(inputAction => inputAction.AxisConstraint == AxisType.Raw)
                           .Select(action => (int)action.Id)
                           .Prepend(0).ToArray();

            rawActionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                              .Where(inputAction => inputAction.AxisConstraint == AxisType.Raw)
                              .Select(inputAction => new GUIContent(inputAction.Description))
                              .Prepend(new GUIContent("None")).ToArray();

            digitalActionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                               .Where(inputAction => inputAction.AxisConstraint == AxisType.Digital)
                               .Select(action => (int)action.Id)
                               .Prepend(0).ToArray();

            digitalActionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                                  .Where(inputAction => inputAction.AxisConstraint == AxisType.Digital)
                                  .Select(inputAction => new GUIContent(inputAction.Description))
                                  .Prepend(new GUIContent("None")).ToArray();

            singleAxisActionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                                  .Where(inputAction => inputAction.AxisConstraint == AxisType.SingleAxis)
                                  .Select(action => (int)action.Id)
                                  .Prepend(0).ToArray();

            singleAxisActionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                                     .Where(inputAction => inputAction.AxisConstraint == AxisType.SingleAxis)
                                     .Select(inputAction => new GUIContent(inputAction.Description))
                                     .Prepend(new GUIContent("None")).ToArray();

            dualAxisActionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                                .Where(inputAction => inputAction.AxisConstraint == AxisType.DualAxis)
                                .Select(action => (int)action.Id).Prepend(0).ToArray();

            dualAxisActionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                                   .Where(inputAction => inputAction.AxisConstraint == AxisType.DualAxis)
                                   .Select(inputAction => new GUIContent(inputAction.Description))
                                   .Prepend(new GUIContent("None")).ToArray();

            threeDofPositionActionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                                        .Where(inputAction => inputAction.AxisConstraint == AxisType.ThreeDofPosition)
                                        .Select(action => (int)action.Id)
                                        .Prepend(0).ToArray();

            threeDofPositionActionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                                           .Where(inputAction => inputAction.AxisConstraint == AxisType.ThreeDofPosition)
                                           .Select(inputAction => new GUIContent(inputAction.Description))
                                           .Prepend(new GUIContent("None")).ToArray();

            threeDofRotationActionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                                        .Where(inputAction => inputAction.AxisConstraint == AxisType.ThreeDofRotation)
                                        .Select(action => (int)action.Id)
                                        .Prepend(0).ToArray();

            threeDofRotationActionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                                           .Where(inputAction => inputAction.AxisConstraint == AxisType.ThreeDofRotation)
                                           .Select(inputAction => new GUIContent(inputAction.Description))
                                           .Prepend(new GUIContent("None")).ToArray();

            sixDofActionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                              .Where(inputAction => inputAction.AxisConstraint == AxisType.SixDof)
                              .Select(action => (int)action.Id)
                              .Prepend(0).ToArray();

            sixDofActionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
                                 .Where(inputAction => inputAction.AxisConstraint == AxisType.SixDof)
                                 .Select(inputAction => new GUIContent(inputAction.Description))
                                 .Prepend(new GUIContent("None")).ToArray();

            #endregion  Interaction Constraint Setup
        }
        private void RenderControllerList(SerializedProperty controllerList)
        {
            if (thisProfile.MixedRealityControllerMappings.Length != controllerList.arraySize)
            {
                return;
            }

            if (InspectorUIUtility.RenderIndentedButton(ControllerAddButtonContent, EditorStyles.miniButton))
            {
                AddController(controllerList, typeof(GenericJoystickController));
                return;
            }

            controllerRenderList.Clear();

            // Generating the set of controllers that belong to each Controller Mapping Signature
            Dictionary <ControllerMappingSignature, List <string> > controllersAffectedByMappingSignatures = new Dictionary <ControllerMappingSignature, List <string> >();

            for (int i = 0; i < thisProfile.MixedRealityControllerMappings.Length; i++)
            {
                MixedRealityControllerMapping controllerMapping = thisProfile.MixedRealityControllerMappings[i];
                Type controllerType = controllerMapping.ControllerType;
                if (controllerType == null)
                {
                    continue;
                }

                Handedness handedness = controllerMapping.Handedness;
                SupportedControllerType supportedControllerType = controllerMapping.SupportedControllerType;

                ControllerMappingSignature currentSignature = new ControllerMappingSignature(supportedControllerType, handedness);
                if (!controllersAffectedByMappingSignatures.ContainsKey(currentSignature))
                {
                    controllersAffectedByMappingSignatures.Add(currentSignature, new List <string>());
                }
                controllersAffectedByMappingSignatures[currentSignature].Add(controllerType.ToString());
            }

            showControllerDefinitions = EditorGUILayout.Foldout(showControllerDefinitions, "Controller Definitions", true);
            if (showControllerDefinitions)
            {
                using (var outerVerticalScope = new GUILayout.VerticalScope())
                {
                    GUILayout.HorizontalScope horizontalScope = null;

                    for (int i = 0; i < thisProfile.MixedRealityControllerMappings.Length; i++)
                    {
                        MixedRealityControllerMapping controllerMapping = thisProfile.MixedRealityControllerMappings[i];
                        Type controllerType = controllerMapping.ControllerType;
                        if (controllerType == null)
                        {
                            continue;
                        }

                        Handedness handedness = controllerMapping.Handedness;
                        bool       useCustomInteractionMappings         = controllerMapping.HasCustomInteractionMappings;
                        SupportedControllerType supportedControllerType = controllerMapping.SupportedControllerType;

                        var controllerMappingProperty = controllerList.GetArrayElementAtIndex(i);
                        var handednessProperty        = controllerMappingProperty.FindPropertyRelative("handedness");

                        #region Profile Migration

                        // Between MRTK v2 RC2 and GA, the HoloLens clicker and HoloLens voice select input were migrated from
                        // SupportedControllerType.WindowsMixedReality && Handedness.None to SupportedControllerType.GGVHand && Handedness.None
                        if (supportedControllerType == SupportedControllerType.WindowsMixedReality && handedness == Handedness.None)
                        {
                            for (int j = 0; j < thisProfile.MixedRealityControllerMappings.Length; j++)
                            {
                                if (thisProfile.MixedRealityControllerMappings[j].SupportedControllerType == SupportedControllerType.GGVHand &&
                                    thisProfile.MixedRealityControllerMappings[j].Handedness == Handedness.None)
                                {
                                    if (horizontalScope != null)
                                    {
                                        horizontalScope.Dispose(); horizontalScope = null;
                                    }

                                    serializedObject.ApplyModifiedProperties();

                                    for (int k = 0; k < controllerMapping.Interactions.Length; k++)
                                    {
                                        MixedRealityInteractionMapping currentMapping = controllerMapping.Interactions[k];

                                        if (currentMapping.InputType == DeviceInputType.Select)
                                        {
                                            thisProfile.MixedRealityControllerMappings[j].Interactions[0].MixedRealityInputAction = currentMapping.MixedRealityInputAction;
                                        }
                                        else if (currentMapping.InputType == DeviceInputType.SpatialGrip)
                                        {
                                            thisProfile.MixedRealityControllerMappings[j].Interactions[1].MixedRealityInputAction = currentMapping.MixedRealityInputAction;
                                        }
                                    }

                                    serializedObject.Update();
                                    controllerList.DeleteArrayElementAtIndex(i);
                                    EditorUtility.DisplayDialog("Mappings updated", "The \"HoloLens Voice and Clicker\" mappings have been migrated to a new serialization. Please save this asset.", "Okay, thanks!");
                                    return;
                                }
                            }
                        }

                        #endregion Profile Migration

                        if (!useCustomInteractionMappings)
                        {
                            bool skip = false;

                            // Merge controllers with the same supported controller type.
                            for (int j = 0; j < controllerRenderList.Count; j++)
                            {
                                if (controllerRenderList[j].SupportedControllerType == supportedControllerType &&
                                    controllerRenderList[j].Handedness == handedness)
                                {
                                    try
                                    {
                                        thisProfile.MixedRealityControllerMappings[i].SynchronizeInputActions(controllerRenderList[j].Interactions);
                                    }
                                    catch (ArgumentException e)
                                    {
                                        Debug.LogError($"Controller mappings between {thisProfile.MixedRealityControllerMappings[i].Description} and {controllerMapping.Description} do not match. Error message: {e.Message}");
                                    }
                                    serializedObject.ApplyModifiedProperties();
                                    skip = true;
                                }
                            }

                            if (skip)
                            {
                                continue;
                            }
                        }

                        controllerRenderList.Add(new ControllerRenderProfile(supportedControllerType, handedness, thisProfile.MixedRealityControllerMappings[i].Interactions));

                        string controllerTitle      = thisProfile.MixedRealityControllerMappings[i].Description;
                        var    interactionsProperty = controllerMappingProperty.FindPropertyRelative("interactions");

                        if (useCustomInteractionMappings)
                        {
                            if (horizontalScope != null)
                            {
                                horizontalScope.Dispose(); horizontalScope = null;
                            }

                            GUILayout.Space(24f);

                            using (var verticalScope = new GUILayout.VerticalScope())
                            {
                                using (horizontalScope = new GUILayout.HorizontalScope())
                                {
                                    EditorGUILayout.LabelField(controllerTitle, EditorStyles.boldLabel);

                                    if (GUILayout.Button(ControllerMinusButtonContent, EditorStyles.miniButtonRight, GUILayout.Width(24f)))
                                    {
                                        controllerList.DeleteArrayElementAtIndex(i);
                                        return;
                                    }
                                }

                                EditorGUI.BeginChangeCheck();

                                // Generic Type dropdown
                                Type[] genericTypes           = MixedRealityControllerMappingProfile.CustomControllerMappingTypes;
                                var    genericTypeListContent = new GUIContent[genericTypes.Length];
                                var    genericTypeListIds     = new int[genericTypes.Length];
                                int    currentGenericType     = -1;
                                for (int genericTypeIdx = 0; genericTypeIdx < genericTypes.Length; genericTypeIdx++)
                                {
                                    var attribute = MixedRealityControllerAttribute.Find(genericTypes[genericTypeIdx]);
                                    if (attribute != null)
                                    {
                                        genericTypeListContent[genericTypeIdx] = new GUIContent(attribute.SupportedControllerType.ToString().Replace("Generic", "").ToProperCase() + " Controller");
                                    }
                                    else
                                    {
                                        genericTypeListContent[genericTypeIdx] = new GUIContent("Unknown Controller");
                                    }

                                    genericTypeListIds[genericTypeIdx] = genericTypeIdx;

                                    if (controllerType == genericTypes[genericTypeIdx])
                                    {
                                        currentGenericType = genericTypeIdx;
                                    }
                                }
                                Debug.Assert(currentGenericType != -1);

                                currentGenericType = EditorGUILayout.IntPopup(GenericTypeContent, currentGenericType, genericTypeListContent, genericTypeListIds);
                                controllerType     = genericTypes[currentGenericType];

                                {
                                    // Handedness dropdown
                                    var attribute = MixedRealityControllerAttribute.Find(controllerType);
                                    if (attribute != null && attribute.SupportedHandedness.Length >= 1)
                                    {
                                        // Make sure handedness is valid for the selected controller type.
                                        if (Array.IndexOf(attribute.SupportedHandedness, (Handedness)handednessProperty.intValue) < 0)
                                        {
                                            handednessProperty.intValue = (int)attribute.SupportedHandedness[0];
                                        }

                                        if (attribute.SupportedHandedness.Length >= 2)
                                        {
                                            var handednessListContent = new GUIContent[attribute.SupportedHandedness.Length];
                                            var handednessListIds     = new int[attribute.SupportedHandedness.Length];
                                            for (int handednessIdx = 0; handednessIdx < attribute.SupportedHandedness.Length; handednessIdx++)
                                            {
                                                handednessListContent[handednessIdx] = new GUIContent(attribute.SupportedHandedness[handednessIdx].ToString());
                                                handednessListIds[handednessIdx]     = (int)attribute.SupportedHandedness[handednessIdx];
                                            }

                                            handednessProperty.intValue = EditorGUILayout.IntPopup(HandednessTypeContent, handednessProperty.intValue, handednessListContent, handednessListIds);
                                        }
                                    }
                                    else
                                    {
                                        handednessProperty.intValue = (int)Handedness.None;
                                    }
                                }

                                if (EditorGUI.EndChangeCheck())
                                {
                                    interactionsProperty.ClearArray();
                                    serializedObject.ApplyModifiedProperties();
                                    thisProfile.MixedRealityControllerMappings[i].ControllerType.Type = genericTypes[currentGenericType];
                                    thisProfile.MixedRealityControllerMappings[i].SetDefaultInteractionMapping(true);
                                    serializedObject.ApplyModifiedProperties();
                                    return;
                                }

                                if (InspectorUIUtility.RenderIndentedButton("Edit Input Action Map"))
                                {
                                    ControllerPopupWindow.Show(controllerMapping, interactionsProperty, handedness);
                                }

                                if (InspectorUIUtility.RenderIndentedButton("Reset Input Actions"))
                                {
                                    interactionsProperty.ClearArray();
                                    serializedObject.ApplyModifiedProperties();
                                    thisProfile.MixedRealityControllerMappings[i].SetDefaultInteractionMapping(true);
                                    serializedObject.ApplyModifiedProperties();
                                }
                            }
                        }
                        else
                        {
                            if (handedness != Handedness.Right)
                            {
                                if (horizontalScope != null)
                                {
                                    horizontalScope.Dispose(); horizontalScope = null;
                                }
                                horizontalScope = new GUILayout.HorizontalScope();
                            }

                            var buttonContent = new GUIContent(controllerTitle, ControllerMappingLibrary.GetControllerTextureScaled(controllerType, handedness));

                            if (GUILayout.Button(buttonContent, MixedRealityStylesUtility.ControllerButtonStyle, GUILayout.Height(128f), GUILayout.MinWidth(32f), GUILayout.ExpandWidth(true)))
                            {
                                ControllerMappingSignature buttonSignature = new ControllerMappingSignature(supportedControllerType, handedness);
                                ControllerPopupWindow.Show(controllerMapping, interactionsProperty, handedness, controllersAffectedByMappingSignatures[buttonSignature]);
                            }
                        }
                    }

                    if (horizontalScope != null)
                    {
                        horizontalScope.Dispose(); horizontalScope = null;
                    }
                }
            }
        }
        private void RenderControllerList(SerializedProperty controllerList)
        {
            if (thisProfile.MixedRealityControllerMappingProfiles.Length != controllerList.arraySize)
            {
                return;
            }

            EditorGUILayout.Space();

            if (GUILayout.Button(ControllerAddButtonContent, EditorStyles.miniButton))
            {
                AddController(controllerList, typeof(GenericJoystickController));
                return;
            }

            bool reset = false;

            if (controllerRenderList.Count > 0)
            {
                for (var type = 1; type <= (int)SupportedControllerType.Mouse; type++)
                {
                    if (controllerRenderList.All(profile => profile.ControllerType != (SupportedControllerType)type))
                    {
                        if ((SupportedControllerType)type == SupportedControllerType.TouchScreen)
                        {
                            AddController(controllerList, typeof(UnityTouchController));
                            reset = true;
                        }

                        if ((SupportedControllerType)type == SupportedControllerType.Mouse)
                        {
                            AddController(controllerList, typeof(MouseController));
                            reset = true;
                        }
                    }
                }
            }

            controllerRenderList.Clear();
            if (reset)
            {
                return;
            }

            GUILayout.Space(12f);
            GUILayout.BeginVertical();

            for (int i = 0; i < controllerList.arraySize; i++)
            {
                var controllerType                = thisProfile.MixedRealityControllerMappingProfiles[i].ControllerType.Type;
                var supportedControllerType       = SupportedControllerType.None;
                var mixedRealityControllerMapping = controllerList.GetArrayElementAtIndex(i);
                var controllerHandedness          = mixedRealityControllerMapping.FindPropertyRelative("handedness");
                var handedness                   = (Handedness)controllerHandedness.intValue;
                var interactionsList             = mixedRealityControllerMapping.FindPropertyRelative("interactions");
                var useCustomInteractionMappings = mixedRealityControllerMapping.FindPropertyRelative("useCustomInteractionMappings");

                if (controllerType == typeof(XboxController))
                {
                    supportedControllerType = SupportedControllerType.Xbox;
                }
                else if (controllerType == typeof(WindowsMixedRealityController) ||
                         controllerType == typeof(WindowsMixedRealityOpenVRMotionController))
                {
                    supportedControllerType = SupportedControllerType.WindowsMixedReality;
                }
                else if (controllerType == typeof(OculusTouchController))
                {
                    supportedControllerType = SupportedControllerType.OculusTouch;
                }
                else if (controllerType == typeof(OculusRemoteController))
                {
                    supportedControllerType = SupportedControllerType.OculusRemote;
                }
                else if (controllerType == typeof(ViveWandController))
                {
                    supportedControllerType = SupportedControllerType.ViveWand;
                }
                else if (controllerType == typeof(GenericOpenVRController))
                {
                    supportedControllerType = SupportedControllerType.GenericOpenVR;
                }
                else if (controllerType == typeof(GenericJoystickController))
                {
                    supportedControllerType = SupportedControllerType.GenericUnity;
                }
                else if (controllerType == typeof(UnityTouchController))
                {
                    supportedControllerType = SupportedControllerType.TouchScreen;
                }
                else if (controllerType == typeof(MouseController))
                {
                    supportedControllerType = SupportedControllerType.Mouse;
                }

                bool skip = false;

                for (int j = 0; j < controllerRenderList.Count; j++)
                {
                    if (supportedControllerType == SupportedControllerType.GenericOpenVR ||
                        supportedControllerType == SupportedControllerType.GenericUnity)
                    {
                        continue;
                    }

                    if (controllerRenderList[j].ControllerType == supportedControllerType &&
                        controllerRenderList[j].Handedness == handedness)
                    {
                        thisProfile.MixedRealityControllerMappingProfiles[i].SynchronizeInputActions(controllerRenderList[j].Interactions);
                        serializedObject.ApplyModifiedProperties();
                        skip = true;
                    }
                }

                if (skip)
                {
                    continue;
                }

                controllerRenderList.Add(new ControllerRenderProfile(supportedControllerType, handedness, thisProfile.MixedRealityControllerMappingProfiles[i].Interactions));

                var handednessTitleText = handedness != Handedness.None ? $"{handedness} Hand " : string.Empty;
                var controllerTitle     = $"{supportedControllerType.ToString().ToProperCase()} {handednessTitleText}Controller";

                if (useCustomInteractionMappings.boolValue)
                {
                    GUILayout.Space(24f);

                    EditorGUILayout.BeginVertical();
                    EditorGUILayout.BeginHorizontal();

                    EditorGUIUtility.labelWidth = 64f;
                    EditorGUIUtility.fieldWidth = 64f;
                    EditorGUILayout.LabelField(controllerTitle);
                    EditorGUIUtility.fieldWidth = defaultFieldWidth;
                    EditorGUIUtility.labelWidth = defaultLabelWidth;

                    if (GUILayout.Button(ControllerMinusButtonContent, EditorStyles.miniButtonRight, GUILayout.Width(24f)))
                    {
                        controllerList.DeleteArrayElementAtIndex(i);
                        EditorGUILayout.EndHorizontal();
                        GUILayout.EndVertical();
                        return;
                    }

                    EditorGUILayout.EndHorizontal();
                    EditorGUI.indentLevel++;

                    EditorGUIUtility.labelWidth = 128f;
                    EditorGUIUtility.fieldWidth = 64f;

                    EditorGUI.BeginChangeCheck();

                    int currentGenericType = -1;

                    if (controllerType == typeof(GenericJoystickController))
                    {
                        currentGenericType = 0;
                    }

                    if (controllerType == typeof(GenericOpenVRController))
                    {
                        currentGenericType = 1;
                    }

                    Debug.Assert(currentGenericType != -1);

                    currentGenericType = EditorGUILayout.IntPopup(GenericTypeContent, currentGenericType, GenericTypeListContent, GenericTypeIds);

                    if (controllerType != typeof(GenericJoystickController))
                    {
                        EditorGUILayout.PropertyField(controllerHandedness);
                    }

                    if (EditorGUI.EndChangeCheck())
                    {
                        switch (currentGenericType)
                        {
                        case 0:
                            controllerType = typeof(GenericJoystickController);
                            controllerHandedness.intValue = 0;
                            break;

                        case 1:
                            controllerType = typeof(GenericOpenVRController);
                            break;
                        }

                        interactionsList.ClearArray();
                        serializedObject.ApplyModifiedProperties();
                        thisProfile.MixedRealityControllerMappingProfiles[i].ControllerType.Type = controllerType;
                        GUILayout.EndVertical();
                        return;
                    }

                    if (interactionsList.arraySize == 0 && controllerType == typeof(GenericOpenVRController))
                    {
                        thisProfile.MixedRealityControllerMappingProfiles[i].SetDefaultInteractionMapping(true);
                        serializedObject.ApplyModifiedProperties();
                    }

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

                    EditorGUI.indentLevel--;

                    if (GUILayout.Button("Edit Input Action Map"))
                    {
                        ControllerPopupWindow.Show(supportedControllerType, interactionsList, (Handedness)controllerHandedness.intValue);
                    }

                    if (GUILayout.Button("Reset Input Actions"))
                    {
                        interactionsList.ClearArray();
                        serializedObject.ApplyModifiedProperties();
                        thisProfile.MixedRealityControllerMappingProfiles[i].SetDefaultInteractionMapping(true);
                        serializedObject.ApplyModifiedProperties();
                    }

                    EditorGUILayout.EndVertical();
                }
                else
                {
                    if (supportedControllerType == SupportedControllerType.WindowsMixedReality &&
                        handedness == Handedness.None)
                    {
                        controllerTitle = "HoloLens Gestures";
                    }

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

                    var buttonContent = new GUIContent(controllerTitle, ControllerMappingLibrary.GetControllerTextureScaled(supportedControllerType, handedness));

                    if (GUILayout.Button(buttonContent, controllerButtonStyle, GUILayout.Height(128f), GUILayout.MinWidth(32f), GUILayout.ExpandWidth(true)))
                    {
                        ControllerPopupWindow.Show(supportedControllerType, interactionsList, (Handedness)controllerHandedness.intValue);
                    }

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

                GUILayout.Space(8f);
            }

            GUILayout.EndVertical();
        }
Esempio n. 7
0
        public override void OnInspectorGUI()
        {
            MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();

            if (thisProfile.ParentProfile != null &&
                GUILayout.Button("Back to controller mapping list"))
            {
                Selection.activeObject = thisProfile.ParentProfile;
            }

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

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

            controllerMappingProfile.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 = controllerMappingProfile.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)
                    {
                        controllerMappingProfile.ControllerMappings[i].SynchronizeInputActions(controllerItems[j].Interactions);
                        serializedObject.ApplyModifiedProperties();
                        skip = true;
                    }
                }

                if (skip)
                {
                    continue;
                }

                controllerItems.Add(new ControllerItem(supportedControllerType, handedness, controllerMappingProfile.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(controllerMappingProfile, supportedControllerType, handedness));

                if (GUILayout.Button(buttonContent, controllerButtonStyle, GUILayout.Height(128f), GUILayout.MinWidth(32f), GUILayout.ExpandWidth(true)))
                {
                    serializedObject.ApplyModifiedProperties();
                    EditorApplication.delayCall += () => ControllerPopupWindow.Show(controllerMappingProfile, controllerMappingProfile.ControllerType, interactions, handedness, MixedRealityPreferences.LockProfiles && !thisProfile.IsCustomProfile);
                }

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

            GUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 8
0
        /// <summary>
        /// Shows the controller pop out window using the provided profile and serialized interaction mapping property
        /// </summary>
        /// <param name="profile"></param>
        /// <param name="interactionMappingProfiles"></param>
        public static void Show(MixedRealityControllerMappingProfile profile, SerializedProperty interactionMappingProfiles)
        {
            var handednessTitleText = profile.Handedness != Handedness.None ? $"{profile.Handedness} Hand " : string.Empty;

            if (window != null)
            {
                window.Close();
            }

            if (profile.ControllerType?.Type == null)
            {
                Debug.LogError($"No controller type defined for {profile.name}");
                return;
            }

            window = (ControllerPopupWindow)CreateInstance(typeof(ControllerPopupWindow));
            window.currentControllerName = profile.ControllerType?.Type?.Name;

            window.currentControllerName         = profile.ControllerType?.Type?.Name;
            window.titleContent                  = new GUIContent($"{window.currentControllerName} {handednessTitleText}Input Action Assignment");
            window.controllerDataProviderProfile = profile;
            window.currentInteractionProfiles    = interactionMappingProfiles;
            window.currentControllerTexture      = ControllerMappingLibrary.GetControllerTexture(profile);

            isMouseInRects = new bool[interactionMappingProfiles.arraySize];

            var asset = AssetDatabase.LoadAssetAtPath <TextAsset>(EditorWindowOptionsPath);

            if (asset.IsNull())
            {
                var empty = new ControllerInputActionOptions
                {
                    Controllers = new List <ControllerInputActionOption>
                    {
                        new ControllerInputActionOption
                        {
                            Controller          = null,
                            Handedness          = Handedness.None,
                            InputLabelPositions = new[] { new Vector2(0, 0) },
                            IsLabelFlipped      = new [] { false }
                        }
                    }
                };

                File.WriteAllText(Path.GetFullPath(EditorWindowOptionsPath), JsonUtility.ToJson(empty, true));
                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
            }
            else
            {
                controllerInputActionOptions = JsonUtility.FromJson <ControllerInputActionOptions>(asset.text);

                // if the controller option doesn't exist, then make a new one.
                if (!controllerInputActionOptions.Controllers.Any(option => option.Controller == window.currentControllerName && option.Handedness == window.Handedness))
                {
                    var newOption = new ControllerInputActionOption
                    {
                        Controller          = window.currentControllerName,
                        Handedness          = window.Handedness,
                        InputLabelPositions = new Vector2[interactionMappingProfiles.arraySize],
                        IsLabelFlipped      = new bool[interactionMappingProfiles.arraySize]
                    };

                    controllerInputActionOptions.Controllers.Add(newOption);
                }

                window.currentControllerOption = controllerInputActionOptions.Controllers.FirstOrDefault(option => option.Controller == window.currentControllerName && option.Handedness == window.Handedness);

                if (window.currentControllerOption.IsLabelFlipped == null)
                {
                    window.currentControllerOption.IsLabelFlipped = new bool[interactionMappingProfiles.arraySize];
                }

                if (window.currentControllerOption.InputLabelPositions == null)
                {
                    window.currentControllerOption.InputLabelPositions = new Vector2[interactionMappingProfiles.arraySize];
                }
            }

            var windowSize = new Vector2(window.IsCustomController || window.currentControllerTexture == null ? 896f : 768f, 512f);

            window.ShowUtility();
            window.maxSize = windowSize;
            window.minSize = windowSize;
            window.CenterOnMainWin();
        }
Esempio n. 9
0
        public static void Show(BaseMixedRealityControllerMappingProfile profile, SupportedControllerType controllerType, SerializedProperty interactionsList, Handedness handedness = Handedness.None, bool isLocked = false)
        {
            var handednessTitleText = handedness != Handedness.None ? $"{handedness} Hand " : string.Empty;

            if (window != null)
            {
                window.Close();
            }

            window = (ControllerPopupWindow)CreateInstance(typeof(ControllerPopupWindow));
            window.titleContent             = new GUIContent($"{controllerType} {handednessTitleText}Input Action Assignment");
            window.isLocked                 = isLocked;
            window.mappingProfile           = profile;
            window.currentHandedness        = handedness;
            window.currentControllerType    = controllerType;
            window.currentInteractionList   = interactionsList;
            window.currentControllerTexture = ControllerMappingLibrary.GetControllerTexture(profile, controllerType, handedness);

            isMouseInRects = new bool[interactionsList.arraySize];

            var asset = AssetDatabase.LoadAssetAtPath <TextAsset>(EditorWindowOptionsPath);

            if (asset == null)
            {
                var empty = new ControllerInputActionOptions
                {
                    Controllers = new List <ControllerInputActionOption>
                    {
                        new ControllerInputActionOption
                        {
                            Controller          = SupportedControllerType.None,
                            Handedness          = Handedness.None,
                            InputLabelPositions = new[] { new Vector2(0, 0) },
                            IsLabelFlipped      = new [] { false }
                        }
                    }
                };

                File.WriteAllText(Path.GetFullPath(EditorWindowOptionsPath), JsonUtility.ToJson(empty, true));
                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
            }
            else
            {
                controllerInputActionOptions = JsonUtility.FromJson <ControllerInputActionOptions>(asset.text);

                if (controllerInputActionOptions.Controllers.Any(option => option.Controller == controllerType && option.Handedness == handedness))
                {
                    window.currentControllerOption = controllerInputActionOptions.Controllers.FirstOrDefault(option => option.Controller == controllerType && option.Handedness == handedness);

                    if (window.currentControllerOption.IsLabelFlipped == null)
                    {
                        window.currentControllerOption.IsLabelFlipped = new bool[interactionsList.arraySize];
                    }

                    if (window.currentControllerOption.InputLabelPositions == null)
                    {
                        window.currentControllerOption.InputLabelPositions = new Vector2[interactionsList.arraySize];
                    }
                }
            }

            var windowSize = new Vector2(window.IsCustomController || window.currentControllerTexture == null ? 896f : 768f, 512f);

            window.ShowUtility();
            window.maxSize = windowSize;
            window.minSize = windowSize;
            window.CenterOnMainWin();
            defaultLabelWidth = EditorGUIUtility.labelWidth;
            defaultFieldWidth = EditorGUIUtility.fieldWidth;
        }
Esempio n. 10
0
        private void OnFocus()
        {
            if (window == null)
            {
                Close();
            }

            currentControllerTexture = ControllerMappingLibrary.GetControllerTexture(mappingProfile, currentControllerType, currentHandedness);
            inputSystemProfile       = mappingProfile.ParentProfile.ParentProfile as MixedRealityInputSystemProfile;

            if (inputSystemProfile == null)
            {
                Debug.LogWarning("No Input System Profile found. Be sure to assign this mapping profile to an input system.");
                return;
            }

            #region Interaction Constraint Setup

            actionIds = inputSystemProfile.InputActionsProfile.InputActions
                        .Select(action => (int)action.Id)
                        .Prepend(0).ToArray();

            axisLabels = ControllerMappingLibrary.UnityInputManagerAxes
                         .Select(axis => new GUIContent(axis.Name))
                         .Prepend(new GUIContent(ControllerMappingLibrary.MouseScroll))
                         .Prepend(new GUIContent(ControllerMappingLibrary.MouseY))
                         .Prepend(new GUIContent(ControllerMappingLibrary.MouseX))
                         .Prepend(new GUIContent(ControllerMappingLibrary.Vertical))
                         .Prepend(new GUIContent(ControllerMappingLibrary.Horizontal))
                         .Prepend(new GUIContent("None")).ToArray();

            actionIds = inputSystemProfile.InputActionsProfile.InputActions
                        .Where(inputAction => inputAction.AxisConstraint == AxisType.None)
                        .Select(action => (int)action.Id)
                        .Prepend(0).ToArray();

            actionLabels = inputSystemProfile.InputActionsProfile.InputActions
                           .Where(inputAction => inputAction.AxisConstraint == AxisType.None)
                           .Select(inputAction => new GUIContent(inputAction.Description))
                           .Prepend(new GUIContent("None")).ToArray();

            rawActionIds = inputSystemProfile.InputActionsProfile.InputActions
                           .Where(inputAction => inputAction.AxisConstraint == AxisType.Raw)
                           .Select(action => (int)action.Id)
                           .Prepend(0).ToArray();

            rawActionLabels = inputSystemProfile.InputActionsProfile.InputActions
                              .Where(inputAction => inputAction.AxisConstraint == AxisType.Raw)
                              .Select(inputAction => new GUIContent(inputAction.Description))
                              .Prepend(new GUIContent("None")).ToArray();

            digitalActionIds = inputSystemProfile.InputActionsProfile.InputActions
                               .Where(inputAction => inputAction.AxisConstraint == AxisType.Digital)
                               .Select(action => (int)action.Id)
                               .Prepend(0).ToArray();

            digitalActionLabels = inputSystemProfile.InputActionsProfile.InputActions
                                  .Where(inputAction => inputAction.AxisConstraint == AxisType.Digital)
                                  .Select(inputAction => new GUIContent(inputAction.Description))
                                  .Prepend(new GUIContent("None")).ToArray();

            singleAxisActionIds = inputSystemProfile.InputActionsProfile.InputActions
                                  .Where(inputAction => inputAction.AxisConstraint == AxisType.SingleAxis)
                                  .Select(action => (int)action.Id)
                                  .Prepend(0).ToArray();

            singleAxisActionLabels = inputSystemProfile.InputActionsProfile.InputActions
                                     .Where(inputAction => inputAction.AxisConstraint == AxisType.SingleAxis)
                                     .Select(inputAction => new GUIContent(inputAction.Description))
                                     .Prepend(new GUIContent("None")).ToArray();

            dualAxisActionIds = inputSystemProfile.InputActionsProfile.InputActions
                                .Where(inputAction => inputAction.AxisConstraint == AxisType.DualAxis)
                                .Select(action => (int)action.Id).Prepend(0).ToArray();

            dualAxisActionLabels = inputSystemProfile.InputActionsProfile.InputActions
                                   .Where(inputAction => inputAction.AxisConstraint == AxisType.DualAxis)
                                   .Select(inputAction => new GUIContent(inputAction.Description))
                                   .Prepend(new GUIContent("None")).ToArray();

            threeDofPositionActionIds = inputSystemProfile.InputActionsProfile.InputActions
                                        .Where(inputAction => inputAction.AxisConstraint == AxisType.ThreeDofPosition)
                                        .Select(action => (int)action.Id)
                                        .Prepend(0).ToArray();

            threeDofPositionActionLabels = inputSystemProfile.InputActionsProfile.InputActions
                                           .Where(inputAction => inputAction.AxisConstraint == AxisType.ThreeDofPosition)
                                           .Select(inputAction => new GUIContent(inputAction.Description))
                                           .Prepend(new GUIContent("None")).ToArray();

            threeDofRotationActionIds = inputSystemProfile.InputActionsProfile.InputActions
                                        .Where(inputAction => inputAction.AxisConstraint == AxisType.ThreeDofRotation)
                                        .Select(action => (int)action.Id)
                                        .Prepend(0).ToArray();

            threeDofRotationActionLabels = inputSystemProfile.InputActionsProfile.InputActions
                                           .Where(inputAction => inputAction.AxisConstraint == AxisType.ThreeDofRotation)
                                           .Select(inputAction => new GUIContent(inputAction.Description))
                                           .Prepend(new GUIContent("None")).ToArray();

            sixDofActionIds = inputSystemProfile.InputActionsProfile.InputActions
                              .Where(inputAction => inputAction.AxisConstraint == AxisType.SixDof)
                              .Select(action => (int)action.Id)
                              .Prepend(0).ToArray();

            sixDofActionLabels = inputSystemProfile.InputActionsProfile.InputActions
                                 .Where(inputAction => inputAction.AxisConstraint == AxisType.SixDof)
                                 .Select(inputAction => new GUIContent(inputAction.Description))
                                 .Prepend(new GUIContent("None")).ToArray();

            #endregion  Interaction Constraint Setup
        }