From 926becd894d40112216a2062741c15e7dc7a5800 Mon Sep 17 00:00:00 2001 From: Unity Technologies <@unity.com> Date: Tue, 23 Jan 2018 00:00:00 +0100 Subject: [PATCH] com.unity.textmeshpro@1.2.0 ## [1.2.0] - 2018-01-23 ### Changes - Package version # increased to 1.2.0 which is the first release for Unity 2018.2. --- CHANGELOG.md | 11 +++++ Documentation/TextMeshPro.md | 4 +- Scripts/Editor/TMP_PostBuildProcessHandler.cs | 42 ++++++++++++++++++- Scripts/Editor/TMP_UiEditorPanel.cs | 2 +- Scripts/Runtime/TMP_Dropdown.cs | 2 +- Scripts/Runtime/TMP_InputField.cs | 2 + Scripts/Runtime/TMP_SubMesh.cs | 2 +- Scripts/Runtime/TMP_SubMeshUI.cs | 2 +- Scripts/Runtime/TMPro_Private.cs | 2 +- Scripts/Runtime/TMPro_UGUI_Private.cs | 2 +- package.json | 4 +- 11 files changed, 64 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4581cf3..609b42d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,17 @@ This is the release of the TextMesh Pro UPM package. This release is the equival See the following link for the Release Notes for version 1.0.56.xx.0b2 of TextMesh Pro. http://digitalnativestudios.com/forum/index.php?topic=1363.0 +## [1.2.0] - 2018-01-23 +### Changes +- Package version # increased to 1.2.0 which is the first release for Unity 2018.2. + +## [1.0.27] - 2018-01-16 +### Changes +- Fixed an issue where setting the TMP_InputField.text property to null would result in an error. +- Fixed issue with Raycast Target state not getting serialized properly when saving / reloading a scene. +- Changed reference to PrefabUtility.GetPrefabParent() to PrefabUtility.GetCorrespondingObjectFromSource() to reflect public API change in 2018.2 +- Option to import package essential resources will only be presented to users when accessing a TMP component or the TMP Settings file via the project menu. + ## [1.0.26] - 2018-01-10 ### Added - Removed Tizen player references in the TMP_InputField as the Tizen player is no longer supported as of Unity 2018.1. diff --git a/Documentation/TextMeshPro.md b/Documentation/TextMeshPro.md index f19be20..8f8c092 100644 --- a/Documentation/TextMeshPro.md +++ b/Documentation/TextMeshPro.md @@ -1,9 +1,9 @@ # **_TextMesh Pro User Guide_** -####**Overview** +#### **Overview** This User Guide was designed to provide first time users of TextMesh Pro with a basic overview of the features and functionality of the tool. -####**Installation** +#### **Installation** The TextMesh Pro UPM package is already included with the Unity Editor and as such does not require installation. TextMesh Pro "TMP" does however require adding resources to your project which are essential for using TextMesh Pro. To import the "*TMP Essential Resources*", please use the "*Window -> TextMeshPro -> Import TMP Essential Resources*" menu option. These resources will be added at the root of your project in the "*TextMesh Pro*" folder. diff --git a/Scripts/Editor/TMP_PostBuildProcessHandler.cs b/Scripts/Editor/TMP_PostBuildProcessHandler.cs index 5f05fbf..a8b800a 100644 --- a/Scripts/Editor/TMP_PostBuildProcessHandler.cs +++ b/Scripts/Editor/TMP_PostBuildProcessHandler.cs @@ -11,7 +11,8 @@ public class TMP_PostBuildProcessHandler [PostProcessBuildAttribute(10000)] public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { - if (target == BuildTarget.iOS && TMP_Settings.enableEmojiSupport) + // 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); @@ -19,5 +20,44 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj 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/Scripts/Editor/TMP_UiEditorPanel.cs b/Scripts/Editor/TMP_UiEditorPanel.cs index 399374f..62dc0b4 100644 --- a/Scripts/Editor/TMP_UiEditorPanel.cs +++ b/Scripts/Editor/TMP_UiEditorPanel.cs @@ -711,7 +711,7 @@ public override void OnInspectorGUI() { // Change needs to propagate to the child sub objects. Graphic[] graphicComponents = m_textComponent.GetComponentsInChildren(); - for (int i = 0; i < graphicComponents.Length; i++) + for (int i = 1; i < graphicComponents.Length; i++) graphicComponents[i].raycastTarget = raycastTarget_prop.boolValue; havePropertiesChanged = true; diff --git a/Scripts/Runtime/TMP_Dropdown.cs b/Scripts/Runtime/TMP_Dropdown.cs index 053e3a0..3b588f1 100644 --- a/Scripts/Runtime/TMP_Dropdown.cs +++ b/Scripts/Runtime/TMP_Dropdown.cs @@ -612,7 +612,7 @@ public void Hide() private IEnumerator DelayedDestroyDropdownList(float delay) { - yield return new WaitForSecondsRealtime(delay); // Unity 5.4 + yield return new WaitForSecondsRealtime(delay); for (int i = 0; i < m_Items.Count; i++) { diff --git a/Scripts/Runtime/TMP_InputField.cs b/Scripts/Runtime/TMP_InputField.cs index 2067ffb..4d372a6 100644 --- a/Scripts/Runtime/TMP_InputField.cs +++ b/Scripts/Runtime/TMP_InputField.cs @@ -352,6 +352,8 @@ public string text if (this.text == value) return; + if (value == null) value = string.Empty; + m_Text = value; //if (m_LineType == LineType.SingleLine) diff --git a/Scripts/Runtime/TMP_SubMesh.cs b/Scripts/Runtime/TMP_SubMesh.cs index e9e9a54..9a547d4 100644 --- a/Scripts/Runtime/TMP_SubMesh.cs +++ b/Scripts/Runtime/TMP_SubMesh.cs @@ -309,7 +309,7 @@ void ON_MATERIAL_PROPERTY_CHANGED(bool isChanged, Material mat) void ON_DRAG_AND_DROP_MATERIAL(GameObject obj, Material currentMaterial, Material newMaterial) { // Check if event applies to this current object - if (obj == gameObject || UnityEditor.PrefabUtility.GetPrefabParent(gameObject) == obj) + if (obj == gameObject || UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(gameObject) == obj) { if (!m_isDefaultMaterial) return; diff --git a/Scripts/Runtime/TMP_SubMeshUI.cs b/Scripts/Runtime/TMP_SubMeshUI.cs index bf9957b..db0cfdf 100644 --- a/Scripts/Runtime/TMP_SubMeshUI.cs +++ b/Scripts/Runtime/TMP_SubMeshUI.cs @@ -400,7 +400,7 @@ void ON_MATERIAL_PROPERTY_CHANGED(bool isChanged, Material mat) void ON_DRAG_AND_DROP_MATERIAL(GameObject obj, Material currentMaterial, Material newMaterial) { // Check if event applies to this current object - if (obj == gameObject || UnityEditor.PrefabUtility.GetPrefabParent(gameObject) == obj) + if (obj == gameObject || UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(gameObject) == obj) { if (!m_isDefaultMaterial) return; diff --git a/Scripts/Runtime/TMPro_Private.cs b/Scripts/Runtime/TMPro_Private.cs index f4ffeda..ae5e7d5 100644 --- a/Scripts/Runtime/TMPro_Private.cs +++ b/Scripts/Runtime/TMPro_Private.cs @@ -376,7 +376,7 @@ void ON_DRAG_AND_DROP_MATERIAL(GameObject obj, Material currentMaterial, Materia //Debug.Log("Drag-n-Drop Event - Receiving Object ID " + GetInstanceID()); // + ". Target Object ID " + obj.GetInstanceID() + ". New Material is " + mat.name + " with ID " + mat.GetInstanceID() + ". Base Material is " + m_baseMaterial.name + " with ID " + m_baseMaterial.GetInstanceID()); // Check if event applies to this current object - if (obj == gameObject || UnityEditor.PrefabUtility.GetPrefabParent(gameObject) == obj) + if (obj == gameObject || UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(gameObject) == obj) { UnityEditor.Undo.RecordObject(this, "Material Assignment"); UnityEditor.Undo.RecordObject(m_renderer, "Material Assignment"); diff --git a/Scripts/Runtime/TMPro_UGUI_Private.cs b/Scripts/Runtime/TMPro_UGUI_Private.cs index 5b87b33..6863f91 100644 --- a/Scripts/Runtime/TMPro_UGUI_Private.cs +++ b/Scripts/Runtime/TMPro_UGUI_Private.cs @@ -440,7 +440,7 @@ void ON_DRAG_AND_DROP_MATERIAL(GameObject obj, Material currentMaterial, Materia //Debug.Log("Drag-n-Drop Event - Receiving Object ID " + GetInstanceID() + ". Sender ID " + obj.GetInstanceID()); // + ". Prefab Parent is " + UnityEditor.PrefabUtility.GetPrefabParent(gameObject).GetInstanceID()); // + ". New Material is " + newMaterial.name + " with ID " + newMaterial.GetInstanceID() + ". Base Material is " + m_baseMaterial.name + " with ID " + m_baseMaterial.GetInstanceID()); // Check if event applies to this current object - if (obj == gameObject || UnityEditor.PrefabUtility.GetPrefabParent(gameObject) == obj) + if (obj == gameObject || UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(gameObject) == obj) { UnityEditor.Undo.RecordObject(this, "Material Assignment"); UnityEditor.Undo.RecordObject(m_canvasRenderer, "Material Assignment"); diff --git a/package.json b/package.json index bc8f6b3..ce50f0a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.textmeshpro", - "version": "1.0.26", - "unity": "2018.1", + "version": "1.2.0", + "unity": "2018.2", "description": "TextMesh Pro is the ultimate text solution for Unity. It's the perfect replacement for Unity's UI Text and the legacy Text Mesh.\n\nPowerful and easy to use, TextMesh Pro uses Advanced Text Rendering techniques along with a set of custom shaders; delivering substantial visual quality improvements while giving users incredible flexibility when it comes to text styling and texturing.\n\nTextMesh Pro provides Improved Control over text formatting and layout with features like character, word, line and paragraph spacing, kerning, justified text, Links, over 30 Rich Text Tags available, support for Multi Font & Sprites, Custom Styles and more.\n\nGreat performance. Since the geometry created by TextMesh Pro uses two triangles per character just like Unity's text components, this improved visual quality and flexibility comes at no additional performance cost.", "keywords": [ "TextMeshPro", "TextMesh Pro", "Text", "SDF" ], "category": "Text Rendering",