Skip to content

Commit 12b5cf0

Browse files
author
Unity Technologies
committed
com.unity.textmeshpro@3.0.0-preview.4
## [3.0.0-preview.4] - 2020-01-31
1 parent 91c5c91 commit 12b5cf0

14 files changed

+515
-346
lines changed

CHANGELOG.md

+17
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+
## [3.0.0-preview.4] - 2020-01-31
5+
## [2.1.0-preview.4]
6+
## [1.5.0-preview.4]
7+
### Changes
8+
- Fixed Input Field issue where scrolling events could prevent OnEndEdit event from firing. See [forum post](https://forum.unity.com/threads/mouse-wheel-on-multiline-input-field-with-no-scrollbar-hangs-input-field-stops-event-firing.794607/) for details.
9+
- Improved Input Field handling of Vertical Scrollbar in conjunction with the ResetOnDeActivation property. Using the Vertical Scrollbar no longer triggers OnEndEdit event.
10+
- Fixed potential Missing Component Exception that could occur when a TMP_SubMeshUI object is created.
11+
- Fixed MissingReferenceException when deleting a TMP prefab that is part of a nested prefab. Case #1207793
12+
- Improved handling of allocations of newly created text objects with large amount of text. As a result of these revisions, allocations will potentially be reduce by 10X. See #1205923
13+
- Fixed potential Null Reference Exception with the TMP DropDown that could occur when using the experimental Editor "Enter Play Mode" feature. Case #1207915
14+
- Fixed potential issue with the assignment of sub text object materials.
15+
- Add support for hiding the soft keyboard for Switch in the TMP Input Field.
16+
- Fixed incorrect Preferred Height when Word Wrapping is disabled on text objects. See [forum post](https://forum.unity.com/threads/incorrect-wordwrapping-preferredsize-textmespro-2-1-preview-3.812376/) for details.
17+
- Added support for the new Selected state and color to the TMP Input Field. Case #1210496
18+
- Fixed additional instances of TMP Resource Importer window being created when deleting the "TextMesh Pro" folder just after having imported them. Case #1205848
19+
- Added public ITextPreprocessor textPreprocessor; property to allow setting the text preprocessor for a given text component.
20+
421
## [3.0.0-preview.3] - 2019-12-16
522
## [2.1.0-preview.3]
623
## [1.5.0-preview.3]

Scripts/Editor/TMPro_CreateObjectMenu.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static void CreateTextMeshProGuiObjectPerform(MenuCommand menuCommand)
7272
GameObject go = TMP_DefaultControls.CreateText(GetStandardResources());
7373

7474
// Override text color and font size
75-
TextMeshProUGUI textComponent = go.GetComponent<TextMeshProUGUI>();
75+
TextMeshProUGUI textComponent = go.GetComponent<TextMeshProUGUI>();
7676

7777
if (textComponent.m_isWaitingOnResourceLoad == false)
7878
{

Scripts/Runtime/TMP_Dropdown.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,10 @@ protected TMP_Dropdown() { }
438438

439439
protected override void Awake()
440440
{
441-
#if UNITY_EDITOR
442-
if (!Application.isPlaying)
443-
return;
444-
#endif
441+
//#if UNITY_EDITOR
442+
// if (!Application.isPlaying)
443+
// return;
444+
//#endif
445445

446446
m_AlphaTweenRunner = new TweenRunner<FloatTween>();
447447
m_AlphaTweenRunner.Init(this);
@@ -1157,4 +1157,4 @@ private void OnSelectItem(Toggle toggle)
11571157
Hide();
11581158
}
11591159
}
1160-
}
1160+
}

Scripts/Runtime/TMP_FontFeatureTable.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class TMP_FontFeatureTable
1515
/// <summary>
1616
/// List that contains the glyph pair adjustment records.
1717
/// </summary>
18-
internal List<TMP_GlyphPairAdjustmentRecord> glyphPairAdjustmentRecords
18+
public List<TMP_GlyphPairAdjustmentRecord> glyphPairAdjustmentRecords
1919
{
2020
get { return m_GlyphPairAdjustmentRecords; }
2121
set { m_GlyphPairAdjustmentRecords = value; }

Scripts/Runtime/TMP_InputField.cs

+47-28
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ public bool shouldHideSoftKeyboard
423423
case RuntimePlatform.WSAPlayerX64:
424424
case RuntimePlatform.WSAPlayerARM:
425425
case RuntimePlatform.Stadia:
426+
case RuntimePlatform.Switch:
426427
return m_HideSoftKeyboard;
427428
default:
428429
return true;
@@ -440,6 +441,7 @@ public bool shouldHideSoftKeyboard
440441
case RuntimePlatform.WSAPlayerX64:
441442
case RuntimePlatform.WSAPlayerARM:
442443
case RuntimePlatform.Stadia:
444+
case RuntimePlatform.Switch:
443445
SetPropertyUtility.SetStruct(ref m_HideSoftKeyboard, value);
444446
break;
445447
default:
@@ -462,6 +464,7 @@ private bool isKeyboardUsingEvents()
462464
case RuntimePlatform.Android:
463465
case RuntimePlatform.IPhonePlayer:
464466
case RuntimePlatform.tvOS:
467+
case RuntimePlatform.Switch:
465468
return false;
466469
default:
467470
return true;
@@ -732,7 +735,7 @@ public bool resetOnDeActivation
732735
private bool m_SelectionStillActive = false;
733736
private bool m_ReleaseSelection = false;
734737

735-
private GameObject m_SelectedObject;
738+
private GameObject m_PreviouslySelectedObject;
736739

737740
/// <summary>
738741
/// Controls whether the original text is restored when pressing "ESC".
@@ -1417,19 +1420,36 @@ protected virtual void LateUpdate()
14171420
{
14181421
GameObject selectedObject = EventSystem.current != null ? EventSystem.current.currentSelectedGameObject : null;
14191422

1423+
if (selectedObject == null && m_ResetOnDeActivation)
1424+
{
1425+
ReleaseSelection();
1426+
return;
1427+
}
1428+
14201429
if (selectedObject != null && selectedObject != this.gameObject)
14211430
{
1422-
if (selectedObject != m_SelectedObject)
1431+
if (selectedObject != m_PreviouslySelectedObject)
14231432
{
1424-
m_SelectedObject = selectedObject;
1433+
m_PreviouslySelectedObject = selectedObject;
14251434

1426-
// Release current selection of the newly selected object is another Input Field
1427-
if (selectedObject.GetComponent<TMP_InputField>() != null)
1435+
// Special handling for Vertical Scrollbar
1436+
if (m_VerticalScrollbar && selectedObject == m_VerticalScrollbar.gameObject)
14281437
{
1429-
// Release selection
1430-
m_SelectionStillActive = false;
1431-
MarkGeometryAsDirty();
1432-
m_SelectedObject = null;
1438+
// Do not release selection
1439+
return;
1440+
}
1441+
else
1442+
{
1443+
// Release selection for all objects when ResetOnDeActivation is true
1444+
if (m_ResetOnDeActivation)
1445+
{
1446+
ReleaseSelection();
1447+
return;
1448+
}
1449+
1450+
// Release current selection of selected object is another Input Field
1451+
if (selectedObject.GetComponent<TMP_InputField>() != null)
1452+
ReleaseSelection();
14331453
}
14341454
}
14351455

@@ -1456,9 +1476,7 @@ protected virtual void LateUpdate()
14561476
//if (caretRectTrans != null)
14571477
// caretRectTrans.localPosition = Vector3.zero;
14581478

1459-
m_SelectionStillActive = false;
1460-
1461-
MarkGeometryAsDirty();
1479+
ReleaseSelection();
14621480

14631481
return;
14641482
}
@@ -2120,7 +2138,12 @@ public virtual void OnUpdateSelected(BaseEventData eventData)
21202138
/// <param name="eventData"></param>
21212139
public virtual void OnScroll(PointerEventData eventData)
21222140
{
2123-
if (m_TextComponent.preferredHeight < m_TextViewport.rect.height) return;
2141+
// Return if Single Line
2142+
if (m_LineType == LineType.SingleLine)
2143+
return;
2144+
2145+
if (m_TextComponent.preferredHeight < m_TextViewport.rect.height)
2146+
return;
21242147

21252148
float scrollDirection = -eventData.scrollDelta.y;
21262149

@@ -2130,9 +2153,6 @@ public virtual void OnScroll(PointerEventData eventData)
21302153

21312154
AdjustTextPositionRelativeToViewport(m_ScrollPosition);
21322155

2133-
// Disable focus until user re-selected the input field.
2134-
m_AllowInput = false;
2135-
21362156
if (m_VerticalScrollbar)
21372157
{
21382158
m_IsUpdatingScrollbarValues = true;
@@ -3948,7 +3968,13 @@ public void OnControlClick()
39483968
public void ReleaseSelection()
39493969
{
39503970
m_SelectionStillActive = false;
3971+
m_ReleaseSelection = false;
3972+
m_PreviouslySelectedObject = null;
3973+
39513974
MarkGeometryAsDirty();
3975+
3976+
SendOnEndEdit();
3977+
SendOnEndTextSelection();
39523978
}
39533979

39543980
public void DeactivateInputField(bool clearSelection = false)
@@ -3983,18 +4009,11 @@ public void DeactivateInputField(bool clearSelection = false)
39834009
//m_StringPosition = m_StringSelectPosition = 0;
39844010
//m_CaretPosition = m_CaretSelectPosition = 0;
39854011
//m_TextComponent.rectTransform.localPosition = m_DefaultTransformPosition;
3986-
3987-
//if (caretRectTrans != null)
3988-
// caretRectTrans.localPosition = Vector3.zero;
3989-
3990-
m_SelectionStillActive = false;
3991-
m_ReleaseSelection = false;
3992-
m_SelectedObject = null;
4012+
4013+
if (m_VerticalScrollbar == null)
4014+
ReleaseSelection();
39934015
}
39944016

3995-
SendOnEndEdit();
3996-
SendOnEndTextSelection();
3997-
39984017
inputSystem.imeCompositionMode = IMECompositionMode.Auto;
39994018
}
40004019

@@ -4173,7 +4192,7 @@ void SetToCustom(CharacterValidation characterValidation)
41734192
protected override void DoStateTransition(SelectionState state, bool instant)
41744193
{
41754194
if (m_HasDoneFocusTransition)
4176-
state = SelectionState.Highlighted;
4195+
state = SelectionState.Selected;
41774196
else if (state == SelectionState.Pressed)
41784197
m_HasDoneFocusTransition = true;
41794198

@@ -4329,4 +4348,4 @@ public static bool SetClass<T>(ref T currentValue, T newValue) where T : class
43294348
return true;
43304349
}
43314350
}
4332-
}
4351+
}

Scripts/Runtime/TMP_PackageResourceImporter.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,17 @@ public class TMP_PackageResourceImporterWindow : EditorWindow
160160
[SerializeField]
161161
TMP_PackageResourceImporter m_ResourceImporter;
162162

163+
static TMP_PackageResourceImporterWindow m_ImporterWindow;
164+
163165
public static void ShowPackageImporterWindow()
164166
{
165-
var window = GetWindow<TMP_PackageResourceImporterWindow>();
166-
window.titleContent = new GUIContent("TMP Importer");
167-
window.Focus();
167+
if (m_ImporterWindow == null)
168+
{
169+
m_ImporterWindow = GetWindow<TMP_PackageResourceImporterWindow>();
170+
m_ImporterWindow.titleContent = new GUIContent("TMP Importer");
171+
}
172+
173+
m_ImporterWindow.Focus();
168174
}
169175

170176
void OnEnable()

Scripts/Runtime/TMP_SubMeshUI.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace TMPro
99
{
1010
[ExecuteAlways]
11+
[RequireComponent(typeof(CanvasRenderer))]
1112
public class TMP_SubMeshUI : MaskableGraphic, IClippable, IMaskable, IMaterialModifier
1213
{
1314
/// <summary>
@@ -274,9 +275,13 @@ protected override void OnEnable()
274275
protected override void OnDisable()
275276
{
276277
//Debug.Log("*** SubObject OnDisable() ***");
278+
//base.OnDisable();
277279

278280
//m_canvasRenderer.Clear();
279-
TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild(this);
281+
//TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild(this);
282+
283+
if (canvasRenderer != null)
284+
canvasRenderer.Clear();
280285

281286
if (m_MaskMaterial != null)
282287
{
@@ -289,8 +294,6 @@ protected override void OnDisable()
289294
TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
290295
m_fallbackMaterial = null;
291296
}
292-
293-
base.OnDisable();
294297
}
295298

296299

@@ -518,6 +521,8 @@ public override Material GetModifiedMaterial(Material baseMaterial)
518521

519522
m_MaskMaterial = mat;
520523
}
524+
else if (m_MaskMaterial != null)
525+
TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);
521526

522527
return mat;
523528
}

0 commit comments

Comments
 (0)