Skip to content

Commit

Permalink
com.unity.textmeshpro@3.0.0-preview.3
Browse files Browse the repository at this point in the history
## [3.0.0-preview.3] - 2019-12-16
  • Loading branch information
Unity Technologies committed Dec 15, 2019
1 parent 64230a7 commit 91c5c91
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 22 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# 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.1.0-preview.3] - 2019-12-16
## [3.0.0-preview.3] - 2019-12-16
## [2.1.0-preview.3]
## [1.5.0-preview.3]
### Changes
- Fixed potential issue with TMP Dropdown where calling Show() and Hide() in very short interval could result in additional Blockers. Case #1194114
Expand All @@ -21,6 +22,8 @@ These are the release notes for the TextMesh Pro UPM package which was first int
- Revised the Create Material Preset context menu option to issue a warning and ignore materials outside the project. Case #1200109
- Added experimental ITextPreprocessor interface to allow users to create custom components to handle text preprocessing and shaping. This interface includes a PreprocessText(string text) function that is called when the object contains a component that inherits from this interface.
- Added support for Unity Presets in the Editor for both <TextMeshPro> and <TextMeshProUGUI> components. Case #1191793
- Fixed missing CanvasRenderer component issue on the Input Field Caret object.
- Added padding to the 2DRectMask on the TMP Input Field - Text Area object.
- Optimization to ensure the TMP Update Manager only rebuilds text objects once per frame regardless of the number of cameras in the scene.

## [2.1.0-preview.2] - 2019-10-30
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Editor/TMP_PackageUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ private static void UpdateProjectFiles()
private static bool CheckProjectSerializationAndSourceControlModes()
{
// Check Project Asset Serialization and Visible Meta Files mode.
if (EditorSettings.serializationMode != SerializationMode.ForceText || EditorSettings.externalVersionControl != "Visible Meta Files")
if (EditorSettings.serializationMode != SerializationMode.ForceText || VersionControlSettings.mode != "Visible Meta Files")
{
return false;
}
Expand Down
14 changes: 13 additions & 1 deletion Scripts/Editor/TMP_SpriteAssetMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ namespace TMPro.EditorUtilities
public static class TMP_SpriteAssetMenu
{
// Add a Context Menu to the Sprite Asset Editor Panel to Create and Add a Default Material.
[MenuItem("CONTEXT/TMP_SpriteAsset/Add Default Material", true, 2200)]
static bool AddDefaultMaterialValidate(MenuCommand command)
{
return AssetDatabase.IsOpenForEdit(command.context);
}

[MenuItem("CONTEXT/TMP_SpriteAsset/Add Default Material", false, 2200)]
static void CopyTexture(MenuCommand command)
static void AddDefaultMaterial(MenuCommand command)
{
TMP_SpriteAsset spriteAsset = (TMP_SpriteAsset)command.context;

Expand All @@ -28,6 +34,12 @@ static void CopyTexture(MenuCommand command)
}

// Add a Context Menu to the Sprite Asset Editor Panel to update existing sprite assets.
[MenuItem("CONTEXT/TMP_SpriteAsset/Update Sprite Asset", true, 2100)]
static bool UpdateSpriteAssetValidate(MenuCommand command)
{
return AssetDatabase.IsOpenForEdit(command.context);
}

[MenuItem("CONTEXT/TMP_SpriteAsset/Update Sprite Asset", false, 2100)]
static void UpdateSpriteAsset(MenuCommand command)
{
Expand Down
33 changes: 31 additions & 2 deletions Scripts/Editor/TMPro_ContextMenus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,16 @@ static void CopyMaterialProperties(MenuCommand command)
}


// PASTE MATERIAL
//[MenuItem("CONTEXT/MaterialComponent/Paste Material Properties", false)]
// PASTE MATERIAL PROPERTIES
[MenuItem("CONTEXT/Material/Paste Material Properties", true)]
static bool PasteMaterialPropertiesValidate(MenuCommand command)
{
if (m_copiedProperties == null)
return false;

return AssetDatabase.IsOpenForEdit(command.context);
}

[MenuItem("CONTEXT/Material/Paste Material Properties", false)]
static void PasteMaterialProperties(MenuCommand command)
{
Expand Down Expand Up @@ -160,6 +168,12 @@ static void PasteMaterialProperties(MenuCommand command)


// Enable Resetting of Material properties without losing unique properties of the font atlas.
[MenuItem("CONTEXT/Material/Reset", true, 2100)]
static bool ResetSettingsValidate(MenuCommand command)
{
return AssetDatabase.IsOpenForEdit(command.context);
}

[MenuItem("CONTEXT/Material/Reset", false, 2100)]
static void ResetSettings(MenuCommand command)
{
Expand Down Expand Up @@ -236,6 +250,15 @@ static void CopyAtlas(MenuCommand command)


// This function is used for debugging and fixing potentially broken font atlas links
[MenuItem("CONTEXT/Material/Paste Atlas", true, 2001)]
static bool PasteAtlasValidate(MenuCommand command)
{
if (m_copiedAtlasProperties == null && m_copiedTexture == null)
return false;

return AssetDatabase.IsOpenForEdit(command.context);
}

[MenuItem("CONTEXT/Material/Paste Atlas", false, 2001)]
static void PasteAtlas(MenuCommand command)
{
Expand Down Expand Up @@ -325,6 +348,12 @@ static void ForceFontAssetUpgrade(MenuCommand command)
/// Clear Dynamic Font Asset data such as glyph, character and font features.
/// </summary>
/// <param name="command"></param>
[MenuItem("CONTEXT/TMP_FontAsset/Reset", true, 100)]
static bool ClearFontAssetDataValidate(MenuCommand command)
{
return AssetDatabase.IsOpenForEdit(command.context);
}

[MenuItem("CONTEXT/TMP_FontAsset/Reset", false, 100)]
static void ClearFontAssetData(MenuCommand command)
{
Expand Down
12 changes: 8 additions & 4 deletions Scripts/Editor/TMPro_CreateObjectMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ static void CreateTextMeshProObjectPerform(MenuCommand command)

if (textComponent.m_isWaitingOnResourceLoad == false)
{
// Apply TMP Settings Defaults if no Preset is defined
if (Preset.GetDefaultForObject(textComponent) == null)
// Get reference to potential Presets for <TextMeshPro> component
Preset[] presets = Preset.GetDefaultPresetsForObject(textComponent);

if (presets == null || presets.Length == 0)
{
textComponent.text = "Sample text";
textComponent.alignment = TextAlignmentOptions.TopLeft;
Expand Down Expand Up @@ -74,8 +76,10 @@ static void CreateTextMeshProGuiObjectPerform(MenuCommand menuCommand)

if (textComponent.m_isWaitingOnResourceLoad == false)
{
// Apply TMP Settings Defaults if no Preset is defined
if (Preset.GetDefaultForObject(textComponent) == null)
// Get reference to potential Presets for <TextMeshPro> component
Preset[] presets = Preset.GetDefaultPresetsForObject(textComponent);

if (presets == null || presets.Length == 0)
{
textComponent.fontSize = TMP_Settings.defaultFontSize;
textComponent.color = Color.white;
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Runtime/TMP_DefaultControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ public static GameObject CreateInputField(Resources resources)
SetDefaultColorTransitionValues(inputField);

// Use UI.Mask for Unity 5.0 - 5.1 and 2D RectMask for Unity 5.2 and up
textArea.AddComponent<RectMask2D>();
RectMask2D rectMask = textArea.AddComponent<RectMask2D>();
rectMask.padding = new Vector4(-8, -5, -8, -5);

RectTransform textAreaRectTransform = textArea.GetComponent<RectTransform>();
textAreaRectTransform.anchorMin = Vector2.zero;
Expand Down
2 changes: 2 additions & 0 deletions Scripts/Runtime/TMP_InputField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ public bool shouldHideSoftKeyboard
case RuntimePlatform.WSAPlayerX86:
case RuntimePlatform.WSAPlayerX64:
case RuntimePlatform.WSAPlayerARM:
case RuntimePlatform.Stadia:
return m_HideSoftKeyboard;
default:
return true;
Expand All @@ -438,6 +439,7 @@ public bool shouldHideSoftKeyboard
case RuntimePlatform.WSAPlayerX86:
case RuntimePlatform.WSAPlayerX64:
case RuntimePlatform.WSAPlayerARM:
case RuntimePlatform.Stadia:
SetPropertyUtility.SetStruct(ref m_HideSoftKeyboard, value);
break;
default:
Expand Down
1 change: 1 addition & 0 deletions Scripts/Runtime/TMP_SelectionCaret.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace TMPro
/// <summary>
/// A simple component that can be added to a newly created object where inheriting from MaskableGraphic is needed.
/// </summary>
[RequireComponent(typeof(CanvasRenderer))]
public class TMP_SelectionCaret : MaskableGraphic
{
/// <summary>
Expand Down
16 changes: 7 additions & 9 deletions Scripts/Runtime/TMPro_Private.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public partial class TextMeshPro
[SerializeField]
private Renderer m_renderer;
private MeshFilter m_meshFilter;
private CanvasRenderer m_CanvasRenderer;

private bool m_isFirstAllocation; // Flag to determine if this is the first allocation of the buffers.
private int m_max_characters = 8; // Determines the initial allocation and size of the character array / buffer.
Expand Down Expand Up @@ -82,11 +81,13 @@ protected override void Awake()
if (m_renderer == null)
m_renderer = gameObject.AddComponent<Renderer>();

// Get reference to CanvasRenderer (if one exists)
m_CanvasRenderer = GetComponent<CanvasRenderer>();

if (m_CanvasRenderer != null)
m_CanvasRenderer.hideFlags = HideFlags.HideInInspector;
// Remove CanvasRenderer from text object if one exists
CanvasRenderer canvasRenderer = GetComponent<CanvasRenderer>();
if (canvasRenderer != null)
{
Debug.Log("Removing unnecessary CanvasRenderer component from text object.", this);
DestroyImmediate(canvasRenderer);
}

// Cache Reference to RectTransform
m_rectTransform = this.rectTransform;
Expand Down Expand Up @@ -269,9 +270,6 @@ protected override void OnValidate()
if (meshFilter != null && m_meshFilter.hideFlags != (HideFlags.HideInInspector | HideFlags.HideAndDontSave))
m_meshFilter.hideFlags = HideFlags.HideInInspector | HideFlags.HideAndDontSave;

if (m_CanvasRenderer != null)
m_CanvasRenderer.hideFlags = HideFlags.HideInInspector;

// Additional Properties could be added to sync up Serialized Properties & Properties.

// Handle Font Asset changes in the inspector
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "com.unity.textmeshpro",
"displayName": "TextMeshPro",
"version": "2.1.0-preview.3",
"unity": "2019.1",
"version": "3.0.0-preview.3",
"unity": "2020.1",
"unityRelease": "0a10",
"description": "TextMeshPro is the ultimate text solution for Unity. It's the perfect replacement for Unity's UI Text and the legacy Text Mesh.\n\nPowerful and easy to use, TextMeshPro (also known as TMP) uses Advanced Text Rendering techniques along with a set of custom shaders; delivering substantial visual quality improvements while giving users incredible flexibility when it comes to text styling and texturing.\n\nTextMeshPro provides Improved Control over text formatting and layout with features like character, word, line and paragraph spacing, kerning, justified text, Links, over 30 Rich Text Tags available, support for Multi Font & Sprites, Custom Styles and more.\n\nGreat performance. Since the geometry created by TextMeshPro uses two triangles per character just like Unity's text components, this improved visual quality and flexibility comes at no additional performance cost.",
"keywords": [
"TextMeshPro",
Expand All @@ -18,6 +19,6 @@
"repository": {
"type": "git",
"url": "git@github.cds.internal.unity3d.com:unity/com.unity.textmeshpro.git",
"revision": "4ddcac2c259c9f2118c351755ebb4b134b9641cf"
"revision": "895ca4d54934dd808230501a874a9ce1c2652746"
}
}

0 comments on commit 91c5c91

Please sign in to comment.