Skip to content

Commit 74bbc6d

Browse files
committed
add(BoundingBoxRig) Public Properties to enable dynamic component assign
Currently BoundingBox missing several public properties for private SerializedField fields. This cause user could not modify component when dynamically add component from Script. This commit open these parameters modifiable.
1 parent 50eb526 commit 74bbc6d

File tree

1 file changed

+133
-52
lines changed

1 file changed

+133
-52
lines changed

Assets/HoloToolkit/UX/Scripts/BoundingBoxes/BoundingBoxRig.cs

Lines changed: 133 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,177 @@ public class BoundingBoxRig : MonoBehaviour
1717
[Tooltip("Choose this option if Rig is to be applied to a 2D object.")]
1818
private BoundingBox.FlattenModeEnum flattenedAxis = default(BoundingBox.FlattenModeEnum);
1919

20+
public BoundingBox.FlattenModeEnum FlattenedAxis
21+
{
22+
get
23+
{
24+
return flattenedAxis;
25+
}
26+
set
27+
{
28+
flattenedAxis = value;
29+
}
30+
}
31+
2032
[Header("Customization Settings")]
2133
[SerializeField]
2234
private Material scaleHandleMaterial;
35+
public Material ScaleHandleMaterial
36+
{
37+
get
38+
{
39+
return scaleHandleMaterial;
40+
}
41+
set
42+
{
43+
scaleHandleMaterial = value;
44+
}
45+
}
2346

2447
[SerializeField]
2548
private Material rotateHandleMaterial;
49+
public Material RotateHandleMaterial
50+
{
51+
get
52+
{
53+
return rotateHandleMaterial;
54+
}
55+
set
56+
{
57+
rotateHandleMaterial = value;
58+
}
59+
}
2660

2761
[SerializeField]
2862
private Material interactingMaterial;
63+
public Material InteractingMaterial
64+
{
65+
get
66+
{
67+
return interactingMaterial;
68+
}
69+
set
70+
{
71+
interactingMaterial = value;
72+
}
73+
}
2974

3075
[Header("Behavior")]
3176
[SerializeField]
3277
private float scaleRate = 1.0f;
78+
public float ScaleRate
79+
{
80+
get
81+
{
82+
return scaleRate;
83+
}
84+
set
85+
{
86+
scaleRate = value;
87+
}
88+
}
3389

3490
[SerializeField]
3591
private float appBarHoverOffsetZ = 0.05f;
92+
public float AppBarHoverOffsetZ
93+
{
94+
get
95+
{
96+
return appBarHoverOffsetZ;
97+
}
98+
set
99+
{
100+
appBarHoverOffsetZ = value;
101+
}
102+
}
36103

37104
[SerializeField]
38105
[Tooltip("This is the maximum scale that one grab can accomplish.")]
39106
private float maxScale = 2.0f;
107+
public float MaxScale
108+
{
109+
get
110+
{
111+
return maxScale;
112+
}
113+
set
114+
{
115+
maxScale = value;
116+
}
117+
}
40118

41119
[SerializeField]
42120
private BoundingBoxGizmoHandleRotationType rotationType = BoundingBoxGizmoHandleRotationType.objectCoordinates;
121+
public BoundingBoxGizmoHandleRotationType RotationType
122+
{
123+
get
124+
{
125+
return rotationType;
126+
}
127+
set
128+
{
129+
rotationType = value;
130+
}
131+
}
43132

44133
[SerializeField]
45134
private BoundingBoxGizmoHandleHandMotionType handMotionToRotate = BoundingBoxGizmoHandleHandMotionType.handRotatesToRotateObject;
135+
public BoundingBoxGizmoHandleHandMotionType HandMotionToRotate
136+
{
137+
get
138+
{
139+
return handMotionToRotate;
140+
}
141+
set
142+
{
143+
handMotionToRotate = value;
144+
}
145+
}
46146

47147
[SerializeField]
48148
private bool rotateAroundPivot = false;
149+
public bool RotateAroundPivot
150+
{
151+
get
152+
{
153+
return rotateAroundPivot;
154+
}
155+
set
156+
{
157+
rotateAroundPivot = value;
158+
}
159+
}
49160

50161
[Header("Preset Components")]
51162
[SerializeField]
52163
[Tooltip("To visualize the object bounding box, drop the MixedRealityToolkit/UX/Prefabs/BoundingBoxes/BoundingBoxBasic.prefab here.")]
53164
private BoundingBox boundingBoxPrefab;
165+
public BoundingBox BoundingBoxPrefab
166+
{
167+
get
168+
{
169+
return boundingBoxPrefab;
170+
}
171+
set
172+
{
173+
boundingBoxPrefab = value;
174+
}
175+
}
54176

55177
[SerializeField]
56178
[Tooltip("AppBar prefab.")]
57179
private AppBar appBarPrefab = null;
180+
public AppBar AppBarPrefab
181+
{
182+
get
183+
{
184+
return appBarPrefab;
185+
}
186+
set
187+
{
188+
appBarPrefab = value;
189+
}
190+
}
58191

59192
private BoundingBox boxInstance;
60193

@@ -82,58 +215,6 @@ public class BoundingBoxRig : MonoBehaviour
82215

83216
private bool destroying = false;
84217

85-
public BoundingBox BoundingBoxPrefab
86-
{
87-
get
88-
{
89-
return boundingBoxPrefab;
90-
}
91-
92-
set
93-
{
94-
boundingBoxPrefab = value;
95-
}
96-
}
97-
98-
public Material ScaleHandleMaterial
99-
{
100-
get
101-
{
102-
return scaleHandleMaterial;
103-
}
104-
105-
set
106-
{
107-
scaleHandleMaterial = value;
108-
}
109-
}
110-
111-
public Material RotateHandleMaterial
112-
{
113-
get
114-
{
115-
return rotateHandleMaterial;
116-
}
117-
118-
set
119-
{
120-
rotateHandleMaterial = value;
121-
}
122-
}
123-
124-
public Material InteractingMaterial
125-
{
126-
get
127-
{
128-
return interactingMaterial;
129-
}
130-
131-
set
132-
{
133-
interactingMaterial = value;
134-
}
135-
}
136-
137218
public void Activate()
138219
{
139220
InputManager.Instance.RaiseBoundingBoxRigActivated(gameObject);

0 commit comments

Comments
 (0)