Skip to content

Commit

Permalink
Change a symbol for TextMeshPro to TMP_PRESENT
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Mar 10, 2019
1 parent 8d92aba commit 4ceb771
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using UnityEngine.EventSystems;
using UnityEngine.UI;

#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
using System.Collections.Generic;
using TMPro;
#if UNITY_EDITOR
Expand All @@ -24,7 +24,7 @@ public abstract class BaseMeshEffect : UIBehaviour, IMeshModifier
//################################
// Constant or Static Members.
//################################
#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
static readonly List<Vector2> s_Uv0 = new List<Vector2> (4096);
static readonly List<Vector2> s_Uv1 = new List<Vector2> (4096);
#if UNITY_2017_1_OR_NEWER
Expand Down Expand Up @@ -58,7 +58,7 @@ public abstract class BaseMeshEffect : UIBehaviour, IMeshModifier
/// </summary>
public CanvasRenderer canvasRenderer { get { Initialize (); return _canvasRenderer; } }

#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
/// <summary>
/// The TMP_Text attached to this GameObject.
/// </summary>
Expand All @@ -84,7 +84,7 @@ public bool isTMPro
{
get
{
#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
return textMeshPro != null;
#else
return false;
Expand All @@ -100,7 +100,7 @@ public virtual Material material
get
{

#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
if (textMeshPro)
{
return textMeshPro.fontSharedMaterial;
Expand All @@ -118,7 +118,7 @@ public virtual Material material
}
set
{
#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
if (textMeshPro)
{
textMeshPro.fontSharedMaterial = value;
Expand All @@ -137,7 +137,7 @@ public virtual Material[] materials
get
{

#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
if (textMeshPro)
{
return textMeshPro.fontSharedMaterials ?? s_EmptyMaterials;
Expand Down Expand Up @@ -177,7 +177,7 @@ public virtual void ModifyMesh (VertexHelper vh)
/// </summary>
public virtual void SetVerticesDirty ()
{
#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
if (textMeshPro)
{
foreach (var info in textMeshPro.textInfo.meshInfo)
Expand Down Expand Up @@ -219,7 +219,7 @@ public virtual void SetVerticesDirty ()

public void ShowTMProWarning (Shader shader, Shader mobileShader, Shader spriteShader, System.Action<Material> onCreatedMaterial)
{
#if UNITY_EDITOR && COM_UNITY_TEXTMESHPRO
#if UNITY_EDITOR && TMP_PRESENT
if(!textMeshPro || !textMeshPro.fontSharedMaterial)
{
return;
Expand Down Expand Up @@ -327,7 +327,7 @@ protected virtual void Initialize ()
_graphic = _graphic ?? GetComponent<Graphic> ();
_canvasRenderer = _canvasRenderer ?? GetComponent<CanvasRenderer> ();
_rectTransform = _rectTransform ?? GetComponent<RectTransform> ();
#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
_textMeshPro = _textMeshPro ?? GetComponent<TMP_Text> ();
#endif
}
Expand All @@ -340,14 +340,14 @@ protected override void OnEnable ()
{
_initialized = false;
SetVerticesDirty ();
#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
if (textMeshPro)
{
TMPro_EventManager.TEXT_CHANGED_EVENT.Add (OnTextChanged);
}
#endif

#if UNITY_EDITOR && COM_UNITY_TEXTMESHPRO
#if UNITY_EDITOR && TMP_PRESENT
if (graphic && textMeshPro)
{
GraphicRebuildTracker.TrackGraphic (graphic);
Expand All @@ -372,12 +372,12 @@ protected override void OnEnable ()
/// </summary>
protected override void OnDisable ()
{
#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
TMPro_EventManager.TEXT_CHANGED_EVENT.Remove (OnTextChanged);
#endif
SetVerticesDirty ();

#if UNITY_EDITOR && COM_UNITY_TEXTMESHPRO
#if UNITY_EDITOR && TMP_PRESENT
if (graphic && textMeshPro)
{
GraphicRebuildTracker.UnTrackGraphic (graphic);
Expand All @@ -391,7 +391,7 @@ protected override void OnDisable ()
/// </summary>
protected virtual void LateUpdate ()
{
#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
if (textMeshPro)
{
if (textMeshPro.havePropertiesChanged || _isTextMeshProActive != textMeshPro.isActiveAndEnabled)
Expand Down Expand Up @@ -431,7 +431,7 @@ protected override void OnValidate ()
Graphic _graphic;
Material [] _materials = new Material [1];

#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
bool _isTextMeshProActive;
TMP_Text _textMeshPro;

Expand Down
4 changes: 2 additions & 2 deletions Assets/Coffee/UIExtensions/UIEffect/Scripts/UIShadow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected override void OnEnable()
ptex.Register(this);
}

#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
if (isTMPro)
{
textMeshPro.onCullStateChanged.AddListener (OnCullStateChanged);
Expand Down Expand Up @@ -228,7 +228,7 @@ protected override void OnValidate ()
}
#endif

#if COM_UNITY_TEXTMESHPRO
#if TMP_PRESENT
protected void OnCullStateChanged (bool state)
{
SetVerticesDirty ();
Expand Down
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ PlayerSettings:
webGLUseWasm: 0
webGLCompressionFormat: 1
scriptingDefineSymbols:
1: COM_UNITY_TEXTMESHPRO;UNITY_EDITOR
1: TMP_PRESENT
platformArchitecture:
iOS: 2
scriptingBackend:
Expand Down

0 comments on commit 4ceb771

Please sign in to comment.