main
mob-sakai 2019-01-25 20:40:59 +09:00
parent 73321b9b62
commit 64b90da720
1 changed files with 15 additions and 10 deletions

View File

@ -27,10 +27,10 @@ namespace Coffee.UIExtensions
[SerializeField] RectTransform m_FitTarget;
[Tooltip("Fit graphic's transform to target transform on LateUpdate every frame.")]
[SerializeField] bool m_FitOnLateUpdate;
[Tooltip("Show the graphic that is associated with the unmask render area.")]
[SerializeField] bool m_ShowUnmaskGraphic = false;
[Tooltip ("Unmask affects only for children.")]
[SerializeField] bool m_OnlyForChildren = false;
[Tooltip("Show the graphic that is associated with the unmask render area.")]
[SerializeField] bool m_ShowUnmaskGraphic = false;
//################################
@ -72,7 +72,6 @@ namespace Coffee.UIExtensions
}
}
/// <summary>
/// Unmask affects only for children.
/// </summary>
@ -108,9 +107,9 @@ namespace Coffee.UIExtensions
var canvasRenderer = graphic.canvasRenderer;
if (m_OnlyForChildren)
{
canvasRenderer.hasPopInstruction = true;
StencilMaterial.Remove (_revertUnmaskMaterial);
_revertUnmaskMaterial = StencilMaterial.Add (baseMaterial, (1 << stencilDepth) - 1, StencilOp.Replace, CompareFunction.NotEqual, (ColorWriteMask)0);
canvasRenderer.hasPopInstruction = true;
canvasRenderer.popMaterialCount = 1;
canvasRenderer.SetPopMaterial (_revertUnmaskMaterial, 0);
}
@ -171,9 +170,13 @@ namespace Coffee.UIExtensions
_unmaskMaterial = null;
_revertUnmaskMaterial = null;
if (graphic)
{
var canvasRenderer = graphic.canvasRenderer;
canvasRenderer.hasPopInstruction = false;
canvasRenderer.popMaterialCount = 0;
graphic.SetMaterialDirty();
}
SetDirty ();
}
@ -192,6 +195,7 @@ namespace Coffee.UIExtensions
}
}
#if UNITY_EDITOR
/// <summary>
/// This function is called when the script is loaded or a value is changed in the inspector (Called in the editor only).
/// </summary>
@ -199,6 +203,7 @@ namespace Coffee.UIExtensions
{
SetDirty();
}
#endif
/// <summary>
/// Mark the graphic as dirty.