Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [2.2.0-preview.1] - 2021-08-06
  • Loading branch information
Unity Technologies committed Aug 6, 2021
1 parent 85a22c6 commit bf4666a
Show file tree
Hide file tree
Showing 76 changed files with 4,893 additions and 1,190 deletions.
44 changes: 43 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,52 @@
# 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

## [2.2.0-preview.1] - 2021-08-06
## [1.6.0-preview.1]
## [3.2.0-pre.1]
### Changes
- Added support for manually defining Diacritical Mark-to-Base and Mark-to-Mark glyph positional adjustments in font assets.
- Updated the font asset editor to include new Mark-to-Base and Mark-to-Mark adjustment tables along with new Preview window to make it easier to edit adjustment records.
- Added OnMissingCharacter event delegate called when the requested Unicode character is missing from the font asset.
- Fixed Argument Null Exception when attempting to create a font asset via the Create Context menu prior to importing the TMP Essential Resources. Case #1290444
- Changes to Sorting Layer ID and Sorting Order of <TextMeshPro> will now be reflected on any potential sub text objects.
- Replaced Word Wrapping in the text component inspector by Text Wrapping Mode to introduce new text wrapping options that control whether whitespaces are preserved or ignored at the end of a line.
- Input Field OnSubmit event will no longer be invoked on focus change or edit cancellation. OnEndEdit will continue to be invoked on submit, focus change or cancellation of edit.
- Added support for <SHY> tag which is replaced internally by a soft hyphen or \u00AD.
- Fixed potential text parsing issue when using markup tags without using quotes to encapsulate their values or attribute values. Case #1316658.
- Revised the textInfo property to return a new TMP_TextInfo instance instead of null when the text component has not yet been awaken. Case #1318194.
- Added new property to TMP Settings to control whether or not sub text objects will be visible in the scene hierarchy.
- Added new "Clear Dynamic Data On Build" property to TMP Settings which determines if the "clearDynamicDataOnBuild" font asset property will be set to true or false on newly created dynamic font assets.
- Added fallback character lookup caching to improve subsequent lookups of these characters coming from font assets assigned as local or global fallbacks.
- Added support for Dynamic OS Font Assets. This new dynamic font asset type will enable users to use fonts present on target platforms and devices. See the following video for more details.
- Added Multi Select support to TMP Dropdown.
- Fixed issue where the <mark> tag color may be incorrect based on line breaking location. See [forum post](https://forum.unity.com/threads/rich-text-tags-dont-apply-to-space-characters-is-there-a-way.1103887/) for details.
- Fixed glyph positional adjustment (kerning) incorrectly being applied to some characters at the end of a line.
- Fixed incorrect text alignment when using <cspace> tag. Case 1333571
- Fixed potential NullReferenceException in TMP Input Field in SendTouchScreenKeyboardStatusChanged(). See [forum post](https://forum.unity.com/threads/nullreferenceexception-at-tmpro-tmp_inputfield-sendtouchscreenkeyboardstatuschanged.1109678/) for details.
- Obsoleted the SetText(string, bool) function since the text in the Text Input Box is always synced now. Re-added the SetText(string) function. See [forum post](https://forum.unity.com/threads/updating-unity-broke-tmpro.1110794/#post-7183375) for details.
- Revised GetPreferredValues(string, float, float) where it will now return the width of the longest line of text given the width restrictions. See [forum post](https://forum.unity.com/threads/question-on-getpreferredvalues-and-text-wrapping.564970/#post-7189120) for details.
- Fixed GetPreferredValues() potentially returning incorrect values. See [forum post](https://forum.unity.com/threads/question-on-getpreferredvalues-and-text-wrapping.564970/#post-7189120) for details.
- Fixed potential sub text object shader mismatch when changing the shader of the text object.
- Added isAlert property to the TMP Input Field to control if the TouchScreenKeyboard is opened in alert mode. See [forum post](https://forum.unity.com/threads/tmp_inputfield-dark-keyboard-option.698900/#post-7126367) for details.
- Added new property "shouldActivateOnSelect" to the TMP Input Field which determines if the input field will be activated automatically when selected.
- Fixed potential text rendering issue due to incorrect "Additional Shader Channels" when using nested canvases. Case #1337742
- Newly created sprite assets will now be given a unique name to prevent potential AssetDatabase issue. Case #1345123
- Fixed potential IndexOutOfRangeException in the Input Field when the text height exceeds the height of the Text Area in conjunction with using text overflow mode Ellipsis or Truncate. Case #1341172
- Fixed <mark> tag not rendering correctly when using one of the SSD shaders. See [forum post](https://forum.unity.com/threads/mobile-tmpro-support-for-mark-mark.1132414/#post-7335727) for details.
- Fixed potential culling issue that was resulting in the culling being delayed by one frame. Case #1335854
- Vertex colors of the <TextMeshPro> component will be converted to linear space when Project Settings are set to Linear color space. Case #1349920
- Fixed potential TouchScreenKeyboard handling issue in the TMP Input Field with UWP. Case #1337129
- Revised handling of <CR><LF> in the Input Field text where these characters will be treated as one when using Left, Right, Backspace and Del keys when "Allow Rich Text Editing" property is disabled. See [forum post](https://forum.unity.com/threads/pasted-r-n-arent-removed-and-break-input-fields.1139056/#post-7397879) for details.
- Added new property "keepTextSelectionVisible" to the Input Field which maintains the text selection visible when selecting other Input Fields or UI Elements. See [forum post](https://forum.unity.com/threads/input-field-selection-disappear-when-another-ui-item-is-activated.1145375/) for details.
- Fixed potential Input Field text area viewport vertical alignment issue when using a vertical scrollbar and when the child text object's vertical margins are not zero. Case #1353535
- Revised handling of SDF Scale updates where the SDF Scale will now only be updated when the lossy scale of the text object changes by more than 20%. Case #1352120

## [2.1.6] - 2021-04-23
## [1.5.6]
## [3.0.6]
### Changes
- Added compiler conditional to exclude reference to PS5 in Unity 2019.4.22f1 or older and similar for Unity 2020.2.2f1 or older.
- Removed the use of Out Variable Declarations since it is not support in C# 6.0 and causing internal testing issue on UWP.

## [2.1.5] - 2021-04-09
## [1.5.5]
Expand Down Expand Up @@ -53,6 +94,7 @@ These are the release notes for the TextMesh Pro UPM package which was first int
- Fixed issue where the material properties of fallback font assets are not updated when changing the material properties of the primary font asset via code. Case #1271468
- Fixed an issue with Text Overflow Linked mode where text would not flow correctly from one component to the other when the last character present at the break point was a linefeed "\n" or vertical tab "\v". See [forum post](https://forum.unity.com/threads/odd-line-break-behavior-in-text-with-overflow-linked.1056821/) for details.


## [2.1.3] - 2020-10-27
## [1.5.3]
## [3.0.3]
Expand Down
Binary file modified Package Resources/TMP Essential Resources.unitypackage
Binary file not shown.
Binary file modified Package Resources/TMP Examples & Extras.unitypackage
Binary file not shown.
Binary file added Package Resources/TMP Shaders.unitypackage
Binary file not shown.
7 changes: 7 additions & 0 deletions Package Resources/TMP Shaders.unitypackage.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Scripts/Editor/DropdownOptionListDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private void Init(SerializedProperty property)
m_ReorderableList = new ReorderableList(property.serializedObject, array);
m_ReorderableList.drawElementCallback = DrawOptionData;
m_ReorderableList.drawHeaderCallback = DrawHeader;
m_ReorderableList.elementHeight += 16;
m_ReorderableList.elementHeight += 40;
}

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
Expand All @@ -40,14 +40,17 @@ private void DrawOptionData(Rect rect, int index, bool isActive, bool isFocused)
SerializedProperty itemData = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index);
SerializedProperty itemText = itemData.FindPropertyRelative("m_Text");
SerializedProperty itemImage = itemData.FindPropertyRelative("m_Image");
SerializedProperty itemColor = itemData.FindPropertyRelative("m_Color");

RectOffset offset = new RectOffset(0, 0, -1, -3);
rect = offset.Add(rect);
rect.height = EditorGUIUtility.singleLineHeight;

EditorGUI.PropertyField(rect, itemText, GUIContent.none);
rect.y += EditorGUIUtility.singleLineHeight;
rect.y += EditorGUIUtility.singleLineHeight + 2;
EditorGUI.PropertyField(rect, itemImage, GUIContent.none);
rect.y += EditorGUIUtility.singleLineHeight + 2;
EditorGUI.PropertyField(rect, itemColor, GUIContent.none);
}

public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Editor/GlyphMetricsPropertyDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace TMPro.EditorUtilities
{

[CustomPropertyDrawer(typeof(GlyphMetrics))]
public class GlyphMetricsPropertyDrawer : PropertyDrawer
internal class GlyphMetricsPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
Expand Down
11 changes: 5 additions & 6 deletions Scripts/Editor/TMP_BaseEditorPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class TMP_BaseEditorPanel : Editor
static readonly GUIContent k_LineSpacingLabel = new GUIContent("Line");
static readonly GUIContent k_ParagraphSpacingLabel = new GUIContent("Paragraph");

static readonly GUIContent k_AlignmentLabel = new GUIContent("Alignment", "Horizontal and vertical aligment of the text within its container.");
static readonly GUIContent k_AlignmentLabel = new GUIContent("Alignment", "Horizontal and vertical alignment of the text within its container.");
static readonly GUIContent k_WrapMixLabel = new GUIContent("Wrap Mix (W <-> C)", "How much to favor words versus characters when distributing the text.");

static readonly GUIContent k_WrappingLabel = new GUIContent("Wrapping", "Wraps text to the next line when reaching the edge of the container.");
Expand Down Expand Up @@ -140,7 +140,7 @@ protected struct Foldout
protected SerializedProperty m_VerticalMappingProp;
protected SerializedProperty m_UvLineOffsetProp;

protected SerializedProperty m_EnableWordWrappingProp;
protected SerializedProperty m_TextWrappingModeProp;
protected SerializedProperty m_WordWrappingRatiosProp;
protected SerializedProperty m_TextOverflowModeProp;
protected SerializedProperty m_PageToDisplayProp;
Expand Down Expand Up @@ -219,7 +219,7 @@ protected virtual void OnEnable()
m_VerticalMappingProp = serializedObject.FindProperty("m_verticalMapping");
m_UvLineOffsetProp = serializedObject.FindProperty("m_uvLineOffset");

m_EnableWordWrappingProp = serializedObject.FindProperty("m_enableWordWrapping");
m_TextWrappingModeProp = serializedObject.FindProperty("m_TextWrappingMode");
m_WordWrappingRatiosProp = serializedObject.FindProperty("m_wordWrappingRatios");
m_TextOverflowModeProp = serializedObject.FindProperty("m_overflowMode");
m_PageToDisplayProp = serializedObject.FindProperty("m_pageToDisplay");
Expand Down Expand Up @@ -993,13 +993,12 @@ void DrawWrappingOverflow()
{
// TEXT WRAPPING
Rect rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
EditorGUI.BeginProperty(rect, k_WrappingLabel, m_EnableWordWrappingProp);
EditorGUI.BeginProperty(rect, k_WrappingLabel, m_TextWrappingModeProp);

EditorGUI.BeginChangeCheck();
int wrapSelection = EditorGUI.Popup(rect, k_WrappingLabel, m_EnableWordWrappingProp.boolValue ? 1 : 0, k_WrappingOptions);
EditorGUI.PropertyField(rect, m_TextWrappingModeProp);
if (EditorGUI.EndChangeCheck())
{
m_EnableWordWrappingProp.boolValue = wrapSelection == 1;
m_HavePropertiesChanged = true;
}

Expand Down
75 changes: 60 additions & 15 deletions Scripts/Editor/TMP_BaseShaderGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ static TMP_BaseShaderGUI()
protected MaterialEditor m_Editor;

protected Material m_Material;
private int m_ShaderID;

protected MaterialProperty[] m_Properties;

Expand All @@ -141,7 +142,7 @@ void PrepareGUI()
{
// There's been at least one undo/redo since the last time this GUI got constructed.
// Maybe the undo/redo was for this material? Assume that is was.
TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, m_Material as Material);
TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, m_Material);
}

s_LastSeenUndoRedoCount = s_UndoRedoCount;
Expand All @@ -154,9 +155,7 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro
this.m_Properties = properties;

if (m_IsNewGUI)
{
PrepareGUI();
}

DoDragAndDropBegin();
EditorGUI.BeginChangeCheck();
Expand All @@ -169,6 +168,13 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro
DoDragAndDropEnd();
}

public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
{
base.AssignNewShaderToMaterial(material, oldShader, newShader);

TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, material);
}

/// <summary>Override this method to create the specific shader GUI.</summary>
protected abstract void DoGUI();

Expand Down Expand Up @@ -331,7 +337,7 @@ void DoTilingOffset(Rect rect, MaterialProperty property)
float labelWidth = EditorGUIUtility.labelWidth;
int indentLevel = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
EditorGUIUtility.labelWidth = Mathf.Min(37f, rect.width * 0.40f);
EditorGUIUtility.labelWidth = Mathf.Min(40f, rect.width * 0.40f);

Vector4 vector = property.textureScaleAndOffset;

Expand Down Expand Up @@ -381,16 +387,25 @@ protected void DoUVSpeed(Rect rect, string[] names)
float labelWidth = EditorGUIUtility.labelWidth;
int indentLevel = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
EditorGUIUtility.labelWidth = Mathf.Min(37f, rect.width * 0.40f);
EditorGUIUtility.labelWidth = Mathf.Min(40f, rect.width * 0.40f);

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

EditorGUIUtility.labelWidth = 10f;
rect.width = rect.width * 0.5f - 2f;
DoFloat(rect, names[0], "X");
rect.x += rect.width + 4f;
DoFloat(rect, names[1], "Y");

if (names.Length == 1)
{
DoFloat2(rect, names[0]);
}
else
{
DoFloat(rect, names[0], "X");
rect.x += rect.width + 4f;
DoFloat(rect, names[1], "Y");
}

EditorGUIUtility.labelWidth = labelWidth;
EditorGUI.indentLevel = indentLevel;
}
Expand Down Expand Up @@ -441,14 +456,26 @@ void DoFloat(Rect rect, string name, string label)
}
}

void DoFloat2(Rect rect, string name)
{
MaterialProperty property = BeginProperty(name);

float x = EditorGUI.FloatField(rect, "X", property.vectorValue.x);
rect.x += rect.width + 4f;
float y = EditorGUI.FloatField(rect, "Y", property.vectorValue.y);

if (EndProperty())
{
property.vectorValue = new Vector2(x, y);
}
}

protected void DoSlider(string name, string label)
{
MaterialProperty property = BeginProperty(name);
Vector2 range = property.rangeLimits;
s_TempLabel.text = label;
float value = EditorGUI.Slider(
EditorGUILayout.GetControlRect(), s_TempLabel, property.floatValue, range.x, range.y
);
float value = EditorGUI.Slider(EditorGUILayout.GetControlRect(), s_TempLabel, property.floatValue, range.x, range.y);
if (EndProperty())
{
property.floatValue = value;
Expand Down Expand Up @@ -492,6 +519,21 @@ protected void DoVector(string name, string label, GUIContent[] subLabels)
}
}

bool IsNewShader()
{
if (m_Material == null)
return false;

int currentShaderID = m_Material.shader.GetInstanceID();

if (m_ShaderID == currentShaderID)
return false;

m_ShaderID = currentShaderID;

return true;
}

void DoDragAndDropBegin()
{
m_DragAndDropMinY = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true)).y;
Expand All @@ -501,15 +543,13 @@ void DoDragAndDropEnd()
{
Rect rect = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
Event evt = Event.current;

if (evt.type == EventType.DragUpdated)
{
DragAndDrop.visualMode = DragAndDropVisualMode.Generic;
evt.Use();
}
else if (
evt.type == EventType.DragPerform &&
Rect.MinMaxRect(rect.xMin, m_DragAndDropMinY, rect.xMax, rect.yMax).Contains(evt.mousePosition)
)
else if (evt.type == EventType.DragPerform && Rect.MinMaxRect(rect.xMin, m_DragAndDropMinY, rect.xMax, rect.yMax).Contains(evt.mousePosition))
{
DragAndDrop.AcceptDrag();
evt.Use();
Expand All @@ -519,6 +559,11 @@ void DoDragAndDropEnd()
PerformDrop(droppedMaterial);
}
}
else if (evt.type == EventType.DragExited)
{
if (IsNewShader())
TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, m_Material);
}
}

void PerformDrop(Material droppedMaterial)
Expand Down
3 changes: 3 additions & 0 deletions Scripts/Editor/TMP_DropdownEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class DropdownEditor : SelectableEditor
SerializedProperty m_ItemImage;
SerializedProperty m_OnSelectionChanged;
SerializedProperty m_Value;
SerializedProperty m_MultiSelect;
SerializedProperty m_AlphaFadeSpeed;
SerializedProperty m_Options;

Expand All @@ -31,6 +32,7 @@ protected override void OnEnable()
m_ItemImage = serializedObject.FindProperty("m_ItemImage");
m_OnSelectionChanged = serializedObject.FindProperty("m_OnValueChanged");
m_Value = serializedObject.FindProperty("m_Value");
m_MultiSelect = serializedObject.FindProperty("m_MultiSelect");
m_AlphaFadeSpeed = serializedObject.FindProperty("m_AlphaFadeSpeed");
m_Options = serializedObject.FindProperty("m_Options");
}
Expand All @@ -48,6 +50,7 @@ public override void OnInspectorGUI()
EditorGUILayout.PropertyField(m_ItemText);
EditorGUILayout.PropertyField(m_ItemImage);
EditorGUILayout.PropertyField(m_Value);
EditorGUILayout.PropertyField(m_MultiSelect);
EditorGUILayout.PropertyField(m_AlphaFadeSpeed);
EditorGUILayout.PropertyField(m_Options);
EditorGUILayout.PropertyField(m_OnSelectionChanged);
Expand Down
Loading

0 comments on commit bf4666a

Please sign in to comment.