private static GetShaderPropertyDrawer ( string attrib, bool &isDecorator ) : |
||
attrib | string | |
isDecorator | bool | |
return |
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); 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); }