close #43; Display warning when material does not support Mask

pull/77/head
mob-sakai 2019-02-23 21:29:38 +09:00
parent 79bbc4de95
commit 54098eea56
1 changed files with 25 additions and 0 deletions

View File

@ -108,9 +108,34 @@ namespace Coffee.UIExtensions
} }
s_ParticleSystems.Clear (); s_ParticleSystems.Clear ();
if (current.maskable && current.material && current.material.shader)
{
var mat = current.material;
var shader = mat.shader;
foreach (var propName in s_MaskablePropertyNames)
{
if (!mat.HasProperty (propName))
{
EditorGUILayout.HelpBox (string.Format("Shader {0} doesn't have '{1}' property. This graphic is not maskable.", shader.name, propName), MessageType.Warning);
break;
}
}
}
serializedObject.ApplyModifiedProperties (); serializedObject.ApplyModifiedProperties ();
} }
static readonly List<string> s_MaskablePropertyNames = new List<string> ()
{
"_Stencil",
"_StencilComp",
"_StencilOp",
"_StencilWriteMask",
"_StencilReadMask",
"_ColorMask",
};
class AnimatedProperty class AnimatedProperty
{ {
static readonly List<string> s_ActiveNames = new List<string> (); static readonly List<string> s_ActiveNames = new List<string> ();