summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor
diff options
context:
space:
mode:
Diffstat (limited to 'Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor')
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/DropdownOptionListDrawer.cs60
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/DropdownOptionListDrawer.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphInfoDrawer.cs61
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphInfoDrawer.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphMetricsPropertyDrawer.cs53
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphMetricsPropertyDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs44
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseEditorPanel.cs1116
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseEditorPanel.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseShaderGUI.cs534
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseShaderGUI.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BitmapShaderGUI.cs85
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BitmapShaderGUI.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_CharacterPropertyDrawer.cs237
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_CharacterPropertyDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientAssetMenu.cs51
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientAssetMenu.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientEditor.cs146
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientEditor.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_DropdownEditor.cs51
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_DropdownEditor.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorCoroutine.cs96
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorCoroutine.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorPanel.cs153
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorPanel.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorUtility.cs450
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorUtility.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAssetEditor.cs1711
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAssetEditor.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAsset_CreationMenu.cs190
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAsset_CreationMenu.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPairAdjustmentRecordPropertyDrawer.cs382
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPairAdjustmentRecordPropertyDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPropertyDrawer.cs118
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPropertyDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_InputFieldEditor.cs283
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_InputFieldEditor.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_MeshRendererEditor.cs76
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_MeshRendererEditor.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PackageUtilities.cs920
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PackageUtilities.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PostBuildProcessHandler.cs63
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PostBuildProcessHandler.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ProjectTextSettings.cs43
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ProjectTextSettings.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ResourcesLoader.cs68
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ResourcesLoader.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SDFShaderGUI.cs442
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SDFShaderGUI.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SerializedPropertyHolder.cs14
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SerializedPropertyHolder.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SettingsEditor.cs341
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SettingsEditor.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetEditor.cs896
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetEditor.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetImporter.cs232
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetImporter.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetMenu.cs329
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetMenu.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteCharacterPropertyDrawer.cs225
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteCharacterPropertyDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteGlyphPropertyDrawer.cs93
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteGlyphPropertyDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs49
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleSheetEditor.cs278
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleSheetEditor.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMeshUI_Editor.cs98
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMeshUI_Editor.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMesh_Editor.cs76
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMesh_Editor.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_TextAlignmentDrawer.cs119
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_TextAlignmentDrawer.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UIStyleManager.cs134
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UIStyleManager.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UiEditorPanel.cs91
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UiEditorPanel.cs.meta12
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_ContextMenus.cs341
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_ContextMenus.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_CreateObjectMenu.cs311
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_CreateObjectMenu.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_EditorShaderUtilities.cs53
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_EditorShaderUtilities.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs1736
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontPlugin.cs115
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontPlugin.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_SortingLayerHelper.cs105
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_SortingLayerHelper.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TextContainerEditor.cs235
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TextContainerEditor.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TexturePostProcessor.cs75
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TexturePostProcessor.cs.meta10
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/Unity.TextMeshPro.Editor.asmdef13
-rw-r--r--Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/Unity.TextMeshPro.Editor.asmdef.meta7
96 files changed, 0 insertions, 13919 deletions
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/DropdownOptionListDrawer.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/DropdownOptionListDrawer.cs
deleted file mode 100644
index d082b5f..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/DropdownOptionListDrawer.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using UnityEditorInternal;
-using UnityEngine;
-using UnityEngine.UI;
-using UnityEditor;
-
-namespace TMPro.EditorUtilities
-{
- [CustomPropertyDrawer(typeof(TMP_Dropdown.OptionDataList), true)]
- class DropdownOptionListDrawer : PropertyDrawer
- {
- private ReorderableList m_ReorderableList;
-
- private void Init(SerializedProperty property)
- {
- if (m_ReorderableList != null)
- return;
-
- SerializedProperty array = property.FindPropertyRelative("m_Options");
-
- m_ReorderableList = new ReorderableList(property.serializedObject, array);
- m_ReorderableList.drawElementCallback = DrawOptionData;
- m_ReorderableList.drawHeaderCallback = DrawHeader;
- m_ReorderableList.elementHeight += 16;
- }
-
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- Init(property);
-
- m_ReorderableList.DoList(position);
- }
-
- private void DrawHeader(Rect rect)
- {
- GUI.Label(rect, "Options");
- }
-
- private void DrawOptionData(Rect rect, int index, bool isActive, bool isFocused)
- {
- SerializedProperty itemData = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index);
- SerializedProperty itemText = itemData.FindPropertyRelative("m_Text");
- SerializedProperty itemImage = itemData.FindPropertyRelative("m_Image");
-
- RectOffset offset = new RectOffset(0, 0, -1, -3);
- rect = offset.Add(rect);
- rect.height = EditorGUIUtility.singleLineHeight;
-
- EditorGUI.PropertyField(rect, itemText, GUIContent.none);
- rect.y += EditorGUIUtility.singleLineHeight;
- EditorGUI.PropertyField(rect, itemImage, GUIContent.none);
- }
-
- public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
- {
- Init(property);
-
- return m_ReorderableList.GetHeight();
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/DropdownOptionListDrawer.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/DropdownOptionListDrawer.cs.meta
deleted file mode 100644
index f077fd3..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/DropdownOptionListDrawer.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 9545c9eb3bf94265810463794fec8334
-timeCreated: 1464818008
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphInfoDrawer.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphInfoDrawer.cs
deleted file mode 100644
index 6c1163a..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphInfoDrawer.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomPropertyDrawer(typeof(TMP_Glyph))]
- public class GlyphInfoDrawer : PropertyDrawer
- {
-
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- SerializedProperty prop_id = property.FindPropertyRelative("id");
- SerializedProperty prop_x = property.FindPropertyRelative("x");
- SerializedProperty prop_y = property.FindPropertyRelative("y");
- SerializedProperty prop_width = property.FindPropertyRelative("width");
- SerializedProperty prop_height = property.FindPropertyRelative("height");
- SerializedProperty prop_xOffset = property.FindPropertyRelative("xOffset");
- SerializedProperty prop_yOffset = property.FindPropertyRelative("yOffset");
- SerializedProperty prop_xAdvance = property.FindPropertyRelative("xAdvance");
- SerializedProperty prop_scale = property.FindPropertyRelative("scale");
-
-
- // We get Rect since a valid position may not be provided by the caller.
- Rect rect = GUILayoutUtility.GetRect(position.width, 48);
- rect.y -= 15;
-
- //GUI.enabled = false;
- EditorGUIUtility.labelWidth = 40f;
- EditorGUIUtility.fieldWidth = 45f;
-
- bool prevGuiState = GUI.enabled;
- GUI.enabled = true;
- EditorGUI.LabelField(new Rect(rect.x + 5f, rect.y, 80f, 18), new GUIContent("Ascii: <color=#FFFF80>" + prop_id.intValue + "</color>"), TMP_UIStyleManager.label);
- EditorGUI.LabelField(new Rect(rect.x + 90f, rect.y, 80f, 18), new GUIContent("Hex: <color=#FFFF80>" + prop_id.intValue.ToString("X") + "</color>"), TMP_UIStyleManager.label);
- EditorGUI.LabelField(new Rect(rect.x + 170f, rect.y, 80, 18), "Char: [ <color=#FFFF80>" + (char)prop_id.intValue + "</color> ]", TMP_UIStyleManager.label);
- GUI.enabled = prevGuiState;
-
- EditorGUIUtility.labelWidth = 35f;
- EditorGUIUtility.fieldWidth = 10f;
-
- float width = (rect.width - 5f) / 4;
- EditorGUI.PropertyField(new Rect(rect.x + 5f + width * 0, rect.y + 22, width - 5f, 18), prop_x, new GUIContent("X:"));
- EditorGUI.PropertyField(new Rect(rect.x + 5f + width * 1, rect.y + 22, width - 5f, 18), prop_y, new GUIContent("Y:"));
- EditorGUI.PropertyField(new Rect(rect.x + 5f + width * 2, rect.y + 22, width - 5f, 18), prop_width, new GUIContent("W:"));
- EditorGUI.PropertyField(new Rect(rect.x + 5f + width * 3, rect.y + 22, width - 5f, 18), prop_height, new GUIContent("H:"));
-
- //GUI.enabled = true;
- EditorGUI.PropertyField(new Rect(rect.x + 5f + width * 0, rect.y + 44, width - 5f, 18), prop_xOffset, new GUIContent("OX:"));
- EditorGUI.PropertyField(new Rect(rect.x + 5f + width * 1, rect.y + 44, width - 5f, 18), prop_yOffset, new GUIContent("OY:"));
- //GUI.enabled = true;
- EditorGUI.PropertyField(new Rect(rect.x + 5f + width * 2, rect.y + 44, width - 5f, 18), prop_xAdvance, new GUIContent("ADV:"));
- EditorGUI.PropertyField(new Rect(rect.x + 5f + width * 3, rect.y + 44, width - 5f, 18), prop_scale, new GUIContent("SF:"));
- }
-
- }
-}
-*/ \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphInfoDrawer.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphInfoDrawer.cs.meta
deleted file mode 100644
index d840c53..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphInfoDrawer.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 900f1a451c764dc3bdcc0de815a15935
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphMetricsPropertyDrawer.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphMetricsPropertyDrawer.cs
deleted file mode 100644
index ee8459f..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphMetricsPropertyDrawer.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using UnityEngine;
-using UnityEngine.TextCore;
-using UnityEditor;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomPropertyDrawer(typeof(GlyphMetrics))]
- public class GlyphMetricsPropertyDrawer : PropertyDrawer
- {
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- SerializedProperty prop_Width = property.FindPropertyRelative("m_Width");
- SerializedProperty prop_Height = property.FindPropertyRelative("m_Height");
- SerializedProperty prop_HoriBearingX = property.FindPropertyRelative("m_HorizontalBearingX");
- SerializedProperty prop_HoriBearingY = property.FindPropertyRelative("m_HorizontalBearingY");
- SerializedProperty prop_HoriAdvance = property.FindPropertyRelative("m_HorizontalAdvance");
-
- // 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 Metrics"));
-
- EditorGUIUtility.labelWidth = 30f;
- EditorGUIUtility.fieldWidth = 10f;
-
- //GUI.enabled = false;
- float width = (rect.width - 75f) / 2;
- EditorGUI.PropertyField(new Rect(rect.x + width * 0, rect.y + 20, width - 5f, 18), prop_Width, new GUIContent("W:"));
- EditorGUI.PropertyField(new Rect(rect.x + width * 1, rect.y + 20, width - 5f, 18), prop_Height, new GUIContent("H:"));
-
- //GUI.enabled = true;
-
- width = (rect.width - 75f) / 3;
- EditorGUI.BeginChangeCheck();
- EditorGUI.PropertyField(new Rect(rect.x + width * 0, rect.y + 40, width - 5f, 18), prop_HoriBearingX, new GUIContent("BX:"));
- EditorGUI.PropertyField(new Rect(rect.x + width * 1, rect.y + 40, width - 5f, 18), prop_HoriBearingY, new GUIContent("BY:"));
- EditorGUI.PropertyField(new Rect(rect.x + width * 2, rect.y + 40, width - 5f, 18), prop_HoriAdvance, new GUIContent("AD:"));
- if (EditorGUI.EndChangeCheck())
- {
-
- }
- }
-
- public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
- {
- return 65f;
- }
-
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphMetricsPropertyDrawer.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphMetricsPropertyDrawer.cs.meta
deleted file mode 100644
index 484aab6..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphMetricsPropertyDrawer.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: e3882522a08b6f5459b4dea6f8791278
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
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
deleted file mode 100644
index eaf8dd4..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-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;
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs.meta
deleted file mode 100644
index 137f460..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/GlyphRectPropertyDrawer.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 8bc2b083b068f3546a9509c805e0541c
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseEditorPanel.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseEditorPanel.cs
deleted file mode 100644
index 07651bf..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseEditorPanel.cs
+++ /dev/null
@@ -1,1116 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-
-namespace TMPro.EditorUtilities
-{
- public abstract class TMP_BaseEditorPanel : Editor
- {
- //Labels and Tooltips
- static readonly GUIContent k_RtlToggleLabel = new GUIContent("Enable RTL Editor", "Reverses text direction and allows right to left editing.");
- static readonly GUIContent k_MainSettingsLabel = new GUIContent("Main Settings");
- static readonly GUIContent k_FontAssetLabel = new GUIContent("Font Asset", "The Font Asset containing the glyphs that can be rendered for this text.");
- static readonly GUIContent k_MaterialPresetLabel = new GUIContent("Material Preset", "The material used for rendering. Only materials created from the Font Asset can be used.");
- static readonly GUIContent k_AutoSizeLabel = new GUIContent("Auto Size", "Auto sizes the text to fit the available space.");
- static readonly GUIContent k_FontSizeLabel = new GUIContent("Font Size", "The size the text will be rendered at in points.");
- static readonly GUIContent k_AutoSizeOptionsLabel = new GUIContent("Auto Size Options");
- static readonly GUIContent k_MinLabel = new GUIContent("Min", "The minimum font size.");
- static readonly GUIContent k_MaxLabel = new GUIContent("Max", "The maximum font size.");
- static readonly GUIContent k_WdLabel = new GUIContent("WD%", "Compresses character width up to this value before reducing font size.");
- static readonly GUIContent k_LineLabel = new GUIContent("Line", "Negative value only. Compresses line height down to this value before reducing font size.");
- static readonly GUIContent k_FontStyleLabel = new GUIContent("Font Style", "Styles to apply to the text such as Bold or Italic.");
-
- static readonly GUIContent k_BoldLabel = new GUIContent("B", "Bold");
- static readonly GUIContent k_ItalicLabel = new GUIContent("I", "Italic");
- static readonly GUIContent k_UnderlineLabel = new GUIContent("U", "Underline");
- static readonly GUIContent k_StrikethroughLabel = new GUIContent("S", "Strikethrough");
- static readonly GUIContent k_LowercaseLabel = new GUIContent("ab", "Lowercase");
- static readonly GUIContent k_UppercaseLabel = new GUIContent("AB", "Uppercase");
- static readonly GUIContent k_SmallcapsLabel = new GUIContent("SC", "Smallcaps");
-
- static readonly GUIContent k_ColorModeLabel = new GUIContent("Color Mode", "The type of gradient to use.");
- static readonly GUIContent k_BaseColorLabel = new GUIContent("Vertex Color", "The base color of the text vertices.");
- static readonly GUIContent k_ColorPresetLabel = new GUIContent("Color Preset", "A Color Preset which override the local color settings.");
- static readonly GUIContent k_ColorGradientLabel = new GUIContent("Color Gradient", "The gradient color applied over the Vertex Color. Can be locally set or driven by a Gradient Asset.");
- static readonly GUIContent k_CorenerColorsLabel = new GUIContent("Colors", "The color composition of the gradient.");
- static readonly GUIContent k_OverrideTagsLabel = new GUIContent("Override Tags", "Whether the color settings override the <color> tag.");
-
- static readonly GUIContent k_SpacingOptionsLabel = new GUIContent("Spacing Options", "Spacing adjustments between different elements of the text.");
- static readonly GUIContent k_CharacterSpacingLabel = new GUIContent("Character");
- static readonly GUIContent k_WordSpacingLabel = new GUIContent("Word");
- static readonly GUIContent k_LineSpacingLabel = new GUIContent("Line");
- static readonly GUIContent k_ParagraphSpacingLabel = new GUIContent("Paragraph");
-
- static readonly GUIContent k_AlignmentLabel = new GUIContent("Alignment", "Horizontal and vertical aligment of the text within its container.");
- static readonly GUIContent k_WrapMixLabel = new GUIContent("Wrap Mix (W <-> C)", "How much to favor words versus characters when distributing the text.");
-
- static readonly GUIContent k_WrappingLabel = new GUIContent("Wrapping", "Wraps text to the next line when reaching the edge of the container.");
- static readonly GUIContent[] k_WrappingOptions = { new GUIContent("Disabled"), new GUIContent("Enabled") };
- static readonly GUIContent k_OverflowLabel = new GUIContent("Overflow", "How to display text which goes past the edge of the container.");
-
- static readonly GUIContent k_MarginsLabel = new GUIContent("Margins", "The space between the text and the edge of its container.");
- static readonly GUIContent k_GeometrySortingLabel = new GUIContent("Geometry Sorting", "The order in which text geometry is sorted. Used to adjust the way overlapping characters are displayed.");
- static readonly GUIContent k_RichTextLabel = new GUIContent("Rich Text", "Enables the use of rich text tags such as <color> and <font>.");
- static readonly GUIContent k_EscapeCharactersLabel = new GUIContent("Parse Escape Characters", "Whether to display strings such as \"\\n\" as is or replace them by the character they represent.");
- static readonly GUIContent k_VisibleDescenderLabel = new GUIContent("Visible Descender", "Compute descender values from visible characters only. Used to adjust layout behavior when hiding and revealing characters dynamically.");
- static readonly GUIContent k_SpriteAssetLabel = new GUIContent("Sprite Asset", "The Sprite Asset used when NOT specifically referencing one using <sprite=\"Sprite Asset Name\">.");
-
- static readonly GUIContent k_HorizontalMappingLabel = new GUIContent("Horizontal Mapping", "Horizontal UV mapping when using a shader with a texture face option.");
- static readonly GUIContent k_VerticalMappingLabel = new GUIContent("Vertical Mapping", "Vertical UV mapping when using a shader with a texture face option.");
- static readonly GUIContent k_LineOffsetLabel = new GUIContent("Line Offset", "Adds an horizontal offset to each successive line. Used for slanted texturing.");
-
- static readonly GUIContent k_KerningLabel = new GUIContent("Kerning", "Enables character specific spacing between pairs of characters.");
- static readonly GUIContent k_PaddingLabel = new GUIContent("Extra Padding", "Adds some padding between the characters and the edge of the text mesh. Can reduce graphical errors when displaying small text.");
-
- static readonly GUIContent k_LeftLabel = new GUIContent("Left");
- static readonly GUIContent k_TopLabel = new GUIContent("Top");
- static readonly GUIContent k_RightLabel = new GUIContent("Right");
- static readonly GUIContent k_BottomLabel = new GUIContent("Bottom");
-
- protected static readonly GUIContent k_ExtraSettingsLabel = new GUIContent("Extra Settings");
-
- protected struct Foldout
- {
- // Track Inspector foldout panel states, globally.
- public static bool extraSettings = false;
- public static bool materialInspector = true;
- }
-
- protected static int s_EventId;
-
- public int selAlignGridA;
- public int selAlignGridB;
-
- protected SerializedProperty m_TextProp;
-
- protected SerializedProperty m_IsRightToLeftProp;
- protected string m_RtlText;
-
- protected SerializedProperty m_FontAssetProp;
-
- protected SerializedProperty m_FontSharedMaterialProp;
- protected Material[] m_MaterialPresets;
- protected GUIContent[] m_MaterialPresetNames;
- protected int m_MaterialPresetSelectionIndex;
- protected bool m_IsPresetListDirty;
-
- protected SerializedProperty m_FontStyleProp;
-
- protected SerializedProperty m_FontColorProp;
- protected SerializedProperty m_EnableVertexGradientProp;
- protected SerializedProperty m_FontColorGradientProp;
- protected SerializedProperty m_FontColorGradientPresetProp;
- protected SerializedProperty m_OverrideHtmlColorProp;
-
- protected SerializedProperty m_FontSizeProp;
- protected SerializedProperty m_FontSizeBaseProp;
-
- protected SerializedProperty m_AutoSizingProp;
- protected SerializedProperty m_FontSizeMinProp;
- protected SerializedProperty m_FontSizeMaxProp;
-
- protected SerializedProperty m_LineSpacingMaxProp;
- protected SerializedProperty m_CharWidthMaxAdjProp;
-
- protected SerializedProperty m_CharacterSpacingProp;
- protected SerializedProperty m_WordSpacingProp;
- protected SerializedProperty m_LineSpacingProp;
- protected SerializedProperty m_ParagraphSpacingProp;
-
- protected SerializedProperty m_TextAlignmentProp;
-
- protected SerializedProperty m_HorizontalMappingProp;
- protected SerializedProperty m_VerticalMappingProp;
- protected SerializedProperty m_UvLineOffsetProp;
-
- protected SerializedProperty m_EnableWordWrappingProp;
- protected SerializedProperty m_WordWrappingRatiosProp;
- protected SerializedProperty m_TextOverflowModeProp;
- protected SerializedProperty m_PageToDisplayProp;
- protected SerializedProperty m_LinkedTextComponentProp;
- protected SerializedProperty m_IsLinkedTextComponentProp;
-
- protected SerializedProperty m_EnableKerningProp;
-
- protected SerializedProperty m_IsRichTextProp;
-
- protected SerializedProperty m_HasFontAssetChangedProp;
-
- protected SerializedProperty m_EnableExtraPaddingProp;
- protected SerializedProperty m_CheckPaddingRequiredProp;
- protected SerializedProperty m_EnableEscapeCharacterParsingProp;
- protected SerializedProperty m_UseMaxVisibleDescenderProp;
- protected SerializedProperty m_GeometrySortingOrderProp;
-
- protected SerializedProperty m_SpriteAssetProp;
-
- protected SerializedProperty m_MarginProp;
-
- protected SerializedProperty m_ColorModeProp;
-
- protected bool m_HavePropertiesChanged;
-
- protected TMP_Text m_TextComponent;
- protected RectTransform m_RectTransform;
-
- protected Material m_TargetMaterial;
-
- protected Vector3[] m_RectCorners = new Vector3[4];
- protected Vector3[] m_HandlePoints = new Vector3[4];
-
- protected virtual void OnEnable()
- {
- m_TextProp = serializedObject.FindProperty("m_text");
- m_IsRightToLeftProp = serializedObject.FindProperty("m_isRightToLeft");
- m_FontAssetProp = serializedObject.FindProperty("m_fontAsset");
- m_FontSharedMaterialProp = serializedObject.FindProperty("m_sharedMaterial");
-
- m_FontStyleProp = serializedObject.FindProperty("m_fontStyle");
-
- m_FontSizeProp = serializedObject.FindProperty("m_fontSize");
- m_FontSizeBaseProp = serializedObject.FindProperty("m_fontSizeBase");
-
- m_AutoSizingProp = serializedObject.FindProperty("m_enableAutoSizing");
- m_FontSizeMinProp = serializedObject.FindProperty("m_fontSizeMin");
- m_FontSizeMaxProp = serializedObject.FindProperty("m_fontSizeMax");
-
- m_LineSpacingMaxProp = serializedObject.FindProperty("m_lineSpacingMax");
- m_CharWidthMaxAdjProp = serializedObject.FindProperty("m_charWidthMaxAdj");
-
- // Colors & Gradient
- m_FontColorProp = serializedObject.FindProperty("m_fontColor");
- m_EnableVertexGradientProp = serializedObject.FindProperty("m_enableVertexGradient");
- m_FontColorGradientProp = serializedObject.FindProperty("m_fontColorGradient");
- m_FontColorGradientPresetProp = serializedObject.FindProperty("m_fontColorGradientPreset");
- m_OverrideHtmlColorProp = serializedObject.FindProperty("m_overrideHtmlColors");
-
- m_CharacterSpacingProp = serializedObject.FindProperty("m_characterSpacing");
- m_WordSpacingProp = serializedObject.FindProperty("m_wordSpacing");
- m_LineSpacingProp = serializedObject.FindProperty("m_lineSpacing");
- m_ParagraphSpacingProp = serializedObject.FindProperty("m_paragraphSpacing");
-
- m_TextAlignmentProp = serializedObject.FindProperty("m_textAlignment");
-
- m_HorizontalMappingProp = serializedObject.FindProperty("m_horizontalMapping");
- m_VerticalMappingProp = serializedObject.FindProperty("m_verticalMapping");
- m_UvLineOffsetProp = serializedObject.FindProperty("m_uvLineOffset");
-
- m_EnableWordWrappingProp = serializedObject.FindProperty("m_enableWordWrapping");
- m_WordWrappingRatiosProp = serializedObject.FindProperty("m_wordWrappingRatios");
- m_TextOverflowModeProp = serializedObject.FindProperty("m_overflowMode");
- m_PageToDisplayProp = serializedObject.FindProperty("m_pageToDisplay");
- m_LinkedTextComponentProp = serializedObject.FindProperty("m_linkedTextComponent");
- m_IsLinkedTextComponentProp = serializedObject.FindProperty("m_isLinkedTextComponent");
-
- m_EnableKerningProp = serializedObject.FindProperty("m_enableKerning");
-
- m_EnableExtraPaddingProp = serializedObject.FindProperty("m_enableExtraPadding");
- m_IsRichTextProp = serializedObject.FindProperty("m_isRichText");
- m_CheckPaddingRequiredProp = serializedObject.FindProperty("checkPaddingRequired");
- m_EnableEscapeCharacterParsingProp = serializedObject.FindProperty("m_parseCtrlCharacters");
- m_UseMaxVisibleDescenderProp = serializedObject.FindProperty("m_useMaxVisibleDescender");
-
- m_GeometrySortingOrderProp = serializedObject.FindProperty("m_geometrySortingOrder");
-
- m_SpriteAssetProp = serializedObject.FindProperty("m_spriteAsset");
-
- m_MarginProp = serializedObject.FindProperty("m_margin");
-
- m_HasFontAssetChangedProp = serializedObject.FindProperty("m_hasFontAssetChanged");
-
- m_ColorModeProp = serializedObject.FindProperty("m_colorMode");
-
- m_TextComponent = (TMP_Text)target;
- m_RectTransform = m_TextComponent.rectTransform;
-
- // Create new Material Editor if one does not exists
- m_TargetMaterial = m_TextComponent.fontSharedMaterial;
-
- // Set material inspector visibility
- if (m_TargetMaterial != null)
- UnityEditorInternal.InternalEditorUtility.SetIsInspectorExpanded(m_TargetMaterial, Foldout.materialInspector);
-
- // Find all Material Presets matching the current Font Asset Material
- m_MaterialPresetNames = GetMaterialPresets();
-
- // Initialize the Event Listener for Undo Events.
- Undo.undoRedoPerformed += OnUndoRedo;
- }
-
- protected virtual void OnDisable()
- {
- // Set material inspector visibility
- if (m_TargetMaterial != null)
- Foldout.materialInspector = UnityEditorInternal.InternalEditorUtility.GetIsInspectorExpanded(m_TargetMaterial);
-
- if (Undo.undoRedoPerformed != null)
- Undo.undoRedoPerformed -= OnUndoRedo;
- }
-
- public override void OnInspectorGUI()
- {
- // Make sure Multi selection only includes TMP Text objects.
- if (IsMixSelectionTypes()) return;
-
- serializedObject.Update();
-
- DrawTextInput();
-
- DrawMainSettings();
-
- DrawExtraSettings();
-
- EditorGUILayout.Space();
-
- if (m_HavePropertiesChanged)
- {
- m_HavePropertiesChanged = false;
- m_TextComponent.havePropertiesChanged = true;
- m_TextComponent.ComputeMarginSize();
- EditorUtility.SetDirty(target);
- }
-
- serializedObject.ApplyModifiedProperties();
- }
-
- public void OnSceneGUI()
- {
- if (IsMixSelectionTypes()) return;
-
- // Margin Frame & Handles
- m_RectTransform.GetWorldCorners(m_RectCorners);
- Vector4 marginOffset = m_TextComponent.margin;
- Vector3 lossyScale = m_RectTransform.lossyScale;
-
- m_HandlePoints[0] = m_RectCorners[0] + m_RectTransform.TransformDirection(new Vector3(marginOffset.x * lossyScale.x, marginOffset.w * lossyScale.y, 0));
- m_HandlePoints[1] = m_RectCorners[1] + m_RectTransform.TransformDirection(new Vector3(marginOffset.x * lossyScale.x, -marginOffset.y * lossyScale.y, 0));
- m_HandlePoints[2] = m_RectCorners[2] + m_RectTransform.TransformDirection(new Vector3(-marginOffset.z * lossyScale.x, -marginOffset.y * lossyScale.y, 0));
- m_HandlePoints[3] = m_RectCorners[3] + m_RectTransform.TransformDirection(new Vector3(-marginOffset.z * lossyScale.x, marginOffset.w * lossyScale.y, 0));
-
- Handles.DrawSolidRectangleWithOutline(m_HandlePoints, new Color32(255, 255, 255, 0), new Color32(255, 255, 0, 255));
-
- // Draw & process FreeMoveHandles
-
- // LEFT HANDLE
- Vector3 oldLeft = (m_HandlePoints[0] + m_HandlePoints[1]) * 0.5f;
- Vector3 newLeft = Handles.FreeMoveHandle(oldLeft, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
- bool hasChanged = false;
- if (oldLeft != newLeft)
- {
- float delta = oldLeft.x - newLeft.x;
- marginOffset.x += -delta / lossyScale.x;
- //Debug.Log("Left Margin H0:" + handlePoints[0] + " H1:" + handlePoints[1]);
- hasChanged = true;
- }
-
- // TOP HANDLE
- Vector3 oldTop = (m_HandlePoints[1] + m_HandlePoints[2]) * 0.5f;
- Vector3 newTop = Handles.FreeMoveHandle(oldTop, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
- if (oldTop != newTop)
- {
- float delta = oldTop.y - newTop.y;
- marginOffset.y += delta / lossyScale.y;
- //Debug.Log("Top Margin H1:" + handlePoints[1] + " H2:" + handlePoints[2]);
- hasChanged = true;
- }
-
- // RIGHT HANDLE
- Vector3 oldRight = (m_HandlePoints[2] + m_HandlePoints[3]) * 0.5f;
- Vector3 newRight = Handles.FreeMoveHandle(oldRight, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
- if (oldRight != newRight)
- {
- float delta = oldRight.x - newRight.x;
- marginOffset.z += delta / lossyScale.x;
- hasChanged = true;
- //Debug.Log("Right Margin H2:" + handlePoints[2] + " H3:" + handlePoints[3]);
- }
-
- // BOTTOM HANDLE
- Vector3 oldBottom = (m_HandlePoints[3] + m_HandlePoints[0]) * 0.5f;
- Vector3 newBottom = Handles.FreeMoveHandle(oldBottom, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
- if (oldBottom != newBottom)
- {
- float delta = oldBottom.y - newBottom.y;
- marginOffset.w += -delta / lossyScale.y;
- hasChanged = true;
- //Debug.Log("Bottom Margin H0:" + handlePoints[0] + " H3:" + handlePoints[3]);
- }
-
- if (hasChanged)
- {
- Undo.RecordObjects(new Object[] {m_RectTransform, m_TextComponent }, "Margin Changes");
- m_TextComponent.margin = marginOffset;
- EditorUtility.SetDirty(target);
- }
- }
-
- protected void DrawTextInput()
- {
- EditorGUILayout.Space();
-
- // If the text component is linked, disable the text input box.
- if (m_IsLinkedTextComponentProp.boolValue)
- {
- EditorGUILayout.HelpBox("The Text Input Box is disabled due to this text component being linked to another.", MessageType.Info);
- }
- else
- {
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_TextProp);
-
- if (EditorGUI.EndChangeCheck() || (m_IsRightToLeftProp.boolValue && string.IsNullOrEmpty(m_RtlText)))
- {
- m_TextComponent.m_inputSource = TMP_Text.TextInputSources.Text;
- m_TextComponent.m_isInputParsingRequired = true;
- m_HavePropertiesChanged = true;
-
- // Handle Left to Right or Right to Left Editor
- if (m_IsRightToLeftProp.boolValue)
- {
- m_RtlText = string.Empty;
- string sourceText = m_TextProp.stringValue;
-
- // Reverse Text displayed in Text Input Box
- for (int i = 0; i < sourceText.Length; i++)
- {
- m_RtlText += sourceText[sourceText.Length - i - 1];
- }
- }
- }
-
- // Toggle showing Rich Tags
- m_IsRightToLeftProp.boolValue = EditorGUILayout.Toggle(k_RtlToggleLabel, m_IsRightToLeftProp.boolValue);
-
- if (m_IsRightToLeftProp.boolValue)
- {
- EditorGUI.BeginChangeCheck();
- m_RtlText = EditorGUILayout.TextArea(m_RtlText, TMP_UIStyleManager.wrappingTextArea, GUILayout.Height(EditorGUI.GetPropertyHeight(m_TextProp) - EditorGUIUtility.singleLineHeight), GUILayout.ExpandWidth(true));
- if (EditorGUI.EndChangeCheck())
- {
- // Convert RTL input
- string sourceText = string.Empty;
-
- // Reverse Text displayed in Text Input Box
- for (int i = 0; i < m_RtlText.Length; i++)
- {
- sourceText += m_RtlText[m_RtlText.Length - i - 1];
- }
-
- m_TextProp.stringValue = sourceText;
- }
- }
- }
- }
-
- protected void DrawMainSettings()
- {
- // MAIN SETTINGS SECTION
- GUILayout.Label(k_MainSettingsLabel, EditorStyles.boldLabel);
-
- EditorGUI.indentLevel += 1;
-
- DrawFont();
-
- DrawColor();
-
- DrawSpacing();
-
- DrawAlignment();
-
- DrawWrappingOverflow();
-
- DrawTextureMapping();
-
- EditorGUI.indentLevel -= 1;
- }
-
- void DrawFont()
- {
- // Update list of material presets if needed.
- if (m_IsPresetListDirty)
- m_MaterialPresetNames = GetMaterialPresets();
-
- // FONT ASSET
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_FontAssetProp, k_FontAssetLabel);
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- m_HasFontAssetChangedProp.boolValue = true;
-
- m_IsPresetListDirty = true;
- m_MaterialPresetSelectionIndex = 0;
- }
-
- Rect rect;
-
- // MATERIAL PRESET
- if (m_MaterialPresetNames != null)
- {
- EditorGUI.BeginChangeCheck();
- rect = EditorGUILayout.GetControlRect(false, 17);
-
- float oldHeight = EditorStyles.popup.fixedHeight;
- EditorStyles.popup.fixedHeight = rect.height;
-
- int oldSize = EditorStyles.popup.fontSize;
- EditorStyles.popup.fontSize = 11;
-
- m_MaterialPresetSelectionIndex = EditorGUI.Popup(rect, k_MaterialPresetLabel, m_MaterialPresetSelectionIndex, m_MaterialPresetNames);
- if (EditorGUI.EndChangeCheck())
- {
- m_FontSharedMaterialProp.objectReferenceValue = m_MaterialPresets[m_MaterialPresetSelectionIndex];
- m_HavePropertiesChanged = true;
- }
-
- //Make sure material preset selection index matches the selection
- if (m_MaterialPresetSelectionIndex < m_MaterialPresetNames.Length && m_TargetMaterial != m_MaterialPresets[m_MaterialPresetSelectionIndex] && !m_HavePropertiesChanged)
- m_IsPresetListDirty = true;
-
- EditorStyles.popup.fixedHeight = oldHeight;
- EditorStyles.popup.fontSize = oldSize;
- }
-
- // FONT STYLE
- EditorGUI.BeginChangeCheck();
-
- int v1, v2, v3, v4, v5, v6, v7;
-
- if (EditorGUIUtility.wideMode)
- {
- rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight + 2f);
-
- EditorGUI.PrefixLabel(rect, k_FontStyleLabel);
-
- int styleValue = m_FontStyleProp.intValue;
-
- rect.x += EditorGUIUtility.labelWidth;
- rect.width -= EditorGUIUtility.labelWidth;
-
- rect.width = Mathf.Max(25f, rect.width / 7f);
-
- v1 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 1) == 1, k_BoldLabel, TMP_UIStyleManager.alignmentButtonLeft) ? 1 : 0; // Bold
- rect.x += rect.width;
- v2 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 2) == 2, k_ItalicLabel, TMP_UIStyleManager.alignmentButtonMid) ? 2 : 0; // Italics
- rect.x += rect.width;
- v3 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 4) == 4, k_UnderlineLabel, TMP_UIStyleManager.alignmentButtonMid) ? 4 : 0; // Underline
- rect.x += rect.width;
- v7 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 64) == 64, k_StrikethroughLabel, TMP_UIStyleManager.alignmentButtonRight) ? 64 : 0; // Strikethrough
- rect.x += rect.width;
-
- int selected = 0;
-
- EditorGUI.BeginChangeCheck();
- v4 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 8) == 8, k_LowercaseLabel, TMP_UIStyleManager.alignmentButtonLeft) ? 8 : 0; // Lowercase
- if (EditorGUI.EndChangeCheck() && v4 > 0)
- {
- selected = v4;
- }
- rect.x += rect.width;
- EditorGUI.BeginChangeCheck();
- v5 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 16) == 16, k_UppercaseLabel, TMP_UIStyleManager.alignmentButtonMid) ? 16 : 0; // Uppercase
- if (EditorGUI.EndChangeCheck() && v5 > 0)
- {
- selected = v5;
- }
- rect.x += rect.width;
- EditorGUI.BeginChangeCheck();
- v6 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 32) == 32, k_SmallcapsLabel, TMP_UIStyleManager.alignmentButtonRight) ? 32 : 0; // Smallcaps
- if (EditorGUI.EndChangeCheck() && v6 > 0)
- {
- selected = v6;
- }
-
- if (selected > 0)
- {
- v4 = selected == 8 ? 8 : 0;
- v5 = selected == 16 ? 16 : 0;
- v6 = selected == 32 ? 32 : 0;
- }
- }
- else
- {
- rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight + 2f);
-
- EditorGUI.PrefixLabel(rect, k_FontStyleLabel);
-
- int styleValue = m_FontStyleProp.intValue;
-
- rect.x += EditorGUIUtility.labelWidth;
- rect.width -= EditorGUIUtility.labelWidth;
- rect.width = Mathf.Max(25f, rect.width / 4f);
-
- v1 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 1) == 1, k_BoldLabel, TMP_UIStyleManager.alignmentButtonLeft) ? 1 : 0; // Bold
- rect.x += rect.width;
- v2 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 2) == 2, k_ItalicLabel, TMP_UIStyleManager.alignmentButtonMid) ? 2 : 0; // Italics
- rect.x += rect.width;
- v3 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 4) == 4, k_UnderlineLabel, TMP_UIStyleManager.alignmentButtonMid) ? 4 : 0; // Underline
- rect.x += rect.width;
- v7 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 64) == 64, k_StrikethroughLabel, TMP_UIStyleManager.alignmentButtonRight) ? 64 : 0; // Strikethrough
-
- rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight + 2f);
-
- rect.x += EditorGUIUtility.labelWidth;
- rect.width -= EditorGUIUtility.labelWidth;
-
- rect.width = Mathf.Max(25f, rect.width / 4f);
-
- int selected = 0;
-
- EditorGUI.BeginChangeCheck();
- v4 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 8) == 8, k_LowercaseLabel, TMP_UIStyleManager.alignmentButtonLeft) ? 8 : 0; // Lowercase
- if (EditorGUI.EndChangeCheck() && v4 > 0)
- {
- selected = v4;
- }
- rect.x += rect.width;
- EditorGUI.BeginChangeCheck();
- v5 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 16) == 16, k_UppercaseLabel, TMP_UIStyleManager.alignmentButtonMid) ? 16 : 0; // Uppercase
- if (EditorGUI.EndChangeCheck() && v5 > 0)
- {
- selected = v5;
- }
- rect.x += rect.width;
- EditorGUI.BeginChangeCheck();
- v6 = TMP_EditorUtility.EditorToggle(rect, (styleValue & 32) == 32, k_SmallcapsLabel, TMP_UIStyleManager.alignmentButtonRight) ? 32 : 0; // Smallcaps
- if (EditorGUI.EndChangeCheck() && v6 > 0)
- {
- selected = v6;
- }
-
- if (selected > 0)
- {
- v4 = selected == 8 ? 8 : 0;
- v5 = selected == 16 ? 16 : 0;
- v6 = selected == 32 ? 32 : 0;
- }
- }
-
- if (EditorGUI.EndChangeCheck())
- {
- m_FontStyleProp.intValue = v1 + v2 + v3 + v4 + v5 + v6 + v7;
- m_HavePropertiesChanged = true;
- }
-
- // FONT SIZE
- EditorGUI.BeginChangeCheck();
-
- EditorGUI.BeginDisabledGroup(m_AutoSizingProp.boolValue);
- EditorGUILayout.PropertyField(m_FontSizeProp, k_FontSizeLabel, GUILayout.MaxWidth(EditorGUIUtility.labelWidth + 50f));
- EditorGUI.EndDisabledGroup();
-
- if (EditorGUI.EndChangeCheck())
- {
- m_FontSizeBaseProp.floatValue = m_FontSizeProp.floatValue;
- m_HavePropertiesChanged = true;
- }
-
- EditorGUI.indentLevel += 1;
-
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_AutoSizingProp, k_AutoSizeLabel);
- if (EditorGUI.EndChangeCheck())
- {
- if (m_AutoSizingProp.boolValue == false)
- m_FontSizeProp.floatValue = m_FontSizeBaseProp.floatValue;
-
- m_HavePropertiesChanged = true;
- }
-
- // Show auto sizing options
- if (m_AutoSizingProp.boolValue)
- {
- rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
-
- EditorGUI.PrefixLabel(rect, k_AutoSizeOptionsLabel);
-
- int previousIndent = EditorGUI.indentLevel;
-
- EditorGUI.indentLevel = 0;
-
- rect.width = (rect.width - EditorGUIUtility.labelWidth) / 4f;
- rect.x += EditorGUIUtility.labelWidth;
-
- EditorGUIUtility.labelWidth = 24;
- EditorGUI.BeginChangeCheck();
- EditorGUI.PropertyField(rect, m_FontSizeMinProp, k_MinLabel);
- if (EditorGUI.EndChangeCheck())
- {
- m_FontSizeMinProp.floatValue = Mathf.Min(m_FontSizeMinProp.floatValue, m_FontSizeMaxProp.floatValue);
- m_HavePropertiesChanged = true;
- }
- rect.x += rect.width;
-
- EditorGUIUtility.labelWidth = 27;
- EditorGUI.BeginChangeCheck();
- EditorGUI.PropertyField(rect, m_FontSizeMaxProp, k_MaxLabel);
- if (EditorGUI.EndChangeCheck())
- {
- m_FontSizeMaxProp.floatValue = Mathf.Max(m_FontSizeMinProp.floatValue, m_FontSizeMaxProp.floatValue);
- m_HavePropertiesChanged = true;
- }
- rect.x += rect.width;
-
- EditorGUI.BeginChangeCheck();
- EditorGUIUtility.labelWidth = 36;
- EditorGUI.PropertyField(rect, m_CharWidthMaxAdjProp, k_WdLabel);
- rect.x += rect.width;
- EditorGUIUtility.labelWidth = 28;
- EditorGUI.PropertyField(rect, m_LineSpacingMaxProp, k_LineLabel);
-
- EditorGUIUtility.labelWidth = 0;
-
- if (EditorGUI.EndChangeCheck())
- {
- m_CharWidthMaxAdjProp.floatValue = Mathf.Clamp(m_CharWidthMaxAdjProp.floatValue, 0, 50);
- m_LineSpacingMaxProp.floatValue = Mathf.Min(0, m_LineSpacingMaxProp.floatValue);
- m_HavePropertiesChanged = true;
- }
-
- EditorGUI.indentLevel = previousIndent;
- }
-
- EditorGUI.indentLevel -= 1;
-
-
-
- EditorGUILayout.Space();
- }
-
- void DrawColor()
- {
- // FACE VERTEX COLOR
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_FontColorProp, k_BaseColorLabel);
-
- EditorGUILayout.PropertyField(m_EnableVertexGradientProp, k_ColorGradientLabel);
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- }
-
- EditorGUIUtility.fieldWidth = 0;
-
- if (m_EnableVertexGradientProp.boolValue)
- {
- EditorGUI.indentLevel += 1;
-
- EditorGUI.BeginChangeCheck();
-
- EditorGUILayout.PropertyField(m_FontColorGradientPresetProp, k_ColorPresetLabel);
-
- SerializedObject obj = null;
-
- SerializedProperty colorMode;
-
- SerializedProperty topLeft;
- SerializedProperty topRight;
- SerializedProperty bottomLeft;
- SerializedProperty bottomRight;
-
- if (m_FontColorGradientPresetProp.objectReferenceValue == null)
- {
- colorMode = m_ColorModeProp;
- topLeft = m_FontColorGradientProp.FindPropertyRelative("topLeft");
- topRight = m_FontColorGradientProp.FindPropertyRelative("topRight");
- bottomLeft = m_FontColorGradientProp.FindPropertyRelative("bottomLeft");
- bottomRight = m_FontColorGradientProp.FindPropertyRelative("bottomRight");
- }
- else
- {
- obj = new SerializedObject(m_FontColorGradientPresetProp.objectReferenceValue);
- colorMode = obj.FindProperty("colorMode");
- topLeft = obj.FindProperty("topLeft");
- topRight = obj.FindProperty("topRight");
- bottomLeft = obj.FindProperty("bottomLeft");
- bottomRight = obj.FindProperty("bottomRight");
- }
-
- EditorGUILayout.PropertyField(colorMode, k_ColorModeLabel);
-
- var rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
-
- EditorGUI.PrefixLabel(rect, k_CorenerColorsLabel);
-
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = rect.width - EditorGUIUtility.labelWidth;
-
- switch ((ColorMode)colorMode.enumValueIndex)
- {
- case ColorMode.Single:
- TMP_EditorUtility.DrawColorProperty(rect, topLeft);
-
- topRight.colorValue = topLeft.colorValue;
- bottomLeft.colorValue = topLeft.colorValue;
- bottomRight.colorValue = topLeft.colorValue;
- break;
- case ColorMode.HorizontalGradient:
- rect.width /= 2f;
-
- TMP_EditorUtility.DrawColorProperty(rect, topLeft);
-
- rect.x += rect.width;
-
- TMP_EditorUtility.DrawColorProperty(rect, topRight);
-
- bottomLeft.colorValue = topLeft.colorValue;
- bottomRight.colorValue = topRight.colorValue;
- break;
- case ColorMode.VerticalGradient:
- TMP_EditorUtility.DrawColorProperty(rect, topLeft);
-
- rect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
- rect.x += EditorGUIUtility.labelWidth;
-
- TMP_EditorUtility.DrawColorProperty(rect, bottomLeft);
-
- topRight.colorValue = topLeft.colorValue;
- bottomRight.colorValue = bottomLeft.colorValue;
- break;
- case ColorMode.FourCornersGradient:
- rect.width /= 2f;
-
- TMP_EditorUtility.DrawColorProperty(rect, topLeft);
-
- rect.x += rect.width;
-
- TMP_EditorUtility.DrawColorProperty(rect, topRight);
-
- rect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2f;
-
- TMP_EditorUtility.DrawColorProperty(rect, bottomLeft);
-
- rect.x += rect.width;
-
- TMP_EditorUtility.DrawColorProperty(rect, bottomRight);
- break;
- }
-
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- if (obj != null)
- {
- obj.ApplyModifiedProperties();
- TMPro_EventManager.ON_COLOR_GRAIDENT_PROPERTY_CHANGED(m_FontColorGradientPresetProp.objectReferenceValue as TMP_ColorGradient);
- }
- }
-
- EditorGUI.indentLevel -= 1;
- }
-
- EditorGUILayout.PropertyField(m_OverrideHtmlColorProp, k_OverrideTagsLabel);
-
- EditorGUILayout.Space();
- }
-
- void DrawSpacing()
- {
- // CHARACTER, LINE & PARAGRAPH SPACING
- EditorGUI.BeginChangeCheck();
-
- Rect rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
-
- EditorGUI.PrefixLabel(rect, k_SpacingOptionsLabel);
-
- int oldIndent = EditorGUI.indentLevel;
- EditorGUI.indentLevel = 0;
-
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = (rect.width - EditorGUIUtility.labelWidth - 3f) / 2f;
-
- EditorGUIUtility.labelWidth = Mathf.Min(rect.width * 0.55f, 80f);
-
- EditorGUI.PropertyField(rect, m_CharacterSpacingProp, k_CharacterSpacingLabel);
- rect.x += rect.width + 3f;
- EditorGUI.PropertyField(rect, m_WordSpacingProp, k_WordSpacingLabel);
-
- rect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight);
- EditorGUIUtility.labelWidth = 0;
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = (rect.width - EditorGUIUtility.labelWidth -3f) / 2f;
- EditorGUIUtility.labelWidth = Mathf.Min(rect.width * 0.55f, 80f);
-
- EditorGUI.PropertyField(rect, m_LineSpacingProp, k_LineSpacingLabel);
- rect.x += rect.width + 3f;
- EditorGUI.PropertyField(rect, m_ParagraphSpacingProp, k_ParagraphSpacingLabel);
-
- EditorGUIUtility.labelWidth = 0;
- EditorGUI.indentLevel = oldIndent;
-
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- }
- }
-
- void DrawAlignment()
- {
- // TEXT ALIGNMENT
- EditorGUI.BeginChangeCheck();
-
- EditorGUILayout.PropertyField(m_TextAlignmentProp, k_AlignmentLabel);
-
- // WRAPPING RATIOS shown if Justified mode is selected.
- if (((_HorizontalAlignmentOptions)m_TextAlignmentProp.intValue & _HorizontalAlignmentOptions.Justified) == _HorizontalAlignmentOptions.Justified || ((_HorizontalAlignmentOptions)m_TextAlignmentProp.intValue & _HorizontalAlignmentOptions.Flush) == _HorizontalAlignmentOptions.Flush)
- DrawPropertySlider(k_WrapMixLabel, m_WordWrappingRatiosProp);
-
- if (EditorGUI.EndChangeCheck())
- m_HavePropertiesChanged = true;
-
- EditorGUILayout.Space();
- }
-
- void DrawWrappingOverflow()
- {
- // TEXT WRAPPING
- EditorGUI.BeginChangeCheck();
- int wrapSelection = EditorGUILayout.Popup(k_WrappingLabel, m_EnableWordWrappingProp.boolValue ? 1 : 0, k_WrappingOptions);
- if (EditorGUI.EndChangeCheck())
- {
- m_EnableWordWrappingProp.boolValue = wrapSelection == 1;
- m_HavePropertiesChanged = true;
- m_TextComponent.m_isInputParsingRequired = true;
- }
-
- // TEXT OVERFLOW
- EditorGUI.BeginChangeCheck();
-
- // Cache Reference to Linked Text Component
- TMP_Text oldLinkedComponent = m_LinkedTextComponentProp.objectReferenceValue as TMP_Text;
-
- if ((TextOverflowModes)m_TextOverflowModeProp.enumValueIndex == TextOverflowModes.Linked)
- {
- EditorGUILayout.BeginHorizontal();
- EditorGUILayout.PropertyField(m_TextOverflowModeProp, k_OverflowLabel);
-
- EditorGUILayout.PropertyField(m_LinkedTextComponentProp, GUIContent.none);
-
- EditorGUILayout.EndHorizontal();
-
- if (GUI.changed)
- {
- TMP_Text linkedComponent = m_LinkedTextComponentProp.objectReferenceValue as TMP_Text;
-
- if (linkedComponent)
- m_TextComponent.linkedTextComponent = linkedComponent;
-
- }
- }
- else if ((TextOverflowModes)m_TextOverflowModeProp.enumValueIndex == TextOverflowModes.Page)
- {
- EditorGUILayout.BeginHorizontal();
- EditorGUILayout.PropertyField(m_TextOverflowModeProp, k_OverflowLabel);
- EditorGUILayout.PropertyField(m_PageToDisplayProp, GUIContent.none);
- EditorGUILayout.EndHorizontal();
-
- if (oldLinkedComponent)
- m_TextComponent.linkedTextComponent = null;
- }
- else
- {
- EditorGUILayout.PropertyField(m_TextOverflowModeProp, k_OverflowLabel);
-
- if (oldLinkedComponent)
- m_TextComponent.linkedTextComponent = null;
- }
-
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- m_TextComponent.m_isInputParsingRequired = true;
- }
-
- EditorGUILayout.Space();
- }
-
- protected abstract void DrawExtraSettings();
-
- protected void DrawMargins()
- {
- EditorGUI.BeginChangeCheck();
- DrawMarginProperty(m_MarginProp, k_MarginsLabel);
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- }
-
- EditorGUILayout.Space();
- }
-
- protected void DrawGeometrySorting()
- {
- EditorGUI.BeginChangeCheck();
-
- EditorGUILayout.PropertyField(m_GeometrySortingOrderProp, k_GeometrySortingLabel);
-
- if (EditorGUI.EndChangeCheck())
- m_HavePropertiesChanged = true;
-
- EditorGUILayout.Space();
- }
-
- protected void DrawRichText()
- {
- EditorGUI.BeginChangeCheck();
-
- EditorGUILayout.PropertyField(m_IsRichTextProp, k_RichTextLabel);
- if (EditorGUI.EndChangeCheck())
- m_HavePropertiesChanged = true;
- }
-
- protected void DrawParsing()
- {
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_EnableEscapeCharacterParsingProp, k_EscapeCharactersLabel);
- EditorGUILayout.PropertyField(m_UseMaxVisibleDescenderProp, k_VisibleDescenderLabel);
-
- EditorGUILayout.Space();
-
- EditorGUILayout.PropertyField(m_SpriteAssetProp, k_SpriteAssetLabel, true);
-
- if (EditorGUI.EndChangeCheck())
- m_HavePropertiesChanged = true;
-
- EditorGUILayout.Space();
- }
-
- protected void DrawTextureMapping()
- {
- // TEXTURE MAPPING OPTIONS
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_HorizontalMappingProp, k_HorizontalMappingLabel);
- EditorGUILayout.PropertyField(m_VerticalMappingProp, k_VerticalMappingLabel);
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- }
-
- // UV OPTIONS
- if (m_HorizontalMappingProp.enumValueIndex > 0)
- {
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_UvLineOffsetProp, k_LineOffsetLabel, GUILayout.MinWidth(70f));
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- }
- }
-
- EditorGUILayout.Space();
- }
-
- protected void DrawKerning()
- {
- // KERNING
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_EnableKerningProp, k_KerningLabel);
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- }
- }
-
- protected void DrawPadding()
- {
- // EXTRA PADDING
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_EnableExtraPaddingProp, k_PaddingLabel);
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- m_CheckPaddingRequiredProp.boolValue = true;
- }
- }
-
- /// <summary>
- /// Method to retrieve the material presets that match the currently selected font asset.
- /// </summary>
- protected GUIContent[] GetMaterialPresets()
- {
- TMP_FontAsset fontAsset = m_FontAssetProp.objectReferenceValue as TMP_FontAsset;
- if (fontAsset == null) return null;
-
- m_MaterialPresets = TMP_EditorUtility.FindMaterialReferences(fontAsset);
- m_MaterialPresetNames = new GUIContent[m_MaterialPresets.Length];
-
- for (int i = 0; i < m_MaterialPresetNames.Length; i++)
- {
- m_MaterialPresetNames[i] = new GUIContent(m_MaterialPresets[i].name);
-
- if (m_TargetMaterial.GetInstanceID() == m_MaterialPresets[i].GetInstanceID())
- m_MaterialPresetSelectionIndex = i;
- }
-
- m_IsPresetListDirty = false;
-
- return m_MaterialPresetNames;
- }
-
- // DRAW MARGIN PROPERTY
- protected void DrawMarginProperty(SerializedProperty property, GUIContent label)
- {
- Rect rect = EditorGUILayout.GetControlRect(false, 2 * 18);
-
- EditorGUI.BeginProperty(rect, label, property);
-
- Rect pos0 = new Rect(rect.x + 15, rect.y + 2, rect.width - 15, 18);
-
- float width = rect.width + 3;
- pos0.width = EditorGUIUtility.labelWidth;
- GUI.Label(pos0, label);
-
- var vec = property.vector4Value;
-
- float widthB = width - EditorGUIUtility.labelWidth;
- float fieldWidth = widthB / 4;
- pos0.width = Mathf.Max(fieldWidth - 5, 45f);
-
- // Labels
- pos0.x = EditorGUIUtility.labelWidth + 15;
- GUI.Label(pos0, k_LeftLabel);
-
- pos0.x += fieldWidth;
- GUI.Label(pos0, k_TopLabel);
-
- pos0.x += fieldWidth;
- GUI.Label(pos0, k_RightLabel);
-
- pos0.x += fieldWidth;
- GUI.Label(pos0, k_BottomLabel);
-
- pos0.y += 18;
-
- pos0.x = EditorGUIUtility.labelWidth;
- vec.x = EditorGUI.FloatField(pos0, GUIContent.none, vec.x);
-
- pos0.x += fieldWidth;
- vec.y = EditorGUI.FloatField(pos0, GUIContent.none, vec.y);
-
- pos0.x += fieldWidth;
- vec.z = EditorGUI.FloatField(pos0, GUIContent.none, vec.z);
-
- pos0.x += fieldWidth;
- vec.w = EditorGUI.FloatField(pos0, GUIContent.none, vec.w);
-
- property.vector4Value = vec;
-
- EditorGUI.EndProperty();
- }
-
- protected void DrawPropertySlider(GUIContent label, SerializedProperty property)
- {
- Rect rect = EditorGUILayout.GetControlRect(false, 17);
-
- GUIContent content = label ?? GUIContent.none;
- EditorGUI.Slider(new Rect(rect.x, rect.y, rect.width, rect.height), property, 0.0f, 1.0f, content);
- }
-
- protected abstract bool IsMixSelectionTypes();
-
- // Special Handling of Undo / Redo Events.
- protected abstract void OnUndoRedo();
-
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseEditorPanel.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseEditorPanel.cs.meta
deleted file mode 100644
index d4a89aa..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseEditorPanel.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 91950f78729ab144aa36e94690b28fad
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseShaderGUI.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseShaderGUI.cs
deleted file mode 100644
index c27e651..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseShaderGUI.cs
+++ /dev/null
@@ -1,534 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-
-namespace TMPro.EditorUtilities
-{
- /// <summary>Base class for TextMesh Pro shader GUIs.</summary>
- public abstract class TMP_BaseShaderGUI : ShaderGUI
- {
- /// <summary>Representation of a #pragma shader_feature.</summary>
- /// <description>It is assumed that the first feature option is for no keyword (underscores).</description>
- protected class ShaderFeature
- {
- public string undoLabel;
-
- public GUIContent label;
-
- /// <summary>The keyword labels, for display. Include the no-keyword as the first option.</summary>
- public GUIContent[] keywordLabels;
-
- /// <summary>The shader keywords. Exclude the no-keyword option.</summary>
- public string[] keywords;
-
- int m_State;
-
- public bool Active
- {
- get { return m_State >= 0; }
- }
-
- public int State
- {
- get { return m_State; }
- }
-
- public void ReadState(Material material)
- {
- for (int i = 0; i < keywords.Length; i++)
- {
- if (material.IsKeywordEnabled(keywords[i]))
- {
- m_State = i;
- return;
- }
- }
-
- m_State = -1;
- }
-
- public void SetActive(bool active, Material material)
- {
- m_State = active ? 0 : -1;
- SetStateKeywords(material);
- }
-
- public void DoPopup(MaterialEditor editor, Material material)
- {
- EditorGUI.BeginChangeCheck();
- int selection = EditorGUILayout.Popup(label, m_State + 1, keywordLabels);
- if (EditorGUI.EndChangeCheck())
- {
- m_State = selection - 1;
- editor.RegisterPropertyChangeUndo(undoLabel);
- SetStateKeywords(material);
- }
- }
-
- void SetStateKeywords(Material material)
- {
- for (int i = 0; i < keywords.Length; i++)
- {
- if (i == m_State)
- {
- material.EnableKeyword(keywords[i]);
- }
- else
- {
- material.DisableKeyword(keywords[i]);
- }
- }
- }
- }
-
- static GUIContent s_TempLabel = new GUIContent();
-
- protected static bool s_DebugExtended;
-
- static int s_UndoRedoCount, s_LastSeenUndoRedoCount;
-
- static float[][] s_TempFloats =
- {
- null, new float[1], new float[2], new float[3], new float[4]
- };
-
- protected static GUIContent[] s_XywhVectorLabels =
- {
- new GUIContent("X"),
- new GUIContent("Y"),
- new GUIContent("W", "Width"),
- new GUIContent("H", "Height")
- };
-
- protected static GUIContent[] s_LbrtVectorLabels =
- {
- new GUIContent("L", "Left"),
- new GUIContent("B", "Bottom"),
- new GUIContent("R", "Right"),
- new GUIContent("T", "Top")
- };
-
- static TMP_BaseShaderGUI()
- {
- // Keep track of how many undo/redo events happened.
- Undo.undoRedoPerformed += () => s_UndoRedoCount += 1;
- }
-
- bool m_IsNewGUI = true;
-
- float m_DragAndDropMinY;
-
- protected MaterialEditor m_Editor;
-
- protected Material m_Material;
-
- protected MaterialProperty[] m_Properties;
-
- void PrepareGUI()
- {
- m_IsNewGUI = false;
- ShaderUtilities.GetShaderPropertyIDs();
-
- // New GUI just got constructed. This happens in response to a selection,
- // but also after undo/redo events.
- if (s_LastSeenUndoRedoCount != s_UndoRedoCount)
- {
- // There's been at least one undo/redo since the last time this GUI got constructed.
- // Maybe the undo/redo was for this material? Assume that is was.
- TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, m_Material as Material);
- }
-
- s_LastSeenUndoRedoCount = s_UndoRedoCount;
- }
-
- public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
- {
- m_Editor = materialEditor;
- m_Material = materialEditor.target as Material;
- this.m_Properties = properties;
-
- if (m_IsNewGUI)
- {
- PrepareGUI();
- }
-
- DoDragAndDropBegin();
- EditorGUI.BeginChangeCheck();
- DoGUI();
- if (EditorGUI.EndChangeCheck())
- {
- TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, m_Material);
- }
-
- DoDragAndDropEnd();
- }
-
- /// <summary>Override this method to create the specific shader GUI.</summary>
- protected abstract void DoGUI();
-
- static string[] s_PanelStateLabel = new string[] { "\t- <i>Click to collapse</i> -", "\t- <i>Click to expand</i> -" };
-
- protected bool BeginPanel(string panel, bool expanded)
- {
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
-
- Rect r = EditorGUI.IndentedRect(GUILayoutUtility.GetRect(20, 18));
- r.x += 20;
- r.width += 6;
-
- bool enabled = GUI.enabled;
- GUI.enabled = true;
- expanded = TMP_EditorUtility.EditorToggle(r, expanded, new GUIContent(panel), TMP_UIStyleManager.panelTitle);
- r.width -= 30;
- EditorGUI.LabelField(r, new GUIContent(expanded ? s_PanelStateLabel[0] : s_PanelStateLabel[1]), TMP_UIStyleManager.rightLabel);
- GUI.enabled = enabled;
-
- EditorGUI.indentLevel += 1;
- EditorGUI.BeginDisabledGroup(false);
-
- return expanded;
- }
-
- protected bool BeginPanel(string panel, ShaderFeature feature, bool expanded, bool readState = true)
- {
- if (readState)
- {
- feature.ReadState(m_Material);
- }
-
- EditorGUI.BeginChangeCheck();
-
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.BeginHorizontal();
-
- Rect r = EditorGUI.IndentedRect(GUILayoutUtility.GetRect(20, 20, GUILayout.Width(20f)));
- bool active = EditorGUI.Toggle(r, feature.Active);
-
- if (EditorGUI.EndChangeCheck())
- {
- m_Editor.RegisterPropertyChangeUndo(feature.undoLabel);
- feature.SetActive(active, m_Material);
- }
-
- r = EditorGUI.IndentedRect(GUILayoutUtility.GetRect(20, 18));
- r.width += 6;
-
- bool enabled = GUI.enabled;
- GUI.enabled = true;
- expanded = TMP_EditorUtility.EditorToggle(r, expanded, new GUIContent(panel), TMP_UIStyleManager.panelTitle);
- r.width -= 10;
- EditorGUI.LabelField(r, new GUIContent(expanded ? s_PanelStateLabel[0] : s_PanelStateLabel[1]), TMP_UIStyleManager.rightLabel);
- GUI.enabled = enabled;
-
- GUILayout.EndHorizontal();
-
- EditorGUI.indentLevel += 1;
- EditorGUI.BeginDisabledGroup(!active);
-
- return expanded;
- }
-
- public void EndPanel()
- {
- EditorGUI.EndDisabledGroup();
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.EndVertical();
- }
-
- MaterialProperty BeginProperty(string name)
- {
- MaterialProperty property = FindProperty(name, m_Properties);
- EditorGUI.BeginChangeCheck();
- EditorGUI.showMixedValue = property.hasMixedValue;
- m_Editor.BeginAnimatedCheck(Rect.zero, property);
-
- return property;
- }
-
- bool EndProperty()
- {
- m_Editor.EndAnimatedCheck();
- EditorGUI.showMixedValue = false;
- return EditorGUI.EndChangeCheck();
- }
-
- protected void DoPopup(string name, string label, GUIContent[] options)
- {
- MaterialProperty property = BeginProperty(name);
- s_TempLabel.text = label;
- int index = EditorGUILayout.Popup(s_TempLabel, (int)property.floatValue, options);
- if (EndProperty())
- {
- property.floatValue = index;
- }
- }
-
- protected void DoCubeMap(string name, string label)
- {
- DoTexture(name, label, typeof(Cubemap));
- }
-
- protected void DoTexture2D(string name, string label, bool withTilingOffset = false, string[] speedNames = null)
- {
- DoTexture(name, label, typeof(Texture2D), withTilingOffset, speedNames);
- }
-
- void DoTexture(string name, string label, System.Type type, bool withTilingOffset = false, string[] speedNames = null)
- {
- MaterialProperty property = BeginProperty(name);
- Rect rect = EditorGUILayout.GetControlRect(true, 60f);
- float totalWidth = rect.width;
- rect.width = EditorGUIUtility.labelWidth + 60f;
- s_TempLabel.text = label;
- Object tex = EditorGUI.ObjectField(rect, s_TempLabel, property.textureValue, type, false);
-
- if (EndProperty())
- {
- property.textureValue = tex as Texture;
- }
-
- rect.x += rect.width + 4f;
- rect.width = totalWidth - rect.width - 4f;
- rect.height = EditorGUIUtility.singleLineHeight;
-
- if (withTilingOffset)
- {
- DoTilingOffset(rect, property);
- rect.y += (rect.height + 2f) * 2f;
- }
-
- if (speedNames != null)
- {
- DoUVSpeed(rect, speedNames);
- }
- }
-
- void DoTilingOffset(Rect rect, MaterialProperty property)
- {
- float labelWidth = EditorGUIUtility.labelWidth;
- int indentLevel = EditorGUI.indentLevel;
- EditorGUI.indentLevel = 0;
- EditorGUIUtility.labelWidth = Mathf.Min(40f, rect.width * 0.20f);
-
- Vector4 vector = property.textureScaleAndOffset;
-
- bool changed = false;
- float[] values = s_TempFloats[2];
-
- s_TempLabel.text = "Tiling";
- Rect vectorRect = EditorGUI.PrefixLabel(rect, s_TempLabel);
- values[0] = vector.x;
- values[1] = vector.y;
- EditorGUI.BeginChangeCheck();
- EditorGUI.MultiFloatField(vectorRect, s_XywhVectorLabels, values);
- if (EndProperty())
- {
- vector.x = values[0];
- vector.y = values[1];
- changed = true;
- }
-
- rect.y += rect.height + 2f;
- s_TempLabel.text = "Offset";
- vectorRect = EditorGUI.PrefixLabel(rect, s_TempLabel);
- values[0] = vector.z;
- values[1] = vector.w;
- EditorGUI.BeginChangeCheck();
- EditorGUI.MultiFloatField(vectorRect, s_XywhVectorLabels, values);
- if (EndProperty())
- {
- vector.z = values[0];
- vector.w = values[1];
- changed = true;
- }
-
- if (changed)
- {
- property.textureScaleAndOffset = vector;
- }
-
- EditorGUIUtility.labelWidth = labelWidth;
- EditorGUI.indentLevel = indentLevel;
- }
-
- protected void DoUVSpeed(Rect rect, string[] names)
- {
- float labelWidth = EditorGUIUtility.labelWidth;
- int indentLevel = EditorGUI.indentLevel;
- EditorGUI.indentLevel = 0;
- EditorGUIUtility.labelWidth = Mathf.Min(40f, rect.width * 0.20f);
-
- s_TempLabel.text = "Speed";
- rect = EditorGUI.PrefixLabel(rect, s_TempLabel);
-
- EditorGUIUtility.labelWidth = 13f;
- rect.width = rect.width * 0.5f - 1f;
- DoFloat(rect, names[0], "X");
- rect.x += rect.width + 2f;
- DoFloat(rect, names[1], "Y");
- EditorGUIUtility.labelWidth = labelWidth;
- EditorGUI.indentLevel = indentLevel;
- }
-
- protected void DoToggle(string name, string label)
- {
- MaterialProperty property = BeginProperty(name);
- s_TempLabel.text = label;
- bool value = EditorGUILayout.Toggle(s_TempLabel, property.floatValue == 1f);
- if (EndProperty())
- {
- property.floatValue = value ? 1f : 0f;
- }
- }
-
- protected void DoFloat(string name, string label)
- {
- MaterialProperty property = BeginProperty(name);
- Rect rect = EditorGUILayout.GetControlRect();
- rect.width = EditorGUIUtility.labelWidth + 55f;
- s_TempLabel.text = label;
- float value = EditorGUI.FloatField(rect, s_TempLabel, property.floatValue);
- if (EndProperty())
- {
- property.floatValue = value;
- }
- }
-
- protected void DoColor(string name, string label)
- {
- MaterialProperty property = BeginProperty(name);
- s_TempLabel.text = label;
- Color value = EditorGUI.ColorField(EditorGUILayout.GetControlRect(), s_TempLabel, property.colorValue);
- if (EndProperty())
- {
- property.colorValue = value;
- }
- }
-
- void DoFloat(Rect rect, string name, string label)
- {
- MaterialProperty property = BeginProperty(name);
- s_TempLabel.text = label;
- float value = EditorGUI.FloatField(rect, s_TempLabel, property.floatValue);
- if (EndProperty())
- {
- property.floatValue = value;
- }
- }
-
- protected void DoSlider(string name, string label)
- {
- MaterialProperty property = BeginProperty(name);
- Vector2 range = property.rangeLimits;
- s_TempLabel.text = label;
- float value = EditorGUI.Slider(
- EditorGUILayout.GetControlRect(), s_TempLabel, property.floatValue, range.x, range.y
- );
- if (EndProperty())
- {
- property.floatValue = value;
- }
- }
-
- protected void DoVector3(string name, string label)
- {
- MaterialProperty property = BeginProperty(name);
- s_TempLabel.text = label;
- Vector4 value = EditorGUILayout.Vector3Field(s_TempLabel, property.vectorValue);
- if (EndProperty())
- {
- property.vectorValue = value;
- }
- }
-
- protected void DoVector(string name, string label, GUIContent[] subLabels)
- {
- MaterialProperty property = BeginProperty(name);
- Rect rect = EditorGUILayout.GetControlRect();
- s_TempLabel.text = label;
- rect = EditorGUI.PrefixLabel(rect, s_TempLabel);
- Vector4 vector = property.vectorValue;
-
- float[] values = s_TempFloats[subLabels.Length];
- for (int i = 0; i < subLabels.Length; i++)
- {
- values[i] = vector[i];
- }
-
- EditorGUI.MultiFloatField(rect, subLabels, values);
- if (EndProperty())
- {
- for (int i = 0; i < subLabels.Length; i++)
- {
- vector[i] = values[i];
- }
-
- property.vectorValue = vector;
- }
- }
-
- void DoDragAndDropBegin()
- {
- m_DragAndDropMinY = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true)).y;
- }
-
- void DoDragAndDropEnd()
- {
- Rect rect = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
- Event evt = Event.current;
- if (evt.type == EventType.DragUpdated)
- {
- DragAndDrop.visualMode = DragAndDropVisualMode.Generic;
- evt.Use();
- }
- else if (
- evt.type == EventType.DragPerform &&
- Rect.MinMaxRect(rect.xMin, m_DragAndDropMinY, rect.xMax, rect.yMax).Contains(evt.mousePosition)
- )
- {
- DragAndDrop.AcceptDrag();
- evt.Use();
- Material droppedMaterial = DragAndDrop.objectReferences[0] as Material;
- if (droppedMaterial && droppedMaterial != m_Material)
- {
- PerformDrop(droppedMaterial);
- }
- }
- }
-
- void PerformDrop(Material droppedMaterial)
- {
- Texture droppedTex = droppedMaterial.GetTexture(ShaderUtilities.ID_MainTex);
- if (!droppedTex)
- {
- return;
- }
-
- Texture currentTex = m_Material.GetTexture(ShaderUtilities.ID_MainTex);
- TMP_FontAsset requiredFontAsset = null;
- if (droppedTex != currentTex)
- {
- requiredFontAsset = TMP_EditorUtility.FindMatchingFontAsset(droppedMaterial);
- if (!requiredFontAsset)
- {
- return;
- }
- }
-
- foreach (GameObject o in Selection.gameObjects)
- {
- if (requiredFontAsset)
- {
- TMP_Text textComponent = o.GetComponent<TMP_Text>();
- if (textComponent)
- {
- Undo.RecordObject(textComponent, "Font Asset Change");
- textComponent.font = requiredFontAsset;
- }
- }
-
- TMPro_EventManager.ON_DRAG_AND_DROP_MATERIAL_CHANGED(o, m_Material, droppedMaterial);
- EditorUtility.SetDirty(o);
- }
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseShaderGUI.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseShaderGUI.cs.meta
deleted file mode 100644
index 0f0cae4..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BaseShaderGUI.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 438efd46088d408d8a53f707fa68d976
-timeCreated: 1469844810
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BitmapShaderGUI.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BitmapShaderGUI.cs
deleted file mode 100644
index 2380704..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BitmapShaderGUI.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-
-namespace TMPro.EditorUtilities
-{
- public class TMP_BitmapShaderGUI : TMP_BaseShaderGUI
- {
- static bool s_Face = true;
-
- protected override void DoGUI()
- {
- s_Face = BeginPanel("Face", s_Face);
- if (s_Face)
- {
- DoFacePanel();
- }
-
- EndPanel();
-
- s_DebugExtended = BeginPanel("Debug Settings", s_DebugExtended);
- if (s_DebugExtended)
- {
- DoDebugPanel();
- }
-
- EndPanel();
- }
-
- void DoFacePanel()
- {
- EditorGUI.indentLevel += 1;
- if (m_Material.HasProperty(ShaderUtilities.ID_FaceTex))
- {
- DoColor("_FaceColor", "Color");
- DoTexture2D("_FaceTex", "Texture", true);
- }
- else
- {
- DoColor("_Color", "Color");
- DoSlider("_DiffusePower", "Diffuse Power");
- }
-
- EditorGUI.indentLevel -= 1;
-
- EditorGUILayout.Space();
- }
-
- void DoDebugPanel()
- {
- EditorGUI.indentLevel += 1;
- DoTexture2D("_MainTex", "Font Atlas");
- if (m_Material.HasProperty(ShaderUtilities.ID_VertexOffsetX))
- {
- if (m_Material.HasProperty(ShaderUtilities.ID_Padding))
- {
- EditorGUILayout.Space();
- DoFloat("_Padding", "Padding");
- }
-
- EditorGUILayout.Space();
- DoFloat("_VertexOffsetX", "Offset X");
- DoFloat("_VertexOffsetY", "Offset Y");
- }
-
- if (m_Material.HasProperty(ShaderUtilities.ID_MaskSoftnessX))
- {
- EditorGUILayout.Space();
- DoFloat("_MaskSoftnessX", "Softness X");
- DoFloat("_MaskSoftnessY", "Softness Y");
- DoVector("_ClipRect", "Clip Rect", s_LbrtVectorLabels);
- }
-
- if (m_Material.HasProperty(ShaderUtilities.ID_StencilID))
- {
- EditorGUILayout.Space();
- DoFloat("_Stencil", "Stencil ID");
- DoFloat("_StencilComp", "Stencil Comp");
- }
-
- EditorGUI.indentLevel -= 1;
-
- EditorGUILayout.Space();
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BitmapShaderGUI.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BitmapShaderGUI.cs.meta
deleted file mode 100644
index 1af014d..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_BitmapShaderGUI.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 806de5a9211448c8b65c8435ebb48dd4
-timeCreated: 1469998850
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_CharacterPropertyDrawer.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_CharacterPropertyDrawer.cs
deleted file mode 100644
index 8abf4a5..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_CharacterPropertyDrawer.cs
+++ /dev/null
@@ -1,237 +0,0 @@
-using UnityEngine;
-using UnityEngine.TextCore;
-using UnityEngine.TextCore.LowLevel;
-using UnityEditor;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
- [CustomPropertyDrawer(typeof(TMP_Character))]
- public class TMP_CharacterPropertyDrawer : PropertyDrawer
- {
- //[SerializeField]
- //static Material s_InternalSDFMaterial;
-
- //[SerializeField]
- //static Material s_InternalBitmapMaterial;
-
- int m_GlyphSelectedForEditing = -1;
-
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- SerializedProperty prop_Unicode = property.FindPropertyRelative("m_Unicode");
- SerializedProperty prop_GlyphIndex = property.FindPropertyRelative("m_GlyphIndex");
- SerializedProperty prop_Scale = property.FindPropertyRelative("m_Scale");
-
-
- GUIStyle style = new GUIStyle(EditorStyles.label);
- style.richText = true;
-
- EditorGUIUtility.labelWidth = 40f;
- EditorGUIUtility.fieldWidth = 50;
-
- Rect rect = new Rect(position.x + 50, position.y, position.width, 49);
-
- // Display non-editable fields
- if (GUI.enabled == false)
- {
- int unicode = prop_Unicode.intValue;
- EditorGUI.LabelField(new Rect(rect.x, rect.y, 120f, 18), new GUIContent("Unicode: <color=#FFFF80>0x" + unicode.ToString("X") + "</color>"), style);
- EditorGUI.LabelField(new Rect(rect.x + 115, rect.y, 120f, 18), unicode <= 0xFFFF ? new GUIContent("UTF16: <color=#FFFF80>\\u" + unicode.ToString("X4") + "</color>") : new GUIContent("UTF32: <color=#FFFF80>\\U" + unicode.ToString("X8") + "</color>"), style);
- EditorGUI.LabelField(new Rect(rect.x, rect.y + 18, 120, 18), new GUIContent("Glyph ID: <color=#FFFF80>" + prop_GlyphIndex.intValue + "</color>"), style);
- EditorGUI.LabelField(new Rect(rect.x, rect.y + 36, 80, 18), new GUIContent("Scale: <color=#FFFF80>" + prop_Scale.floatValue + "</color>"), style);
-
- // Draw Glyph (if exists)
- DrawGlyph(position, property);
- }
- else // Display editable fields
- {
- EditorGUIUtility.labelWidth = 55f;
- GUI.SetNextControlName("Unicode Input");
- EditorGUI.BeginChangeCheck();
- string unicode = EditorGUI.TextField(new Rect(rect.x, rect.y, 120, 18), "Unicode:", prop_Unicode.intValue.ToString("X"));
-
- if (GUI.GetNameOfFocusedControl() == "Unicode Input")
- {
- //Filter out unwanted characters.
- char chr = Event.current.character;
- if ((chr < '0' || chr > '9') && (chr < 'a' || chr > 'f') && (chr < 'A' || chr > 'F'))
- {
- Event.current.character = '\0';
- }
- }
-
- if (EditorGUI.EndChangeCheck())
- {
- // Update Unicode value
- prop_Unicode.intValue = TMP_TextUtilities.StringHexToInt(unicode);
- }
-
- // Cache current glyph index in case it needs to be restored if the new glyph index is invalid.
- int currentGlyphIndex = prop_GlyphIndex.intValue;
-
- EditorGUIUtility.labelWidth = 59f;
- EditorGUI.BeginChangeCheck();
- EditorGUI.DelayedIntField(new Rect(rect.x, rect.y + 18, 100, 18), prop_GlyphIndex, new GUIContent("Glyph ID:"));
- if (EditorGUI.EndChangeCheck())
- {
- // Get a reference to the font asset
- TMP_FontAsset fontAsset = property.serializedObject.targetObject as TMP_FontAsset;
-
- // Make sure new glyph index is valid.
- int elementIndex = fontAsset.glyphTable.FindIndex(item => item.index == prop_GlyphIndex.intValue);
-
- if (elementIndex == -1)
- prop_GlyphIndex.intValue = currentGlyphIndex;
- else
- fontAsset.m_IsFontAssetLookupTablesDirty = true;
- }
-
- int glyphIndex = prop_GlyphIndex.intValue;
-
- // Reset glyph selection if new character has been selected.
- if (GUI.enabled && m_GlyphSelectedForEditing != glyphIndex)
- m_GlyphSelectedForEditing = -1;
-
- // Display button to edit the glyph data.
- if (GUI.Button(new Rect(rect.x + 120, rect.y + 18, 75, 18), new GUIContent("Edit Glyph")))
- {
- if (m_GlyphSelectedForEditing == -1)
- m_GlyphSelectedForEditing = glyphIndex;
- else
- m_GlyphSelectedForEditing = -1;
-
- // Button clicks should not result in potential change.
- GUI.changed = false;
- }
-
- // Show the glyph property drawer if selected
- if (glyphIndex == m_GlyphSelectedForEditing && GUI.enabled)
- {
- // Get a reference to the font asset
- TMP_FontAsset fontAsset = property.serializedObject.targetObject as TMP_FontAsset;
-
- if (fontAsset != null)
- {
- // Get the index of the glyph in the font asset glyph table.
- int elementIndex = fontAsset.glyphTable.FindIndex(item => item.index == glyphIndex);
-
- if (elementIndex != -1)
- {
- SerializedProperty prop_GlyphTable = property.serializedObject.FindProperty("m_GlyphTable");
- SerializedProperty prop_Glyph = prop_GlyphTable.GetArrayElementAtIndex(elementIndex);
-
- SerializedProperty prop_GlyphMetrics = prop_Glyph.FindPropertyRelative("m_Metrics");
- SerializedProperty prop_GlyphRect = prop_Glyph.FindPropertyRelative("m_GlyphRect");
-
- Rect newRect = EditorGUILayout.GetControlRect(false, 115);
- EditorGUI.DrawRect(new Rect(newRect.x + 52, newRect.y - 20, newRect.width - 52, newRect.height - 5), new Color(0.1f, 0.1f, 0.1f, 0.45f));
- EditorGUI.DrawRect(new Rect(newRect.x + 53, newRect.y - 19, newRect.width - 54, newRect.height - 7), new Color(0.3f, 0.3f, 0.3f, 0.8f));
-
- // Display GlyphRect
- newRect.x += 55;
- newRect.y -= 18;
- newRect.width += 5;
- EditorGUI.PropertyField(newRect, prop_GlyphRect);
-
- // Display GlyphMetrics
- newRect.y += 45;
- EditorGUI.PropertyField(newRect, prop_GlyphMetrics);
-
- rect.y += 120;
- }
- }
- }
-
- EditorGUIUtility.labelWidth = 39f;
- EditorGUI.PropertyField(new Rect(rect.x, rect.y + 36, 80, 18), prop_Scale, new GUIContent("Scale:"));
-
- // Draw Glyph (if exists)
- DrawGlyph(position, property);
- }
- }
-
- public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
- {
- return 58;
- }
-
- void DrawGlyph(Rect position, SerializedProperty property)
- {
- // Get a reference to the atlas texture
- TMP_FontAsset fontAsset = property.serializedObject.targetObject as TMP_FontAsset;
-
- if (fontAsset == null)
- return;
-
- // Get a reference to the Glyph Table
- SerializedProperty prop_GlyphTable = property.serializedObject.FindProperty("m_GlyphTable");
- int glyphIndex = property.FindPropertyRelative("m_GlyphIndex").intValue;
- int elementIndex = fontAsset.glyphTable.FindIndex(item => item.index == glyphIndex);
-
- // Return if we can't find the glyph
- if (elementIndex == -1)
- return;
-
- SerializedProperty prop_Glyph = prop_GlyphTable.GetArrayElementAtIndex(elementIndex);
-
- // Get reference to atlas texture.
- int atlasIndex = prop_Glyph.FindPropertyRelative("m_AtlasIndex").intValue;
- Texture2D atlasTexture = fontAsset.atlasTextures.Length > atlasIndex ? fontAsset.atlasTextures[atlasIndex] : null;
-
- if (atlasTexture == null)
- return;
-
- Material mat;
- if (((GlyphRasterModes)fontAsset.atlasRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP)
- {
- mat = TMP_FontAssetEditor.internalBitmapMaterial;
-
- if (mat == null)
- return;
-
- mat.mainTexture = atlasTexture;
- mat.SetColor("_Color", Color.white);
- }
- else
- {
- mat = TMP_FontAssetEditor.internalSDFMaterial;
-
- if (mat == null)
- return;
-
- mat.mainTexture = atlasTexture;
- mat.SetFloat(ShaderUtilities.ID_GradientScale, fontAsset.atlasPadding + 1);
- }
-
- // Draw glyph
- Rect glyphDrawPosition = new Rect(position.x, position.y, 48, 58);
-
- SerializedProperty prop_GlyphRect = prop_Glyph.FindPropertyRelative("m_GlyphRect");
-
- int glyphOriginX = prop_GlyphRect.FindPropertyRelative("m_X").intValue;
- int glyphOriginY = prop_GlyphRect.FindPropertyRelative("m_Y").intValue;
- int glyphWidth = prop_GlyphRect.FindPropertyRelative("m_Width").intValue;
- int glyphHeight = prop_GlyphRect.FindPropertyRelative("m_Height").intValue;
-
- float normalizedHeight = fontAsset.faceInfo.ascentLine - fontAsset.faceInfo.descentLine;
- float scale = glyphDrawPosition.width / normalizedHeight;
-
- // Compute the normalized texture coordinates
- Rect texCoords = new Rect((float)glyphOriginX / atlasTexture.width, (float)glyphOriginY / atlasTexture.height, (float)glyphWidth / atlasTexture.width, (float)glyphHeight / atlasTexture.height);
-
- if (Event.current.type == EventType.Repaint)
- {
- glyphDrawPosition.x += (glyphDrawPosition.width - glyphWidth * scale) / 2;
- glyphDrawPosition.y += (glyphDrawPosition.height - glyphHeight * scale) / 2;
- glyphDrawPosition.width = glyphWidth * scale;
- glyphDrawPosition.height = glyphHeight * scale;
-
- // Could switch to using the default material of the font asset which would require passing scale to the shader.
- Graphics.DrawTexture(glyphDrawPosition, atlasTexture, texCoords, 0, 0, 0, 0, new Color(1f, 1f, 1f), mat);
- }
- }
-
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_CharacterPropertyDrawer.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_CharacterPropertyDrawer.cs.meta
deleted file mode 100644
index 24f23b9..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_CharacterPropertyDrawer.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 01ada73c4792aba4c937ff5d92cce866
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientAssetMenu.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientAssetMenu.cs
deleted file mode 100644
index 80272ac..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientAssetMenu.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using UnityEditor;
-using UnityEngine;
-using System.IO;
-using System.Collections;
-
-
-
-namespace TMPro.EditorUtilities
-{
-
- public static class TMP_ColorGradientAssetMenu
- {
- [MenuItem("Assets/Create/TextMeshPro/Color Gradient", false, 115)]
- public static void CreateColorGradient(MenuCommand context)
- {
- string filePath;
-
- if (Selection.assetGUIDs.Length == 0)
- filePath = "Assets/New TMP Color Gradient.asset";
- else
- filePath = AssetDatabase.GUIDToAssetPath(Selection.assetGUIDs[0]);
-
- if (Directory.Exists(filePath))
- {
- filePath += "/New TMP Color Gradient.asset";
- }
- else
- {
- filePath = Path.GetDirectoryName(filePath) + "/New TMP Color Gradient.asset";
- }
-
- filePath = AssetDatabase.GenerateUniqueAssetPath(filePath);
-
- // Create new Color Gradient Asset.
- TMP_ColorGradient colorGradient = ScriptableObject.CreateInstance<TMP_ColorGradient>();
-
- // Create Asset
- AssetDatabase.CreateAsset(colorGradient, filePath);
-
- //EditorUtility.SetDirty(colorGradient);
-
- AssetDatabase.SaveAssets();
-
- AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(colorGradient));
-
- EditorUtility.FocusProjectWindow();
- Selection.activeObject = colorGradient;
-
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientAssetMenu.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientAssetMenu.cs.meta
deleted file mode 100644
index 35535ba..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientAssetMenu.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: d9647b571c5e44729b71d756b3d55317
-timeCreated: 1468187791
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientEditor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientEditor.cs
deleted file mode 100644
index a262d51..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientEditor.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
- [CustomEditor(typeof(TMP_ColorGradient))]
- public class TMP_ColorGradientEditor : Editor
- {
- SerializedProperty m_ColorMode;
- SerializedProperty m_TopLeftColor;
- SerializedProperty m_TopRightColor;
- SerializedProperty m_BottomLeftColor;
- SerializedProperty m_BottomRightColor;
-
- void OnEnable()
- {
- m_ColorMode = serializedObject.FindProperty("colorMode");
- m_TopLeftColor = serializedObject.FindProperty("topLeft");
- m_TopRightColor = serializedObject.FindProperty("topRight");
- m_BottomLeftColor = serializedObject.FindProperty("bottomLeft");
- m_BottomRightColor = serializedObject.FindProperty("bottomRight");
- }
-
- public override void OnInspectorGUI()
- {
- serializedObject.Update();
-
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_ColorMode, new GUIContent("Color Mode"));
- if (EditorGUI.EndChangeCheck())
- {
- switch ((ColorMode)m_ColorMode.enumValueIndex)
- {
- case ColorMode.Single:
- m_TopRightColor.colorValue = m_TopLeftColor.colorValue;
- m_BottomLeftColor.colorValue = m_TopLeftColor.colorValue;
- m_BottomRightColor.colorValue = m_TopLeftColor.colorValue;
- break;
- case ColorMode.HorizontalGradient:
- m_BottomLeftColor.colorValue = m_TopLeftColor.colorValue;
- m_BottomRightColor.colorValue = m_TopRightColor.colorValue;
- break;
- case ColorMode.VerticalGradient:
- m_TopRightColor.colorValue = m_TopLeftColor.colorValue;
- m_BottomRightColor.colorValue = m_BottomLeftColor.colorValue;
- break;
- }
- }
- Rect rect;
- switch ((ColorMode)m_ColorMode.enumValueIndex)
- {
- case ColorMode.Single:
- EditorGUI.BeginChangeCheck();
- rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
- EditorGUI.PrefixLabel(rect, new GUIContent("Colors"));
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = (rect.width - EditorGUIUtility.labelWidth) / (EditorGUIUtility.wideMode ? 1f : 2f);
- TMP_EditorUtility.DrawColorProperty(rect, m_TopLeftColor);
- if (EditorGUI.EndChangeCheck())
- {
- m_TopRightColor.colorValue = m_TopLeftColor.colorValue;
- m_BottomLeftColor.colorValue = m_TopLeftColor.colorValue;
- m_BottomRightColor.colorValue = m_TopLeftColor.colorValue;
- }
- break;
-
- case ColorMode.HorizontalGradient:
- rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
- EditorGUI.PrefixLabel(rect, new GUIContent("Colors"));
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2f;
-
- EditorGUI.BeginChangeCheck();
- TMP_EditorUtility.DrawColorProperty(rect, m_TopLeftColor);
- if (EditorGUI.EndChangeCheck())
- {
- m_BottomLeftColor.colorValue = m_TopLeftColor.colorValue;
- }
-
- rect.x += rect.width;
-
- EditorGUI.BeginChangeCheck();
- TMP_EditorUtility.DrawColorProperty(rect, m_TopRightColor);
- if (EditorGUI.EndChangeCheck())
- {
- m_BottomRightColor.colorValue = m_TopRightColor.colorValue;
- }
- break;
-
- case ColorMode.VerticalGradient:
- rect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
- EditorGUI.PrefixLabel(rect, new GUIContent("Colors"));
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = (rect.width - EditorGUIUtility.labelWidth) / (EditorGUIUtility.wideMode ? 1f : 2f);
- rect.height = EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2);
-
- EditorGUI.BeginChangeCheck();
- TMP_EditorUtility.DrawColorProperty(rect, m_TopLeftColor);
- if (EditorGUI.EndChangeCheck())
- {
- m_TopRightColor.colorValue = m_TopLeftColor.colorValue;
- }
-
- rect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = (rect.width - EditorGUIUtility.labelWidth) / (EditorGUIUtility.wideMode ? 1f : 2f);
- rect.height = EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2);
-
- EditorGUI.BeginChangeCheck();
- TMP_EditorUtility.DrawColorProperty(rect, m_BottomLeftColor);
- if (EditorGUI.EndChangeCheck())
- {
- m_BottomRightColor.colorValue = m_BottomLeftColor.colorValue;
- }
- break;
-
- case ColorMode.FourCornersGradient:
- rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
- EditorGUI.PrefixLabel(rect, new GUIContent("Colors"));
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2f;
- rect.height = EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2);
-
- TMP_EditorUtility.DrawColorProperty(rect, m_TopLeftColor);
- rect.x += rect.width;
- TMP_EditorUtility.DrawColorProperty(rect, m_TopRightColor);
-
- rect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2f;
- rect.height = EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2);
-
- TMP_EditorUtility.DrawColorProperty(rect, m_BottomLeftColor);
- rect.x += rect.width;
- TMP_EditorUtility.DrawColorProperty(rect, m_BottomRightColor);
- break;
- }
-
- if (serializedObject.ApplyModifiedProperties())
- TMPro_EventManager.ON_COLOR_GRAIDENT_PROPERTY_CHANGED(target as TMP_ColorGradient);
-
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientEditor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientEditor.cs.meta
deleted file mode 100644
index 6d7849e..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ColorGradientEditor.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: fcc60c1d6bb544d9b712b652f418ff3a
-timeCreated: 1468400050
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_DropdownEditor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_DropdownEditor.cs
deleted file mode 100644
index 60406aa..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_DropdownEditor.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using UnityEditor.UI;
-using UnityEngine.UI;
-
-namespace TMPro.EditorUtilities
-{
- [CustomEditor(typeof(TMP_Dropdown), true)]
- [CanEditMultipleObjects]
- public class DropdownEditor : SelectableEditor
- {
- SerializedProperty m_Template;
- SerializedProperty m_CaptionText;
- SerializedProperty m_CaptionImage;
- SerializedProperty m_ItemText;
- SerializedProperty m_ItemImage;
- SerializedProperty m_OnSelectionChanged;
- SerializedProperty m_Value;
- SerializedProperty m_Options;
-
- protected override void OnEnable()
- {
- base.OnEnable();
- m_Template = serializedObject.FindProperty("m_Template");
- m_CaptionText = serializedObject.FindProperty("m_CaptionText");
- m_CaptionImage = serializedObject.FindProperty("m_CaptionImage");
- m_ItemText = serializedObject.FindProperty("m_ItemText");
- m_ItemImage = serializedObject.FindProperty("m_ItemImage");
- m_OnSelectionChanged = serializedObject.FindProperty("m_OnValueChanged");
- m_Value = serializedObject.FindProperty("m_Value");
- m_Options = serializedObject.FindProperty("m_Options");
- }
-
- public override void OnInspectorGUI()
- {
- base.OnInspectorGUI();
- EditorGUILayout.Space();
-
- serializedObject.Update();
- EditorGUILayout.PropertyField(m_Template);
- EditorGUILayout.PropertyField(m_CaptionText);
- EditorGUILayout.PropertyField(m_CaptionImage);
- EditorGUILayout.PropertyField(m_ItemText);
- EditorGUILayout.PropertyField(m_ItemImage);
- EditorGUILayout.PropertyField(m_Value);
- EditorGUILayout.PropertyField(m_Options);
- EditorGUILayout.PropertyField(m_OnSelectionChanged);
- serializedObject.ApplyModifiedProperties();
- }
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_DropdownEditor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_DropdownEditor.cs.meta
deleted file mode 100644
index fb4ac92..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_DropdownEditor.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 6dbcf248c987476181a37f01a1814975
-timeCreated: 1446377461
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorCoroutine.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorCoroutine.cs
deleted file mode 100644
index c40b271..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorCoroutine.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEditor;
-using UnityEngine;
-
-
-namespace TMPro.EditorUtilities
-{
- /// <summary>
- /// Simple implementation of coroutine working in the Unity Editor.
- /// </summary>
- public class TMP_EditorCoroutine
- {
- //private static Dictionary<int, EditorCoroutine> s_ActiveCoroutines;
-
- readonly IEnumerator coroutine;
-
- /// <summary>
- /// Constructor
- /// </summary>
- /// <param name="routine"></param>
- TMP_EditorCoroutine(IEnumerator routine)
- {
- this.coroutine = routine;
- }
-
-
- /// <summary>
- /// Starts a new EditorCoroutine.
- /// </summary>
- /// <param name="newCoroutine">Coroutine</param>
- /// <returns>new EditorCoroutine</returns>
- public static TMP_EditorCoroutine StartCoroutine(IEnumerator routine)
- {
- TMP_EditorCoroutine coroutine = new TMP_EditorCoroutine(routine);
- coroutine.Start();
-
- // Add coroutine to tracking list
- //if (s_ActiveCoroutines == null)
- // s_ActiveCoroutines = new Dictionary<int, EditorCoroutine>();
-
- // Add new instance of editor coroutine to dictionary.
- //s_ActiveCoroutines.Add(coroutine.GetHashCode(), coroutine);
-
- return coroutine;
- }
-
-
- /// <summary>
- /// Clear delegate list
- /// </summary>
- //public static void StopAllEditorCoroutines()
- //{
- // EditorApplication.update = null;
- //}
-
-
- /// <summary>
- /// Register callback for editor updates
- /// </summary>
- void Start()
- {
- EditorApplication.update += EditorUpdate;
- }
-
-
- /// <summary>
- /// Unregister callback for editor updates.
- /// </summary>
- public void Stop()
- {
- if (EditorApplication.update != null)
- EditorApplication.update -= EditorUpdate;
-
- //s_ActiveCoroutines.Remove(this.GetHashCode());
- }
-
-
- /// <summary>
- /// Delegate function called on editor updates.
- /// </summary>
- void EditorUpdate()
- {
- // Stop editor coroutine if it does not continue.
- if (coroutine.MoveNext() == false)
- Stop();
-
- // Process the different types of EditorCoroutines.
- if (coroutine.Current != null)
- {
-
- }
- }
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorCoroutine.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorCoroutine.cs.meta
deleted file mode 100644
index d2d411a..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorCoroutine.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 27a0335dab59ec542aadd6636a5b4ebd
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorPanel.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorPanel.cs
deleted file mode 100644
index 36eb2f8..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorPanel.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomEditor(typeof(TextMeshPro), true), CanEditMultipleObjects]
- public class TMP_EditorPanel : TMP_BaseEditorPanel
- {
- static readonly GUIContent k_SortingLayerLabel = new GUIContent("Sorting Layer", "Name of the Renderer's sorting layer.");
- static readonly GUIContent k_OrderInLayerLabel = new GUIContent("Order in Layer", "Renderer's order within a sorting layer.");
- static readonly GUIContent k_OrthographicLabel = new GUIContent("Orthographic Mode", "Should be enabled when using an orthographic camera. Instructs the shader to not perform any perspective correction.");
- static readonly GUIContent k_VolumetricLabel = new GUIContent("Volumetric Setup", "Use cubes rather than quads to render the text. Allows for volumetric rendering when combined with a compatible shader.");
-
- SerializedProperty m_IsVolumetricTextProp;
-
- SerializedProperty m_IsOrthographicProp;
-
- Renderer m_Renderer;
-
- protected override void OnEnable()
- {
- base.OnEnable();
-
- m_IsOrthographicProp = serializedObject.FindProperty("m_isOrthographic");
-
- m_IsVolumetricTextProp = serializedObject.FindProperty("m_isVolumetricText");
-
- m_Renderer = m_TextComponent.GetComponent<Renderer>();
- }
-
- protected override void DrawExtraSettings()
- {
- Foldout.extraSettings = EditorGUILayout.Foldout(Foldout.extraSettings, k_ExtraSettingsLabel, true, TMP_UIStyleManager.boldFoldout);
- if (Foldout.extraSettings)
- {
- EditorGUI.indentLevel += 1;
-
- DrawMargins();
-
- DrawSortingLayer();
-
- DrawGeometrySorting();
-
- DrawOrthographicMode();
-
- DrawRichText();
-
- DrawParsing();
-
- DrawVolumetricSetup();
-
- DrawKerning();
-
- DrawPadding();
-
- EditorGUI.indentLevel -= 1;
- }
- }
-
- protected void DrawSortingLayer()
- {
- Undo.RecordObject(m_Renderer, "Sorting Layer Change");
-
- EditorGUI.BeginChangeCheck();
-
- // SORTING LAYERS
- var sortingLayerNames = SortingLayerHelper.sortingLayerNames;
-
- var textComponent = (TextMeshPro)m_TextComponent;
-
- // Look up the layer name using the current layer ID
- string oldName = SortingLayerHelper.GetSortingLayerNameFromID(textComponent.sortingLayerID);
-
- // Use the name to look up our array index into the names list
- int oldLayerIndex = System.Array.IndexOf(sortingLayerNames, oldName);
-
- // Show the pop-up for the names
- EditorGUIUtility.fieldWidth = 0f;
- int newLayerIndex = EditorGUILayout.Popup(k_SortingLayerLabel, oldLayerIndex, sortingLayerNames);
-
- // If the index changes, look up the ID for the new index to store as the new ID
- if (newLayerIndex != oldLayerIndex)
- {
- textComponent.sortingLayerID = SortingLayerHelper.GetSortingLayerIDForIndex(newLayerIndex);
- }
-
- // Expose the manual sorting order
- int newSortingLayerOrder = EditorGUILayout.IntField(k_OrderInLayerLabel, textComponent.sortingOrder);
- if (newSortingLayerOrder != textComponent.sortingOrder)
- {
- textComponent.sortingOrder = newSortingLayerOrder;
- }
-
- if (EditorGUI.EndChangeCheck())
- m_HavePropertiesChanged = true;
-
- EditorGUILayout.Space();
- }
-
- protected void DrawOrthographicMode()
- {
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_IsOrthographicProp, k_OrthographicLabel);
- if (EditorGUI.EndChangeCheck())
- m_HavePropertiesChanged = true;
- }
-
- protected void DrawVolumetricSetup()
- {
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_IsVolumetricTextProp, k_VolumetricLabel);
- if (EditorGUI.EndChangeCheck())
- {
- m_HavePropertiesChanged = true;
- m_TextComponent.textInfo.ResetVertexLayout(m_IsVolumetricTextProp.boolValue);
- }
-
- EditorGUILayout.Space();
- }
-
- // Method to handle multi object selection
- protected override bool IsMixSelectionTypes()
- {
- GameObject[] objects = Selection.gameObjects;
- if (objects.Length > 1)
- {
- for (int i = 0; i < objects.Length; i++)
- {
- if (objects[i].GetComponent<TextMeshPro>() == null)
- return true;
- }
- }
- return false;
- }
-
- protected override void OnUndoRedo()
- {
- int undoEventId = Undo.GetCurrentGroup();
- int lastUndoEventId = s_EventId;
-
- if (undoEventId != lastUndoEventId)
- {
- for (int i = 0; i < targets.Length; i++)
- {
- //Debug.Log("Undo & Redo Performed detected in Editor Panel. Event ID:" + Undo.GetCurrentGroup());
- TMPro_EventManager.ON_TEXTMESHPRO_PROPERTY_CHANGED(true, targets[i] as TextMeshPro);
- s_EventId = undoEventId;
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorPanel.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorPanel.cs.meta
deleted file mode 100644
index aace189..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorPanel.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 34f6695d37a94370a3697f6b068f5d5e
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorUtility.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorUtility.cs
deleted file mode 100644
index 9c8e630..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorUtility.cs
+++ /dev/null
@@ -1,450 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.Text;
-using System.IO;
-using System.Collections;
-using System.Collections.Generic;
-
-
-namespace TMPro.EditorUtilities
-{
-
- public static class TMP_EditorUtility
- {
- /// <summary>
- /// Returns the relative path of the package.
- /// </summary>
- public static string packageRelativePath
- {
- get
- {
- if (string.IsNullOrEmpty(m_PackagePath))
- m_PackagePath = GetPackageRelativePath();
-
- return m_PackagePath;
- }
- }
- [SerializeField]
- private static string m_PackagePath;
-
- /// <summary>
- /// Returns the fully qualified path of the package.
- /// </summary>
- public static string packageFullPath
- {
- get
- {
- if (string.IsNullOrEmpty(m_PackageFullPath))
- m_PackageFullPath = GetPackageFullPath();
-
- return m_PackageFullPath;
- }
- }
- [SerializeField]
- private static string m_PackageFullPath;
-
-
- // Static Fields Related to locating the TextMesh Pro Asset
- private static string folderPath = "Not Found";
-
- private static EditorWindow Gameview;
- private static bool isInitialized = false;
-
- private static void GetGameview()
- {
- System.Reflection.Assembly assembly = typeof(UnityEditor.EditorWindow).Assembly;
- System.Type type = assembly.GetType("UnityEditor.GameView");
- Gameview = EditorWindow.GetWindow(type);
- }
-
-
- public static void RepaintAll()
- {
- if (isInitialized == false)
- {
- GetGameview();
- isInitialized = true;
- }
-
- SceneView.RepaintAll();
- Gameview.Repaint();
- }
-
-
- /// <summary>
- /// Create and return a new asset in a smart location based on the current selection and then select it.
- /// </summary>
- /// <param name="name">
- /// Name of the new asset. Do not include the .asset extension.
- /// </param>
- /// <returns>
- /// The new asset.
- /// </returns>
- public static T CreateAsset<T>(string name) where T : ScriptableObject
- {
- string path = AssetDatabase.GetAssetPath(Selection.activeObject);
- if (path.Length == 0)
- {
- // no asset selected, place in asset root
- path = "Assets/" + name + ".asset";
- }
- else if (Directory.Exists(path))
- {
- // place in currently selected directory
- path += "/" + name + ".asset";
- }
- else {
- // place in current selection's containing directory
- path = Path.GetDirectoryName(path) + "/" + name + ".asset";
- }
- T asset = ScriptableObject.CreateInstance<T>();
- AssetDatabase.CreateAsset(asset, AssetDatabase.GenerateUniqueAssetPath(path));
- EditorUtility.FocusProjectWindow();
- Selection.activeObject = asset;
- return asset;
- }
-
-
-
- // Function used to find all materials which reference a font atlas so we can update all their references.
- public static Material[] FindMaterialReferences(TMP_FontAsset fontAsset)
- {
- List<Material> refs = new List<Material>();
- Material mat = fontAsset.material;
- refs.Add(mat);
-
- // Get materials matching the search pattern.
- string searchPattern = "t:Material" + " " + fontAsset.name.Split(new char[] { ' ' })[0];
- string[] materialAssetGUIDs = AssetDatabase.FindAssets(searchPattern);
-
- for (int i = 0; i < materialAssetGUIDs.Length; i++)
- {
- string materialPath = AssetDatabase.GUIDToAssetPath(materialAssetGUIDs[i]);
- Material targetMaterial = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
-
- if (targetMaterial.HasProperty(ShaderUtilities.ID_MainTex) && targetMaterial.GetTexture(ShaderUtilities.ID_MainTex) != null && mat.GetTexture(ShaderUtilities.ID_MainTex) != null && targetMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID() == mat.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID())
- {
- if (!refs.Contains(targetMaterial))
- refs.Add(targetMaterial);
- }
- else
- {
- // TODO: Find a more efficient method to unload resources.
- //Resources.UnloadAsset(targetMaterial.GetTexture(ShaderUtilities.ID_MainTex));
- }
- }
-
- return refs.ToArray();
- }
-
-
- // Function used to find the Font Asset which matches the given Material Preset and Font Atlas Texture.
- public static TMP_FontAsset FindMatchingFontAsset(Material mat)
- {
- if (mat.GetTexture(ShaderUtilities.ID_MainTex) == null) return null;
-
- // Find the dependent assets of this material.
- string[] dependentAssets = AssetDatabase.GetDependencies(AssetDatabase.GetAssetPath(mat), false);
-
- for (int i = 0; i < dependentAssets.Length; i++)
- {
- TMP_FontAsset fontAsset = AssetDatabase.LoadAssetAtPath<TMP_FontAsset>(dependentAssets[i]);
- if (fontAsset != null)
- return fontAsset;
- }
-
- return null;
- }
-
-
- private static string GetPackageRelativePath()
- {
- // Check for potential UPM package
- string packagePath = Path.GetFullPath("Packages/com.unity.textmeshpro");
- if (Directory.Exists(packagePath))
- {
- return "Packages/com.unity.textmeshpro";
- }
-
- packagePath = Path.GetFullPath("Assets/..");
- if (Directory.Exists(packagePath))
- {
- // Search default location for development package
- if (Directory.Exists(packagePath + "/Assets/Packages/com.unity.TextMeshPro/Editor Resources"))
- {
- return "Assets/Packages/com.unity.TextMeshPro";
- }
-
- // Search for default location of normal TextMesh Pro AssetStore package
- if (Directory.Exists(packagePath + "/Assets/TextMesh Pro/Editor Resources"))
- {
- return "Assets/TextMesh Pro";
- }
-
- // Search for potential alternative locations in the user project
- string[] matchingPaths = Directory.GetDirectories(packagePath, "TextMesh Pro", SearchOption.AllDirectories);
- packagePath = ValidateLocation(matchingPaths, packagePath);
- if (packagePath != null) return packagePath;
- }
-
- return null;
- }
-
- private static string GetPackageFullPath()
- {
- // Check for potential UPM package
- string packagePath = Path.GetFullPath("Packages/com.unity.textmeshpro");
- if (Directory.Exists(packagePath))
- {
- return packagePath;
- }
-
- packagePath = Path.GetFullPath("Assets/..");
- if (Directory.Exists(packagePath))
- {
- // Search default location for development package
- if (Directory.Exists(packagePath + "/Assets/Packages/com.unity.TextMeshPro/Editor Resources"))
- {
- return packagePath + "/Assets/Packages/com.unity.TextMeshPro";
- }
-
- // Search for default location of normal TextMesh Pro AssetStore package
- if (Directory.Exists(packagePath + "/Assets/TextMesh Pro/Editor Resources"))
- {
- return packagePath + "/Assets/TextMesh Pro";
- }
-
- // Search for potential alternative locations in the user project
- string[] matchingPaths = Directory.GetDirectories(packagePath, "TextMesh Pro", SearchOption.AllDirectories);
- string path = ValidateLocation(matchingPaths, packagePath);
- if (path != null) return packagePath + path;
- }
-
- return null;
- }
-
-
- /// <summary>
- /// Method to validate the location of the asset folder by making sure the GUISkins folder exists.
- /// </summary>
- /// <param name="paths"></param>
- /// <returns></returns>
- private static string ValidateLocation(string[] paths, string projectPath)
- {
- for (int i = 0; i < paths.Length; i++)
- {
- // Check if any of the matching directories contain a GUISkins directory.
- if (Directory.Exists(paths[i] + "/Editor Resources"))
- {
- folderPath = paths[i].Replace(projectPath, "");
- folderPath = folderPath.TrimStart('\\', '/');
- return folderPath;
- }
- }
-
- return null;
- }
-
-
- /// <summary>
- /// Function which returns a string containing a sequence of Decimal character ranges.
- /// </summary>
- /// <param name="characterSet"></param>
- /// <returns></returns>
- public static string GetDecimalCharacterSequence(int[] characterSet)
- {
- if (characterSet == null || characterSet.Length == 0)
- return string.Empty;
-
- string characterSequence = string.Empty;
- int count = characterSet.Length;
- int first = characterSet[0];
- int last = first;
-
- for (int i = 1; i < count; i++)
- {
- if (characterSet[i - 1] + 1 == characterSet[i])
- {
- last = characterSet[i];
- }
- else
- {
- if (first == last)
- characterSequence += first + ",";
- else
- characterSequence += first + "-" + last + ",";
-
- first = last = characterSet[i];
- }
-
- }
-
- // handle the final group
- if (first == last)
- characterSequence += first;
- else
- characterSequence += first + "-" + last;
-
- return characterSequence;
- }
-
-
- /// <summary>
- /// Function which returns a string containing a sequence of Unicode (Hex) character ranges.
- /// </summary>
- /// <param name="characterSet"></param>
- /// <returns></returns>
- public static string GetUnicodeCharacterSequence(int[] characterSet)
- {
- if (characterSet == null || characterSet.Length == 0)
- return string.Empty;
-
- string characterSequence = string.Empty;
- int count = characterSet.Length;
- int first = characterSet[0];
- int last = first;
-
- for (int i = 1; i < count; i++)
- {
- if (characterSet[i - 1] + 1 == characterSet[i])
- {
- last = characterSet[i];
- }
- else
- {
- if (first == last)
- characterSequence += first.ToString("X2") + ",";
- else
- characterSequence += first.ToString("X2") + "-" + last.ToString("X2") + ",";
-
- first = last = characterSet[i];
- }
-
- }
-
- // handle the final group
- if (first == last)
- characterSequence += first.ToString("X2");
- else
- characterSequence += first.ToString("X2") + "-" + last.ToString("X2");
-
- return characterSequence;
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="rect"></param>
- /// <param name="thickness"></param>
- /// <param name="color"></param>
- public static void DrawBox(Rect rect, float thickness, Color color)
- {
- EditorGUI.DrawRect(new Rect(rect.x - thickness, rect.y + thickness, rect.width + thickness * 2, thickness), color);
- EditorGUI.DrawRect(new Rect(rect.x - thickness, rect.y + thickness, thickness, rect.height - thickness * 2), color);
- EditorGUI.DrawRect(new Rect(rect.x - thickness, rect.y + rect.height - thickness * 2, rect.width + thickness * 2, thickness), color);
- EditorGUI.DrawRect(new Rect(rect.x + rect.width, rect.y + thickness, thickness, rect.height - thickness * 2), color);
- }
-
-
- /// <summary>
- /// Function to return the horizontal alignment grid value.
- /// </summary>
- /// <param name="value"></param>
- /// <returns></returns>
- public static int GetHorizontalAlignmentGridValue(int value)
- {
- if ((value & 0x1) == 0x1)
- return 0;
- else if ((value & 0x2) == 0x2)
- return 1;
- else if ((value & 0x4) == 0x4)
- return 2;
- else if ((value & 0x8) == 0x8)
- return 3;
- else if ((value & 0x10) == 0x10)
- return 4;
- else if ((value & 0x20) == 0x20)
- return 5;
-
- return 0;
- }
-
- /// <summary>
- /// Function to return the vertical alignment grid value.
- /// </summary>
- /// <param name="value"></param>
- /// <returns></returns>
- public static int GetVerticalAlignmentGridValue(int value)
- {
- if ((value & 0x100) == 0x100)
- return 0;
- if ((value & 0x200) == 0x200)
- return 1;
- if ((value & 0x400) == 0x400)
- return 2;
- if ((value & 0x800) == 0x800)
- return 3;
- if ((value & 0x1000) == 0x1000)
- return 4;
- if ((value & 0x2000) == 0x2000)
- return 5;
-
- return 0;
- }
-
- public static void DrawColorProperty(Rect rect, SerializedProperty property)
- {
- int oldIndent = EditorGUI.indentLevel;
- EditorGUI.indentLevel = 0;
- if (EditorGUIUtility.wideMode)
- {
- EditorGUI.PropertyField(new Rect(rect.x, rect.y, 50f, rect.height), property, GUIContent.none);
- rect.x += 50f;
- rect.width = Mathf.Min(100f, rect.width - 55f);
- }
- else
- {
- rect.height /= 2f;
- rect.width = Mathf.Min(100f, rect.width - 5f);
- EditorGUI.PropertyField(rect, property, GUIContent.none);
- rect.y += rect.height;
- }
-
- EditorGUI.BeginChangeCheck();
- string colorString = EditorGUI.TextField(rect, string.Format("#{0}", ColorUtility.ToHtmlStringRGBA(property.colorValue)));
- if (EditorGUI.EndChangeCheck())
- {
- if (ColorUtility.TryParseHtmlString(colorString, out Color color))
- {
- property.colorValue = color;
- }
- }
- EditorGUI.indentLevel = oldIndent;
- }
-
- public static bool EditorToggle(Rect position, bool value, GUIContent content, GUIStyle style)
- {
- var id = GUIUtility.GetControlID(content, FocusType.Keyboard, position);
- var evt = Event.current;
-
- // Toggle selected toggle on space or return key
- if (GUIUtility.keyboardControl == id && evt.type == EventType.KeyDown && (evt.keyCode == KeyCode.Space || evt.keyCode == KeyCode.Return || evt.keyCode == KeyCode.KeypadEnter))
- {
- value = !value;
- evt.Use();
- GUI.changed = true;
- }
-
- if (evt.type == EventType.MouseDown && position.Contains(Event.current.mousePosition))
- {
- GUIUtility.keyboardControl = id;
- EditorGUIUtility.editingTextField = false;
- HandleUtility.Repaint();
- }
-
- return GUI.Toggle(position, id, value, content, style);
- }
-
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorUtility.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorUtility.cs.meta
deleted file mode 100644
index c462f87..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_EditorUtility.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 2300e75732d74890b38a8ff257a3ae15
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAssetEditor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAssetEditor.cs
deleted file mode 100644
index e352814..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAssetEditor.cs
+++ /dev/null
@@ -1,1711 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using UnityEditorInternal;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine.TextCore;
-using UnityEngine.TextCore.LowLevel;
-
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomPropertyDrawer(typeof(TMP_FontWeightPair))]
- public class FontWeightDrawer : PropertyDrawer
- {
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- SerializedProperty prop_regular = property.FindPropertyRelative("regularTypeface");
- SerializedProperty prop_italic = property.FindPropertyRelative("italicTypeface");
-
- float width = position.width;
-
- position.width = EditorGUIUtility.labelWidth;
- EditorGUI.LabelField(position, label);
-
- int oldIndent = EditorGUI.indentLevel;
- EditorGUI.indentLevel = 0;
-
- // NORMAL TYPEFACE
- if (label.text[0] == '4') GUI.enabled = false;
- position.x += position.width; position.width = (width - position.width) / 2;
- EditorGUI.PropertyField(position, prop_regular, GUIContent.none);
-
- // ITALIC TYPEFACE
- GUI.enabled = true;
- position.x += position.width;
- EditorGUI.PropertyField(position, prop_italic, GUIContent.none);
-
- EditorGUI.indentLevel = oldIndent;
- }
- }
-
- [CustomEditor(typeof(TMP_FontAsset))]
- public class TMP_FontAssetEditor : Editor
- {
- private struct UI_PanelState
- {
- public static bool faceInfoPanel = true;
- public static bool generationSettingsPanel = true;
- public static bool fontAtlasInfoPanel = true;
- public static bool fontWeightPanel = true;
- public static bool fallbackFontAssetPanel = true;
- public static bool glyphTablePanel = false;
- public static bool characterTablePanel = false;
- public static bool fontFeatureTablePanel = false;
- }
-
- private struct AtlasSettings
- {
- public GlyphRenderMode glyphRenderMode;
- public int pointSize;
- public int padding;
- public int atlasWidth;
- public int atlasHeight;
- }
-
- /// <summary>
- /// Material used to display SDF glyphs in the Character and Glyph tables.
- /// </summary>
- internal static Material internalSDFMaterial
- {
- get
- {
- if (s_InternalSDFMaterial == null)
- {
- Shader shader = Shader.Find("Hidden/TextMeshPro/Internal/Distance Field SSD");
-
- if (shader != null)
- s_InternalSDFMaterial = new Material(shader);
- }
-
- return s_InternalSDFMaterial;
- }
- }
- static Material s_InternalSDFMaterial;
-
- /// <summary>
- /// Material used to display Bitmap glyphs in the Character and Glyph tables.
- /// </summary>
- internal static Material internalBitmapMaterial
- {
- get
- {
- if (s_InternalBitmapMaterial == null)
- {
- Shader shader = Shader.Find("Hidden/Internal-GUITextureClipText");
-
- if (shader != null)
- s_InternalBitmapMaterial = new Material(shader);
- }
-
- return s_InternalBitmapMaterial;
- }
- }
- static Material s_InternalBitmapMaterial;
-
- private static string[] s_UiStateLabel = new string[] { "<i>(Click to collapse)</i> ", "<i>(Click to expand)</i> " };
- private GUIContent[] m_AtlasResolutionLabels = { new GUIContent("8"), new GUIContent("16"), new GUIContent("32"), new GUIContent("64"), new GUIContent("128"), new GUIContent("256"), new GUIContent("512"), new GUIContent("1024"), new GUIContent("2048"), new GUIContent("4096"), new GUIContent("8192") };
- private int[] m_AtlasResolutions = { 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192 };
-
- private struct Warning
- {
- public bool isEnabled;
- public double expirationTime;
- }
-
- private int m_CurrentGlyphPage = 0;
- private int m_CurrentCharacterPage = 0;
- private int m_CurrentKerningPage = 0;
-
- private int m_SelectedGlyphRecord = -1;
- private int m_SelectedCharacterRecord = -1;
- private int m_SelectedAdjustmentRecord = -1;
-
- private string m_dstGlyphID;
- private string m_dstUnicode;
- private const string k_placeholderUnicodeHex = "<i>New Unicode (Hex)</i>";
- private string m_unicodeHexLabel = k_placeholderUnicodeHex;
- private const string k_placeholderGlyphID = "<i>New Glyph ID</i>";
- private string m_GlyphIDLabel = k_placeholderGlyphID;
-
- private Warning m_AddGlyphWarning;
- private Warning m_AddCharacterWarning;
- private bool m_DisplayDestructiveChangeWarning;
- private AtlasSettings m_AtlasSettings;
- private bool m_MaterialPresetsRequireUpdate;
-
- private string m_GlyphSearchPattern;
- private List<int> m_GlyphSearchList;
-
- private string m_CharacterSearchPattern;
- private List<int> m_CharacterSearchList;
-
- private string m_KerningTableSearchPattern;
- private List<int> m_KerningTableSearchList;
-
- private bool m_isSearchDirty;
-
- private const string k_UndoRedo = "UndoRedoPerformed";
-
- private SerializedProperty m_AtlasPopulationMode_prop;
- private SerializedProperty font_atlas_prop;
- private SerializedProperty font_material_prop;
-
- private SerializedProperty m_AtlasRenderMode_prop;
- private SerializedProperty m_SamplingPointSize_prop;
- private SerializedProperty m_AtlasPadding_prop;
- private SerializedProperty m_AtlasWidth_prop;
- private SerializedProperty m_AtlasHeight_prop;
-
- private SerializedProperty fontWeights_prop;
-
- //private SerializedProperty fallbackFontAssets_prop;
- private ReorderableList m_list;
-
- private SerializedProperty font_normalStyle_prop;
- private SerializedProperty font_normalSpacing_prop;
-
- private SerializedProperty font_boldStyle_prop;
- private SerializedProperty font_boldSpacing_prop;
-
- private SerializedProperty font_italicStyle_prop;
- private SerializedProperty font_tabSize_prop;
-
- private SerializedProperty m_FaceInfo_prop;
- private SerializedProperty m_GlyphTable_prop;
- private SerializedProperty m_CharacterTable_prop;
-
- private TMP_FontFeatureTable m_FontFeatureTable;
- private SerializedProperty m_FontFeatureTable_prop;
- private SerializedProperty m_GlyphPairAdjustmentRecords_prop;
-
- private TMP_SerializedPropertyHolder m_SerializedPropertyHolder;
- private SerializedProperty m_EmptyGlyphPairAdjustmentRecord_prop;
-
- private TMP_FontAsset m_fontAsset;
-
- private Material[] m_materialPresets;
-
- private bool isAssetDirty = false;
-
- private int errorCode;
-
- private System.DateTime timeStamp;
-
-
- public void OnEnable()
- {
- m_FaceInfo_prop = serializedObject.FindProperty("m_FaceInfo");
-
- font_atlas_prop = serializedObject.FindProperty("m_AtlasTextures").GetArrayElementAtIndex(0);
- font_material_prop = serializedObject.FindProperty("material");
-
- m_AtlasPopulationMode_prop = serializedObject.FindProperty("m_AtlasPopulationMode");
- m_AtlasRenderMode_prop = serializedObject.FindProperty("m_AtlasRenderMode");
- m_SamplingPointSize_prop = m_FaceInfo_prop.FindPropertyRelative("m_PointSize");
- m_AtlasPadding_prop = serializedObject.FindProperty("m_AtlasPadding");
- m_AtlasWidth_prop = serializedObject.FindProperty("m_AtlasWidth");
- m_AtlasHeight_prop = serializedObject.FindProperty("m_AtlasHeight");
-
- fontWeights_prop = serializedObject.FindProperty("m_FontWeightTable");
-
- m_list = new ReorderableList(serializedObject, serializedObject.FindProperty("m_FallbackFontAssetTable"), true, true, true, true);
-
- m_list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
- {
- var element = m_list.serializedProperty.GetArrayElementAtIndex(index);
- rect.y += 2;
- EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, GUIContent.none);
- };
-
- m_list.drawHeaderCallback = rect =>
- {
- EditorGUI.LabelField(rect, "Fallback List");
- };
-
- // Clean up fallback list in the event if contains null elements.
- CleanFallbackFontAssetTable();
-
- font_normalStyle_prop = serializedObject.FindProperty("normalStyle");
- font_normalSpacing_prop = serializedObject.FindProperty("normalSpacingOffset");
-
- font_boldStyle_prop = serializedObject.FindProperty("boldStyle");
- font_boldSpacing_prop = serializedObject.FindProperty("boldSpacing");
-
- font_italicStyle_prop = serializedObject.FindProperty("italicStyle");
- font_tabSize_prop = serializedObject.FindProperty("tabSize");
-
- m_CharacterTable_prop = serializedObject.FindProperty("m_CharacterTable");
- m_GlyphTable_prop = serializedObject.FindProperty("m_GlyphTable");
-
- m_FontFeatureTable_prop = serializedObject.FindProperty("m_FontFeatureTable");
- m_GlyphPairAdjustmentRecords_prop = m_FontFeatureTable_prop.FindPropertyRelative("m_GlyphPairAdjustmentRecords");
-
- m_fontAsset = target as TMP_FontAsset;
- m_FontFeatureTable = m_fontAsset.fontFeatureTable;
-
- // Upgrade Font Feature Table if necessary
- if (m_fontAsset.m_KerningTable != null && m_fontAsset.m_KerningTable.kerningPairs != null && m_fontAsset.m_KerningTable.kerningPairs.Count > 0)
- m_fontAsset.ReadFontAssetDefinition();
-
- // Create serialized object to allow us to use a serialized property of an empty kerning pair.
- m_SerializedPropertyHolder = CreateInstance<TMP_SerializedPropertyHolder>();
- m_SerializedPropertyHolder.fontAsset = m_fontAsset;
- SerializedObject internalSerializedObject = new SerializedObject(m_SerializedPropertyHolder);
- m_EmptyGlyphPairAdjustmentRecord_prop = internalSerializedObject.FindProperty("glyphPairAdjustmentRecord");
-
- m_materialPresets = TMP_EditorUtility.FindMaterialReferences(m_fontAsset);
-
- m_GlyphSearchList = new List<int>();
- m_KerningTableSearchList = new List<int>();
- }
-
-
- public void OnDisable()
- {
- // Revert changes if user closes or changes selection without having made a choice.
- if (m_DisplayDestructiveChangeWarning)
- {
- m_DisplayDestructiveChangeWarning = false;
- RestoreAtlasGenerationSettings();
- GUIUtility.keyboardControl = 0;
-
- serializedObject.ApplyModifiedProperties();
- }
- }
-
-
- public override void OnInspectorGUI()
- {
- //Debug.Log("OnInspectorGUI Called.");
-
- Event currentEvent = Event.current;
-
- serializedObject.Update();
-
- Rect rect = EditorGUILayout.GetControlRect(false, 24);
- float labelWidth = EditorGUIUtility.labelWidth;
- float fieldWidth = EditorGUIUtility.fieldWidth;
-
- // FACE INFO PANEL
- #region Face info
- GUI.Label(rect, new GUIContent("<b>Face Info</b> - v" + m_fontAsset.version), TMP_UIStyleManager.sectionHeader);
-
- rect.x += rect.width - 132f;
- rect.y += 2;
- rect.width = 130f;
- rect.height = 18f;
- if (GUI.Button(rect, new GUIContent("Update Atlas Texture")))
- {
- TMPro_FontAssetCreatorWindow.ShowFontAtlasCreatorWindow(target as TMP_FontAsset);
- }
-
- EditorGUI.indentLevel = 1;
- GUI.enabled = false; // Lock UI
-
- // TODO : Consider creating a property drawer for these.
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_FamilyName"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_StyleName"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_PointSize"));
-
- GUI.enabled = true;
-
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_Scale"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_LineHeight"));
-
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_AscentLine"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_CapLine"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_MeanLine"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_Baseline"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_DescentLine"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_UnderlineOffset"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_UnderlineThickness"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_StrikethroughOffset"));
- //EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("strikethroughThickness"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_SuperscriptOffset"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_SuperscriptSize"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_SubscriptOffset"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_SubscriptSize"));
- EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_TabWidth"));
- // TODO : Add clamping for some of these values.
- //subSize_prop.floatValue = Mathf.Clamp(subSize_prop.floatValue, 0.25f, 1f);
-
- EditorGUILayout.Space();
- #endregion
-
- // GENERATION SETTINGS
- #region Generation Settings
- rect = EditorGUILayout.GetControlRect(false, 24);
-
- if (GUI.Button(rect, new GUIContent("<b>Generation Settings</b>"), TMP_UIStyleManager.sectionHeader))
- UI_PanelState.generationSettingsPanel = !UI_PanelState.generationSettingsPanel;
-
- GUI.Label(rect, (UI_PanelState.generationSettingsPanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
-
- if (UI_PanelState.generationSettingsPanel)
- {
- EditorGUI.indentLevel = 1;
-
- EditorGUI.BeginChangeCheck();
- Font sourceFont = (Font)EditorGUILayout.ObjectField("Source Font File", m_fontAsset.m_SourceFontFile_EditorRef, typeof(Font), false);
- if (EditorGUI.EndChangeCheck())
- {
- string guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(sourceFont));
- m_fontAsset.m_SourceFontFileGUID = guid;
- m_fontAsset.m_SourceFontFile_EditorRef = sourceFont;
- }
-
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_AtlasPopulationMode_prop, new GUIContent("Atlas Population Mode"));
- if (EditorGUI.EndChangeCheck())
- {
- serializedObject.ApplyModifiedProperties();
-
- bool isDatabaseRefreshRequired = false;
-
- if (m_AtlasPopulationMode_prop.intValue == 0)
- {
- m_fontAsset.sourceFontFile = null;
-
- // Set atlas textures to non readable.
- //for (int i = 0; i < m_fontAsset.atlasTextures.Length; i++)
- //{
- // Texture2D tex = m_fontAsset.atlasTextures[i];
-
- // if (tex != null && tex.isReadable)
- // {
- // string texPath = AssetDatabase.GetAssetPath(tex);
- // var texImporter = AssetImporter.GetAtPath(texPath) as TextureImporter;
- // if (texImporter != null)
- // {
- // texImporter.isReadable = false;
- // AssetDatabase.ImportAsset(texPath);
- // isDatabaseRefreshRequired = true;
- // }
- // }
- //}
-
- Debug.Log("Atlas Population mode set to [Static].");
- }
- else if (m_AtlasPopulationMode_prop.intValue == 1)
- {
- if (m_fontAsset.m_SourceFontFile_EditorRef.dynamic == false)
- {
- Debug.LogWarning("Please set the [" + m_fontAsset.name + "] font to dynamic mode as this is required for Dynamic SDF support.", m_fontAsset.m_SourceFontFile_EditorRef);
- m_AtlasPopulationMode_prop.intValue = 0;
-
- serializedObject.ApplyModifiedProperties();
- }
- else
- {
- m_fontAsset.sourceFontFile = m_fontAsset.m_SourceFontFile_EditorRef;
-
- /*
- // Set atlas textures to non readable.
- for (int i = 0; i < m_fontAsset.atlasTextures.Length; i++)
- {
- Texture2D tex = m_fontAsset.atlasTextures[i];
-
- if (tex != null && tex.isReadable == false)
- {
- string texPath = AssetDatabase.GetAssetPath(tex.GetInstanceID());
- Object[] paths = AssetDatabase.LoadAllAssetsAtPath(texPath);
- var texImporter = AssetImporter.GetAtPath(texPath) as TextureImporter;
- if (texImporter != null)
- {
- texImporter.isReadable = true;
- AssetDatabase.ImportAsset(texPath);
- isDatabaseRefreshRequired = true;
- }
- }
- }
- */
- Debug.Log("Atlas Population mode set to [Dynamic].");
- }
- }
-
- if (isDatabaseRefreshRequired)
- AssetDatabase.Refresh();
-
- serializedObject.Update();
- isAssetDirty = true;
- }
-
- GUI.enabled = true;
- // Save state of atlas settings
- if (m_DisplayDestructiveChangeWarning == false)
- {
- SavedAtlasGenerationSettings();
- //Undo.RegisterCompleteObjectUndo(m_fontAsset, "Font Asset Changes");
- }
-
- EditorGUI.BeginChangeCheck();
- // TODO: Switch shaders depending on GlyphRenderMode.
- EditorGUILayout.PropertyField(m_AtlasRenderMode_prop);
- EditorGUILayout.PropertyField(m_SamplingPointSize_prop, new GUIContent("Sampling Point Size"));
- if (EditorGUI.EndChangeCheck())
- {
- m_DisplayDestructiveChangeWarning = true;
- }
-
- // Changes to these properties require updating Material Presets for this font asset.
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_AtlasPadding_prop, new GUIContent("Padding"));
- EditorGUILayout.IntPopup(m_AtlasWidth_prop, m_AtlasResolutionLabels, m_AtlasResolutions, new GUIContent("Atlas Width"));
- EditorGUILayout.IntPopup(m_AtlasHeight_prop, m_AtlasResolutionLabels, m_AtlasResolutions, new GUIContent("Atlas Height"));
- if (EditorGUI.EndChangeCheck())
- {
- m_MaterialPresetsRequireUpdate = true;
- m_DisplayDestructiveChangeWarning = true;
- }
-
- if (m_DisplayDestructiveChangeWarning)
- {
- // These changes are destructive on the font asset
- rect = EditorGUILayout.GetControlRect(false, 60);
- rect.x += 15;
- rect.width -= 15;
- EditorGUI.HelpBox(rect, "Changing these settings will clear the font asset's character, glyph and texture data.", MessageType.Warning);
-
- if (GUI.Button(new Rect(rect.width - 140, rect.y + 36, 80, 18), new GUIContent("Apply")))
- {
- m_DisplayDestructiveChangeWarning = false;
-
- // Update face info is sampling point size was changed.
- if (m_AtlasSettings.pointSize != m_SamplingPointSize_prop.intValue)
- {
- FontEngine.LoadFontFace(m_fontAsset.sourceFontFile, m_SamplingPointSize_prop.intValue);
- m_fontAsset.faceInfo = FontEngine.GetFaceInfo();
- }
-
- // Update material
- m_fontAsset.material.SetFloat(ShaderUtilities.ID_TextureWidth, m_AtlasWidth_prop.intValue);
- m_fontAsset.material.SetFloat(ShaderUtilities.ID_TextureHeight, m_AtlasHeight_prop.intValue);
- m_fontAsset.material.SetFloat(ShaderUtilities.ID_GradientScale, m_AtlasPadding_prop.intValue + 1);
-
- // Update material presets if any of the relevant properties have been changed.
- if (m_MaterialPresetsRequireUpdate)
- {
- m_MaterialPresetsRequireUpdate = false;
-
- Material[] materialPresets = TMP_EditorUtility.FindMaterialReferences(m_fontAsset);
- for (int i = 0; i < materialPresets.Length; i++)
- {
- Material mat = materialPresets[i];
-
- mat.SetFloat(ShaderUtilities.ID_TextureWidth, m_AtlasWidth_prop.intValue);
- mat.SetFloat(ShaderUtilities.ID_TextureHeight, m_AtlasHeight_prop.intValue);
- mat.SetFloat(ShaderUtilities.ID_GradientScale, m_AtlasPadding_prop.intValue + 1);
- }
- }
-
- m_fontAsset.ClearFontAssetData();
- GUIUtility.keyboardControl = 0;
- isAssetDirty = true;
-
- // Update Font Asset Creation Settings to reflect new changes.
- UpdateFontAssetCreationSettings();
-
- // TODO: Clear undo buffers.
- //Undo.ClearUndo(m_fontAsset);
- }
-
- if (GUI.Button(new Rect(rect.width - 56, rect.y + 36, 80, 18), new GUIContent("Revert")))
- {
- m_DisplayDestructiveChangeWarning = false;
- RestoreAtlasGenerationSettings();
- GUIUtility.keyboardControl = 0;
-
- // TODO: Clear undo buffers.
- //Undo.ClearUndo(m_fontAsset);
- }
- }
- EditorGUILayout.Space();
- }
- #endregion
-
- // ATLAS & MATERIAL PANEL
- #region Atlas & Material
- rect = EditorGUILayout.GetControlRect(false, 24);
-
- if (GUI.Button(rect, new GUIContent("<b>Atlas & Material</b>"), TMP_UIStyleManager.sectionHeader))
- UI_PanelState.fontAtlasInfoPanel = !UI_PanelState.fontAtlasInfoPanel;
-
- GUI.Label(rect, (UI_PanelState.fontAtlasInfoPanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
-
- if (UI_PanelState.fontAtlasInfoPanel)
- {
- EditorGUI.indentLevel = 1;
-
- GUI.enabled = false;
- EditorGUILayout.PropertyField(font_atlas_prop, new GUIContent("Font Atlas"));
- EditorGUILayout.PropertyField(font_material_prop, new GUIContent("Font Material"));
- GUI.enabled = true;
- EditorGUILayout.Space();
- }
- #endregion
-
- string evt_cmd = Event.current.commandName; // Get Current Event CommandName to check for Undo Events
-
- // FONT WEIGHT PANEL
- #region Font Weights
- rect = EditorGUILayout.GetControlRect(false, 24);
-
- if (GUI.Button(rect, new GUIContent("<b>Font Weights</b>", "The Font Assets that will be used for different font weights and the settings used to simulate a typeface when no asset is available."), TMP_UIStyleManager.sectionHeader))
- UI_PanelState.fontWeightPanel = !UI_PanelState.fontWeightPanel;
-
- GUI.Label(rect, (UI_PanelState.fontWeightPanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
-
- if (UI_PanelState.fontWeightPanel)
- {
- EditorGUIUtility.labelWidth *= 0.75f;
- EditorGUIUtility.fieldWidth *= 0.25f;
-
- EditorGUILayout.BeginVertical();
- EditorGUI.indentLevel = 1;
- rect = EditorGUILayout.GetControlRect(true);
- rect.x += EditorGUIUtility.labelWidth;
- rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2f;
- GUI.Label(rect, "Regular Tyepface", EditorStyles.label);
- rect.x += rect.width;
- GUI.Label(rect, "Italic Typeface", EditorStyles.label);
-
- EditorGUI.indentLevel = 1;
-
- EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(1), new GUIContent("100 - Thin"));
- EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(2), new GUIContent("200 - Extra-Light"));
- EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(3), new GUIContent("300 - Light"));
- EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(4), new GUIContent("400 - Regular"));
- EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(5), new GUIContent("500 - Medium"));
- EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(6), new GUIContent("600 - Semi-Bold"));
- EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(7), new GUIContent("700 - Bold"));
- EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(8), new GUIContent("800 - Heavy"));
- EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(9), new GUIContent("900 - Black"));
-
- EditorGUILayout.EndVertical();
-
- EditorGUILayout.Space();
-
- EditorGUILayout.BeginVertical();
-
- EditorGUILayout.BeginHorizontal();
- EditorGUILayout.PropertyField(font_normalStyle_prop, new GUIContent("Normal Weight"));
- font_normalStyle_prop.floatValue = Mathf.Clamp(font_normalStyle_prop.floatValue, -3.0f, 3.0f);
- if (GUI.changed || evt_cmd == k_UndoRedo)
- {
- GUI.changed = false;
-
- // Modify the material property on matching material presets.
- for (int i = 0; i < m_materialPresets.Length; i++)
- m_materialPresets[i].SetFloat("_WeightNormal", font_normalStyle_prop.floatValue);
- }
-
- EditorGUILayout.PropertyField(font_boldStyle_prop, new GUIContent("Bold Weight"));
- font_boldStyle_prop.floatValue = Mathf.Clamp(font_boldStyle_prop.floatValue, -3.0f, 3.0f);
- if (GUI.changed || evt_cmd == k_UndoRedo)
- {
- GUI.changed = false;
-
- // Modify the material property on matching material presets.
- for (int i = 0; i < m_materialPresets.Length; i++)
- m_materialPresets[i].SetFloat("_WeightBold", font_boldStyle_prop.floatValue);
- }
- EditorGUILayout.EndHorizontal();
-
- EditorGUILayout.BeginHorizontal();
- EditorGUILayout.PropertyField(font_normalSpacing_prop, new GUIContent("Spacing Offset"));
- font_normalSpacing_prop.floatValue = Mathf.Clamp(font_normalSpacing_prop.floatValue, -100, 100);
- if (GUI.changed || evt_cmd == k_UndoRedo)
- {
- GUI.changed = false;
- }
-
- EditorGUILayout.PropertyField(font_boldSpacing_prop, new GUIContent("Bold Spacing"));
- font_boldSpacing_prop.floatValue = Mathf.Clamp(font_boldSpacing_prop.floatValue, 0, 100);
- if (GUI.changed || evt_cmd == k_UndoRedo)
- {
- GUI.changed = false;
- }
- EditorGUILayout.EndHorizontal();
-
- EditorGUILayout.BeginHorizontal();
- EditorGUILayout.PropertyField(font_italicStyle_prop, new GUIContent("Italic Style"));
- font_italicStyle_prop.intValue = Mathf.Clamp(font_italicStyle_prop.intValue, 15, 60);
-
- EditorGUILayout.PropertyField(font_tabSize_prop, new GUIContent("Tab Multiple"));
- EditorGUILayout.EndHorizontal();
- EditorGUILayout.EndVertical();
- EditorGUILayout.Space();
- }
-
- EditorGUIUtility.labelWidth = 0;
- EditorGUIUtility.fieldWidth = 0;
- #endregion
-
- // FALLBACK FONT ASSETS
- #region Fallback Font Asset
- rect = EditorGUILayout.GetControlRect(false, 24);
- EditorGUI.indentLevel = 0;
- if (GUI.Button(rect, new GUIContent("<b>Fallback Font Assets</b>", "Select the Font Assets that will be searched and used as fallback when characters are missing from this font asset."), TMP_UIStyleManager.sectionHeader))
- UI_PanelState.fallbackFontAssetPanel = !UI_PanelState.fallbackFontAssetPanel;
-
- GUI.Label(rect, (UI_PanelState.fallbackFontAssetPanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
-
- if (UI_PanelState.fallbackFontAssetPanel)
- {
- EditorGUIUtility.labelWidth = 120;
- EditorGUI.indentLevel = 0;
-
- m_list.DoLayoutList();
- EditorGUILayout.Space();
- }
- #endregion
-
- // CHARACTER TABLE TABLE
- #region Character Table
- EditorGUIUtility.labelWidth = labelWidth;
- EditorGUIUtility.fieldWidth = fieldWidth;
- EditorGUI.indentLevel = 0;
- rect = EditorGUILayout.GetControlRect(false, 24);
-
- if (GUI.Button(rect, new GUIContent("<b>Character Table</b>", "List of characters contained in this font asset."), TMP_UIStyleManager.sectionHeader))
- UI_PanelState.characterTablePanel = !UI_PanelState.characterTablePanel;
-
- GUI.Label(rect, (UI_PanelState.characterTablePanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
-
- if (UI_PanelState.characterTablePanel)
- {
- int arraySize = m_CharacterTable_prop.arraySize;
- int itemsPerPage = 15;
-
- // Display Glyph Management Tools
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- {
- // Search Bar implementation
- #region DISPLAY SEARCH BAR
- EditorGUILayout.BeginHorizontal();
- {
- EditorGUIUtility.labelWidth = 130f;
- EditorGUI.BeginChangeCheck();
- string searchPattern = EditorGUILayout.TextField("Character Search", m_CharacterSearchPattern, "SearchTextField");
- if (EditorGUI.EndChangeCheck() || m_isSearchDirty)
- {
- if (string.IsNullOrEmpty(searchPattern) == false)
- {
- m_CharacterSearchPattern = searchPattern;
-
- // Search Character Table for potential matches
- SearchCharacterTable (m_CharacterSearchPattern, ref m_CharacterSearchList);
- }
- else
- m_CharacterSearchPattern = null;
-
- m_isSearchDirty = false;
- }
-
- string styleName = string.IsNullOrEmpty(m_CharacterSearchPattern) ? "SearchCancelButtonEmpty" : "SearchCancelButton";
- if (GUILayout.Button(GUIContent.none, styleName))
- {
- GUIUtility.keyboardControl = 0;
- m_CharacterSearchPattern = string.Empty;
- }
- }
- EditorGUILayout.EndHorizontal();
- #endregion
-
- // Display Page Navigation
- if (!string.IsNullOrEmpty(m_CharacterSearchPattern))
- arraySize = m_CharacterSearchList.Count;
-
- DisplayPageNavigation(ref m_CurrentCharacterPage, arraySize, itemsPerPage);
- }
- EditorGUILayout.EndVertical();
-
- // Display Character Table Elements
- if (arraySize > 0)
- {
- // Display each character entry using the CharacterPropertyDrawer.
- for (int i = itemsPerPage * m_CurrentCharacterPage; i < arraySize && i < itemsPerPage * (m_CurrentCharacterPage + 1); i++)
- {
- // Define the start of the selection region of the element.
- Rect elementStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- int elementIndex = i;
- if (!string.IsNullOrEmpty(m_CharacterSearchPattern))
- elementIndex = m_CharacterSearchList[i];
-
- SerializedProperty characterProperty = m_CharacterTable_prop.GetArrayElementAtIndex(elementIndex);
-
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
-
- EditorGUI.BeginDisabledGroup(i != m_SelectedCharacterRecord);
- {
- EditorGUILayout.PropertyField(characterProperty);
- }
- EditorGUI.EndDisabledGroup();
-
- EditorGUILayout.EndVertical();
-
- // Define the end of the selection region of the element.
- Rect elementEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- // Check for Item selection
- Rect selectionArea = new Rect(elementStartRegion.x, elementStartRegion.y, elementEndRegion.width, elementEndRegion.y - elementStartRegion.y);
- if (DoSelectionCheck(selectionArea))
- {
- if (m_SelectedCharacterRecord == i)
- m_SelectedCharacterRecord = -1;
- else
- {
- m_SelectedCharacterRecord = i;
- m_AddCharacterWarning.isEnabled = false;
- m_unicodeHexLabel = k_placeholderUnicodeHex;
- GUIUtility.keyboardControl = 0;
- }
- }
-
- // Draw Selection Highlight and Glyph Options
- if (m_SelectedCharacterRecord == i)
- {
- TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));
-
- // Draw Glyph management options
- Rect controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * 1f);
- float optionAreaWidth = controlRect.width * 0.6f;
- float btnWidth = optionAreaWidth / 3;
-
- Rect position = new Rect(controlRect.x + controlRect.width * .4f, controlRect.y, btnWidth, controlRect.height);
-
- // Copy Selected Glyph to Target Glyph ID
- GUI.enabled = !string.IsNullOrEmpty(m_dstUnicode);
- if (GUI.Button(position, new GUIContent("Copy to")))
- {
- GUIUtility.keyboardControl = 0;
-
- // Convert Hex Value to Decimal
- int dstGlyphID = TMP_TextUtilities.StringHexToInt(m_dstUnicode);
-
- //Add new glyph at target Unicode hex id.
- if (!AddNewCharacter(elementIndex, dstGlyphID))
- {
- m_AddCharacterWarning.isEnabled = true;
- m_AddCharacterWarning.expirationTime = EditorApplication.timeSinceStartup + 1;
- }
-
- m_dstUnicode = string.Empty;
- m_isSearchDirty = true;
-
- TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, m_fontAsset);
- }
-
- // Target Glyph ID
- GUI.enabled = true;
- position.x += btnWidth;
-
- GUI.SetNextControlName("CharacterID_Input");
- m_dstUnicode = EditorGUI.TextField(position, m_dstUnicode);
-
- // Placeholder text
- EditorGUI.LabelField(position, new GUIContent(m_unicodeHexLabel, "The Unicode (Hex) ID of the duplicated Character"), TMP_UIStyleManager.label);
-
- // Only filter the input when the destination glyph ID text field has focus.
- if (GUI.GetNameOfFocusedControl() == "CharacterID_Input")
- {
- m_unicodeHexLabel = string.Empty;
-
- //Filter out unwanted characters.
- char chr = Event.current.character;
- if ((chr < '0' || chr > '9') && (chr < 'a' || chr > 'f') && (chr < 'A' || chr > 'F'))
- {
- Event.current.character = '\0';
- }
- }
- else
- {
- m_unicodeHexLabel = k_placeholderUnicodeHex;
- //m_dstUnicode = string.Empty;
- }
-
-
- // Remove Glyph
- position.x += btnWidth;
- if (GUI.Button(position, "Remove"))
- {
- GUIUtility.keyboardControl = 0;
-
- RemoveCharacterFromList(elementIndex);
-
- isAssetDirty = true;
- m_SelectedCharacterRecord = -1;
- m_isSearchDirty = true;
- break;
- }
-
- if (m_AddCharacterWarning.isEnabled && EditorApplication.timeSinceStartup < m_AddCharacterWarning.expirationTime)
- {
- EditorGUILayout.HelpBox("The Destination Character ID already exists", MessageType.Warning);
- }
-
- }
- }
- }
-
- DisplayPageNavigation(ref m_CurrentCharacterPage, arraySize, itemsPerPage);
-
- EditorGUILayout.Space();
- }
- #endregion
-
- // GLYPH TABLE
- #region Glyph Table
- EditorGUIUtility.labelWidth = labelWidth;
- EditorGUIUtility.fieldWidth = fieldWidth;
- EditorGUI.indentLevel = 0;
- rect = EditorGUILayout.GetControlRect(false, 24);
-
- GUIStyle glyphPanelStyle = new GUIStyle(EditorStyles.helpBox);
-
- if (GUI.Button(rect, new GUIContent("<b>Glyph Table</b>", "List of glyphs contained in this font asset."), TMP_UIStyleManager.sectionHeader))
- UI_PanelState.glyphTablePanel = !UI_PanelState.glyphTablePanel;
-
- GUI.Label(rect, (UI_PanelState.glyphTablePanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
-
- if (UI_PanelState.glyphTablePanel)
- {
- int arraySize = m_GlyphTable_prop.arraySize;
- int itemsPerPage = 15;
-
- // Display Glyph Management Tools
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- {
- // Search Bar implementation
- #region DISPLAY SEARCH BAR
- EditorGUILayout.BeginHorizontal();
- {
- EditorGUIUtility.labelWidth = 130f;
- EditorGUI.BeginChangeCheck();
- string searchPattern = EditorGUILayout.TextField("Glyph Search", m_GlyphSearchPattern, "SearchTextField");
- if (EditorGUI.EndChangeCheck() || m_isSearchDirty)
- {
- if (string.IsNullOrEmpty(searchPattern) == false)
- {
- m_GlyphSearchPattern = searchPattern;
-
- // Search Glyph Table for potential matches
- SearchGlyphTable(m_GlyphSearchPattern, ref m_GlyphSearchList);
- }
- else
- m_GlyphSearchPattern = null;
-
- m_isSearchDirty = false;
- }
-
- string styleName = string.IsNullOrEmpty(m_GlyphSearchPattern) ? "SearchCancelButtonEmpty" : "SearchCancelButton";
- if (GUILayout.Button(GUIContent.none, styleName))
- {
- GUIUtility.keyboardControl = 0;
- m_GlyphSearchPattern = string.Empty;
- }
- }
- EditorGUILayout.EndHorizontal();
- #endregion
-
- // Display Page Navigation
- if (!string.IsNullOrEmpty(m_GlyphSearchPattern))
- arraySize = m_GlyphSearchList.Count;
-
- DisplayPageNavigation(ref m_CurrentGlyphPage, arraySize, itemsPerPage);
- }
- EditorGUILayout.EndVertical();
-
- // Display Glyph Table Elements
-
- if (arraySize > 0)
- {
- // Display each GlyphInfo entry using the GlyphInfo property drawer.
- for (int i = itemsPerPage * m_CurrentGlyphPage; i < arraySize && i < itemsPerPage * (m_CurrentGlyphPage + 1); i++)
- {
- // Define the start of the selection region of the element.
- Rect elementStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- int elementIndex = i;
- if (!string.IsNullOrEmpty(m_GlyphSearchPattern))
- elementIndex = m_GlyphSearchList[i];
-
- SerializedProperty glyphProperty = m_GlyphTable_prop.GetArrayElementAtIndex(elementIndex);
-
- EditorGUILayout.BeginVertical(glyphPanelStyle);
-
- using (new EditorGUI.DisabledScope(i != m_SelectedGlyphRecord))
- {
- EditorGUILayout.PropertyField(glyphProperty);
- }
-
- EditorGUILayout.EndVertical();
-
- // Define the end of the selection region of the element.
- Rect elementEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- // Check for Item selection
- Rect selectionArea = new Rect(elementStartRegion.x, elementStartRegion.y, elementEndRegion.width, elementEndRegion.y - elementStartRegion.y);
- if (DoSelectionCheck(selectionArea))
- {
- if (m_SelectedGlyphRecord == i)
- m_SelectedGlyphRecord = -1;
- else
- {
- m_SelectedGlyphRecord = i;
- m_AddGlyphWarning.isEnabled = false;
- m_unicodeHexLabel = k_placeholderUnicodeHex;
- GUIUtility.keyboardControl = 0;
- }
- }
-
- // Draw Selection Highlight and Glyph Options
- if (m_SelectedGlyphRecord == i)
- {
- TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));
-
- // Draw Glyph management options
- Rect controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * 1f);
- float optionAreaWidth = controlRect.width * 0.6f;
- float btnWidth = optionAreaWidth / 3;
-
- Rect position = new Rect(controlRect.x + controlRect.width * .4f, controlRect.y, btnWidth, controlRect.height);
-
- // Copy Selected Glyph to Target Glyph ID
- GUI.enabled = !string.IsNullOrEmpty(m_dstGlyphID);
- if (GUI.Button(position, new GUIContent("Copy to")))
- {
- GUIUtility.keyboardControl = 0;
-
- // Convert Hex Value to Decimal
- int.TryParse(m_dstGlyphID, out int dstGlyphID);
-
- //Add new glyph at target Unicode hex id.
- if (!AddNewGlyph(elementIndex, dstGlyphID))
- {
- m_AddGlyphWarning.isEnabled = true;
- m_AddGlyphWarning.expirationTime = EditorApplication.timeSinceStartup + 1;
- }
-
- m_dstGlyphID = string.Empty;
- m_isSearchDirty = true;
-
- TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, m_fontAsset);
- }
-
- // Target Glyph ID
- GUI.enabled = true;
- position.x += btnWidth;
-
- GUI.SetNextControlName("GlyphID_Input");
- m_dstGlyphID = EditorGUI.TextField(position, m_dstGlyphID);
-
- // Placeholder text
- EditorGUI.LabelField(position, new GUIContent(m_GlyphIDLabel, "The Glyph ID of the duplicated Glyph"), TMP_UIStyleManager.label);
-
- // Only filter the input when the destination glyph ID text field has focus.
- if (GUI.GetNameOfFocusedControl() == "GlyphID_Input")
- {
- m_GlyphIDLabel = string.Empty;
-
- //Filter out unwanted characters.
- char chr = Event.current.character;
- if ((chr < '0' || chr > '9'))
- {
- Event.current.character = '\0';
- }
- }
- else
- {
- m_GlyphIDLabel = k_placeholderGlyphID;
- //m_dstGlyphID = string.Empty;
- }
-
- // Remove Glyph
- position.x += btnWidth;
- if (GUI.Button(position, "Remove"))
- {
- GUIUtility.keyboardControl = 0;
-
- RemoveGlyphFromList(elementIndex);
-
- isAssetDirty = true;
- m_SelectedGlyphRecord = -1;
- m_isSearchDirty = true;
- break;
- }
-
- if (m_AddGlyphWarning.isEnabled && EditorApplication.timeSinceStartup < m_AddGlyphWarning.expirationTime)
- {
- EditorGUILayout.HelpBox("The Destination Glyph ID already exists", MessageType.Warning);
- }
-
- }
- }
- }
-
- DisplayPageNavigation(ref m_CurrentGlyphPage, arraySize, itemsPerPage);
-
- EditorGUILayout.Space();
- }
- #endregion
-
- // FONT FEATURE TABLE
- #region Font Feature Table
- EditorGUIUtility.labelWidth = labelWidth;
- EditorGUIUtility.fieldWidth = fieldWidth;
- EditorGUI.indentLevel = 0;
- rect = EditorGUILayout.GetControlRect(false, 24);
-
- if (GUI.Button(rect, new GUIContent("<b>Glyph Adjustment Table</b>", "List of glyph adjustment / advanced kerning pairs."), TMP_UIStyleManager.sectionHeader))
- UI_PanelState.fontFeatureTablePanel = !UI_PanelState.fontFeatureTablePanel;
-
- GUI.Label(rect, (UI_PanelState.fontFeatureTablePanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
-
- if (UI_PanelState.fontFeatureTablePanel)
- {
- int arraySize = m_GlyphPairAdjustmentRecords_prop.arraySize;
- int itemsPerPage = 20;
-
- // Display Kerning Pair Management Tools
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- {
- // Search Bar implementation
- #region DISPLAY SEARCH BAR
- EditorGUILayout.BeginHorizontal();
- {
- EditorGUIUtility.labelWidth = 150f;
- EditorGUI.BeginChangeCheck();
- string searchPattern = EditorGUILayout.TextField("Adjustment Pair Search", m_KerningTableSearchPattern, "SearchTextField");
- if (EditorGUI.EndChangeCheck() || m_isSearchDirty)
- {
- if (string.IsNullOrEmpty(searchPattern) == false)
- {
- m_KerningTableSearchPattern = searchPattern;
-
- // Search Glyph Table for potential matches
- SearchKerningTable(m_KerningTableSearchPattern, ref m_KerningTableSearchList);
- }
- else
- m_KerningTableSearchPattern = null;
-
- m_isSearchDirty = false;
- }
-
- string styleName = string.IsNullOrEmpty(m_KerningTableSearchPattern) ? "SearchCancelButtonEmpty" : "SearchCancelButton";
- if (GUILayout.Button(GUIContent.none, styleName))
- {
- GUIUtility.keyboardControl = 0;
- m_KerningTableSearchPattern = string.Empty;
- }
- }
- EditorGUILayout.EndHorizontal();
- #endregion
-
- // Display Page Navigation
- if (!string.IsNullOrEmpty(m_KerningTableSearchPattern))
- arraySize = m_KerningTableSearchList.Count;
-
- DisplayPageNavigation(ref m_CurrentKerningPage, arraySize, itemsPerPage);
- }
- EditorGUILayout.EndVertical();
-
- if (arraySize > 0)
- {
- // Display each GlyphInfo entry using the GlyphInfo property drawer.
- for (int i = itemsPerPage * m_CurrentKerningPage; i < arraySize && i < itemsPerPage * (m_CurrentKerningPage + 1); i++)
- {
- // Define the start of the selection region of the element.
- Rect elementStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- int elementIndex = i;
- if (!string.IsNullOrEmpty(m_KerningTableSearchPattern))
- elementIndex = m_KerningTableSearchList[i];
-
- SerializedProperty pairAdjustmentRecordProperty = m_GlyphPairAdjustmentRecords_prop.GetArrayElementAtIndex(elementIndex);
-
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
-
- using (new EditorGUI.DisabledScope(i != m_SelectedAdjustmentRecord))
- {
- EditorGUILayout.PropertyField(pairAdjustmentRecordProperty, new GUIContent("Selectable"));
- }
-
- EditorGUILayout.EndVertical();
-
- // Define the end of the selection region of the element.
- Rect elementEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- // Check for Item selection
- Rect selectionArea = new Rect(elementStartRegion.x, elementStartRegion.y, elementEndRegion.width, elementEndRegion.y - elementStartRegion.y);
- if (DoSelectionCheck(selectionArea))
- {
- if (m_SelectedAdjustmentRecord == i)
- {
- m_SelectedAdjustmentRecord = -1;
- }
- else
- {
- m_SelectedAdjustmentRecord = i;
- GUIUtility.keyboardControl = 0;
- }
- }
-
- // Draw Selection Highlight and Kerning Pair Options
- if (m_SelectedAdjustmentRecord == i)
- {
- TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));
-
- // Draw Glyph management options
- Rect controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * 1f);
- float optionAreaWidth = controlRect.width;
- float btnWidth = optionAreaWidth / 4;
-
- Rect position = new Rect(controlRect.x + controlRect.width - btnWidth, controlRect.y, btnWidth, controlRect.height);
-
- // Remove Kerning pair
- GUI.enabled = true;
- if (GUI.Button(position, "Remove"))
- {
- GUIUtility.keyboardControl = 0;
-
- RemoveAdjustmentPairFromList(i);
-
- isAssetDirty = true;
- m_SelectedAdjustmentRecord = -1;
- m_isSearchDirty = true;
- break;
- }
- }
- }
- }
-
- DisplayPageNavigation(ref m_CurrentKerningPage, arraySize, itemsPerPage);
-
- GUILayout.Space(5);
-
- // Add new kerning pair
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- {
- EditorGUILayout.PropertyField(m_EmptyGlyphPairAdjustmentRecord_prop);
- }
- EditorGUILayout.EndVertical();
-
- if (GUILayout.Button("Add New Glyph Adjustment Record"))
- {
- SerializedProperty firstAdjustmentRecordProperty = m_EmptyGlyphPairAdjustmentRecord_prop.FindPropertyRelative("m_FirstAdjustmentRecord");
- SerializedProperty secondAdjustmentRecordProperty = m_EmptyGlyphPairAdjustmentRecord_prop.FindPropertyRelative("m_SecondAdjustmentRecord");
-
- uint firstGlyphIndex = (uint)firstAdjustmentRecordProperty.FindPropertyRelative("m_GlyphIndex").intValue;
- uint secondGlyphIndex = (uint)secondAdjustmentRecordProperty.FindPropertyRelative("m_GlyphIndex").intValue;
-
- TMP_GlyphValueRecord firstValueRecord = GetValueRecord(firstAdjustmentRecordProperty.FindPropertyRelative("m_GlyphValueRecord"));
- TMP_GlyphValueRecord secondValueRecord = GetValueRecord(secondAdjustmentRecordProperty.FindPropertyRelative("m_GlyphValueRecord"));
-
- errorCode = -1;
- long pairKey = (long)secondGlyphIndex << 32 | firstGlyphIndex;
- if (m_FontFeatureTable.m_GlyphPairAdjustmentRecordLookupDictionary.ContainsKey(pairKey) == false)
- {
- TMP_GlyphPairAdjustmentRecord adjustmentRecord = new TMP_GlyphPairAdjustmentRecord(new TMP_GlyphAdjustmentRecord(firstGlyphIndex, firstValueRecord), new TMP_GlyphAdjustmentRecord(secondGlyphIndex, secondValueRecord));
- m_FontFeatureTable.m_GlyphPairAdjustmentRecords.Add(adjustmentRecord);
- m_FontFeatureTable.m_GlyphPairAdjustmentRecordLookupDictionary.Add(pairKey, adjustmentRecord);
- errorCode = 0;
- }
-
- // Add glyphs and characters
- uint firstCharacter = m_SerializedPropertyHolder.firstCharacter;
- if (!m_fontAsset.characterLookupTable.ContainsKey(firstCharacter))
- m_fontAsset.TryAddCharacterInternal(firstCharacter, out TMP_Character character);
-
- uint secondCharacter = m_SerializedPropertyHolder.secondCharacter;
- if (!m_fontAsset.characterLookupTable.ContainsKey(secondCharacter))
- m_fontAsset.TryAddCharacterInternal(secondCharacter, out TMP_Character character);
-
- // Sort Kerning Pairs & Reload Font Asset if new kerning pair was added.
- if (errorCode != -1)
- {
- m_FontFeatureTable.SortGlyphPairAdjustmentRecords();
- serializedObject.ApplyModifiedProperties();
- isAssetDirty = true;
- m_isSearchDirty = true;
- }
- else
- {
- timeStamp = System.DateTime.Now.AddSeconds(5);
- }
-
- // Clear Add Kerning Pair Panel
- // TODO
- }
-
- if (errorCode == -1)
- {
- GUILayout.BeginHorizontal();
- GUILayout.FlexibleSpace();
- GUILayout.Label("Kerning Pair already <color=#ffff00>exists!</color>", TMP_UIStyleManager.label);
- GUILayout.FlexibleSpace();
- GUILayout.EndHorizontal();
-
- if (System.DateTime.Now > timeStamp)
- errorCode = 0;
- }
- }
- #endregion
-
- if (serializedObject.ApplyModifiedProperties() || evt_cmd == k_UndoRedo || isAssetDirty)
- {
- // Delay callback until user has decided to Apply or Revert the changes.
- if (m_DisplayDestructiveChangeWarning == false)
- TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, m_fontAsset);
-
- if (m_fontAsset.m_IsFontAssetLookupTablesDirty || evt_cmd == k_UndoRedo)
- m_fontAsset.ReadFontAssetDefinition();
-
- isAssetDirty = false;
- EditorUtility.SetDirty(target);
- }
-
-
- // Clear selection if mouse event was not consumed.
- GUI.enabled = true;
- if (currentEvent.type == EventType.MouseDown && currentEvent.button == 0)
- m_SelectedAdjustmentRecord = -1;
-
- }
-
- void CleanFallbackFontAssetTable()
- {
- SerializedProperty m_FallbackFontAsseTable = serializedObject.FindProperty("m_FallbackFontAssetTable");
-
- bool isListDirty = false;
-
- int elementCount = m_FallbackFontAsseTable.arraySize;
-
- for (int i = 0; i < elementCount; i++)
- {
- SerializedProperty element = m_FallbackFontAsseTable.GetArrayElementAtIndex(i);
- if (element.objectReferenceValue == null)
- {
- m_FallbackFontAsseTable.DeleteArrayElementAtIndex(i);
- elementCount -= 1;
- i -= 1;
-
- isListDirty = true;
- }
- }
-
- if (isListDirty)
- {
- serializedObject.ApplyModifiedProperties();
- serializedObject.Update();
- }
- }
-
- void SavedAtlasGenerationSettings()
- {
- m_AtlasSettings.glyphRenderMode = (GlyphRenderMode)m_AtlasRenderMode_prop.intValue;
- m_AtlasSettings.pointSize = m_SamplingPointSize_prop.intValue;
- m_AtlasSettings.padding = m_AtlasPadding_prop.intValue;
- m_AtlasSettings.atlasWidth = m_AtlasWidth_prop.intValue;
- m_AtlasSettings.atlasHeight = m_AtlasHeight_prop.intValue;
- }
-
- void RestoreAtlasGenerationSettings()
- {
- m_AtlasRenderMode_prop.intValue = (int)m_AtlasSettings.glyphRenderMode;
- m_SamplingPointSize_prop.intValue = m_AtlasSettings.pointSize;
- m_AtlasPadding_prop.intValue = m_AtlasSettings.padding;
- m_AtlasWidth_prop.intValue = m_AtlasSettings.atlasWidth;
- m_AtlasHeight_prop.intValue = m_AtlasSettings.atlasHeight;
- }
-
-
- void UpdateFontAssetCreationSettings()
- {
- m_fontAsset.m_CreationSettings.pointSize = m_SamplingPointSize_prop.intValue;
- m_fontAsset.m_CreationSettings.renderMode = m_AtlasRenderMode_prop.intValue;
- m_fontAsset.m_CreationSettings.padding = m_AtlasPadding_prop.intValue;
- m_fontAsset.m_CreationSettings.atlasWidth = m_AtlasWidth_prop.intValue;
- m_fontAsset.m_CreationSettings.atlasHeight = m_AtlasHeight_prop.intValue;
- }
-
-
- void UpdateCharacterData(SerializedProperty property, int index)
- {
- TMP_Character character = m_fontAsset.characterTable[index];
-
- character.unicode = (uint)property.FindPropertyRelative("m_Unicode").intValue;
- character.scale = property.FindPropertyRelative("m_Scale").floatValue;
-
- SerializedProperty glyphProperty = property.FindPropertyRelative("m_Glyph");
- character.glyph.index = (uint)glyphProperty.FindPropertyRelative("m_Index").intValue;
-
- SerializedProperty glyphRectProperty = glyphProperty.FindPropertyRelative("m_GlyphRect");
- character.glyph.glyphRect = new GlyphRect(glyphRectProperty.FindPropertyRelative("m_X").intValue, glyphRectProperty.FindPropertyRelative("m_Y").intValue, glyphRectProperty.FindPropertyRelative("m_Width").intValue, glyphRectProperty.FindPropertyRelative("m_Height").intValue);
-
- SerializedProperty glyphMetricsProperty = glyphProperty.FindPropertyRelative("m_Metrics");
- character.glyph.metrics = new GlyphMetrics(glyphMetricsProperty.FindPropertyRelative("m_Width").floatValue, glyphMetricsProperty.FindPropertyRelative("m_Height").floatValue, glyphMetricsProperty.FindPropertyRelative("m_HorizontalBearingX").floatValue, glyphMetricsProperty.FindPropertyRelative("m_HorizontalBearingY").floatValue, glyphMetricsProperty.FindPropertyRelative("m_HorizontalAdvance").floatValue);
-
- character.glyph.scale = glyphProperty.FindPropertyRelative("m_Scale").floatValue;
-
- character.glyph.atlasIndex = glyphProperty.FindPropertyRelative("m_AtlasIndex").intValue;
- }
-
-
- void UpdateGlyphData(SerializedProperty property, int index)
- {
- Glyph glyph = m_fontAsset.glyphTable[index];
-
- glyph.index = (uint)property.FindPropertyRelative("m_Index").intValue;
-
- SerializedProperty glyphRect = property.FindPropertyRelative("m_GlyphRect");
- glyph.glyphRect = new GlyphRect(glyphRect.FindPropertyRelative("m_X").intValue, glyphRect.FindPropertyRelative("m_Y").intValue, glyphRect.FindPropertyRelative("m_Width").intValue, glyphRect.FindPropertyRelative("m_Height").intValue);
-
- SerializedProperty glyphMetrics = property.FindPropertyRelative("m_Metrics");
- glyph.metrics = new GlyphMetrics(glyphMetrics.FindPropertyRelative("m_Width").floatValue, glyphMetrics.FindPropertyRelative("m_Height").floatValue, glyphMetrics.FindPropertyRelative("m_HorizontalBearingX").floatValue, glyphMetrics.FindPropertyRelative("m_HorizontalBearingY").floatValue, glyphMetrics.FindPropertyRelative("m_HorizontalAdvance").floatValue);
-
- glyph.scale = property.FindPropertyRelative("m_Scale").floatValue;
- }
-
-
- void DisplayPageNavigation(ref int currentPage, int arraySize, int itemsPerPage)
- {
- Rect pagePos = EditorGUILayout.GetControlRect(false, 20);
- pagePos.width /= 3;
-
- int shiftMultiplier = Event.current.shift ? 10 : 1; // Page + Shift goes 10 page forward
-
- // Previous Page
- GUI.enabled = currentPage > 0;
-
- if (GUI.Button(pagePos, "Previous Page"))
- currentPage -= 1 * shiftMultiplier;
-
-
- // Page Counter
- GUI.enabled = true;
- pagePos.x += pagePos.width;
- int totalPages = (int)(arraySize / (float)itemsPerPage + 0.999f);
- GUI.Label(pagePos, "Page " + (currentPage + 1) + " / " + totalPages, TMP_UIStyleManager.centeredLabel);
-
- // Next Page
- pagePos.x += pagePos.width;
- GUI.enabled = itemsPerPage * (currentPage + 1) < arraySize;
-
- if (GUI.Button(pagePos, "Next Page"))
- currentPage += 1 * shiftMultiplier;
-
- // Clamp page range
- currentPage = Mathf.Clamp(currentPage, 0, arraySize / itemsPerPage);
-
- GUI.enabled = true;
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="srcGlyphID"></param>
- /// <param name="dstGlyphID"></param>
- bool AddNewGlyph(int srcIndex, int dstGlyphID)
- {
- // Make sure Destination Glyph ID doesn't already contain a Glyph
- if (m_fontAsset.glyphLookupTable.ContainsKey((uint)dstGlyphID))
- return false;
-
- // Add new element to glyph list.
- m_GlyphTable_prop.arraySize += 1;
-
- // Get a reference to the source glyph.
- SerializedProperty sourceGlyph = m_GlyphTable_prop.GetArrayElementAtIndex(srcIndex);
-
- int dstIndex = m_GlyphTable_prop.arraySize - 1;
-
- // Get a reference to the target / destination glyph.
- SerializedProperty targetGlyph = m_GlyphTable_prop.GetArrayElementAtIndex(dstIndex);
-
- CopyGlyphSerializedProperty(sourceGlyph, ref targetGlyph);
-
- // Update the ID of the glyph
- targetGlyph.FindPropertyRelative("m_Index").intValue = dstGlyphID;
-
- serializedObject.ApplyModifiedProperties();
-
- m_fontAsset.SortGlyphTable();
-
- m_fontAsset.ReadFontAssetDefinition();
-
- return true;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="glyphID"></param>
- void RemoveGlyphFromList(int index)
- {
- if (index > m_GlyphTable_prop.arraySize)
- return;
-
- int targetGlyphIndex = m_GlyphTable_prop.GetArrayElementAtIndex(index).FindPropertyRelative("m_Index").intValue;
-
- m_GlyphTable_prop.DeleteArrayElementAtIndex(index);
-
- // Remove all characters referencing this glyph.
- for (int i = 0; i < m_CharacterTable_prop.arraySize; i++)
- {
- int glyphIndex = m_CharacterTable_prop.GetArrayElementAtIndex(i).FindPropertyRelative("m_GlyphIndex").intValue;
-
- if (glyphIndex == targetGlyphIndex)
- {
- // Remove character
- m_CharacterTable_prop.DeleteArrayElementAtIndex(i);
- }
- }
-
- serializedObject.ApplyModifiedProperties();
-
- m_fontAsset.ReadFontAssetDefinition();
- }
-
- bool AddNewCharacter(int srcIndex, int dstGlyphID)
- {
- // Make sure Destination Glyph ID doesn't already contain a Glyph
- if (m_fontAsset.characterLookupTable.ContainsKey((uint)dstGlyphID))
- return false;
-
- // Add new element to glyph list.
- m_CharacterTable_prop.arraySize += 1;
-
- // Get a reference to the source glyph.
- SerializedProperty sourceCharacter = m_CharacterTable_prop.GetArrayElementAtIndex(srcIndex);
-
- int dstIndex = m_CharacterTable_prop.arraySize - 1;
-
- // Get a reference to the target / destination glyph.
- SerializedProperty targetCharacter = m_CharacterTable_prop.GetArrayElementAtIndex(dstIndex);
-
- CopyCharacterSerializedProperty(sourceCharacter, ref targetCharacter);
-
- // Update the ID of the glyph
- targetCharacter.FindPropertyRelative("m_Unicode").intValue = dstGlyphID;
-
- serializedObject.ApplyModifiedProperties();
-
- m_fontAsset.SortCharacterTable();
-
- m_fontAsset.ReadFontAssetDefinition();
-
- return true;
- }
-
- void RemoveCharacterFromList(int index)
- {
- if (index > m_CharacterTable_prop.arraySize)
- return;
-
- m_CharacterTable_prop.DeleteArrayElementAtIndex(index);
-
- serializedObject.ApplyModifiedProperties();
-
- m_fontAsset.ReadFontAssetDefinition();
- }
-
-
- // Check if any of the Style elements were clicked on.
- private bool DoSelectionCheck(Rect selectionArea)
- {
- Event currentEvent = Event.current;
-
- switch (currentEvent.type)
- {
- case EventType.MouseDown:
- if (selectionArea.Contains(currentEvent.mousePosition) && currentEvent.button == 0)
- {
- currentEvent.Use();
- return true;
- }
-
- break;
- }
-
- return false;
- }
-
- TMP_GlyphValueRecord GetValueRecord(SerializedProperty property)
- {
- TMP_GlyphValueRecord record = new TMP_GlyphValueRecord();
- record.xPlacement = property.FindPropertyRelative("m_XPlacement").floatValue;
- record.yPlacement = property.FindPropertyRelative("m_YPlacement").floatValue;
- record.xAdvance = property.FindPropertyRelative("m_XAdvance").floatValue;
- record.yAdvance = property.FindPropertyRelative("m_YAdvance").floatValue;
-
- return record;
- }
-
- void RemoveAdjustmentPairFromList(int index)
- {
- if (index > m_GlyphPairAdjustmentRecords_prop.arraySize)
- return;
-
- m_GlyphPairAdjustmentRecords_prop.DeleteArrayElementAtIndex(index);
-
- serializedObject.ApplyModifiedProperties();
-
- m_fontAsset.ReadFontAssetDefinition();
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="srcGlyph"></param>
- /// <param name="dstGlyph"></param>
- void CopyGlyphSerializedProperty(SerializedProperty srcGlyph, ref SerializedProperty dstGlyph)
- {
- // TODO : Should make a generic function which copies each of the properties.
- dstGlyph.FindPropertyRelative("m_Index").intValue = srcGlyph.FindPropertyRelative("m_Index").intValue;
-
- // Glyph -> GlyphMetrics
- SerializedProperty srcGlyphMetrics = srcGlyph.FindPropertyRelative("m_Metrics");
- SerializedProperty dstGlyphMetrics = dstGlyph.FindPropertyRelative("m_Metrics");
-
- dstGlyphMetrics.FindPropertyRelative("m_Width").floatValue = srcGlyphMetrics.FindPropertyRelative("m_Width").floatValue;
- dstGlyphMetrics.FindPropertyRelative("m_Height").floatValue = srcGlyphMetrics.FindPropertyRelative("m_Height").floatValue;
- dstGlyphMetrics.FindPropertyRelative("m_HorizontalBearingX").floatValue = srcGlyphMetrics.FindPropertyRelative("m_HorizontalBearingX").floatValue;
- dstGlyphMetrics.FindPropertyRelative("m_HorizontalBearingY").floatValue = srcGlyphMetrics.FindPropertyRelative("m_HorizontalBearingY").floatValue;
- dstGlyphMetrics.FindPropertyRelative("m_HorizontalAdvance").floatValue = srcGlyphMetrics.FindPropertyRelative("m_HorizontalAdvance").floatValue;
-
- // Glyph -> GlyphRect
- SerializedProperty srcGlyphRect = srcGlyph.FindPropertyRelative("m_GlyphRect");
- SerializedProperty dstGlyphRect = dstGlyph.FindPropertyRelative("m_GlyphRect");
-
- dstGlyphRect.FindPropertyRelative("m_X").intValue = srcGlyphRect.FindPropertyRelative("m_X").intValue;
- dstGlyphRect.FindPropertyRelative("m_Y").intValue = srcGlyphRect.FindPropertyRelative("m_Y").intValue;
- dstGlyphRect.FindPropertyRelative("m_Width").intValue = srcGlyphRect.FindPropertyRelative("m_Width").intValue;
- dstGlyphRect.FindPropertyRelative("m_Height").intValue = srcGlyphRect.FindPropertyRelative("m_Height").intValue;
-
- dstGlyph.FindPropertyRelative("m_Scale").floatValue = srcGlyph.FindPropertyRelative("m_Scale").floatValue;
- dstGlyph.FindPropertyRelative("m_AtlasIndex").intValue = srcGlyph.FindPropertyRelative("m_AtlasIndex").intValue;
- }
-
-
- void CopyCharacterSerializedProperty(SerializedProperty source, ref SerializedProperty target)
- {
- // TODO : Should make a generic function which copies each of the properties.
- int unicode = source.FindPropertyRelative("m_Unicode").intValue;
- target.FindPropertyRelative("m_Unicode").intValue = unicode;
-
- int srcGlyphIndex = source.FindPropertyRelative("m_GlyphIndex").intValue;
- target.FindPropertyRelative("m_GlyphIndex").intValue = srcGlyphIndex;
-
- target.FindPropertyRelative("m_Scale").floatValue = source.FindPropertyRelative("m_Scale").floatValue;
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="searchPattern"></param>
- /// <returns></returns>
- void SearchGlyphTable (string searchPattern, ref List<int> searchResults)
- {
- if (searchResults == null) searchResults = new List<int>();
-
- searchResults.Clear();
-
- int arraySize = m_GlyphTable_prop.arraySize;
-
- for (int i = 0; i < arraySize; i++)
- {
- SerializedProperty sourceGlyph = m_GlyphTable_prop.GetArrayElementAtIndex(i);
-
- int id = sourceGlyph.FindPropertyRelative("m_Index").intValue;
-
- // Check for potential match against a character.
- //if (searchPattern.Length == 1 && id == searchPattern[0])
- // searchResults.Add(i);
-
- // Check for potential match against decimal id
- if (id.ToString().Contains(searchPattern))
- searchResults.Add(i);
-
- //if (id.ToString("x").Contains(searchPattern))
- // searchResults.Add(i);
-
- //if (id.ToString("X").Contains(searchPattern))
- // searchResults.Add(i);
- }
- }
-
-
- void SearchCharacterTable(string searchPattern, ref List<int> searchResults)
- {
- if (searchResults == null) searchResults = new List<int>();
-
- searchResults.Clear();
-
- int arraySize = m_CharacterTable_prop.arraySize;
-
- for (int i = 0; i < arraySize; i++)
- {
- SerializedProperty sourceCharacter = m_CharacterTable_prop.GetArrayElementAtIndex(i);
-
- int id = sourceCharacter.FindPropertyRelative("m_Unicode").intValue;
-
- // Check for potential match against a character.
- if (searchPattern.Length == 1 && id == searchPattern[0])
- searchResults.Add(i);
- else if (id.ToString("x").Contains(searchPattern))
- searchResults.Add(i);
- else if (id.ToString("X").Contains(searchPattern))
- searchResults.Add(i);
-
- // Check for potential match against decimal id
- //if (id.ToString().Contains(searchPattern))
- // searchResults.Add(i);
- }
- }
-
-
- void SearchKerningTable(string searchPattern, ref List<int> searchResults)
- {
- if (searchResults == null) searchResults = new List<int>();
-
- searchResults.Clear();
-
- // Lookup glyph index of potential characters contained in the search pattern.
- uint firstGlyphIndex = 0;
- if (searchPattern.Length > 0 && m_fontAsset.characterLookupTable.TryGetValue(searchPattern[0], out TMP_Character firstCharacterSearch))
- firstGlyphIndex = firstCharacterSearch.glyphIndex;
-
- uint secondGlyphIndex = 0;
- if (searchPattern.Length > 1 && m_fontAsset.characterLookupTable.TryGetValue(searchPattern[1], out TMP_Character secondCharacterSearch))
- secondGlyphIndex = secondCharacterSearch.glyphIndex;
-
- int arraySize = m_GlyphPairAdjustmentRecords_prop.arraySize;
-
- for (int i = 0; i < arraySize; i++)
- {
- SerializedProperty record = m_GlyphPairAdjustmentRecords_prop.GetArrayElementAtIndex(i);
-
- SerializedProperty firstAdjustmentRecord = record.FindPropertyRelative("m_FirstAdjustmentRecord");
- SerializedProperty secondAdjustmentRecord = record.FindPropertyRelative("m_SecondAdjustmentRecord");
-
- int firstGlyph = firstAdjustmentRecord.FindPropertyRelative("m_GlyphIndex").intValue;
- int secondGlyph = secondAdjustmentRecord.FindPropertyRelative("m_GlyphIndex").intValue;
-
- if (firstGlyphIndex == firstGlyph && secondGlyphIndex == secondGlyph)
- searchResults.Add(i);
- else if (searchPattern.Length == 1 && (firstGlyphIndex == firstGlyph || firstGlyphIndex == secondGlyph))
- searchResults.Add(i);
- else if (firstGlyph.ToString().Contains(searchPattern))
- searchResults.Add(i);
- else if (secondGlyph.ToString().Contains(searchPattern))
- searchResults.Add(i);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAssetEditor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAssetEditor.cs.meta
deleted file mode 100644
index b243777..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAssetEditor.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 96b44f7d98314b139324a8a87eb66067
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAsset_CreationMenu.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAsset_CreationMenu.cs
deleted file mode 100644
index dca6d14..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAsset_CreationMenu.cs
+++ /dev/null
@@ -1,190 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.Linq;
-using System.IO;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine.TextCore;
-using UnityEngine.TextCore.LowLevel;
-using TMPro;
-
-
-namespace TMPro
-{
- public static class TMP_FontAsset_CreationMenu
- {
- /*
- [MenuItem("Assets/Create/TextMeshPro/Font Asset Fallback", false, 105)]
- public static void CreateFallbackFontAsset()
- {
- Object target = Selection.activeObject;
-
- // Make sure the selection is a font file
- if (target == null || target.GetType() != typeof(TMP_FontAsset))
- {
- Debug.LogWarning("A Font file must first be selected in order to create a Font Asset.");
- return;
- }
-
- TMP_FontAsset sourceFontAsset = (TMP_FontAsset)target;
-
- string sourceFontFilePath = AssetDatabase.GetAssetPath(target);
-
- string folderPath = Path.GetDirectoryName(sourceFontFilePath);
- string assetName = Path.GetFileNameWithoutExtension(sourceFontFilePath);
-
- string newAssetFilePathWithName = AssetDatabase.GenerateUniqueAssetPath(folderPath + "/" + assetName + " - Fallback.asset");
-
- //// Create new TM Font Asset.
- TMP_FontAsset fontAsset = ScriptableObject.CreateInstance<TMP_FontAsset>();
- AssetDatabase.CreateAsset(fontAsset, newAssetFilePathWithName);
-
- fontAsset.version = "1.1.0";
-
- fontAsset.faceInfo = sourceFontAsset.faceInfo;
-
- fontAsset.m_SourceFontFileGUID = sourceFontAsset.m_SourceFontFileGUID;
- fontAsset.m_SourceFontFile_EditorRef = sourceFontAsset.m_SourceFontFile_EditorRef;
- fontAsset.atlasPopulationMode = TMP_FontAsset.AtlasPopulationMode.Dynamic;
-
- int atlasWidth = fontAsset.atlasWidth = sourceFontAsset.atlasWidth;
- int atlasHeight = fontAsset.atlasHeight = sourceFontAsset.atlasHeight;
- int atlasPadding = fontAsset.atlasPadding = sourceFontAsset.atlasPadding;
- fontAsset.atlasRenderMode = sourceFontAsset.atlasRenderMode;
-
- // Initialize array for the font atlas textures.
- fontAsset.atlasTextures = new Texture2D[1];
-
- // Create and add font atlas texture
- Texture2D texture = new Texture2D(atlasWidth, atlasHeight, TextureFormat.Alpha8, false);
- Color32[] colors = new Color32[atlasWidth * atlasHeight];
- texture.SetPixels32(colors);
-
- texture.name = assetName + " Atlas";
- fontAsset.atlasTextures[0] = texture;
- AssetDatabase.AddObjectToAsset(texture, fontAsset);
-
- // Add free rectangle of the size of the texture.
- int packingModifier = ((GlyphRasterModes)fontAsset.atlasRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP ? 0 : 1;
- fontAsset.m_FreeGlyphRects = new List<GlyphRect>() { new GlyphRect(0, 0, atlasWidth - packingModifier, atlasHeight - packingModifier) };
- fontAsset.m_UsedGlyphRects = new List<GlyphRect>();
-
- // Create new Material and Add it as Sub-Asset
- Material tmp_material = new Material(sourceFontAsset.material);
-
- tmp_material.name = texture.name + " Material";
- tmp_material.SetTexture(ShaderUtilities.ID_MainTex, texture);
- tmp_material.SetFloat(ShaderUtilities.ID_TextureWidth, atlasWidth);
- tmp_material.SetFloat(ShaderUtilities.ID_TextureHeight, atlasHeight);
-
- tmp_material.SetFloat(ShaderUtilities.ID_GradientScale, atlasPadding + packingModifier);
-
- tmp_material.SetFloat(ShaderUtilities.ID_WeightNormal, fontAsset.normalStyle);
- tmp_material.SetFloat(ShaderUtilities.ID_WeightBold, fontAsset.boldStyle);
-
- fontAsset.material = tmp_material;
-
- AssetDatabase.AddObjectToAsset(tmp_material, fontAsset);
-
- // Add Font Asset Creation Settings
- // TODO
-
- // Not sure if this is still necessary in newer versions of Unity.
- EditorUtility.SetDirty(fontAsset);
-
- AssetDatabase.SaveAssets();
- }
- */
-
- //[MenuItem("Assets/Create/TextMeshPro/Font Asset #%F12", true)]
- //public static bool CreateFontAssetMenuValidation()
- //{
- // return false;
- //}
-
- [MenuItem("Assets/Create/TextMeshPro/Font Asset #%F12", false, 100)]
- public static void CreateFontAsset()
- {
- Object target = Selection.activeObject;
-
- // Make sure the selection is a font file
- if (target == null || target.GetType() != typeof(Font))
- {
- Debug.LogWarning("A Font file must first be selected in order to create a Font Asset.");
- return;
- }
-
- Font sourceFont = (Font)target;
-
- string sourceFontFilePath = AssetDatabase.GetAssetPath(target);
-
- string folderPath = Path.GetDirectoryName(sourceFontFilePath);
- string assetName = Path.GetFileNameWithoutExtension(sourceFontFilePath);
-
- string newAssetFilePathWithName = AssetDatabase.GenerateUniqueAssetPath(folderPath + "/" + assetName + " SDF.asset");
-
- //// Create new TM Font Asset.
- TMP_FontAsset fontAsset = ScriptableObject.CreateInstance<TMP_FontAsset>();
- AssetDatabase.CreateAsset(fontAsset, newAssetFilePathWithName);
-
- fontAsset.version = "1.1.0";
-
- // Set face information
- FontEngine.InitializeFontEngine();
- FontEngine.LoadFontFace(sourceFont, 90);
- fontAsset.faceInfo = FontEngine.GetFaceInfo();
-
- // Set font reference and GUID
- fontAsset.m_SourceFontFileGUID = AssetDatabase.AssetPathToGUID(sourceFontFilePath);
- fontAsset.m_SourceFontFile_EditorRef = sourceFont;
- fontAsset.atlasPopulationMode = AtlasPopulationMode.Dynamic;
-
- // Default atlas resolution is 1024 x 1024.
- int atlasWidth = fontAsset.atlasWidth = 1024;
- int atlasHeight = fontAsset.atlasHeight = 1024;
- int atlasPadding = fontAsset.atlasPadding = 9;
- fontAsset.atlasRenderMode = GlyphRenderMode.SDFAA;
-
- // Initialize array for the font atlas textures.
- fontAsset.atlasTextures = new Texture2D[1];
-
- // Create atlas texture of size zero.
- Texture2D texture = new Texture2D(0, 0, TextureFormat.Alpha8, false);
-
- texture.name = assetName + " Atlas";
- fontAsset.atlasTextures[0] = texture;
- AssetDatabase.AddObjectToAsset(texture, fontAsset);
-
- // Add free rectangle of the size of the texture.
- int packingModifier = ((GlyphRasterModes)fontAsset.atlasRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP ? 0 : 1;
- fontAsset.freeGlyphRects = new List<GlyphRect>() { new GlyphRect(0, 0, atlasWidth - packingModifier, atlasHeight - packingModifier) };
- fontAsset.usedGlyphRects = new List<GlyphRect>();
-
- // Create new Material and Add it as Sub-Asset
- Shader default_Shader = Shader.Find("TextMeshPro/Distance Field");
- Material tmp_material = new Material(default_Shader);
-
- tmp_material.name = texture.name + " Material";
- tmp_material.SetTexture(ShaderUtilities.ID_MainTex, texture);
- tmp_material.SetFloat(ShaderUtilities.ID_TextureWidth, atlasWidth);
- tmp_material.SetFloat(ShaderUtilities.ID_TextureHeight, atlasHeight);
-
- tmp_material.SetFloat(ShaderUtilities.ID_GradientScale, atlasPadding + packingModifier);
-
- tmp_material.SetFloat(ShaderUtilities.ID_WeightNormal, fontAsset.normalStyle);
- tmp_material.SetFloat(ShaderUtilities.ID_WeightBold, fontAsset.boldStyle);
-
- fontAsset.material = tmp_material;
-
- AssetDatabase.AddObjectToAsset(tmp_material, fontAsset);
-
- // Add Font Asset Creation Settings
- fontAsset.creationSettings = new FontAssetCreationSettings(fontAsset.m_SourceFontFileGUID, fontAsset.faceInfo.pointSize, 0, atlasPadding, 0, 1024, 1024, 7, string.Empty, (int)GlyphRenderMode.SDFAA);
-
- // Not sure if this is still necessary in newer versions of Unity.
- EditorUtility.SetDirty(fontAsset);
-
- AssetDatabase.SaveAssets();
- }
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAsset_CreationMenu.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAsset_CreationMenu.cs.meta
deleted file mode 100644
index ade7a84..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_FontAsset_CreationMenu.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 7496af95dfe67cf429ac65edaaf99106
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPairAdjustmentRecordPropertyDrawer.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPairAdjustmentRecordPropertyDrawer.cs
deleted file mode 100644
index 1ea8e80..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPairAdjustmentRecordPropertyDrawer.cs
+++ /dev/null
@@ -1,382 +0,0 @@
-using UnityEngine;
-using UnityEngine.TextCore;
-using UnityEngine.TextCore.LowLevel;
-using UnityEditor;
-using System.Collections;
-using System.Text.RegularExpressions;
-
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomPropertyDrawer(typeof(TMP_GlyphPairAdjustmentRecord))]
- public class TMP_GlyphPairAdjustmentRecordPropertyDrawer : PropertyDrawer
- {
- private bool isEditingEnabled = false;
- private bool isSelectable = false;
-
- private string m_FirstCharacter = string.Empty;
- private string m_SecondCharacter = string.Empty;
- private string m_PreviousInput;
-
- static GUIContent s_CharacterTextFieldLabel = new GUIContent("Char:", "Enter the character or its UTF16 or UTF32 Unicode character escape sequence. For UTF16 use \"\\uFF00\" and for UTF32 use \"\\UFF00FF00\" representation.");
-
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- SerializedProperty prop_FirstAdjustmentRecord = property.FindPropertyRelative("m_FirstAdjustmentRecord");
- SerializedProperty prop_SecondAdjustmentRecord = property.FindPropertyRelative("m_SecondAdjustmentRecord");
-
- SerializedProperty prop_FirstGlyphIndex = prop_FirstAdjustmentRecord.FindPropertyRelative("m_GlyphIndex");
- SerializedProperty prop_FirstGlyphValueRecord = prop_FirstAdjustmentRecord.FindPropertyRelative("m_GlyphValueRecord");
-
- SerializedProperty prop_SecondGlyphIndex = prop_SecondAdjustmentRecord.FindPropertyRelative("m_GlyphIndex");
- SerializedProperty prop_SecondGlyphValueRecord = prop_SecondAdjustmentRecord.FindPropertyRelative("m_GlyphValueRecord");
-
- SerializedProperty prop_FontFeatureLookupFlags = property.FindPropertyRelative("m_FeatureLookupFlags");
-
- position.yMin += 2;
-
- float width = position.width / 2;
- float padding = 5.0f;
-
- Rect rect;
-
- isEditingEnabled = GUI.enabled;
- isSelectable = label.text == "Selectable" ? true : false;
-
- if (isSelectable)
- GUILayoutUtility.GetRect(position.width, 75);
- else
- GUILayoutUtility.GetRect(position.width, 55);
-
- GUIStyle style = new GUIStyle(EditorStyles.label);
- style.richText = true;
-
- // First Glyph
- GUI.enabled = isEditingEnabled;
- if (isSelectable)
- {
- rect = new Rect(position.x + 70, position.y, position.width, 49);
-
- float labelWidth = GUI.skin.label.CalcSize(new GUIContent("ID: " + prop_FirstGlyphIndex.intValue)).x;
- EditorGUI.LabelField(new Rect(position.x + (64 - labelWidth) / 2, position.y + 60, 64f, 18f), new GUIContent("ID: <color=#FFFF80>" + prop_FirstGlyphIndex.intValue + "</color>"), style);
-
- GUI.enabled = isEditingEnabled;
- EditorGUIUtility.labelWidth = 30f;
-
- rect = new Rect(position.x + 70, position.y + 10, (width - 70) - padding, 18);
- EditorGUI.PropertyField(rect, prop_FirstGlyphValueRecord.FindPropertyRelative("m_XPlacement"), new GUIContent("OX:"));
-
- rect.y += 20;
- EditorGUI.PropertyField(rect, prop_FirstGlyphValueRecord.FindPropertyRelative("m_YPlacement"), new GUIContent("OY:"));
-
- rect.y += 20;
- EditorGUI.PropertyField(rect, prop_FirstGlyphValueRecord.FindPropertyRelative("m_XAdvance"), new GUIContent("AX:"));
-
- //rect.y += 20;
- //EditorGUI.PropertyField(rect, prop_FirstGlyphValueRecord.FindPropertyRelative("m_YAdvance"), new GUIContent("AY:"));
-
- DrawGlyph((uint)prop_FirstGlyphIndex.intValue, new Rect(position.x, position.y, position.width, position.height), property);
- }
- else
- {
- rect = new Rect(position.x, position.y, width / 2 * 0.8f - padding, 18);
- EditorGUIUtility.labelWidth = 40f;
-
- // First Character Lookup
- GUI.SetNextControlName("FirstCharacterField");
- EditorGUI.BeginChangeCheck();
- string firstCharacter = EditorGUI.TextField(rect, s_CharacterTextFieldLabel, m_FirstCharacter);
-
- if (GUI.GetNameOfFocusedControl() == "FirstCharacterField")
- {
- if (ValidateInput(firstCharacter))
- {
- //Debug.Log("1st Unicode value: [" + firstCharacter + "]");
-
- uint unicode = GetUnicodeCharacter(firstCharacter);
-
- // Lookup glyph index
- TMP_SerializedPropertyHolder propertyHolder = property.serializedObject.targetObject as TMP_SerializedPropertyHolder;
- TMP_FontAsset fontAsset = propertyHolder.fontAsset;
- if (fontAsset != null)
- {
- prop_FirstGlyphIndex.intValue = (int)fontAsset.GetGlyphIndex(unicode);
- propertyHolder.firstCharacter = unicode;
- }
- }
- }
-
- if (EditorGUI.EndChangeCheck())
- m_FirstCharacter = firstCharacter;
-
- // First Glyph Index
- rect.x += width / 2 * 0.8f;
-
- EditorGUIUtility.labelWidth = 25f;
- EditorGUI.BeginChangeCheck();
- EditorGUI.PropertyField(rect, prop_FirstGlyphIndex, new GUIContent("ID:"));
- if (EditorGUI.EndChangeCheck())
- {
-
- }
-
- GUI.enabled = isEditingEnabled;
- EditorGUIUtility.labelWidth = 25f;
-
- rect = new Rect(position.x, position.y + 20, width * 0.5f - padding, 18);
- EditorGUI.PropertyField(rect, prop_FirstGlyphValueRecord.FindPropertyRelative("m_XPlacement"), new GUIContent("OX"));
-
- rect.x += width * 0.5f;
- EditorGUI.PropertyField(rect, prop_FirstGlyphValueRecord.FindPropertyRelative("m_YPlacement"), new GUIContent("OY"));
-
- rect.x = position.x;
- rect.y += 20;
- EditorGUI.PropertyField(rect, prop_FirstGlyphValueRecord.FindPropertyRelative("m_XAdvance"), new GUIContent("AX"));
-
- //rect.x += width * 0.5f;
- //EditorGUI.PropertyField(rect, prop_FirstGlyphAdjustment.FindPropertyRelative("m_YAdvance"), new GUIContent("AY"));
-
- }
-
-
- // Second Glyph
- GUI.enabled = isEditingEnabled;
- if (isSelectable)
- {
- float labelWidth = GUI.skin.label.CalcSize(new GUIContent("ID: " + prop_SecondGlyphIndex.intValue)).x;
- EditorGUI.LabelField(new Rect(position.width / 2 + 20 + (64 - labelWidth) / 2, position.y + 60, 64f, 18f), new GUIContent("ID: <color=#FFFF80>" + prop_SecondGlyphIndex.intValue + "</color>"), style);
-
- GUI.enabled = isEditingEnabled;
- EditorGUIUtility.labelWidth = 30f;
-
- rect = new Rect(position.width / 2 + 20 + 70, position.y + 10, (width - 70) - padding, 18);
- EditorGUI.PropertyField(rect, prop_SecondGlyphValueRecord.FindPropertyRelative("m_XPlacement"), new GUIContent("OX:"));
-
- rect.y += 20;
- EditorGUI.PropertyField(rect, prop_SecondGlyphValueRecord.FindPropertyRelative("m_YPlacement"), new GUIContent("OY:"));
-
- rect.y += 20;
- EditorGUI.PropertyField(rect, prop_SecondGlyphValueRecord.FindPropertyRelative("m_XAdvance"), new GUIContent("AX:"));
-
- //rect.y += 20;
- //EditorGUI.PropertyField(rect, prop_SecondGlyphAdjustment.FindPropertyRelative("m_YAdvance"), new GUIContent("AY"));
-
- DrawGlyph((uint)prop_SecondGlyphIndex.intValue, new Rect(position.width / 2 + 20, position.y, position.width, position.height), property);
- }
- else
- {
- rect = new Rect(position.width / 2 + 20, position.y, width / 2 * 0.8f - padding, 18);
- EditorGUIUtility.labelWidth = 40f;
-
- // Second Character Lookup
- GUI.SetNextControlName("SecondCharacterField");
- EditorGUI.BeginChangeCheck();
- string secondCharacter = EditorGUI.TextField(rect, s_CharacterTextFieldLabel, m_SecondCharacter);
-
- if (GUI.GetNameOfFocusedControl() == "SecondCharacterField")
- {
- if (ValidateInput(secondCharacter))
- {
- //Debug.Log("2nd Unicode value: [" + secondCharacter + "]");
-
- uint unicode = GetUnicodeCharacter(secondCharacter);
-
- // Lookup glyph index
- TMP_SerializedPropertyHolder propertyHolder = property.serializedObject.targetObject as TMP_SerializedPropertyHolder;
- TMP_FontAsset fontAsset = propertyHolder.fontAsset;
- if (fontAsset != null)
- {
- prop_SecondGlyphIndex.intValue = (int)fontAsset.GetGlyphIndex(unicode);
- propertyHolder.secondCharacter = unicode;
- }
- }
- }
-
- if (EditorGUI.EndChangeCheck())
- m_SecondCharacter = secondCharacter;
-
- // Second Glyph Index
- rect.x += width / 2 * 0.8f;
-
- EditorGUIUtility.labelWidth = 25f;
- EditorGUI.BeginChangeCheck();
- EditorGUI.PropertyField(rect, prop_SecondGlyphIndex, new GUIContent("ID:"));
- if (EditorGUI.EndChangeCheck())
- {
-
- }
-
- GUI.enabled = isEditingEnabled;
- EditorGUIUtility.labelWidth = 25f;
-
- rect = new Rect(position.width / 2 + 20, position.y + 20, width * 0.5f - padding, 18);
- EditorGUI.PropertyField(rect, prop_SecondGlyphValueRecord.FindPropertyRelative("m_XPlacement"), new GUIContent("OX"));
-
- rect.x += width * 0.5f;
- EditorGUI.PropertyField(rect, prop_SecondGlyphValueRecord.FindPropertyRelative("m_YPlacement"), new GUIContent("OY"));
-
- rect.x = position.width / 2 + 20;
- rect.y += 20;
- EditorGUI.PropertyField(rect, prop_SecondGlyphValueRecord.FindPropertyRelative("m_XAdvance"), new GUIContent("AX"));
-
- //rect.x += width * 0.5f;
- //EditorGUI.PropertyField(rect, prop_SecondGlyphAdjustment.FindPropertyRelative("m_YAdvance"), new GUIContent("AY"));
- }
-
- // Font Feature Lookup Flags
- if (isSelectable)
- {
- EditorGUIUtility.labelWidth = 55f;
-
- rect.x = position.width - 255;
- rect.y += 23;
- rect.width = 270; // width - 70 - padding;
-
- FontFeatureLookupFlags flags = (FontFeatureLookupFlags)prop_FontFeatureLookupFlags.intValue;
-
- EditorGUI.BeginChangeCheck();
- flags = (FontFeatureLookupFlags)EditorGUI.EnumFlagsField(rect, new GUIContent("Options:"), flags);
- if (EditorGUI.EndChangeCheck())
- {
- prop_FontFeatureLookupFlags.intValue = (int)flags;
- }
- }
-
- }
-
- bool ValidateInput(string source)
- {
- int length = string.IsNullOrEmpty(source) ? 0 : source.Length;
-
- ////Filter out unwanted characters.
- Event evt = Event.current;
-
- char c = evt.character;
-
- if (c != '\0')
- {
- switch (length)
- {
- case 0:
- break;
- case 1:
- if (source != m_PreviousInput)
- return true;
-
- if ((source[0] == '\\' && (c == 'u' || c == 'U')) == false)
- evt.character = '\0';
-
- break;
- case 2:
- case 3:
- case 4:
- case 5:
- if ((c < '0' || c > '9') && (c < 'a' || c > 'f') && (c < 'A' || c > 'F'))
- evt.character = '\0';
- break;
- case 6:
- case 7:
- case 8:
- case 9:
- if (source[1] == 'u' || (c < '0' || c > '9') && (c < 'a' || c > 'f') && (c < 'A' || c > 'F'))
- evt.character = '\0';
-
- // Validate input
- if (length == 6 && source[1] == 'u' && source != m_PreviousInput)
- return true;
- break;
- case 10:
- if (source != m_PreviousInput)
- return true;
-
- evt.character = '\0';
- break;
- }
- }
-
- m_PreviousInput = source;
-
- return false;
- }
-
- uint GetUnicodeCharacter (string source)
- {
- uint unicode;
-
- if (source.Length == 1)
- unicode = source[0];
- else if (source.Length == 6)
- unicode = (uint)TMP_TextUtilities.StringHexToInt(source.Replace("\\u", ""));
- else
- unicode = (uint)TMP_TextUtilities.StringHexToInt(source.Replace("\\U", ""));
-
- return unicode;
- }
-
- void DrawGlyph(uint glyphIndex, Rect position, SerializedProperty property)
- {
- // Get a reference to the sprite texture
- TMP_FontAsset fontAsset = property.serializedObject.targetObject as TMP_FontAsset;
-
- if (fontAsset == null)
- return;
-
- // Check if glyph currently exists in the atlas texture.
- if (!fontAsset.glyphLookupTable.TryGetValue(glyphIndex, out Glyph glyph))
- return;
-
- // Get reference to atlas texture.
- int atlasIndex = fontAsset.m_AtlasTextureIndex;
- Texture2D atlasTexture = fontAsset.atlasTextures.Length > atlasIndex ? fontAsset.atlasTextures[atlasIndex] : null;
-
- if (atlasTexture == null)
- return;
-
- Material mat;
- if (((GlyphRasterModes)fontAsset.atlasRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP)
- {
- mat = TMP_FontAssetEditor.internalBitmapMaterial;
-
- if (mat == null)
- return;
-
- mat.mainTexture = atlasTexture;
- }
- else
- {
- mat = TMP_FontAssetEditor.internalSDFMaterial;
-
- if (mat == null)
- return;
-
- mat.mainTexture = atlasTexture;
- mat.SetFloat(ShaderUtilities.ID_GradientScale, fontAsset.atlasPadding + 1);
- }
-
- // Draw glyph from atlas texture.
- Rect glyphDrawPosition = new Rect(position.x, position.y + 2, 64, 60);
-
- GlyphRect glyphRect = glyph.glyphRect;
-
- float normalizedHeight = fontAsset.faceInfo.ascentLine - fontAsset.faceInfo.descentLine;
- float scale = glyphDrawPosition.width / normalizedHeight;
-
- // Compute the normalized texture coordinates
- Rect texCoords = new Rect((float)glyphRect.x / atlasTexture.width, (float)glyphRect.y / atlasTexture.height, (float)glyphRect.width / atlasTexture.width, (float)glyphRect.height / atlasTexture.height);
-
- if (Event.current.type == EventType.Repaint)
- {
- glyphDrawPosition.x += (glyphDrawPosition.width - glyphRect.width * scale) / 2;
- glyphDrawPosition.y += (glyphDrawPosition.height - glyphRect.height * scale) / 2;
- glyphDrawPosition.width = glyphRect.width * scale;
- glyphDrawPosition.height = glyphRect.height * scale;
-
- // Could switch to using the default material of the font asset which would require passing scale to the shader.
- Graphics.DrawTexture(glyphDrawPosition, atlasTexture, texCoords, 0, 0, 0, 0, new Color(1f, 1f, 1f), mat);
- }
- }
-
-
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPairAdjustmentRecordPropertyDrawer.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPairAdjustmentRecordPropertyDrawer.cs.meta
deleted file mode 100644
index d79c389..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPairAdjustmentRecordPropertyDrawer.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: d256fa541faf5d4409992c631adb98a1
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPropertyDrawer.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPropertyDrawer.cs
deleted file mode 100644
index c4d0dcf..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPropertyDrawer.cs
+++ /dev/null
@@ -1,118 +0,0 @@
- using UnityEngine;
-using UnityEngine.TextCore;
-using UnityEngine.TextCore.LowLevel;
-using UnityEditor;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomPropertyDrawer(typeof(Glyph))]
- public class TMP_GlyphPropertyDrawer : 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);
-
- float labelWidth = GUI.skin.label.CalcSize(new GUIContent("ID: " + prop_GlyphIndex.intValue)).x;
- EditorGUI.LabelField(new Rect(position.x + (64 - labelWidth) / 2, position.y + 85, 64f, 18f), new GUIContent("ID: <color=#FFFF80>" + prop_GlyphIndex.intValue + "</color>"), style);
- //EditorGUIUtility.labelWidth = 22f;
- //EditorGUI.DelayedIntField(new Rect(position.x + (64 - labelWidth) / 2, position.y + 89, 58f, 18f), prop_GlyphIndex, new GUIContent("ID:"));
-
- // We get Rect since a valid position may not be provided by the caller.
- EditorGUI.PropertyField(new Rect(rect.x, rect.y, position.width, 49), prop_GlyphRect);
-
- 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:")); // new GUIContent("Scale: <color=#FFFF80>" + prop_Scale.floatValue + "</color>"), style);
-
- EditorGUIUtility.labelWidth = 74f;
- EditorGUI.PropertyField(new Rect(rect.x + 85, rect.y + 65, 95, 18), prop_AtlasIndex, new GUIContent("Atlas Index:")); // new GUIContent("Atlas Index: <color=#FFFF80>" + prop_AtlasIndex.intValue + "</color>"), style);
-
- DrawGlyph(position, property);
- }
-
- public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
- {
- return 130f;
- }
-
- void DrawGlyph(Rect position, SerializedProperty property)
- {
- // Get a reference to the sprite texture
- TMP_FontAsset fontAsset = property.serializedObject.targetObject as TMP_FontAsset;
-
- if (fontAsset == null)
- return;
-
- // Get reference to atlas texture.
- int atlasIndex = property.FindPropertyRelative("m_AtlasIndex").intValue;
- Texture2D atlasTexture = fontAsset.atlasTextures.Length > atlasIndex ? fontAsset.atlasTextures[atlasIndex] : null;
-
- if (atlasTexture == null)
- return;
-
- Material mat;
- if (((GlyphRasterModes)fontAsset.atlasRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP)
- {
- mat = TMP_FontAssetEditor.internalBitmapMaterial;
-
- if (mat == null)
- return;
-
- mat.mainTexture = atlasTexture;
- mat.SetColor("_Color", Color.white);
- }
- else
- {
- mat = TMP_FontAssetEditor.internalSDFMaterial;
-
- if (mat == null)
- return;
-
- mat.mainTexture = atlasTexture;
- mat.SetFloat(ShaderUtilities.ID_GradientScale, fontAsset.atlasPadding + 1);
- }
-
- // Draw glyph from atlas texture.
- Rect glyphDrawPosition = new Rect(position.x, position.y + 2, 64, 80);
-
- SerializedProperty prop_GlyphRect = property.FindPropertyRelative("m_GlyphRect");
-
- int glyphOriginX = prop_GlyphRect.FindPropertyRelative("m_X").intValue;
- int glyphOriginY = prop_GlyphRect.FindPropertyRelative("m_Y").intValue;
- int glyphWidth = prop_GlyphRect.FindPropertyRelative("m_Width").intValue;
- int glyphHeight = prop_GlyphRect.FindPropertyRelative("m_Height").intValue;
-
- float normalizedHeight = fontAsset.faceInfo.ascentLine - fontAsset.faceInfo.descentLine;
- float scale = glyphDrawPosition.width / normalizedHeight;
-
- // Compute the normalized texture coordinates
- Rect texCoords = new Rect((float)glyphOriginX / atlasTexture.width, (float)glyphOriginY / atlasTexture.height, (float)glyphWidth / atlasTexture.width, (float)glyphHeight / atlasTexture.height);
-
- if (Event.current.type == EventType.Repaint)
- {
- glyphDrawPosition.x += (glyphDrawPosition.width - glyphWidth * scale) / 2;
- glyphDrawPosition.y += (glyphDrawPosition.height - glyphHeight * scale) / 2;
- glyphDrawPosition.width = glyphWidth * scale;
- glyphDrawPosition.height = glyphHeight * scale;
-
- // Could switch to using the default material of the font asset which would require passing scale to the shader.
- Graphics.DrawTexture(glyphDrawPosition, atlasTexture, texCoords, 0, 0, 0, 0, new Color(1f, 1f, 1f), mat);
- }
- }
-
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPropertyDrawer.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPropertyDrawer.cs.meta
deleted file mode 100644
index 1b40b11..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_GlyphPropertyDrawer.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: c4777500b5da6094e956c3d4f04de4db
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_InputFieldEditor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_InputFieldEditor.cs
deleted file mode 100644
index 5a7749b..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_InputFieldEditor.cs
+++ /dev/null
@@ -1,283 +0,0 @@
-using UnityEngine;
-using UnityEngine.UI;
-using UnityEditor;
-using UnityEditor.UI;
-using UnityEditor.AnimatedValues;
-
-
-namespace TMPro.EditorUtilities
-{
- [CanEditMultipleObjects]
- [CustomEditor(typeof(TMP_InputField), true)]
- public class TMP_InputFieldEditor : SelectableEditor
- {
- private struct m_foldout
- { // Track Inspector foldout panel states, globally.
- public static bool textInput = true;
- public static bool fontSettings = true;
- public static bool extraSettings = true;
- //public static bool shadowSetting = false;
- //public static bool materialEditor = true;
- }
-
- SerializedProperty m_TextViewport;
- SerializedProperty m_TextComponent;
- SerializedProperty m_Text;
- SerializedProperty m_ContentType;
- SerializedProperty m_LineType;
- SerializedProperty m_LineLimit;
- SerializedProperty m_InputType;
- SerializedProperty m_CharacterValidation;
- SerializedProperty m_InputValidator;
- SerializedProperty m_RegexValue;
- SerializedProperty m_KeyboardType;
- SerializedProperty m_CharacterLimit;
- SerializedProperty m_CaretBlinkRate;
- SerializedProperty m_CaretWidth;
- SerializedProperty m_CaretColor;
- SerializedProperty m_CustomCaretColor;
- SerializedProperty m_SelectionColor;
- SerializedProperty m_HideMobileKeyboard;
- SerializedProperty m_HideMobileInput;
- SerializedProperty m_Placeholder;
- SerializedProperty m_VerticalScrollbar;
- SerializedProperty m_ScrollbarScrollSensitivity;
- SerializedProperty m_OnValueChanged;
- SerializedProperty m_OnEndEdit;
- SerializedProperty m_OnSelect;
- SerializedProperty m_OnDeselect;
- SerializedProperty m_ReadOnly;
- SerializedProperty m_RichText;
- SerializedProperty m_RichTextEditingAllowed;
- SerializedProperty m_ResetOnDeActivation;
- SerializedProperty m_RestoreOriginalTextOnEscape;
-
- SerializedProperty m_OnFocusSelectAll;
- SerializedProperty m_GlobalPointSize;
- SerializedProperty m_GlobalFontAsset;
-
- AnimBool m_CustomColor;
-
- //TMP_InputValidator m_ValidationScript;
-
- protected override void OnEnable()
- {
- base.OnEnable();
-
- m_TextViewport = serializedObject.FindProperty("m_TextViewport");
- m_TextComponent = serializedObject.FindProperty("m_TextComponent");
- m_Text = serializedObject.FindProperty("m_Text");
- m_ContentType = serializedObject.FindProperty("m_ContentType");
- m_LineType = serializedObject.FindProperty("m_LineType");
- m_LineLimit = serializedObject.FindProperty("m_LineLimit");
- m_InputType = serializedObject.FindProperty("m_InputType");
- m_CharacterValidation = serializedObject.FindProperty("m_CharacterValidation");
- m_InputValidator = serializedObject.FindProperty("m_InputValidator");
- m_RegexValue = serializedObject.FindProperty("m_RegexValue");
- m_KeyboardType = serializedObject.FindProperty("m_KeyboardType");
- m_CharacterLimit = serializedObject.FindProperty("m_CharacterLimit");
- m_CaretBlinkRate = serializedObject.FindProperty("m_CaretBlinkRate");
- m_CaretWidth = serializedObject.FindProperty("m_CaretWidth");
- m_CaretColor = serializedObject.FindProperty("m_CaretColor");
- m_CustomCaretColor = serializedObject.FindProperty("m_CustomCaretColor");
- m_SelectionColor = serializedObject.FindProperty("m_SelectionColor");
-
- m_HideMobileKeyboard = serializedObject.FindProperty("m_HideSoftKeyboard");
- m_HideMobileInput = serializedObject.FindProperty("m_HideMobileInput");
-
- m_Placeholder = serializedObject.FindProperty("m_Placeholder");
- m_VerticalScrollbar = serializedObject.FindProperty("m_VerticalScrollbar");
- m_ScrollbarScrollSensitivity = serializedObject.FindProperty("m_ScrollSensitivity");
-
- m_OnValueChanged = serializedObject.FindProperty("m_OnValueChanged");
- m_OnEndEdit = serializedObject.FindProperty("m_OnEndEdit");
- m_OnSelect = serializedObject.FindProperty("m_OnSelect");
- m_OnDeselect = serializedObject.FindProperty("m_OnDeselect");
- m_ReadOnly = serializedObject.FindProperty("m_ReadOnly");
- m_RichText = serializedObject.FindProperty("m_RichText");
- m_RichTextEditingAllowed = serializedObject.FindProperty("m_isRichTextEditingAllowed");
- m_ResetOnDeActivation = serializedObject.FindProperty("m_ResetOnDeActivation");
- m_RestoreOriginalTextOnEscape = serializedObject.FindProperty("m_RestoreOriginalTextOnEscape");
-
- m_OnFocusSelectAll = serializedObject.FindProperty("m_OnFocusSelectAll");
- m_GlobalPointSize = serializedObject.FindProperty("m_GlobalPointSize");
- m_GlobalFontAsset = serializedObject.FindProperty("m_GlobalFontAsset");
-
- m_CustomColor = new AnimBool(m_CustomCaretColor.boolValue);
- m_CustomColor.valueChanged.AddListener(Repaint);
- }
-
- protected override void OnDisable()
- {
- base.OnDisable();
- m_CustomColor.valueChanged.RemoveListener(Repaint);
- }
-
- public override void OnInspectorGUI()
- {
- serializedObject.Update();
-
- base.OnInspectorGUI();
-
- EditorGUILayout.Space();
-
- EditorGUILayout.PropertyField(m_TextViewport);
-
- EditorGUILayout.PropertyField(m_TextComponent);
-
- TextMeshProUGUI text = null;
- if (m_TextComponent != null && m_TextComponent.objectReferenceValue != null)
- {
- text = m_TextComponent.objectReferenceValue as TextMeshProUGUI;
- //if (text.supportRichText)
- //{
- // EditorGUILayout.HelpBox("Using Rich Text with input is unsupported.", MessageType.Warning);
- //}
- }
-
- EditorGUI.BeginDisabledGroup(m_TextComponent == null || m_TextComponent.objectReferenceValue == null);
-
- // TEXT INPUT BOX
- EditorGUILayout.PropertyField(m_Text);
-
- // INPUT FIELD SETTINGS
- #region INPUT FIELD SETTINGS
-
- m_foldout.fontSettings = EditorGUILayout.Foldout(m_foldout.fontSettings, "Input Field Settings", true, TMP_UIStyleManager.boldFoldout);
-
- if (m_foldout.fontSettings)
- {
- EditorGUI.indentLevel++;
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_GlobalFontAsset, new GUIContent("Font Asset", "Set the Font Asset for both Placeholder and Input Field text object."));
- if (EditorGUI.EndChangeCheck())
- {
- TMP_InputField inputField = target as TMP_InputField;
- inputField.SetGlobalFontAsset(m_GlobalFontAsset.objectReferenceValue as TMP_FontAsset);
- }
-
-
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_GlobalPointSize, new GUIContent("Point Size", "Set the point size of both Placeholder and Input Field text object."));
- if (EditorGUI.EndChangeCheck())
- {
- TMP_InputField inputField = target as TMP_InputField;
- inputField.SetGlobalPointSize(m_GlobalPointSize.floatValue);
- }
-
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_CharacterLimit);
-
- EditorGUILayout.Space();
-
- EditorGUILayout.PropertyField(m_ContentType);
- if (!m_ContentType.hasMultipleDifferentValues)
- {
- EditorGUI.indentLevel++;
-
- if (m_ContentType.enumValueIndex == (int)TMP_InputField.ContentType.Standard ||
- m_ContentType.enumValueIndex == (int)TMP_InputField.ContentType.Autocorrected ||
- m_ContentType.enumValueIndex == (int)TMP_InputField.ContentType.Custom)
- {
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_LineType);
- if (EditorGUI.EndChangeCheck())
- {
- if (text != null)
- {
- if (m_LineType.enumValueIndex == (int)TMP_InputField.LineType.SingleLine)
- text.enableWordWrapping = false;
- else
- {
- text.enableWordWrapping = true;
- }
- }
- }
-
- if (m_LineType.enumValueIndex != (int)TMP_InputField.LineType.SingleLine)
- {
- EditorGUILayout.PropertyField(m_LineLimit);
- }
- }
-
- if (m_ContentType.enumValueIndex == (int)TMP_InputField.ContentType.Custom)
- {
- EditorGUILayout.PropertyField(m_InputType);
- EditorGUILayout.PropertyField(m_KeyboardType);
- EditorGUILayout.PropertyField(m_CharacterValidation);
- if (m_CharacterValidation.enumValueIndex == (int)TMP_InputField.CharacterValidation.Regex)
- {
- EditorGUILayout.PropertyField(m_RegexValue);
- }
- else if (m_CharacterValidation.enumValueIndex == (int)TMP_InputField.CharacterValidation.CustomValidator)
- {
- EditorGUILayout.PropertyField(m_InputValidator);
- }
- }
-
- EditorGUI.indentLevel--;
- }
-
- EditorGUILayout.Space();
-
- EditorGUILayout.PropertyField(m_Placeholder);
- EditorGUILayout.PropertyField(m_VerticalScrollbar);
-
- if (m_VerticalScrollbar.objectReferenceValue != null)
- EditorGUILayout.PropertyField(m_ScrollbarScrollSensitivity);
-
- EditorGUILayout.PropertyField(m_CaretBlinkRate);
- EditorGUILayout.PropertyField(m_CaretWidth);
-
- EditorGUILayout.PropertyField(m_CustomCaretColor);
-
- m_CustomColor.target = m_CustomCaretColor.boolValue;
-
- if (EditorGUILayout.BeginFadeGroup(m_CustomColor.faded))
- {
- EditorGUILayout.PropertyField(m_CaretColor);
- }
- EditorGUILayout.EndFadeGroup();
-
- EditorGUILayout.PropertyField(m_SelectionColor);
-
- EditorGUI.indentLevel--;
- }
- #endregion
-
-
- // CONTROL SETTINGS
- #region CONTROL SETTINGS
- m_foldout.extraSettings = EditorGUILayout.Foldout(m_foldout.extraSettings, "Control Settings", true, TMP_UIStyleManager.boldFoldout);
-
- if (m_foldout.extraSettings)
- {
- EditorGUI.indentLevel++;
-
- EditorGUILayout.PropertyField(m_OnFocusSelectAll, new GUIContent("OnFocus - Select All", "Should all the text be selected when the Input Field is selected."));
- EditorGUILayout.PropertyField(m_ResetOnDeActivation, new GUIContent("Reset On DeActivation", "Should the Text and Caret position be reset when Input Field is DeActivated."));
- EditorGUILayout.PropertyField(m_RestoreOriginalTextOnEscape, new GUIContent("Restore On ESC Key", "Should the original text be restored when pressing ESC."));
- EditorGUILayout.PropertyField(m_HideMobileKeyboard, new GUIContent("Hide Soft Keyboard", "Controls the visibility of the mobile virtual keyboard."));
- EditorGUILayout.PropertyField(m_HideMobileInput, new GUIContent("Hide Mobile Input", "Controls the visibility of the editable text field above the mobile virtual keyboard. Not supported on all mobile platforms."));
- EditorGUILayout.PropertyField(m_ReadOnly);
- EditorGUILayout.PropertyField(m_RichText);
- EditorGUILayout.PropertyField(m_RichTextEditingAllowed, new GUIContent("Allow Rich Text Editing"));
-
- EditorGUI.indentLevel--;
- }
- #endregion
-
-
- EditorGUILayout.Space();
-
- EditorGUILayout.PropertyField(m_OnValueChanged);
- EditorGUILayout.PropertyField(m_OnEndEdit);
- EditorGUILayout.PropertyField(m_OnSelect);
- EditorGUILayout.PropertyField(m_OnDeselect);
-
- EditorGUI.EndDisabledGroup();
-
- serializedObject.ApplyModifiedProperties();
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_InputFieldEditor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_InputFieldEditor.cs.meta
deleted file mode 100644
index 9adf20a..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_InputFieldEditor.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: aa160f27c3fe4052a5850e21108811b6
-timeCreated: 1457861621
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_MeshRendererEditor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_MeshRendererEditor.cs
deleted file mode 100644
index 984b8cc..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_MeshRendererEditor.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-// When enabled, allows setting the material by dropping a material onto the MeshRenderer inspector component.
-// The drawback is that the MeshRenderer inspector will not have properties for light probes, so if you need light probe support, do not enable this.
-//#define ALLOW_MESHRENDERER_MATERIAL_DRAG_N_DROP
-
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
- // Disabled for compatibility reason as lightprobe setup isn't supported due to inability to inherit from MeshRendererEditor class
-#if ALLOW_MESHRENDERER_MATERIAL_DRAG_N_DROP
- [CanEditMultipleObjects]
- [CustomEditor(typeof(MeshRenderer))]
- public class TMP_MeshRendererEditor : Editor
- {
- private SerializedProperty m_Materials;
-
- void OnEnable()
- {
- m_Materials = serializedObject.FindProperty("m_Materials");
- }
-
-
- public override void OnInspectorGUI()
- {
- serializedObject.Update();
-
- // Get a reference to the current material.
- SerializedProperty material_prop = m_Materials.GetArrayElementAtIndex(0);
- Material currentMaterial = material_prop.objectReferenceValue as Material;
-
- EditorGUI.BeginChangeCheck();
- base.OnInspectorGUI();
- if (EditorGUI.EndChangeCheck())
- {
- material_prop = m_Materials.GetArrayElementAtIndex(0);
-
- TMP_FontAsset newFontAsset = null;
- Material newMaterial = null;
-
- if (material_prop != null)
- newMaterial = material_prop.objectReferenceValue as Material;
-
- // Check if the new material is referencing a different font atlas texture.
- if (newMaterial != null && currentMaterial.GetInstanceID() != newMaterial.GetInstanceID())
- {
- // Search for the Font Asset matching the new font atlas texture.
- newFontAsset = TMP_EditorUtility.FindMatchingFontAsset(newMaterial);
- }
-
-
- GameObject[] objects = Selection.gameObjects;
-
- for (int i = 0; i < objects.Length; i++)
- {
- // Assign new font asset
- if (newFontAsset != null)
- {
- TMP_Text textComponent = objects[i].GetComponent<TMP_Text>();
-
- if (textComponent != null)
- {
- Undo.RecordObject(textComponent, "Font Asset Change");
- textComponent.font = newFontAsset;
- }
- }
-
- TMPro_EventManager.ON_DRAG_AND_DROP_MATERIAL_CHANGED(objects[i], currentMaterial, newMaterial);
- }
- }
- }
- }
-#endif
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_MeshRendererEditor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_MeshRendererEditor.cs.meta
deleted file mode 100644
index e9b5656..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_MeshRendererEditor.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 6d437b997e074079b4b2f6e395394f4b
-timeCreated: 1462864011
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PackageUtilities.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PackageUtilities.cs
deleted file mode 100644
index dc1beba..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PackageUtilities.cs
+++ /dev/null
@@ -1,920 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System;
-using System.IO;
-using System.Linq;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using TMPro.EditorUtilities;
-
-
-namespace TMPro
-{
- /// <summary>
- /// Data structure containing the target and replacement fileIDs and GUIDs which will require remapping from previous version of TextMesh Pro to the new TextMesh Pro UPM package.
- /// </summary>
- [System.Serializable]
- struct AssetConversionRecord
- {
- public string referencedResource;
- public string target;
- public string replacement;
- }
-
-
- /// <summary>
- /// Data structure containing a list of target and replacement fileID and GUID requiring remapping from previous versions of TextMesh Pro to the new TextMesh Pro UPM package.
- /// This data structure is populated with the data contained in the PackageConversionData.json file included in the package.
- /// </summary>
- [System.Serializable]
- class AssetConversionData
- {
- public List<AssetConversionRecord> assetRecords;
- }
-
-
- public class TMP_ProjectConversionUtility : EditorWindow
- {
- // Create Sprite Asset Editor Window
- [MenuItem("Window/TextMeshPro/Project Files GUID Remapping Tool", false, 2100)]
- static void ShowConverterWindow()
- {
- var window = GetWindow<TMP_ProjectConversionUtility>();
- window.titleContent = new GUIContent("Conversion Tool");
- window.Focus();
- }
-
- private static HashSet<Type> m_IgnoreAssetTypes = new HashSet<Type>()
- {
- typeof(AnimatorOverrideController),
- typeof(AudioClip),
- typeof(AvatarMask),
- typeof(ComputeShader),
- typeof(Cubemap),
- typeof(DefaultAsset),
- typeof(Flare),
- typeof(Font),
- typeof(GUISkin),
- typeof(HumanTemplate),
- typeof(LightingDataAsset),
- typeof(Mesh),
- typeof(MonoScript),
- typeof(PhysicMaterial),
- typeof(PhysicsMaterial2D),
- typeof(RenderTexture),
- typeof(Shader),
- typeof(TerrainData),
- typeof(TextAsset),
- typeof(Texture2D),
- typeof(Texture2DArray),
- typeof(Texture3D),
- typeof(UnityEditor.Animations.AnimatorController),
- typeof(UnityEditorInternal.AssemblyDefinitionAsset),
- typeof(UnityEngine.AI.NavMeshData),
- typeof(UnityEngine.Tilemaps.Tile),
- typeof(UnityEngine.U2D.SpriteAtlas),
- typeof(UnityEngine.Video.VideoClip),
- };
-
- /// <summary>
- ///
- /// </summary>
- struct AssetModificationRecord
- {
- public string assetFilePath;
- public string assetDataFile;
- }
-
- struct AssetFileRecord
- {
- public string assetFilePath;
- public string assetMetaFilePath;
-
- public AssetFileRecord(string filePath, string metaFilePath)
- {
- this.assetFilePath = filePath;
- this.assetMetaFilePath = metaFilePath;
- }
- }
-
- private static string m_ProjectPath;
- private static string m_ProjectFolderToScan;
- private static bool m_IsAlreadyScanningProject;
- private static bool m_CancelScanProcess;
- private static string k_ProjectScanReportDefaultText = "<color=#FFFF80><b>Project Scan Results</b></color>\n";
- private static string k_ProjectScanLabelPrefix = "Scanning: ";
- private static string m_ProjectScanResults = string.Empty;
- private static Vector2 m_ProjectScanResultScrollPosition;
- private static float m_ProgressPercentage = 0;
-
- private static int m_ScanningTotalFiles;
- private static int m_RemainingFilesToScan;
- private static int m_ScanningCurrentFileIndex;
- private static string m_ScanningCurrentFileName;
-
- private static AssetConversionData m_ConversionData;
-
- private static List<AssetModificationRecord> m_ModifiedAssetList = new List<AssetModificationRecord>();
-
-
- void OnEnable()
- {
- // Set Editor Window Size
- SetEditorWindowSize();
-
- m_ProjectScanResults = k_ProjectScanReportDefaultText;
- }
-
-
- void OnGUI()
- {
- GUILayout.BeginVertical();
- {
- // Scan project files and resources
- GUILayout.BeginVertical(EditorStyles.helpBox);
- {
- GUILayout.Label("Scan Project Files", EditorStyles.boldLabel);
- GUILayout.Label("Press the <i>Scan Project Files</i> button to begin scanning your project for files & resources that were created with a previous version of TextMesh Pro.", TMP_UIStyleManager.label);
- GUILayout.Space(10f);
- GUILayout.Label("Project folder to be scanned. Example \"Assets/TextMesh Pro\"");
- m_ProjectFolderToScan = EditorGUILayout.TextField("Folder Path: Assets/", m_ProjectFolderToScan);
- GUILayout.Space(5f);
-
- GUI.enabled = m_IsAlreadyScanningProject == false ? true : false;
- if (GUILayout.Button("Scan Project Files"))
- {
- m_CancelScanProcess = false;
-
- // Make sure Asset Serialization mode is set to ForceText and Version Control mode to Visible Meta Files.
- if (CheckProjectSerializationAndSourceControlModes() == true)
- {
- m_ProjectPath = Path.GetFullPath("Assets/..");
- TMP_EditorCoroutine.StartCoroutine(ScanProjectFiles());
- }
- else
- {
- EditorUtility.DisplayDialog("Project Settings Change Required", "In menu options \"Edit - Project Settings - Editor\", please change Asset Serialization Mode to ForceText and Source Control Mode to Visible Meta Files.", "OK", string.Empty);
- }
- }
- GUI.enabled = true;
-
- // Display progress bar
- Rect rect = GUILayoutUtility.GetRect(0f, 20f, GUILayout.ExpandWidth(true));
- EditorGUI.ProgressBar(rect, m_ProgressPercentage, "Scan Progress (" + m_ScanningCurrentFileIndex + "/" + m_ScanningTotalFiles + ")");
-
- // Display cancel button and name of file currently being scanned.
- if (m_IsAlreadyScanningProject)
- {
- Rect cancelRect = new Rect(rect.width - 20, rect.y + 2, 20, 16);
- if (GUI.Button(cancelRect, "X"))
- {
- m_CancelScanProcess = true;
- }
- GUILayout.Label(k_ProjectScanLabelPrefix + m_ScanningCurrentFileName, TMP_UIStyleManager.label);
- }
- else
- GUILayout.Label(string.Empty);
-
- GUILayout.Space(5);
-
- // Creation Feedback
- GUILayout.BeginVertical(TMP_UIStyleManager.textAreaBoxWindow, GUILayout.ExpandHeight(true));
- {
- m_ProjectScanResultScrollPosition = EditorGUILayout.BeginScrollView(m_ProjectScanResultScrollPosition, GUILayout.ExpandHeight(true));
- EditorGUILayout.LabelField(m_ProjectScanResults, TMP_UIStyleManager.label);
- EditorGUILayout.EndScrollView();
- }
- GUILayout.EndVertical();
- GUILayout.Space(5f);
- }
- GUILayout.EndVertical();
-
- // Scan project files and resources
- GUILayout.BeginVertical(EditorStyles.helpBox);
- {
- GUILayout.Label("Save Modified Project Files", EditorStyles.boldLabel);
- GUILayout.Label("Pressing the <i>Save Modified Project Files</i> button will update the files in the <i>Project Scan Results</i> listed above. <color=#FFFF80>Please make sure that you have created a backup of your project first</color> as these file modifications are permanent and cannot be undone.", TMP_UIStyleManager.label);
- GUILayout.Space(5f);
-
- GUI.enabled = m_IsAlreadyScanningProject == false && m_ModifiedAssetList.Count > 0 ? true : false;
- if (GUILayout.Button("Save Modified Project Files"))
- {
- UpdateProjectFiles();
- }
- GUILayout.Space(10f);
- }
- GUILayout.EndVertical();
-
- }
- GUILayout.EndVertical();
- GUILayout.Space(5f);
- }
-
- void OnInspectorUpdate()
- {
- Repaint();
- }
-
-
- /// <summary>
- /// Limits the minimum size of the editor window.
- /// </summary>
- void SetEditorWindowSize()
- {
- EditorWindow editorWindow = this;
-
- Vector2 currentWindowSize = editorWindow.minSize;
-
- editorWindow.minSize = new Vector2(Mathf.Max(640, currentWindowSize.x), Mathf.Max(420, currentWindowSize.y));
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="filePath"></param>
- /// <returns></returns>
- private static bool ShouldIgnoreFile(string filePath)
- {
- string fileExtension = Path.GetExtension(filePath);
- Type fileType = AssetDatabase.GetMainAssetTypeAtPath(filePath);
-
- if (m_IgnoreAssetTypes.Contains(fileType))
- return true;
-
- // Exclude FBX
- if (fileType == typeof(GameObject) && fileExtension.ToLower() == ".fbx") { return true; }
- return false;
- }
-
-
- private IEnumerator ScanProjectFiles()
- {
- m_IsAlreadyScanningProject = true;
- string packageFullPath = EditorUtilities.TMP_EditorUtility.packageFullPath;
-
- // List containing assets that have been modified.
- m_ProjectScanResults = k_ProjectScanReportDefaultText;
- m_ModifiedAssetList.Clear();
- m_ProgressPercentage = 0;
-
- // Read Conversion Data from Json file.
- if (m_ConversionData == null)
- m_ConversionData = JsonUtility.FromJson<AssetConversionData>(File.ReadAllText(packageFullPath + "/PackageConversionData.json"));
-
- // Get list of GUIDs for assets that might contain references to previous GUIDs that require updating.
- string searchFolder = string.IsNullOrEmpty(m_ProjectFolderToScan) ? "Assets" : ("Assets/" + m_ProjectFolderToScan);
- string[] guids = AssetDatabase.FindAssets("t:Object", new string[] { searchFolder }).Distinct().ToArray();
-
- k_ProjectScanLabelPrefix = "<b>Phase 1 - Filtering:</b> ";
- m_ScanningTotalFiles = guids.Length;
- m_ScanningCurrentFileIndex = 0;
-
- List<AssetFileRecord> projectFilesToScan = new List<AssetFileRecord>();
-
- foreach (var guid in guids)
- {
- if (m_CancelScanProcess)
- break;
-
- string assetFilePath = AssetDatabase.GUIDToAssetPath(guid);
-
- m_ScanningCurrentFileIndex += 1;
- m_ScanningCurrentFileName = assetFilePath;
- m_ProgressPercentage = (float)m_ScanningCurrentFileIndex / m_ScanningTotalFiles;
-
- // Filter out file types we have no interest in searching
- if (ShouldIgnoreFile(assetFilePath))
- continue;
-
- string assetMetaFilePath = AssetDatabase.GetTextMetaFilePathFromAssetPath(assetFilePath);
-
- projectFilesToScan.Add(new AssetFileRecord(assetFilePath, assetMetaFilePath));
-
- yield return null;
- }
-
- m_RemainingFilesToScan = m_ScanningTotalFiles = projectFilesToScan.Count;
-
- k_ProjectScanLabelPrefix = "<b>Phase 2 - Scanning:</b> ";
-
- for (int i = 0; i < m_ScanningTotalFiles; i++)
- {
- if (m_CancelScanProcess)
- break;
-
- AssetFileRecord fileRecord = projectFilesToScan[i];
-
- Task.Run(() =>
- {
- ScanProjectFileAsync(fileRecord);
-
- m_ScanningCurrentFileName = fileRecord.assetFilePath;
-
- int completedScans = m_ScanningTotalFiles - Interlocked.Decrement(ref m_RemainingFilesToScan);
-
- m_ScanningCurrentFileIndex = completedScans;
- m_ProgressPercentage = (float)completedScans / m_ScanningTotalFiles;
- });
-
- if (i % 64 == 0)
- yield return new WaitForSeconds(2.0f);
-
- }
-
- while (m_RemainingFilesToScan > 0 && !m_CancelScanProcess)
- yield return null;
-
- m_IsAlreadyScanningProject = false;
- m_ScanningCurrentFileName = string.Empty;
- }
-
-
- static void ScanProjectFileAsync(AssetFileRecord fileRecord)
- {
- if (m_CancelScanProcess)
- return;
-
- // Read the asset data file
- string assetDataFile = string.Empty;
- bool hasFileChanged = false;
-
- try
- {
- assetDataFile = File.ReadAllText(m_ProjectPath + "/" + fileRecord.assetFilePath);
- }
- catch
- {
- // Continue to the next asset if we can't read the current one.
- return;
- }
-
- // Read the asset meta data file
- string assetMetaFile = File.ReadAllText(m_ProjectPath + "/" + fileRecord.assetMetaFilePath);
- bool hasMetaFileChanges = false;
-
- foreach (AssetConversionRecord record in m_ConversionData.assetRecords)
- {
- if (assetDataFile.Contains(record.target))
- {
- hasFileChanged = true;
-
- assetDataFile = assetDataFile.Replace(record.target, record.replacement);
- }
-
- //// Check meta file
- if (assetMetaFile.Contains(record.target))
- {
- hasMetaFileChanges = true;
-
- assetMetaFile = assetMetaFile.Replace(record.target, record.replacement);
- }
- }
-
- if (hasFileChanged)
- {
- AssetModificationRecord modifiedAsset;
- modifiedAsset.assetFilePath = fileRecord.assetFilePath;
- modifiedAsset.assetDataFile = assetDataFile;
-
- m_ModifiedAssetList.Add(modifiedAsset);
-
- m_ProjectScanResults += fileRecord.assetFilePath + "\n";
- }
-
- if (hasMetaFileChanges)
- {
- AssetModificationRecord modifiedAsset;
- modifiedAsset.assetFilePath = fileRecord.assetMetaFilePath;
- modifiedAsset.assetDataFile = assetMetaFile;
-
- m_ModifiedAssetList.Add(modifiedAsset);
-
- m_ProjectScanResults += fileRecord.assetMetaFilePath + "\n";
- }
- }
-
-
- /// <summary>
- ///
- /// </summary>
- private static void ResetScanProcess()
- {
- m_IsAlreadyScanningProject = false;
- m_ScanningCurrentFileName = string.Empty;
- m_ProgressPercentage = 0;
- m_ScanningCurrentFileIndex = 0;
- m_ScanningTotalFiles = 0;
- }
-
-
- /// <summary>
- ///
- /// </summary>
- private static void UpdateProjectFiles()
- {
- // Make sure Asset Serialization mode is set to ForceText with Visible Meta Files.
- CheckProjectSerializationAndSourceControlModes();
-
- string projectPath = Path.GetFullPath("Assets/..");
-
- // Display dialogue to show user a list of project files that will be modified upon their consent.
- if (EditorUtility.DisplayDialog("Save Modified Asset(s)?", "Are you sure you want to save all modified assets?", "YES", "NO"))
- {
- for (int i = 0; i < m_ModifiedAssetList.Count; i++)
- {
- // Make sure all file streams that might have been opened by Unity are closed.
- //AssetDatabase.ReleaseCachedFileHandles();
-
- //Debug.Log("Writing asset file [" + m_ModifiedAssetList[i].assetFilePath + "].");
-
- File.WriteAllText(projectPath + "/" + m_ModifiedAssetList[i].assetFilePath, m_ModifiedAssetList[i].assetDataFile);
- }
- }
-
- AssetDatabase.Refresh();
-
- m_ProgressPercentage = 0;
- m_ProjectScanResults = k_ProjectScanReportDefaultText;
- }
-
-
- /// <summary>
- /// Check project Asset Serialization and Source Control modes
- /// </summary>
- private static bool CheckProjectSerializationAndSourceControlModes()
- {
- // Check Project Asset Serialization and Visible Meta Files mode.
- if (EditorSettings.serializationMode != SerializationMode.ForceText || EditorSettings.externalVersionControl != "Visible Meta Files")
- {
- return false;
- }
-
- return true;
- }
- }
-
-
-
- public class TMP_PackageUtilities : Editor
- {
-
- enum SaveAssetDialogueOptions { Unset = 0, Save = 1, SaveAll = 2, DoNotSave = 3 };
-
- private static SerializationMode m_ProjectAssetSerializationMode;
- private static string m_ProjectExternalVersionControl;
-
- struct AssetRemappingRecord
- {
- public string oldGuid;
- public string newGuid;
- public string assetPath;
- }
-
- struct AssetModificationRecord
- {
- public string assetFilePath;
- public string assetDataFile;
- }
-
- // Create Sprite Asset Editor Window
- //[MenuItem("Window/TextMeshPro/Generate New Package GUIDs", false, 1500)]
- public static void GenerateNewPackageGUIDs_Menu()
- {
- GenerateNewPackageGUIDs();
- }
-
-
- /// <summary>
- ///
- /// </summary>
- [MenuItem("Window/TextMeshPro/Import TMP Essential Resources", false, 2050)]
- public static void ImportProjectResourcesMenu()
- {
- ImportProjectResources();
- }
-
-
- /// <summary>
- ///
- /// </summary>
- [MenuItem("Window/TextMeshPro/Import TMP Examples and Extras", false, 2051)]
- public static void ImportExamplesContentMenu()
- {
- ImportExtraContent();
- }
-
-
- // Create Sprite Asset Editor Window
- //[MenuItem("Window/TextMeshPro/Convert TMP Project Files to UPM", false, 1510)]
- public static void ConvertProjectGUIDsMenu()
- {
- ConvertProjectGUIDsToUPM();
-
- //GetVersionInfo();
- }
-
-
- // Create Sprite Asset Editor Window
- //[MenuItem("Window/TextMeshPro/Convert GUID (Source to DLL)", false, 2010)]
- public static void ConvertGUIDFromSourceToDLLMenu()
- {
- //ConvertGUIDFromSourceToDLL();
-
- //GetVersionInfo();
- }
-
-
- // Create Sprite Asset Editor Window
- //[MenuItem("Window/TextMeshPro/Convert GUID (DLL to Source)", false, 2020)]
- public static void ConvertGUIDFromDllToSourceMenu()
- {
- //ConvertGUIDFromDLLToSource();
-
- //GetVersionInfo();
- }
-
-
- // Create Sprite Asset Editor Window
- //[MenuItem("Window/TextMeshPro/Extract Package GUIDs", false, 1530)]
- public static void ExtractPackageGUIDMenu()
- {
- ExtractPackageGUIDs();
- }
-
-
- private static void GetVersionInfo()
- {
- string version = TMP_Settings.version;
- Debug.Log("The version of this TextMesh Pro UPM package is (" + version + ").");
- }
-
-
- /// <summary>
- ///
- /// </summary>
- private static void ImportExtraContent()
- {
- string packageFullPath = EditorUtilities.TMP_EditorUtility.packageFullPath;
-
- AssetDatabase.ImportPackage(packageFullPath + "/Package Resources/TMP Examples & Extras.unitypackage", true);
- }
-
-
- /// <summary>
- ///
- /// </summary>
- private static void ImportProjectResources()
- {
- string packageFullPath = EditorUtilities.TMP_EditorUtility.packageFullPath;
-
- AssetDatabase.ImportPackage(packageFullPath + "/Package Resources/TMP Essential Resources.unitypackage", true);
- }
-
-
- /// <summary>
- ///
- /// </summary>
- private static void GenerateNewPackageGUIDs()
- {
- // Make sure Asset Serialization mode is set to ForceText with Visible Meta Files.
- SetProjectSerializationAndSourceControlModes();
-
- string projectPath = Path.GetFullPath("Assets/..");
-
- // Clear existing dictionary of AssetRecords
- List<AssetRemappingRecord> assetRecords = new List<AssetRemappingRecord>();
-
- // Get full list of GUIDs used in the package which including folders.
- string[] packageGUIDs = AssetDatabase.FindAssets("t:Object", new string[] { "Assets/Packages/com.unity.TextMeshPro" });
-
- for (int i = 0; i < packageGUIDs.Length; i++)
- {
- // Could add a progress bar for this process (if needed)
-
- string guid = packageGUIDs[i];
- string assetFilePath = AssetDatabase.GUIDToAssetPath(guid);
- string assetMetaFilePath = AssetDatabase.GetTextMetaFilePathFromAssetPath(assetFilePath);
- //System.Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetFilePath);
-
- AssetRemappingRecord assetRecord;
- assetRecord.oldGuid = guid;
- assetRecord.assetPath = assetFilePath;
-
- string newGUID = GenerateUniqueGUID();
-
- assetRecord.newGuid = newGUID;
-
- if (assetRecords.FindIndex(item => item.oldGuid == guid) != -1)
- continue;
-
- assetRecords.Add(assetRecord);
-
- // Read the meta file for the given asset.
- string assetMetaFile = File.ReadAllText(projectPath + "/" + assetMetaFilePath);
-
- assetMetaFile = assetMetaFile.Replace("guid: " + guid, "guid: " + newGUID);
-
- File.WriteAllText(projectPath + "/" + assetMetaFilePath, assetMetaFile);
-
- //Debug.Log("Asset: [" + assetFilePath + "] Type: " + assetType + " Current GUID: [" + guid + "] New GUID: [" + newGUID + "]");
- }
-
- AssetDatabase.Refresh();
-
- // Get list of GUIDs for assets that might need references to previous GUIDs which need to be updated.
- packageGUIDs = AssetDatabase.FindAssets("t:Object"); // ("t:Object", new string[] { "Assets/Asset Importer" });
-
- for (int i = 0; i < packageGUIDs.Length; i++)
- {
- // Could add a progress bar for this process
-
- string guid = packageGUIDs[i];
- string assetFilePath = AssetDatabase.GUIDToAssetPath(guid);
- System.Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetFilePath);
-
- // Filter out file types we are not interested in
- if (assetType == typeof(DefaultAsset) || assetType == typeof(MonoScript) || assetType == typeof(Texture2D) || assetType == typeof(TextAsset) || assetType == typeof(Shader))
- continue;
-
- // Read the asset data file
- string assetDataFile = File.ReadAllText(projectPath + "/" + assetFilePath);
-
- //Debug.Log("Searching Asset: [" + assetFilePath + "] of type: " + assetType);
-
- bool hasFileChanged = false;
-
- foreach (AssetRemappingRecord record in assetRecords)
- {
- if (assetDataFile.Contains(record.oldGuid))
- {
- hasFileChanged = true;
-
- assetDataFile = assetDataFile.Replace(record.oldGuid, record.newGuid);
-
- Debug.Log("Replacing old GUID: [" + record.oldGuid + "] by new GUID: [" + record.newGuid + "] in asset file: [" + assetFilePath + "].");
- }
- }
-
- if (hasFileChanged)
- {
- // Add file to list of changed files
- File.WriteAllText(projectPath + "/" + assetFilePath, assetDataFile);
- }
-
- }
-
- AssetDatabase.Refresh();
-
- // Restore project Asset Serialization and Source Control modes.
- RestoreProjectSerializationAndSourceControlModes();
- }
-
-
- private static void ExtractPackageGUIDs()
- {
- // Make sure Asset Serialization mode is set to ForceText with Visible Meta Files.
- SetProjectSerializationAndSourceControlModes();
-
- string projectPath = Path.GetFullPath("Assets/..");
-
- // Create new instance of AssetConversionData file
- AssetConversionData data = new AssetConversionData();
- data.assetRecords = new List<AssetConversionRecord>();
-
- // Get full list of GUIDs used in the package which including folders.
- string[] packageGUIDs = AssetDatabase.FindAssets("t:Object", new string[] { "Assets/Packages/com.unity.TextMeshPro" });
-
- for (int i = 0; i < packageGUIDs.Length; i++)
- {
- // Could add a progress bar for this process (if needed)
-
- string guid = packageGUIDs[i];
- string assetFilePath = AssetDatabase.GUIDToAssetPath(guid);
- //string assetMetaFilePath = AssetDatabase.GetTextMetaFilePathFromAssetPath(assetFilePath);
-
- //ObjectIdentifier[] localIdentifider = BundleBuildInterface.GetPlayerObjectIdentifiersInAsset(new GUID(guid), BuildTarget.NoTarget);
- //System.Type[] types = BundleBuildInterface.GetTypeForObjects(localIdentifider);
-
- System.Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetFilePath);
-
- // Filter out file types we are not interested in
- if (assetType == typeof(DefaultAsset))
- continue;
-
- string newGuid = GenerateUniqueGUID();
-
- AssetConversionRecord record;
- record.referencedResource = Path.GetFileName(assetFilePath);
- record.target = "fileID: 2108210716, guid: " + newGuid;
-
- record.replacement = "fileID: 11500000, guid: " + guid;
-
- //if (m_AssetRecords.FindIndex(item => item.oldGuid == guid) != -1)
- // continue;
-
- data.assetRecords.Add(record);
-
- // Read the meta file for the given asset.
- //string assetMetaFile = File.ReadAllText(projectPath + "/" + assetMetaFilePath);
-
- //assetMetaFile = assetMetaFile.Replace("guid: " + guid, "guid: " + newGUID);
-
- //File.WriteAllText(projectPath + "/" + assetMetaFilePath, assetMetaFile);
-
- Debug.Log("Asset: [" + Path.GetFileName(assetFilePath) + "] Type: " + assetType + " Current GUID: [" + guid + "] New GUID: [" + newGuid + "]");
- }
-
- // Write new information into JSON file
- string dataFile = JsonUtility.ToJson(data, true);
-
- File.WriteAllText(projectPath + "/Assets/Packages/com.unity.TextMeshPro/PackageConversionData.json", dataFile);
-
- // Restore project Asset Serialization and Source Control modes.
- RestoreProjectSerializationAndSourceControlModes();
- }
-
-
- /// <summary>
- ///
- /// </summary>
- private static void ConvertProjectGUIDsToUPM()
- {
- // Make sure Asset Serialization mode is set to ForceText with Visible Meta Files.
- SetProjectSerializationAndSourceControlModes();
-
- string projectPath = Path.GetFullPath("Assets/..");
- string packageFullPath = EditorUtilities.TMP_EditorUtility.packageFullPath;
-
- // List containing assets that have been modified.
- List<AssetModificationRecord> modifiedAssetList = new List<AssetModificationRecord>();
-
- // Read Conversion Data from Json file.
- AssetConversionData conversionData = JsonUtility.FromJson<AssetConversionData>(File.ReadAllText(packageFullPath + "/PackageConversionData.json"));
-
- // Get list of GUIDs for assets that might contain references to previous GUIDs that require updating.
- string[] projectGUIDs = AssetDatabase.FindAssets("t:Object");
-
- for (int i = 0; i < projectGUIDs.Length; i++)
- {
- // Could add a progress bar for this process
-
- string guid = projectGUIDs[i];
- string assetFilePath = AssetDatabase.GUIDToAssetPath(guid);
- System.Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetFilePath);
-
- // Filter out file types we are not interested in
- if (assetType == typeof(DefaultAsset) || assetType == typeof(MonoScript) || assetType == typeof(Texture2D) || assetType == typeof(TextAsset) || assetType == typeof(Shader))
- continue;
-
- // Read the asset data file
- string assetDataFile = File.ReadAllText(projectPath + "/" + assetFilePath);
-
- //Debug.Log("Searching Asset: [" + assetFilePath + "] of type: " + assetType);
-
- bool hasFileChanged = false;
-
- foreach (AssetConversionRecord record in conversionData.assetRecords)
- {
- if (assetDataFile.Contains(record.target))
- {
- hasFileChanged = true;
-
- assetDataFile = assetDataFile.Replace(record.target, record.replacement);
-
- Debug.Log("Replacing Reference to [" + record.referencedResource + "] using [" + record.target + "] with [" + record.replacement + "] in asset file: [" + assetFilePath + "].");
- }
- }
-
- if (hasFileChanged)
- {
- Debug.Log("Adding [" + assetFilePath + "] to list of assets to be modified.");
-
- AssetModificationRecord modifiedAsset;
- modifiedAsset.assetFilePath = assetFilePath;
- modifiedAsset.assetDataFile = assetDataFile;
-
- modifiedAssetList.Add(modifiedAsset);
- }
-
- }
-
- // Scan project meta files to update GUIDs of assets whose GUID has changed.
- projectGUIDs = AssetDatabase.FindAssets("t:Object");
-
- for (int i = 0; i < projectGUIDs.Length; i++)
- {
- string guid = projectGUIDs[i];
- string assetFilePath = AssetDatabase.GUIDToAssetPath(guid);
- string assetMetaFilePath = AssetDatabase.GetTextMetaFilePathFromAssetPath(assetFilePath);
-
- // Read the asset meta data file
- string assetMetaFile = File.ReadAllText(projectPath + "/" + assetMetaFilePath);
-
- bool hasFileChanged = false;
-
- foreach (AssetConversionRecord record in conversionData.assetRecords)
- {
- if (assetMetaFile.Contains(record.target))
- {
- hasFileChanged = true;
-
- assetMetaFile = assetMetaFile.Replace(record.target, record.replacement);
-
- Debug.Log("Replacing Reference to [" + record.referencedResource + "] using [" + record.target + "] with [" + record.replacement + "] in asset file: [" + assetMetaFilePath + "].");
- }
- }
-
- if (hasFileChanged)
- {
- Debug.Log("Adding [" + assetMetaFilePath + "] to list of meta files to be modified.");
-
- AssetModificationRecord modifiedAsset;
- modifiedAsset.assetFilePath = assetMetaFilePath;
- modifiedAsset.assetDataFile = assetMetaFile;
-
- modifiedAssetList.Add(modifiedAsset);
- }
- }
-
- // Display dialogue to show user a list of project files that will be modified upon their consent.
- if (EditorUtility.DisplayDialog("Save Modified Asset(s)?", "Are you sure you want to save all modified assets?", "YES", "NO"))
- {
- for (int i = 0; i < modifiedAssetList.Count; i++)
- {
- // Make sure all file streams that might have been opened by Unity are closed.
- //AssetDatabase.ReleaseCachedFileHandles();
-
- Debug.Log("Writing asset file [" + modifiedAssetList[i].assetFilePath + "].");
-
- //File.WriteAllText(projectPath + "/" + modifiedAssetList[i].assetFilePath, modifiedAssetList[i].assetDataFile);
- }
-
- }
-
- AssetDatabase.Refresh();
-
- // Restore project Asset Serialization and Source Control modes.
- RestoreProjectSerializationAndSourceControlModes();
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- private static string GenerateUniqueGUID()
- {
- string monoGuid = System.Guid.NewGuid().ToString();
-
- char[] charGuid = new char[32];
- int index = 0;
- for (int i = 0; i < monoGuid.Length; i++)
- {
- if (monoGuid[i] != '-')
- charGuid[index++] = monoGuid[i];
- }
-
- string guid = new string(charGuid);
-
- // Make sure new GUID is not already used by some other asset.
- if (AssetDatabase.GUIDToAssetPath(guid) != string.Empty)
- guid = GenerateUniqueGUID();
-
- return guid;
- }
-
-
- /// <summary>
- /// Change project asset serialization mode to ForceText (if necessary)
- /// </summary>
- private static void SetProjectSerializationAndSourceControlModes()
- {
- // Make sure Asset Serialization mode is set to ForceText with Visible Meta Files.
- m_ProjectAssetSerializationMode = EditorSettings.serializationMode;
- if (m_ProjectAssetSerializationMode != SerializationMode.ForceText)
- UnityEditor.EditorSettings.serializationMode = SerializationMode.ForceText;
-
- m_ProjectExternalVersionControl = EditorSettings.externalVersionControl;
- if (m_ProjectExternalVersionControl != "Visible Meta Files")
- UnityEditor.EditorSettings.externalVersionControl = "Visible Meta Files";
- }
-
-
- /// <summary>
- /// Revert potential change to asset serialization mode (if necessary)
- /// </summary>
- private static void RestoreProjectSerializationAndSourceControlModes()
- {
- // Make sure Asset Serialization mode is set to ForceText with Visible Meta Files.
- if (m_ProjectAssetSerializationMode != EditorSettings.serializationMode)
- EditorSettings.serializationMode = m_ProjectAssetSerializationMode;
-
- if (m_ProjectExternalVersionControl != EditorSettings.externalVersionControl)
- EditorSettings.externalVersionControl = m_ProjectExternalVersionControl;
- }
-
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PackageUtilities.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PackageUtilities.cs.meta
deleted file mode 100644
index 916d326..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PackageUtilities.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 68eedd4e5b33b37429c02c4add0036fe
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PostBuildProcessHandler.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PostBuildProcessHandler.cs
deleted file mode 100644
index aacab93..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PostBuildProcessHandler.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using UnityEditor.Callbacks;
-using System.IO;
-
-
-namespace TMPro
-{
- public class TMP_PostBuildProcessHandler
- {
- [PostProcessBuildAttribute(10000)]
- public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
- {
- // Check if TMP Essential Resource are present in user project.
- if (target == BuildTarget.iOS && File.Exists(GetEssentialProjectResourcesPath() + "/Resources/TMP Settings.asset") && TMP_Settings.enableEmojiSupport)
- {
- string file = Path.Combine(pathToBuiltProject, "Classes/UI/Keyboard.mm");
- string content = File.ReadAllText(file);
- content = content.Replace("FILTER_EMOJIS_IOS_KEYBOARD 1", "FILTER_EMOJIS_IOS_KEYBOARD 0");
- File.WriteAllText(file, content);
- }
- }
-
-
- private static string GetEssentialProjectResourcesPath()
- {
- // Find the potential location of the TextMesh Pro folder in the user project.
- string projectPath = Path.GetFullPath("Assets/..");
- if (Directory.Exists(projectPath))
- {
- // Search for default location of TMP Essential Resources
- if (Directory.Exists(projectPath + "/Assets/TextMesh Pro/Resources"))
- {
- return "Assets/TextMesh Pro";
- }
-
- // Search for potential alternative locations in the user project
- string[] matchingPaths = Directory.GetDirectories(projectPath, "TextMesh Pro", SearchOption.AllDirectories);
- projectPath = ValidateLocation(matchingPaths, projectPath);
- if (projectPath != null) return projectPath;
- }
-
- return null;
- }
-
-
- private static string ValidateLocation(string[] paths, string projectPath)
- {
- for (int i = 0; i < paths.Length; i++)
- {
- // Check if any of the matching directories contain a GUISkins directory.
- if (Directory.Exists(paths[i] + "/Resources"))
- {
- string folderPath = paths[i].Replace(projectPath, "");
- folderPath = folderPath.TrimStart('\\', '/');
- return folderPath;
- }
- }
-
- return null;
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PostBuildProcessHandler.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PostBuildProcessHandler.cs.meta
deleted file mode 100644
index 5da0161..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_PostBuildProcessHandler.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 6fdea2af3daa40fe8f88e5e9cfc17abb
-timeCreated: 1479886230
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ProjectTextSettings.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ProjectTextSettings.cs
deleted file mode 100644
index 8a3258b..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ProjectTextSettings.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-#if !UNITY_2018_3_OR_NEWER
-using UnityEditor;
-
-namespace TMPro
-{
-
- public static class TMP_ProjectTextSettings
- {
- // Open Project Text Settings
- [MenuItem("Edit/Project Settings/TextMeshPro Settings", false, 309)]
- public static void SelectProjectTextSettings()
- {
- TMP_Settings textSettings = TMP_Settings.instance;
-
- if (textSettings)
- {
- Selection.activeObject = textSettings;
-
- // TODO: Do we want to ping the Project Text Settings asset in the Project Inspector
- EditorUtility.FocusProjectWindow();
- EditorGUIUtility.PingObject(textSettings);
- }
- else
- TMPro_EventManager.RESOURCE_LOAD_EVENT.Add(ON_RESOURCES_LOADED);
- }
-
-
- // Event received when TMP resources have been loaded.
- static void ON_RESOURCES_LOADED()
- {
- TMPro_EventManager.RESOURCE_LOAD_EVENT.Remove(ON_RESOURCES_LOADED);
-
- TMP_Settings textSettings = TMP_Settings.instance;
-
- Selection.activeObject = textSettings;
-
- // TODO: Do we want to ping the Project Text Settings asset in the Project Inspector
- EditorUtility.FocusProjectWindow();
- EditorGUIUtility.PingObject(textSettings);
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ProjectTextSettings.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ProjectTextSettings.cs.meta
deleted file mode 100644
index 403b287..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ProjectTextSettings.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 0e751e877ed14d71a6b8e63ac54949cf
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ResourcesLoader.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ResourcesLoader.cs
deleted file mode 100644
index 16cbd76..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ResourcesLoader.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using UnityEditor;
-using UnityEngine;
-using System.Collections;
-
-namespace TMPro.EditorUtilities
-{
-
- //[InitializeOnLoad]
- class TMP_ResourcesLoader
- {
-
- /// <summary>
- /// Function to pre-load the TMP Resources
- /// </summary>
- public static void LoadTextMeshProResources()
- {
- //TMP_Settings.LoadDefaultSettings();
- //TMP_StyleSheet.LoadDefaultStyleSheet();
- }
-
-
- static TMP_ResourcesLoader()
- {
- //Debug.Log("Loading TMP Resources...");
-
- // Get current targetted platform
-
-
- //string Settings = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
- //TMPro.TMP_Settings.LoadDefaultSettings();
- //TMPro.TMP_StyleSheet.LoadDefaultStyleSheet();
- }
-
-
-
- //[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
- //static void OnBeforeSceneLoaded()
- //{
- //Debug.Log("Before scene is loaded.");
-
- // //TMPro.TMP_Settings.LoadDefaultSettings();
- // //TMPro.TMP_StyleSheet.LoadDefaultStyleSheet();
-
- // //ShaderVariantCollection collection = new ShaderVariantCollection();
- // //Shader s0 = Shader.Find("TextMeshPro/Mobile/Distance Field");
- // //ShaderVariantCollection.ShaderVariant tmp_Variant = new ShaderVariantCollection.ShaderVariant(s0, UnityEngine.Rendering.PassType.Normal, string.Empty);
-
- // //collection.Add(tmp_Variant);
- // //collection.WarmUp();
- //}
-
- }
-
- //static class TMP_ProjectSettings
- //{
- // [InitializeOnLoadMethod]
- // static void SetProjectDefineSymbols()
- // {
- // string currentBuildSettings = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
-
- // //Check for and inject TMP_INSTALLED
- // if (!currentBuildSettings.Contains("TMP_PRESENT"))
- // {
- // PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, currentBuildSettings + ";TMP_PRESENT");
- // }
- // }
- //}
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ResourcesLoader.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ResourcesLoader.cs.meta
deleted file mode 100644
index 3fd11fb..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ResourcesLoader.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 7241c7dc25374fc1a6ab3ef9da79c363
-timeCreated: 1465441092
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SDFShaderGUI.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SDFShaderGUI.cs
deleted file mode 100644
index 22ba616..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SDFShaderGUI.cs
+++ /dev/null
@@ -1,442 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-
-namespace TMPro.EditorUtilities
-{
- public class TMP_SDFShaderGUI : TMP_BaseShaderGUI
- {
- static ShaderFeature s_OutlineFeature, s_UnderlayFeature, s_BevelFeature, s_GlowFeature, s_MaskFeature;
-
- static bool s_Face = true, s_Outline = true, s_Underlay, s_Lighting, s_Glow, s_Bevel, s_Light, s_Bump, s_Env;
-
- static string[]
- s_FaceUvSpeedNames = { "_FaceUVSpeedX", "_FaceUVSpeedY" },
- s_OutlineUvSpeedNames = { "_OutlineUVSpeedX", "_OutlineUVSpeedY" };
-
- static TMP_SDFShaderGUI()
- {
- s_OutlineFeature = new ShaderFeature()
- {
- undoLabel = "Outline",
- keywords = new[] { "OUTLINE_ON" }
- };
-
- s_UnderlayFeature = new ShaderFeature()
- {
- undoLabel = "Underlay",
- keywords = new[] { "UNDERLAY_ON", "UNDERLAY_INNER" },
- label = new GUIContent("Underlay Type"),
- keywordLabels = new[]
- {
- new GUIContent("None"), new GUIContent("Normal"), new GUIContent("Inner")
- }
- };
-
- s_BevelFeature = new ShaderFeature()
- {
- undoLabel = "Bevel",
- keywords = new[] { "BEVEL_ON" }
- };
-
- s_GlowFeature = new ShaderFeature()
- {
- undoLabel = "Glow",
- keywords = new[] { "GLOW_ON" }
- };
-
- s_MaskFeature = new ShaderFeature()
- {
- undoLabel = "Mask",
- keywords = new[] { "MASK_HARD", "MASK_SOFT" },
- label = new GUIContent("Mask"),
- keywordLabels = new[]
- {
- new GUIContent("Mask Off"), new GUIContent("Mask Hard"), new GUIContent("Mask Soft")
- }
- };
- }
-
- protected override void DoGUI()
- {
- s_Face = BeginPanel("Face", s_Face);
- if (s_Face)
- {
- DoFacePanel();
- }
-
- EndPanel();
-
- s_Outline = m_Material.HasProperty(ShaderUtilities.ID_OutlineTex) ? BeginPanel("Outline", s_Outline) : BeginPanel("Outline", s_OutlineFeature, s_Outline);
- if (s_Outline)
- {
- DoOutlinePanel();
- }
-
- EndPanel();
-
- if (m_Material.HasProperty(ShaderUtilities.ID_UnderlayColor))
- {
- s_Underlay = BeginPanel("Underlay", s_UnderlayFeature, s_Underlay);
- if (s_Underlay)
- {
- DoUnderlayPanel();
- }
-
- EndPanel();
- }
-
- if (m_Material.HasProperty("_SpecularColor"))
- {
- s_Lighting = BeginPanel("Lighting", s_BevelFeature, s_Lighting);
- if (s_Lighting)
- {
- s_Bevel = BeginPanel("Bevel", s_Bevel);
- if (s_Bevel)
- {
- DoBevelPanel();
- }
-
- EndPanel();
-
- s_Light = BeginPanel("Local Lighting", s_Light);
- if (s_Light)
- {
- DoLocalLightingPanel();
- }
-
- EndPanel();
-
- s_Bump = BeginPanel("Bump Map", s_Bump);
- if (s_Bump)
- {
- DoBumpMapPanel();
- }
-
- EndPanel();
-
- s_Env = BeginPanel("Environment Map", s_Env);
- if (s_Env)
- {
- DoEnvMapPanel();
- }
-
- EndPanel();
- }
-
- EndPanel();
- }
- else if (m_Material.HasProperty("_SpecColor"))
- {
- s_Bevel = BeginPanel("Bevel", s_Bevel);
- if (s_Bevel)
- {
- DoBevelPanel();
- }
-
- EndPanel();
-
- s_Light = BeginPanel("Surface Lighting", s_Light);
- if (s_Light)
- {
- DoSurfaceLightingPanel();
- }
-
- EndPanel();
-
- s_Bump = BeginPanel("Bump Map", s_Bump);
- if (s_Bump)
- {
- DoBumpMapPanel();
- }
-
- EndPanel();
-
- s_Env = BeginPanel("Environment Map", s_Env);
- if (s_Env)
- {
- DoEnvMapPanel();
- }
-
- EndPanel();
- }
-
- if (m_Material.HasProperty(ShaderUtilities.ID_GlowColor))
- {
- s_Glow = BeginPanel("Glow", s_GlowFeature, s_Glow);
- if (s_Glow)
- {
- DoGlowPanel();
- }
-
- EndPanel();
- }
-
- s_DebugExtended = BeginPanel("Debug Settings", s_DebugExtended);
- if (s_DebugExtended)
- {
- DoDebugPanel();
- }
-
- EndPanel();
- }
-
- void DoFacePanel()
- {
- EditorGUI.indentLevel += 1;
- DoColor("_FaceColor", "Color");
- if (m_Material.HasProperty(ShaderUtilities.ID_FaceTex))
- {
- if (m_Material.HasProperty("_FaceUVSpeedX"))
- {
- DoTexture2D("_FaceTex", "Texture", true, s_FaceUvSpeedNames);
- }
- else
- {
- DoTexture2D("_FaceTex", "Texture", true);
- }
- }
-
- DoSlider("_OutlineSoftness", "Softness");
- DoSlider("_FaceDilate", "Dilate");
- if (m_Material.HasProperty(ShaderUtilities.ID_Shininess))
- {
- DoSlider("_FaceShininess", "Gloss");
- }
-
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.Space();
- }
-
- void DoOutlinePanel()
- {
- EditorGUI.indentLevel += 1;
- DoColor("_OutlineColor", "Color");
- if (m_Material.HasProperty(ShaderUtilities.ID_OutlineTex))
- {
- if (m_Material.HasProperty("_OutlineUVSpeedX"))
- {
- DoTexture2D("_OutlineTex", "Texture", true, s_OutlineUvSpeedNames);
- }
- else
- {
- DoTexture2D("_OutlineTex", "Texture", true);
- }
- }
-
- DoSlider("_OutlineWidth", "Thickness");
- if (m_Material.HasProperty("_OutlineShininess"))
- {
- DoSlider("_OutlineShininess", "Gloss");
- }
-
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.Space();
- }
-
- void DoUnderlayPanel()
- {
- EditorGUI.indentLevel += 1;
- s_UnderlayFeature.DoPopup(m_Editor, m_Material);
- DoColor("_UnderlayColor", "Color");
- DoSlider("_UnderlayOffsetX", "Offset X");
- DoSlider("_UnderlayOffsetY", "Offset Y");
- DoSlider("_UnderlayDilate", "Dilate");
- DoSlider("_UnderlaySoftness", "Softness");
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.Space();
- }
-
- static GUIContent[] s_BevelTypeLabels =
- {
- new GUIContent("Outer Bevel"),
- new GUIContent("Inner Bevel")
- };
-
- void DoBevelPanel()
- {
- EditorGUI.indentLevel += 1;
- DoPopup("_ShaderFlags", "Type", s_BevelTypeLabels);
- DoSlider("_Bevel", "Amount");
- DoSlider("_BevelOffset", "Offset");
- DoSlider("_BevelWidth", "Width");
- DoSlider("_BevelRoundness", "Roundness");
- DoSlider("_BevelClamp", "Clamp");
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.Space();
- }
-
- void DoLocalLightingPanel()
- {
- EditorGUI.indentLevel += 1;
- DoSlider("_LightAngle", "Light Angle");
- DoColor("_SpecularColor", "Specular Color");
- DoSlider("_SpecularPower", "Specular Power");
- DoSlider("_Reflectivity", "Reflectivity Power");
- DoSlider("_Diffuse", "Diffuse Shadow");
- DoSlider("_Ambient", "Ambient Shadow");
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.Space();
- }
-
- void DoSurfaceLightingPanel()
- {
- EditorGUI.indentLevel += 1;
- DoColor("_SpecColor", "Specular Color");
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.Space();
- }
-
- void DoBumpMapPanel()
- {
- EditorGUI.indentLevel += 1;
- DoTexture2D("_BumpMap", "Texture");
- DoSlider("_BumpFace", "Face");
- DoSlider("_BumpOutline", "Outline");
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.Space();
- }
-
- void DoEnvMapPanel()
- {
- EditorGUI.indentLevel += 1;
- DoColor("_ReflectFaceColor", "Face Color");
- DoColor("_ReflectOutlineColor", "Outline Color");
- DoCubeMap("_Cube", "Texture");
- DoVector3("_EnvMatrixRotation", "Rotation");
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.Space();
- }
-
- void DoGlowPanel()
- {
- EditorGUI.indentLevel += 1;
- DoColor("_GlowColor", "Color");
- DoSlider("_GlowOffset", "Offset");
- DoSlider("_GlowInner", "Inner");
- DoSlider("_GlowOuter", "Outer");
- DoSlider("_GlowPower", "Power");
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.Space();
- }
-
- void DoDebugPanel()
- {
- EditorGUI.indentLevel += 1;
- DoTexture2D("_MainTex", "Font Atlas");
- DoFloat("_GradientScale", "Gradient Scale");
- DoFloat("_TextureWidth", "Texture Width");
- DoFloat("_TextureHeight", "Texture Height");
- EditorGUILayout.Space();
- DoFloat("_ScaleX", "Scale X");
- DoFloat("_ScaleY", "Scale Y");
-
- if (m_Material.HasProperty(ShaderUtilities.ID_Sharpness))
- DoSlider("_Sharpness", "Sharpness");
-
- DoSlider("_PerspectiveFilter", "Perspective Filter");
- EditorGUILayout.Space();
- DoFloat("_VertexOffsetX", "Offset X");
- DoFloat("_VertexOffsetY", "Offset Y");
-
- if (m_Material.HasProperty(ShaderUtilities.ID_MaskCoord))
- {
- EditorGUILayout.Space();
- s_MaskFeature.ReadState(m_Material);
- s_MaskFeature.DoPopup(m_Editor, m_Material);
- if (s_MaskFeature.Active)
- {
- DoMaskSubgroup();
- }
-
- EditorGUILayout.Space();
- DoVector("_ClipRect", "Clip Rect", s_LbrtVectorLabels);
- }
- else if (m_Material.HasProperty("_MaskTex"))
- {
- DoMaskTexSubgroup();
- }
- else if (m_Material.HasProperty(ShaderUtilities.ID_MaskSoftnessX))
- {
- EditorGUILayout.Space();
- DoFloat("_MaskSoftnessX", "Softness X");
- DoFloat("_MaskSoftnessY", "Softness Y");
- DoVector("_ClipRect", "Clip Rect", s_LbrtVectorLabels);
- }
-
- if (m_Material.HasProperty(ShaderUtilities.ID_StencilID))
- {
- EditorGUILayout.Space();
- DoFloat("_Stencil", "Stencil ID");
- DoFloat("_StencilComp", "Stencil Comp");
- }
-
- EditorGUILayout.Space();
-
- EditorGUI.BeginChangeCheck();
- bool useRatios = EditorGUILayout.Toggle("Use Ratios", !m_Material.IsKeywordEnabled("RATIOS_OFF"));
- if (EditorGUI.EndChangeCheck())
- {
- m_Editor.RegisterPropertyChangeUndo("Use Ratios");
- if (useRatios)
- {
- m_Material.DisableKeyword("RATIOS_OFF");
- }
- else
- {
- m_Material.EnableKeyword("RATIOS_OFF");
- }
- }
-
- EditorGUI.BeginDisabledGroup(true);
- DoFloat("_ScaleRatioA", "Scale Ratio A");
- DoFloat("_ScaleRatioB", "Scale Ratio B");
- DoFloat("_ScaleRatioC", "Scale Ratio C");
- EditorGUI.EndDisabledGroup();
- EditorGUI.indentLevel -= 1;
- EditorGUILayout.Space();
- }
-
- void DoMaskSubgroup()
- {
- DoVector("_MaskCoord", "Mask Bounds", s_XywhVectorLabels);
- if (Selection.activeGameObject != null)
- {
- Renderer renderer = Selection.activeGameObject.GetComponent<Renderer>();
- if (renderer != null)
- {
- Rect rect = EditorGUILayout.GetControlRect();
- rect.x += EditorGUIUtility.labelWidth;
- rect.width -= EditorGUIUtility.labelWidth;
- if (GUI.Button(rect, "Match Renderer Bounds"))
- {
- FindProperty("_MaskCoord", m_Properties).vectorValue = new Vector4(
- 0,
- 0,
- Mathf.Round(renderer.bounds.extents.x * 1000) / 1000,
- Mathf.Round(renderer.bounds.extents.y * 1000) / 1000
- );
- }
- }
- }
-
- if (s_MaskFeature.State == 1)
- {
- DoFloat("_MaskSoftnessX", "Softness X");
- DoFloat("_MaskSoftnessY", "Softness Y");
- }
- }
-
- void DoMaskTexSubgroup()
- {
- EditorGUILayout.Space();
- DoTexture2D("_MaskTex", "Mask Texture");
- DoToggle("_MaskInverse", "Inverse Mask");
- DoColor("_MaskEdgeColor", "Edge Color");
- DoSlider("_MaskEdgeSoftness", "Edge Softness");
- DoSlider("_MaskWipeControl", "Wipe Position");
- DoFloat("_MaskSoftnessX", "Softness X");
- DoFloat("_MaskSoftnessY", "Softness Y");
- DoVector("_ClipRect", "Clip Rect", s_LbrtVectorLabels);
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SDFShaderGUI.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SDFShaderGUI.cs.meta
deleted file mode 100644
index bad1503..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SDFShaderGUI.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 8413ca0e506d42a1a4bd9769f204ad16
-timeCreated: 1469844718
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SerializedPropertyHolder.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SerializedPropertyHolder.cs
deleted file mode 100644
index 227ea7c..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SerializedPropertyHolder.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-
-namespace TMPro
-{
- class TMP_SerializedPropertyHolder : ScriptableObject
- {
- public TMP_FontAsset fontAsset;
- public uint firstCharacter;
- public uint secondCharacter;
-
- public TMP_GlyphPairAdjustmentRecord glyphPairAdjustmentRecord = new TMP_GlyphPairAdjustmentRecord(new TMP_GlyphAdjustmentRecord(), new TMP_GlyphAdjustmentRecord());
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SerializedPropertyHolder.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SerializedPropertyHolder.cs.meta
deleted file mode 100644
index 5419071..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SerializedPropertyHolder.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 9c4a050f089abb04ebd4125e419f4548
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SettingsEditor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SettingsEditor.cs
deleted file mode 100644
index 78897f1..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SettingsEditor.cs
+++ /dev/null
@@ -1,341 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEditor;
-using UnityEditorInternal;
-
-#pragma warning disable 0414 // Disabled a few warnings for not yet implemented features.
-
-namespace TMPro.EditorUtilities
-{
- [CustomEditor(typeof(TMP_Settings))]
- public class TMP_SettingsEditor : Editor
- {
- internal class Styles
- {
- public static readonly GUIContent defaultFontAssetLabel = new GUIContent("Default Font Asset", "The Font Asset that will be assigned by default to newly created text objects when no Font Asset is specified.");
- public static readonly GUIContent defaultFontAssetPathLabel = new GUIContent("Path: Resources/", "The relative path to a Resources folder where the Font Assets and Material Presets are located.\nExample \"Fonts & Materials/\"");
-
- public static readonly GUIContent fallbackFontAssetsLabel = new GUIContent("Fallback Font Assets", "The Font Assets that will be searched to locate and replace missing characters from a given Font Asset.");
- public static readonly GUIContent fallbackFontAssetsListLabel = new GUIContent("Fallback Font Assets List", "The Font Assets that will be searched to locate and replace missing characters from a given Font Asset.");
-
- public static readonly GUIContent fallbackMaterialSettingsLabel = new GUIContent("Fallback Material Settings");
- public static readonly GUIContent matchMaterialPresetLabel = new GUIContent("Match Material Presets");
-
- public static readonly GUIContent containerDefaultSettingsLabel = new GUIContent("Text Container Default Settings");
-
- public static readonly GUIContent textMeshProLabel = new GUIContent("TextMeshPro");
- public static readonly GUIContent textMeshProUiLabel = new GUIContent("TextMeshPro UI");
- public static readonly GUIContent enableRaycastTarget = new GUIContent("Enable Raycast Target");
- public static readonly GUIContent autoSizeContainerLabel = new GUIContent("Auto Size Text Container", "Set the size of the text container to match the text.");
-
- public static readonly GUIContent textComponentDefaultSettingsLabel = new GUIContent("Text Component Default Settings");
- public static readonly GUIContent defaultFontSize = new GUIContent("Default Font Size");
- public static readonly GUIContent autoSizeRatioLabel = new GUIContent("Text Auto Size Ratios");
- public static readonly GUIContent minLabel = new GUIContent("Min");
- public static readonly GUIContent maxLabel = new GUIContent("Max");
-
- public static readonly GUIContent wordWrappingLabel = new GUIContent("Word Wrapping");
- public static readonly GUIContent kerningLabel = new GUIContent("Kerning");
- public static readonly GUIContent extraPaddingLabel = new GUIContent("Extra Padding");
- public static readonly GUIContent tintAllSpritesLabel = new GUIContent("Tint All Sprites");
- public static readonly GUIContent parseEscapeCharactersLabel = new GUIContent("Parse Escape Sequence");
-
- public static readonly GUIContent dynamicFontSystemSettingsLabel = new GUIContent("Dynamic Font System Settings");
- public static readonly GUIContent getFontFeaturesAtRuntime = new GUIContent("Get Font Features at Runtime", "Determines if Glyph Adjustment Data will be retrieved from font files at runtime when new characters and glyphs are added to font assets.");
-
- public static readonly GUIContent missingGlyphLabel = new GUIContent("Replacement Character", "The character to be displayed when the requested character is not found in any font asset or fallbacks.");
- public static readonly GUIContent disableWarningsLabel = new GUIContent("Disable warnings", "Disable warning messages in the Console.");
-
- public static readonly GUIContent defaultSpriteAssetLabel = new GUIContent("Default Sprite Asset", "The Sprite Asset that will be assigned by default when using the <sprite> tag when no Sprite Asset is specified.");
- public static readonly GUIContent enableEmojiSupportLabel = new GUIContent("iOS Emoji Support", "Enables Emoji support for Touch Screen Keyboards on target devices.");
- public static readonly GUIContent spriteAssetsPathLabel = new GUIContent("Path: Resources/", "The relative path to a Resources folder where the Sprite Assets are located.\nExample \"Sprite Assets/\"");
-
- public static readonly GUIContent defaultStyleSheetLabel = new GUIContent("Default Style Sheet", "The Style Sheet that will be used for all text objects in this project.");
-
- public static readonly GUIContent colorGradientPresetsLabel = new GUIContent("Color Gradient Presets", "The relative path to a Resources folder where the Color Gradient Presets are located.\nExample \"Color Gradient Presets/\"");
- public static readonly GUIContent colorGradientsPathLabel = new GUIContent("Path: Resources/", "The relative path to a Resources folder where the Color Gradient Presets are located.\nExample \"Color Gradient Presets/\"");
-
- public static readonly GUIContent lineBreakingLabel = new GUIContent("Line Breaking for Asian languages", "The text assets that contain the Leading and Following characters which define the rules for line breaking with Asian languages.");
- }
-
- SerializedProperty m_PropFontAsset;
- SerializedProperty m_PropDefaultFontAssetPath;
- SerializedProperty m_PropDefaultFontSize;
- SerializedProperty m_PropDefaultAutoSizeMinRatio;
- SerializedProperty m_PropDefaultAutoSizeMaxRatio;
- SerializedProperty m_PropDefaultTextMeshProTextContainerSize;
- SerializedProperty m_PropDefaultTextMeshProUITextContainerSize;
- SerializedProperty m_PropAutoSizeTextContainer;
- SerializedProperty m_PropEnableRaycastTarget;
-
- SerializedProperty m_PropSpriteAsset;
- SerializedProperty m_PropSpriteAssetPath;
- SerializedProperty m_PropEnableEmojiSupport;
- SerializedProperty m_PropStyleSheet;
- ReorderableList m_List;
-
- SerializedProperty m_PropColorGradientPresetsPath;
-
- SerializedProperty m_PropMatchMaterialPreset;
- SerializedProperty m_PropWordWrapping;
- SerializedProperty m_PropKerning;
- SerializedProperty m_PropExtraPadding;
- SerializedProperty m_PropTintAllSprites;
- SerializedProperty m_PropParseEscapeCharacters;
- SerializedProperty m_PropMissingGlyphCharacter;
-
- SerializedProperty m_GetFontFeaturesAtRuntime;
-
- SerializedProperty m_PropWarningsDisabled;
-
- SerializedProperty m_PropLeadingCharacters;
- SerializedProperty m_PropFollowingCharacters;
-
- public void OnEnable()
- {
- if (target == null)
- return;
-
- m_PropFontAsset = serializedObject.FindProperty("m_defaultFontAsset");
- m_PropDefaultFontAssetPath = serializedObject.FindProperty("m_defaultFontAssetPath");
- m_PropDefaultFontSize = serializedObject.FindProperty("m_defaultFontSize");
- m_PropDefaultAutoSizeMinRatio = serializedObject.FindProperty("m_defaultAutoSizeMinRatio");
- m_PropDefaultAutoSizeMaxRatio = serializedObject.FindProperty("m_defaultAutoSizeMaxRatio");
- m_PropDefaultTextMeshProTextContainerSize = serializedObject.FindProperty("m_defaultTextMeshProTextContainerSize");
- m_PropDefaultTextMeshProUITextContainerSize = serializedObject.FindProperty("m_defaultTextMeshProUITextContainerSize");
- m_PropAutoSizeTextContainer = serializedObject.FindProperty("m_autoSizeTextContainer");
- m_PropEnableRaycastTarget = serializedObject.FindProperty("m_EnableRaycastTarget");
-
- m_PropSpriteAsset = serializedObject.FindProperty("m_defaultSpriteAsset");
- m_PropSpriteAssetPath = serializedObject.FindProperty("m_defaultSpriteAssetPath");
- m_PropEnableEmojiSupport = serializedObject.FindProperty("m_enableEmojiSupport");
- m_PropStyleSheet = serializedObject.FindProperty("m_defaultStyleSheet");
- m_PropColorGradientPresetsPath = serializedObject.FindProperty("m_defaultColorGradientPresetsPath");
-
- m_List = new ReorderableList(serializedObject, serializedObject.FindProperty("m_fallbackFontAssets"), true, true, true, true);
-
- m_List.drawElementCallback = (rect, index, isActive, isFocused) =>
- {
- var element = m_List.serializedProperty.GetArrayElementAtIndex(index);
- rect.y += 2;
- EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, GUIContent.none);
- };
-
- m_List.drawHeaderCallback = rect =>
- {
- EditorGUI.LabelField(rect, Styles.fallbackFontAssetsListLabel);
- };
-
- m_PropMatchMaterialPreset = serializedObject.FindProperty("m_matchMaterialPreset");
-
- m_PropWordWrapping = serializedObject.FindProperty("m_enableWordWrapping");
- m_PropKerning = serializedObject.FindProperty("m_enableKerning");
- m_PropExtraPadding = serializedObject.FindProperty("m_enableExtraPadding");
- m_PropTintAllSprites = serializedObject.FindProperty("m_enableTintAllSprites");
- m_PropParseEscapeCharacters = serializedObject.FindProperty("m_enableParseEscapeCharacters");
- m_PropMissingGlyphCharacter = serializedObject.FindProperty("m_missingGlyphCharacter");
-
- m_PropWarningsDisabled = serializedObject.FindProperty("m_warningsDisabled");
-
- m_GetFontFeaturesAtRuntime = serializedObject.FindProperty("m_GetFontFeaturesAtRuntime");
-
- m_PropLeadingCharacters = serializedObject.FindProperty("m_leadingCharacters");
- m_PropFollowingCharacters = serializedObject.FindProperty("m_followingCharacters");
- }
-
- public override void OnInspectorGUI()
- {
- serializedObject.Update();
-
- float labelWidth = EditorGUIUtility.labelWidth;
- float fieldWidth = EditorGUIUtility.fieldWidth;
-
- // TextMeshPro Font Info Panel
- EditorGUI.indentLevel = 0;
-
- // FONT ASSET
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label(Styles.defaultFontAssetLabel, EditorStyles.boldLabel);
- EditorGUI.indentLevel = 1;
- EditorGUILayout.PropertyField(m_PropFontAsset, Styles.defaultFontAssetLabel);
- EditorGUILayout.PropertyField(m_PropDefaultFontAssetPath, Styles.defaultFontAssetPathLabel);
- EditorGUI.indentLevel = 0;
-
- EditorGUILayout.Space();
- EditorGUILayout.EndVertical();
-
- // FALLBACK FONT ASSETs
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label(Styles.fallbackFontAssetsLabel, EditorStyles.boldLabel);
- m_List.DoLayoutList();
-
- GUILayout.Label(Styles.fallbackMaterialSettingsLabel, EditorStyles.boldLabel);
- EditorGUI.indentLevel = 1;
- EditorGUILayout.PropertyField(m_PropMatchMaterialPreset, Styles.matchMaterialPresetLabel);
- EditorGUI.indentLevel = 0;
-
- EditorGUILayout.Space();
- EditorGUILayout.EndVertical();
-
- // MISSING GLYPHS
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label(Styles.dynamicFontSystemSettingsLabel, EditorStyles.boldLabel);
- EditorGUI.indentLevel = 1;
- EditorGUILayout.PropertyField(m_GetFontFeaturesAtRuntime, Styles.getFontFeaturesAtRuntime);
- EditorGUILayout.PropertyField(m_PropMissingGlyphCharacter, Styles.missingGlyphLabel);
- EditorGUILayout.PropertyField(m_PropWarningsDisabled, Styles.disableWarningsLabel);
- EditorGUI.indentLevel = 0;
-
- EditorGUILayout.Space();
- EditorGUILayout.EndVertical();
-
- // TEXT OBJECT DEFAULT PROPERTIES
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label(Styles.containerDefaultSettingsLabel, EditorStyles.boldLabel);
- EditorGUI.indentLevel = 1;
-
- EditorGUILayout.PropertyField(m_PropDefaultTextMeshProTextContainerSize, Styles.textMeshProLabel);
- EditorGUILayout.PropertyField(m_PropDefaultTextMeshProUITextContainerSize, Styles.textMeshProUiLabel);
- EditorGUILayout.PropertyField(m_PropEnableRaycastTarget, Styles.enableRaycastTarget);
- EditorGUILayout.PropertyField(m_PropAutoSizeTextContainer, Styles.autoSizeContainerLabel);
- EditorGUI.indentLevel = 0;
-
- EditorGUILayout.Space();
-
- GUILayout.Label(Styles.textComponentDefaultSettingsLabel, EditorStyles.boldLabel);
- EditorGUI.indentLevel = 1;
- EditorGUILayout.PropertyField(m_PropDefaultFontSize, Styles.defaultFontSize);
-
- EditorGUILayout.BeginHorizontal();
- {
- EditorGUILayout.PrefixLabel(Styles.autoSizeRatioLabel);
- EditorGUIUtility.labelWidth = 32;
- EditorGUIUtility.fieldWidth = 10;
-
- EditorGUI.indentLevel = 0;
- EditorGUILayout.PropertyField(m_PropDefaultAutoSizeMinRatio, Styles.minLabel);
- EditorGUILayout.PropertyField(m_PropDefaultAutoSizeMaxRatio, Styles.maxLabel);
- EditorGUI.indentLevel = 1;
- }
- EditorGUILayout.EndHorizontal();
-
- EditorGUIUtility.labelWidth = labelWidth;
- EditorGUIUtility.fieldWidth = fieldWidth;
-
- EditorGUILayout.PropertyField(m_PropWordWrapping, Styles.wordWrappingLabel);
- EditorGUILayout.PropertyField(m_PropKerning, Styles.kerningLabel);
-
- EditorGUILayout.PropertyField(m_PropExtraPadding, Styles.extraPaddingLabel);
- EditorGUILayout.PropertyField(m_PropTintAllSprites, Styles.tintAllSpritesLabel);
-
- EditorGUILayout.PropertyField(m_PropParseEscapeCharacters, Styles.parseEscapeCharactersLabel);
-
- EditorGUI.indentLevel = 0;
-
- EditorGUILayout.Space();
- EditorGUILayout.EndVertical();
-
- // SPRITE ASSET
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label(Styles.defaultSpriteAssetLabel, EditorStyles.boldLabel);
- EditorGUI.indentLevel = 1;
- EditorGUILayout.PropertyField(m_PropSpriteAsset, Styles.defaultSpriteAssetLabel);
- EditorGUILayout.PropertyField(m_PropEnableEmojiSupport, Styles.enableEmojiSupportLabel);
- EditorGUILayout.PropertyField(m_PropSpriteAssetPath, Styles.spriteAssetsPathLabel);
- EditorGUI.indentLevel = 0;
-
- EditorGUILayout.Space();
- EditorGUILayout.EndVertical();
-
- // STYLE SHEET
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label(Styles.defaultStyleSheetLabel, EditorStyles.boldLabel);
- EditorGUI.indentLevel = 1;
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_PropStyleSheet, Styles.defaultStyleSheetLabel);
- if (EditorGUI.EndChangeCheck())
- {
- serializedObject.ApplyModifiedProperties();
- TMP_StyleSheet.UpdateStyleSheet();
- }
- EditorGUI.indentLevel = 0;
-
- EditorGUILayout.Space();
- EditorGUILayout.EndVertical();
-
- // COLOR GRADIENT PRESETS
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label(Styles.colorGradientPresetsLabel, EditorStyles.boldLabel);
- EditorGUI.indentLevel = 1;
- EditorGUILayout.PropertyField(m_PropColorGradientPresetsPath, Styles.colorGradientsPathLabel);
- EditorGUI.indentLevel = 0;
-
- EditorGUILayout.Space();
- EditorGUILayout.EndVertical();
-
- // LINE BREAKING RULE
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label(Styles.lineBreakingLabel, EditorStyles.boldLabel);
- EditorGUI.indentLevel = 1;
- EditorGUILayout.PropertyField(m_PropLeadingCharacters);
- EditorGUILayout.PropertyField(m_PropFollowingCharacters);
- EditorGUI.indentLevel = 0;
-
- EditorGUILayout.Space();
- EditorGUILayout.EndVertical();
-
- if (serializedObject.ApplyModifiedProperties())
- {
- EditorUtility.SetDirty(target);
- TMPro_EventManager.ON_TMP_SETTINGS_CHANGED();
- }
- }
- }
-
-#if UNITY_2018_3_OR_NEWER
- class TMP_ResourceImporterProvider : SettingsProvider
- {
- TMP_PackageResourceImporter m_ResourceImporter;
-
- public TMP_ResourceImporterProvider()
- : base("Project/TextMesh Pro", SettingsScope.Project)
- {
- }
-
- public override void OnGUI(string searchContext)
- {
- // Lazy creation that supports domain reload
- if (m_ResourceImporter == null)
- m_ResourceImporter = new TMP_PackageResourceImporter();
-
- m_ResourceImporter.OnGUI();
- }
-
- public override void OnDeactivate()
- {
- if (m_ResourceImporter != null)
- m_ResourceImporter.OnDestroy();
- }
-
- static UnityEngine.Object GetTMPSettings()
- {
- return Resources.Load<TMP_Settings>("TMP Settings");
- }
-
- [SettingsProviderGroup]
- static SettingsProvider[] CreateTMPSettingsProvider()
- {
- var providers = new List<SettingsProvider> { new TMP_ResourceImporterProvider() };
-
- if (GetTMPSettings() != null)
- {
- var provider = new AssetSettingsProvider("Project/TextMesh Pro/Settings", GetTMPSettings);
- provider.PopulateSearchKeywordsFromGUIContentProperties<TMP_SettingsEditor.Styles>();
- providers.Add(provider);
- }
-
- return providers.ToArray();
- }
- }
-#endif
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SettingsEditor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SettingsEditor.cs.meta
deleted file mode 100644
index 18c399a..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SettingsEditor.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 0386b6eb838c47138cd51d1c1b879a35
-timeCreated: 1436658550
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetEditor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetEditor.cs
deleted file mode 100644
index 82d13d7..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetEditor.cs
+++ /dev/null
@@ -1,896 +0,0 @@
-using UnityEngine;
-using UnityEngine.TextCore;
-using UnityEditor;
-using UnityEditorInternal;
-using System.Collections.Generic;
-
-
-
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomEditor(typeof(TMP_SpriteAsset))]
- public class TMP_SpriteAssetEditor : Editor
- {
- struct UI_PanelState
- {
- public static bool spriteAssetInfoPanel = true;
- public static bool fallbackSpriteAssetPanel = true;
- public static bool spriteCharacterTablePanel;
- public static bool spriteGlyphTablePanel;
- }
-
- private static string[] s_UiStateLabel = new string[] { "<i>(Click to collapse)</i> ", "<i>(Click to expand)</i> " };
-
- int m_moveToIndex;
- int m_selectedElement = -1;
- int m_CurrentCharacterPage;
- int m_CurrentGlyphPage;
-
- const string k_UndoRedo = "UndoRedoPerformed";
-
- string m_CharacterSearchPattern;
- List<int> m_CharacterSearchList;
- bool m_IsCharacterSearchDirty;
-
- string m_GlyphSearchPattern;
- List<int> m_GlyphSearchList;
- bool m_IsGlyphSearchDirty;
-
- SerializedProperty m_spriteAtlas_prop;
- SerializedProperty m_material_prop;
- SerializedProperty m_SpriteCharacterTableProperty;
- SerializedProperty m_SpriteGlyphTableProperty;
- ReorderableList m_fallbackSpriteAssetList;
-
- TMP_SpriteAsset m_SpriteAsset;
-
- bool isAssetDirty;
-
- float m_xOffset;
- float m_yOffset;
- float m_xAdvance;
- float m_scale;
-
- public void OnEnable()
- {
- m_SpriteAsset = target as TMP_SpriteAsset;
-
- m_spriteAtlas_prop = serializedObject.FindProperty("spriteSheet");
- m_material_prop = serializedObject.FindProperty("material");
- m_SpriteCharacterTableProperty = serializedObject.FindProperty("m_SpriteCharacterTable");
- m_SpriteGlyphTableProperty = serializedObject.FindProperty("m_SpriteGlyphTable");
-
- // Fallback TMP Sprite Asset list
- m_fallbackSpriteAssetList = new ReorderableList(serializedObject, serializedObject.FindProperty("fallbackSpriteAssets"), true, true, true, true);
-
- m_fallbackSpriteAssetList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
- {
- var element = m_fallbackSpriteAssetList.serializedProperty.GetArrayElementAtIndex(index);
- rect.y += 2;
- EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, GUIContent.none);
- };
-
- m_fallbackSpriteAssetList.drawHeaderCallback = rect =>
- {
- EditorGUI.LabelField(rect, new GUIContent("Fallback Sprite Asset List", "Select the Sprite Assets that will be searched and used as fallback when a given sprite is missing from this sprite asset."));
- };
- }
-
-
- public override void OnInspectorGUI()
- {
-
- //Debug.Log("OnInspectorGUI Called.");
- Event currentEvent = Event.current;
- string evt_cmd = currentEvent.commandName; // Get Current Event CommandName to check for Undo Events
-
- serializedObject.Update();
-
- Rect rect;
-
- // TEXTMESHPRO SPRITE INFO PANEL
- GUILayout.Label("Sprite Info", EditorStyles.boldLabel);
- EditorGUI.indentLevel = 1;
-
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_spriteAtlas_prop , new GUIContent("Sprite Atlas"));
- if (EditorGUI.EndChangeCheck())
- {
- // Assign the new sprite atlas texture to the current material
- Texture2D tex = m_spriteAtlas_prop.objectReferenceValue as Texture2D;
- if (tex != null)
- {
- Material mat = m_material_prop.objectReferenceValue as Material;
- if (mat != null)
- mat.mainTexture = tex;
- }
- }
-
- EditorGUILayout.PropertyField(m_material_prop, new GUIContent("Default Material"));
-
- EditorGUILayout.Space();
-
- // FALLBACK SPRITE ASSETS
- EditorGUI.indentLevel = 0;
- UI_PanelState.fallbackSpriteAssetPanel = EditorGUILayout.Foldout(UI_PanelState.fallbackSpriteAssetPanel, new GUIContent("Fallback Sprite Assets", "Select the Sprite Assets that will be searched and used as fallback when a given sprite is missing from this sprite asset."), true, TMP_UIStyleManager.boldFoldout);
-
- if (UI_PanelState.fallbackSpriteAssetPanel)
- {
- m_fallbackSpriteAssetList.DoLayoutList();
- }
-
- // SPRITE CHARACTER TABLE
- #region Display Sprite Character Table
- EditorGUI.indentLevel = 0;
- rect = EditorGUILayout.GetControlRect(false, 24);
-
- if (GUI.Button(rect, new GUIContent("<b>Sprite Character Table</b>", "List of sprite characters contained in this sprite asset."), TMP_UIStyleManager.sectionHeader))
- UI_PanelState.spriteCharacterTablePanel = !UI_PanelState.spriteCharacterTablePanel;
-
- GUI.Label(rect, (UI_PanelState.spriteCharacterTablePanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
-
- if (UI_PanelState.spriteCharacterTablePanel)
- {
- int arraySize = m_SpriteCharacterTableProperty.arraySize;
- int itemsPerPage = 10;
-
- // Display Glyph Management Tools
- EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandWidth(true));
- {
- // Search Bar implementation
- #region DISPLAY SEARCH BAR
- EditorGUILayout.BeginHorizontal();
- {
- EditorGUIUtility.labelWidth = 110f;
- EditorGUI.BeginChangeCheck();
- string searchPattern = EditorGUILayout.TextField("Sprite Search", m_CharacterSearchPattern, "SearchTextField");
- if (EditorGUI.EndChangeCheck() || m_IsCharacterSearchDirty)
- {
- if (string.IsNullOrEmpty(searchPattern) == false)
- {
- //GUIUtility.keyboardControl = 0;
- m_CharacterSearchPattern = searchPattern.ToLower(System.Globalization.CultureInfo.InvariantCulture).Trim();
-
- // Search Glyph Table for potential matches
- SearchCharacterTable(m_CharacterSearchPattern, ref m_CharacterSearchList);
- }
- else
- m_CharacterSearchPattern = null;
-
- m_IsCharacterSearchDirty = false;
- }
-
- string styleName = string.IsNullOrEmpty(m_CharacterSearchPattern) ? "SearchCancelButtonEmpty" : "SearchCancelButton";
- if (GUILayout.Button(GUIContent.none, styleName))
- {
- GUIUtility.keyboardControl = 0;
- m_CharacterSearchPattern = string.Empty;
- }
- }
- EditorGUILayout.EndHorizontal();
- #endregion
-
- // Display Page Navigation
- if (!string.IsNullOrEmpty(m_CharacterSearchPattern))
- arraySize = m_CharacterSearchList.Count;
-
- // Display Page Navigation
- DisplayPageNavigation(ref m_CurrentCharacterPage, arraySize, itemsPerPage);
- }
- EditorGUILayout.EndVertical();
-
- if (arraySize > 0)
- {
- // Display each SpriteInfo entry using the SpriteInfo property drawer.
- for (int i = itemsPerPage * m_CurrentCharacterPage; i < arraySize && i < itemsPerPage * (m_CurrentCharacterPage + 1); i++)
- {
- // Define the start of the selection region of the element.
- Rect elementStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- int elementIndex = i;
- if (!string.IsNullOrEmpty(m_CharacterSearchPattern))
- elementIndex = m_CharacterSearchList[i];
-
- SerializedProperty spriteCharacterProperty = m_SpriteCharacterTableProperty.GetArrayElementAtIndex(elementIndex);
-
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- {
- EditorGUI.BeginDisabledGroup(i != m_selectedElement);
- {
- EditorGUILayout.PropertyField(spriteCharacterProperty);
- }
- EditorGUI.EndDisabledGroup();
- }
- EditorGUILayout.EndVertical();
-
- // Define the end of the selection region of the element.
- Rect elementEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- // Check for Item selection
- Rect selectionArea = new Rect(elementStartRegion.x, elementStartRegion.y, elementEndRegion.width, elementEndRegion.y - elementStartRegion.y);
- if (DoSelectionCheck(selectionArea))
- {
- if (m_selectedElement == i)
- {
- m_selectedElement = -1;
- }
- else
- {
- m_selectedElement = i;
- GUIUtility.keyboardControl = 0;
- }
- }
-
- // Draw & Handle Section Area
- if (m_selectedElement == i)
- {
- // Draw selection highlight
- TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));
-
- // Draw options to MoveUp, MoveDown, Add or Remove Sprites
- Rect controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * 1f);
- controlRect.width /= 8;
-
- // Move sprite up.
- bool guiEnabled = GUI.enabled;
- if (i == 0) { GUI.enabled = false; }
- if (GUI.Button(controlRect, "Up"))
- {
- SwapCharacterElements(i, i - 1);
- }
- GUI.enabled = guiEnabled;
-
- // Move sprite down.
- controlRect.x += controlRect.width;
- if (i == arraySize - 1) { GUI.enabled = false; }
- if (GUI.Button(controlRect, "Down"))
- {
- SwapCharacterElements(i, i + 1);
- }
- GUI.enabled = guiEnabled;
-
- // Move sprite to new index
- controlRect.x += controlRect.width * 2;
- //if (i == arraySize - 1) { GUI.enabled = false; }
- m_moveToIndex = EditorGUI.IntField(controlRect, m_moveToIndex);
- controlRect.x -= controlRect.width;
- if (GUI.Button(controlRect, "Goto"))
- {
- MoveCharacterToIndex(i, m_moveToIndex);
- }
- //controlRect.x += controlRect.width;
- GUI.enabled = guiEnabled;
-
- // Add new Sprite
- controlRect.x += controlRect.width * 4;
- if (GUI.Button(controlRect, "+"))
- {
- m_SpriteCharacterTableProperty.arraySize += 1;
-
- int index = m_SpriteCharacterTableProperty.arraySize - 1;
-
- SerializedProperty spriteInfo_prop = m_SpriteCharacterTableProperty.GetArrayElementAtIndex(index);
-
- // Copy properties of the selected element
- CopyCharacterSerializedProperty(m_SpriteCharacterTableProperty.GetArrayElementAtIndex(elementIndex), ref spriteInfo_prop);
-
- //spriteInfo_prop.FindPropertyRelative("m_Index").intValue = index;
- serializedObject.ApplyModifiedProperties();
-
- m_IsCharacterSearchDirty = true;
- }
-
- // Delete selected Sprite
- controlRect.x += controlRect.width;
- if (m_selectedElement == -1) GUI.enabled = false;
- if (GUI.Button(controlRect, "-"))
- {
- m_SpriteCharacterTableProperty.DeleteArrayElementAtIndex(elementIndex);
-
- m_selectedElement = -1;
- serializedObject.ApplyModifiedProperties();
-
- m_IsCharacterSearchDirty = true;
-
- return;
- }
-
-
- }
- }
- }
-
- DisplayPageNavigation(ref m_CurrentCharacterPage, arraySize, itemsPerPage);
-
- EditorGUIUtility.labelWidth = 40f;
- EditorGUIUtility.fieldWidth = 20f;
-
- GUILayout.Space(5f);
-
- // GLOBAL TOOLS
- #region Global Tools
- /*
- GUI.enabled = true;
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- rect = EditorGUILayout.GetControlRect(false, 40);
-
- float width = (rect.width - 75f) / 4;
- EditorGUI.LabelField(rect, "Global Offsets & Scale", EditorStyles.boldLabel);
-
-
- rect.x += 70;
- bool old_ChangedState = GUI.changed;
-
- GUI.changed = false;
- m_xOffset = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 0, rect.y + 20, width - 5f, 18), new GUIContent("OX:"), m_xOffset);
- if (GUI.changed) UpdateGlobalProperty("m_HorizontalBearingX", m_xOffset);
-
- m_yOffset = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 1, rect.y + 20, width - 5f, 18), new GUIContent("OY:"), m_yOffset);
- if (GUI.changed) UpdateGlobalProperty("m_HorizontalBearingY", m_yOffset);
-
- m_xAdvance = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 2, rect.y + 20, width - 5f, 18), new GUIContent("ADV."), m_xAdvance);
- if (GUI.changed) UpdateGlobalProperty("m_HorizontalAdvance", m_xAdvance);
-
- m_scale = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 3, rect.y + 20, width - 5f, 18), new GUIContent("SF."), m_scale);
- if (GUI.changed) UpdateGlobalProperty("m_Scale", m_scale);
-
- EditorGUILayout.EndVertical();
-
- GUI.changed = old_ChangedState;
- */
- #endregion
-
- }
- #endregion
-
-
- // SPRITE GLYPH TABLE
- #region Display Sprite Glyph Table
- EditorGUI.indentLevel = 0;
- rect = EditorGUILayout.GetControlRect(false, 24);
-
- if (GUI.Button(rect, new GUIContent("<b>Sprite Glyph Table</b>", "A list of the SpriteGlyphs contained in this sprite asset."), TMP_UIStyleManager.sectionHeader))
- UI_PanelState.spriteGlyphTablePanel = !UI_PanelState.spriteGlyphTablePanel;
-
- GUI.Label(rect, (UI_PanelState.spriteGlyphTablePanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
-
- if (UI_PanelState.spriteGlyphTablePanel)
- {
- int arraySize = m_SpriteGlyphTableProperty.arraySize;
- int itemsPerPage = 10;
-
- // Display Glyph Management Tools
- EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandWidth(true));
- {
- // Search Bar implementation
- #region DISPLAY SEARCH BAR
- EditorGUILayout.BeginHorizontal();
- {
- EditorGUIUtility.labelWidth = 110f;
- EditorGUI.BeginChangeCheck();
- string searchPattern = EditorGUILayout.TextField("Sprite Search", m_GlyphSearchPattern, "SearchTextField");
- if (EditorGUI.EndChangeCheck() || m_IsGlyphSearchDirty)
- {
- if (string.IsNullOrEmpty(searchPattern) == false)
- {
- //GUIUtility.keyboardControl = 0;
- m_GlyphSearchPattern = searchPattern.ToLower(System.Globalization.CultureInfo.InvariantCulture).Trim();
-
- // Search Glyph Table for potential matches
- SearchCharacterTable(m_GlyphSearchPattern, ref m_GlyphSearchList);
- }
- else
- m_GlyphSearchPattern = null;
-
- m_IsGlyphSearchDirty = false;
- }
-
- string styleName = string.IsNullOrEmpty(m_GlyphSearchPattern) ? "SearchCancelButtonEmpty" : "SearchCancelButton";
- if (GUILayout.Button(GUIContent.none, styleName))
- {
- GUIUtility.keyboardControl = 0;
- m_GlyphSearchPattern = string.Empty;
- }
- }
- EditorGUILayout.EndHorizontal();
- #endregion
-
- // Display Page Navigation
- if (!string.IsNullOrEmpty(m_GlyphSearchPattern))
- arraySize = m_GlyphSearchList.Count;
-
- // Display Page Navigation
- DisplayPageNavigation(ref m_CurrentGlyphPage, arraySize, itemsPerPage);
- }
- EditorGUILayout.EndVertical();
-
- if (arraySize > 0)
- {
- // Display each SpriteInfo entry using the SpriteInfo property drawer.
- for (int i = itemsPerPage * m_CurrentGlyphPage; i < arraySize && i < itemsPerPage * (m_CurrentGlyphPage + 1); i++)
- {
- // Define the start of the selection region of the element.
- Rect elementStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- int elementIndex = i;
- if (!string.IsNullOrEmpty(m_GlyphSearchPattern))
- elementIndex = m_GlyphSearchList[i];
-
- SerializedProperty spriteGlyphProperty = m_SpriteGlyphTableProperty.GetArrayElementAtIndex(elementIndex);
-
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- {
- EditorGUI.BeginDisabledGroup(i != m_selectedElement);
- {
- EditorGUILayout.PropertyField(spriteGlyphProperty);
- }
- EditorGUI.EndDisabledGroup();
- }
- EditorGUILayout.EndVertical();
-
- // Define the end of the selection region of the element.
- Rect elementEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- // Check for Item selection
- Rect selectionArea = new Rect(elementStartRegion.x, elementStartRegion.y, elementEndRegion.width, elementEndRegion.y - elementStartRegion.y);
- if (DoSelectionCheck(selectionArea))
- {
- if (m_selectedElement == i)
- {
- m_selectedElement = -1;
- }
- else
- {
- m_selectedElement = i;
- GUIUtility.keyboardControl = 0;
- }
- }
-
- // Draw & Handle Section Area
- if (m_selectedElement == i)
- {
- // Draw selection highlight
- TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));
-
- // Draw options to MoveUp, MoveDown, Add or Remove Sprites
- Rect controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * 1f);
- controlRect.width /= 8;
-
- // Move sprite up.
- bool guiEnabled = GUI.enabled;
- if (i == 0) { GUI.enabled = false; }
- if (GUI.Button(controlRect, "Up"))
- {
- SwapGlyphElements(i, i - 1);
- }
- GUI.enabled = guiEnabled;
-
- // Move sprite down.
- controlRect.x += controlRect.width;
- if (i == arraySize - 1) { GUI.enabled = false; }
- if (GUI.Button(controlRect, "Down"))
- {
- SwapGlyphElements(i, i + 1);
- }
- GUI.enabled = guiEnabled;
-
- // Move sprite to new index
- controlRect.x += controlRect.width * 2;
- //if (i == arraySize - 1) { GUI.enabled = false; }
- m_moveToIndex = EditorGUI.IntField(controlRect, m_moveToIndex);
- controlRect.x -= controlRect.width;
- if (GUI.Button(controlRect, "Goto"))
- {
- MoveGlyphToIndex(i, m_moveToIndex);
- }
- //controlRect.x += controlRect.width;
- GUI.enabled = guiEnabled;
-
- // Add new Sprite
- controlRect.x += controlRect.width * 4;
- if (GUI.Button(controlRect, "+"))
- {
- m_SpriteGlyphTableProperty.arraySize += 1;
-
- int index = m_SpriteGlyphTableProperty.arraySize - 1;
-
- SerializedProperty newSpriteGlyphProperty = m_SpriteGlyphTableProperty.GetArrayElementAtIndex(index);
-
- // Copy properties of the selected element
- CopyGlyphSerializedProperty(m_SpriteGlyphTableProperty.GetArrayElementAtIndex(elementIndex), ref newSpriteGlyphProperty);
-
- newSpriteGlyphProperty.FindPropertyRelative("m_Index").intValue = index;
-
- serializedObject.ApplyModifiedProperties();
-
- m_IsGlyphSearchDirty = true;
-
- //m_SpriteAsset.UpdateLookupTables();
- }
-
- // Delete selected Sprite
- controlRect.x += controlRect.width;
- if (m_selectedElement == -1) GUI.enabled = false;
- if (GUI.Button(controlRect, "-"))
- {
- SerializedProperty selectedSpriteGlyphProperty = m_SpriteGlyphTableProperty.GetArrayElementAtIndex(elementIndex);
-
- int selectedGlyphIndex = selectedSpriteGlyphProperty.FindPropertyRelative("m_Index").intValue;
-
- m_SpriteGlyphTableProperty.DeleteArrayElementAtIndex(elementIndex);
-
- // Remove all Sprite Characters referencing this glyph.
- for (int j = 0; j < m_SpriteCharacterTableProperty.arraySize; j++)
- {
- int glyphIndex = m_SpriteCharacterTableProperty.GetArrayElementAtIndex(j).FindPropertyRelative("m_GlyphIndex").intValue;
-
- if (glyphIndex == selectedGlyphIndex)
- {
- // Remove character
- m_SpriteCharacterTableProperty.DeleteArrayElementAtIndex(j);
- }
- }
-
- m_selectedElement = -1;
- serializedObject.ApplyModifiedProperties();
-
- m_IsGlyphSearchDirty = true;
-
- //m_SpriteAsset.UpdateLookupTables();
-
- return;
- }
-
-
- }
- }
- }
-
- DisplayPageNavigation(ref m_CurrentGlyphPage, arraySize, itemsPerPage);
-
- EditorGUIUtility.labelWidth = 40f;
- EditorGUIUtility.fieldWidth = 20f;
-
- GUILayout.Space(5f);
-
- // GLOBAL TOOLS
- #region Global Tools
- GUI.enabled = true;
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- rect = EditorGUILayout.GetControlRect(false, 40);
-
- float width = (rect.width - 75f) / 4;
- EditorGUI.LabelField(rect, "Global Offsets & Scale", EditorStyles.boldLabel);
-
-
- rect.x += 70;
- bool old_ChangedState = GUI.changed;
-
- GUI.changed = false;
- m_xOffset = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 0, rect.y + 20, width - 5f, 18), new GUIContent("OX:"), m_xOffset);
- if (GUI.changed) UpdateGlobalProperty("m_HorizontalBearingX", m_xOffset);
-
- m_yOffset = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 1, rect.y + 20, width - 5f, 18), new GUIContent("OY:"), m_yOffset);
- if (GUI.changed) UpdateGlobalProperty("m_HorizontalBearingY", m_yOffset);
-
- m_xAdvance = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 2, rect.y + 20, width - 5f, 18), new GUIContent("ADV."), m_xAdvance);
- if (GUI.changed) UpdateGlobalProperty("m_HorizontalAdvance", m_xAdvance);
-
- m_scale = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 3, rect.y + 20, width - 5f, 18), new GUIContent("SF."), m_scale);
- if (GUI.changed) UpdateGlobalProperty("m_Scale", m_scale);
-
- EditorGUILayout.EndVertical();
- #endregion
-
- GUI.changed = old_ChangedState;
-
- }
- #endregion
-
-
- if (serializedObject.ApplyModifiedProperties() || evt_cmd == k_UndoRedo || isAssetDirty)
- {
- if (m_SpriteAsset.m_IsSpriteAssetLookupTablesDirty || evt_cmd == k_UndoRedo)
- m_SpriteAsset.UpdateLookupTables();
-
- TMPro_EventManager.ON_SPRITE_ASSET_PROPERTY_CHANGED(true, m_SpriteAsset);
-
- isAssetDirty = false;
- EditorUtility.SetDirty(target);
- }
-
- // Clear selection if mouse event was not consumed.
- GUI.enabled = true;
- if (currentEvent.type == EventType.MouseDown && currentEvent.button == 0)
- m_selectedElement = -1;
-
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="arraySize"></param>
- /// <param name="itemsPerPage"></param>
- void DisplayPageNavigation(ref int currentPage, int arraySize, int itemsPerPage)
- {
- Rect pagePos = EditorGUILayout.GetControlRect(false, 20);
- pagePos.width /= 3;
-
- int shiftMultiplier = Event.current.shift ? 10 : 1; // Page + Shift goes 10 page forward
-
- // Previous Page
- GUI.enabled = currentPage > 0;
-
- if (GUI.Button(pagePos, "Previous Page"))
- {
- currentPage -= 1 * shiftMultiplier;
- //m_isNewPage = true;
- }
-
- // Page Counter
- GUI.enabled = true;
- pagePos.x += pagePos.width;
- int totalPages = (int)(arraySize / (float)itemsPerPage + 0.999f);
- GUI.Label(pagePos, "Page " + (currentPage + 1) + " / " + totalPages, TMP_UIStyleManager.centeredLabel);
-
- // Next Page
- pagePos.x += pagePos.width;
- GUI.enabled = itemsPerPage * (currentPage + 1) < arraySize;
-
- if (GUI.Button(pagePos, "Next Page"))
- {
- currentPage += 1 * shiftMultiplier;
- //m_isNewPage = true;
- }
-
- // Clamp page range
- currentPage = Mathf.Clamp(currentPage, 0, arraySize / itemsPerPage);
-
- GUI.enabled = true;
- }
-
-
- /// <summary>
- /// Method to update the properties of all sprites
- /// </summary>
- /// <param name="property"></param>
- /// <param name="value"></param>
- void UpdateGlobalProperty(string property, float value)
- {
- int arraySize = m_SpriteGlyphTableProperty.arraySize;
-
- for (int i = 0; i < arraySize; i++)
- {
- // Get a reference to the sprite glyph.
- SerializedProperty spriteGlyphProperty = m_SpriteGlyphTableProperty.GetArrayElementAtIndex(i);
-
- if (property == "m_Scale")
- {
- spriteGlyphProperty.FindPropertyRelative(property).floatValue = value;
- }
- else
- {
- SerializedProperty glyphMetricsProperty = spriteGlyphProperty.FindPropertyRelative("m_Metrics");
- glyphMetricsProperty.FindPropertyRelative(property).floatValue = value;
- }
- }
-
- GUI.changed = false;
- }
-
- // Check if any of the Style elements were clicked on.
- private bool DoSelectionCheck(Rect selectionArea)
- {
- Event currentEvent = Event.current;
-
- switch (currentEvent.type)
- {
- case EventType.MouseDown:
- if (selectionArea.Contains(currentEvent.mousePosition) && currentEvent.button == 0)
- {
- currentEvent.Use();
- return true;
- }
- break;
- }
-
- return false;
- }
-
-
- /// <summary>
- /// Swap the sprite item at the currently selected array index to another index.
- /// </summary>
- /// <param name="selectedIndex">Selected index.</param>
- /// <param name="newIndex">New index.</param>
- void SwapCharacterElements(int selectedIndex, int newIndex)
- {
- m_SpriteCharacterTableProperty.MoveArrayElement(selectedIndex, newIndex);
- m_selectedElement = newIndex;
- m_IsCharacterSearchDirty = true;
- m_SpriteAsset.m_IsSpriteAssetLookupTablesDirty = true;
- }
-
- /// <summary>
- /// Move Sprite Element at selected index to another index and reorder sprite list.
- /// </summary>
- /// <param name="selectedIndex"></param>
- /// <param name="newIndex"></param>
- void MoveCharacterToIndex(int selectedIndex, int newIndex)
- {
- int arraySize = m_SpriteCharacterTableProperty.arraySize;
-
- if (newIndex >= arraySize)
- newIndex = arraySize - 1;
-
- m_SpriteCharacterTableProperty.MoveArrayElement(selectedIndex, newIndex);
-
- m_selectedElement = newIndex;
- m_IsCharacterSearchDirty = true;
- m_SpriteAsset.m_IsSpriteAssetLookupTablesDirty = true;
-
- // TODO: Need to handle switching pages if the character or glyph is moved to a different page.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="selectedIndex"></param>
- /// <param name="newIndex"></param>
- void SwapGlyphElements(int selectedIndex, int newIndex)
- {
- m_SpriteGlyphTableProperty.MoveArrayElement(selectedIndex, newIndex);
- m_selectedElement = newIndex;
- m_IsGlyphSearchDirty = true;
- m_SpriteAsset.m_IsSpriteAssetLookupTablesDirty = true;
- }
-
- /// <summary>
- /// Move Sprite Element at selected index to another index and reorder sprite list.
- /// </summary>
- /// <param name="selectedIndex"></param>
- /// <param name="newIndex"></param>
- void MoveGlyphToIndex(int selectedIndex, int newIndex)
- {
- int arraySize = m_SpriteGlyphTableProperty.arraySize;
-
- if (newIndex >= arraySize)
- newIndex = arraySize - 1;
-
- m_SpriteGlyphTableProperty.MoveArrayElement(selectedIndex, newIndex);
-
- m_selectedElement = newIndex;
- m_IsGlyphSearchDirty = true;
- m_SpriteAsset.m_IsSpriteAssetLookupTablesDirty = true;
-
- // TODO: Need to handle switching pages if the character or glyph is moved to a different page.
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="source"></param>
- /// <param name="target"></param>
- void CopyCharacterSerializedProperty(SerializedProperty source, ref SerializedProperty target)
- {
- target.FindPropertyRelative("m_Name").stringValue = source.FindPropertyRelative("m_Name").stringValue;
- target.FindPropertyRelative("m_HashCode").intValue = source.FindPropertyRelative("m_HashCode").intValue;
- target.FindPropertyRelative("m_Unicode").intValue = source.FindPropertyRelative("m_Unicode").intValue;
- target.FindPropertyRelative("m_GlyphIndex").intValue = source.FindPropertyRelative("m_GlyphIndex").intValue;
- target.FindPropertyRelative("m_Scale").floatValue = source.FindPropertyRelative("m_Scale").floatValue;
- }
-
- void CopyGlyphSerializedProperty(SerializedProperty srcGlyph, ref SerializedProperty dstGlyph)
- {
- // TODO : Should make a generic function which copies each of the properties.
-
- // Index
- dstGlyph.FindPropertyRelative("m_Index").intValue = srcGlyph.FindPropertyRelative("m_Index").intValue;
-
- // GlyphMetrics
- SerializedProperty srcGlyphMetrics = srcGlyph.FindPropertyRelative("m_Metrics");
- SerializedProperty dstGlyphMetrics = dstGlyph.FindPropertyRelative("m_Metrics");
-
- dstGlyphMetrics.FindPropertyRelative("m_Width").floatValue = srcGlyphMetrics.FindPropertyRelative("m_Width").floatValue;
- dstGlyphMetrics.FindPropertyRelative("m_Height").floatValue = srcGlyphMetrics.FindPropertyRelative("m_Height").floatValue;
- dstGlyphMetrics.FindPropertyRelative("m_HorizontalBearingX").floatValue = srcGlyphMetrics.FindPropertyRelative("m_HorizontalBearingX").floatValue;
- dstGlyphMetrics.FindPropertyRelative("m_HorizontalBearingY").floatValue = srcGlyphMetrics.FindPropertyRelative("m_HorizontalBearingY").floatValue;
- dstGlyphMetrics.FindPropertyRelative("m_HorizontalAdvance").floatValue = srcGlyphMetrics.FindPropertyRelative("m_HorizontalAdvance").floatValue;
-
- // GlyphRect
- SerializedProperty srcGlyphRect = srcGlyph.FindPropertyRelative("m_GlyphRect");
- SerializedProperty dstGlyphRect = dstGlyph.FindPropertyRelative("m_GlyphRect");
-
- dstGlyphRect.FindPropertyRelative("m_X").intValue = srcGlyphRect.FindPropertyRelative("m_X").intValue;
- dstGlyphRect.FindPropertyRelative("m_Y").intValue = srcGlyphRect.FindPropertyRelative("m_Y").intValue;
- dstGlyphRect.FindPropertyRelative("m_Width").intValue = srcGlyphRect.FindPropertyRelative("m_Width").intValue;
- dstGlyphRect.FindPropertyRelative("m_Height").intValue = srcGlyphRect.FindPropertyRelative("m_Height").intValue;
-
- dstGlyph.FindPropertyRelative("m_Scale").floatValue = srcGlyph.FindPropertyRelative("m_Scale").floatValue;
- dstGlyph.FindPropertyRelative("m_AtlasIndex").intValue = srcGlyph.FindPropertyRelative("m_AtlasIndex").intValue;
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="searchPattern"></param>
- /// <returns></returns>
- void SearchCharacterTable(string searchPattern, ref List<int> searchResults)
- {
- if (searchResults == null) searchResults = new List<int>();
- searchResults.Clear();
-
- int arraySize = m_SpriteCharacterTableProperty.arraySize;
-
- for (int i = 0; i < arraySize; i++)
- {
- SerializedProperty sourceSprite = m_SpriteCharacterTableProperty.GetArrayElementAtIndex(i);
-
- // Check for potential match against array index
- if (i.ToString().Contains(searchPattern))
- {
- searchResults.Add(i);
- continue;
- }
-
- // Check for potential match against decimal id
- int id = sourceSprite.FindPropertyRelative("m_GlyphIndex").intValue;
- if (id.ToString().Contains(searchPattern))
- {
- searchResults.Add(i);
- continue;
- }
-
- // Check for potential match against name
- string name = sourceSprite.FindPropertyRelative("m_Name").stringValue.ToLower(System.Globalization.CultureInfo.InvariantCulture).Trim();
- if (name.Contains(searchPattern))
- {
- searchResults.Add(i);
- continue;
- }
- }
- }
-
- void SearchGlyphTable(string searchPattern, ref List<int> searchResults)
- {
- if (searchResults == null) searchResults = new List<int>();
- searchResults.Clear();
-
- int arraySize = m_SpriteGlyphTableProperty.arraySize;
-
- for (int i = 0; i < arraySize; i++)
- {
- SerializedProperty sourceSprite = m_SpriteGlyphTableProperty.GetArrayElementAtIndex(i);
-
- // Check for potential match against array index
- if (i.ToString().Contains(searchPattern))
- {
- searchResults.Add(i);
- continue;
- }
-
- // Check for potential match against decimal id
- int id = sourceSprite.FindPropertyRelative("m_GlyphIndex").intValue;
- if (id.ToString().Contains(searchPattern))
- {
- searchResults.Add(i);
- continue;
- }
-
- // Check for potential match against name
- string name = sourceSprite.FindPropertyRelative("m_Name").stringValue.ToLower(System.Globalization.CultureInfo.InvariantCulture).Trim();
- if (name.Contains(searchPattern))
- {
- searchResults.Add(i);
- continue;
- }
- }
- }
-
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetEditor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetEditor.cs.meta
deleted file mode 100644
index 20605ad..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetEditor.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: b09be1f217d34247af54863a2f5587e1
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetImporter.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetImporter.cs
deleted file mode 100644
index a4b0739..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetImporter.cs
+++ /dev/null
@@ -1,232 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.IO;
-using System.Collections.Generic;
-using TMPro.EditorUtilities;
-using TMPro.SpriteAssetUtilities;
-
-namespace TMPro
-{
- public class TMP_SpriteAssetImporter : EditorWindow
- {
- // Create Sprite Asset Editor Window
- [MenuItem("Window/TextMeshPro/Sprite Importer", false, 2026)]
- public static void ShowFontAtlasCreatorWindow()
- {
- var window = GetWindow<TMP_SpriteAssetImporter>();
- window.titleContent = new GUIContent("Sprite Importer");
- window.Focus();
- }
-
- Texture2D m_SpriteAtlas;
- SpriteAssetImportFormats m_SpriteDataFormat = SpriteAssetImportFormats.TexturePacker;
- TextAsset m_JsonFile;
-
- string m_CreationFeedback;
-
- TMP_SpriteAsset m_SpriteAsset;
- List<TMP_Sprite> m_SpriteInfoList = new List<TMP_Sprite>();
-
-
- void OnEnable()
- {
- // Set Editor Window Size
- SetEditorWindowSize();
- }
-
- public void OnGUI()
- {
- DrawEditorPanel();
- }
-
-
- void DrawEditorPanel()
- {
- // label
- GUILayout.Label("Import Settings", EditorStyles.boldLabel);
-
- EditorGUI.BeginChangeCheck();
-
- // Sprite Texture Selection
- m_JsonFile = EditorGUILayout.ObjectField("Sprite Data Source", m_JsonFile, typeof(TextAsset), false) as TextAsset;
-
- m_SpriteDataFormat = (SpriteAssetImportFormats)EditorGUILayout.EnumPopup("Import Format", m_SpriteDataFormat);
-
- // Sprite Texture Selection
- m_SpriteAtlas = EditorGUILayout.ObjectField("Sprite Texture Atlas", m_SpriteAtlas, typeof(Texture2D), false) as Texture2D;
-
- if (EditorGUI.EndChangeCheck())
- {
- m_CreationFeedback = string.Empty;
- }
-
- GUILayout.Space(10);
-
- GUI.enabled = m_JsonFile != null && m_SpriteAtlas != null && m_SpriteDataFormat == SpriteAssetImportFormats.TexturePacker;
-
- // Create Sprite Asset
- if (GUILayout.Button("Create Sprite Asset"))
- {
- m_CreationFeedback = string.Empty;
-
- // Read json data file
- if (m_JsonFile != null && m_SpriteDataFormat == SpriteAssetImportFormats.TexturePacker)
- {
- TexturePacker.SpriteDataObject sprites = JsonUtility.FromJson<TexturePacker.SpriteDataObject>(m_JsonFile.text);
-
- if (sprites != null && sprites.frames != null && sprites.frames.Count > 0)
- {
- int spriteCount = sprites.frames.Count;
-
- // Update import results
- m_CreationFeedback = "<b>Import Results</b>\n--------------------\n";
- m_CreationFeedback += "<color=#C0ffff><b>" + spriteCount + "</b></color> Sprites were imported from file.";
-
- // Create sprite info list
- m_SpriteInfoList = CreateSpriteInfoList(sprites);
- }
- }
-
- }
-
- GUI.enabled = true;
-
- // Creation Feedback
- GUILayout.Space(5);
- GUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.Height(60));
- {
- EditorGUILayout.LabelField(m_CreationFeedback, TMP_UIStyleManager.label);
- }
- GUILayout.EndVertical();
-
- GUILayout.Space(5);
- GUI.enabled = m_JsonFile != null && m_SpriteAtlas && m_SpriteInfoList != null && m_SpriteInfoList.Count > 0; // Enable Save Button if font_Atlas is not Null.
- if (GUILayout.Button("Save Sprite Asset") && m_JsonFile != null)
- {
- string filePath = EditorUtility.SaveFilePanel("Save Sprite Asset File", new FileInfo(AssetDatabase.GetAssetPath(m_JsonFile)).DirectoryName, m_JsonFile.name, "asset");
-
- if (filePath.Length == 0)
- return;
-
- SaveSpriteAsset(filePath);
- }
- GUI.enabled = true;
- }
-
-
- /// <summary>
- ///
- /// </summary>
- List<TMP_Sprite> CreateSpriteInfoList(TexturePacker.SpriteDataObject spriteDataObject)
- {
- List<TexturePacker.SpriteData> importedSprites = spriteDataObject.frames;
-
- List<TMP_Sprite> spriteInfoList = new List<TMP_Sprite>();
-
- for (int i = 0; i < importedSprites.Count; i++)
- {
- TMP_Sprite sprite = new TMP_Sprite();
-
- sprite.id = i;
- sprite.name = Path.GetFileNameWithoutExtension(importedSprites[i].filename) ?? "";
- sprite.hashCode = TMP_TextUtilities.GetSimpleHashCode(sprite.name);
-
- // Attempt to extract Unicode value from name
- int unicode;
- int indexOfSeperator = sprite.name.IndexOf('-');
- if (indexOfSeperator != -1)
- unicode = TMP_TextUtilities.StringHexToInt(sprite.name.Substring(indexOfSeperator + 1));
- else
- unicode = TMP_TextUtilities.StringHexToInt(sprite.name);
-
- sprite.unicode = unicode;
-
- sprite.x = importedSprites[i].frame.x;
- sprite.y = m_SpriteAtlas.height - (importedSprites[i].frame.y + importedSprites[i].frame.h);
- sprite.width = importedSprites[i].frame.w;
- sprite.height = importedSprites[i].frame.h;
-
- //Calculate sprite pivot position
- sprite.pivot = importedSprites[i].pivot;
-
- // Properties the can be modified
- sprite.xAdvance = sprite.width;
- sprite.scale = 1.0f;
- sprite.xOffset = 0 - (sprite.width * sprite.pivot.x);
- sprite.yOffset = sprite.height - (sprite.height * sprite.pivot.y);
-
- spriteInfoList.Add(sprite);
- }
-
- return spriteInfoList;
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="filePath"></param>
- void SaveSpriteAsset(string filePath)
- {
- filePath = filePath.Substring(0, filePath.Length - 6); // Trim file extension from filePath.
-
- string dataPath = Application.dataPath;
-
- if (filePath.IndexOf(dataPath, System.StringComparison.InvariantCultureIgnoreCase) == -1)
- {
- Debug.LogError("You're saving the font asset in a directory outside of this project folder. This is not supported. Please select a directory under \"" + dataPath + "\"");
- return;
- }
-
- string relativeAssetPath = filePath.Substring(dataPath.Length - 6);
- string dirName = Path.GetDirectoryName(relativeAssetPath);
- string fileName = Path.GetFileNameWithoutExtension(relativeAssetPath);
- string pathNoExt = dirName + "/" + fileName;
-
-
- // Create new Sprite Asset using this texture
- m_SpriteAsset = CreateInstance<TMP_SpriteAsset>();
- AssetDatabase.CreateAsset(m_SpriteAsset, pathNoExt + ".asset");
-
- // Compute the hash code for the sprite asset.
- m_SpriteAsset.hashCode = TMP_TextUtilities.GetSimpleHashCode(m_SpriteAsset.name);
-
- // Assign new Sprite Sheet texture to the Sprite Asset.
- m_SpriteAsset.spriteSheet = m_SpriteAtlas;
- m_SpriteAsset.spriteInfoList = m_SpriteInfoList;
-
- // Add new default material for sprite asset.
- AddDefaultMaterial(m_SpriteAsset);
- }
-
-
- /// <summary>
- /// Create and add new default material to sprite asset.
- /// </summary>
- /// <param name="spriteAsset"></param>
- static void AddDefaultMaterial(TMP_SpriteAsset spriteAsset)
- {
- Shader shader = Shader.Find("TextMeshPro/Sprite");
- Material material = new Material(shader);
- material.SetTexture(ShaderUtilities.ID_MainTex, spriteAsset.spriteSheet);
-
- spriteAsset.material = material;
- material.hideFlags = HideFlags.HideInHierarchy;
- AssetDatabase.AddObjectToAsset(material, spriteAsset);
- }
-
-
- /// <summary>
- /// Limits the minimum size of the editor window.
- /// </summary>
- void SetEditorWindowSize()
- {
- EditorWindow editorWindow = this;
-
- Vector2 currentWindowSize = editorWindow.minSize;
-
- editorWindow.minSize = new Vector2(Mathf.Max(230, currentWindowSize.x), Mathf.Max(300, currentWindowSize.y));
- }
-
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetImporter.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetImporter.cs.meta
deleted file mode 100644
index 6aa809c..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetImporter.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: f1ea944dcf8849ebab391e461b99ccb7
-timeCreated: 1480023525
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetMenu.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetMenu.cs
deleted file mode 100644
index 34dff5d..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetMenu.cs
+++ /dev/null
@@ -1,329 +0,0 @@
-using UnityEngine;
-using UnityEngine.TextCore;
-using UnityEditor;
-using System.Linq;
-using System.IO;
-using System.Collections;
-using System.Collections.Generic;
-
-
-namespace TMPro.EditorUtilities
-{
-
- public static class TMP_SpriteAssetMenu
- {
- // Add a Context Menu to the Sprite Asset Editor Panel to Create and Add a Default Material.
- [MenuItem("CONTEXT/TMP_SpriteAsset/Add Default Material", false, 2200)]
- static void CopyTexture(MenuCommand command)
- {
- TMP_SpriteAsset spriteAsset = (TMP_SpriteAsset)command.context;
-
- // Make sure the sprite asset already contains a default material
- if (spriteAsset != null && spriteAsset.material == null)
- {
- // Add new default material for sprite asset.
- AddDefaultMaterial(spriteAsset);
- }
- }
-
- // Add a Context Menu to the Sprite Asset Editor Panel to update existing sprite assets.
- [MenuItem("CONTEXT/TMP_SpriteAsset/Update Sprite Asset", false, 2100)]
- static void UpdateSpriteAsset(MenuCommand command)
- {
- TMP_SpriteAsset spriteAsset = (TMP_SpriteAsset)command.context;
-
- if (spriteAsset == null)
- return;
-
- // Get a list of all the sprites contained in the texture referenced by the sprite asset.
- // This only works if the texture is set to sprite mode.
- string filePath = AssetDatabase.GetAssetPath(spriteAsset.spriteSheet);
-
- if (string.IsNullOrEmpty(filePath))
- return;
-
- // Get all the Sprites sorted Left to Right / Top to Bottom
- Sprite[] sprites = AssetDatabase.LoadAllAssetsAtPath(filePath).Select(x => x as Sprite).Where(x => x != null).OrderByDescending(x => x.rect.y).ThenBy(x => x.rect.x).ToArray();
-
- List<TMP_SpriteGlyph> spriteGlyphTable = spriteAsset.spriteGlyphTable;
-
- // Finding available glyph indexes to insert new glyphs into.
- var tempGlyphTable = spriteGlyphTable.OrderBy(glyph => glyph.index).ToList();
- List<uint> availableGlyphIndexes = new List<uint>();
-
- int elementIndex = 0;
- for (uint i = 0; i < tempGlyphTable[tempGlyphTable.Count - 1].index; i++)
- {
- uint currentElementIndex = tempGlyphTable[elementIndex].index;
-
- if (i == currentElementIndex)
- elementIndex += 1;
- else
- availableGlyphIndexes.Add(i);
- }
-
- // Iterate over each of the sprites in the texture to try to match them to existing sprites in the sprite asset.
- for (int i = 0; i < sprites.Length; i++)
- {
- int id = sprites[i].GetInstanceID();
-
- int glyphIndex = spriteGlyphTable.FindIndex(item => item.sprite.GetInstanceID() == id);
-
- if (glyphIndex == -1)
- {
- // Add new Sprite Glyph to the table
- Sprite sprite = sprites[i];
-
- TMP_SpriteGlyph spriteGlyph = new TMP_SpriteGlyph();
-
- // Get available glyph index
- if (availableGlyphIndexes.Count > 0)
- {
- spriteGlyph.index = availableGlyphIndexes[0];
- availableGlyphIndexes.RemoveAt(0);
- }
- else
- spriteGlyph.index = (uint)spriteGlyphTable.Count;
-
- spriteGlyph.metrics = new GlyphMetrics(sprite.rect.width, sprite.rect.height, -sprite.pivot.x, sprite.rect.height - sprite.pivot.y, sprite.rect.width);
- spriteGlyph.glyphRect = new GlyphRect(sprite.rect);
- spriteGlyph.scale = 1.0f;
- spriteGlyph.sprite = sprite;
-
- spriteGlyphTable.Add(spriteGlyph);
-
- TMP_SpriteCharacter spriteCharacter = new TMP_SpriteCharacter(0, spriteGlyph);
- spriteCharacter.name = sprite.name;
- spriteCharacter.scale = 1.0f;
-
- spriteAsset.spriteCharacterTable.Add(spriteCharacter);
- }
- else
- {
- // Look for changes in existing Sprite Glyph
- Sprite sprite = sprites[i];
-
- TMP_SpriteGlyph spriteGlyph = spriteGlyphTable[glyphIndex];
-
- // We only update changes to the sprite position / glyph rect.
- if (spriteGlyph.glyphRect.x != sprite.rect.x || spriteGlyph.glyphRect.y != sprite.rect.y || spriteGlyph.glyphRect.width != sprite.rect.width || spriteGlyph.glyphRect.height != sprite.rect.height)
- spriteGlyph.glyphRect = new GlyphRect(sprite.rect);
- }
- }
-
- // Sort glyph table by glyph index
- spriteAsset.SortGlyphTable();
- spriteAsset.UpdateLookupTables();
- TMPro_EventManager.ON_SPRITE_ASSET_PROPERTY_CHANGED(true, spriteAsset);
- }
-
-
- [MenuItem("Assets/Create/TextMeshPro/Sprite Asset", false, 110)]
- public static void CreateSpriteAsset()
- {
- Object target = Selection.activeObject;
-
- // Make sure the selection is a texture.
- if (target == null || target.GetType() != typeof(Texture2D))
- {
- Debug.LogWarning("A texture which contains sprites must first be selected in order to create a TextMesh Pro Sprite Asset.");
- return;
- }
-
- Texture2D sourceTex = target as Texture2D;
-
- // Get the path to the selected texture.
- string filePathWithName = AssetDatabase.GetAssetPath(sourceTex);
- string fileNameWithExtension = Path.GetFileName(filePathWithName);
- string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePathWithName);
- string filePath = filePathWithName.Replace(fileNameWithExtension, "");
-
- // Check if Sprite Asset already exists
- TMP_SpriteAsset spriteAsset = AssetDatabase.LoadAssetAtPath(filePath + fileNameWithoutExtension + ".asset", typeof(TMP_SpriteAsset)) as TMP_SpriteAsset;
- bool isNewAsset = spriteAsset == null ? true : false;
-
- if (isNewAsset)
- {
- // Create new Sprite Asset using this texture
- spriteAsset = ScriptableObject.CreateInstance<TMP_SpriteAsset>();
- AssetDatabase.CreateAsset(spriteAsset, filePath + fileNameWithoutExtension + ".asset");
-
- spriteAsset.version = "1.1.0";
-
- // Compute the hash code for the sprite asset.
- spriteAsset.hashCode = TMP_TextUtilities.GetSimpleHashCode(spriteAsset.name);
-
- // Assign new Sprite Sheet texture to the Sprite Asset.
- spriteAsset.spriteSheet = sourceTex;
-
- List<TMP_SpriteGlyph> spriteGlyphTable = new List<TMP_SpriteGlyph>();
- List<TMP_SpriteCharacter> spriteCharacterTable = new List<TMP_SpriteCharacter>();
-
- PopulateSpriteTables(sourceTex, ref spriteCharacterTable, ref spriteGlyphTable);
-
- spriteAsset.spriteCharacterTable = spriteCharacterTable;
- spriteAsset.spriteGlyphTable = spriteGlyphTable;
-
- // Add new default material for sprite asset.
- AddDefaultMaterial(spriteAsset);
- }
- //else
- //{
- // spriteAsset.spriteInfoList = UpdateSpriteInfo(spriteAsset);
-
- // // Make sure the sprite asset already contains a default material
- // if (spriteAsset.material == null)
- // {
- // // Add new default material for sprite asset.
- // AddDefaultMaterial(spriteAsset);
- // }
-
- //}
-
- // Update Lookup tables.
- spriteAsset.UpdateLookupTables();
-
- // Get the Sprites contained in the Sprite Sheet
- EditorUtility.SetDirty(spriteAsset);
-
- //spriteAsset.sprites = sprites;
-
- // Set source texture back to Not Readable.
- //texImporter.isReadable = false;
-
-
- AssetDatabase.SaveAssets();
-
- AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(spriteAsset)); // Re-import font asset to get the new updated version.
-
- //AssetDatabase.Refresh();
- }
-
-
- private static void PopulateSpriteTables(Texture source, ref List<TMP_SpriteCharacter> spriteCharacterTable, ref List<TMP_SpriteGlyph> spriteGlyphTable)
- {
- //Debug.Log("Creating new Sprite Asset.");
-
- string filePath = AssetDatabase.GetAssetPath(source);
-
- // Get all the Sprites sorted by Index
- Sprite[] sprites = AssetDatabase.LoadAllAssetsAtPath(filePath).Select(x => x as Sprite).Where(x => x != null).OrderByDescending(x => x.rect.y).ThenBy(x => x.rect.x).ToArray();
-
- for (int i = 0; i < sprites.Length; i++)
- {
- Sprite sprite = sprites[i];
-
- TMP_SpriteGlyph spriteGlyph = new TMP_SpriteGlyph();
- spriteGlyph.index = (uint)i;
- spriteGlyph.metrics = new GlyphMetrics(sprite.rect.width, sprite.rect.height, -sprite.pivot.x, sprite.rect.height - sprite.pivot.y, sprite.rect.width);
- spriteGlyph.glyphRect = new GlyphRect(sprite.rect);
- spriteGlyph.scale = 1.0f;
- spriteGlyph.sprite = sprite;
-
- spriteGlyphTable.Add(spriteGlyph);
-
- TMP_SpriteCharacter spriteCharacter = new TMP_SpriteCharacter(0, spriteGlyph);
- spriteCharacter.name = sprite.name;
- spriteCharacter.scale = 1.0f;
-
- spriteCharacterTable.Add(spriteCharacter);
- }
- }
-
-
- /// <summary>
- /// Create and add new default material to sprite asset.
- /// </summary>
- /// <param name="spriteAsset"></param>
- private static void AddDefaultMaterial(TMP_SpriteAsset spriteAsset)
- {
- Shader shader = Shader.Find("TextMeshPro/Sprite");
- Material material = new Material(shader);
- material.SetTexture(ShaderUtilities.ID_MainTex, spriteAsset.spriteSheet);
-
- spriteAsset.material = material;
- material.hideFlags = HideFlags.HideInHierarchy;
- AssetDatabase.AddObjectToAsset(material, spriteAsset);
- }
-
-
- // Update existing SpriteInfo
- private static List<TMP_Sprite> UpdateSpriteInfo(TMP_SpriteAsset spriteAsset)
- {
- //Debug.Log("Updating Sprite Asset.");
-
- string filePath = AssetDatabase.GetAssetPath(spriteAsset.spriteSheet);
-
- // Get all the Sprites sorted Left to Right / Top to Bottom
- Sprite[] sprites = AssetDatabase.LoadAllAssetsAtPath(filePath).Select(x => x as Sprite).Where(x => x != null).OrderByDescending(x => x.rect.y).ThenBy(x => x.rect.x).ToArray();
-
- for (int i = 0; i < sprites.Length; i++)
- {
- Sprite sprite = sprites[i];
-
- // Check if the sprite is already contained in the SpriteInfoList
- int index = -1;
- if (spriteAsset.spriteInfoList.Count > i && spriteAsset.spriteInfoList[i].sprite != null)
- index = spriteAsset.spriteInfoList.FindIndex(item => item.sprite.GetInstanceID() == sprite.GetInstanceID());
-
- // Use existing SpriteInfo if it already exists
- TMP_Sprite spriteInfo = index == -1 ? new TMP_Sprite() : spriteAsset.spriteInfoList[index];
-
- Rect spriteRect = sprite.rect;
- spriteInfo.x = spriteRect.x;
- spriteInfo.y = spriteRect.y;
- spriteInfo.width = spriteRect.width;
- spriteInfo.height = spriteRect.height;
-
- // Get Sprite Pivot
- Vector2 pivot = new Vector2(0 - (sprite.bounds.min.x) / (sprite.bounds.extents.x * 2), 0 - (sprite.bounds.min.y) / (sprite.bounds.extents.y * 2));
-
- // The position of the pivot influences the Offset position.
- spriteInfo.pivot = new Vector2(0 - pivot.x * spriteRect.width, spriteRect.height - pivot.y * spriteRect.height);
-
- if (index == -1)
- {
- // Find the next available index for this Sprite
- int[] ids = spriteAsset.spriteInfoList.Select(item => item.id).ToArray();
-
- int id = 0;
- for (int j = 0; j < ids.Length; j++ )
- {
- if (ids[0] != 0) break;
-
- if (j > 0 && (ids[j] - ids[j - 1]) > 1)
- {
- id = ids[j - 1] + 1;
- break;
- }
-
- id = j + 1;
- }
-
- spriteInfo.sprite = sprite;
- spriteInfo.name = sprite.name;
- spriteInfo.hashCode = TMP_TextUtilities.GetSimpleHashCode(spriteInfo.name);
- spriteInfo.id = id;
- spriteInfo.xAdvance = spriteRect.width;
- spriteInfo.scale = 1.0f;
-
- spriteInfo.xOffset = spriteInfo.pivot.x;
- spriteInfo.yOffset = spriteInfo.pivot.y;
-
- spriteAsset.spriteInfoList.Add(spriteInfo);
-
- // Sort the Sprites by ID
- spriteAsset.spriteInfoList = spriteAsset.spriteInfoList.OrderBy(s => s.id).ToList();
- }
- else
- {
- spriteAsset.spriteInfoList[index] = spriteInfo;
- }
- }
-
- return spriteAsset.spriteInfoList;
- }
-
-
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetMenu.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetMenu.cs.meta
deleted file mode 100644
index 87ee603..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteAssetMenu.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 1048a87135154606808bf2030da32d18
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteCharacterPropertyDrawer.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteCharacterPropertyDrawer.cs
deleted file mode 100644
index 506b49b..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteCharacterPropertyDrawer.cs
+++ /dev/null
@@ -1,225 +0,0 @@
-using UnityEngine;
-using UnityEngine.TextCore;
-using UnityEditor;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomPropertyDrawer(typeof(TMP_SpriteCharacter))]
- public class TMP_SpriteCharacterPropertyDrawer : PropertyDrawer
- {
- int m_GlyphSelectedForEditing = -1;
-
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- SerializedProperty prop_SpriteName = property.FindPropertyRelative("m_Name");
- SerializedProperty prop_SpriteNameHashCode = property.FindPropertyRelative("m_HashCode");
- SerializedProperty prop_SpriteUnicode = property.FindPropertyRelative("m_Unicode");
- SerializedProperty prop_SpriteGlyphIndex = property.FindPropertyRelative("m_GlyphIndex");
- SerializedProperty prop_SpriteScale = property.FindPropertyRelative("m_Scale");
-
-
- GUIStyle style = new GUIStyle(EditorStyles.label);
- style.richText = true;
-
- EditorGUIUtility.labelWidth = 40f;
- EditorGUIUtility.fieldWidth = 50;
-
- Rect rect = new Rect(position.x + 60, position.y, position.width, 49);
-
- // Display non-editable fields
- if (GUI.enabled == false)
- {
- // Sprite Character Index
- int.TryParse(property.displayName.Split(' ')[1], out int spriteCharacterIndex);
- EditorGUI.LabelField(new Rect(rect.x, rect.y, 75f, 18), new GUIContent("Index: <color=#FFFF80>" + spriteCharacterIndex + "</color>"), style);
-
- EditorGUI.LabelField(new Rect(rect.x + 75f, rect.y, 120f, 18), new GUIContent("Unicode: <color=#FFFF80>0x" + prop_SpriteUnicode.intValue.ToString("X") + "</color>"), style);
- EditorGUI.LabelField(new Rect(rect.x + 195f, rect.y, rect.width - 255, 18), new GUIContent("Name: <color=#FFFF80>" + prop_SpriteName.stringValue + "</color>"), style);
-
- EditorGUI.LabelField(new Rect(rect.x, rect.y + 18, 120, 18), new GUIContent("Glyph ID: <color=#FFFF80>" + prop_SpriteGlyphIndex.intValue + "</color>"), style);
-
- // Draw Sprite Glyph (if exists)
- DrawSpriteGlyph(position, property);
-
- EditorGUI.LabelField(new Rect(rect.x, rect.y + 36, 80, 18), new GUIContent("Scale: <color=#FFFF80>" + prop_SpriteScale.floatValue + "</color>"), style);
- }
- else // Display editable fields
- {
- // Get a reference to the underlying Sprite Asset
- TMP_SpriteAsset spriteAsset = property.serializedObject.targetObject as TMP_SpriteAsset;
-
- // Sprite Character Index
- int.TryParse(property.displayName.Split(' ')[1], out int spriteCharacterIndex);
-
- EditorGUI.LabelField(new Rect(rect.x, rect.y, 75f, 18), new GUIContent("Index: <color=#FFFF80>" + spriteCharacterIndex + "</color>"), style);
-
- EditorGUIUtility.labelWidth = 55f;
- GUI.SetNextControlName("Unicode Input");
- EditorGUI.BeginChangeCheck();
- string unicode = EditorGUI.DelayedTextField(new Rect(rect.x + 75f, rect.y, 120, 18), "Unicode:", prop_SpriteUnicode.intValue.ToString("X"));
-
- if (GUI.GetNameOfFocusedControl() == "Unicode Input")
- {
- //Filter out unwanted characters.
- char chr = Event.current.character;
- if ((chr < '0' || chr > '9') && (chr < 'a' || chr > 'f') && (chr < 'A' || chr > 'F'))
- {
- Event.current.character = '\0';
- }
- }
-
- if (EditorGUI.EndChangeCheck())
- {
- // Update Unicode value
- prop_SpriteUnicode.intValue = TMP_TextUtilities.StringHexToInt(unicode);
- spriteAsset.m_IsSpriteAssetLookupTablesDirty = true;
- }
-
- EditorGUIUtility.labelWidth = 41f;
- EditorGUI.BeginChangeCheck();
- EditorGUI.DelayedTextField(new Rect(rect.x + 195f, rect.y, rect.width - 255, 18), prop_SpriteName, new GUIContent("Name:"));
- if (EditorGUI.EndChangeCheck())
- {
- // Recompute hashCode for new name
- prop_SpriteNameHashCode.intValue = TMP_TextUtilities.GetSimpleHashCode(prop_SpriteName.stringValue);
- spriteAsset.m_IsSpriteAssetLookupTablesDirty = true;
- }
-
- EditorGUIUtility.labelWidth = 59f;
- EditorGUI.BeginChangeCheck();
- EditorGUI.DelayedIntField(new Rect(rect.x, rect.y + 18, 100, 18), prop_SpriteGlyphIndex, new GUIContent("Glyph ID:"));
- if (EditorGUI.EndChangeCheck())
- {
- spriteAsset.m_IsSpriteAssetLookupTablesDirty = true;
- }
-
- // Draw Sprite Glyph (if exists)
- DrawSpriteGlyph(position, property);
-
- int glyphIndex = prop_SpriteGlyphIndex.intValue;
-
- // Reset glyph selection if new character has been selected.
- if (GUI.enabled && m_GlyphSelectedForEditing != glyphIndex)
- m_GlyphSelectedForEditing = -1;
-
- // Display button to edit the glyph data.
- if (GUI.Button(new Rect(rect.x + 120, rect.y + 18, 75, 18), new GUIContent("Edit Glyph")))
- {
- if (m_GlyphSelectedForEditing == -1)
- m_GlyphSelectedForEditing = glyphIndex;
- else
- m_GlyphSelectedForEditing = -1;
-
- // Button clicks should not result in potential change.
- GUI.changed = false;
- }
-
- // Show the glyph property drawer if selected
- if (glyphIndex == m_GlyphSelectedForEditing && GUI.enabled)
- {
- if (spriteAsset != null)
- {
- // Lookup glyph and draw glyph (if available)
- int elementIndex = spriteAsset.spriteGlyphTable.FindIndex(item => item.index == glyphIndex);
-
- if (elementIndex != -1)
- {
- // Get a reference to the Sprite Glyph Table
- SerializedProperty prop_SpriteGlyphTable = property.serializedObject.FindProperty("m_SpriteGlyphTable");
-
- SerializedProperty prop_SpriteGlyph = prop_SpriteGlyphTable.GetArrayElementAtIndex(elementIndex);
- SerializedProperty prop_GlyphMetrics = prop_SpriteGlyph.FindPropertyRelative("m_Metrics");
- SerializedProperty prop_GlyphRect = prop_SpriteGlyph.FindPropertyRelative("m_GlyphRect");
-
- Rect newRect = EditorGUILayout.GetControlRect(false, 115);
- EditorGUI.DrawRect(new Rect(newRect.x + 62, newRect.y - 20, newRect.width - 62, newRect.height - 5), new Color(0.1f, 0.1f, 0.1f, 0.45f));
- EditorGUI.DrawRect(new Rect(newRect.x + 63, newRect.y - 19, newRect.width - 64, newRect.height - 7), new Color(0.3f, 0.3f, 0.3f, 0.8f));
-
- // Display GlyphRect
- newRect.x += 65;
- newRect.y -= 18;
- newRect.width += 5;
- EditorGUI.PropertyField(newRect, prop_GlyphRect);
-
- // Display GlyphMetrics
- newRect.y += 45;
- EditorGUI.PropertyField(newRect, prop_GlyphMetrics);
-
- rect.y += 120;
- }
- }
- }
-
- EditorGUIUtility.labelWidth = 39f;
- EditorGUI.PropertyField(new Rect(rect.x, rect.y + 36, 80, 18), prop_SpriteScale, new GUIContent("Scale:"));
- }
- }
-
-
- public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
- {
- return 58;
- }
-
-
- void DrawSpriteGlyph(Rect position, SerializedProperty property)
- {
- // Get a reference to the sprite glyph table
- TMP_SpriteAsset spriteAsset = property.serializedObject.targetObject as TMP_SpriteAsset;
-
- if (spriteAsset == null)
- return;
-
- int glyphIndex = property.FindPropertyRelative("m_GlyphIndex").intValue;
-
- // Lookup glyph and draw glyph (if available)
- int elementIndex = spriteAsset.spriteGlyphTable.FindIndex(item => item.index == glyphIndex);
-
- if (elementIndex != -1)
- {
- // Get a reference to the Sprite Glyph Table
- SerializedProperty prop_SpriteGlyphTable = property.serializedObject.FindProperty("m_SpriteGlyphTable");
- SerializedProperty prop_SpriteGlyph = prop_SpriteGlyphTable.GetArrayElementAtIndex(elementIndex);
- SerializedProperty prop_GlyphRect = prop_SpriteGlyph.FindPropertyRelative("m_GlyphRect");
-
- // Get a reference to the sprite texture
- Texture tex = 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 [" + spriteAsset.name + "] Sprite Asset.", spriteAsset);
- return;
- }
-
- Vector2 spriteTexPosition = new Vector2(position.x, position.y);
- Vector2 spriteSize = new Vector2(48, 48);
- Vector2 alignmentOffset = new Vector2((58 - spriteSize.x) / 2, (58 - spriteSize.y) / 2);
-
- float x = prop_GlyphRect.FindPropertyRelative("m_X").intValue;
- float y = prop_GlyphRect.FindPropertyRelative("m_Y").intValue;
- float spriteWidth = prop_GlyphRect.FindPropertyRelative("m_Width").intValue;
- float spriteHeight = prop_GlyphRect.FindPropertyRelative("m_Height").intValue;
-
- if (spriteWidth >= spriteHeight)
- {
- spriteSize.y = spriteHeight * spriteSize.x / spriteWidth;
- spriteTexPosition.y += (spriteSize.x - spriteSize.y) / 2;
- }
- else
- {
- spriteSize.x = spriteWidth * spriteSize.y / spriteHeight;
- spriteTexPosition.x += (spriteSize.y - spriteSize.x) / 2;
- }
-
- // Compute the normalized texture coordinates
- Rect texCoords = new Rect(x / tex.width, y / tex.height, spriteWidth / tex.width, spriteHeight / tex.height);
- GUI.DrawTextureWithTexCoords(new Rect(spriteTexPosition.x + alignmentOffset.x, spriteTexPosition.y + alignmentOffset.y, spriteSize.x, spriteSize.y), tex, texCoords, true);
- }
- }
-
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteCharacterPropertyDrawer.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteCharacterPropertyDrawer.cs.meta
deleted file mode 100644
index 636acc8..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteCharacterPropertyDrawer.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 37cff9f5a86ae494c8cb04423580480d
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
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: <color=#FFFF80>" + prop_GlyphIndex.intValue + "</color>"), 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;
- }
-
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteGlyphPropertyDrawer.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteGlyphPropertyDrawer.cs.meta
deleted file mode 100644
index eb0a221..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SpriteGlyphPropertyDrawer.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 056819c66570ca54cadb72330a354050
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs
deleted file mode 100644
index db42bb4..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.IO;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
-
- public static class TMP_StyleAssetMenu
- {
-
- [MenuItem("Assets/Create/TextMeshPro/Style Sheet", false, 120)]
- public static void CreateTextMeshProObjectPerform()
- {
- string filePath;
- if (Selection.assetGUIDs.Length == 0)
- {
- // No asset selected.
- filePath = "Assets";
- }
- else
- {
- // Get the path of the selected folder or asset.
- filePath = AssetDatabase.GUIDToAssetPath(Selection.assetGUIDs[0]);
-
- // Get the file extension of the selected asset as it might need to be removed.
- string fileExtension = Path.GetExtension(filePath);
- if (fileExtension != "")
- {
- filePath = Path.GetDirectoryName(filePath);
- }
- }
-
-
- string filePathWithName = AssetDatabase.GenerateUniqueAssetPath(filePath + "/TMP StyleSheet.asset");
-
- //// Create new Style Sheet Asset.
- TMP_StyleSheet styleSheet = ScriptableObject.CreateInstance<TMP_StyleSheet>();
-
- AssetDatabase.CreateAsset(styleSheet, filePathWithName);
-
- EditorUtility.SetDirty(styleSheet);
-
- AssetDatabase.SaveAssets();
- }
- }
-
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs.meta
deleted file mode 100644
index 94e5b17..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 23a562f2cac6401f9f91251c68a1a794
-timeCreated: 1432690168
-licenseType: Store
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleSheetEditor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleSheetEditor.cs
deleted file mode 100644
index e28df06..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleSheetEditor.cs
+++ /dev/null
@@ -1,278 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomPropertyDrawer(typeof(TMP_Style))]
- public class StyleDrawer : PropertyDrawer
- {
- public static readonly float height = 95f;
-
- public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
- {
- return height;
- }
-
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- SerializedProperty nameProperty = property.FindPropertyRelative("m_Name");
- SerializedProperty hashCodeProperty = property.FindPropertyRelative("m_HashCode");
- SerializedProperty openingDefinitionProperty = property.FindPropertyRelative("m_OpeningDefinition");
- SerializedProperty closingDefinitionProperty = property.FindPropertyRelative("m_ClosingDefinition");
- SerializedProperty openingDefinitionArray = property.FindPropertyRelative("m_OpeningTagArray");
- SerializedProperty closingDefinitionArray = property.FindPropertyRelative("m_ClosingTagArray");
-
-
- EditorGUIUtility.labelWidth = 90;
- position.height = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
- float labelHeight = position.height + 2f;
-
- EditorGUI.BeginChangeCheck();
- Rect rect0 = new Rect(position.x, position.y, (position.width) / 2 + 5, position.height);
- EditorGUI.PropertyField(rect0, nameProperty);
- if (EditorGUI.EndChangeCheck())
- {
- // Recompute HashCode if name has changed.
- hashCodeProperty.intValue = TMP_TextUtilities.GetSimpleHashCode(nameProperty.stringValue);
-
- property.serializedObject.ApplyModifiedProperties();
- // Dictionary needs to be updated since HashCode has changed.
- TMP_StyleSheet.RefreshStyles();
- }
-
- // HashCode
- Rect rect1 = new Rect(rect0.x + rect0.width + 5, position.y, 65, position.height);
- GUI.Label(rect1, "HashCode");
- GUI.enabled = false;
- rect1.x += 65;
- rect1.width = position.width / 2 - 75;
- EditorGUI.PropertyField(rect1, hashCodeProperty, GUIContent.none);
-
- GUI.enabled = true;
-
- // Text Tags
- EditorGUI.BeginChangeCheck();
-
- // Opening Tags
- position.y += labelHeight;
- GUI.Label(position, "Opening Tags");
- Rect textRect1 = new Rect(108, position.y, position.width - 86, 35);
- openingDefinitionProperty.stringValue = EditorGUI.TextArea(textRect1, openingDefinitionProperty.stringValue);
- if (EditorGUI.EndChangeCheck())
- {
- // If any properties have changed, we need to update the Opening and Closing Arrays.
- int size = openingDefinitionProperty.stringValue.Length;
-
- // Adjust array size to match new string length.
- if (openingDefinitionArray.arraySize != size) openingDefinitionArray.arraySize = size;
-
- for (int i = 0; i < size; i++)
- {
- SerializedProperty element = openingDefinitionArray.GetArrayElementAtIndex(i);
- element.intValue = openingDefinitionProperty.stringValue[i];
- }
- }
-
- EditorGUI.BeginChangeCheck();
-
- // Closing Tags
- position.y += 38;
- GUI.Label(position, "Closing Tags");
- Rect textRect2 = new Rect(108, position.y, position.width - 86, 35);
- closingDefinitionProperty.stringValue = EditorGUI.TextArea(textRect2, closingDefinitionProperty.stringValue);
-
- if (EditorGUI.EndChangeCheck())
- {
- // If any properties have changed, we need to update the Opening and Closing Arrays.
- int size = closingDefinitionProperty.stringValue.Length;
-
- // Adjust array size to match new string length.
- if (closingDefinitionArray.arraySize != size) closingDefinitionArray.arraySize = size;
-
- for (int i = 0; i < size; i++)
- {
- SerializedProperty element = closingDefinitionArray.GetArrayElementAtIndex(i);
- element.intValue = closingDefinitionProperty.stringValue[i];
- }
- }
-
- }
- }
-
-
-
- [CustomEditor(typeof(TMP_StyleSheet)), CanEditMultipleObjects]
- public class TMP_StyleEditor : Editor
- {
-
- SerializedProperty m_StyleListProp;
-
- int m_SelectedElement = -1;
-
- //private Event m_CurrentEvent;
- int m_Page;
-
-
-
- void OnEnable()
- {
- m_StyleListProp = serializedObject.FindProperty("m_StyleList");
- }
-
-
- public override void OnInspectorGUI()
- {
- Event currentEvent = Event.current;
-
- serializedObject.Update();
-
- int arraySize = m_StyleListProp.arraySize;
- int itemsPerPage = (Screen.height - 178) / 111;
-
- if (arraySize > 0)
- {
- // Display each Style entry using the StyleDrawer PropertyDrawer.
- for (int i = itemsPerPage * m_Page; i < arraySize && i < itemsPerPage * (m_Page + 1); i++)
- {
-
- // Define the start of the selection region of the element.
- Rect elementStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
-
- SerializedProperty spriteInfo = m_StyleListProp.GetArrayElementAtIndex(i);
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(spriteInfo);
- EditorGUILayout.EndVertical();
- if (EditorGUI.EndChangeCheck())
- {
- //
- }
-
- // Define the end of the selection region of the element.
- Rect elementEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
-
- // Check for Item selection
- Rect selectionArea = new Rect(elementStartRegion.x, elementStartRegion.y, elementEndRegion.width, elementEndRegion.y - elementStartRegion.y);
- if (DoSelectionCheck(selectionArea))
- {
- if (m_SelectedElement == i)
- {
- m_SelectedElement = -1;
- }
- else
- {
- m_SelectedElement = i;
- GUIUtility.keyboardControl = 0;
- }
- }
-
- // Handle Selection Highlighting
- if (m_SelectedElement == i)
- {
- TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));
- }
- }
- }
-
- int shiftMultiplier = currentEvent.shift ? 10 : 1; // Page + Shift goes 10 page forward
-
- GUILayout.Space(-3f);
-
- Rect pagePos = EditorGUILayout.GetControlRect(false, 20);
- pagePos.width /= 6;
-
- // Return if we can't display any items.
- if (itemsPerPage == 0) return;
-
-
- // Add new style.
- pagePos.x += pagePos.width * 4;
- if (GUI.Button(pagePos, "+"))
- {
- m_StyleListProp.arraySize += 1;
- serializedObject.ApplyModifiedProperties();
- TMP_StyleSheet.RefreshStyles();
- }
-
-
- // Delete selected style.
- pagePos.x += pagePos.width;
- if (m_SelectedElement == -1) GUI.enabled = false;
- if (GUI.Button(pagePos, "-"))
- {
- if (m_SelectedElement != -1)
- m_StyleListProp.DeleteArrayElementAtIndex(m_SelectedElement);
-
- m_SelectedElement = -1;
- serializedObject.ApplyModifiedProperties();
- TMP_StyleSheet.RefreshStyles();
- }
-
- GUILayout.Space(5f);
-
- pagePos = EditorGUILayout.GetControlRect(false, 20);
- pagePos.width /= 3;
-
-
- // Previous Page
- if (m_Page > 0) GUI.enabled = true;
- else GUI.enabled = false;
-
- if (GUI.Button(pagePos, "Previous"))
- m_Page -= 1 * shiftMultiplier;
-
- // PAGE COUNTER
- GUI.enabled = true;
- pagePos.x += pagePos.width;
- int totalPages = (int)(arraySize / (float)itemsPerPage + 0.999f);
- GUI.Label(pagePos, "Page " + (m_Page + 1) + " / " + totalPages, TMP_UIStyleManager.centeredLabel);
-
- // Next Page
- pagePos.x += pagePos.width;
- if (itemsPerPage * (m_Page + 1) < arraySize) GUI.enabled = true;
- else GUI.enabled = false;
-
- if (GUI.Button(pagePos, "Next"))
- m_Page += 1 * shiftMultiplier;
-
- // Clamp page range
- m_Page = Mathf.Clamp(m_Page, 0, arraySize / itemsPerPage);
-
-
- if (serializedObject.ApplyModifiedProperties())
- TMPro_EventManager.ON_TEXT_STYLE_PROPERTY_CHANGED(true);
-
- // Clear selection if mouse event was not consumed.
- GUI.enabled = true;
- if (currentEvent.type == EventType.MouseDown && currentEvent.button == 0)
- m_SelectedElement = -1;
-
-
- }
-
-
- // Check if any of the Style elements were clicked on.
- static bool DoSelectionCheck(Rect selectionArea)
- {
- Event currentEvent = Event.current;
-
- switch (currentEvent.type)
- {
- case EventType.MouseDown:
- if (selectionArea.Contains(currentEvent.mousePosition) && currentEvent.button == 0)
- {
- currentEvent.Use();
- return true;
- }
- break;
- }
-
- return false;
- }
-
- }
-
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleSheetEditor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleSheetEditor.cs.meta
deleted file mode 100644
index 0da7754..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleSheetEditor.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 34e2c9b9d9e44953933afe37461f44e6
-timeCreated: 1432683777
-licenseType: Store
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMeshUI_Editor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMeshUI_Editor.cs
deleted file mode 100644
index 74bcccc..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMeshUI_Editor.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-
-namespace TMPro.EditorUtilities
-{
- [CustomEditor(typeof(TMP_SubMeshUI)), CanEditMultipleObjects]
- public class TMP_SubMeshUI_Editor : Editor
- {
- private struct m_foldout
- { // Track Inspector foldout panel states, globally.
- //public static bool textInput = true;
- public static bool fontSettings = true;
- //public static bool extraSettings = false;
- //public static bool shadowSetting = false;
- //public static bool materialEditor = true;
- }
-
- private SerializedProperty fontAsset_prop;
- private SerializedProperty spriteAsset_prop;
-
- private TMP_SubMeshUI m_SubMeshComponent;
-
- private CanvasRenderer m_canvasRenderer;
- private Editor m_materialEditor;
- private Material m_targetMaterial;
-
-
- public void OnEnable()
- {
- fontAsset_prop = serializedObject.FindProperty("m_fontAsset");
- spriteAsset_prop = serializedObject.FindProperty("m_spriteAsset");
-
- m_SubMeshComponent = target as TMP_SubMeshUI;
- //m_rectTransform = m_SubMeshComponent.rectTransform;
- m_canvasRenderer = m_SubMeshComponent.canvasRenderer;
-
-
- // Create new Material Editor if one does not exists
- if (m_canvasRenderer != null && m_canvasRenderer.GetMaterial() != null)
- {
- m_materialEditor = Editor.CreateEditor(m_canvasRenderer.GetMaterial());
- m_targetMaterial = m_canvasRenderer.GetMaterial();
- }
- }
-
-
- public void OnDisable()
- {
- // Destroy material editor if one exists
- if (m_materialEditor != null)
- {
- //Debug.Log("Destroying Inline Material Editor.");
- DestroyImmediate(m_materialEditor);
- }
- }
-
-
-
- public override void OnInspectorGUI()
- {
- GUI.enabled = false;
- EditorGUILayout.PropertyField(fontAsset_prop);
- EditorGUILayout.PropertyField(spriteAsset_prop);
- GUI.enabled = true;
-
- EditorGUILayout.Space();
-
- // If a Custom Material Editor exists, we use it.
- if (m_canvasRenderer != null && m_canvasRenderer.GetMaterial() != null)
- {
- Material mat = m_canvasRenderer.GetMaterial();
-
- //Debug.Log(mat + " " + m_targetMaterial);
-
- if (mat != m_targetMaterial)
- {
- // Destroy previous Material Instance
- //Debug.Log("New Material has been assigned.");
- m_targetMaterial = mat;
- DestroyImmediate(m_materialEditor);
- }
-
-
- if (m_materialEditor == null)
- {
- m_materialEditor = Editor.CreateEditor(mat);
- }
-
- m_materialEditor.DrawHeader();
-
-
- m_materialEditor.OnInspectorGUI();
- }
- }
-
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMeshUI_Editor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMeshUI_Editor.cs.meta
deleted file mode 100644
index 963ea3c..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMeshUI_Editor.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 6b01141ed8f74d198965c86f25eb7040
-timeCreated: 1452757501
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMesh_Editor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMesh_Editor.cs
deleted file mode 100644
index 7597311..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMesh_Editor.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-
-namespace TMPro.EditorUtilities
-{
- [CustomEditor(typeof(TMP_SubMesh)), CanEditMultipleObjects]
- public class TMP_SubMesh_Editor : Editor
- {
- private struct m_foldout
- { // Track Inspector foldout panel states, globally.
- //public static bool textInput = true;
- public static bool fontSettings = true;
- //public static bool extraSettings = false;
- //public static bool shadowSetting = false;
- //public static bool materialEditor = true;
- }
-
- private SerializedProperty fontAsset_prop;
- private SerializedProperty spriteAsset_prop;
-
- private TMP_SubMesh m_SubMeshComponent;
- private Renderer m_Renderer;
-
- public void OnEnable()
- {
- fontAsset_prop = serializedObject.FindProperty("m_fontAsset");
- spriteAsset_prop = serializedObject.FindProperty("m_spriteAsset");
-
- m_SubMeshComponent = target as TMP_SubMesh;
-
- m_Renderer = m_SubMeshComponent.renderer;
- }
-
-
- public override void OnInspectorGUI()
- {
- EditorGUI.indentLevel = 0;
-
- GUI.enabled = false;
- EditorGUILayout.PropertyField(fontAsset_prop);
- EditorGUILayout.PropertyField(spriteAsset_prop);
- GUI.enabled = true;
-
- EditorGUI.BeginChangeCheck();
-
- // SORTING LAYERS
- var sortingLayerNames = SortingLayerHelper.sortingLayerNames;
-
- // Look up the layer name using the current layer ID
- string oldName = SortingLayerHelper.GetSortingLayerNameFromID(m_Renderer.sortingLayerID);
-
- // Use the name to look up our array index into the names list
- int oldLayerIndex = System.Array.IndexOf(sortingLayerNames, oldName);
-
- // Show the pop-up for the names
- int newLayerIndex = EditorGUILayout.Popup("Sorting Layer", oldLayerIndex, sortingLayerNames);
-
- // If the index changes, look up the ID for the new index to store as the new ID
- if (newLayerIndex != oldLayerIndex)
- {
- //Undo.RecordObject(renderer, "Edit Sorting Layer");
- m_Renderer.sortingLayerID = SortingLayerHelper.GetSortingLayerIDForIndex(newLayerIndex);
- //EditorUtility.SetDirty(renderer);
- }
-
- // Expose the manual sorting order
- int newSortingLayerOrder = EditorGUILayout.IntField("Order in Layer", m_Renderer.sortingOrder);
- if (newSortingLayerOrder != m_Renderer.sortingOrder)
- {
- //Undo.RecordObject(renderer, "Edit Sorting Order");
- m_Renderer.sortingOrder = newSortingLayerOrder;
- }
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMesh_Editor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMesh_Editor.cs.meta
deleted file mode 100644
index 6ab0a94..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SubMesh_Editor.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: dd2fe74169b54bf58fca17288513ef38
-timeCreated: 1456189048
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_TextAlignmentDrawer.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_TextAlignmentDrawer.cs
deleted file mode 100644
index cd96573..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_TextAlignmentDrawer.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomPropertyDrawer(typeof(TextAlignmentOptions))]
- public class TMP_TextAlignmentDrawer : PropertyDrawer
- {
- const int k_AlignmentButtonWidth = 24;
- const int k_AlignmentButtonHeight = 20;
- const int k_WideViewWidth = 504;
- const int k_ControlsSpacing = 6;
- const int k_GroupWidth = k_AlignmentButtonWidth * 6;
- static readonly int k_TextAlignmentHash = "DoTextAligmentControl".GetHashCode();
-
- public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
- {
- return EditorGUIUtility.currentViewWidth > k_WideViewWidth ? k_AlignmentButtonHeight : k_AlignmentButtonHeight * 2 + 3;
- }
-
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- var id = GUIUtility.GetControlID(k_TextAlignmentHash, FocusType.Keyboard, position);
-
- EditorGUI.BeginProperty(position, label, property);
- {
- var controlArea = EditorGUI.PrefixLabel(position, id, label);
-
- var horizontalAligment = new Rect(controlArea.x, controlArea.y, k_GroupWidth, k_AlignmentButtonHeight);
- var verticalAligment = new Rect(!(EditorGUIUtility.currentViewWidth > k_WideViewWidth) ? controlArea.x : horizontalAligment.xMax + k_ControlsSpacing, !(EditorGUIUtility.currentViewWidth > k_WideViewWidth) ? controlArea.y + k_AlignmentButtonHeight + 3 : controlArea.y, k_GroupWidth, k_AlignmentButtonHeight);
-
- EditorGUI.BeginChangeCheck();
-
- var selectedHorizontal = DoHorizontalAligmentControl(horizontalAligment, property);
- var selectedVertical = DoVerticalAligmentControl(verticalAligment, property);
-
- if (EditorGUI.EndChangeCheck())
- {
- var value = (0x1 << selectedHorizontal) | (0x100 << selectedVertical);
- property.intValue = value;
- }
- }
- EditorGUI.EndProperty();
- }
-
- static int DoHorizontalAligmentControl(Rect position, SerializedProperty alignment)
- {
- var selected = TMP_EditorUtility.GetHorizontalAlignmentGridValue(alignment.intValue);
-
- var values = new bool[6];
-
- values[selected] = true;
-
- if (alignment.hasMultipleDifferentValues)
- {
- foreach (var obj in alignment.serializedObject.targetObjects)
- {
- var text = obj as TMP_Text;
- if (text != null)
- {
- values[TMP_EditorUtility.GetHorizontalAlignmentGridValue((int)text.alignment)] = true;
- }
- }
- }
-
- position.width = k_AlignmentButtonWidth;
-
- for (var i = 0; i < values.Length; i++)
- {
- var oldValue = values[i];
- var newValue = TMP_EditorUtility.EditorToggle(position, oldValue, TMP_UIStyleManager.alignContentA[i], i == 0 ? TMP_UIStyleManager.alignmentButtonLeft : (i == 5 ? TMP_UIStyleManager.alignmentButtonRight : TMP_UIStyleManager.alignmentButtonMid));
- if (newValue != oldValue)
- {
- selected = i;
- }
- position.x += position.width;
- }
-
- return selected;
- }
-
- static int DoVerticalAligmentControl(Rect position, SerializedProperty alignment)
- {
- var selected = TMP_EditorUtility.GetVerticalAlignmentGridValue(alignment.intValue);
-
- var values = new bool[6];
-
- values[selected] = true;
-
- if (alignment.hasMultipleDifferentValues)
- {
- foreach (var obj in alignment.serializedObject.targetObjects)
- {
- var text = obj as TMP_Text;
- if (text != null)
- {
- values[TMP_EditorUtility.GetVerticalAlignmentGridValue((int)text.alignment)] = true;
- }
- }
- }
-
- position.width = k_AlignmentButtonWidth;
-
- for (var i = 0; i < values.Length; i++)
- {
- var oldValue = values[i];
- var newValue = TMP_EditorUtility.EditorToggle(position, oldValue, TMP_UIStyleManager.alignContentB[i], i == 0 ? TMP_UIStyleManager.alignmentButtonLeft : (i == 5 ? TMP_UIStyleManager.alignmentButtonRight : TMP_UIStyleManager.alignmentButtonMid));
- if (newValue != oldValue)
- {
- selected = i;
- }
- position.x += position.width;
- }
-
- return selected;
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_TextAlignmentDrawer.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_TextAlignmentDrawer.cs.meta
deleted file mode 100644
index eda4bd8..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_TextAlignmentDrawer.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: c55a64c7570474f47a94abe39ebfef04
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UIStyleManager.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UIStyleManager.cs
deleted file mode 100644
index ae8bb44..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UIStyleManager.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
-
- public static class TMP_UIStyleManager
- {
- public static GUIStyle label;
- public static GUIStyle textAreaBoxWindow;
- public static GUIStyle boldFoldout;
- public static GUIStyle panelTitle;
- public static GUIStyle sectionHeader;
- public static GUIStyle centeredLabel;
- public static GUIStyle rightLabel;
- public static GUIStyle wrappingTextArea;
-
- public static GUIStyle alignmentButtonLeft;
- public static GUIStyle alignmentButtonMid;
- public static GUIStyle alignmentButtonRight;
-
- // Alignment Button Textures
- public static Texture2D alignLeft;
- public static Texture2D alignCenter;
- public static Texture2D alignRight;
- public static Texture2D alignJustified;
- public static Texture2D alignFlush;
- public static Texture2D alignGeoCenter;
- public static Texture2D alignTop;
- public static Texture2D alignMiddle;
- public static Texture2D alignBottom;
- public static Texture2D alignBaseline;
- public static Texture2D alignMidline;
- public static Texture2D alignCapline;
- public static Texture2D sectionHeaderTexture;
-
- public static GUIContent[] alignContentA;
- public static GUIContent[] alignContentB;
-
- static TMP_UIStyleManager()
- {
- // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
- var tmproAssetFolderPath = TMP_EditorUtility.packageRelativePath;
-
- if (EditorGUIUtility.isProSkin)
- {
- alignLeft = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignLeft.psd", typeof(Texture2D)) as Texture2D;
- alignCenter = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignCenter.psd", typeof(Texture2D)) as Texture2D;
- alignRight = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignRight.psd", typeof(Texture2D)) as Texture2D;
- alignJustified = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignJustified.psd", typeof(Texture2D)) as Texture2D;
- alignFlush = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignFlush.psd", typeof(Texture2D)) as Texture2D;
- alignGeoCenter = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignCenterGeo.psd", typeof(Texture2D)) as Texture2D;
- alignTop = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignTop.psd", typeof(Texture2D)) as Texture2D;
- alignMiddle = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignMiddle.psd", typeof(Texture2D)) as Texture2D;
- alignBottom = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignBottom.psd", typeof(Texture2D)) as Texture2D;
- alignBaseline = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignBaseLine.psd", typeof(Texture2D)) as Texture2D;
- alignMidline = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignMidLine.psd", typeof(Texture2D)) as Texture2D;
- alignCapline = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignCapLine.psd", typeof(Texture2D)) as Texture2D;
- sectionHeaderTexture = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/SectionHeader_Dark.psd", typeof(Texture2D)) as Texture2D;
- }
- else
- {
- alignLeft = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignLeft_Light.psd", typeof(Texture2D)) as Texture2D;
- alignCenter = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignCenter_Light.psd", typeof(Texture2D)) as Texture2D;
- alignRight = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignRight_Light.psd", typeof(Texture2D)) as Texture2D;
- alignJustified = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignJustified_Light.psd", typeof(Texture2D)) as Texture2D;
- alignFlush = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignFlush_Light.psd", typeof(Texture2D)) as Texture2D;
- alignGeoCenter = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignCenterGeo_Light.psd", typeof(Texture2D)) as Texture2D;
- alignTop = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignTop_Light.psd", typeof(Texture2D)) as Texture2D;
- alignMiddle = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignMiddle_Light.psd", typeof(Texture2D)) as Texture2D;
- alignBottom = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignBottom_Light.psd", typeof(Texture2D)) as Texture2D;
- alignBaseline = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignBaseLine_Light.psd", typeof(Texture2D)) as Texture2D;
- alignMidline = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignMidLine_Light.psd", typeof(Texture2D)) as Texture2D;
- alignCapline = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/btn_AlignCapLine_Light.psd", typeof(Texture2D)) as Texture2D;
- sectionHeaderTexture = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/Editor Resources/Textures/SectionHeader_Light.psd", typeof(Texture2D)) as Texture2D;
- }
-
- label = new GUIStyle(EditorStyles.label) { richText = true, wordWrap = true, stretchWidth = true };
- textAreaBoxWindow = new GUIStyle(EditorStyles.textArea) { richText = true };
- boldFoldout = new GUIStyle(EditorStyles.foldout) { fontStyle = FontStyle.Bold };
- panelTitle = new GUIStyle(EditorStyles.label) { fontStyle = FontStyle.Bold };
-
- sectionHeader = new GUIStyle(EditorStyles.label) { fixedHeight = 22, richText = true, border = new RectOffset(9, 9, 0, 0), overflow = new RectOffset(9, 0, 0, 0), padding = new RectOffset(0, 0, 4, 0) };
- sectionHeader.normal.background = sectionHeaderTexture;
-
- centeredLabel = new GUIStyle(EditorStyles.label) { alignment = TextAnchor.MiddleCenter};
- rightLabel = new GUIStyle(EditorStyles.label) { alignment = TextAnchor.MiddleRight, richText = true };
-
-
- alignmentButtonLeft = new GUIStyle(EditorStyles.miniButtonLeft);
- alignmentButtonLeft.padding.left = 4;
- alignmentButtonLeft.padding.right = 4;
- alignmentButtonLeft.padding.top = 2;
- alignmentButtonLeft.padding.bottom = 2;
-
- alignmentButtonMid = new GUIStyle(EditorStyles.miniButtonMid);
- alignmentButtonMid.padding.left = 4;
- alignmentButtonMid.padding.right = 4;
- alignmentButtonLeft.padding.top = 2;
- alignmentButtonLeft.padding.bottom = 2;
-
- alignmentButtonRight = new GUIStyle(EditorStyles.miniButtonRight);
- alignmentButtonRight.padding.left = 4;
- alignmentButtonRight.padding.right = 4;
- alignmentButtonLeft.padding.top = 2;
- alignmentButtonLeft.padding.bottom = 2;
-
- wrappingTextArea = new GUIStyle(EditorStyles.textArea);
- wrappingTextArea.wordWrap = true;
-
- alignContentA = new []
- {
- new GUIContent(alignLeft, "Left"),
- new GUIContent(alignCenter, "Center"),
- new GUIContent(alignRight, "Right"),
- new GUIContent(alignJustified, "Justified"),
- new GUIContent(alignFlush, "Flush"),
- new GUIContent(alignGeoCenter, "Geometry Center")
- };
-
- alignContentB = new []
- {
- new GUIContent(alignTop, "Top"),
- new GUIContent(alignMiddle, "Middle"),
- new GUIContent(alignBottom, "Bottom"),
- new GUIContent(alignBaseline, "Baseline"),
- new GUIContent(alignMidline, "Midline"),
- new GUIContent(alignCapline, "Capline")
- };
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UIStyleManager.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UIStyleManager.cs.meta
deleted file mode 100644
index f2178f4..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UIStyleManager.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 30a939dce2fd4073955f2f20e659d506
-timeCreated: 1426454127
-licenseType: Store
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UiEditorPanel.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UiEditorPanel.cs
deleted file mode 100644
index d44999e..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UiEditorPanel.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using UnityEngine;
-using UnityEngine.UI;
-using UnityEditor;
-
-namespace TMPro.EditorUtilities
-{
-
- [CustomEditor(typeof(TextMeshProUGUI), true), CanEditMultipleObjects]
- public class TMP_UiEditorPanel : TMP_BaseEditorPanel
- {
- static readonly GUIContent k_RaycastTargetLabel = new GUIContent("Raycast Target", "Whether the text blocks raycasts from the Graphic Raycaster.");
-
- SerializedProperty m_RaycastTargetProp;
-
- protected override void OnEnable()
- {
- base.OnEnable();
- m_RaycastTargetProp = serializedObject.FindProperty("m_RaycastTarget");
- }
-
- protected override void DrawExtraSettings()
- {
- Foldout.extraSettings = EditorGUILayout.Foldout(Foldout.extraSettings, k_ExtraSettingsLabel, true, TMP_UIStyleManager.boldFoldout);
- if (Foldout.extraSettings)
- {
- EditorGUI.indentLevel += 1;
-
- DrawMargins();
-
- DrawGeometrySorting();
-
- DrawRichText();
-
- DrawRaycastTarget();
-
- DrawParsing();
-
- DrawKerning();
-
- DrawPadding();
-
- EditorGUI.indentLevel -= 1;
- }
- }
-
- protected void DrawRaycastTarget()
- {
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(m_RaycastTargetProp, k_RaycastTargetLabel);
- if (EditorGUI.EndChangeCheck())
- {
- // Change needs to propagate to the child sub objects.
- Graphic[] graphicComponents = m_TextComponent.GetComponentsInChildren<Graphic>();
- for (int i = 1; i < graphicComponents.Length; i++)
- graphicComponents[i].raycastTarget = m_RaycastTargetProp.boolValue;
-
- m_HavePropertiesChanged = true;
- }
- }
-
- // Method to handle multi object selection
- protected override bool IsMixSelectionTypes()
- {
- GameObject[] objects = Selection.gameObjects;
- if (objects.Length > 1)
- {
- for (int i = 0; i < objects.Length; i++)
- {
- if (objects[i].GetComponent<TextMeshProUGUI>() == null)
- return true;
- }
- }
- return false;
- }
- protected override void OnUndoRedo()
- {
- int undoEventId = Undo.GetCurrentGroup();
- int lastUndoEventId = s_EventId;
-
- if (undoEventId != lastUndoEventId)
- {
- for (int i = 0; i < targets.Length; i++)
- {
- //Debug.Log("Undo & Redo Performed detected in Editor Panel. Event ID:" + Undo.GetCurrentGroup());
- TMPro_EventManager.ON_TEXTMESHPRO_UGUI_PROPERTY_CHANGED(true, targets[i] as TextMeshProUGUI);
- s_EventId = undoEventId;
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UiEditorPanel.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UiEditorPanel.cs.meta
deleted file mode 100644
index fa7958a..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_UiEditorPanel.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 21c0044a7f964773be90d197a78e4703
-timeCreated: 1443571501
-licenseType: Pro
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_ContextMenus.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_ContextMenus.cs
deleted file mode 100644
index b1e9533..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_ContextMenus.cs
+++ /dev/null
@@ -1,341 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.IO;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
-
- public class TMP_ContextMenus : Editor
- {
-
- private static Texture m_copiedTexture;
-
- private static Material m_copiedProperties;
- private static Material m_copiedAtlasProperties;
-
-
- // Add a Context Menu to the Texture Editor Panel to allow Copy / Paste of Texture.
- [MenuItem("CONTEXT/Texture/Copy", false, 2000)]
- static void CopyTexture(MenuCommand command)
- {
- m_copiedTexture = command.context as Texture;
- }
-
-
- // Select the currently assigned material or material preset.
- [MenuItem("CONTEXT/Material/Select Material", false, 500)]
- static void SelectMaterial(MenuCommand command)
- {
- Material mat = command.context as Material;
-
- // Select current material
- EditorUtility.FocusProjectWindow();
- EditorGUIUtility.PingObject(mat);
- }
-
-
- // Add a Context Menu to allow easy duplication of the Material.
- [MenuItem("CONTEXT/Material/Create Material Preset", false)]
- static void DuplicateMaterial(MenuCommand command)
- {
- // Get the type of text object
- // If material is not a base material, we get material leaks...
-
- Material source_Mat = (Material)command.context;
- if (!EditorUtility.IsPersistent(source_Mat))
- {
- Debug.LogWarning("Material is an instance and cannot be converted into a permanent asset.");
- return;
- }
-
-
- string assetPath = AssetDatabase.GetAssetPath(source_Mat).Split('.')[0];
-
- Material duplicate = new Material(source_Mat);
-
- // Need to manually copy the shader keywords
- duplicate.shaderKeywords = source_Mat.shaderKeywords;
-
- AssetDatabase.CreateAsset(duplicate, AssetDatabase.GenerateUniqueAssetPath(assetPath + ".mat"));
-
- // Assign duplicate Material to selected object (if one is)
- if (Selection.activeGameObject != null)
- {
- TMP_Text textObject = Selection.activeGameObject.GetComponent<TMP_Text>();
- if (textObject != null)
- {
- textObject.fontSharedMaterial = duplicate;
- }
- else
- {
- TMP_SubMesh subMeshObject = Selection.activeGameObject.GetComponent<TMP_SubMesh>();
-
- if (subMeshObject != null)
- subMeshObject.sharedMaterial = duplicate;
- else
- {
- TMP_SubMeshUI subMeshUIObject = Selection.activeGameObject.GetComponent<TMP_SubMeshUI>();
-
- if (subMeshUIObject != null)
- subMeshUIObject.sharedMaterial = duplicate;
- }
- }
- }
-
- // Ping newly created Material Preset.
- EditorUtility.FocusProjectWindow();
- EditorGUIUtility.PingObject(duplicate);
- }
-
-
- //[MenuItem("CONTEXT/MaterialComponent/Copy Material Properties", false)]
- [MenuItem("CONTEXT/Material/Copy Material Properties", false)]
- static void CopyMaterialProperties(MenuCommand command)
- {
- Material mat = null;
- if (command.context.GetType() == typeof(Material))
- mat = (Material)command.context;
- else
- {
- mat = Selection.activeGameObject.GetComponent<CanvasRenderer>().GetMaterial();
- }
-
- m_copiedProperties = new Material(mat);
-
- m_copiedProperties.shaderKeywords = mat.shaderKeywords;
-
- m_copiedProperties.hideFlags = HideFlags.DontSave;
- }
-
-
- // PASTE MATERIAL
- //[MenuItem("CONTEXT/MaterialComponent/Paste Material Properties", false)]
- [MenuItem("CONTEXT/Material/Paste Material Properties", false)]
- static void PasteMaterialProperties(MenuCommand command)
- {
-
- if (m_copiedProperties == null)
- {
- Debug.LogWarning("No Material Properties to Paste. Use Copy Material Properties first.");
- return;
- }
-
- Material mat = null;
- if (command.context.GetType() == typeof(Material))
- mat = (Material)command.context;
- else
- {
- mat = Selection.activeGameObject.GetComponent<CanvasRenderer>().GetMaterial();
- }
-
- Undo.RecordObject(mat, "Paste Material");
-
- ShaderUtilities.GetShaderPropertyIDs(); // Make sure we have valid Property IDs
- if (mat.HasProperty(ShaderUtilities.ID_GradientScale))
- {
- // Preserve unique SDF properties from destination material.
- m_copiedProperties.SetTexture(ShaderUtilities.ID_MainTex, mat.GetTexture(ShaderUtilities.ID_MainTex));
- m_copiedProperties.SetFloat(ShaderUtilities.ID_GradientScale, mat.GetFloat(ShaderUtilities.ID_GradientScale));
- m_copiedProperties.SetFloat(ShaderUtilities.ID_TextureWidth, mat.GetFloat(ShaderUtilities.ID_TextureWidth));
- m_copiedProperties.SetFloat(ShaderUtilities.ID_TextureHeight, mat.GetFloat(ShaderUtilities.ID_TextureHeight));
- }
-
- EditorShaderUtilities.CopyMaterialProperties(m_copiedProperties, mat);
-
- // Copy ShaderKeywords from one material to the other.
- mat.shaderKeywords = m_copiedProperties.shaderKeywords;
-
- // Let TextMeshPro Objects that this mat has changed.
- TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, mat);
- }
-
-
- // Enable Resetting of Material properties without losing unique properties of the font atlas.
- [MenuItem("CONTEXT/Material/Reset", false, 2100)]
- static void ResetSettings(MenuCommand command)
- {
-
- Material mat = null;
- if (command.context.GetType() == typeof(Material))
- mat = (Material)command.context;
- else
- {
- mat = Selection.activeGameObject.GetComponent<CanvasRenderer>().GetMaterial();
- }
-
- Undo.RecordObject(mat, "Reset Material");
-
- ShaderUtilities.GetShaderPropertyIDs(); // Make sure we have valid Property IDs
- if (mat.HasProperty(ShaderUtilities.ID_GradientScale))
- {
- // Copy unique properties of the SDF Material
- var texture = mat.GetTexture(ShaderUtilities.ID_MainTex);
- var gradientScale = mat.GetFloat(ShaderUtilities.ID_GradientScale);
- var texWidth = mat.GetFloat(ShaderUtilities.ID_TextureWidth);
- var texHeight = mat.GetFloat(ShaderUtilities.ID_TextureHeight);
-
- var stencilId = 0.0f;
- var stencilComp = 0.0f;
-
- if (mat.HasProperty(ShaderUtilities.ID_StencilID))
- {
- stencilId = mat.GetFloat(ShaderUtilities.ID_StencilID);
- stencilComp = mat.GetFloat(ShaderUtilities.ID_StencilComp);
- }
-
- var normalWeight = mat.GetFloat(ShaderUtilities.ID_WeightNormal);
- var boldWeight = mat.GetFloat(ShaderUtilities.ID_WeightBold);
-
- // Reset the material
- Unsupported.SmartReset(mat);
-
- // Reset ShaderKeywords
- mat.shaderKeywords = new string[0]; // { "BEVEL_OFF", "GLOW_OFF", "UNDERLAY_OFF" };
-
- // Copy unique material properties back to the material.
- mat.SetTexture(ShaderUtilities.ID_MainTex, texture);
- mat.SetFloat(ShaderUtilities.ID_GradientScale, gradientScale);
- mat.SetFloat(ShaderUtilities.ID_TextureWidth, texWidth);
- mat.SetFloat(ShaderUtilities.ID_TextureHeight, texHeight);
-
- if (mat.HasProperty(ShaderUtilities.ID_StencilID))
- {
- mat.SetFloat(ShaderUtilities.ID_StencilID, stencilId);
- mat.SetFloat(ShaderUtilities.ID_StencilComp, stencilComp);
- }
-
- mat.SetFloat(ShaderUtilities.ID_WeightNormal, normalWeight);
- mat.SetFloat(ShaderUtilities.ID_WeightBold, boldWeight);
- }
- else
- {
- Unsupported.SmartReset(mat);
- }
-
- TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, mat);
- }
-
-
-
- //This function is used for debugging and fixing potentially broken font atlas links.
- [MenuItem("CONTEXT/Material/Copy Atlas", false, 2000)]
- static void CopyAtlas(MenuCommand command)
- {
- Material mat = command.context as Material;
-
- m_copiedAtlasProperties = new Material(mat);
- m_copiedAtlasProperties.hideFlags = HideFlags.DontSave;
- }
-
-
- // This function is used for debugging and fixing potentially broken font atlas links
- [MenuItem("CONTEXT/Material/Paste Atlas", false, 2001)]
- static void PasteAtlas(MenuCommand command)
- {
- Material mat = command.context as Material;
-
- if (m_copiedAtlasProperties != null)
- {
- Undo.RecordObject(mat, "Paste Texture");
-
- ShaderUtilities.GetShaderPropertyIDs(); // Make sure we have valid Property IDs
- mat.SetTexture(ShaderUtilities.ID_MainTex, m_copiedAtlasProperties.GetTexture(ShaderUtilities.ID_MainTex));
- mat.SetFloat(ShaderUtilities.ID_GradientScale, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_GradientScale));
- mat.SetFloat(ShaderUtilities.ID_TextureWidth, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_TextureWidth));
- mat.SetFloat(ShaderUtilities.ID_TextureHeight, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_TextureHeight));
- }
- else if (m_copiedTexture != null)
- {
- Undo.RecordObject(mat, "Paste Texture");
-
- mat.SetTexture(ShaderUtilities.ID_MainTex, m_copiedTexture);
- }
-
- //DestroyImmediate(m_copiedAtlasProperties);
- }
-
-
- // Context Menus for TMPro Font Assets
- //This function is used for debugging and fixing potentially broken font atlas links.
- [MenuItem("CONTEXT/TMP_FontAsset/Extract Atlas", false, 2100)]
- static void ExtractAtlas(MenuCommand command)
- {
- TMP_FontAsset font = command.context as TMP_FontAsset;
-
- string fontPath = AssetDatabase.GetAssetPath(font);
- string texPath = Path.GetDirectoryName(fontPath) + "/" + Path.GetFileNameWithoutExtension(fontPath) + " Atlas.png";
-
- // Create a Serialized Object of the texture to allow us to make it readable.
- SerializedObject texprop = new SerializedObject(font.material.GetTexture(ShaderUtilities.ID_MainTex));
- texprop.FindProperty("m_IsReadable").boolValue = true;
- texprop.ApplyModifiedProperties();
-
- // Create a copy of the texture.
- Texture2D tex = Instantiate(font.material.GetTexture(ShaderUtilities.ID_MainTex)) as Texture2D;
-
- // Set the texture to not readable again.
- texprop.FindProperty("m_IsReadable").boolValue = false;
- texprop.ApplyModifiedProperties();
-
- Debug.Log(texPath);
- // Saving File for Debug
- var pngData = tex.EncodeToPNG();
- File.WriteAllBytes(texPath, pngData);
-
- AssetDatabase.Refresh();
- DestroyImmediate(tex);
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="command"></param>
- [MenuItem("CONTEXT/TMP_FontAsset/Update Atlas Texture...", false, 2000)]
- static void RegenerateFontAsset(MenuCommand command)
- {
- TMP_FontAsset fontAsset = command.context as TMP_FontAsset;
-
- if (fontAsset != null)
- {
- TMPro_FontAssetCreatorWindow.ShowFontAtlasCreatorWindow(fontAsset);
- }
- }
-
-
- /// <summary>
- /// Clear Font Asset Data
- /// </summary>
- /// <param name="command"></param>
- [MenuItem("CONTEXT/TMP_FontAsset/Reset", false, 100)]
- static void ClearFontAssetData(MenuCommand command)
- {
- TMP_FontAsset fontAsset = command.context as TMP_FontAsset;
-
- if (fontAsset != null && Selection.activeObject != fontAsset)
- {
- Selection.activeObject = fontAsset;
- }
-
- fontAsset.ClearFontAssetData(true);
-
- TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, fontAsset);
- }
-
-
- [MenuItem("CONTEXT/TrueTypeFontImporter/Create TMP Font Asset...", false, 200)]
- static void CreateFontAsset(MenuCommand command)
- {
- TrueTypeFontImporter importer = command.context as TrueTypeFontImporter;
-
- if (importer != null)
- {
- Font sourceFontFile = AssetDatabase.LoadAssetAtPath<Font>(importer.assetPath);
-
- if (sourceFontFile)
- TMPro_FontAssetCreatorWindow.ShowFontAtlasCreatorWindow(sourceFontFile);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_ContextMenus.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_ContextMenus.cs.meta
deleted file mode 100644
index 594965a..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_ContextMenus.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 44e1d646473a40178712cb2150f54cec
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_CreateObjectMenu.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_CreateObjectMenu.cs
deleted file mode 100644
index 19810ab..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_CreateObjectMenu.cs
+++ /dev/null
@@ -1,311 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using UnityEditor.SceneManagement;
-using UnityEditor.Experimental.SceneManagement;
-using UnityEngine.SceneManagement;
-using UnityEngine.UI;
-using UnityEngine.EventSystems;
-
-
-namespace TMPro.EditorUtilities
-{
- public static class TMPro_CreateObjectMenu
- {
-
- /// <summary>
- /// Create a TextMeshPro object that works with the Mesh Renderer
- /// </summary>
- /// <param name="command"></param>
- [MenuItem("GameObject/3D Object/Text - TextMeshPro", false, 30)]
- static void CreateTextMeshProObjectPerform(MenuCommand command)
- {
- GameObject go = new GameObject("Text (TMP)");
-
- // Add support for new prefab mode
- StageUtility.PlaceGameObjectInCurrentStage(go);
-
- TextMeshPro textMeshPro = go.AddComponent<TextMeshPro>();
- textMeshPro.text = "Sample text";
- textMeshPro.alignment = TextAlignmentOptions.TopLeft;
-
- Undo.RegisterCreatedObjectUndo((Object)go, "Create " + go.name);
-
- GameObject contextObject = command.context as GameObject;
- if (contextObject != null)
- {
- GameObjectUtility.SetParentAndAlign(go, contextObject);
- Undo.SetTransformParent(go.transform, contextObject.transform, "Parent " + go.name);
- }
-
- Selection.activeGameObject = go;
- }
-
-
- /// <summary>
- /// Create a TextMeshPro object that works with the CanvasRenderer
- /// </summary>
- /// <param name="command"></param>
- [MenuItem("GameObject/UI/Text - TextMeshPro", false, 2001)]
- static void CreateTextMeshProGuiObjectPerform(MenuCommand menuCommand)
- {
- GameObject go = TMP_DefaultControls.CreateText(GetStandardResources());
-
- // Override text color and font size
- TMP_Text textComponent = go.GetComponent<TMP_Text>();
- textComponent.color = Color.white;
- if (textComponent.m_isWaitingOnResourceLoad == false)
- textComponent.fontSize = TMP_Settings.defaultFontSize;
-
- PlaceUIElementRoot(go, menuCommand);
- }
-
- [MenuItem("GameObject/UI/Button - TextMeshPro", false, 2031)]
- static public void AddButton(MenuCommand menuCommand)
- {
- GameObject go = TMP_DefaultControls.CreateButton(GetStandardResources());
-
- // Override font size
- TMP_Text textComponent = go.GetComponentInChildren<TMP_Text>();
- textComponent.fontSize = 24;
-
- PlaceUIElementRoot(go, menuCommand);
- }
-
-
-
- [MenuItem("GameObject/UI/Input Field - TextMeshPro", false, 2037)]
- static void AddTextMeshProInputField(MenuCommand menuCommand)
- {
- GameObject go = TMP_DefaultControls.CreateInputField(GetStandardResources());
- PlaceUIElementRoot(go, menuCommand);
- }
-
-
- [MenuItem("GameObject/UI/Dropdown - TextMeshPro", false, 2036)]
- static public void AddDropdown(MenuCommand menuCommand)
- {
- GameObject go = TMP_DefaultControls.CreateDropdown(GetStandardResources());
- PlaceUIElementRoot(go, menuCommand);
- }
-
-
- private const string kUILayerName = "UI";
-
- private const string kStandardSpritePath = "UI/Skin/UISprite.psd";
- private const string kBackgroundSpritePath = "UI/Skin/Background.psd";
- private const string kInputFieldBackgroundPath = "UI/Skin/InputFieldBackground.psd";
- private const string kKnobPath = "UI/Skin/Knob.psd";
- private const string kCheckmarkPath = "UI/Skin/Checkmark.psd";
- private const string kDropdownArrowPath = "UI/Skin/DropdownArrow.psd";
- private const string kMaskPath = "UI/Skin/UIMask.psd";
-
- static private TMP_DefaultControls.Resources s_StandardResources;
-
-
- static private TMP_DefaultControls.Resources GetStandardResources()
- {
- if (s_StandardResources.standard == null)
- {
- s_StandardResources.standard = AssetDatabase.GetBuiltinExtraResource<Sprite>(kStandardSpritePath);
- s_StandardResources.background = AssetDatabase.GetBuiltinExtraResource<Sprite>(kBackgroundSpritePath);
- s_StandardResources.inputField = AssetDatabase.GetBuiltinExtraResource<Sprite>(kInputFieldBackgroundPath);
- s_StandardResources.knob = AssetDatabase.GetBuiltinExtraResource<Sprite>(kKnobPath);
- s_StandardResources.checkmark = AssetDatabase.GetBuiltinExtraResource<Sprite>(kCheckmarkPath);
- s_StandardResources.dropdown = AssetDatabase.GetBuiltinExtraResource<Sprite>(kDropdownArrowPath);
- s_StandardResources.mask = AssetDatabase.GetBuiltinExtraResource<Sprite>(kMaskPath);
- }
- return s_StandardResources;
- }
-
-
- private static void SetPositionVisibleinSceneView(RectTransform canvasRTransform, RectTransform itemTransform)
- {
- // Find the best scene view
- SceneView sceneView = SceneView.lastActiveSceneView;
- if (sceneView == null && SceneView.sceneViews.Count > 0)
- sceneView = SceneView.sceneViews[0] as SceneView;
-
- // Couldn't find a SceneView. Don't set position.
- if (sceneView == null || sceneView.camera == null)
- return;
-
- // Create world space Plane from canvas position.
- Camera camera = sceneView.camera;
- Vector3 position = Vector3.zero;
- if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRTransform, new Vector2(camera.pixelWidth / 2, camera.pixelHeight / 2), camera, out Vector2 localPlanePosition))
- {
- // Adjust for canvas pivot
- localPlanePosition.x = localPlanePosition.x + canvasRTransform.sizeDelta.x * canvasRTransform.pivot.x;
- localPlanePosition.y = localPlanePosition.y + canvasRTransform.sizeDelta.y * canvasRTransform.pivot.y;
-
- localPlanePosition.x = Mathf.Clamp(localPlanePosition.x, 0, canvasRTransform.sizeDelta.x);
- localPlanePosition.y = Mathf.Clamp(localPlanePosition.y, 0, canvasRTransform.sizeDelta.y);
-
- // Adjust for anchoring
- position.x = localPlanePosition.x - canvasRTransform.sizeDelta.x * itemTransform.anchorMin.x;
- position.y = localPlanePosition.y - canvasRTransform.sizeDelta.y * itemTransform.anchorMin.y;
-
- Vector3 minLocalPosition;
- minLocalPosition.x = canvasRTransform.sizeDelta.x * (0 - canvasRTransform.pivot.x) + itemTransform.sizeDelta.x * itemTransform.pivot.x;
- minLocalPosition.y = canvasRTransform.sizeDelta.y * (0 - canvasRTransform.pivot.y) + itemTransform.sizeDelta.y * itemTransform.pivot.y;
-
- Vector3 maxLocalPosition;
- maxLocalPosition.x = canvasRTransform.sizeDelta.x * (1 - canvasRTransform.pivot.x) - itemTransform.sizeDelta.x * itemTransform.pivot.x;
- maxLocalPosition.y = canvasRTransform.sizeDelta.y * (1 - canvasRTransform.pivot.y) - itemTransform.sizeDelta.y * itemTransform.pivot.y;
-
- position.x = Mathf.Clamp(position.x, minLocalPosition.x, maxLocalPosition.x);
- position.y = Mathf.Clamp(position.y, minLocalPosition.y, maxLocalPosition.y);
- }
-
- itemTransform.anchoredPosition = position;
- itemTransform.localRotation = Quaternion.identity;
- itemTransform.localScale = Vector3.one;
- }
-
-
- private static void PlaceUIElementRoot(GameObject element, MenuCommand menuCommand)
- {
- GameObject parent = menuCommand.context as GameObject;
- bool explicitParentChoice = true;
- if (parent == null)
- {
- parent = GetOrCreateCanvasGameObject();
- explicitParentChoice = false;
-
- // If in Prefab Mode, Canvas has to be part of Prefab contents,
- // otherwise use Prefab root instead.
- PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
- if (prefabStage != null && !prefabStage.IsPartOfPrefabContents(parent))
- parent = prefabStage.prefabContentsRoot;
- }
- if (parent.GetComponentInParent<Canvas>() == null)
- {
- // Create canvas under context GameObject,
- // and make that be the parent which UI element is added under.
- GameObject canvas = CreateNewUI();
- canvas.transform.SetParent(parent.transform, false);
- parent = canvas;
- }
-
- // Setting the element to be a child of an element already in the scene should
- // be sufficient to also move the element to that scene.
- // However, it seems the element needs to be already in its destination scene when the
- // RegisterCreatedObjectUndo is performed; otherwise the scene it was created in is dirtied.
- SceneManager.MoveGameObjectToScene(element, parent.scene);
-
- if (element.transform.parent == null)
- {
- Undo.SetTransformParent(element.transform, parent.transform, "Parent " + element.name);
- }
-
- GameObjectUtility.EnsureUniqueNameForSibling(element);
-
- // We have to fix up the undo name since the name of the object was only known after reparenting it.
- Undo.SetCurrentGroupName("Create " + element.name);
-
- GameObjectUtility.SetParentAndAlign(element, parent);
- if (!explicitParentChoice) // not a context click, so center in sceneview
- SetPositionVisibleinSceneView(parent.GetComponent<RectTransform>(), element.GetComponent<RectTransform>());
-
- Undo.RegisterCreatedObjectUndo(element, "Create " + element.name);
-
- Selection.activeGameObject = element;
- }
-
-
- static public GameObject CreateNewUI()
- {
- // Root for the UI
- var root = new GameObject("Canvas");
- root.layer = LayerMask.NameToLayer(kUILayerName);
- Canvas canvas = root.AddComponent<Canvas>();
- canvas.renderMode = RenderMode.ScreenSpaceOverlay;
- root.AddComponent<CanvasScaler>();
- root.AddComponent<GraphicRaycaster>();
-
- // Works for all stages.
- StageUtility.PlaceGameObjectInCurrentStage(root);
- bool customScene = false;
- PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
- if (prefabStage != null)
- {
- root.transform.SetParent(prefabStage.prefabContentsRoot.transform, false);
- customScene = true;
- }
-
- Undo.RegisterCreatedObjectUndo(root, "Create " + root.name);
-
- // If there is no event system add one...
- // No need to place event system in custom scene as these are temporary anyway.
- // It can be argued for or against placing it in the user scenes,
- // but let's not modify scene user is not currently looking at.
- if (!customScene)
- CreateEventSystem(false);
- return root;
- }
-
-
- private static void CreateEventSystem(bool select)
- {
- CreateEventSystem(select, null);
- }
-
-
- private static void CreateEventSystem(bool select, GameObject parent)
- {
- var esys = Object.FindObjectOfType<EventSystem>();
- if (esys == null)
- {
- var eventSystem = new GameObject("EventSystem");
- GameObjectUtility.SetParentAndAlign(eventSystem, parent);
- esys = eventSystem.AddComponent<EventSystem>();
- eventSystem.AddComponent<StandaloneInputModule>();
-
- Undo.RegisterCreatedObjectUndo(eventSystem, "Create " + eventSystem.name);
- }
-
- if (select && esys != null)
- {
- Selection.activeGameObject = esys.gameObject;
- }
- }
-
-
- // Helper function that returns a Canvas GameObject; preferably a parent of the selection, or other existing Canvas.
- static public GameObject GetOrCreateCanvasGameObject()
- {
- GameObject selectedGo = Selection.activeGameObject;
-
- // Try to find a gameobject that is the selected GO or one if its parents.
- Canvas canvas = (selectedGo != null) ? selectedGo.GetComponentInParent<Canvas>() : null;
- if (IsValidCanvas(canvas))
- return canvas.gameObject;
-
- // No canvas in selection or its parents? Then use any valid canvas.
- // We have to find all loaded Canvases, not just the ones in main scenes.
- Canvas[] canvasArray = StageUtility.GetCurrentStageHandle().FindComponentsOfType<Canvas>();
- for (int i = 0; i < canvasArray.Length; i++)
- if (IsValidCanvas(canvasArray[i]))
- return canvasArray[i].gameObject;
-
- // No canvas in the scene at all? Then create a new one.
- return CreateNewUI();
- }
-
- static bool IsValidCanvas(Canvas canvas)
- {
- if (canvas == null || !canvas.gameObject.activeInHierarchy)
- return false;
-
- // It's important that the non-editable canvas from a prefab scene won't be rejected,
- // but canvases not visible in the Hierarchy at all do. Don't check for HideAndDontSave.
- if (EditorUtility.IsPersistent(canvas) || (canvas.hideFlags & HideFlags.HideInHierarchy) != 0)
- return false;
-
- if (StageUtility.GetStageHandle(canvas.gameObject) != StageUtility.GetCurrentStageHandle())
- return false;
-
- return true;
- }
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_CreateObjectMenu.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_CreateObjectMenu.cs.meta
deleted file mode 100644
index 6ea901d..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_CreateObjectMenu.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 7065397ff8184621aa3ca4f854491259
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_EditorShaderUtilities.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_EditorShaderUtilities.cs
deleted file mode 100644
index 1633a68..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_EditorShaderUtilities.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.Linq;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
-
- public static class EditorShaderUtilities
- {
-
- /// <summary>
- /// Copy Shader properties from source to destination material.
- /// </summary>
- /// <param name="source"></param>
- /// <returns></returns>
- public static void CopyMaterialProperties(Material source, Material destination)
- {
- MaterialProperty[] source_prop = MaterialEditor.GetMaterialProperties(new Material[] { source });
-
- for (int i = 0; i < source_prop.Length; i++)
- {
- int property_ID = Shader.PropertyToID(source_prop[i].name);
- if (destination.HasProperty(property_ID))
- {
- //Debug.Log(source_prop[i].name + " Type:" + ShaderUtil.GetPropertyType(source.shader, i));
- switch (ShaderUtil.GetPropertyType(source.shader, i))
- {
- case ShaderUtil.ShaderPropertyType.Color:
- destination.SetColor(property_ID, source.GetColor(property_ID));
- break;
- case ShaderUtil.ShaderPropertyType.Float:
- destination.SetFloat(property_ID, source.GetFloat(property_ID));
- break;
- case ShaderUtil.ShaderPropertyType.Range:
- destination.SetFloat(property_ID, source.GetFloat(property_ID));
- break;
- case ShaderUtil.ShaderPropertyType.TexEnv:
- destination.SetTexture(property_ID, source.GetTexture(property_ID));
- break;
- case ShaderUtil.ShaderPropertyType.Vector:
- destination.SetVector(property_ID, source.GetVector(property_ID));
- break;
- }
- }
- }
-
- }
-
- }
-
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_EditorShaderUtilities.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_EditorShaderUtilities.cs.meta
deleted file mode 100644
index 9a24d61..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_EditorShaderUtilities.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: aa76955fe5bb44f7915d91db8c7043c4
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs
deleted file mode 100644
index 21b17d6..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs
+++ /dev/null
@@ -1,1736 +0,0 @@
-using System;
-using UnityEngine;
-using UnityEditor;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Threading;
-using System.IO;
-using System.Text.RegularExpressions;
-using UnityEngine.TextCore;
-using UnityEngine.TextCore.LowLevel;
-using Object = UnityEngine.Object;
-
-namespace TMPro.EditorUtilities
-{
- public class TMPro_FontAssetCreatorWindow : EditorWindow
- {
- [MenuItem("Window/TextMeshPro/Font Asset Creator", false, 2025)]
- public static void ShowFontAtlasCreatorWindow()
- {
- var window = GetWindow<TMPro_FontAssetCreatorWindow>();
- window.titleContent = new GUIContent("Font Asset Creator");
- window.Focus();
-
- // Make sure TMP Essential Resources have been imported.
- window.CheckEssentialResources();
- }
-
-
- public static void ShowFontAtlasCreatorWindow(Font sourceFontFile)
- {
- var window = GetWindow<TMPro_FontAssetCreatorWindow>();
-
- window.titleContent = new GUIContent("Font Asset Creator");
- window.Focus();
-
- window.ClearGeneratedData();
- window.m_LegacyFontAsset = null;
- window.m_SelectedFontAsset = null;
-
- // Override selected font asset
- window.m_SourceFontFile = sourceFontFile;
-
- // Make sure TMP Essential Resources have been imported.
- window.CheckEssentialResources();
- }
-
-
- public static void ShowFontAtlasCreatorWindow(TMP_FontAsset fontAsset)
- {
- var window = GetWindow<TMPro_FontAssetCreatorWindow>();
-
- window.titleContent = new GUIContent("Font Asset Creator");
- window.Focus();
-
- // Clear any previously generated data
- window.ClearGeneratedData();
- window.m_LegacyFontAsset = null;
-
- // Load font asset creation settings if we have valid settings
- if (string.IsNullOrEmpty(fontAsset.creationSettings.sourceFontFileGUID) == false)
- {
- window.LoadFontCreationSettings(fontAsset.creationSettings);
-
- // Override settings to inject character list from font asset
- window.m_CharacterSetSelectionMode = 6;
- window.m_CharacterSequence = TMP_EditorUtility.GetUnicodeCharacterSequence(TMP_FontAsset.GetCharactersArray(fontAsset));
-
-
- window.m_ReferencedFontAsset = fontAsset;
- window.m_SavedFontAtlas = fontAsset.atlasTexture;
- }
- else
- {
- window.m_WarningMessage = "Font Asset [" + fontAsset.name + "] does not contain any previous \"Font Asset Creation Settings\". This usually means [" + fontAsset.name + "] was created before this new functionality was added.";
- window.m_SourceFontFile = null;
- window.m_LegacyFontAsset = fontAsset;
- }
-
- // Even if we don't have any saved generation settings, we still want to pre-select the source font file.
- window.m_SelectedFontAsset = fontAsset;
-
- // Make sure TMP Essential Resources have been imported.
- window.CheckEssentialResources();
- }
-
- [System.Serializable]
- class FontAssetCreationSettingsContainer
- {
- public List<FontAssetCreationSettings> fontAssetCreationSettings;
- }
-
- FontAssetCreationSettingsContainer m_FontAssetCreationSettingsContainer;
-
- //static readonly string[] m_FontCreationPresets = new string[] { "Recent 1", "Recent 2", "Recent 3", "Recent 4" };
- int m_FontAssetCreationSettingsCurrentIndex = 0;
-
- const string k_FontAssetCreationSettingsContainerKey = "TextMeshPro.FontAssetCreator.RecentFontAssetCreationSettings.Container";
- const string k_FontAssetCreationSettingsCurrentIndexKey = "TextMeshPro.FontAssetCreator.RecentFontAssetCreationSettings.CurrentIndex";
- const float k_TwoColumnControlsWidth = 335f;
-
- // Diagnostics
- System.Diagnostics.Stopwatch m_StopWatch;
- double m_GlyphPackingGenerationTime;
- double m_GlyphRenderingGenerationTime;
-
- string[] m_FontSizingOptions = { "Auto Sizing", "Custom Size" };
- int m_PointSizeSamplingMode;
- string[] m_FontResolutionLabels = { "8", "16","32", "64", "128", "256", "512", "1024", "2048", "4096", "8192" };
- int[] m_FontAtlasResolutions = { 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192 };
- string[] m_FontCharacterSets = { "ASCII", "Extended ASCII", "ASCII Lowercase", "ASCII Uppercase", "Numbers + Symbols", "Custom Range", "Unicode Range (Hex)", "Custom Characters", "Characters from File" };
- enum FontPackingModes { Fast = 0, Optimum = 4 };
- FontPackingModes m_PackingMode = FontPackingModes.Fast;
-
- int m_CharacterSetSelectionMode;
-
- string m_CharacterSequence = "";
- string m_OutputFeedback = "";
- string m_WarningMessage;
- int m_CharacterCount;
- Vector2 m_ScrollPosition;
- Vector2 m_OutputScrollPosition;
-
- bool m_IsRepaintNeeded;
-
- float m_AtlasGenerationProgress;
- string m_AtlasGenerationProgressLabel = string.Empty;
- float m_RenderingProgress;
- bool m_IsRenderingDone;
- bool m_IsProcessing;
- bool m_IsGenerationDisabled;
- bool m_IsGenerationCancelled;
-
- bool m_IsFontAtlasInvalid;
- Object m_SourceFontFile;
- TMP_FontAsset m_SelectedFontAsset;
- TMP_FontAsset m_LegacyFontAsset;
- TMP_FontAsset m_ReferencedFontAsset;
-
- TextAsset m_CharactersFromFile;
- int m_PointSize;
- int m_Padding = 5;
- //FaceStyles m_FontStyle = FaceStyles.Normal;
- //float m_FontStyleValue = 2;
-
- GlyphRenderMode m_GlyphRenderMode = GlyphRenderMode.SDFAA;
- int m_AtlasWidth = 512;
- int m_AtlasHeight = 512;
- byte[] m_AtlasTextureBuffer;
- Texture2D m_FontAtlasTexture;
- Texture2D m_SavedFontAtlas;
-
- //
- List<Glyph> m_FontGlyphTable = new List<Glyph>();
- List<TMP_Character> m_FontCharacterTable = new List<TMP_Character>();
-
- Dictionary<uint, uint> m_CharacterLookupMap = new Dictionary<uint, uint>();
- Dictionary<uint, List<uint>> m_GlyphLookupMap = new Dictionary<uint, List<uint>>();
-
- List<Glyph> m_GlyphsToPack = new List<Glyph>();
- List<Glyph> m_GlyphsPacked = new List<Glyph>();
- List<GlyphRect> m_FreeGlyphRects = new List<GlyphRect>();
- List<GlyphRect> m_UsedGlyphRects = new List<GlyphRect>();
- List<Glyph> m_GlyphsToRender = new List<Glyph>();
- List<uint> m_AvailableGlyphsToAdd = new List<uint>();
- List<uint> m_MissingCharacters = new List<uint>();
- List<uint> m_ExcludedCharacters = new List<uint>();
-
- private FaceInfo m_FaceInfo;
-
- bool m_IncludeFontFeatures;
-
-
- public void OnEnable()
- {
- // Used for Diagnostics
- m_StopWatch = new System.Diagnostics.Stopwatch();
-
- // Set Editor window size.
- minSize = new Vector2(315, minSize.y);
-
- // Initialize & Get shader property IDs.
- ShaderUtilities.GetShaderPropertyIDs();
-
- // Load last selected preset if we are not already in the process of regenerating an existing font asset (via the Context menu)
- if (EditorPrefs.HasKey(k_FontAssetCreationSettingsContainerKey))
- {
- if (m_FontAssetCreationSettingsContainer == null)
- m_FontAssetCreationSettingsContainer = JsonUtility.FromJson<FontAssetCreationSettingsContainer>(EditorPrefs.GetString(k_FontAssetCreationSettingsContainerKey));
-
- if (m_FontAssetCreationSettingsContainer.fontAssetCreationSettings != null && m_FontAssetCreationSettingsContainer.fontAssetCreationSettings.Count > 0)
- {
- // Load Font Asset Creation Settings preset.
- if (EditorPrefs.HasKey(k_FontAssetCreationSettingsCurrentIndexKey))
- m_FontAssetCreationSettingsCurrentIndex = EditorPrefs.GetInt(k_FontAssetCreationSettingsCurrentIndexKey);
-
- LoadFontCreationSettings(m_FontAssetCreationSettingsContainer.fontAssetCreationSettings[m_FontAssetCreationSettingsCurrentIndex]);
- }
- }
-
- ClearGeneratedData();
- }
-
-
- public void OnDisable()
- {
- //Debug.Log("TextMeshPro Editor Window has been disabled.");
-
- // Destroy Engine only if it has been initialized already
- FontEngine.DestroyFontEngine();
-
- ClearGeneratedData();
-
- // Remove Glyph Report if one was created.
- if (File.Exists("Assets/TextMesh Pro/Glyph Report.txt"))
- {
- File.Delete("Assets/TextMesh Pro/Glyph Report.txt");
- File.Delete("Assets/TextMesh Pro/Glyph Report.txt.meta");
-
- AssetDatabase.Refresh();
- }
-
- // Save Font Asset Creation Settings Index
- SaveCreationSettingsToEditorPrefs(SaveFontCreationSettings());
- EditorPrefs.SetInt(k_FontAssetCreationSettingsCurrentIndexKey, m_FontAssetCreationSettingsCurrentIndex);
-
- // Unregister to event
- TMPro_EventManager.RESOURCE_LOAD_EVENT.Remove(ON_RESOURCES_LOADED);
-
- Resources.UnloadUnusedAssets();
- }
-
-
- // Event received when TMP resources have been loaded.
- void ON_RESOURCES_LOADED()
- {
- TMPro_EventManager.RESOURCE_LOAD_EVENT.Remove(ON_RESOURCES_LOADED);
-
- m_IsGenerationDisabled = false;
- }
-
- // Make sure TMP Essential Resources have been imported.
- void CheckEssentialResources()
- {
- if (TMP_Settings.instance == null)
- {
- if (m_IsGenerationDisabled == false)
- TMPro_EventManager.RESOURCE_LOAD_EVENT.Add(ON_RESOURCES_LOADED);
-
- m_IsGenerationDisabled = true;
- }
- }
-
-
- public void OnGUI()
- {
- GUILayout.BeginHorizontal();
- DrawControls();
- if (position.width > position.height && position.width > k_TwoColumnControlsWidth)
- {
- DrawPreview();
- }
- GUILayout.EndHorizontal();
- }
-
-
- public void Update()
- {
- if (m_IsRepaintNeeded)
- {
- //Debug.Log("Repainting...");
- m_IsRepaintNeeded = false;
- Repaint();
- }
-
- // Update Progress bar is we are Rendering a Font.
- if (m_IsProcessing)
- {
- m_AtlasGenerationProgress = FontEngine.generationProgress;
-
- m_IsRepaintNeeded = true;
- }
-
- // Update Feedback Window & Create Font Texture once Rendering is done.
- if (m_IsRenderingDone)
- {
- m_IsProcessing = false;
- m_IsRenderingDone = false;
-
- if (m_IsGenerationCancelled == false)
- {
- m_AtlasGenerationProgressLabel = "Generation completed in: " + (m_GlyphPackingGenerationTime + m_GlyphRenderingGenerationTime).ToString("0.00 ms.");
-
- UpdateRenderFeedbackWindow();
- CreateFontAtlasTexture();
-
- // If dynamic make readable ...
- m_FontAtlasTexture.Apply(false, false);
- }
- Repaint();
- }
- }
-
-
- /// <summary>
- /// Method which returns the character corresponding to a decimal value.
- /// </summary>
- /// <param name="sequence"></param>
- /// <returns></returns>
- static uint[] ParseNumberSequence(string sequence)
- {
- List<uint> unicodeList = new List<uint>();
- string[] sequences = sequence.Split(',');
-
- foreach (string seq in sequences)
- {
- string[] s1 = seq.Split('-');
-
- if (s1.Length == 1)
- try
- {
- unicodeList.Add(uint.Parse(s1[0]));
- }
- catch
- {
- Debug.Log("No characters selected or invalid format.");
- }
- else
- {
- for (uint j = uint.Parse(s1[0]); j < uint.Parse(s1[1]) + 1; j++)
- {
- unicodeList.Add(j);
- }
- }
- }
-
- return unicodeList.ToArray();
- }
-
-
- /// <summary>
- /// Method which returns the character (decimal value) from a hex sequence.
- /// </summary>
- /// <param name="sequence"></param>
- /// <returns></returns>
- static uint[] ParseHexNumberSequence(string sequence)
- {
- List<uint> unicodeList = new List<uint>();
- string[] sequences = sequence.Split(',');
-
- foreach (string seq in sequences)
- {
- string[] s1 = seq.Split('-');
-
- if (s1.Length == 1)
- try
- {
- unicodeList.Add(uint.Parse(s1[0], NumberStyles.AllowHexSpecifier));
- }
- catch
- {
- Debug.Log("No characters selected or invalid format.");
- }
- else
- {
- for (uint j = uint.Parse(s1[0], NumberStyles.AllowHexSpecifier); j < uint.Parse(s1[1], NumberStyles.AllowHexSpecifier) + 1; j++)
- {
- unicodeList.Add(j);
- }
- }
- }
-
- return unicodeList.ToArray();
- }
-
-
- void DrawControls()
- {
- GUILayout.Space(5f);
-
- if (position.width > position.height && position.width > k_TwoColumnControlsWidth)
- {
- m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition, GUILayout.Width(315));
- }
- else
- {
- m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
- }
-
- GUILayout.Space(5f);
-
- GUILayout.Label(m_SelectedFontAsset != null ? string.Format("Font Settings [{0}]", m_SelectedFontAsset.name) : "Font Settings", EditorStyles.boldLabel);
-
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
-
- EditorGUIUtility.labelWidth = 125f;
- EditorGUIUtility.fieldWidth = 5f;
-
- // Disable Options if already generating a font atlas texture.
- EditorGUI.BeginDisabledGroup(m_IsProcessing);
- {
- // FONT TTF SELECTION
- EditorGUI.BeginChangeCheck();
- m_SourceFontFile = EditorGUILayout.ObjectField("Source Font File", m_SourceFontFile, typeof(Font), false) as Font;
- if (EditorGUI.EndChangeCheck())
- {
- m_SelectedFontAsset = null;
- m_IsFontAtlasInvalid = true;
- }
-
- // FONT SIZING
- EditorGUI.BeginChangeCheck();
- if (m_PointSizeSamplingMode == 0)
- {
- m_PointSizeSamplingMode = EditorGUILayout.Popup("Sampling Point Size", m_PointSizeSamplingMode, m_FontSizingOptions);
- }
- else
- {
- GUILayout.BeginHorizontal();
- m_PointSizeSamplingMode = EditorGUILayout.Popup("Sampling Point Size", m_PointSizeSamplingMode, m_FontSizingOptions, GUILayout.Width(225));
- m_PointSize = EditorGUILayout.IntField(m_PointSize);
- GUILayout.EndHorizontal();
- }
- if (EditorGUI.EndChangeCheck())
- {
- m_IsFontAtlasInvalid = true;
- }
-
- // FONT PADDING
- EditorGUI.BeginChangeCheck();
- m_Padding = EditorGUILayout.IntField("Padding", m_Padding);
- m_Padding = (int)Mathf.Clamp(m_Padding, 0f, 64f);
- if (EditorGUI.EndChangeCheck())
- {
- m_IsFontAtlasInvalid = true;
- }
-
- // FONT PACKING METHOD SELECTION
- EditorGUI.BeginChangeCheck();
- m_PackingMode = (FontPackingModes)EditorGUILayout.EnumPopup("Packing Method", m_PackingMode);
- if (EditorGUI.EndChangeCheck())
- {
- m_IsFontAtlasInvalid = true;
- }
-
- // FONT ATLAS RESOLUTION SELECTION
- GUILayout.BeginHorizontal();
- GUI.changed = false;
-
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PrefixLabel("Atlas Resolution");
- m_AtlasWidth = EditorGUILayout.IntPopup(m_AtlasWidth, m_FontResolutionLabels, m_FontAtlasResolutions);
- m_AtlasHeight = EditorGUILayout.IntPopup(m_AtlasHeight, m_FontResolutionLabels, m_FontAtlasResolutions);
- if (EditorGUI.EndChangeCheck())
- {
- m_IsFontAtlasInvalid = true;
- }
-
- GUILayout.EndHorizontal();
-
-
- // FONT CHARACTER SET SELECTION
- EditorGUI.BeginChangeCheck();
- bool hasSelectionChanged = false;
- m_CharacterSetSelectionMode = EditorGUILayout.Popup("Character Set", m_CharacterSetSelectionMode, m_FontCharacterSets);
- if (EditorGUI.EndChangeCheck())
- {
- m_CharacterSequence = "";
- hasSelectionChanged = true;
- m_IsFontAtlasInvalid = true;
- }
-
- switch (m_CharacterSetSelectionMode)
- {
- case 0: // ASCII
- //characterSequence = "32 - 126, 130, 132 - 135, 139, 145 - 151, 153, 155, 161, 166 - 167, 169 - 174, 176, 181 - 183, 186 - 187, 191, 8210 - 8226, 8230, 8240, 8242 - 8244, 8249 - 8250, 8252 - 8254, 8260, 8286";
- m_CharacterSequence = "32 - 126, 160, 8203, 8230, 9633";
- break;
-
- case 1: // EXTENDED ASCII
- m_CharacterSequence = "32 - 126, 160 - 255, 8192 - 8303, 8364, 8482, 9633";
- // Could add 9632 for missing glyph
- break;
-
- case 2: // Lowercase
- m_CharacterSequence = "32 - 64, 91 - 126, 160";
- break;
-
- case 3: // Uppercase
- m_CharacterSequence = "32 - 96, 123 - 126, 160";
- break;
-
- case 4: // Numbers & Symbols
- m_CharacterSequence = "32 - 64, 91 - 96, 123 - 126, 160";
- break;
-
- case 5: // Custom Range
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label("Enter a sequence of decimal values to define the characters to be included in the font asset or retrieve one from another font asset.", TMP_UIStyleManager.label);
- GUILayout.Space(10f);
-
- EditorGUI.BeginChangeCheck();
- m_ReferencedFontAsset = EditorGUILayout.ObjectField("Select Font Asset", m_ReferencedFontAsset, typeof(TMP_FontAsset), false) as TMP_FontAsset;
- if (EditorGUI.EndChangeCheck() || hasSelectionChanged)
- {
- if (m_ReferencedFontAsset != null)
- m_CharacterSequence = TMP_EditorUtility.GetDecimalCharacterSequence(TMP_FontAsset.GetCharactersArray(m_ReferencedFontAsset));
-
- m_IsFontAtlasInvalid = true;
- }
-
- // Filter out unwanted characters.
- char chr = Event.current.character;
- if ((chr < '0' || chr > '9') && (chr < ',' || chr > '-'))
- {
- Event.current.character = '\0';
- }
- GUILayout.Label("Character Sequence (Decimal)", EditorStyles.boldLabel);
- EditorGUI.BeginChangeCheck();
- m_CharacterSequence = EditorGUILayout.TextArea(m_CharacterSequence, TMP_UIStyleManager.textAreaBoxWindow, GUILayout.Height(120), GUILayout.ExpandWidth(true));
- if (EditorGUI.EndChangeCheck())
- {
- m_IsFontAtlasInvalid = true;
- }
-
- EditorGUILayout.EndVertical();
- break;
-
- case 6: // Unicode HEX Range
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label("Enter a sequence of Unicode (hex) values to define the characters to be included in the font asset or retrieve one from another font asset.", TMP_UIStyleManager.label);
- GUILayout.Space(10f);
-
- EditorGUI.BeginChangeCheck();
- m_ReferencedFontAsset = EditorGUILayout.ObjectField("Select Font Asset", m_ReferencedFontAsset, typeof(TMP_FontAsset), false) as TMP_FontAsset;
- if (EditorGUI.EndChangeCheck() || hasSelectionChanged)
- {
- if (m_ReferencedFontAsset != null)
- m_CharacterSequence = TMP_EditorUtility.GetUnicodeCharacterSequence(TMP_FontAsset.GetCharactersArray(m_ReferencedFontAsset));
-
- m_IsFontAtlasInvalid = true;
- }
-
- // Filter out unwanted characters.
- chr = Event.current.character;
- if ((chr < '0' || chr > '9') && (chr < 'a' || chr > 'f') && (chr < 'A' || chr > 'F') && (chr < ',' || chr > '-'))
- {
- Event.current.character = '\0';
- }
- GUILayout.Label("Character Sequence (Hex)", EditorStyles.boldLabel);
- EditorGUI.BeginChangeCheck();
- m_CharacterSequence = EditorGUILayout.TextArea(m_CharacterSequence, TMP_UIStyleManager.textAreaBoxWindow, GUILayout.Height(120), GUILayout.ExpandWidth(true));
- if (EditorGUI.EndChangeCheck())
- {
- m_IsFontAtlasInvalid = true;
- }
-
- EditorGUILayout.EndVertical();
- break;
-
- case 7: // Characters from Font Asset
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
- GUILayout.Label("Type the characters to be included in the font asset or retrieve them from another font asset.", TMP_UIStyleManager.label);
- GUILayout.Space(10f);
-
- EditorGUI.BeginChangeCheck();
- m_ReferencedFontAsset = EditorGUILayout.ObjectField("Select Font Asset", m_ReferencedFontAsset, typeof(TMP_FontAsset), false) as TMP_FontAsset;
- if (EditorGUI.EndChangeCheck() || hasSelectionChanged)
- {
- if (m_ReferencedFontAsset != null)
- m_CharacterSequence = TMP_FontAsset.GetCharacters(m_ReferencedFontAsset);
-
- m_IsFontAtlasInvalid = true;
- }
-
- EditorGUI.indentLevel = 0;
-
- GUILayout.Label("Custom Character List", EditorStyles.boldLabel);
- EditorGUI.BeginChangeCheck();
- m_CharacterSequence = EditorGUILayout.TextArea(m_CharacterSequence, TMP_UIStyleManager.textAreaBoxWindow, GUILayout.Height(120), GUILayout.ExpandWidth(true));
- if (EditorGUI.EndChangeCheck())
- {
- m_IsFontAtlasInvalid = true;
- }
- EditorGUILayout.EndVertical();
- break;
-
- case 8: // Character List from File
- EditorGUI.BeginChangeCheck();
- m_CharactersFromFile = EditorGUILayout.ObjectField("Character File", m_CharactersFromFile, typeof(TextAsset), false) as TextAsset;
- if (EditorGUI.EndChangeCheck())
- {
- m_IsFontAtlasInvalid = true;
- }
-
- if (m_CharactersFromFile != null)
- {
- Regex rx = new Regex(@"(?<!\\)(?:\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})");
-
- m_CharacterSequence = rx.Replace(m_CharactersFromFile.text,
- match =>
- {
- if (match.Value.StartsWith("\\U"))
- return char.ConvertFromUtf32(int.Parse(match.Value.Replace("\\U", ""), NumberStyles.HexNumber));
-
- return char.ConvertFromUtf32(int.Parse(match.Value.Replace("\\u", ""), NumberStyles.HexNumber));
- });
- }
- break;
- }
-
- // FONT STYLE SELECTION
- //GUILayout.BeginHorizontal();
- //EditorGUI.BeginChangeCheck();
- ////m_FontStyle = (FaceStyles)EditorGUILayout.EnumPopup("Font Style", m_FontStyle, GUILayout.Width(225));
- ////m_FontStyleValue = EditorGUILayout.IntField((int)m_FontStyleValue);
- //if (EditorGUI.EndChangeCheck())
- //{
- // m_IsFontAtlasInvalid = true;
- //}
- //GUILayout.EndHorizontal();
-
- // Render Mode Selection
- CheckForLegacyGlyphRenderMode();
-
- EditorGUI.BeginChangeCheck();
- m_GlyphRenderMode = (GlyphRenderMode)EditorGUILayout.EnumPopup("Render Mode", m_GlyphRenderMode);
- if (EditorGUI.EndChangeCheck())
- {
- m_IsFontAtlasInvalid = true;
- }
-
- m_IncludeFontFeatures = EditorGUILayout.Toggle("Get Kerning Pairs", m_IncludeFontFeatures);
-
- EditorGUILayout.Space();
- }
-
- EditorGUI.EndDisabledGroup();
-
- if (!string.IsNullOrEmpty(m_WarningMessage))
- {
- EditorGUILayout.HelpBox(m_WarningMessage, MessageType.Warning);
- }
-
- GUI.enabled = m_SourceFontFile != null && !m_IsProcessing && !m_IsGenerationDisabled; // Enable Preview if we are not already rendering a font.
- if (GUILayout.Button("Generate Font Atlas") && GUI.enabled)
- {
- if (!m_IsProcessing && m_SourceFontFile != null)
- {
- DestroyImmediate(m_FontAtlasTexture);
- m_FontAtlasTexture = null;
- m_SavedFontAtlas = null;
-
- // Initialize font engine
- FontEngineError errorCode = FontEngine.InitializeFontEngine();
- if (errorCode != FontEngineError.Success)
- {
- Debug.Log("Font Asset Creator - Error [" + errorCode + "] has occurred while Initializing the FreeType Library.");
- }
-
- // Get file path of the source font file.
- string fontPath = AssetDatabase.GetAssetPath(m_SourceFontFile);
-
- if (errorCode == FontEngineError.Success)
- {
- errorCode = FontEngine.LoadFontFace(fontPath);
-
- if (errorCode != FontEngineError.Success)
- {
- Debug.Log("Font Asset Creator - Error Code [" + errorCode + "] has occurred trying to load the [" + m_SourceFontFile.name + "] font file. This typically results from the use of an incompatible or corrupted font file.");
- }
- }
-
-
- // Define an array containing the characters we will render.
- if (errorCode == FontEngineError.Success)
- {
- uint[] characterSet = null;
-
- // Get list of characters that need to be packed and rendered to the atlas texture.
- if (m_CharacterSetSelectionMode == 7 || m_CharacterSetSelectionMode == 8)
- {
- List<uint> char_List = new List<uint>();
-
- for (int i = 0; i < m_CharacterSequence.Length; i++)
- {
- uint unicode = m_CharacterSequence[i];
-
- // Handle surrogate pairs
- if (i < m_CharacterSequence.Length - 1 && char.IsHighSurrogate((char)unicode) && char.IsLowSurrogate(m_CharacterSequence[i + 1]))
- {
- unicode = (uint)char.ConvertToUtf32(m_CharacterSequence[i], m_CharacterSequence[i + 1]);
- i += 1;
- }
-
- // Check to make sure we don't include duplicates
- if (char_List.FindIndex(item => item == unicode) == -1)
- char_List.Add(unicode);
- }
-
- characterSet = char_List.ToArray();
- }
- else if (m_CharacterSetSelectionMode == 6)
- {
- characterSet = ParseHexNumberSequence(m_CharacterSequence);
- }
- else
- {
- characterSet = ParseNumberSequence(m_CharacterSequence);
- }
-
- m_CharacterCount = characterSet.Length;
-
- m_AtlasGenerationProgress = 0;
- m_IsProcessing = true;
- m_IsGenerationCancelled = false;
-
- GlyphLoadFlags glyphLoadFlags = ((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_HINTED) == GlyphRasterModes.RASTER_MODE_HINTED ? GlyphLoadFlags.LOAD_RENDER : GlyphLoadFlags.LOAD_RENDER | GlyphLoadFlags.LOAD_NO_HINTING;
-
- //
- AutoResetEvent autoEvent = new AutoResetEvent(false);
-
- // Worker thread to pack glyphs in the given texture space.
- ThreadPool.QueueUserWorkItem(PackGlyphs =>
- {
- // Start Stop Watch
- m_StopWatch = System.Diagnostics.Stopwatch.StartNew();
-
- // Clear the various lists used in the generation process.
- m_AvailableGlyphsToAdd.Clear();
- m_MissingCharacters.Clear();
- m_ExcludedCharacters.Clear();
- m_CharacterLookupMap.Clear();
- m_GlyphLookupMap.Clear();
- m_GlyphsToPack.Clear();
- m_GlyphsPacked.Clear();
-
- // Check if requested characters are available in the source font file.
- for (int i = 0; i < characterSet.Length; i++)
- {
- uint unicode = characterSet[i];
-
- if (FontEngine.TryGetGlyphIndex(unicode, out uint glyphIndex))
- {
- // Skip over potential duplicate characters.
- if (m_CharacterLookupMap.ContainsKey(unicode))
- continue;
-
- // Add character to character lookup map.
- m_CharacterLookupMap.Add(unicode, glyphIndex);
-
- // Skip over potential duplicate glyph references.
- if (m_GlyphLookupMap.ContainsKey(glyphIndex))
- {
- // Add additional glyph reference for this character.
- m_GlyphLookupMap[glyphIndex].Add(unicode);
- continue;
- }
-
- // Add glyph reference to glyph lookup map.
- m_GlyphLookupMap.Add(glyphIndex, new List<uint>() { unicode });
-
- // Add glyph index to list of glyphs to add to texture.
- m_AvailableGlyphsToAdd.Add(glyphIndex);
- }
- else
- {
- // Add Unicode to list of missing characters.
- m_MissingCharacters.Add(unicode);
- }
- }
-
- // Pack available glyphs in the provided texture space.
- if (m_AvailableGlyphsToAdd.Count > 0)
- {
- int packingModifier = ((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP ? 0 : 1;
-
- if (m_PointSizeSamplingMode == 0) // Auto-Sizing Point Size Mode
- {
- // Estimate min / max range for auto sizing of point size.
- int minPointSize = 0;
- int maxPointSize = (int)Mathf.Sqrt((m_AtlasWidth * m_AtlasHeight) / m_AvailableGlyphsToAdd.Count) * 3;
-
- m_PointSize = (maxPointSize + minPointSize) / 2;
-
- bool optimumPointSizeFound = false;
- for (int iteration = 0; iteration < 15 && optimumPointSizeFound == false; iteration++)
- {
- m_AtlasGenerationProgressLabel = "Packing glyphs - Pass (" + iteration + ")";
-
- FontEngine.SetFaceSize(m_PointSize);
-
- m_GlyphsToPack.Clear();
- m_GlyphsPacked.Clear();
-
- m_FreeGlyphRects.Clear();
- m_FreeGlyphRects.Add(new GlyphRect(0, 0, m_AtlasWidth - packingModifier, m_AtlasHeight - packingModifier));
- m_UsedGlyphRects.Clear();
-
- for (int i = 0; i < m_AvailableGlyphsToAdd.Count; i++)
- {
- uint glyphIndex = m_AvailableGlyphsToAdd[i];
-
- if (FontEngine.TryGetGlyphWithIndexValue(glyphIndex, glyphLoadFlags, out Glyph glyph))
- {
- if (glyph.glyphRect.width > 0 && glyph.glyphRect.height > 0)
- {
- m_GlyphsToPack.Add(glyph);
- }
- else
- {
- m_GlyphsPacked.Add(glyph);
- }
- }
- }
-
- FontEngine.TryPackGlyphsInAtlas(m_GlyphsToPack, m_GlyphsPacked, m_Padding, (GlyphPackingMode)m_PackingMode, m_GlyphRenderMode, m_AtlasWidth, m_AtlasHeight, m_FreeGlyphRects, m_UsedGlyphRects);
-
- if (m_IsGenerationCancelled)
- {
- DestroyImmediate(m_FontAtlasTexture);
- m_FontAtlasTexture = null;
- return;
- }
-
- //Debug.Log("Glyphs remaining to add [" + m_GlyphsToAdd.Count + "]. Glyphs added [" + m_GlyphsAdded.Count + "].");
-
- if (m_GlyphsToPack.Count > 0)
- {
- if (m_PointSize > minPointSize)
- {
- maxPointSize = m_PointSize;
- m_PointSize = (m_PointSize + minPointSize) / 2;
-
- //Debug.Log("Decreasing point size from [" + maxPointSize + "] to [" + m_PointSize + "].");
- }
- }
- else
- {
- if (maxPointSize - minPointSize > 1 && m_PointSize < maxPointSize)
- {
- minPointSize = m_PointSize;
- m_PointSize = (m_PointSize + maxPointSize) / 2;
-
- //Debug.Log("Increasing point size from [" + minPointSize + "] to [" + m_PointSize + "].");
- }
- else
- {
- //Debug.Log("[" + iteration + "] iterations to find the optimum point size of : [" + m_PointSize + "].");
- optimumPointSizeFound = true;
- }
- }
- }
- }
- else // Custom Point Size Mode
- {
- m_AtlasGenerationProgressLabel = "Packing glyphs...";
-
- // Set point size
- FontEngine.SetFaceSize(m_PointSize);
-
- m_GlyphsToPack.Clear();
- m_GlyphsPacked.Clear();
-
- m_FreeGlyphRects.Clear();
- m_FreeGlyphRects.Add(new GlyphRect(0, 0, m_AtlasWidth - packingModifier, m_AtlasHeight - packingModifier));
- m_UsedGlyphRects.Clear();
-
- for (int i = 0; i < m_AvailableGlyphsToAdd.Count; i++)
- {
- uint glyphIndex = m_AvailableGlyphsToAdd[i];
-
- if (FontEngine.TryGetGlyphWithIndexValue(glyphIndex, glyphLoadFlags, out Glyph glyph))
- {
- if (glyph.glyphRect.width > 0 && glyph.glyphRect.height > 0)
- {
- m_GlyphsToPack.Add(glyph);
- }
- else
- {
- m_GlyphsPacked.Add(glyph);
- }
- }
- }
-
- FontEngine.TryPackGlyphsInAtlas(m_GlyphsToPack, m_GlyphsPacked, m_Padding, (GlyphPackingMode)m_PackingMode, m_GlyphRenderMode, m_AtlasWidth, m_AtlasHeight, m_FreeGlyphRects, m_UsedGlyphRects);
-
- if (m_IsGenerationCancelled)
- {
- DestroyImmediate(m_FontAtlasTexture);
- m_FontAtlasTexture = null;
- return;
- }
- //Debug.Log("Glyphs remaining to add [" + m_GlyphsToAdd.Count + "]. Glyphs added [" + m_GlyphsAdded.Count + "].");
- }
-
- }
- else
- {
- int packingModifier = ((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP ? 0 : 1;
-
- FontEngine.SetFaceSize(m_PointSize);
-
- m_GlyphsToPack.Clear();
- m_GlyphsPacked.Clear();
-
- m_FreeGlyphRects.Clear();
- m_FreeGlyphRects.Add(new GlyphRect(0, 0, m_AtlasWidth - packingModifier, m_AtlasHeight - packingModifier));
- m_UsedGlyphRects.Clear();
- }
-
- //Stop StopWatch
- m_StopWatch.Stop();
- m_GlyphPackingGenerationTime = m_StopWatch.Elapsed.TotalMilliseconds;
- Debug.Log("Glyph packing completed in: " + m_GlyphPackingGenerationTime.ToString("0.000 ms."));
- m_StopWatch.Reset();
-
- m_FontCharacterTable.Clear();
- m_FontGlyphTable.Clear();
- m_GlyphsToRender.Clear();
-
- // Add glyphs and characters successfully added to texture to their respective font tables.
- foreach (Glyph glyph in m_GlyphsPacked)
- {
- uint glyphIndex = glyph.index;
-
- m_FontGlyphTable.Add(glyph);
-
- // Add glyphs to list of glyphs that need to be rendered.
- if (glyph.glyphRect.width > 0 && glyph.glyphRect.height > 0)
- m_GlyphsToRender.Add(glyph);
-
- foreach (uint unicode in m_GlyphLookupMap[glyphIndex])
- {
- // Create new Character
- m_FontCharacterTable.Add(new TMP_Character(unicode, glyph));
- }
- }
-
- //
- foreach (Glyph glyph in m_GlyphsToPack)
- {
- foreach (uint unicode in m_GlyphLookupMap[glyph.index])
- {
- m_ExcludedCharacters.Add(unicode);
- }
- }
-
- // Get the face info for the current sampling point size.
- m_FaceInfo = FontEngine.GetFaceInfo();
-
- autoEvent.Set();
- });
-
- // Worker thread to render glyphs in texture buffer.
- ThreadPool.QueueUserWorkItem(RenderGlyphs =>
- {
- autoEvent.WaitOne();
-
- // Start Stop Watch
- m_StopWatch = System.Diagnostics.Stopwatch.StartNew();
-
- m_IsRenderingDone = false;
-
- // Allocate texture data
- m_AtlasTextureBuffer = new byte[m_AtlasWidth * m_AtlasHeight];
-
- m_AtlasGenerationProgressLabel = "Rendering glyphs...";
-
- // Render and add glyphs to the given atlas texture.
- if (m_GlyphsToRender.Count > 0)
- {
- FontEngine.RenderGlyphsToTexture(m_GlyphsToRender, m_Padding, m_GlyphRenderMode, m_AtlasTextureBuffer, m_AtlasWidth, m_AtlasHeight);
- }
-
- m_IsRenderingDone = true;
-
- // Stop StopWatch
- m_StopWatch.Stop();
- m_GlyphRenderingGenerationTime = m_StopWatch.Elapsed.TotalMilliseconds;
- Debug.Log("Font Atlas generation completed in: " + m_GlyphRenderingGenerationTime.ToString("0.000 ms."));
- m_StopWatch.Reset();
- });
- }
-
- SaveCreationSettingsToEditorPrefs(SaveFontCreationSettings());
- }
- }
-
- // FONT RENDERING PROGRESS BAR
- GUILayout.Space(1);
- Rect progressRect = EditorGUILayout.GetControlRect(false, 20);
-
- GUI.enabled = true;
- progressRect.width -= 22;
- EditorGUI.ProgressBar(progressRect, Mathf.Max(0.01f, m_AtlasGenerationProgress), m_AtlasGenerationProgressLabel);
- progressRect.x = progressRect.x + progressRect.width + 2;
- progressRect.y -= 1;
- progressRect.width = 20;
- progressRect.height = 20;
-
- GUI.enabled = m_IsProcessing;
- if (GUI.Button(progressRect, "X"))
- {
- FontEngine.SendCancellationRequest();
- m_AtlasGenerationProgress = 0;
- m_IsProcessing = false;
- m_IsGenerationCancelled = true;
- }
- GUILayout.Space(5);
-
- // FONT STATUS & INFORMATION
- GUI.enabled = true;
-
- GUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.Height(200));
- m_OutputScrollPosition = EditorGUILayout.BeginScrollView(m_OutputScrollPosition);
- EditorGUILayout.LabelField(m_OutputFeedback, TMP_UIStyleManager.label);
- EditorGUILayout.EndScrollView();
- GUILayout.EndVertical();
-
- // SAVE TEXTURE & CREATE and SAVE FONT XML FILE
- GUI.enabled = m_FontAtlasTexture != null && !m_IsProcessing; // Enable Save Button if font_Atlas is not Null.
-
- EditorGUILayout.BeginHorizontal();
-
- if (GUILayout.Button("Save") && GUI.enabled)
- {
- if (m_SelectedFontAsset == null)
- {
- if (m_LegacyFontAsset != null)
- SaveNewFontAssetWithSameName(m_LegacyFontAsset);
- else
- SaveNewFontAsset(m_SourceFontFile);
- }
- else
- {
- // Save over exiting Font Asset
- string filePath = Path.GetFullPath(AssetDatabase.GetAssetPath(m_SelectedFontAsset)).Replace('\\', '/');
-
- if (((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP)
- Save_Bitmap_FontAsset(filePath);
- else
- Save_SDF_FontAsset(filePath);
- }
- }
- if (GUILayout.Button("Save as...") && GUI.enabled)
- {
- if (m_SelectedFontAsset == null)
- {
- SaveNewFontAsset(m_SourceFontFile);
- }
- else
- {
- SaveNewFontAssetWithSameName(m_SelectedFontAsset);
- }
- }
-
- EditorGUILayout.EndHorizontal();
-
- EditorGUILayout.Space();
-
- EditorGUILayout.EndVertical();
-
- GUI.enabled = true; // Re-enable GUI
-
- if (position.height > position.width || position.width < k_TwoColumnControlsWidth)
- {
- DrawPreview();
- GUILayout.Space(5);
- }
-
- EditorGUILayout.EndScrollView();
-
- if (m_IsFontAtlasInvalid)
- ClearGeneratedData();
- }
-
-
- /// <summary>
- /// Clear the previously generated data.
- /// </summary>
- void ClearGeneratedData()
- {
- m_IsFontAtlasInvalid = false;
-
- if (m_FontAtlasTexture != null && !EditorUtility.IsPersistent(m_FontAtlasTexture))
- {
- DestroyImmediate(m_FontAtlasTexture);
- m_FontAtlasTexture = null;
- }
-
- m_AtlasGenerationProgressLabel = string.Empty;
- m_AtlasGenerationProgress = 0;
- m_SavedFontAtlas = null;
-
- m_OutputFeedback = string.Empty;
- m_WarningMessage = string.Empty;
- }
-
-
- /// <summary>
- /// Function to update the feedback window showing the results of the latest generation.
- /// </summary>
- void UpdateRenderFeedbackWindow()
- {
- m_PointSize = m_FaceInfo.pointSize;
-
- string missingGlyphReport = string.Empty;
-
- //string colorTag = m_FontCharacterTable.Count == m_CharacterCount ? "<color=#C0ffff>" : "<color=#ffff00>";
- string colorTag2 = "<color=#C0ffff>";
-
- missingGlyphReport = "Font: <b>" + colorTag2 + m_FaceInfo.familyName + "</color></b> Style: <b>" + colorTag2 + m_FaceInfo.styleName + "</color></b>";
-
- missingGlyphReport += "\nPoint Size: <b>" + colorTag2 + m_FaceInfo.pointSize + "</color></b> SP/PD Ratio: <b>" + colorTag2 + ((float)m_Padding / m_FaceInfo.pointSize).ToString("0.0%" + "</color></b>");
-
- missingGlyphReport += "\n\nCharacters included: <color=#ffff00><b>" + m_FontCharacterTable.Count + "/" + m_CharacterCount + "</b></color>";
- missingGlyphReport += "\nMissing characters: <color=#ffff00><b>" + m_MissingCharacters.Count + "</b></color>";
- missingGlyphReport += "\nExcluded characters: <color=#ffff00><b>" + m_ExcludedCharacters.Count + "</b></color>";
-
- // Report characters missing from font file
- missingGlyphReport += "\n\n<b><color=#ffff00>Characters missing from font file:</color></b>";
- missingGlyphReport += "\n----------------------------------------";
-
- m_OutputFeedback = missingGlyphReport;
-
- for (int i = 0; i < m_MissingCharacters.Count; i++)
- {
- missingGlyphReport += "\nID: <color=#C0ffff>" + m_MissingCharacters[i] + "\t</color>Hex: <color=#C0ffff>" + m_MissingCharacters[i].ToString("X") + "\t</color>Char [<color=#C0ffff>" + (char)m_MissingCharacters[i] + "</color>]";
-
- if (missingGlyphReport.Length < 16300)
- m_OutputFeedback = missingGlyphReport;
- }
-
- // Report characters that did not fit in the atlas texture
- missingGlyphReport += "\n\n<b><color=#ffff00>Characters excluded from packing:</color></b>";
- missingGlyphReport += "\n----------------------------------------";
-
- for (int i = 0; i < m_ExcludedCharacters.Count; i++)
- {
- missingGlyphReport += "\nID: <color=#C0ffff>" + m_ExcludedCharacters[i] + "\t</color>Hex: <color=#C0ffff>" + m_ExcludedCharacters[i].ToString("X") + "\t</color>Char [<color=#C0ffff>" + (char)m_ExcludedCharacters[i] + "</color>]";
-
- if (missingGlyphReport.Length < 16300)
- m_OutputFeedback = missingGlyphReport;
- }
-
- if (missingGlyphReport.Length > 16300)
- m_OutputFeedback += "\n\n<color=#ffff00>Report truncated.</color>\n<color=#c0ffff>See</color> \"TextMesh Pro\\Glyph Report.txt\"";
-
- // Save Missing Glyph Report file
- if (Directory.Exists("Assets/TextMesh Pro"))
- {
- missingGlyphReport = System.Text.RegularExpressions.Regex.Replace(missingGlyphReport, @"<[^>]*>", string.Empty);
- File.WriteAllText("Assets/TextMesh Pro/Glyph Report.txt", missingGlyphReport);
- AssetDatabase.Refresh();
- }
- }
-
-
- void CreateFontAtlasTexture()
- {
- if (m_FontAtlasTexture != null)
- DestroyImmediate(m_FontAtlasTexture);
-
- m_FontAtlasTexture = new Texture2D(m_AtlasWidth, m_AtlasHeight, TextureFormat.Alpha8, false, true);
-
- Color32[] colors = new Color32[m_AtlasWidth * m_AtlasHeight];
-
- for (int i = 0; i < colors.Length; i++)
- {
- byte c = m_AtlasTextureBuffer[i];
- colors[i] = new Color32(c, c, c, c);
- }
-
- // Clear allocation of
- m_AtlasTextureBuffer = null;
-
- if ((m_GlyphRenderMode & GlyphRenderMode.RASTER) == GlyphRenderMode.RASTER || (m_GlyphRenderMode & GlyphRenderMode.RASTER_HINTED) == GlyphRenderMode.RASTER_HINTED)
- m_FontAtlasTexture.filterMode = FilterMode.Point;
-
- m_FontAtlasTexture.SetPixels32(colors, 0);
- m_FontAtlasTexture.Apply(false, false);
-
- // Saving File for Debug
- //var pngData = m_FontAtlasTexture.EncodeToPNG();
- //File.WriteAllBytes("Assets/Textures/Debug Font Texture.png", pngData);
- }
-
-
- /// <summary>
- /// Open Save Dialog to provide the option save the font asset using the name of the source font file. This also appends SDF to the name if using any of the SDF Font Asset creation modes.
- /// </summary>
- /// <param name="sourceObject"></param>
- void SaveNewFontAsset(Object sourceObject)
- {
- string filePath;
-
- // Save new Font Asset and open save file requester at Source Font File location.
- string saveDirectory = new FileInfo(AssetDatabase.GetAssetPath(sourceObject)).DirectoryName;
-
- if (((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP)
- {
- filePath = EditorUtility.SaveFilePanel("Save TextMesh Pro! Font Asset File", saveDirectory, sourceObject.name, "asset");
-
- if (filePath.Length == 0)
- return;
-
- Save_Bitmap_FontAsset(filePath);
- }
- else
- {
- filePath = EditorUtility.SaveFilePanel("Save TextMesh Pro! Font Asset File", saveDirectory, sourceObject.name + " SDF", "asset");
-
- if (filePath.Length == 0)
- return;
-
- Save_SDF_FontAsset(filePath);
- }
- }
-
-
- /// <summary>
- /// Open Save Dialog to provide the option to save the font asset under the same name.
- /// </summary>
- /// <param name="sourceObject"></param>
- void SaveNewFontAssetWithSameName(Object sourceObject)
- {
- string filePath;
-
- // Save new Font Asset and open save file requester at Source Font File location.
- string saveDirectory = new FileInfo(AssetDatabase.GetAssetPath(sourceObject)).DirectoryName;
-
- filePath = EditorUtility.SaveFilePanel("Save TextMesh Pro! Font Asset File", saveDirectory, sourceObject.name, "asset");
-
- if (filePath.Length == 0)
- return;
-
- if (((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP)
- {
- Save_Bitmap_FontAsset(filePath);
- }
- else
- {
- Save_SDF_FontAsset(filePath);
- }
- }
-
-
- void Save_Bitmap_FontAsset(string filePath)
- {
- filePath = filePath.Substring(0, filePath.Length - 6); // Trim file extension from filePath.
-
- string dataPath = Application.dataPath;
-
- if (filePath.IndexOf(dataPath, System.StringComparison.InvariantCultureIgnoreCase) == -1)
- {
- Debug.LogError("You're saving the font asset in a directory outside of this project folder. This is not supported. Please select a directory under \"" + dataPath + "\"");
- return;
- }
-
- string relativeAssetPath = filePath.Substring(dataPath.Length - 6);
- string tex_DirName = Path.GetDirectoryName(relativeAssetPath);
- string tex_FileName = Path.GetFileNameWithoutExtension(relativeAssetPath);
- string tex_Path_NoExt = tex_DirName + "/" + tex_FileName;
-
- // Check if TextMeshPro font asset already exists. If not, create a new one. Otherwise update the existing one.
- TMP_FontAsset fontAsset = AssetDatabase.LoadAssetAtPath(tex_Path_NoExt + ".asset", typeof(TMP_FontAsset)) as TMP_FontAsset;
- if (fontAsset == null)
- {
- //Debug.Log("Creating TextMeshPro font asset!");
- fontAsset = ScriptableObject.CreateInstance<TMP_FontAsset>(); // Create new TextMeshPro Font Asset.
- AssetDatabase.CreateAsset(fontAsset, tex_Path_NoExt + ".asset");
-
- // Set version number of font asset
- fontAsset.version = "1.1.0";
-
- //Set Font Asset Type
- fontAsset.atlasRenderMode = m_GlyphRenderMode;
-
- // Reference to the source font file GUID.
- fontAsset.m_SourceFontFileGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_SourceFontFile));
-
- // Add FaceInfo to Font Asset
- fontAsset.faceInfo = m_FaceInfo;
-
- // Add GlyphInfo[] to Font Asset
- fontAsset.glyphTable = m_FontGlyphTable;
-
- // Add CharacterTable[] to font asset.
- fontAsset.characterTable = m_FontCharacterTable;
-
- // Sort glyph and character tables.
- fontAsset.SortGlyphAndCharacterTables();
-
- // Get and Add Kerning Pairs to Font Asset
- if (m_IncludeFontFeatures)
- fontAsset.fontFeatureTable = GetKerningTable();
-
-
- // Add Font Atlas as Sub-Asset
- fontAsset.atlasTextures = new Texture2D[] { m_FontAtlasTexture };
- m_FontAtlasTexture.name = tex_FileName + " Atlas";
- fontAsset.atlasWidth = m_AtlasWidth;
- fontAsset.atlasHeight = m_AtlasHeight;
- fontAsset.atlasPadding = m_Padding;
-
- AssetDatabase.AddObjectToAsset(m_FontAtlasTexture, fontAsset);
-
- // Create new Material and Add it as Sub-Asset
- Shader default_Shader = Shader.Find("TextMeshPro/Bitmap"); // m_shaderSelection;
- Material tmp_material = new Material(default_Shader);
- tmp_material.name = tex_FileName + " Material";
- tmp_material.SetTexture(ShaderUtilities.ID_MainTex, m_FontAtlasTexture);
- fontAsset.material = tmp_material;
-
- AssetDatabase.AddObjectToAsset(tmp_material, fontAsset);
-
- }
- else
- {
- // Find all Materials referencing this font atlas.
- Material[] material_references = TMP_EditorUtility.FindMaterialReferences(fontAsset);
-
- // Set version number of font asset
- fontAsset.version = "1.1.0";
-
- // Special handling to remove legacy font asset data
- if (fontAsset.m_glyphInfoList != null && fontAsset.m_glyphInfoList.Count > 0)
- fontAsset.m_glyphInfoList = null;
-
- // Destroy Assets that will be replaced.
- if (fontAsset.atlasTextures != null && fontAsset.atlasTextures.Length > 0)
- DestroyImmediate(fontAsset.atlasTextures[0], true);
-
- //Set Font Asset Type
- fontAsset.atlasRenderMode = m_GlyphRenderMode;
-
- // Add FaceInfo to Font Asset
- fontAsset.faceInfo = m_FaceInfo;
-
- // Add GlyphInfo[] to Font Asset
- fontAsset.glyphTable = m_FontGlyphTable;
-
- // Add CharacterTable[] to font asset.
- fontAsset.characterTable = m_FontCharacterTable;
-
- // Sort glyph and character tables.
- fontAsset.SortGlyphAndCharacterTables();
-
- // Get and Add Kerning Pairs to Font Asset
- if (m_IncludeFontFeatures)
- fontAsset.fontFeatureTable = GetKerningTable();
-
- // Add Font Atlas as Sub-Asset
- fontAsset.atlasTextures = new Texture2D[] { m_FontAtlasTexture };
- m_FontAtlasTexture.name = tex_FileName + " Atlas";
- fontAsset.atlasWidth = m_AtlasWidth;
- fontAsset.atlasHeight = m_AtlasHeight;
- fontAsset.atlasPadding = m_Padding;
-
- // Special handling due to a bug in earlier versions of Unity.
- m_FontAtlasTexture.hideFlags = HideFlags.None;
- fontAsset.material.hideFlags = HideFlags.None;
-
- AssetDatabase.AddObjectToAsset(m_FontAtlasTexture, fontAsset);
-
- // Assign new font atlas texture to the existing material.
- fontAsset.material.SetTexture(ShaderUtilities.ID_MainTex, fontAsset.atlasTextures[0]);
-
- // Update the Texture reference on the Material
- for (int i = 0; i < material_references.Length; i++)
- {
- material_references[i].SetTexture(ShaderUtilities.ID_MainTex, m_FontAtlasTexture);
- }
- }
-
- // Add list of GlyphRects to font asset.
- fontAsset.freeGlyphRects = m_FreeGlyphRects;
- fontAsset.usedGlyphRects = m_UsedGlyphRects;
-
- // Save Font Asset creation settings
- m_SelectedFontAsset = fontAsset;
- m_LegacyFontAsset = null;
- fontAsset.creationSettings = SaveFontCreationSettings();
-
- AssetDatabase.SaveAssets();
-
- AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(fontAsset)); // Re-import font asset to get the new updated version.
-
- //EditorUtility.SetDirty(font_asset);
- fontAsset.ReadFontAssetDefinition();
-
- AssetDatabase.Refresh();
-
- m_FontAtlasTexture = null;
-
- // NEED TO GENERATE AN EVENT TO FORCE A REDRAW OF ANY TEXTMESHPRO INSTANCES THAT MIGHT BE USING THIS FONT ASSET
- TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, fontAsset);
- }
-
-
- void Save_SDF_FontAsset(string filePath)
- {
- filePath = filePath.Substring(0, filePath.Length - 6); // Trim file extension from filePath.
-
- string dataPath = Application.dataPath;
-
- if (filePath.IndexOf(dataPath, System.StringComparison.InvariantCultureIgnoreCase) == -1)
- {
- Debug.LogError("You're saving the font asset in a directory outside of this project folder. This is not supported. Please select a directory under \"" + dataPath + "\"");
- return;
- }
-
- string relativeAssetPath = filePath.Substring(dataPath.Length - 6);
- string tex_DirName = Path.GetDirectoryName(relativeAssetPath);
- string tex_FileName = Path.GetFileNameWithoutExtension(relativeAssetPath);
- string tex_Path_NoExt = tex_DirName + "/" + tex_FileName;
-
-
- // Check if TextMeshPro font asset already exists. If not, create a new one. Otherwise update the existing one.
- TMP_FontAsset fontAsset = AssetDatabase.LoadAssetAtPath<TMP_FontAsset>(tex_Path_NoExt + ".asset");
- if (fontAsset == null)
- {
- //Debug.Log("Creating TextMeshPro font asset!");
- fontAsset = ScriptableObject.CreateInstance<TMP_FontAsset>(); // Create new TextMeshPro Font Asset.
- AssetDatabase.CreateAsset(fontAsset, tex_Path_NoExt + ".asset");
-
- // Set version number of font asset
- fontAsset.version = "1.1.0";
-
- // Reference to source font file GUID.
- fontAsset.m_SourceFontFileGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_SourceFontFile));
-
- //Set Font Asset Type
- fontAsset.atlasRenderMode = m_GlyphRenderMode;
-
- // Add FaceInfo to Font Asset
- fontAsset.faceInfo = m_FaceInfo;
-
- // Add GlyphInfo[] to Font Asset
- fontAsset.glyphTable = m_FontGlyphTable;
-
- // Add CharacterTable[] to font asset.
- fontAsset.characterTable = m_FontCharacterTable;
-
- // Sort glyph and character tables.
- fontAsset.SortGlyphAndCharacterTables();
-
- // Get and Add Kerning Pairs to Font Asset
- if (m_IncludeFontFeatures)
- fontAsset.fontFeatureTable = GetKerningTable();
-
- // Add Font Atlas as Sub-Asset
- fontAsset.atlasTextures = new Texture2D[] { m_FontAtlasTexture };
- m_FontAtlasTexture.name = tex_FileName + " Atlas";
- fontAsset.atlasWidth = m_AtlasWidth;
- fontAsset.atlasHeight = m_AtlasHeight;
- fontAsset.atlasPadding = m_Padding;
-
- AssetDatabase.AddObjectToAsset(m_FontAtlasTexture, fontAsset);
-
- // Create new Material and Add it as Sub-Asset
- Shader default_Shader = Shader.Find("TextMeshPro/Distance Field");
- Material tmp_material = new Material(default_Shader);
-
- tmp_material.name = tex_FileName + " Material";
- tmp_material.SetTexture(ShaderUtilities.ID_MainTex, m_FontAtlasTexture);
- tmp_material.SetFloat(ShaderUtilities.ID_TextureWidth, m_FontAtlasTexture.width);
- tmp_material.SetFloat(ShaderUtilities.ID_TextureHeight, m_FontAtlasTexture.height);
-
- int spread = m_Padding + 1;
- tmp_material.SetFloat(ShaderUtilities.ID_GradientScale, spread); // Spread = Padding for Brute Force SDF.
-
- tmp_material.SetFloat(ShaderUtilities.ID_WeightNormal, fontAsset.normalStyle);
- tmp_material.SetFloat(ShaderUtilities.ID_WeightBold, fontAsset.boldStyle);
-
- fontAsset.material = tmp_material;
-
- AssetDatabase.AddObjectToAsset(tmp_material, fontAsset);
-
- }
- else
- {
- // Find all Materials referencing this font atlas.
- Material[] material_references = TMP_EditorUtility.FindMaterialReferences(fontAsset);
-
- // Destroy Assets that will be replaced.
- if (fontAsset.atlasTextures != null && fontAsset.atlasTextures.Length > 0)
- DestroyImmediate(fontAsset.atlasTextures[0], true);
-
- // Set version number of font asset
- fontAsset.version = "1.1.0";
-
- // Special handling to remove legacy font asset data
- if (fontAsset.m_glyphInfoList != null && fontAsset.m_glyphInfoList.Count > 0)
- fontAsset.m_glyphInfoList = null;
-
- //Set Font Asset Type
- fontAsset.atlasRenderMode = m_GlyphRenderMode;
-
- // Add FaceInfo to Font Asset
- fontAsset.faceInfo = m_FaceInfo;
-
- // Add GlyphInfo[] to Font Asset
- fontAsset.glyphTable = m_FontGlyphTable;
-
- // Add CharacterTable[] to font asset.
- fontAsset.characterTable = m_FontCharacterTable;
-
- // Sort glyph and character tables.
- fontAsset.SortGlyphAndCharacterTables();
-
- // Get and Add Kerning Pairs to Font Asset
- // TODO: Check and preserve existing adjustment pairs.
- if (m_IncludeFontFeatures)
- fontAsset.fontFeatureTable = GetKerningTable();
-
- // Add Font Atlas as Sub-Asset
- fontAsset.atlasTextures = new Texture2D[] { m_FontAtlasTexture };
- m_FontAtlasTexture.name = tex_FileName + " Atlas";
- fontAsset.atlasWidth = m_AtlasWidth;
- fontAsset.atlasHeight = m_AtlasHeight;
- fontAsset.atlasPadding = m_Padding;
-
- // Special handling due to a bug in earlier versions of Unity.
- m_FontAtlasTexture.hideFlags = HideFlags.None;
- fontAsset.material.hideFlags = HideFlags.None;
-
- AssetDatabase.AddObjectToAsset(m_FontAtlasTexture, fontAsset);
-
- // Assign new font atlas texture to the existing material.
- fontAsset.material.SetTexture(ShaderUtilities.ID_MainTex, fontAsset.atlasTextures[0]);
-
- // Update the Texture reference on the Material
- for (int i = 0; i < material_references.Length; i++)
- {
- material_references[i].SetTexture(ShaderUtilities.ID_MainTex, m_FontAtlasTexture);
- material_references[i].SetFloat(ShaderUtilities.ID_TextureWidth, m_FontAtlasTexture.width);
- material_references[i].SetFloat(ShaderUtilities.ID_TextureHeight, m_FontAtlasTexture.height);
-
- int spread = m_Padding + 1;
- material_references[i].SetFloat(ShaderUtilities.ID_GradientScale, spread); // Spread = Padding for Brute Force SDF.
-
- material_references[i].SetFloat(ShaderUtilities.ID_WeightNormal, fontAsset.normalStyle);
- material_references[i].SetFloat(ShaderUtilities.ID_WeightBold, fontAsset.boldStyle);
- }
- }
-
- // Saving File for Debug
- //var pngData = destination_Atlas.EncodeToPNG();
- //File.WriteAllBytes("Assets/Textures/Debug Distance Field.png", pngData);
-
- // Add list of GlyphRects to font asset.
- fontAsset.freeGlyphRects = m_FreeGlyphRects;
- fontAsset.usedGlyphRects = m_UsedGlyphRects;
-
- // Save Font Asset creation settings
- m_SelectedFontAsset = fontAsset;
- m_LegacyFontAsset = null;
- fontAsset.creationSettings = SaveFontCreationSettings();
-
- AssetDatabase.SaveAssets();
-
- AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(fontAsset)); // Re-import font asset to get the new updated version.
-
- fontAsset.ReadFontAssetDefinition();
-
- AssetDatabase.Refresh();
-
- m_FontAtlasTexture = null;
-
- // NEED TO GENERATE AN EVENT TO FORCE A REDRAW OF ANY TEXTMESHPRO INSTANCES THAT MIGHT BE USING THIS FONT ASSET
- TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, fontAsset);
- }
-
-
- /// <summary>
- /// Internal method to save the Font Asset Creation Settings
- /// </summary>
- /// <returns></returns>
- FontAssetCreationSettings SaveFontCreationSettings()
- {
- FontAssetCreationSettings settings = new FontAssetCreationSettings();
-
- //settings.sourceFontFileName = m_SourceFontFile.name;
- settings.sourceFontFileGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_SourceFontFile));
- settings.pointSizeSamplingMode = m_PointSizeSamplingMode;
- settings.pointSize = m_PointSize;
- settings.padding = m_Padding;
- settings.packingMode = (int)m_PackingMode;
- settings.atlasWidth = m_AtlasWidth;
- settings.atlasHeight = m_AtlasHeight;
- settings.characterSetSelectionMode = m_CharacterSetSelectionMode;
- settings.characterSequence = m_CharacterSequence;
- settings.referencedFontAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_ReferencedFontAsset));
- settings.referencedTextAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_CharactersFromFile));
- //settings.fontStyle = (int)m_FontStyle;
- //settings.fontStyleModifier = m_FontStyleValue;
- settings.renderMode = (int)m_GlyphRenderMode;
- settings.includeFontFeatures = m_IncludeFontFeatures;
-
- return settings;
- }
-
-
- /// <summary>
- /// Internal method to load the Font Asset Creation Settings
- /// </summary>
- /// <param name="settings"></param>
- void LoadFontCreationSettings(FontAssetCreationSettings settings)
- {
- m_SourceFontFile = AssetDatabase.LoadAssetAtPath<Font>(AssetDatabase.GUIDToAssetPath(settings.sourceFontFileGUID));
- m_PointSizeSamplingMode = settings.pointSizeSamplingMode;
- m_PointSize = settings.pointSize;
- m_Padding = settings.padding;
- m_PackingMode = (FontPackingModes)settings.packingMode;
- m_AtlasWidth = settings.atlasWidth;
- m_AtlasHeight = settings.atlasHeight;
- m_CharacterSetSelectionMode = settings.characterSetSelectionMode;
- m_CharacterSequence = settings.characterSequence;
- m_ReferencedFontAsset = AssetDatabase.LoadAssetAtPath<TMP_FontAsset>(AssetDatabase.GUIDToAssetPath(settings.referencedFontAssetGUID));
- m_CharactersFromFile = AssetDatabase.LoadAssetAtPath<TextAsset>(AssetDatabase.GUIDToAssetPath(settings.referencedTextAssetGUID));
- //m_FontStyle = (FaceStyles)settings.fontStyle;
- //m_FontStyleValue = settings.fontStyleModifier;
- m_GlyphRenderMode = (GlyphRenderMode)settings.renderMode;
- m_IncludeFontFeatures = settings.includeFontFeatures;
- }
-
-
- /// <summary>
- /// Save the latest font asset creation settings to EditorPrefs.
- /// </summary>
- /// <param name="settings"></param>
- void SaveCreationSettingsToEditorPrefs(FontAssetCreationSettings settings)
- {
- // Create new list if one does not already exist
- if (m_FontAssetCreationSettingsContainer == null)
- {
- m_FontAssetCreationSettingsContainer = new FontAssetCreationSettingsContainer();
- m_FontAssetCreationSettingsContainer.fontAssetCreationSettings = new List<FontAssetCreationSettings>();
- }
-
- // Add new creation settings to the list
- m_FontAssetCreationSettingsContainer.fontAssetCreationSettings.Add(settings);
-
- // Since list should only contain the most 4 recent settings, we remove the first element if list exceeds 4 elements.
- if (m_FontAssetCreationSettingsContainer.fontAssetCreationSettings.Count > 4)
- m_FontAssetCreationSettingsContainer.fontAssetCreationSettings.RemoveAt(0);
-
- m_FontAssetCreationSettingsCurrentIndex = m_FontAssetCreationSettingsContainer.fontAssetCreationSettings.Count - 1;
-
- // Serialize list to JSON
- string serializedSettings = JsonUtility.ToJson(m_FontAssetCreationSettingsContainer, true);
-
- EditorPrefs.SetString(k_FontAssetCreationSettingsContainerKey, serializedSettings);
- }
-
- void DrawPreview()
- {
- Rect pixelRect;
- if (position.width > position.height && position.width > k_TwoColumnControlsWidth)
- {
- float minSide = Mathf.Min(position.height - 15f, position.width - k_TwoColumnControlsWidth);
-
- EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.MaxWidth(minSide));
-
- pixelRect = GUILayoutUtility.GetRect(minSide, minSide, GUILayout.ExpandHeight(false), GUILayout.ExpandWidth(false));
- }
- else
- {
- EditorGUILayout.BeginVertical(EditorStyles.helpBox);
-
- pixelRect = GUILayoutUtility.GetAspectRect(1f);
- }
-
- if (m_FontAtlasTexture != null)
- {
- EditorGUI.DrawTextureAlpha(pixelRect, m_FontAtlasTexture, ScaleMode.StretchToFill);
- }
- else if (m_SavedFontAtlas != null)
- {
- EditorGUI.DrawTextureAlpha(pixelRect, m_SavedFontAtlas, ScaleMode.StretchToFill);
- }
-
- EditorGUILayout.EndVertical();
- }
-
-
- void CheckForLegacyGlyphRenderMode()
- {
- // Special handling for legacy glyph render mode
- if ((int)m_GlyphRenderMode < 0x100)
- {
- switch ((int)m_GlyphRenderMode)
- {
- case 0:
- m_GlyphRenderMode = GlyphRenderMode.SMOOTH_HINTED;
- break;
- case 1:
- m_GlyphRenderMode = GlyphRenderMode.SMOOTH;
- break;
- case 2:
- m_GlyphRenderMode = GlyphRenderMode.RASTER_HINTED;
- break;
- case 3:
- m_GlyphRenderMode = GlyphRenderMode.RASTER;
- break;
- case 6:
- case 7:
- m_GlyphRenderMode = GlyphRenderMode.SDFAA;
- break;
- }
- }
- }
-
-
- // Get Kerning Pairs
- public TMP_FontFeatureTable GetKerningTable()
- {
- GlyphPairAdjustmentRecord[] adjustmentRecords = FontEngine.GetGlyphPairAdjustmentTable(m_AvailableGlyphsToAdd.ToArray());
-
- if (adjustmentRecords == null)
- return null;
-
- TMP_FontFeatureTable fontFeatureTable = new TMP_FontFeatureTable();
-
- for (int i = 0; i < adjustmentRecords.Length; i++)
- {
- fontFeatureTable.glyphPairAdjustmentRecords.Add(new TMP_GlyphPairAdjustmentRecord(adjustmentRecords[i]));
- }
-
- fontFeatureTable.SortGlyphPairAdjustmentRecords();
-
- return fontFeatureTable;
- }
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs.meta
deleted file mode 100644
index aa7176f..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 383966e89d344865a36addd5d378ffd3
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontPlugin.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontPlugin.cs
deleted file mode 100644
index 4ff58ad..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontPlugin.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-using System;
-using System.Runtime.InteropServices;
-
-
-namespace TMPro.EditorUtilities
-{
- /*
- public class TMPro_FontPlugin
- {
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void DebugLog(string log);
- private static readonly DebugLog debugLog = DebugWrapper;
- private static readonly IntPtr functionPointer = Marshal.GetFunctionPointerForDelegate(debugLog);
-
- private static void DebugWrapper(string log)
- {
- Debug.Log(log);
- }
-
- public static void LinkDebugLog()
- {
- LinkDebug(functionPointer);
- }
-
- [DllImport("TMPro_Plugin")]
- private static extern void LinkDebug([MarshalAs(UnmanagedType.FunctionPtr)]IntPtr debugCall);
-
- [DllImport("TMPro_Plugin")]
- public static extern
- int Initialize_FontEngine();
-
- [DllImport("TMPro_Plugin")]
- public static extern
- int Destroy_FontEngine();
-
- [DllImport("TMPro_Plugin")]
- public static extern
- int Load_TrueType_Font(string fontPath);
-
- [DllImport("TMPro_Plugin")]
- public static extern
- int FT_Size_Font(int fontSize);
-
- [DllImport("TMPro_Plugin")]
- public static extern
- int Render_Character(byte[] buffer_fill, byte[] buffer_edge, int buffer_width, int buffer_height, int offset, int asc, FaceStyles style, float thickness, RenderModes rasterMode, ref FT_GlyphInfo glyphInfo);
-
- [DllImport("TMPro_Plugin")]
- public static extern
- int Render_Characters(byte[] buffer, int buffer_width, int buffer_height, int character_padding, int[] asc_set, int char_count, FaceStyles style, float style_mod, bool autoSize, RenderModes renderMode, int method, ref FT_FaceInfo fontData, FT_GlyphInfo[] Output);
-
- [DllImport("TMPro_Plugin")]
- public static extern
- int FT_GetKerningPairs(string fontPath, int[] characterSet, int setCount, FT_KerningPair[] kerningPairs);
-
- [DllImport("TMPro_Plugin")]
- public static extern
- float Check_RenderProgress();
-
- [DllImport("TMPro_Plugin")]
- internal static extern
- void SendCancellationRequest(CancellationRequestType request);
- }
-
- public enum FaceStyles { Normal, Bold, Italic, Bold_Italic, Outline, Bold_Sim };
- public enum RenderModes { HintedSmooth = 0, Smooth = 1, RasterHinted = 2, Raster = 3, DistanceField16 = 6, DistanceField32 = 7 }; // SignedDistanceField64 = 8
-
- internal enum CancellationRequestType : byte { None = 0x0, CancelInProgess = 0x1, WindowClosed = 0x2 };
-
- [StructLayout(LayoutKind.Sequential)]
- public struct FT_KerningPair
- {
- public int ascII_Left;
- public int ascII_Right;
- public float xAdvanceOffset;
- }
-
-
- [StructLayout(LayoutKind.Sequential)]
- public struct FT_GlyphInfo
- {
- public int id;
- public float x;
- public float y;
- public float width;
- public float height;
- public float xOffset;
- public float yOffset;
- public float xAdvance;
- }
-
-
- [StructLayout(LayoutKind.Sequential)]
- public struct FT_FaceInfo
- {
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
- public string name;
- public int pointSize;
- public int padding;
- public float lineHeight;
- public float baseline;
- public float ascender;
- public float descender;
- public float centerLine;
- public float underline;
- public float underlineThickness;
- public int characterCount;
- public int atlasWidth;
- public int atlasHeight;
- }
- */
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontPlugin.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontPlugin.cs.meta
deleted file mode 100644
index a6afabd..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_FontPlugin.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 9edc9283e7d6409fab242fe8fb6a822c
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_SortingLayerHelper.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_SortingLayerHelper.cs
deleted file mode 100644
index ca0ba18..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_SortingLayerHelper.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2014, Nick Gravelyn.
- *
- * This software is provided 'as-is', without any express or implied
- * warranty. In no event will the authors be held liable for any damages
- * arising from the use of this software.
- *
- * Permission is granted to anyone to use this software for any purpose,
- * including commercial applications, and to alter it and redistribute it
- * freely, subject to the following restrictions:
- *
- * 1. The origin of this software must not be misrepresented; you must not
- * claim that you wrote the original software. If you use this software
- * in a product, an acknowledgment in the product documentation would be
- * appreciated but is not required.
- *
- * 2. Altered source versions must be plainly marked as such, and must not be
- * misrepresented as being the original software.
- *
- * 3. This notice may not be removed or altered from any source
- * distribution.
- */
-
-using UnityEngine;
-using UnityEditor;
-using System;
-using System.Reflection;
-
-namespace TMPro
-{
- // Helpers used by the different sorting layer classes.
- public static class SortingLayerHelper
- {
- private static Type _utilityType;
- private static PropertyInfo _sortingLayerNamesProperty;
- private static MethodInfo _getSortingLayerUserIdMethod;
-
- static SortingLayerHelper()
- {
- _utilityType = Type.GetType("UnityEditorInternal.InternalEditorUtility, UnityEditor");
- _sortingLayerNamesProperty = _utilityType.GetProperty("sortingLayerNames", BindingFlags.Static | BindingFlags.NonPublic);
- _getSortingLayerUserIdMethod = _utilityType.GetMethod("GetSortingLayerUniqueID", BindingFlags.Static | BindingFlags.NonPublic);
- }
-
- // Gets an array of sorting layer names.
- // Since this uses reflection, callers should check for 'null' which will be returned if the reflection fails.
- public static string[] sortingLayerNames
- {
- get
- {
- if (_sortingLayerNamesProperty == null)
- {
- return null;
- }
-
- return _sortingLayerNamesProperty.GetValue(null, null) as string[];
- }
- }
-
- // Given the ID of a sorting layer, returns the sorting layer's name
- public static string GetSortingLayerNameFromID(int id)
- {
- string[] names = sortingLayerNames;
- if (names == null)
- {
- return null;
- }
-
- for (int i = 0; i < names.Length; i++)
- {
- if (GetSortingLayerIDForIndex(i) == id)
- {
- return names[i];
- }
- }
-
- return null;
- }
-
- // Given the name of a sorting layer, returns the ID.
- public static int GetSortingLayerIDForName(string name)
- {
- string[] names = sortingLayerNames;
- if (names == null)
- {
- return 0;
- }
-
- return GetSortingLayerIDForIndex(Array.IndexOf(names, name));
- }
-
- // Helper to convert from a sorting layer INDEX to a sorting layer ID. These are not the same thing.
- // IDs are based on the order in which layers were created and do not change when reordering the layers.
- // Thankfully there is a private helper we can call to get the ID for a layer given its index.
- public static int GetSortingLayerIDForIndex(int index)
- {
- if (_getSortingLayerUserIdMethod == null)
- {
- return 0;
- }
-
- return (int)_getSortingLayerUserIdMethod.Invoke(null, new object[] { index });
- }
- }
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_SortingLayerHelper.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_SortingLayerHelper.cs.meta
deleted file mode 100644
index e959de6..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_SortingLayerHelper.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 88ed537c17c34f339121fe9a7d6d7a0e
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TextContainerEditor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TextContainerEditor.cs
deleted file mode 100644
index cdeb623..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TextContainerEditor.cs
+++ /dev/null
@@ -1,235 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
- [CustomEditor(typeof(TextContainer)), CanEditMultipleObjects]
- public class TMPro_TextContainerEditor : Editor
- {
-
- // Serialized Properties
- private SerializedProperty anchorPosition_prop;
- private SerializedProperty pivot_prop;
- private SerializedProperty rectangle_prop;
- private SerializedProperty margins_prop;
-
-
- private TextContainer m_textContainer;
- //private Transform m_transform;
- //private Vector3[] m_Rect_handlePoints = new Vector3[4];
- //private Vector3[] m_Margin_handlePoints = new Vector3[4];
-
- //private Vector2 m_anchorPosition;
-
- //private Vector3 m_mousePreviousPOS;
- //private Vector2 m_previousStartPOS;
- //private int m_mouseDragFlag = 0;
-
- //private static Transform m_visualHelper;
-
-
- void OnEnable()
- {
-
- // Serialized Properties
- anchorPosition_prop = serializedObject.FindProperty("m_anchorPosition");
- pivot_prop = serializedObject.FindProperty("m_pivot");
- rectangle_prop = serializedObject.FindProperty("m_rect");
- margins_prop = serializedObject.FindProperty("m_margins");
-
- m_textContainer = (TextContainer)target;
- //m_transform = m_textContainer.transform;
-
-
- /*
- if (m_visualHelper == null)
- {
- m_visualHelper = GameObject.CreatePrimitive(PrimitiveType.Sphere).transform;
- m_visualHelper.localScale = new Vector3(0.25f, 0.25f, 0.25f);
- }
- */
- }
-
- void OnDisable()
- {
- /*
- if (m_visualHelper != null)
- DestroyImmediate (m_visualHelper.gameObject);
- */
- }
-
-
-
-
- public override void OnInspectorGUI()
- {
- serializedObject.Update();
-
- EditorGUI.BeginChangeCheck();
- EditorGUILayout.PropertyField(anchorPosition_prop);
- if (anchorPosition_prop.enumValueIndex == 9)
- {
- EditorGUI.indentLevel += 1;
- EditorGUILayout.PropertyField(pivot_prop, new GUIContent("Pivot Position"));
- EditorGUI.indentLevel -= 1;
- }
-
-
- DrawDimensionProperty(rectangle_prop, "Dimensions");
- DrawMaginProperty(margins_prop, "Margins");
- if (EditorGUI.EndChangeCheck())
- {
- // Re-compute pivot position when changes are made.
- if (anchorPosition_prop.enumValueIndex != 9)
- pivot_prop.vector2Value = GetAnchorPosition(anchorPosition_prop.enumValueIndex);
-
- m_textContainer.hasChanged = true;
- }
-
- serializedObject.ApplyModifiedProperties();
-
- EditorGUILayout.Space();
- }
-
-
- private void DrawDimensionProperty(SerializedProperty property, string label)
- {
- float old_LabelWidth = EditorGUIUtility.labelWidth;
- float old_FieldWidth = EditorGUIUtility.fieldWidth;
-
- Rect rect = EditorGUILayout.GetControlRect(false, 18);
- Rect pos0 = new Rect(rect.x, rect.y + 2, rect.width, 18);
-
- float width = rect.width + 3;
- pos0.width = old_LabelWidth;
- GUI.Label(pos0, label);
-
- Rect rectangle = property.rectValue;
-
- float width_B = width - old_LabelWidth;
- float fieldWidth = width_B / 4;
- pos0.width = fieldWidth - 5;
-
- pos0.x = old_LabelWidth + 15;
- GUI.Label(pos0, "Width");
-
- pos0.x += fieldWidth;
- rectangle.width = EditorGUI.FloatField(pos0, GUIContent.none, rectangle.width);
-
- pos0.x += fieldWidth;
- GUI.Label(pos0, "Height");
-
- pos0.x += fieldWidth;
- rectangle.height = EditorGUI.FloatField(pos0, GUIContent.none, rectangle.height);
-
- property.rectValue = rectangle;
- EditorGUIUtility.labelWidth = old_LabelWidth;
- EditorGUIUtility.fieldWidth = old_FieldWidth;
- }
-
-
- private void DrawMaginProperty(SerializedProperty property, string label)
- {
- float old_LabelWidth = EditorGUIUtility.labelWidth;
- float old_FieldWidth = EditorGUIUtility.fieldWidth;
-
- Rect rect = EditorGUILayout.GetControlRect(false, 2 * 18);
- Rect pos0 = new Rect(rect.x, rect.y + 2, rect.width, 18);
-
- float width = rect.width + 3;
- pos0.width = old_LabelWidth;
- GUI.Label(pos0, label);
-
- //Vector4 vec = property.vector4Value;
- Vector4 vec = Vector4.zero;
- vec.x = property.FindPropertyRelative("x").floatValue;
- vec.y = property.FindPropertyRelative("y").floatValue;
- vec.z = property.FindPropertyRelative("z").floatValue;
- vec.w = property.FindPropertyRelative("w").floatValue;
-
-
- float widthB = width - old_LabelWidth;
- float fieldWidth = widthB / 4;
- pos0.width = fieldWidth - 5;
-
- // Labels
- pos0.x = old_LabelWidth + 15;
- GUI.Label(pos0, "Left");
-
- pos0.x += fieldWidth;
- GUI.Label(pos0, "Top");
-
- pos0.x += fieldWidth;
- GUI.Label(pos0, "Right");
-
- pos0.x += fieldWidth;
- GUI.Label(pos0, "Bottom");
-
- pos0.y += 18;
-
- pos0.x = old_LabelWidth + 15;
- vec.x = EditorGUI.FloatField(pos0, GUIContent.none, vec.x);
-
- pos0.x += fieldWidth;
- vec.y = EditorGUI.FloatField(pos0, GUIContent.none, vec.y);
-
- pos0.x += fieldWidth;
- vec.z = EditorGUI.FloatField(pos0, GUIContent.none, vec.z);
-
- pos0.x += fieldWidth;
- vec.w = EditorGUI.FloatField(pos0, GUIContent.none, vec.w);
-
- //property.vector4Value = vec;
- property.FindPropertyRelative("x").floatValue = vec.x;
- property.FindPropertyRelative("y").floatValue = vec.y;
- property.FindPropertyRelative("z").floatValue = vec.z;
- property.FindPropertyRelative("w").floatValue = vec.w;
-
- EditorGUIUtility.labelWidth = old_LabelWidth;
- EditorGUIUtility.fieldWidth = old_FieldWidth;
- }
-
-
- Vector2 GetAnchorPosition(int index)
- {
- Vector2 anchorPosition = Vector2.zero;
-
- switch (index)
- {
- case 0: // TOP LEFT
- anchorPosition = new Vector2(0, 1);
- break;
- case 1: // TOP
- anchorPosition = new Vector2(0.5f, 1);
- break;
- case 2: // TOP RIGHT
- anchorPosition = new Vector2(1, 1);
- break;
- case 3: // LEFT
- anchorPosition = new Vector2(0, 0.5f);
- break;
- case 4: // MIDDLE
- anchorPosition = new Vector2(0.5f, 0.5f);
- break;
- case 5: // RIGHT
- anchorPosition = new Vector2(1, 0.5f);
- break;
- case 6: // BOTTOM LEFT
- anchorPosition = new Vector2(0, 0);
- break;
- case 7: // BOTTOM
- anchorPosition = new Vector2(0.5f, 0);
- break;
- case 8: // BOTTOM RIGHT
- anchorPosition = new Vector2(1, 0);
- break;
- }
-
- return anchorPosition;
- }
-
-
- }
-}
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TextContainerEditor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TextContainerEditor.cs.meta
deleted file mode 100644
index 03c0dee..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TextContainerEditor.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 02893ffb522b490a9fa28eedd2584309
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TexturePostProcessor.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TexturePostProcessor.cs
deleted file mode 100644
index adbaecf..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TexturePostProcessor.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-
-
-namespace TMPro.EditorUtilities
-{
-
- public class TMPro_TexturePostProcessor : AssetPostprocessor
- {
-
- void OnPostprocessTexture(Texture2D texture)
- {
- //var importer = assetImporter as TextureImporter;
-
- Texture2D tex = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture2D)) as Texture2D;
-
- // Send Event Sub Objects
- if (tex != null)
- TMPro_EventManager.ON_SPRITE_ASSET_PROPERTY_CHANGED(true, tex);
- }
-
- }
-
-
- //public class TMPro_PackageImportPostProcessor : AssetPostprocessor
- //{
- // static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
- // {
- // for (int i = 0; i < importedAssets.Length; i++)
- // {
- // if (importedAssets[i].Contains("TextMesh Pro/Resources/TMP Settings.asset"))
- // {
- // Debug.Log("New TMP Settings file was just imported.");
-
- // // TMP Settings file was just re-imported.
- // // Check if project already contains
- // }
-
-
- // if (importedAssets[i].Contains("com.unity.TextMeshPro/Examples"))
- // {
- // //Debug.Log("New TMP Examples folder was just imported.");
- // }
-
- // //Debug.Log("[" + importedAssets[i] + "] was just imported.");
- // }
-
-
-
- // //for (int i = 0; i < deletedAssets.Length; i++)
- // //{
- // // if (deletedAssets[i] == "Assets/TextMesh Pro")
- // // {
- // // //Debug.Log("Asset [" + deletedAssets[i] + "] has been deleted.");
- // // string currentBuildSettings = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
-
- // // //Check for and inject TMP_PRESENT
- // // if (currentBuildSettings.Contains("TMP_PRESENT;"))
- // // {
- // // currentBuildSettings = currentBuildSettings.Replace("TMP_PRESENT;", "");
-
- // // PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, currentBuildSettings);
- // // }
- // // else if (currentBuildSettings.Contains("TMP_PRESENT"))
- // // {
- // // currentBuildSettings = currentBuildSettings.Replace("TMP_PRESENT", "");
-
- // // PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, currentBuildSettings);
- // // }
- // // }
- // //}
- // }
- //}
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TexturePostProcessor.cs.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TexturePostProcessor.cs.meta
deleted file mode 100644
index c10f584..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMPro_TexturePostProcessor.cs.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: f4935fb862d54980b1bcbca942962642
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/Unity.TextMeshPro.Editor.asmdef b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/Unity.TextMeshPro.Editor.asmdef
deleted file mode 100644
index d0af0f6..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/Unity.TextMeshPro.Editor.asmdef
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name": "Unity.TextMeshPro.Editor",
- "references": [
- "Unity.TextMeshPro",
- "Unity.ugui",
- "Unity.ugui.Editor"
- ],
- "optionalUnityReferences": [],
- "includePlatforms": [
- "Editor"
- ],
- "excludePlatforms": []
-} \ No newline at end of file
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/Unity.TextMeshPro.Editor.asmdef.meta b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/Unity.TextMeshPro.Editor.asmdef.meta
deleted file mode 100644
index 3ff293e..0000000
--- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/Unity.TextMeshPro.Editor.asmdef.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 6546d7765b4165b40850b3667f981c26
-AssemblyDefinitionImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant: