Skip to content

Commit dd763aa

Browse files
author
Unity Technologies
committed
com.unity.textmeshpro@2.1.0-preview.14
## [2.1.0-preview.14] - 2020-06-08
1 parent 88be79d commit dd763aa

16 files changed

+254
-127
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Changelog
22
These are the release notes for the TextMesh Pro UPM package which was first introduced with Unity 2018.1. Please see the following link for the Release Notes for prior versions of TextMesh Pro. http://digitalnativestudios.com/forum/index.php?topic=1363.0
33

4+
## [2.1.0-preview.14] - 2020-06-08
5+
## [1.5.0-preview.14]
6+
## [3.0.0-preview.14]
7+
### Changes
8+
- Fixed sprite character and sprite glyph scale not being reflected in the text layout. See [forum post](https://forum.unity.com/threads/glyph-scale-dont-change-line-height.898817/) for details.
9+
- Fixed potential null reference exception in the CrossFadeColor or CrossFadeAlpha functions. See [forum post](https://forum.unity.com/threads/version-1-5-0-2-1-0-3-0-0-preview-13-now-available-for-testing.753587/page-4#post-5885075) for details.
10+
- Minor improvements to the Sprite Asset Importer to improve allocations and address potential error encountered when creating multiple sprite assets.
11+
- TMP GUID Remapping Tool - Removed "UnityEditor.Animations.AnimatorController" from the exclusion search list.
12+
- Fixed potential culling issue when dynamically updating the content of child text objects of RectMask2D components. Case #1253625
13+
- Fixed InvalidOperationException that could occur when changing text Overflow linked components via code. Case #1251283
14+
415
## [2.1.0-preview.13] - 2020-05-22
516
## [1.5.0-preview.13]
617
## [3.0.0-preview.13]

Scripts/Editor/TMP_PackageUtilities.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ static void ShowConverterWindow()
7272
typeof(Texture2D),
7373
typeof(Texture2DArray),
7474
typeof(Texture3D),
75-
typeof(UnityEditor.Animations.AnimatorController),
7675
typeof(UnityEditorInternal.AssemblyDefinitionAsset),
7776
typeof(UnityEngine.AI.NavMeshData),
7877
typeof(UnityEngine.Tilemaps.Tile),

Scripts/Editor/TMP_SpriteAssetImporter.cs

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using UnityEngine;
1+
using System;
2+
using UnityEngine;
23
using UnityEngine.TextCore;
34
using UnityEditor;
45
using System.IO;
@@ -28,19 +29,36 @@ public static void ShowFontAtlasCreatorWindow()
2829
TMP_SpriteAsset m_SpriteAsset;
2930
List<TMP_Sprite> m_SpriteInfoList = new List<TMP_Sprite>();
3031

31-
32+
/// <summary>
33+
///
34+
/// </summary>
3235
void OnEnable()
3336
{
3437
// Set Editor Window Size
3538
SetEditorWindowSize();
3639
}
3740

41+
/// <summary>
42+
///
43+
/// </summary>
3844
public void OnGUI()
3945
{
4046
DrawEditorPanel();
4147
}
4248

49+
/// <summary>
50+
///
51+
/// </summary>
52+
private void OnDisable()
53+
{
54+
// Clean up sprite asset object that may have been created and not saved.
55+
if (m_SpriteAsset != null && !EditorUtility.IsPersistent(m_SpriteAsset))
56+
DestroyImmediate(m_SpriteAsset);
57+
}
4358

59+
/// <summary>
60+
///
61+
/// </summary>
4462
void DrawEditorPanel()
4563
{
4664
// label
@@ -70,6 +88,10 @@ void DrawEditorPanel()
7088
{
7189
m_CreationFeedback = string.Empty;
7290

91+
// Clean up sprite asset object that may have been previously created.
92+
if (m_SpriteAsset != null && !EditorUtility.IsPersistent(m_SpriteAsset))
93+
DestroyImmediate(m_SpriteAsset);
94+
7395
// Read json data file
7496
if (m_JsonFile != null)
7597
{
@@ -94,9 +116,6 @@ void DrawEditorPanel()
94116
m_CreationFeedback = "<b>Import Results</b>\n--------------------\n";
95117
m_CreationFeedback += "<color=#C0ffff><b>" + spriteCount + "</b></color> Sprites were imported from file.";
96118

97-
if (m_SpriteAsset != null)
98-
DestroyImmediate(m_SpriteAsset);
99-
100119
// Create new Sprite Asset
101120
m_SpriteAsset = CreateInstance<TMP_SpriteAsset>();
102121

@@ -122,7 +141,7 @@ void DrawEditorPanel()
122141
GUILayout.Space(5);
123142
GUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.Height(60));
124143
{
125-
EditorGUILayout.LabelField(m_CreationFeedback, TMP_UIStyleManager.label);
144+
EditorGUILayout.TextArea(m_CreationFeedback, TMP_UIStyleManager.label);
126145
}
127146
GUILayout.EndVertical();
128147

@@ -140,7 +159,6 @@ void DrawEditorPanel()
140159
GUI.enabled = true;
141160
}
142161

143-
144162
/// <summary>
145163
///
146164
/// </summary>
@@ -175,7 +193,6 @@ private static void PopulateSpriteTables(TexturePacker_JsonArray.SpriteDataObjec
175193
}
176194
}
177195

178-
179196
/// <summary>
180197
///
181198
/// </summary>
@@ -210,7 +227,6 @@ void SaveSpriteAsset(string filePath)
210227
AddDefaultMaterial(m_SpriteAsset);
211228
}
212229

213-
214230
/// <summary>
215231
/// Create and add new default material to sprite asset.
216232
/// </summary>
@@ -226,7 +242,6 @@ static void AddDefaultMaterial(TMP_SpriteAsset spriteAsset)
226242
AssetDatabase.AddObjectToAsset(material, spriteAsset);
227243
}
228244

229-
230245
/// <summary>
231246
/// Limits the minimum size of the editor window.
232247
/// </summary>
@@ -238,6 +253,5 @@ void SetEditorWindowSize()
238253

239254
editorWindow.minSize = new Vector2(Mathf.Max(230, currentWindowSize.x), Mathf.Max(300, currentWindowSize.y));
240255
}
241-
242256
}
243257
}

Scripts/Runtime/TMP_Asset.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
using UnityEngine;
1+
using System;
2+
using UnityEngine;
23

34
namespace TMPro
45
{
56

67
// Base class inherited by the various TextMeshPro Assets.
7-
[System.Serializable]
8-
public class TMP_Asset : ScriptableObject
8+
[Serializable]
9+
public abstract class TMP_Asset : ScriptableObject
910
{
1011
/// <summary>
1112
/// Instance ID of the TMP Asset

Scripts/Runtime/TMP_ColorGradient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public enum ColorMode
1111
FourCornersGradient
1212
}
1313

14-
[System.Serializable]
14+
[System.Serializable][ExcludeFromPresetAttribute]
1515
public class TMP_ColorGradient : ScriptableObject
1616
{
1717
public ColorMode colorMode = ColorMode.FourCornersGradient;

Scripts/Runtime/TMP_FontAsset.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public enum AtlasPopulationMode
2121
}
2222

2323

24-
[Serializable]
24+
[Serializable][ExcludeFromPresetAttribute]
2525
public class TMP_FontAsset : TMP_Asset
2626
{
2727
/// <summary>
@@ -531,6 +531,13 @@ void Awake()
531531
UpgradeFontAsset();
532532
}
533533

534+
#if UNITY_EDITOR
535+
private void OnValidate()
536+
{
537+
if (m_CharacterLookupDictionary == null || m_GlyphLookupDictionary == null)
538+
ReadFontAssetDefinition();
539+
}
540+
#endif
534541

535542
public void ReadFontAssetDefinition()
536543
{
@@ -2720,8 +2727,9 @@ internal void UpdateFontAssetData()
27202727

27212728
//TMP_ResourceManager.RebuildFontAssetCache(instanceID);
27222729

2723-
// Add glyphs
2724-
TryAddCharacters(unicodeCharacters, true);
2730+
// Add existing glyphs and characters back in the font asset (if any)
2731+
if (unicodeCharacters.Length > 0)
2732+
TryAddCharacters(unicodeCharacters, true);
27252733

27262734
Profiler.EndSample();
27272735
}

Scripts/Runtime/TMP_ResourcesManager.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,31 @@ public class TMP_ResourceManager
1414

1515
static TMP_ResourceManager() { }
1616

17+
// ======================================================
18+
// TEXT SETTINGS MANAGEMENT
19+
// ======================================================
20+
21+
private static TMP_Settings s_TextSettings;
22+
23+
internal static TMP_Settings GetTextSettings()
24+
{
25+
if (s_TextSettings == null)
26+
{
27+
// Try loading the TMP Settings from a Resources folder in the user project.
28+
s_TextSettings = Resources.Load<TMP_Settings>("TextSettings"); // ?? ScriptableObject.CreateInstance<TMP_Settings>();
29+
30+
#if UNITY_EDITOR
31+
if (s_TextSettings == null)
32+
{
33+
// Open TMP Resources Importer to enable the user to import the TMP Essential Resources and option TMP Examples & Extras
34+
TMP_PackageResourceImporterWindow.ShowPackageImporterWindow();
35+
}
36+
#endif
37+
}
38+
39+
return s_TextSettings;
40+
}
41+
1742
// ======================================================
1843
// FONT ASSET MANAGEMENT - Fields, Properties and Functions
1944
// ======================================================

Scripts/Runtime/TMP_SpriteAsset.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace TMPro
88
{
9-
9+
[ExcludeFromPresetAttribute]
1010
public class TMP_SpriteAsset : TMP_Asset
1111
{
1212
internal Dictionary<int, int> m_NameLookup;

Scripts/Runtime/TMP_StyleSheet.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
namespace TMPro
77
{
88

9-
[Serializable]
9+
[Serializable][ExcludeFromPresetAttribute]
1010
public class TMP_StyleSheet : ScriptableObject
1111
{
1212
/// <summary>
13-
///
13+
///
1414
/// </summary>
1515
internal List<TMP_Style> styles
1616
{
@@ -67,7 +67,7 @@ public void RefreshStyles()
6767
}
6868

6969
/// <summary>
70-
///
70+
///
7171
/// </summary>
7272
private void LoadStyleDictionaryInternal()
7373
{
@@ -80,7 +80,7 @@ private void LoadStyleDictionaryInternal()
8080
for (int i = 0; i < m_StyleList.Count; i++)
8181
{
8282
m_StyleList[i].RefreshStyle();
83-
83+
8484
if (!m_StyleLookupDictionary.ContainsKey(m_StyleList[i].hashCode))
8585
m_StyleLookupDictionary.Add(m_StyleList[i].hashCode, m_StyleList[i]);
8686
}
@@ -92,4 +92,4 @@ private void LoadStyleDictionaryInternal()
9292
}
9393
}
9494

95-
}
95+
}

Scripts/Runtime/TMP_SubMeshUI.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace TMPro
1010
{
1111
[ExecuteAlways]
12-
public class TMP_SubMeshUI : MaskableGraphic, IClippable, IMaskable, IMaterialModifier
12+
public class TMP_SubMeshUI : MaskableGraphic
1313
{
1414
/// <summary>
1515
/// The TMP Font Asset assigned to this sub text object.
@@ -645,22 +645,13 @@ Transform GetRootCanvasTransform()
645645
private Transform m_RootCanvasTransform;
646646

647647
/// <summary>
648-
/// Override to Cull function of MaskableGraphic to prevent Culling.
648+
/// Override Cull function as this is handled by the parent text object.
649649
/// </summary>
650650
/// <param name="clipRect"></param>
651651
/// <param name="validRect"></param>
652652
public override void Cull(Rect clipRect, bool validRect)
653653
{
654-
// Get compound rect for the text object and sub text objects in local canvas space.
655-
Rect rect = m_TextComponent.GetCanvasSpaceClippingRect();
656-
657-
var cull = !validRect || !clipRect.Overlaps(rect, true);
658-
if (canvasRenderer.cull != cull)
659-
{
660-
canvasRenderer.cull = cull;
661-
onCullStateChanged.Invoke(cull);
662-
OnCullingChanged();
663-
}
654+
// Do nothing as this functionality is handled by the parent text object.
664655
}
665656

666657

0 commit comments

Comments
 (0)