summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-04-19 17:19:32 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-04-19 17:19:32 -0400
commitc55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 (patch)
treeee4d51c7c1d633e11f46453ef1edd3c77c4ef9f7 /Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs
downloadProject-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.gz
Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.bz2
Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.zip
Inital commit
Diffstat (limited to 'Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs')
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs
new file mode 100644
index 0000000..eaf8dd4
--- /dev/null
+++ b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs
@@ -0,0 +1,44 @@
+using UnityEngine;
+using UnityEngine.TextCore;
+using UnityEditor;
+using System.Collections;
+
+
+namespace TMPro.EditorUtilities
+{
+
+ [CustomPropertyDrawer(typeof(GlyphRect))]
+ public class GlyphRectPropertyDrawer : PropertyDrawer
+ {
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ //EditorGUI.BeginProperty(position, label, property);
+
+ SerializedProperty prop_X = property.FindPropertyRelative("m_X");
+ SerializedProperty prop_Y = property.FindPropertyRelative("m_Y");
+ SerializedProperty prop_Width = property.FindPropertyRelative("m_Width");
+ SerializedProperty prop_Height = property.FindPropertyRelative("m_Height");
+
+ // We get Rect since a valid position may not be provided by the caller.
+ Rect rect = new Rect(position.x, position.y, position.width, 49);
+ EditorGUI.LabelField(rect, new GUIContent("Glyph Rect"));
+
+ EditorGUIUtility.labelWidth = 30f;
+ EditorGUIUtility.fieldWidth = 10f;
+
+ //GUI.enabled = false;
+ float width = (rect.width - 75f) / 4;
+ EditorGUI.PropertyField(new Rect(rect.x + width * 0, rect.y + 20, width - 5f, 18), prop_X, new GUIContent("X:"));
+ EditorGUI.PropertyField(new Rect(rect.x + width * 1, rect.y + 20, width - 5f, 18), prop_Y, new GUIContent("Y:"));
+ EditorGUI.PropertyField(new Rect(rect.x + width * 2, rect.y + 20, width - 5f, 18), prop_Width, new GUIContent("W:"));
+ EditorGUI.PropertyField(new Rect(rect.x + width * 3, rect.y + 20, width - 5f, 18), prop_Height, new GUIContent("H:"));
+
+ //EditorGUI.EndProperty();
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return 45f;
+ }
+ }
+}