Skip to content

Commit 9a5f086

Browse files
Merge v1.1.0
2 parents 31d07b2 + e0d83b7 commit 9a5f086

File tree

6 files changed

+409
-375
lines changed

6 files changed

+409
-375
lines changed

Changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
v 1.0.0
2+
- Initial Release.
3+
4+
v 1.1.0
5+
- Mesh & Wire Mesh
6+
* Added option to copy values from the origin transform field.

Changelog.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/GizmoDrawer.cs

Lines changed: 66 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,82 @@
11
#if UNITY_EDITOR
2-
using UnityEngine;
2+
using UnityEngine;
33

4-
namespace MccDev260.GizmoTool
4+
namespace MccDev260.GizmoTool
5+
{
6+
[ExecuteInEditMode]
7+
public class GizmoDrawer : MonoBehaviour
58
{
6-
[ExecuteInEditMode]
7-
public class GizmoDrawer : MonoBehaviour
8-
{
9-
[SerializeField] private bool drawOnSelectOnly;
9+
[SerializeField] private bool drawOnSelectOnly;
10+
11+
#region Properties
12+
//Shared
13+
[Tooltip("Sets the origin of the gizmo to the position of this transform.")]
14+
[HideInInspector] public Transform originTransform;
15+
[Tooltip("Directly enter world postion for the gizmo origin.")]
16+
[HideInInspector] public Vector3 originPos;
17+
[HideInInspector] public GizmoType gizmoType;
18+
[HideInInspector] public Color gizmoColor = Color.blue;
19+
20+
//Icon
21+
[Tooltip("Source should be placed in Assets/Gizmos folder.")]
22+
[HideInInspector] public string filePathString;
23+
[HideInInspector] public bool allowScaling;
1024

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;
25+
//Sphere
26+
[HideInInspector] public float floatRadius = 1f;
27+
//Cube
28+
[HideInInspector] public bool uniformScale; // Not implemented yet.
1729

18-
//Icon
19-
[HideInInspector] public string filePathString;
20-
[HideInInspector] public bool allowScaling;
30+
// Mesh
31+
[HideInInspector] public Mesh mesh;
32+
[Tooltip("Copy the transform values from the object this script is on.")]
33+
[HideInInspector] public bool useAttachedTransformValues;
34+
[Tooltip("Use the mesh thats on this object as the gizmo.")]
35+
[HideInInspector] public bool useMeshOnFilter;
36+
[Tooltip("Copy values from the transform referenced as the origin.")]
37+
[HideInInspector] public bool useOriginTransformValues;
2138

22-
//Sphere
23-
[HideInInspector] public float floatRadius = 1f;
24-
//Cube
25-
[HideInInspector] public bool uniformScale;
26-
[HideInInspector] public Vector3 scale = Vector3.one;
39+
[HideInInspector] public Vector3 meshRotation;
40+
[HideInInspector] public Vector3 scale = Vector3.one;
2741

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;
42+
//Line
43+
[HideInInspector] public Transform targetTransform;
44+
[HideInInspector] public Vector3 targetPosition;
3645

37-
//LineList & LineStrip
38-
[HideInInspector] public Vector3[] points = new Vector3[0];
46+
//LineList & LineStrip
47+
[HideInInspector] public Vector3[] points = new Vector3[0];
3948

40-
[HideInInspector] public bool useTransformArray;
41-
[HideInInspector] public Transform[] transformPoints = new Transform[0];
49+
[HideInInspector] public bool useTransformArray;
50+
[HideInInspector] public Transform[] transformPoints = new Transform[0];
4251

43-
[HideInInspector] public bool looped;
52+
[HideInInspector] public bool looped;
4453

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
54+
// GUI Texture
55+
/// <summary>
56+
/// The size and position of the texture on the "screen" defined by the XY plane.
57+
/// </summary>
58+
[HideInInspector] public Rect screenRect;
59+
/// <summary>
60+
/// The texture to be displayed.
61+
/// </summary>
62+
[HideInInspector] public Texture texture;
63+
/// <summary>
64+
/// An optional material to apply the texture.
65+
/// </summary>
66+
[HideInInspector] public Material mat;
67+
#endregion
5968

60-
private void OnDrawGizmosSelected()
61-
{
62-
if (drawOnSelectOnly)
63-
GizmoTool.DrawGizmo(this);
64-
}
69+
private void OnDrawGizmosSelected()
70+
{
71+
if (drawOnSelectOnly)
72+
GizmoTool.DrawGizmo(this);
73+
}
6574

66-
private void OnDrawGizmos()
67-
{
68-
if (!drawOnSelectOnly)
69-
GizmoTool.DrawGizmo(this);
70-
}
75+
private void OnDrawGizmos()
76+
{
77+
if (!drawOnSelectOnly)
78+
GizmoTool.DrawGizmo(this);
7179
}
7280
}
81+
}
7382
#endif

0 commit comments

Comments
 (0)