Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [3.0.0-preview.4] - 2020-01-31
  • Loading branch information
Unity Technologies committed Jan 30, 2020
1 parent 91c5c91 commit 12b5cf0
Show file tree
Hide file tree
Showing 14 changed files with 515 additions and 346 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# Changelog
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

## [3.0.0-preview.4] - 2020-01-31
## [2.1.0-preview.4]
## [1.5.0-preview.4]
### Changes
- 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.
- Improved Input Field handling of Vertical Scrollbar in conjunction with the ResetOnDeActivation property. Using the Vertical Scrollbar no longer triggers OnEndEdit event.
- Fixed potential Missing Component Exception that could occur when a TMP_SubMeshUI object is created.
- Fixed MissingReferenceException when deleting a TMP prefab that is part of a nested prefab. Case #1207793
- 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
- Fixed potential Null Reference Exception with the TMP DropDown that could occur when using the experimental Editor "Enter Play Mode" feature. Case #1207915
- Fixed potential issue with the assignment of sub text object materials.
- Add support for hiding the soft keyboard for Switch in the TMP Input Field.
- 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.
- Added support for the new Selected state and color to the TMP Input Field. Case #1210496
- Fixed additional instances of TMP Resource Importer window being created when deleting the "TextMesh Pro" folder just after having imported them. Case #1205848
- Added public ITextPreprocessor textPreprocessor; property to allow setting the text preprocessor for a given text component.

## [3.0.0-preview.3] - 2019-12-16
## [2.1.0-preview.3]
## [1.5.0-preview.3]
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Editor/TMPro_CreateObjectMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static void CreateTextMeshProGuiObjectPerform(MenuCommand menuCommand)
GameObject go = TMP_DefaultControls.CreateText(GetStandardResources());

// Override text color and font size
TextMeshProUGUI textComponent = go.GetComponent<TextMeshProUGUI>();
TextMeshProUGUI textComponent = go.GetComponent<TextMeshProUGUI>();

if (textComponent.m_isWaitingOnResourceLoad == false)
{
Expand Down
10 changes: 5 additions & 5 deletions Scripts/Runtime/TMP_Dropdown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,10 @@ protected TMP_Dropdown() { }

protected override void Awake()
{
#if UNITY_EDITOR
if (!Application.isPlaying)
return;
#endif
//#if UNITY_EDITOR
// if (!Application.isPlaying)
// return;
//#endif

m_AlphaTweenRunner = new TweenRunner<FloatTween>();
m_AlphaTweenRunner.Init(this);
Expand Down Expand Up @@ -1157,4 +1157,4 @@ private void OnSelectItem(Toggle toggle)
Hide();
}
}
}
}
2 changes: 1 addition & 1 deletion Scripts/Runtime/TMP_FontFeatureTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class TMP_FontFeatureTable
/// <summary>
/// List that contains the glyph pair adjustment records.
/// </summary>
internal List<TMP_GlyphPairAdjustmentRecord> glyphPairAdjustmentRecords
public List<TMP_GlyphPairAdjustmentRecord> glyphPairAdjustmentRecords
{
get { return m_GlyphPairAdjustmentRecords; }
set { m_GlyphPairAdjustmentRecords = value; }
Expand Down
75 changes: 47 additions & 28 deletions Scripts/Runtime/TMP_InputField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ public bool shouldHideSoftKeyboard
case RuntimePlatform.WSAPlayerX64:
case RuntimePlatform.WSAPlayerARM:
case RuntimePlatform.Stadia:
case RuntimePlatform.Switch:
return m_HideSoftKeyboard;
default:
return true;
Expand All @@ -440,6 +441,7 @@ public bool shouldHideSoftKeyboard
case RuntimePlatform.WSAPlayerX64:
case RuntimePlatform.WSAPlayerARM:
case RuntimePlatform.Stadia:
case RuntimePlatform.Switch:
SetPropertyUtility.SetStruct(ref m_HideSoftKeyboard, value);
break;
default:
Expand All @@ -462,6 +464,7 @@ private bool isKeyboardUsingEvents()
case RuntimePlatform.Android:
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.tvOS:
case RuntimePlatform.Switch:
return false;
default:
return true;
Expand Down Expand Up @@ -732,7 +735,7 @@ public bool resetOnDeActivation
private bool m_SelectionStillActive = false;
private bool m_ReleaseSelection = false;

private GameObject m_SelectedObject;
private GameObject m_PreviouslySelectedObject;

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

if (selectedObject == null && m_ResetOnDeActivation)
{
ReleaseSelection();
return;
}

if (selectedObject != null && selectedObject != this.gameObject)
{
if (selectedObject != m_SelectedObject)
if (selectedObject != m_PreviouslySelectedObject)
{
m_SelectedObject = selectedObject;
m_PreviouslySelectedObject = selectedObject;

// Release current selection of the newly selected object is another Input Field
if (selectedObject.GetComponent<TMP_InputField>() != null)
// Special handling for Vertical Scrollbar
if (m_VerticalScrollbar && selectedObject == m_VerticalScrollbar.gameObject)
{
// Release selection
m_SelectionStillActive = false;
MarkGeometryAsDirty();
m_SelectedObject = null;
// Do not release selection
return;
}
else
{
// Release selection for all objects when ResetOnDeActivation is true
if (m_ResetOnDeActivation)
{
ReleaseSelection();
return;
}

// Release current selection of selected object is another Input Field
if (selectedObject.GetComponent<TMP_InputField>() != null)
ReleaseSelection();
}
}

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

m_SelectionStillActive = false;

MarkGeometryAsDirty();
ReleaseSelection();

return;
}
Expand Down Expand Up @@ -2120,7 +2138,12 @@ public virtual void OnUpdateSelected(BaseEventData eventData)
/// <param name="eventData"></param>
public virtual void OnScroll(PointerEventData eventData)
{
if (m_TextComponent.preferredHeight < m_TextViewport.rect.height) return;
// Return if Single Line
if (m_LineType == LineType.SingleLine)
return;

if (m_TextComponent.preferredHeight < m_TextViewport.rect.height)
return;

float scrollDirection = -eventData.scrollDelta.y;

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

AdjustTextPositionRelativeToViewport(m_ScrollPosition);

// Disable focus until user re-selected the input field.
m_AllowInput = false;

if (m_VerticalScrollbar)
{
m_IsUpdatingScrollbarValues = true;
Expand Down Expand Up @@ -3948,7 +3968,13 @@ public void OnControlClick()
public void ReleaseSelection()
{
m_SelectionStillActive = false;
m_ReleaseSelection = false;
m_PreviouslySelectedObject = null;

MarkGeometryAsDirty();

SendOnEndEdit();
SendOnEndTextSelection();
}

public void DeactivateInputField(bool clearSelection = false)
Expand Down Expand Up @@ -3983,18 +4009,11 @@ public void DeactivateInputField(bool clearSelection = false)
//m_StringPosition = m_StringSelectPosition = 0;
//m_CaretPosition = m_CaretSelectPosition = 0;
//m_TextComponent.rectTransform.localPosition = m_DefaultTransformPosition;

//if (caretRectTrans != null)
// caretRectTrans.localPosition = Vector3.zero;

m_SelectionStillActive = false;
m_ReleaseSelection = false;
m_SelectedObject = null;

if (m_VerticalScrollbar == null)
ReleaseSelection();
}

SendOnEndEdit();
SendOnEndTextSelection();

inputSystem.imeCompositionMode = IMECompositionMode.Auto;
}

Expand Down Expand Up @@ -4173,7 +4192,7 @@ void SetToCustom(CharacterValidation characterValidation)
protected override void DoStateTransition(SelectionState state, bool instant)
{
if (m_HasDoneFocusTransition)
state = SelectionState.Highlighted;
state = SelectionState.Selected;
else if (state == SelectionState.Pressed)
m_HasDoneFocusTransition = true;

Expand Down Expand Up @@ -4329,4 +4348,4 @@ public static bool SetClass<T>(ref T currentValue, T newValue) where T : class
return true;
}
}
}
}
12 changes: 9 additions & 3 deletions Scripts/Runtime/TMP_PackageResourceImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,17 @@ public class TMP_PackageResourceImporterWindow : EditorWindow
[SerializeField]
TMP_PackageResourceImporter m_ResourceImporter;

static TMP_PackageResourceImporterWindow m_ImporterWindow;

public static void ShowPackageImporterWindow()
{
var window = GetWindow<TMP_PackageResourceImporterWindow>();
window.titleContent = new GUIContent("TMP Importer");
window.Focus();
if (m_ImporterWindow == null)
{
m_ImporterWindow = GetWindow<TMP_PackageResourceImporterWindow>();
m_ImporterWindow.titleContent = new GUIContent("TMP Importer");
}

m_ImporterWindow.Focus();
}

void OnEnable()
Expand Down
11 changes: 8 additions & 3 deletions Scripts/Runtime/TMP_SubMeshUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace TMPro
{
[ExecuteAlways]
[RequireComponent(typeof(CanvasRenderer))]
public class TMP_SubMeshUI : MaskableGraphic, IClippable, IMaskable, IMaterialModifier
{
/// <summary>
Expand Down Expand Up @@ -274,9 +275,13 @@ protected override void OnEnable()
protected override void OnDisable()
{
//Debug.Log("*** SubObject OnDisable() ***");
//base.OnDisable();

//m_canvasRenderer.Clear();
TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild(this);
//TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild(this);

if (canvasRenderer != null)
canvasRenderer.Clear();

if (m_MaskMaterial != null)
{
Expand All @@ -289,8 +294,6 @@ protected override void OnDisable()
TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
m_fallbackMaterial = null;
}

base.OnDisable();
}


Expand Down Expand Up @@ -518,6 +521,8 @@ public override Material GetModifiedMaterial(Material baseMaterial)

m_MaskMaterial = mat;
}
else if (m_MaskMaterial != null)
TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);

return mat;
}
Expand Down
Loading

0 comments on commit 12b5cf0

Please sign in to comment.