private static MaterialPropertyHandler GetShaderPropertyHandler(Shader shader, string name) { string[] propertyAttributes = ShaderUtil.GetShaderPropertyAttributes(shader, name); if (propertyAttributes == null || propertyAttributes.Length == 0) { return((MaterialPropertyHandler)null); } MaterialPropertyHandler materialPropertyHandler = new MaterialPropertyHandler(); foreach (string attrib in propertyAttributes) { bool isDecorator; MaterialPropertyDrawer shaderPropertyDrawer = MaterialPropertyHandler.GetShaderPropertyDrawer(attrib, out isDecorator); if (shaderPropertyDrawer != null) { if (isDecorator) { if (materialPropertyHandler.m_DecoratorDrawers == null) { materialPropertyHandler.m_DecoratorDrawers = new List <MaterialPropertyDrawer>(); } materialPropertyHandler.m_DecoratorDrawers.Add(shaderPropertyDrawer); } else { if (materialPropertyHandler.m_PropertyDrawer != null) { Debug.LogWarning((object)string.Format("Shader property {0} already has a property drawer", (object)name), (UnityEngine.Object)shader); } materialPropertyHandler.m_PropertyDrawer = shaderPropertyDrawer; } } } return(materialPropertyHandler); }
private static MaterialPropertyHandler GetShaderPropertyHandler(Shader shader, string name) { string[] shaderPropertyAttributes = ShaderUtil.GetShaderPropertyAttributes(shader, name); if ((shaderPropertyAttributes == null) || (shaderPropertyAttributes.Length == 0)) { return(null); } MaterialPropertyHandler handler = new MaterialPropertyHandler(); foreach (string str in shaderPropertyAttributes) { bool flag; MaterialPropertyDrawer shaderPropertyDrawer = GetShaderPropertyDrawer(str, out flag); if (shaderPropertyDrawer != null) { if (flag) { if (handler.m_DecoratorDrawers == null) { handler.m_DecoratorDrawers = new List <MaterialPropertyDrawer>(); } handler.m_DecoratorDrawers.Add(shaderPropertyDrawer); } else { if (handler.m_PropertyDrawer != null) { Debug.LogWarning(string.Format("Shader property {0} already has a property drawer", name), shader); } handler.m_PropertyDrawer = shaderPropertyDrawer; } } } return(handler); }
private static MaterialPropertyHandler GetShaderPropertyHandler(Shader shader, string name) { string[] shaderPropertyAttributes = ShaderUtil.GetShaderPropertyAttributes(shader, name); MaterialPropertyHandler result; if (shaderPropertyAttributes == null || shaderPropertyAttributes.Length == 0) { result = null; } else { MaterialPropertyHandler materialPropertyHandler = new MaterialPropertyHandler(); string[] array = shaderPropertyAttributes; for (int i = 0; i < array.Length; i++) { string attrib = array[i]; bool flag; MaterialPropertyDrawer shaderPropertyDrawer = MaterialPropertyHandler.GetShaderPropertyDrawer(attrib, out flag); if (shaderPropertyDrawer != null) { if (flag) { if (materialPropertyHandler.m_DecoratorDrawers == null) { materialPropertyHandler.m_DecoratorDrawers = new List <MaterialPropertyDrawer>(); } materialPropertyHandler.m_DecoratorDrawers.Add(shaderPropertyDrawer); } else { if (materialPropertyHandler.m_PropertyDrawer != null) { Debug.LogWarning(string.Format("Shader property {0} already has a property drawer", name), shader); } materialPropertyHandler.m_PropertyDrawer = shaderPropertyDrawer; } } } result = materialPropertyHandler; } return(result); }
private static MaterialPropertyHandler GetShaderPropertyHandler(Shader shader, string name) { string[] attribs = ShaderUtil.GetShaderPropertyAttributes(shader, name); if (attribs == null || attribs.Length == 0) { return(null); } var handler = new MaterialPropertyHandler(); foreach (var attr in attribs) { bool isDecorator; MaterialPropertyDrawer drawer = GetShaderPropertyDrawer(attr, out isDecorator); if (drawer != null) { if (isDecorator) { if (handler.m_DecoratorDrawers == null) { handler.m_DecoratorDrawers = new List <MaterialPropertyDrawer>(); } handler.m_DecoratorDrawers.Add(drawer); } else { if (handler.m_PropertyDrawer != null) { Debug.LogWarning(string.Format("Shader property {0} already has a property drawer", name), shader); } handler.m_PropertyDrawer = drawer; } } } return(handler); }