From 3af4c218c0e70167db23a6303d2af30aff37d2fe Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 20 Aug 2020 23:40:50 -0400 Subject: Removed a bunch of stuff; Changes --- .../Editor/TMP_SpriteGlyphPropertyDrawer.cs | 93 ---------------------- 1 file changed, 93 deletions(-) delete mode 100644 Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteGlyphPropertyDrawer.cs (limited to 'Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteGlyphPropertyDrawer.cs') diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteGlyphPropertyDrawer.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteGlyphPropertyDrawer.cs deleted file mode 100644 index d218701..0000000 --- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteGlyphPropertyDrawer.cs +++ /dev/null @@ -1,93 +0,0 @@ -using UnityEngine; -using UnityEngine.TextCore; -using UnityEditor; -using System.Collections; - - -namespace TMPro.EditorUtilities -{ - - [CustomPropertyDrawer(typeof(TMP_SpriteGlyph))] - public class TMP_SpriteGlyphPropertyDrawer : PropertyDrawer - { - public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) - { - SerializedProperty prop_GlyphIndex = property.FindPropertyRelative("m_Index"); - SerializedProperty prop_GlyphMetrics = property.FindPropertyRelative("m_Metrics"); - SerializedProperty prop_GlyphRect = property.FindPropertyRelative("m_GlyphRect"); - SerializedProperty prop_Scale = property.FindPropertyRelative("m_Scale"); - SerializedProperty prop_AtlasIndex = property.FindPropertyRelative("m_AtlasIndex"); - - GUIStyle style = new GUIStyle(EditorStyles.label); - style.richText = true; - - Rect rect = new Rect(position.x + 70, position.y, position.width, 49); - - // Draw GlyphRect - EditorGUI.PropertyField(rect, prop_GlyphRect); - - // Draw GlyphMetrics - rect.y += 45; - EditorGUI.PropertyField(rect, prop_GlyphMetrics); - - EditorGUIUtility.labelWidth = 40f; - EditorGUI.PropertyField(new Rect(rect.x, rect.y + 65, 75, 18), prop_Scale, new GUIContent("Scale:")); - - EditorGUIUtility.labelWidth = 74f; - EditorGUI.PropertyField(new Rect(rect.x + 85, rect.y + 65, 95, 18), prop_AtlasIndex, new GUIContent("Atlas Index:")); - - DrawGlyph(position, property); - - int.TryParse(property.displayName.Split(' ')[1], out int spriteCharacterIndex); - float labelWidthIndex = GUI.skin.label.CalcSize(new GUIContent("#" + spriteCharacterIndex)).x; - EditorGUI.LabelField(new Rect(position.x, position.y + 5, 64f, 18f), new GUIContent("#" + spriteCharacterIndex), style); - - float labelWidthID = GUI.skin.label.CalcSize(new GUIContent("ID: " + prop_GlyphIndex.intValue)).x; - EditorGUI.LabelField(new Rect(position.x + (64 - labelWidthID) / 2, position.y + 110, 64f, 18f), new GUIContent("ID: " + prop_GlyphIndex.intValue + ""), style); - } - - void DrawGlyph(Rect position, SerializedProperty property) - { - // Get a reference to the sprite texture - Texture tex = (property.serializedObject.targetObject as TMP_SpriteAsset).spriteSheet; - - // Return if we don't have a texture assigned to the sprite asset. - if (tex == null) - { - Debug.LogWarning("Please assign a valid Sprite Atlas texture to the [" + property.serializedObject.targetObject.name + "] Sprite Asset.", property.serializedObject.targetObject); - return; - } - - Vector2 spriteTexPosition = new Vector2(position.x, position.y); - Vector2 spriteSize = new Vector2(65, 65); - - SerializedProperty prop_GlyphRect = property.FindPropertyRelative("m_GlyphRect"); - - int spriteImageX = prop_GlyphRect.FindPropertyRelative("m_X").intValue; - int spriteImageY = prop_GlyphRect.FindPropertyRelative("m_Y").intValue; - int spriteImageWidth = prop_GlyphRect.FindPropertyRelative("m_Width").intValue; - int spriteImageHeight = prop_GlyphRect.FindPropertyRelative("m_Height").intValue; - - if (spriteImageWidth >= spriteImageHeight) - { - spriteSize.y = spriteImageHeight * spriteSize.x / spriteImageWidth; - spriteTexPosition.y += (spriteSize.x - spriteSize.y) / 2; - } - else - { - spriteSize.x = spriteImageWidth * spriteSize.y / spriteImageHeight; - spriteTexPosition.x += (spriteSize.y - spriteSize.x) / 2; - } - - // Compute the normalized texture coordinates - Rect texCoords = new Rect((float)spriteImageX / tex.width, (float)spriteImageY / tex.height, (float)spriteImageWidth / tex.width, (float)spriteImageHeight / tex.height); - GUI.DrawTextureWithTexCoords(new Rect(spriteTexPosition.x + 5, spriteTexPosition.y + 32f, spriteSize.x, spriteSize.y), tex, texCoords, true); - } - - public override float GetPropertyHeight(SerializedProperty property, GUIContent label) - { - return 130f; - } - - } -} -- cgit v1.2.3