Skip to content

Commit c54048f

Browse files
committed
Replace EnumFlags -> FlagsProperty
1 parent 592e541 commit c54048f

File tree

7 files changed

+21
-29
lines changed

7 files changed

+21
-29
lines changed

org.mixedrealitytoolkit.spatialmanipulation/BoundsControl/BoundsControl.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
// Copyright (c) Mixed Reality Toolkit Contributors
22
// Licensed under the BSD 3-Clause
33

4+
using System;
45
using Unity.Profiling;
6+
using Unity.XR.CoreUtils.GUI;
57
using UnityEngine;
68
using UnityEngine.XR.Interaction.Toolkit;
79
using static MixedReality.Toolkit.SpatialManipulation.ObjectManipulator;
8-
using System;
9-
10-
#if UNITY_EDITOR
11-
using UnityEditor;
12-
#endif
1310

1411
namespace MixedReality.Toolkit.SpatialManipulation
1512
{
@@ -262,8 +259,7 @@ public HandleType EnabledHandles
262259
set => enabledHandles = value;
263260
}
264261

265-
[EnumFlags]
266-
[SerializeField]
262+
[SerializeField, FlagsProperty]
267263
[Tooltip("Specifies whether the rotate handles will rotate the object around its origin, or the center of its calculated bounds.")]
268264
private RotateAnchorType rotateAnchor = RotateAnchorType.BoundsCenter;
269265

@@ -282,8 +278,7 @@ public RotateAnchorType RotateAnchor
282278
}
283279
}
284280

285-
[EnumFlags]
286-
[SerializeField]
281+
[SerializeField, FlagsProperty]
287282
[Tooltip("Specifies whether the scale handles will rotate the object around their opposing corner, or the center of its calculated bounds.")]
288283
private ScaleAnchorType scaleAnchor = ScaleAnchorType.OppositeCorner;
289284

org.mixedrealitytoolkit.spatialmanipulation/Constraints/MoveAxisConstraint.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Mixed Reality Toolkit Contributors
22
// Licensed under the BSD 3-Clause
33

4+
using Unity.XR.CoreUtils.GUI;
45
using UnityEngine;
56

67
namespace MixedReality.Toolkit.SpatialManipulation
@@ -18,8 +19,7 @@ public class MoveAxisConstraint : TransformConstraint
1819
{
1920
#region Properties
2021

21-
[SerializeField]
22-
[EnumFlags]
22+
[SerializeField, FlagsProperty]
2323
[Tooltip("Constrain movement along an axis")]
2424
private AxisFlags constraintOnMovement = 0;
2525

org.mixedrealitytoolkit.spatialmanipulation/Constraints/RotationAxisConstraint.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Mixed Reality Toolkit Contributors
22
// Licensed under the BSD 3-Clause
33

4+
using Unity.XR.CoreUtils.GUI;
45
using UnityEngine;
56

67
namespace MixedReality.Toolkit.SpatialManipulation
@@ -17,8 +18,7 @@ public class RotationAxisConstraint : TransformConstraint
1718
{
1819
#region Properties
1920

20-
[SerializeField]
21-
[EnumFlags]
21+
[SerializeField, FlagsProperty]
2222
[Tooltip("Constrain rotation about an axis")]
2323
private AxisFlags constraintOnRotation = 0;
2424

org.mixedrealitytoolkit.spatialmanipulation/Constraints/TransformConstraint.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Mixed Reality Toolkit Contributors
22
// Licensed under the BSD 3-Clause
33

4-
using System;
4+
using Unity.XR.CoreUtils.GUI;
55
using UnityEngine;
66

77
namespace MixedReality.Toolkit.SpatialManipulation
@@ -17,8 +17,7 @@ public abstract class TransformConstraint : MonoBehaviour
1717
{
1818
#region Properties
1919

20-
[SerializeField]
21-
[EnumFlags]
20+
[SerializeField, FlagsProperty]
2221
[Tooltip("What type of manipulation this constraint applies to. Defaults to One Handed and Two Handed.")]
2322
private ManipulationHandFlags handType = ManipulationHandFlags.OneHanded | ManipulationHandFlags.TwoHanded;
2423

@@ -31,8 +30,7 @@ public ManipulationHandFlags HandType
3130
set => handType = value;
3231
}
3332

34-
[SerializeField]
35-
[EnumFlags]
33+
[SerializeField, FlagsProperty]
3634
[Tooltip("What type of manipulation this constraint applies to. Defaults to Near and Far.")]
3735
private ManipulationProximityFlags proximityType = ManipulationProximityFlags.Near | ManipulationProximityFlags.Far;
3836

org.mixedrealitytoolkit.spatialmanipulation/ObjectManipulator/ObjectManipulator.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using Unity.Profiling;
7+
using Unity.XR.CoreUtils.GUI;
78
using UnityEngine;
89
using UnityEngine.Serialization;
910
using UnityEngine.XR.Interaction.Toolkit;
@@ -135,8 +136,7 @@ public Transform HostTransform
135136
}
136137
}
137138

138-
[SerializeField]
139-
[EnumFlags]
139+
[SerializeField, FlagsProperty]
140140
[Tooltip("What kinds of manipulation should be allowed?")]
141141
private TransformFlags allowedManipulations = TransformFlags.Move | TransformFlags.Rotate | TransformFlags.Scale;
142142

@@ -288,8 +288,7 @@ public RotateAnchorType RotationAnchorFar
288288
set => rotationAnchorFar = value;
289289
}
290290

291-
[SerializeField]
292-
[EnumFlags]
291+
[SerializeField, FlagsProperty]
293292
[Tooltip("Rigid body behavior of the dragged object when releasing it.")]
294293
private ReleaseBehaviorType releaseBehavior = ReleaseBehaviorType.KeepVelocity | ReleaseBehaviorType.KeepAngularVelocity;
295294

org.mixedrealitytoolkit.spatialmanipulation/Solvers/Follow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the BSD 3-Clause
33

44
using Unity.Profiling;
5+
using Unity.XR.CoreUtils.GUI;
56
using UnityEngine;
67
using UnityEngine.Serialization;
78

@@ -69,8 +70,7 @@ public Transform TargetToFace
6970
set => targetToFace = value;
7071
}
7172

72-
[SerializeField]
73-
[EnumFlags]
73+
[SerializeField, FlagsProperty]
7474
[Tooltip("Rotation axes used when facing target.")]
7575
private AxisFlags pivotAxis = AxisFlags.XAxis | AxisFlags.YAxis | AxisFlags.ZAxis;
7676

org.mixedrealitytoolkit.uxcore/Interop/UGUIInputAdapter.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Collections;
55
using System.Collections.Generic;
6+
using Unity.XR.CoreUtils.GUI;
67
using UnityEngine;
78
using UnityEngine.EventSystems;
89
using UnityEngine.UI;
@@ -38,8 +39,7 @@ protected IXRInteractable ThisInteractable
3839
}
3940
}
4041

41-
[SerializeField]
42-
[EnumFlags]
42+
[SerializeField, FlagsProperty]
4343
[Tooltip("Which axes should be used for manipulation instead of navigation?")]
4444
private AxisFlags movableAxes = 0;
4545

@@ -109,9 +109,9 @@ internal protected XRInteractionManager InteractionManager
109109
/// A Unity Editor only event function that is called when the script is loaded or a value changes in the Unity Inspector.
110110
/// </summary>
111111
protected override void OnValidate()
112-
{
112+
{
113113
base.OnValidate();
114-
114+
115115
// Validate that no transition type is set. You shouldn't be using this
116116
// for any sort of UI visuals; use a StatefulInteractable and a
117117
// StateVisualizer instead, even for UI.
@@ -416,7 +416,7 @@ protected IEnumerator Move(Vector3 objectLocalDelta)
416416
}
417417
}
418418
}
419-
419+
420420
/// <summary>
421421
/// Called when the Unity UGUI element is selected.
422422
/// </summary>

0 commit comments

Comments
 (0)