Skip to content

Commit ae66a48

Browse files
author
Unity Technologies
committed
com.unity.textmeshpro@1.5.0
## [1.5.0] - 2020-06-30 ## [2.1.0] ## [3.0.0] ### Changes - Added support to control if a text object is Maskable and affected by UI Mask components. The new setting is found in the Extra Settings section of the <TextMeshProUGUI> component inspector. - Fixed potential Null Reference Exception when trying to add characters and / or glyphs to a font asset via scripting and before it has been initialized or ReadFontAssetDefinition() has been called. - Fixed incorrect preferred width values when using alternative font weight font assets. Case #1255336 - Enabling or disabling the Mesh Renderer of a <TextMeshPro> text object should now also mirror that state on any sub text object renderers as well. - Fixed <sprite> incorrect position when this sprite is the only character in the text and when the sprite asset face info has not been defined. - Fixed potential Null Reference Exception related to culling when entering play mode. - Added OnPreRenderText event delegate to allow potential modification of the text geometry before it is uploaded to the mesh and rendered. - Fixed missing warning when the requested character is missing from the font asset or any potential fallbacks. Case #1256879 - Fixed potential issue with Underline and StrikeThrough when using alternative typeface. Case #1255336 - Fixed potential errors in the Text StyleSheet Inspector when adding or removing Text Styles after resetting the asset. Case #1254602 - Fixed text Margin property values not being draggable in the Extra Settings section of the text inspector. Case #1253447 - It will no longer be possible to create Editor Presets for the TMP_FontAsset, TMP_SpriteAsset, TMP_StyleSheet, TMP_ColorGradient and TMP_Settings as these are persistent and runtime assets. Case #1251229
1 parent 5152b17 commit ae66a48

17 files changed

+251
-231
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
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+
## [1.5.0] - 2020-06-30
5+
## [2.1.0]
6+
## [3.0.0]
7+
### Changes
8+
- Added support to control if a text object is Maskable and affected by UI Mask components. The new setting is found in the Extra Settings section of the <TextMeshProUGUI> component inspector.
9+
- Fixed potential Null Reference Exception when trying to add characters and / or glyphs to a font asset via scripting and before it has been initialized or ReadFontAssetDefinition() has been called.
10+
- Fixed incorrect preferred width values when using alternative font weight font assets. Case #1255336
11+
- Enabling or disabling the Mesh Renderer of a <TextMeshPro> text object should now also mirror that state on any sub text object renderers as well.
12+
- Fixed <sprite> incorrect position when this sprite is the only character in the text and when the sprite asset face info has not been defined.
13+
- Fixed potential Null Reference Exception related to culling when entering play mode.
14+
- Added OnPreRenderText event delegate to allow potential modification of the text geometry before it is uploaded to the mesh and rendered.
15+
- Fixed missing warning when the requested character is missing from the font asset or any potential fallbacks. Case #1256879
16+
- Fixed potential issue with Underline and StrikeThrough when using alternative typeface. Case #1255336
17+
- Fixed potential errors in the Text StyleSheet Inspector when adding or removing Text Styles after resetting the asset. Case #1254602
18+
- Fixed text Margin property values not being draggable in the Extra Settings section of the text inspector. Case #1253447
19+
- It will no longer be possible to create Editor Presets for the TMP_FontAsset, TMP_SpriteAsset, TMP_StyleSheet, TMP_ColorGradient and TMP_Settings as these are persistent and runtime assets. Case #1251229
20+
421
## [1.5.0-preview.14] - 2020-06-08
522
## [2.1.0-preview.14]
623
## [3.0.0-preview.14]

Scripts/Editor/TMP_BaseEditorPanel.cs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,44 +1282,41 @@ protected void DrawMarginProperty(SerializedProperty property, GUIContent label)
12821282

12831283
float width = rect.width + 3;
12841284
pos0.width = EditorGUIUtility.labelWidth;
1285-
GUI.Label(pos0, label);
1285+
EditorGUI.PrefixLabel(pos0, label);
12861286

1287-
var vec = property.vector4Value;
1287+
Vector4 margins = property.vector4Value;
12881288

12891289
float widthB = width - EditorGUIUtility.labelWidth;
12901290
float fieldWidth = widthB / 4;
12911291
pos0.width = Mathf.Max(fieldWidth - 5, 45f);
12921292

12931293
// Labels
12941294
pos0.x = EditorGUIUtility.labelWidth + 15;
1295-
GUI.Label(pos0, k_LeftLabel);
1295+
margins.x = DrawMarginField(pos0, "Left", margins.x);
12961296

12971297
pos0.x += fieldWidth;
1298-
GUI.Label(pos0, k_TopLabel);
1298+
margins.y = DrawMarginField(pos0, "Top", margins.y);
12991299

13001300
pos0.x += fieldWidth;
1301-
GUI.Label(pos0, k_RightLabel);
1301+
margins.z = DrawMarginField(pos0, "Right", margins.z);
13021302

13031303
pos0.x += fieldWidth;
1304-
GUI.Label(pos0, k_BottomLabel);
1304+
margins.w = DrawMarginField(pos0, "Bottom", margins.w);
13051305

1306-
pos0.y += 18;
1306+
property.vector4Value = margins;
13071307

1308-
pos0.x = EditorGUIUtility.labelWidth + 15;
1309-
vec.x = EditorGUI.FloatField(pos0, GUIContent.none, vec.x);
1310-
1311-
pos0.x += fieldWidth;
1312-
vec.y = EditorGUI.FloatField(pos0, GUIContent.none, vec.y);
1313-
1314-
pos0.x += fieldWidth;
1315-
vec.z = EditorGUI.FloatField(pos0, GUIContent.none, vec.z);
1308+
EditorGUI.EndProperty();
1309+
}
13161310

1317-
pos0.x += fieldWidth;
1318-
vec.w = EditorGUI.FloatField(pos0, GUIContent.none, vec.w);
1311+
float DrawMarginField(Rect position, string label, float value)
1312+
{
1313+
int controlId = GUIUtility.GetControlID(FocusType.Keyboard, position);
1314+
EditorGUI.PrefixLabel(position, controlId, new GUIContent(label));
13191315

1320-
property.vector4Value = vec;
1316+
Rect dragZone = new Rect(position.x, position.y, position.width, position.height);
1317+
position.y += EditorGUIUtility.singleLineHeight;
13211318

1322-
EditorGUI.EndProperty();
1319+
return EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, position, dragZone, controlId, value, EditorGUI.kFloatFieldFormatString, EditorStyles.numberField, true);
13231320
}
13241321

13251322
protected void DrawPropertySlider(GUIContent label, SerializedProperty property)

Scripts/Editor/TMP_EditorPanelUI.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ namespace TMPro.EditorUtilities
99
public class TMP_EditorPanelUI : TMP_BaseEditorPanel
1010
{
1111
static readonly GUIContent k_RaycastTargetLabel = new GUIContent("Raycast Target", "Whether the text blocks raycasts from the Graphic Raycaster.");
12+
static readonly GUIContent k_MaskableLabel = new GUIContent("Maskable", "Determines if the text object will be affected by UI Mask.");
1213

1314
SerializedProperty m_RaycastTargetProp;
15+
private SerializedProperty m_MaskableProp;
1416

1517
protected override void OnEnable()
1618
{
1719
base.OnEnable();
1820
m_RaycastTargetProp = serializedObject.FindProperty("m_RaycastTarget");
21+
m_MaskableProp = serializedObject.FindProperty("m_Maskable");
1922
}
2023

2124
protected override void DrawExtraSettings()
@@ -40,6 +43,8 @@ protected override void DrawExtraSettings()
4043

4144
DrawRaycastTarget();
4245

46+
DrawMaskable();
47+
4348
DrawParsing();
4449

4550
DrawSpriteAsset();
@@ -69,6 +74,23 @@ protected void DrawRaycastTarget()
6974
}
7075
}
7176

77+
protected void DrawMaskable()
78+
{
79+
EditorGUI.BeginChangeCheck();
80+
EditorGUILayout.PropertyField(m_MaskableProp, k_MaskableLabel);
81+
if (EditorGUI.EndChangeCheck())
82+
{
83+
m_TextComponent.maskable = m_MaskableProp.boolValue;
84+
85+
// Change needs to propagate to the child sub objects.
86+
MaskableGraphic[] maskableGraphics = m_TextComponent.GetComponentsInChildren<MaskableGraphic>();
87+
for (int i = 1; i < maskableGraphics.Length; i++)
88+
maskableGraphics[i].maskable = m_MaskableProp.boolValue;
89+
90+
m_HavePropertiesChanged = true;
91+
}
92+
}
93+
7294
// Method to handle multi object selection
7395
protected override bool IsMixSelectionTypes()
7496
{
@@ -99,4 +121,4 @@ protected override void OnUndoRedo()
99121
}
100122
}
101123
}
102-
}
124+
}

Scripts/Editor/TMP_SpriteAssetEditor.cs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using System.Collections.Generic;
66

77

8-
9-
108
namespace TMPro.EditorUtilities
119
{
1210

@@ -374,33 +372,33 @@ public override void OnInspectorGUI()
374372
GUI.enabled = true;
375373
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
376374
rect = EditorGUILayout.GetControlRect(false, 40);
377-
375+
378376
float width = (rect.width - 75f) / 4;
379377
EditorGUI.LabelField(rect, "Global Offsets & Scale", EditorStyles.boldLabel);
380-
381-
378+
379+
382380
rect.x += 70;
383381
bool old_ChangedState = GUI.changed;
384382
385383
GUI.changed = false;
386384
m_xOffset = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 0, rect.y + 20, width - 5f, 18), new GUIContent("OX:"), m_xOffset);
387385
if (GUI.changed) UpdateGlobalProperty("m_HorizontalBearingX", m_xOffset);
388-
386+
389387
m_yOffset = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 1, rect.y + 20, width - 5f, 18), new GUIContent("OY:"), m_yOffset);
390388
if (GUI.changed) UpdateGlobalProperty("m_HorizontalBearingY", m_yOffset);
391-
389+
392390
m_xAdvance = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 2, rect.y + 20, width - 5f, 18), new GUIContent("ADV."), m_xAdvance);
393391
if (GUI.changed) UpdateGlobalProperty("m_HorizontalAdvance", m_xAdvance);
394-
392+
395393
m_scale = EditorGUI.FloatField(new Rect(rect.x + 5f + width * 3, rect.y + 20, width - 5f, 18), new GUIContent("SF."), m_scale);
396394
if (GUI.changed) UpdateGlobalProperty("m_Scale", m_scale);
397395
398396
EditorGUILayout.EndVertical();
399-
397+
400398
GUI.changed = old_ChangedState;
401399
*/
402400
#endregion
403-
401+
404402
}
405403
#endregion
406404

@@ -565,7 +563,7 @@ public override void OnInspectorGUI()
565563
serializedObject.ApplyModifiedProperties();
566564

567565
m_IsGlyphSearchDirty = true;
568-
566+
569567
//m_SpriteAsset.UpdateLookupTables();
570568
}
571569

@@ -660,7 +658,7 @@ public override void OnInspectorGUI()
660658
EditorUtility.SetDirty(target);
661659
}
662660

663-
// Clear selection if mouse event was not consumed.
661+
// Clear selection if mouse event was not consumed.
664662
GUI.enabled = true;
665663
if (currentEvent.type == EventType.MouseDown && currentEvent.button == 0)
666664
m_selectedElement = -1;
@@ -669,7 +667,7 @@ public override void OnInspectorGUI()
669667

670668

671669
/// <summary>
672-
///
670+
///
673671
/// </summary>
674672
/// <param name="arraySize"></param>
675673
/// <param name="itemsPerPage"></param>
@@ -795,7 +793,7 @@ void MoveCharacterToIndex(int selectedIndex, int newIndex)
795793
}
796794

797795
/// <summary>
798-
///
796+
///
799797
/// </summary>
800798
/// <param name="selectedIndex"></param>
801799
/// <param name="newIndex"></param>
@@ -830,7 +828,7 @@ void MoveGlyphToIndex(int selectedIndex, int newIndex)
830828

831829

832830
/// <summary>
833-
///
831+
///
834832
/// </summary>
835833
/// <param name="source"></param>
836834
/// <param name="target"></param>
@@ -875,7 +873,7 @@ void CopyGlyphSerializedProperty(SerializedProperty srcGlyph, ref SerializedProp
875873

876874

877875
/// <summary>
878-
///
876+
///
879877
/// </summary>
880878
/// <param name="searchPattern"></param>
881879
/// <returns></returns>
@@ -952,4 +950,4 @@ void SearchGlyphTable(string searchPattern, ref List<int> searchResults)
952950
}
953951

954952
}
955-
}
953+
}

Scripts/Editor/TMP_StyleAssetMenu.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static void CreateTextMeshProObjectPerform()
3333
}
3434

3535

36-
string filePathWithName = AssetDatabase.GenerateUniqueAssetPath(filePath + "/TMP StyleSheet.asset");
36+
string filePathWithName = AssetDatabase.GenerateUniqueAssetPath(filePath + "/Text StyleSheet.asset");
3737

3838
//// Create new Style Sheet Asset.
3939
TMP_StyleSheet styleSheet = ScriptableObject.CreateInstance<TMP_StyleSheet>();
@@ -53,4 +53,4 @@ public static void CreateTextMeshProObjectPerform()
5353
}
5454
}
5555

56-
}
56+
}

0 commit comments

Comments
 (0)