|
1 | | -using UnityEngine; |
2 | | - |
3 | | -namespace MccDev260.GizmoTool |
4 | | -{ |
5 | 1 | #if UNITY_EDITOR |
6 | | - [ExecuteInEditMode] |
7 | | - public class GizmoDrawer : MonoBehaviour |
| 2 | + using UnityEngine; |
| 3 | + |
| 4 | + namespace MccDev260.GizmoTool |
8 | 5 | { |
9 | | - [SerializeField] private bool drawOnSelectOnly; |
| 6 | + [ExecuteInEditMode] |
| 7 | + public class GizmoDrawer : MonoBehaviour |
| 8 | + { |
| 9 | + [SerializeField] private bool drawOnSelectOnly; |
10 | 10 |
|
11 | | - #region Properties |
12 | | - //Shared |
13 | | - [HideInInspector] public Transform originTransform; |
14 | | - [HideInInspector] public Vector3 originPos; |
15 | | - [HideInInspector] public GizmoType gizmoType; |
16 | | - [HideInInspector] public Color gizmoColor = Color.blue; |
| 11 | + #region Properties |
| 12 | + //Shared |
| 13 | + [HideInInspector] public Transform originTransform; |
| 14 | + [HideInInspector] public Vector3 originPos; |
| 15 | + [HideInInspector] public GizmoType gizmoType; |
| 16 | + [HideInInspector] public Color gizmoColor = Color.blue; |
17 | 17 |
|
18 | | - //Icon |
19 | | - [HideInInspector] public string filePathString; |
20 | | - [HideInInspector] public bool allowScaling; |
| 18 | + //Icon |
| 19 | + [HideInInspector] public string filePathString; |
| 20 | + [HideInInspector] public bool allowScaling; |
21 | 21 |
|
22 | | - //Sphere |
23 | | - [HideInInspector] public float floatRadius = 1f; |
24 | | - //Cube |
25 | | - [HideInInspector] public bool uniformScale; |
26 | | - [HideInInspector] public Vector3 scale = Vector3.one; |
| 22 | + //Sphere |
| 23 | + [HideInInspector] public float floatRadius = 1f; |
| 24 | + //Cube |
| 25 | + [HideInInspector] public bool uniformScale; |
| 26 | + [HideInInspector] public Vector3 scale = Vector3.one; |
27 | 27 |
|
28 | | - // Mesh |
29 | | - [HideInInspector] public Mesh mesh; |
30 | | - [HideInInspector] public Vector3 meshRotation; |
31 | | - [HideInInspector] public bool useAttachedTransformValues; |
32 | | - [HideInInspector] public bool useMeshOnFilter; |
33 | | - //Line |
34 | | - [HideInInspector] public Transform targetTransform; |
35 | | - [HideInInspector] public Vector3 targetPosition; |
| 28 | + // Mesh |
| 29 | + [HideInInspector] public Mesh mesh; |
| 30 | + [HideInInspector] public Vector3 meshRotation; |
| 31 | + [HideInInspector] public bool useAttachedTransformValues; |
| 32 | + [HideInInspector] public bool useMeshOnFilter; |
| 33 | + //Line |
| 34 | + [HideInInspector] public Transform targetTransform; |
| 35 | + [HideInInspector] public Vector3 targetPosition; |
36 | 36 |
|
37 | | - //LineList & LineStrip |
38 | | - [HideInInspector] public Vector3[] points = new Vector3[0]; |
| 37 | + //LineList & LineStrip |
| 38 | + [HideInInspector] public Vector3[] points = new Vector3[0]; |
39 | 39 |
|
40 | | - [HideInInspector] public bool useTransformArray; |
41 | | - [HideInInspector] public Transform[] transformPoints = new Transform[0]; |
| 40 | + [HideInInspector] public bool useTransformArray; |
| 41 | + [HideInInspector] public Transform[] transformPoints = new Transform[0]; |
42 | 42 |
|
43 | | - [HideInInspector] public bool looped; |
| 43 | + [HideInInspector] public bool looped; |
44 | 44 |
|
45 | | - // GUI Texture |
46 | | - /// <summary> |
47 | | - /// The size and position of the texture on the "screen" defined by the XY plane. |
48 | | - /// </summary> |
49 | | - [HideInInspector] public Rect screenRect; |
50 | | - /// <summary> |
51 | | - /// The texture to be displayed. |
52 | | - /// </summary> |
53 | | - [HideInInspector] public Texture texture; |
54 | | - /// <summary> |
55 | | - /// An optional material to apply the texture. |
56 | | - /// </summary> |
57 | | - [HideInInspector] public Material mat; |
58 | | - #endregion |
| 45 | + // GUI Texture |
| 46 | + /// <summary> |
| 47 | + /// The size and position of the texture on the "screen" defined by the XY plane. |
| 48 | + /// </summary> |
| 49 | + [HideInInspector] public Rect screenRect; |
| 50 | + /// <summary> |
| 51 | + /// The texture to be displayed. |
| 52 | + /// </summary> |
| 53 | + [HideInInspector] public Texture texture; |
| 54 | + /// <summary> |
| 55 | + /// An optional material to apply the texture. |
| 56 | + /// </summary> |
| 57 | + [HideInInspector] public Material mat; |
| 58 | + #endregion |
59 | 59 |
|
60 | | - private void OnDrawGizmosSelected() |
61 | | - { |
62 | | - if (drawOnSelectOnly) |
63 | | - GizmoTool.DrawGizmo(this); |
64 | | - } |
| 60 | + private void OnDrawGizmosSelected() |
| 61 | + { |
| 62 | + if (drawOnSelectOnly) |
| 63 | + GizmoTool.DrawGizmo(this); |
| 64 | + } |
65 | 65 |
|
66 | | - private void OnDrawGizmos() |
67 | | - { |
68 | | - if (!drawOnSelectOnly) |
69 | | - GizmoTool.DrawGizmo(this); |
| 66 | + private void OnDrawGizmos() |
| 67 | + { |
| 68 | + if (!drawOnSelectOnly) |
| 69 | + GizmoTool.DrawGizmo(this); |
| 70 | + } |
70 | 71 | } |
71 | 72 | } |
72 | 73 | #endif |
73 | | -} |
0 commit comments