Skip to content

Commit fb6fa51

Browse files
author
Unity Technologies
committed
com.unity.textmeshpro@2.1.3
## [2.1.3] - 2020-10-27
1 parent 3854337 commit fb6fa51

33 files changed

+861
-403
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
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.3] - 2020-10-27
5+
## [1.5.3]
6+
## [3.0.3]
7+
### Changes
8+
- Fixed potential null reference exception in the Input Field that can occur as a result of using a workflow that involves enabling and disabling Canvases. See [forum post](https://forum.unity.com/threads/tmp_inputfield-generatecaret-m_textcomponent-canvas-exception.940659/) for details.
9+
- Fixed potential Invalid AssetDatabase path warning that can be issued when assets are imported from outside the project. See [forum post](https://forum.unity.com/threads/textmesh-pro-invalid-assetdatabase-path-use-path-relative-to-the-project-folder.955731/) for details.
10+
- Fixed <TextMeshProUGUI> objects not being created correctly in Prefab isolation mode when using the Create context menu. See [forum post](https://forum.unity.com/threads/tmp-doesnt-like-prefabs.954186/) for details. Case #1266096
11+
- Fixed an issue where nesting <uppercase> and <lowercase> tags didn't behaves as expected. See [forum post](https://forum.unity.com/threads/nested-tags-of-same-kind-dont-act-as-expected.956364/) for details.
12+
- Fixed Input Field incorrect handling of validation with text selection. Case #1267777
13+
- Fixed potential null reference exception that could occur in the Input Field when hiding the soft keyboard on iOS or Android. Case #1273631
14+
- Fixed OnScroll event not getting passed to potential parent ScrollRect when the Input Field is in Single Line mode. Case #1270241
15+
- Fixed Prefab override context menu to override or revert changes not being available for some text object properties. Case #1271420
16+
- The sampling point size in the Font Asset Creator will now be limited to a maximum of 16,384 points for SDF over-sampled modes. This means a maximum point size of 2048 for SDF8, 1024 for SDF16 and 512 for SDF32. Case #1253370
17+
- Fixed Margin widget in the scene view not working correctly when the text object is rotated on the z-axis. Case #1263001
18+
- Fixed Input Field Scrollbar not behaving correctly when set to Bottom to Top direction. Case #1179982
19+
- Fixed minor UI cosmetic issue in the StyleSheet inspector. Case #1258771
20+
- Fixed minor UI cosmetic issue in Material inspector texture properties. Case #1163983
21+
- Fixed potential IndexOutOfRangeException that could occur when duplicating text objects that have more than 8 sub text objects.
22+
- Revised and improved Input Field with Scrollbar behavior with respect to text alignment. Case #1272647
23+
- Improved Input Field Name validation including adding the ability to use Hyphens. Case #1277951
24+
- Fixed state of MeshRenderer potentially not being mirrored on sub text objects. Case #1278329
25+
- Fixed GetPreferredValues() function returning incorrect values when called consecutively. See [forum post](https://forum.unity.com/threads/preferred-width-height-sometimes-0.980022/) for details.
26+
- Initial pass at revising some of the data structures used in the text parsing and layout process to reduce text object memory overhead.
27+
- Fixed incorrect positioning of IME window when using a canvas in World Space when no camera is assigned to the canvas. Case #1043535
28+
- Added new option to Font Asset Generation Settings to automatically clear dynamic data and atlas texture when creating a build.
29+
- Fixed text object properties not being applied correctly when instantiating a text prefab prior to importing TMP Essential Resources. Case #1271192
30+
- Fixed default text object properties potentially not being set correctly when instantiating a prefab. Case #1286412
31+
- Fixed incorrect parsing and display of UTF32 characters. See [forum post](https://forum.unity.com/threads/several-unicode-characters-cannot-be-shown-using-tmp.970857/#post-6316422) for details.
32+
- Fixed potential material error when updating a font asset generation settings when the font asset is using a non SDF shader. Case #1286132
33+
- Fixed minor UI cosmetic issue in the Sprite Asset Sprite Glyph Table inspector. Case #1285022
34+
435
## [2.1.1] - 2020-07-26
536
## [1.5.1]
637
## [3.0.1]

Scripts/Editor/TMP_BaseEditorPanel.cs

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ protected virtual void OnEnable()
265265
m_MaterialPresetNames = GetMaterialPresets();
266266

267267
// Get Styles from Style Sheet
268-
if (!m_TextComponent.m_isWaitingOnResourceLoad)
268+
if (TMP_Settings.instance != null)
269269
m_StyleNames = GetStyleNames();
270270

271271
// Register to receive events when style sheets are modified.
@@ -333,6 +333,8 @@ public void OnSceneGUI()
333333

334334
Handles.DrawSolidRectangleWithOutline(m_HandlePoints, new Color32(255, 255, 255, 0), new Color32(255, 255, 0, 255));
335335

336+
Matrix4x4 matrix = m_RectTransform.worldToLocalMatrix;
337+
336338
// Draw & process FreeMoveHandles
337339

338340
// LEFT HANDLE
@@ -341,6 +343,9 @@ public void OnSceneGUI()
341343
bool hasChanged = false;
342344
if (oldLeft != newLeft)
343345
{
346+
oldLeft = matrix.MultiplyPoint(oldLeft);
347+
newLeft = matrix.MultiplyPoint(newLeft);
348+
344349
float delta = oldLeft.x - newLeft.x;
345350
marginOffset.x += -delta / lossyScale.x;
346351
//Debug.Log("Left Margin H0:" + handlePoints[0] + " H1:" + handlePoints[1]);
@@ -352,6 +357,9 @@ public void OnSceneGUI()
352357
Vector3 newTop = Handles.FreeMoveHandle(oldTop, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
353358
if (oldTop != newTop)
354359
{
360+
oldTop = matrix.MultiplyPoint(oldTop);
361+
newTop = matrix.MultiplyPoint(newTop);
362+
355363
float delta = oldTop.y - newTop.y;
356364
marginOffset.y += delta / lossyScale.y;
357365
//Debug.Log("Top Margin H1:" + handlePoints[1] + " H2:" + handlePoints[2]);
@@ -363,6 +371,9 @@ public void OnSceneGUI()
363371
Vector3 newRight = Handles.FreeMoveHandle(oldRight, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
364372
if (oldRight != newRight)
365373
{
374+
oldRight = matrix.MultiplyPoint(oldRight);
375+
newRight = matrix.MultiplyPoint(newRight);
376+
366377
float delta = oldRight.x - newRight.x;
367378
marginOffset.z += delta / lossyScale.x;
368379
hasChanged = true;
@@ -374,6 +385,9 @@ public void OnSceneGUI()
374385
Vector3 newBottom = Handles.FreeMoveHandle(oldBottom, Quaternion.identity, HandleUtility.GetHandleSize(m_RectTransform.position) * 0.05f, Vector3.zero, Handles.DotHandleCap);
375386
if (oldBottom != newBottom)
376387
{
388+
oldBottom = matrix.MultiplyPoint(oldBottom);
389+
newBottom = matrix.MultiplyPoint(newBottom);
390+
377391
float delta = oldBottom.y - newBottom.y;
378392
marginOffset.w += -delta / lossyScale.y;
379393
hasChanged = true;
@@ -415,7 +429,8 @@ protected void DrawTextInput()
415429
EditorGUI.BeginChangeCheck();
416430
EditorGUILayout.PropertyField(m_TextProp, GUIContent.none);
417431

418-
if (EditorGUI.EndChangeCheck())
432+
// Need to also compare string content due to issue related to scroll bar drag handle
433+
if (EditorGUI.EndChangeCheck() && m_TextProp.stringValue != m_TextComponent.text)
419434
{
420435
m_TextComponent.m_inputSource = TMP_Text.TextInputSources.Text;
421436
m_TextComponent.m_isInputParsingRequired = true;
@@ -455,6 +470,8 @@ protected void DrawTextInput()
455470
{
456471
rect = EditorGUILayout.GetControlRect(false, 17);
457472

473+
EditorGUI.BeginProperty(rect, k_StyleLabel, m_TextStyleHashCodeProp);
474+
458475
m_TextStyleIndexLookup.TryGetValue(m_TextStyleHashCodeProp.intValue, out m_StyleSelectionIndex);
459476

460477
EditorGUI.BeginChangeCheck();
@@ -465,6 +482,8 @@ protected void DrawTextInput()
465482
m_TextComponent.m_TextStyle = m_Styles[m_StyleSelectionIndex];
466483
m_HavePropertiesChanged = true;
467484
}
485+
486+
EditorGUI.EndProperty();
468487
}
469488
}
470489
}
@@ -518,6 +537,8 @@ void DrawFont()
518537
EditorGUI.BeginChangeCheck();
519538
rect = EditorGUILayout.GetControlRect(false, 17);
520539

540+
EditorGUI.BeginProperty(rect, k_MaterialPresetLabel, m_FontSharedMaterialProp);
541+
521542
float oldHeight = EditorStyles.popup.fixedHeight;
522543
EditorStyles.popup.fixedHeight = rect.height;
523544

@@ -528,6 +549,9 @@ void DrawFont()
528549
m_MaterialPresetIndexLookup.TryGetValue(m_FontSharedMaterialProp.objectReferenceValue.GetInstanceID(), out m_MaterialPresetSelectionIndex);
529550

530551
m_MaterialPresetSelectionIndex = EditorGUI.Popup(rect, k_MaterialPresetLabel, m_MaterialPresetSelectionIndex, m_MaterialPresetNames);
552+
553+
EditorGUI.EndProperty();
554+
531555
if (EditorGUI.EndChangeCheck())
532556
{
533557
m_FontSharedMaterialProp.objectReferenceValue = m_MaterialPresets[m_MaterialPresetSelectionIndex];
@@ -547,6 +571,8 @@ void DrawFont()
547571
{
548572
rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight + 2f);
549573

574+
EditorGUI.BeginProperty(rect, k_FontStyleLabel, m_FontStyleProp);
575+
550576
EditorGUI.PrefixLabel(rect, k_FontStyleLabel);
551577

552578
int styleValue = m_FontStyleProp.intValue;
@@ -594,11 +620,15 @@ void DrawFont()
594620
v5 = selected == 16 ? 16 : 0;
595621
v6 = selected == 32 ? 32 : 0;
596622
}
623+
624+
EditorGUI.EndProperty();
597625
}
598626
else
599627
{
600628
rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight + 2f);
601629

630+
EditorGUI.BeginProperty(rect, k_FontStyleLabel, m_FontStyleProp);
631+
602632
EditorGUI.PrefixLabel(rect, k_FontStyleLabel);
603633

604634
int styleValue = m_FontStyleProp.intValue;
@@ -651,6 +681,8 @@ void DrawFont()
651681
v5 = selected == 16 ? 16 : 0;
652682
v6 = selected == 32 ? 32 : 0;
653683
}
684+
685+
EditorGUI.EndProperty();
654686
}
655687

656688
if (EditorGUI.EndChangeCheck())
@@ -757,10 +789,9 @@ void DrawColor()
757789
{
758790
// FACE VERTEX COLOR
759791
EditorGUI.BeginChangeCheck();
760-
Color vertexColor = EditorGUILayout.ColorField(k_BaseColorLabel, m_FontColorProp.colorValue, false, true, false);
792+
EditorGUILayout.PropertyField(m_FontColorProp, k_BaseColorLabel);
761793
if (EditorGUI.EndChangeCheck())
762794
{
763-
m_FontColorProp.colorValue = vertexColor;
764795
m_HavePropertiesChanged = true;
765796
}
766797

@@ -810,7 +841,7 @@ void DrawColor()
810841

811842
EditorGUILayout.PropertyField(colorMode, k_ColorModeLabel);
812843

813-
var rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
844+
Rect rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * (EditorGUIUtility.wideMode ? 1 : 2));
814845

815846
EditorGUI.PrefixLabel(rect, k_CorenerColorsLabel);
816847

@@ -936,6 +967,8 @@ void DrawAlignment()
936967
EditorGUI.BeginChangeCheck();
937968

938969
Rect rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.currentViewWidth > 504 ? 20 : 40 + 3);
970+
EditorGUI.BeginProperty(rect, k_AlignmentLabel, m_HorizontalAlignmentProp);
971+
EditorGUI.BeginProperty(rect, k_AlignmentLabel, m_VerticalAlignmentProp);
939972

940973
EditorGUI.PrefixLabel(rect, k_AlignmentLabel);
941974
rect.x += EditorGUIUtility.labelWidth;
@@ -950,21 +983,29 @@ void DrawAlignment()
950983
if (EditorGUI.EndChangeCheck())
951984
m_HavePropertiesChanged = true;
952985

986+
EditorGUI.EndProperty();
987+
EditorGUI.EndProperty();
988+
953989
EditorGUILayout.Space();
954990
}
955991

956992
void DrawWrappingOverflow()
957993
{
958994
// TEXT WRAPPING
995+
Rect rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
996+
EditorGUI.BeginProperty(rect, k_WrappingLabel, m_EnableWordWrappingProp);
997+
959998
EditorGUI.BeginChangeCheck();
960-
int wrapSelection = EditorGUILayout.Popup(k_WrappingLabel, m_EnableWordWrappingProp.boolValue ? 1 : 0, k_WrappingOptions);
999+
int wrapSelection = EditorGUI.Popup(rect, k_WrappingLabel, m_EnableWordWrappingProp.boolValue ? 1 : 0, k_WrappingOptions);
9611000
if (EditorGUI.EndChangeCheck())
9621001
{
9631002
m_EnableWordWrappingProp.boolValue = wrapSelection == 1;
9641003
m_HavePropertiesChanged = true;
9651004
m_TextComponent.m_isInputParsingRequired = true;
9661005
}
9671006

1007+
EditorGUI.EndProperty();
1008+
9681009
// TEXT OVERFLOW
9691010
EditorGUI.BeginChangeCheck();
9701011

Scripts/Editor/TMP_BaseShaderGUI.cs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,17 @@ protected void DoTexture2D(string name, string label, bool withTilingOffset = fa
284284

285285
void DoTexture(string name, string label, System.Type type, bool withTilingOffset = false, string[] speedNames = null)
286286
{
287+
float objFieldSize = 60f;
288+
bool smallLayout = EditorGUIUtility.currentViewWidth <= 440f && (withTilingOffset || speedNames != null);
289+
float controlHeight = smallLayout ? objFieldSize * 2 : objFieldSize;
290+
287291
MaterialProperty property = FindProperty(name, m_Properties);
288292
m_Editor.BeginAnimatedCheck(Rect.zero, property);
289293

290-
Rect rect = EditorGUILayout.GetControlRect(true, 60f);
294+
Rect rect = EditorGUILayout.GetControlRect(true, controlHeight);
291295
float totalWidth = rect.width;
292-
rect.width = EditorGUIUtility.labelWidth + 60f;
296+
rect.width = EditorGUIUtility.labelWidth + objFieldSize;
297+
rect.height = objFieldSize;
293298
s_TempLabel.text = label;
294299

295300
EditorGUI.BeginChangeCheck();
@@ -299,8 +304,12 @@ void DoTexture(string name, string label, System.Type type, bool withTilingOffse
299304
property.textureValue = tex as Texture;
300305
}
301306

302-
rect.x += rect.width + 4f;
303-
rect.width = totalWidth - rect.width - 4f;
307+
float additionalHeight = controlHeight - objFieldSize;
308+
float xOffset = smallLayout ? rect.width - objFieldSize : rect.width;
309+
310+
rect.y += additionalHeight;
311+
rect.x += xOffset;
312+
rect.width = totalWidth - xOffset;
304313
rect.height = EditorGUIUtility.singleLineHeight;
305314

306315
if (withTilingOffset)
@@ -322,7 +331,7 @@ void DoTilingOffset(Rect rect, MaterialProperty property)
322331
float labelWidth = EditorGUIUtility.labelWidth;
323332
int indentLevel = EditorGUI.indentLevel;
324333
EditorGUI.indentLevel = 0;
325-
EditorGUIUtility.labelWidth = Mathf.Min(40f, rect.width * 0.20f);
334+
EditorGUIUtility.labelWidth = Mathf.Min(37f, rect.width * 0.40f);
326335

327336
Vector4 vector = property.textureScaleAndOffset;
328337

@@ -372,15 +381,15 @@ protected void DoUVSpeed(Rect rect, string[] names)
372381
float labelWidth = EditorGUIUtility.labelWidth;
373382
int indentLevel = EditorGUI.indentLevel;
374383
EditorGUI.indentLevel = 0;
375-
EditorGUIUtility.labelWidth = Mathf.Min(40f, rect.width * 0.20f);
384+
EditorGUIUtility.labelWidth = Mathf.Min(37f, rect.width * 0.40f);
376385

377386
s_TempLabel.text = "Speed";
378387
rect = EditorGUI.PrefixLabel(rect, s_TempLabel);
379388

380-
EditorGUIUtility.labelWidth = 13f;
381-
rect.width = rect.width * 0.5f - 1f;
389+
EditorGUIUtility.labelWidth = 10f;
390+
rect.width = rect.width * 0.5f - 2f;
382391
DoFloat(rect, names[0], "X");
383-
rect.x += rect.width + 2f;
392+
rect.x += rect.width + 4f;
384393
DoFloat(rect, names[1], "Y");
385394
EditorGUIUtility.labelWidth = labelWidth;
386395
EditorGUI.indentLevel = indentLevel;

0 commit comments

Comments
 (0)