GetPropertyDescription() private method

private GetPropertyDescription ( Shader s, int propertyIdx ) : string
s UnityEngine.Shader
propertyIdx int
return string
        private static void ShowShaderProperties(Shader s)
        {
            GUILayout.Space(5f);
            GUILayout.Label("Properties:", EditorStyles.boldLabel, new GUILayoutOption[0]);
            int propertyCount = ShaderUtil.GetPropertyCount(s);

            for (int i = 0; i < propertyCount; i++)
            {
                string propertyName = ShaderUtil.GetPropertyName(s, i);
                string label        = ShaderInspector.GetPropertyType(s, i) + ShaderUtil.GetPropertyDescription(s, i);
                EditorGUILayout.LabelField(propertyName, label, new GUILayoutOption[0]);
            }
        }
示例#2
0
        private static void ShowShaderProperties(Shader s)
        {
            GUILayout.Space(kSpace);
            GUILayout.Label("Properties:", EditorStyles.boldLabel);
            int n = ShaderUtil.GetPropertyCount(s);

            for (int i = 0; i < n; ++i)
            {
                string pname = ShaderUtil.GetPropertyName(s, i);
                string pdesc = GetPropertyType(s, i) + ShaderUtil.GetPropertyDescription(s, i);
                EditorGUILayout.LabelField(pname, pdesc);
            }
        }
        protected override void ResetValues()
        {
            base.ResetValues();
            this.m_Properties.Clear();
            ShaderImporter shaderImporter = base.target as ShaderImporter;

            if (!(shaderImporter == null))
            {
                Shader shader = shaderImporter.GetShader();
                if (!(shader == null))
                {
                    int propertyCount = ShaderUtil.GetPropertyCount(shader);
                    for (int i = 0; i < propertyCount; i++)
                    {
                        if (ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
                        {
                            string  propertyName        = ShaderUtil.GetPropertyName(shader, i);
                            string  propertyDescription = ShaderUtil.GetPropertyDescription(shader, i);
                            bool    flag = !ShaderUtil.IsShaderPropertyNonModifiableTexureProperty(shader, i);
                            Texture texture;
                            if (!flag)
                            {
                                texture = shaderImporter.GetNonModifiableTexture(propertyName);
                            }
                            else
                            {
                                texture = shaderImporter.GetDefaultTexture(propertyName);
                            }
                            ShaderImporterInspector.TextureProp item = new ShaderImporterInspector.TextureProp
                            {
                                propertyName = propertyName,
                                texture      = texture,
                                dimension    = ShaderUtil.GetTexDim(shader, i),
                                displayName  = propertyDescription,
                                modifiable   = flag
                            };
                            this.m_Properties.Add(item);
                        }
                    }
                }
            }
        }
        private static void ShowShaderProperties(Shader s)
        {
            GUILayout.Space(5f);
            GUILayout.Label("Properties:", EditorStyles.boldLabel, new GUILayoutOption[0]);
            int propertyCount = ShaderUtil.GetPropertyCount(s);

            for (int index = 0; index < propertyCount; ++index)
            {
                EditorGUILayout.LabelField(ShaderUtil.GetPropertyName(s, index), ShaderInspector.GetPropertyType(s, index) + ShaderUtil.GetPropertyDescription(s, index), new GUILayoutOption[0]);
            }
        }