Skip to content

Commit aeecff3

Browse files
authored
Remove HandNode from HandModel (#1045)
* Remove HandNode from HandModel Signed-off-by: Kurtis <[email protected]> * HandNode * Update CHANGELOG.md --------- Signed-off-by: Kurtis <[email protected]>
1 parent 4cfd33c commit aeecff3

File tree

6 files changed

+9
-41
lines changed

6 files changed

+9
-41
lines changed

org.mixedrealitytoolkit.input/Assets/Prefabs/MRTK LeftHand Controller.prefab

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,6 @@ MonoBehaviour:
10931093
modelPrefab: {fileID: 1768293572455847265, guid: 2b468cc4fe6d2b44ebc53b958b38b91a, type: 3}
10941094
modelParent: {fileID: 0}
10951095
model: {fileID: 0}
1096-
handNode: 4
10971096
selectInput:
10981097
m_InputSourceMode: 3
10991098
m_InputActionPerformed:

org.mixedrealitytoolkit.input/Assets/Prefabs/MRTK RightHand Controller.prefab

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,6 @@ PrefabInstance:
291291
propertyPath: managedReferences[5].trackingStateActionProperty.m_Reference
292292
value:
293293
objectReference: {fileID: 3239510804178183174, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
294-
- target: {fileID: 3853158803892222464, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
295-
propertyPath: handNode
296-
value: 5
297-
objectReference: {fileID: 0}
298294
- target: {fileID: 3853158803892222464, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
299295
propertyPath: modelPrefab
300296
value:

org.mixedrealitytoolkit.input/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1818

1919
* Updated the minimum editor version to 2022.3.6f1 [PR #1003](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1003)
2020

21+
### Removed
22+
23+
* Removed HandNode property and field from HandModel, as it was largely unused. [PR #1045](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1045)
24+
2125
### Deprecated
2226

2327
* Deprecated IHandedInteractor across the interactor implementations, as its info is now queryable directly from IXRInteractor's handedness property. [PR #1042](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1042)

org.mixedrealitytoolkit.input/Controllers/HandModel.cs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,44 +23,32 @@ public class HandModel : MonoBehaviour
2323
/// <summary>
2424
/// The prefab of the model to show that will be automatically instantiated by this <see cref="MonoBehaviour"/>.
2525
/// </summary>
26-
/// <remarks>Expected to be XRNode.LeftHand or XRNode.RightHand.</remarks>
2726
public Transform ModelPrefab
2827
{
2928
get => modelPrefab;
3029
set => modelPrefab = value;
3130
}
3231

33-
[SerializeField, Tooltip("The transform that is used as the parent for the model prefab when it is instantiated. Will be set to a new child GameObject if None.")]
32+
[SerializeField, Tooltip("The transform that is used as the parent for the model prefab when it is instantiated. Will be set to a new child GameObject if None.")]
3433
private Transform modelParent;
3534

3635
/// <summary>
37-
/// The <see cref="Transform"/> that is used as the parent for the model prefab when it is instantiated. Will be set to a new child <see cref="GameObject"/> if None.
36+
/// The <see cref="Transform"/> that is used as the parent for the model prefab when it is instantiated. Will be set to a new child <see cref="GameObject"/> if None.
3837
/// </summary>
39-
/// <remarks>Expected to be XRNode.LeftHand or XRNode.RightHand.</remarks>
4038
public Transform ModelParent => modelParent;
4139

42-
[SerializeField, Tooltip("The instance of the controller model in the scene. This can be set to an existing object instead of using Model Prefab.")]
40+
[SerializeField, Tooltip("The instance of the controller model in the scene. This can be set to an existing object instead of using Model Prefab.")]
4341
private Transform model;
4442

4543
/// <summary>
46-
/// The instance of the model in the scene. This can be set to an existing object instead of using Model Prefab.
44+
/// The instance of the model in the scene. This can be set to an existing object instead of using Model Prefab.
4745
/// </summary>
48-
/// <remarks>Expected to be XRNode.LeftHand or XRNode.RightHand.</remarks>
4946
public Transform Model => model;
5047

5148
#endregion Properties
5249

5350
#region Associated hand select values
5451

55-
[SerializeField, Tooltip("The XRNode associated with this Hand Controller. Expected to be XRNode.LeftHand or XRNode.RightHand.")]
56-
private XRNode handNode;
57-
58-
/// <summary>
59-
/// The <see cref="XRNode"/> associated with this Hand Model.
60-
/// </summary>
61-
/// <remarks>Expected to be XRNode.LeftHand or XRNode.RightHand.</remarks>
62-
public XRNode HandNode => handNode;
63-
6452
[SerializeField, Tooltip("The XRInputButtonReader representing selection values to be used by the hand model prefab when implementing ISelectInputVisualizer.")]
6553
private XRInputButtonReader selectInput;
6654

@@ -77,17 +65,12 @@ public Transform ModelPrefab
7765
/// </summary>
7866
protected virtual void Start()
7967
{
80-
if (!HandNode.Equals(XRNode.LeftHand) && !HandNode.Equals(XRNode.RightHand))
81-
{
82-
Debug.LogWarning("HandNode is not set to XRNode.LeftHand or XRNode.RightHand. HandNode is expected to be XRNode.LeftHand or XRNode.RightHand.");
83-
}
84-
8568
// Instantiate the model prefab if it is set
8669
if (ModelPrefab != null)
8770
{
8871
model = Instantiate(ModelPrefab, ModelParent);
8972

90-
Debug.Assert(selectInput != null, $"The Select Input reader for {handNode} is not set and will not be used with the instantiated hand model.");
73+
Debug.Assert(selectInput != null, $"The Select Input reader for {name} is not set and will not be used with the instantiated hand model.");
9174

9275
// Set the select input reader for the model if it implements ISelectInputVisualizer
9376
if (selectInput != null && model != null && model.TryGetComponent(out ISelectInputVisualizer selectInputVisualizer))

org.mixedrealitytoolkit.input/Tests/Runtime/BasicInputTests.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,6 @@ public IEnumerator HandModelHasRequiredFieldsAndAccessors()
626626
var modelFieldInfo = fieldInfos.Where(fieldInfo => fieldInfo.Name.Equals("model")).ToArray();
627627
Assert.AreEqual(1, modelFieldInfo.Length, "HandModel is missing the 'model' field");
628628

629-
var handNodeFieldInfo = fieldInfos.Where(fieldInfo => fieldInfo.Name.Equals("handNode")).ToArray();
630-
Assert.AreEqual(1, modelFieldInfo.Length, "HandModel is missing the 'handNode' field");
631-
632629
var modelPrefabAccessorInfo = accessorsInfos.Where(accessorInfo => accessorInfo.Name.Equals("ModelPrefab")).ToArray();
633630
Assert.AreEqual(1, modelPrefabAccessorInfo.Length, "HandModel is missing the 'ModelPrefab' accessor");
634631

@@ -638,9 +635,6 @@ public IEnumerator HandModelHasRequiredFieldsAndAccessors()
638635
var modelAccessorInfo = accessorsInfos.Where(accessorInfo => accessorInfo.Name.Equals("Model")).ToArray();
639636
Assert.AreEqual(1, modelAccessorInfo.Length, "HandModel is missing the 'Model' accessor");
640637

641-
var handNodeAccessorInfo = accessorsInfos.Where(accessorInfo => accessorInfo.Name.Equals("HandNode")).ToArray();
642-
Assert.AreEqual(1, handNodeAccessorInfo.Length, "HandModel is missing the 'HandNode' accessor");
643-
644638
yield return null;
645639
}
646640

org.mixedrealitytoolkit.input/Tests/Runtime/BasicInputTestsForControllerlessRig.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -464,15 +464,13 @@ public IEnumerator ControllerlessRigSmokeTest()
464464
var leftHandHandModels = leftHandGameObject.GetComponents<HandModel>();
465465
Assert.AreEqual(1, leftHandHandModels.Length);
466466
HandModel leftHandHandModel = leftHandHandModels[0];
467-
Assert.AreEqual(XRNode.LeftHand, leftHandHandModel.HandNode);
468467
Assert.IsTrue(leftHandHandModel.Model.name.Equals(OpenXRLeftHandCloneName));
469468
Assert.AreEqual(leftHandHandModel.ModelParent.transform.parent, leftHandGameObject.transform);
470469
Assert.IsTrue(leftHandHandModel.ModelPrefab.name.Equals(OpenXRLeftHandName));
471470

472471
var rigtHandHandModels = rightHandGameObject.GetComponents<HandModel>();
473472
Assert.AreEqual(1, rigtHandHandModels.Length);
474473
HandModel rightHandHandModel = rigtHandHandModels[0];
475-
Assert.AreEqual(XRNode.RightHand, rightHandHandModel.HandNode);
476474
Assert.IsTrue(rightHandHandModel.Model.name.Equals(OpenXRRightHandCloneName));
477475
Assert.AreEqual(rightHandHandModel.ModelParent.transform.parent, rightHandHandModel.transform);
478476
Assert.IsTrue(rightHandHandModel.ModelPrefab.name.Equals(OpenXRRightHandName));
@@ -963,9 +961,6 @@ public IEnumerator HandModelHasRequiredFieldsAndAccessors()
963961
var modelFieldInfo = fieldInfos.Where(fieldInfo => fieldInfo.Name.Equals("model")).ToArray();
964962
Assert.AreEqual(1, modelFieldInfo.Length, "HandModel is missing the 'model' field");
965963

966-
var handNodeFieldInfo = fieldInfos.Where(fieldInfo => fieldInfo.Name.Equals("handNode")).ToArray();
967-
Assert.AreEqual(1, modelFieldInfo.Length, "HandModel is missing the 'handNode' field");
968-
969964
var modelPrefabAccessorInfo = accessorsInfos.Where(accessorInfo => accessorInfo.Name.Equals("ModelPrefab")).ToArray();
970965
Assert.AreEqual(1, modelPrefabAccessorInfo.Length, "HandModel is missing the 'ModelPrefab' accessor");
971966

@@ -975,9 +970,6 @@ public IEnumerator HandModelHasRequiredFieldsAndAccessors()
975970
var modelAccessorInfo = accessorsInfos.Where(accessorInfo => accessorInfo.Name.Equals("Model")).ToArray();
976971
Assert.AreEqual(1, modelAccessorInfo.Length, "HandModel is missing the 'Model' accessor");
977972

978-
var handNodeAccessorInfo = accessorsInfos.Where(accessorInfo => accessorInfo.Name.Equals("HandNode")).ToArray();
979-
Assert.AreEqual(1, handNodeAccessorInfo.Length, "HandModel is missing the 'HandNode' accessor");
980-
981973
yield return null;
982974
}
983975
}

0 commit comments

Comments
 (0)