Skip to content

Commit 9094341

Browse files
Merge branch 'mrtk_development' into vNEXT-Revolution
# Conflicts: # Assets/MixedRealityToolkit/_Core/Inspectors/Profiles/MixedRealityGesturesProfileInspector.cs
2 parents a5f39d8 + 749dc20 commit 9094341

File tree

5 files changed

+87
-146
lines changed

5 files changed

+87
-146
lines changed

Assets/MixedRealityToolkit-Examples/Demos/Solvers/Prefabs/SolverSwappingVolume.prefab

Lines changed: 2 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,6 @@ GameObject:
6464
m_NavMeshLayer: 0
6565
m_StaticEditorFlags: 0
6666
m_IsActive: 1
67-
--- !u!1 &1806980022041722
68-
GameObject:
69-
m_ObjectHideFlags: 0
70-
m_PrefabParentObject: {fileID: 0}
71-
m_PrefabInternal: {fileID: 100100000}
72-
serializedVersion: 5
73-
m_Component:
74-
- component: {fileID: 4532111562577858}
75-
- component: {fileID: 114537914091800886}
76-
- component: {fileID: 114720463534382782}
77-
- component: {fileID: 33793527096412838}
78-
- component: {fileID: 23348121759550618}
79-
m_Layer: 0
80-
m_Name: ChaseSource
81-
m_TagString: Untagged
82-
m_Icon: {fileID: 0}
83-
m_NavMeshLayer: 0
84-
m_StaticEditorFlags: 0
85-
m_IsActive: 1
8667
--- !u!1 &1859447626459620
8768
GameObject:
8869
m_ObjectHideFlags: 1
@@ -111,7 +92,6 @@ Transform:
11192
m_LocalPosition: {x: -0.5, y: 1.09, z: 1.4}
11293
m_LocalScale: {x: 0.25, y: 0.25, z: 0.25}
11394
m_Children:
114-
- {fileID: 4532111562577858}
11595
- {fileID: 4440517697149476}
11696
m_Father: {fileID: 0}
11797
m_RootOrder: 0
@@ -129,19 +109,6 @@ Transform:
129109
- {fileID: 224604559336910218}
130110
- {fileID: 4790300607699990}
131111
m_Father: {fileID: 4348569316050982}
132-
m_RootOrder: 1
133-
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
134-
--- !u!4 &4532111562577858
135-
Transform:
136-
m_ObjectHideFlags: 1
137-
m_PrefabParentObject: {fileID: 0}
138-
m_PrefabInternal: {fileID: 100100000}
139-
m_GameObject: {fileID: 1806980022041722}
140-
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
141-
m_LocalPosition: {x: 0, y: 0, z: 0}
142-
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
143-
m_Children: []
144-
m_Father: {fileID: 4348569316050982}
145112
m_RootOrder: 0
146113
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
147114
--- !u!4 &4790300607699990
@@ -227,41 +194,6 @@ MeshRenderer:
227194
m_SortingLayerID: 0
228195
m_SortingLayer: 0
229196
m_SortingOrder: 0
230-
--- !u!23 &23348121759550618
231-
MeshRenderer:
232-
m_ObjectHideFlags: 1
233-
m_PrefabParentObject: {fileID: 0}
234-
m_PrefabInternal: {fileID: 100100000}
235-
m_GameObject: {fileID: 1806980022041722}
236-
m_Enabled: 1
237-
m_CastShadows: 1
238-
m_ReceiveShadows: 1
239-
m_DynamicOccludee: 1
240-
m_MotionVectors: 1
241-
m_LightProbeUsage: 1
242-
m_ReflectionProbeUsage: 1
243-
m_RenderingLayerMask: 4294967295
244-
m_Materials:
245-
- {fileID: 2100000, guid: c4a1b7475a654dd0acaa0cfdfba2e20c, type: 2}
246-
m_StaticBatchInfo:
247-
firstSubMesh: 0
248-
subMeshCount: 0
249-
m_StaticBatchRoot: {fileID: 0}
250-
m_ProbeAnchor: {fileID: 0}
251-
m_LightProbeVolumeOverride: {fileID: 0}
252-
m_ScaleInLightmap: 1
253-
m_PreserveUVs: 0
254-
m_IgnoreNormalsForChartDetection: 0
255-
m_ImportantGI: 0
256-
m_StitchLightmapSeams: 0
257-
m_SelectedEditorRenderState: 3
258-
m_MinimumChartSize: 4
259-
m_AutoUVMaxDistance: 0.5
260-
m_AutoUVMaxAngle: 89
261-
m_LightmapParameters: {fileID: 0}
262-
m_SortingLayerID: 0
263-
m_SortingLayer: 0
264-
m_SortingOrder: 0
265197
--- !u!33 &33043184315017164
266198
MeshFilter:
267199
m_ObjectHideFlags: 1
@@ -276,13 +208,6 @@ MeshFilter:
276208
m_PrefabInternal: {fileID: 100100000}
277209
m_GameObject: {fileID: 1687025458477342}
278210
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
279-
--- !u!33 &33793527096412838
280-
MeshFilter:
281-
m_ObjectHideFlags: 1
282-
m_PrefabParentObject: {fileID: 0}
283-
m_PrefabInternal: {fileID: 100100000}
284-
m_GameObject: {fileID: 1806980022041722}
285-
m_Mesh: {fileID: 4300000, guid: 841b5755ac02dbc439bd347f414de999, type: 3}
286211
--- !u!54 &54233848105879872
287212
Rigidbody:
288213
m_ObjectHideFlags: 1
@@ -354,55 +279,9 @@ MonoBehaviour:
354279
m_Script: {fileID: 11500000, guid: edea428b5e02f9144b45b9fbd5ba5278, type: 3}
355280
m_Name:
356281
m_EditorClassIdentifier:
357-
hideThisObject: {fileID: 1806980022041722}
358-
spawnThisPrefab: {fileID: 1307245229378308, guid: de99acdc648a6d945ba138103ed87328,
359-
type: 2}
282+
hideThisObject: {fileID: 0}
283+
spawnThisPrefab: {fileID: 0}
360284
updateSolverTargetToClickSource: 1
361-
--- !u!114 &114537914091800886
362-
MonoBehaviour:
363-
m_ObjectHideFlags: 1
364-
m_PrefabParentObject: {fileID: 0}
365-
m_PrefabInternal: {fileID: 100100000}
366-
m_GameObject: {fileID: 1806980022041722}
367-
m_Enabled: 0
368-
m_EditorHideFlags: 0
369-
m_Script: {fileID: 11500000, guid: b55691ad5b034fe6966763a6e23818d2, type: 3}
370-
m_Name:
371-
m_EditorClassIdentifier:
372-
handedness: 1
373-
trackedObjectToReference: 2
374-
additionalOffset: {x: 0, y: 0, z: 0}
375-
additionalRotation: {x: 0, y: 0, z: 0}
376-
transformTarget: {fileID: 0}
377-
updateSolvers: 1
378-
--- !u!114 &114720463534382782
379-
MonoBehaviour:
380-
m_ObjectHideFlags: 1
381-
m_PrefabParentObject: {fileID: 0}
382-
m_PrefabInternal: {fileID: 100100000}
383-
m_GameObject: {fileID: 1806980022041722}
384-
m_Enabled: 0
385-
m_EditorHideFlags: 0
386-
m_Script: {fileID: 11500000, guid: 4684083f6dff4a1d8a790bccc354fcf4, type: 3}
387-
m_Name:
388-
m_EditorClassIdentifier:
389-
updateLinkedTransform: 0
390-
moveLerpTime: 0.1
391-
rotateLerpTime: 0.1
392-
scaleLerpTime: 0
393-
maintainScale: 1
394-
smoothing: 1
395-
lifetime: 0
396-
SolverHandler: {fileID: 114537914091800886}
397-
referenceDirection: 0
398-
minDistance: 0.1
399-
maxDistance: 0.1
400-
minViewDegrees: 0
401-
maxViewDegrees: 0
402-
aspectV: 1
403-
ignoreAngleClamp: 0
404-
ignoreDistanceClamp: 0
405-
orientToReferenceDirection: 0
406285
--- !u!135 &135082391517649018
407286
SphereCollider:
408287
m_ObjectHideFlags: 1

Assets/MixedRealityToolkit/_Core/Inspectors/Profiles/MixedRealityGesturesProfileInspector.cs

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

44
using Microsoft.MixedReality.Toolkit.Core.Definitions;
5+
using Microsoft.MixedReality.Toolkit.Core.Definitions.Devices;
56
using Microsoft.MixedReality.Toolkit.Core.Definitions.InputSystem;
67
using Microsoft.MixedReality.Toolkit.Core.Services;
8+
using System;
9+
using System.Collections.Generic;
710
using System.Linq;
811
using UnityEditor;
912
using UnityEngine;
@@ -19,16 +22,19 @@ public class MixedRealityGesturesProfileInspector : MixedRealityBaseConfiguratio
1922
private static readonly GUIContent GestureTypeContent = new GUIContent("Gesture Type", "The type of Gesture that will trigger the action.");
2023
private static readonly GUIContent ActionContent = new GUIContent("Action", "The action to trigger when a Gesture is recognized.");
2124

22-
private static GUIContent[] actionLabels;
23-
private static int[] actionIds;
24-
2525
private SerializedProperty gestures;
2626
private SerializedProperty windowsManipulationGestureSettings;
2727
private SerializedProperty useRailsNavigation;
2828
private SerializedProperty windowsNavigationGestureSettings;
2929
private SerializedProperty windowsRailsNavigationGestures;
3030
private SerializedProperty windowsGestureAutoStart;
3131

32+
private MixedRealityGesturesProfile thisProfile;
33+
private static GUIContent[] allGestureLabels;
34+
private static int[] allGestureIds;
35+
private static GUIContent[] actionLabels;
36+
private static int[] actionIds;
37+
3238
private void OnEnable()
3339
{
3440
if (!CheckMixedRealityConfigured(false)) { return; }
@@ -39,13 +45,42 @@ private void OnEnable()
3945
windowsNavigationGestureSettings = serializedObject.FindProperty("navigationGestures");
4046
windowsRailsNavigationGestures = serializedObject.FindProperty("railsNavigationGestures");
4147
windowsGestureAutoStart = serializedObject.FindProperty("windowsGestureAutoStart");
48+
thisProfile = target as MixedRealityGesturesProfile;
49+
Debug.Assert(thisProfile != null);
4250

4351
if (MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled &&
4452
MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile != null)
4553
{
46-
actionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions.Select(action => new GUIContent(action.Description)).Prepend(new GUIContent("None")).ToArray();
47-
actionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions.Select(action => (int)action.Id).Prepend(0).ToArray();
54+
actionLabels = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
55+
.Select(action => new GUIContent(action.Description))
56+
.Prepend(new GUIContent("None")).ToArray();
57+
actionIds = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions
58+
.Select(action => (int)action.Id)
59+
.Prepend(0).ToArray();
60+
}
61+
62+
UpdateGestureLabels();
63+
}
64+
65+
private void UpdateGestureLabels()
66+
{
67+
var allGestureTypeNames = Enum.GetNames(typeof(GestureInputType));
68+
69+
var tempIds = new List<int>();
70+
var tempContent = new List<GUIContent>();
71+
72+
for (int i = 0; i < allGestureTypeNames.Length; i++)
73+
{
74+
if (allGestureTypeNames[i].Equals("None") ||
75+
thisProfile.Gestures.All(mapping => !allGestureTypeNames[i].Equals(mapping.GestureType.ToString())))
76+
{
77+
tempContent.Add(new GUIContent(allGestureTypeNames[i]));
78+
tempIds.Add(i);
79+
}
4880
}
81+
82+
allGestureIds = tempIds.ToArray();
83+
allGestureLabels = tempContent.ToArray();
4984
}
5085

5186
public override void OnInspectorGUI()
@@ -101,7 +136,7 @@ public override void OnInspectorGUI()
101136
serializedObject.ApplyModifiedProperties();
102137
}
103138

104-
private static void RenderList(SerializedProperty list)
139+
private void RenderList(SerializedProperty list)
105140
{
106141
EditorGUILayout.Space();
107142
GUILayout.BeginVertical();
@@ -112,8 +147,8 @@ private static void RenderList(SerializedProperty list)
112147
var speechCommand = list.GetArrayElementAtIndex(list.arraySize - 1);
113148
var keyword = speechCommand.FindPropertyRelative("description");
114149
keyword.stringValue = string.Empty;
115-
var keyCode = speechCommand.FindPropertyRelative("gestureType");
116-
keyCode.intValue = (int)KeyCode.None;
150+
var gestureType = speechCommand.FindPropertyRelative("gestureType");
151+
gestureType.intValue = (int)GestureInputType.None;
117152
var action = speechCommand.FindPropertyRelative("action");
118153
var actionId = action.FindPropertyRelative("id");
119154
actionId.intValue = 0;
@@ -129,6 +164,7 @@ private static void RenderList(SerializedProperty list)
129164
{
130165
EditorGUILayout.HelpBox("Define a new Gesture.", MessageType.Warning);
131166
GUILayout.EndVertical();
167+
UpdateGestureLabels();
132168
return;
133169
}
134170

@@ -149,14 +185,37 @@ private static void RenderList(SerializedProperty list)
149185
EditorGUILayout.BeginHorizontal();
150186
SerializedProperty gesture = list.GetArrayElementAtIndex(i);
151187
var keyword = gesture.FindPropertyRelative("description");
152-
EditorGUILayout.PropertyField(keyword, GUIContent.none, GUILayout.ExpandWidth(true));
153188
var gestureType = gesture.FindPropertyRelative("gestureType");
154-
EditorGUILayout.PropertyField(gestureType, GUIContent.none, GUILayout.Width(80f));
155189
var action = gesture.FindPropertyRelative("action");
156190
var actionId = action.FindPropertyRelative("id");
157191
var actionDescription = action.FindPropertyRelative("description");
158192
var actionConstraint = action.FindPropertyRelative("axisConstraint");
159193

194+
EditorGUILayout.PropertyField(keyword, GUIContent.none, GUILayout.ExpandWidth(true));
195+
196+
Debug.Assert(allGestureLabels.Length == allGestureIds.Length);
197+
198+
var gestureLabels = new GUIContent[allGestureLabels.Length + 1];
199+
var gestureIds = new int[allGestureIds.Length + 1];
200+
201+
gestureLabels[0] = new GUIContent(((GestureInputType)gestureType.intValue).ToString());
202+
gestureIds[0] = gestureType.intValue;
203+
204+
for (int j = 0; j < allGestureLabels.Length; j++)
205+
{
206+
gestureLabels[j + 1] = allGestureLabels[j];
207+
gestureIds[j + 1] = allGestureIds[j];
208+
}
209+
210+
EditorGUI.BeginChangeCheck();
211+
gestureType.intValue = EditorGUILayout.IntPopup(GUIContent.none, gestureType.intValue, gestureLabels, gestureIds, GUILayout.Width(80f));
212+
213+
if (EditorGUI.EndChangeCheck())
214+
{
215+
serializedObject.ApplyModifiedProperties();
216+
UpdateGestureLabels();
217+
}
218+
160219
EditorGUI.BeginChangeCheck();
161220
actionId.intValue = EditorGUILayout.IntPopup(GUIContent.none, actionId.intValue, actionLabels, actionIds, GUILayout.Width(64f));
162221

@@ -165,11 +224,14 @@ private static void RenderList(SerializedProperty list)
165224
MixedRealityInputAction inputAction = actionId.intValue == 0 ? MixedRealityInputAction.None : MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions[actionId.intValue - 1];
166225
actionDescription.stringValue = inputAction.Description;
167226
actionConstraint.enumValueIndex = (int)inputAction.AxisConstraint;
227+
serializedObject.ApplyModifiedProperties();
168228
}
169229

170230
if (GUILayout.Button(MinusButtonContent, EditorStyles.miniButtonRight, GUILayout.Width(24f)))
171231
{
172232
list.DeleteArrayElementAtIndex(i);
233+
serializedObject.ApplyModifiedProperties();
234+
UpdateGestureLabels();
173235
}
174236

175237
EditorGUILayout.EndHorizontal();

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ For larger submissions, we have drafted contribution guidelines to ensure a smoo
66

77
All changes be they small or large, need to adhere to the [MRTK Coding Standards](/CodingGuidelines.md), so please ensure you are familiar with these while developing to avoid delays when the change is being reviewed.
88

9-
If you have any questions, please reach out on the [HoloLens forums](https://forums.hololens.com/) or the [HoloDevelopers slack](https://holodevelopers.slack.com/).
9+
If you have any questions, please reach out on the [HoloLens forums](https://forums.hololens.com/) or the [HoloDevelopers slack](https://holodevelopers.slack.com/). You can easily be granted access to the Slack community via the [automatic invitation sender](https://holodevelopersslack.azurewebsites.net/).
1010

1111
# Submission process
1212
We provide several paths to enable developers to contribute to the Mixed Reality Toolkit, all starting with [creating a new Issue](https://github.com/Microsoft/MixedRealityToolkit-Unity/issues/new/choose)

0 commit comments

Comments
 (0)