Skip to content

Commit a5f9ef7

Browse files
committed
rewrote ValueReferenceDrawer
1 parent 133d93f commit a5f9ef7

13 files changed

+190
-21
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using UnityEngine;
2+
using UnityEditor;
3+
4+
5+
6+
namespace Signals.Common
7+
{
8+
[CustomPropertyDrawer(typeof(QuaternionValueReference))]
9+
public class QuaternionValueReferenceDrawer : ValueReferenceDrawer
10+
{
11+
static Vector4 QuaternionToVector4(Quaternion quaternion)
12+
{
13+
return new Vector4(quaternion.x, quaternion.y, quaternion.z, quaternion.w);
14+
}
15+
16+
static Quaternion Vector4ToQuaternion(Vector4 vector)
17+
{
18+
return new Quaternion(vector.x, vector.y, vector.z, vector.w);
19+
}
20+
21+
protected override void LocalValueField(Rect position, SerializedProperty localValue)
22+
{
23+
localValue.quaternionValue = Vector4ToQuaternion(EditorGUI.Vector4Field(position, GUIContent.none, QuaternionToVector4(localValue.quaternionValue)));
24+
}
25+
}
26+
}

Code/Common/Editor/QuaternionValueReferenceDrawer.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using UnityEditor;
2+
3+
4+
5+
namespace Signals.Common
6+
{
7+
[CustomPropertyDrawer(typeof(Vector2IntValueReference))]
8+
public class Vector2IntValueReferenceDrawer : ValueReferenceDrawer { }
9+
}

Code/Common/Editor/Vector2IntValueReferenceDrawer.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using UnityEditor;
2+
3+
4+
5+
namespace Signals.Common
6+
{
7+
[CustomPropertyDrawer(typeof(Vector2ValueReference))]
8+
public class Vector2ValueReferenceDrawer : ValueReferenceDrawer { }
9+
}

Code/Common/Editor/Vector2ValueReferenceDrawer.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using UnityEditor;
2+
3+
4+
5+
namespace Signals.Common
6+
{
7+
[CustomPropertyDrawer(typeof(Vector3IntValueReference))]
8+
public class Vector3IntValueReferenceDrawer : ValueReferenceDrawer { }
9+
}

Code/Common/Editor/Vector3IntValueReferenceDrawer.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using UnityEditor;
2+
3+
4+
5+
namespace Signals.Common
6+
{
7+
[CustomPropertyDrawer(typeof(Vector3ValueReference))]
8+
public class Vector3ValueReferenceDrawer : ValueReferenceDrawer { }
9+
}

Code/Common/Editor/Vector3ValueReferenceDrawer.cs.meta

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

0 commit comments

Comments
 (0)