Ejemplo n.º 1
0
        /// <summary>
        /// Function returning the modified material for masking if necessary.
        /// </summary>
        /// <param name="baseMaterial"></param>
        /// <returns></returns>
        public override Material GetModifiedMaterial(Material baseMaterial)
        {
            Material mat = baseMaterial;

            if (m_ShouldRecalculateStencil)
            {
                m_StencilValue             = TMP_MaterialManager.GetStencilID(gameObject);
                m_ShouldRecalculateStencil = false;
            }

            if (m_StencilValue > 0)
            {
                mat = TMP_MaterialManager.GetStencilMaterial(baseMaterial, m_StencilValue);
                if (m_MaskMaterial != null)
                {
                    TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);
                }

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

            return(mat);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="baseMaterial"></param>
        /// <returns></returns>
        public override Material GetModifiedMaterial(Material baseMaterial)
        {
            Material mat = baseMaterial;

            if (m_ShouldRecalculateStencil)
            {
                m_stencilID = TMP_MaterialManager.GetStencilID(gameObject);
                m_ShouldRecalculateStencil = false;
            }

            // Release masking material
            //if (m_MaskMaterial != null)
            //    MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);

            if (m_stencilID > 0)
            {
                mat = TMP_MaterialManager.GetStencilMaterial(baseMaterial, m_stencilID);
                if (m_MaskMaterial != null)
                {
                    TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);
                }

                m_MaskMaterial = mat;
            }

            return(mat);
        }
Ejemplo n.º 3
0
        void OnDestroy()
        {
            //Debug.Log("***** OnDestroy() called on Sub Object ID [" + GetInstanceID() + "]. Parent Text Object ID [" + textComponent.GetInstanceID() + "] *****");

            // Destroy Mesh
            if (m_mesh != null)
            {
                DestroyImmediate(m_mesh);
            }

            if (m_fallbackMaterial != null)
            {
                TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
                m_fallbackMaterial = null;
            }

            #if UNITY_EDITOR
            // Unregister the event this object was listening to
            TMPro_EventManager.MATERIAL_PROPERTY_EVENT.Remove(ON_MATERIAL_PROPERTY_CHANGED);
            TMPro_EventManager.FONT_PROPERTY_EVENT.Remove(ON_FONT_PROPERTY_CHANGED);
            //TMPro_EventManager.TEXTMESHPRO_PROPERTY_EVENT.Remove(ON_TEXTMESHPRO_PROPERTY_CHANGED);
            TMPro_EventManager.DRAG_AND_DROP_MATERIAL_EVENT.Remove(ON_DRAG_AND_DROP_MATERIAL);
            //TMPro_EventManager.TEXT_STYLE_PROPERTY_EVENT.Remove(ON_TEXT_STYLE_CHANGED);
            TMPro_EventManager.SPRITE_ASSET_PROPERTY_EVENT.Remove(ON_SPRITE_ASSET_PROPERTY_CHANGED);
            //TMPro_EventManager.TMP_SETTINGS_PROPERTY_EVENT.Remove(ON_TMP_SETTINGS_CHANGED);
            #endif
            m_isRegisteredForEvents = false;

            // Notify parent text object
            m_TextComponent.havePropertiesChanged = true;
            m_TextComponent.SetAllDirty();
        }
Ejemplo n.º 4
0
        void OnDestroy()
        {
            // Destroy Mesh
            if (m_mesh != null)
            {
                DestroyImmediate(m_mesh);
            }

            if (m_fallbackMaterial != null)
            {
                TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
                m_fallbackMaterial = null;
            }

#if UNITY_EDITOR
            // Unregister the event this object was listening to
            TMPro_EventManager.MATERIAL_PROPERTY_EVENT.Remove(ON_MATERIAL_PROPERTY_CHANGED);
            TMPro_EventManager.FONT_PROPERTY_EVENT.Remove(ON_FONT_PROPERTY_CHANGED);
            //TMPro_EventManager.TEXTMESHPRO_PROPERTY_EVENT.Remove(ON_TEXTMESHPRO_PROPERTY_CHANGED);
            TMPro_EventManager.DRAG_AND_DROP_MATERIAL_EVENT.Remove(ON_DRAG_AND_DROP_MATERIAL);
            //TMPro_EventManager.TEXT_STYLE_PROPERTY_EVENT.Remove(ON_TEXT_STYLE_CHANGED);
            TMPro_EventManager.SPRITE_ASSET_PROPERTY_EVENT.Remove(ON_SPRITE_ASSET_PROPERTY_CHANGED);
            //TMPro_EventManager.TMP_SETTINGS_PROPERTY_EVENT.Remove(ON_TMP_SETTINGS_CHANGED);
#endif
            m_isRegisteredForEvents = false;
        }
Ejemplo n.º 5
0
        // Event received when custom material editor properties are changed.
        void ON_MATERIAL_PROPERTY_CHANGED(bool isChanged, Material mat)
        {
            //Debug.Log("*** ON_MATERIAL_PROPERTY_CHANGED ***");
            int targetMaterialID         = mat.GetInstanceID();
            int sharedMaterialID         = m_sharedMaterial.GetInstanceID();
            int fallbackSourceMaterialID = m_fallbackSourceMaterial == null ? 0 : m_fallbackSourceMaterial.GetInstanceID();

            // Filter events and return if the affected material is not this object's material.
            if (targetMaterialID != sharedMaterialID)
            {
                // Check if event applies to the source fallback material
                if (m_fallbackMaterial != null && fallbackSourceMaterialID == targetMaterialID)
                {
                    TMP_MaterialManager.CopyMaterialPresetProperties(mat, m_fallbackMaterial);
                }
                else
                {
                    return;
                }
            }

            if (m_TextComponent == null)
            {
                m_TextComponent = GetComponentInParent <TextMeshPro>();
            }

            m_padding = GetPaddingForMaterial();

            m_TextComponent.havePropertiesChanged = true;
            m_TextComponent.SetVerticesDirty();
        }
        public static int GetStencilID(GameObject obj)
        {
            int       num       = 0;
            Transform transform = obj.transform;
            Transform y         = TMP_MaterialManager.FindRootSortOverrideCanvas(transform);

            if (transform == y)
            {
                return(num);
            }
            Transform   parent = transform.parent;
            List <Mask> list   = TMP_ListPool <Mask> .Get();

            while (parent != null)
            {
                parent.GetComponents <Mask>(list);
                for (int i = 0; i < list.Count; i++)
                {
                    Mask mask = list[i];
                    if (mask != null && mask.MaskEnabled() && mask.graphic.IsActive())
                    {
                        num++;
                        break;
                    }
                }
                if (parent == y)
                {
                    break;
                }
                parent = parent.parent;
            }
            TMP_ListPool <Mask> .Release(list);

            return(Mathf.Min((1 << num) - 1, 255));
        }
Ejemplo n.º 7
0
        protected override void OnDisable()
        {
            //Debug.Log("*** SubObject OnDisable() ***");
            //base.OnDisable();

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

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

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

            if (m_fallbackMaterial != null)
            {
                TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
                m_fallbackMaterial = null;
            }
        }
 private static void OnPreRenderCanvas()
 {
     if (TMP_MaterialManager.isFallbackListDirty)
     {
         TMP_MaterialManager.CleanupFallbackMaterials();
         TMP_MaterialManager.isFallbackListDirty = false;
     }
 }
Ejemplo n.º 9
0
 private void OnDisable()
 {
     m_meshFilter.sharedMesh = null;
     if (m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
         m_fallbackMaterial = null;
     }
 }
Ejemplo n.º 10
0
        private void ON_MATERIAL_PROPERTY_CHANGED(bool isChanged, Material mat)
        {
            int instanceID  = mat.GetInstanceID();
            int instanceID2 = m_sharedMaterial.GetInstanceID();
            int num         = (!(base.m_MaskMaterial == null)) ? base.m_MaskMaterial.GetInstanceID() : 0;
            int num2        = (!(m_fallbackSourceMaterial == null)) ? m_fallbackSourceMaterial.GetInstanceID() : 0;

            if (m_fallbackMaterial != null && num2 == instanceID)
            {
                TMP_MaterialManager.CopyMaterialPresetProperties(mat, m_fallbackMaterial);
            }
            if ((UnityEngine.Object)(object) m_TextComponent == null)
            {
                m_TextComponent = base.GetComponentInParent <TextMeshProUGUI>();
            }
            if (base.m_MaskMaterial != null)
            {
#if UNITY_EDITOR
                /*Undo.RecordObject(base.m_MaskMaterial, "Material Property Changes");
                 * Undo.RecordObject(m_sharedMaterial, "Material Property Changes");*/
#endif
                if (instanceID == instanceID2)
                {
                    float @float = base.m_MaskMaterial.GetFloat(ShaderUtilities.ID_StencilID);
                    float float2 = base.m_MaskMaterial.GetFloat(ShaderUtilities.ID_StencilComp);
                    base.m_MaskMaterial.CopyPropertiesFromMaterial(mat);
                    base.m_MaskMaterial.shaderKeywords = mat.shaderKeywords;
                    base.m_MaskMaterial.SetFloat(ShaderUtilities.ID_StencilID, @float);
                    base.m_MaskMaterial.SetFloat(ShaderUtilities.ID_StencilComp, float2);
                }
                else if (instanceID == num)
                {
                    GetPaddingForMaterial(mat);
                    m_sharedMaterial.CopyPropertiesFromMaterial(mat);
                    m_sharedMaterial.shaderKeywords = mat.shaderKeywords;
                    m_sharedMaterial.SetFloat(ShaderUtilities.ID_StencilID, 0f);
                    m_sharedMaterial.SetFloat(ShaderUtilities.ID_StencilComp, 8f);
                }
                else if (num2 == instanceID)
                {
                    float float3 = base.m_MaskMaterial.GetFloat(ShaderUtilities.ID_StencilID);
                    float float4 = base.m_MaskMaterial.GetFloat(ShaderUtilities.ID_StencilComp);
                    base.m_MaskMaterial.CopyPropertiesFromMaterial(m_fallbackMaterial);
                    base.m_MaskMaterial.shaderKeywords = m_fallbackMaterial.shaderKeywords;
                    base.m_MaskMaterial.SetFloat(ShaderUtilities.ID_StencilID, float3);
                    base.m_MaskMaterial.SetFloat(ShaderUtilities.ID_StencilComp, float4);
                }
            }
            m_padding = GetPaddingForMaterial();
            SetVerticesDirty();
            base.m_ShouldRecalculateStencil = true;
            //((MaskableGraphic)this).RecalculateClipping();
            RecalculateClipping();
            //((MaskableGraphic)this).RecalculateMasking();
            RecalculateMasking();
        }
Ejemplo n.º 11
0
        void OnDisable()
        {
            // Hide the geometry when the object is disabled.
            m_meshFilter.sharedMesh = null;

            if (m_fallbackMaterial != null)
            {
                TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
                m_fallbackMaterial = null;
            }
        }
Ejemplo n.º 12
0
 private void OnDestroy()
 {
     if (this.m_mesh != null)
     {
         Object.DestroyImmediate(this.m_mesh);
     }
     if (this.m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(this.m_fallbackMaterial);
         this.m_fallbackMaterial = null;
     }
     this.m_isRegisteredForEvents = false;
 }
Ejemplo n.º 13
0
        void OnDisable()
        {
            //Debug.Log("***** OnDisable() called on Sub Object ID [" + GetInstanceID() + "]. Parent Text Object ID [" + textComponent.GetInstanceID() + "] *****");

            // Hide the geometry when the object is disabled.
            m_meshFilter.sharedMesh = null;

            if (m_fallbackMaterial != null)
            {
                TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
                m_fallbackMaterial = null;
            }
        }
Ejemplo n.º 14
0
 private void OnDestroy()
 {
     if (m_mesh != null)
     {
         UnityEngine.Object.DestroyImmediate(m_mesh);
     }
     if (m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
         m_fallbackMaterial = null;
     }
     m_isRegisteredForEvents = false;
 }
Ejemplo n.º 15
0
 // Event received when font asset properties are changed in Font Inspector
 void ON_FONT_PROPERTY_CHANGED(bool isChanged, TMP_FontAsset font)
 {
     if (m_fontAsset != null && font.GetInstanceID() == m_fontAsset.GetInstanceID())
     {
         // Copy Normal and Bold Weight
         if (m_fallbackMaterial != null)
         {
             if (TMP_Settings.matchMaterialPreset)
             {
                 TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
                 TMP_MaterialManager.CleanupFallbackMaterials();
             }
         }
     }
 }
Ejemplo n.º 16
0
 protected override void OnDisable()
 {
     TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild(this);
     if (this.m_MaskMaterial != null)
     {
         TMP_MaterialManager.ReleaseStencilMaterial(this.m_MaskMaterial);
         this.m_MaskMaterial = null;
     }
     if (this.m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(this.m_fallbackMaterial);
         this.m_fallbackMaterial = null;
     }
     base.OnDisable();
 }
Ejemplo n.º 17
0
 protected override void OnDisable()
 {
     TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild((ICanvasElement)(object)this);
     if (base.m_MaskMaterial != null)
     {
         TMP_MaterialManager.ReleaseStencilMaterial(base.m_MaskMaterial);
         base.m_MaskMaterial = null;
     }
     if (m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
         m_fallbackMaterial = null;
     }
     //((MaskableGraphic)this).OnDisable();
     base.OnDisable();
 }
        // Event received when custom material editor properties are changed.
        void ON_MATERIAL_PROPERTY_CHANGED(bool isChanged, Material mat)
        {
            //Debug.Log("*** ON_MATERIAL_PROPERTY_CHANGED ***");
            if (m_sharedMaterial == null)
            {
                return;
            }

            int targetMaterialID         = mat.GetInstanceID();
            int sharedMaterialID         = m_sharedMaterial.GetInstanceID();
            int fallbackSourceMaterialID = m_fallbackSourceMaterial == null ? 0 : m_fallbackSourceMaterial.GetInstanceID();

            // Sync culling with parent text object
            bool  hasCullModeProperty = m_sharedMaterial.HasProperty(ShaderUtilities.ShaderTag_CullMode);
            float cullMode            = 0;

            if (hasCullModeProperty)
            {
                cullMode = textComponent.fontSharedMaterial.GetFloat(ShaderUtilities.ShaderTag_CullMode);
                m_sharedMaterial.SetFloat(ShaderUtilities.ShaderTag_CullMode, cullMode);
            }

            // Filter events and return if the affected material is not this object's material.
            if (targetMaterialID != sharedMaterialID)
            {
                // Check if event applies to the source fallback material
                if (m_fallbackMaterial != null && fallbackSourceMaterialID == targetMaterialID && TMP_Settings.matchMaterialPreset)
                {
                    TMP_MaterialManager.CopyMaterialPresetProperties(mat, m_fallbackMaterial);

                    // Re-sync culling with parent text object
                    if (hasCullModeProperty)
                    {
                        m_fallbackMaterial.SetFloat(ShaderUtilities.ShaderTag_CullMode, cullMode);
                    }
                }
                else
                {
                    return;
                }
            }

            m_padding = GetPaddingForMaterial();

            m_TextComponent.havePropertiesChanged = true;
            m_TextComponent.SetVerticesDirty();
        }
Ejemplo n.º 19
0
 private void OnDestroy()
 {
     if (m_mesh != null)
     {
         UnityEngine.Object.DestroyImmediate(m_mesh);
     }
     if (m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
         m_fallbackMaterial = null;
     }
     TMPro_EventManager.MATERIAL_PROPERTY_EVENT.Remove(ON_MATERIAL_PROPERTY_CHANGED);
     TMPro_EventManager.FONT_PROPERTY_EVENT.Remove(ON_FONT_PROPERTY_CHANGED);
     TMPro_EventManager.DRAG_AND_DROP_MATERIAL_EVENT.Remove(ON_DRAG_AND_DROP_MATERIAL);
     TMPro_EventManager.SPRITE_ASSET_PROPERTY_EVENT.Remove(ON_SPRITE_ASSET_PROPERTY_CHANGED);
     m_isRegisteredForEvents = false;
 }
        protected override void OnDisable()
        {
            //Debug.Log("*** SubObject OnDisable() ***");
            base.OnDisable();

            // if (m_MaskMaterial != null)
            // {
            //     TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial);
            //     m_MaskMaterial = null;
            // }

            if (m_fallbackMaterial != null)
            {
                TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
                m_fallbackMaterial = null;
            }
        }
Ejemplo n.º 21
0
 protected override void OnDestroy()
 {
     if (this.m_mesh != null)
     {
         Object.DestroyImmediate(this.m_mesh);
     }
     if (this.m_MaskMaterial != null)
     {
         TMP_MaterialManager.ReleaseStencilMaterial(this.m_MaskMaterial);
     }
     if (this.m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(this.m_fallbackMaterial);
         this.m_fallbackMaterial = null;
     }
     this.m_isRegisteredForEvents = false;
     this.RecalculateClipping();
 }
Ejemplo n.º 22
0
        public override Material GetModifiedMaterial(Material baseMaterial)
        {
            Material material = baseMaterial;

            if (this.m_ShouldRecalculateStencil)
            {
                this.m_StencilValue             = TMP_MaterialManager.GetStencilID(base.gameObject);
                this.m_ShouldRecalculateStencil = false;
            }
            if (this.m_StencilValue > 0)
            {
                material = TMP_MaterialManager.GetStencilMaterial(baseMaterial, this.m_StencilValue);
                if (this.m_MaskMaterial != null)
                {
                    TMP_MaterialManager.ReleaseStencilMaterial(this.m_MaskMaterial);
                }
                this.m_MaskMaterial = material;
            }
            return(material);
        }
Ejemplo n.º 23
0
        private void ON_MATERIAL_PROPERTY_CHANGED(bool isChanged, Material mat)
        {
            int instanceID  = mat.GetInstanceID();
            int instanceID2 = m_sharedMaterial.GetInstanceID();
            int num         = (!(m_fallbackSourceMaterial == null)) ? m_fallbackSourceMaterial.GetInstanceID() : 0;

            if (instanceID != instanceID2)
            {
                if (!(m_fallbackMaterial != null) || num != instanceID)
                {
                    return;
                }
                TMP_MaterialManager.CopyMaterialPresetProperties(mat, m_fallbackMaterial);
            }
            if ((UnityEngine.Object)(object) m_TextComponent == null)
            {
                m_TextComponent = GetComponentInParent <TextMeshPro>();
            }
            m_padding = GetPaddingForMaterial();
            m_TextComponent.havePropertiesChanged = true;
            ((Graphic)m_TextComponent).SetVerticesDirty();
        }
Ejemplo n.º 24
0
 protected override void OnDestroy()
 {
     if (m_mesh != null)
     {
         UnityEngine.Object.DestroyImmediate(m_mesh);
     }
     if (base.m_MaskMaterial != null)
     {
         TMP_MaterialManager.ReleaseStencilMaterial(base.m_MaskMaterial);
     }
     if (m_fallbackMaterial != null)
     {
         TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial);
         m_fallbackMaterial = null;
     }
     TMPro_EventManager.MATERIAL_PROPERTY_EVENT.Remove(ON_MATERIAL_PROPERTY_CHANGED);
     TMPro_EventManager.FONT_PROPERTY_EVENT.Remove(ON_FONT_PROPERTY_CHANGED);
     TMPro_EventManager.DRAG_AND_DROP_MATERIAL_EVENT.Remove(ON_DRAG_AND_DROP_MATERIAL);
     TMPro_EventManager.SPRITE_ASSET_PROPERTY_EVENT.Remove(ON_SPRITE_ASSET_PROPERTY_CHANGED);
     m_isRegisteredForEvents = false;
     //((MaskableGraphic)this).RecalculateClipping();
     RecalculateClipping();
 }
Ejemplo n.º 25
0
        // Event received when custom material editor properties are changed.
        void ON_MATERIAL_PROPERTY_CHANGED(bool isChanged, Material mat)
        {
            //Debug.Log("*** ON_MATERIAL_PROPERTY_CHANGED ***");

            int targetMaterialID         = mat.GetInstanceID();
            int sharedMaterialID         = m_sharedMaterial.GetInstanceID();
            int maskingMaterialID        = m_MaskMaterial == null ? 0 : m_MaskMaterial.GetInstanceID();
            int fallbackSourceMaterialID = m_fallbackSourceMaterial == null ? 0 : m_fallbackSourceMaterial.GetInstanceID();

            // Filter events and return if the affected material is not this object's material.
            //if (targetMaterialID != sharedMaterialID && targetMaterialID != maskingMaterialID) return;

            // Filter events and return if the affected material is not this object's material.
            if (m_fallbackMaterial != null && fallbackSourceMaterialID == targetMaterialID)
            {
                TMP_MaterialManager.CopyMaterialPresetProperties(mat, m_fallbackMaterial);
            }

            if (m_TextComponent == null)
            {
                m_TextComponent = GetComponentInParent <TextMeshProUGUI>();
            }

            // Make sure material properties are synchronized between the assigned material and masking material.
            if (m_MaskMaterial != null)
            {
                UnityEditor.Undo.RecordObject(m_MaskMaterial, "Material Property Changes");
                UnityEditor.Undo.RecordObject(m_sharedMaterial, "Material Property Changes");

                if (targetMaterialID == sharedMaterialID)
                {
                    //Debug.Log("Copy base material properties to masking material if not null.");
                    float stencilID   = m_MaskMaterial.GetFloat(ShaderUtilities.ID_StencilID);
                    float stencilComp = m_MaskMaterial.GetFloat(ShaderUtilities.ID_StencilComp);
                    m_MaskMaterial.CopyPropertiesFromMaterial(mat);
                    m_MaskMaterial.shaderKeywords = mat.shaderKeywords;

                    m_MaskMaterial.SetFloat(ShaderUtilities.ID_StencilID, stencilID);
                    m_MaskMaterial.SetFloat(ShaderUtilities.ID_StencilComp, stencilComp);
                }
                else if (targetMaterialID == maskingMaterialID)
                {
                    // Update the padding
                    GetPaddingForMaterial(mat);

                    m_sharedMaterial.CopyPropertiesFromMaterial(mat);
                    m_sharedMaterial.shaderKeywords = mat.shaderKeywords;
                    m_sharedMaterial.SetFloat(ShaderUtilities.ID_StencilID, 0);
                    m_sharedMaterial.SetFloat(ShaderUtilities.ID_StencilComp, 8);
                }
                else if (fallbackSourceMaterialID == targetMaterialID)
                {
                    float stencilID   = m_MaskMaterial.GetFloat(ShaderUtilities.ID_StencilID);
                    float stencilComp = m_MaskMaterial.GetFloat(ShaderUtilities.ID_StencilComp);
                    m_MaskMaterial.CopyPropertiesFromMaterial(m_fallbackMaterial);
                    m_MaskMaterial.shaderKeywords = m_fallbackMaterial.shaderKeywords;

                    m_MaskMaterial.SetFloat(ShaderUtilities.ID_StencilID, stencilID);
                    m_MaskMaterial.SetFloat(ShaderUtilities.ID_StencilComp, stencilComp);
                }
            }

            m_padding = GetPaddingForMaterial();

            SetVerticesDirty();
            m_ShouldRecalculateStencil = true;
            RecalculateClipping();
            RecalculateMasking();
        }