TexturePropertyTwoLines() public method

public TexturePropertyTwoLines ( GUIContent label, MaterialProperty textureProp, MaterialProperty extraProperty1, GUIContent label2, MaterialProperty extraProperty2 ) : Rect
label UnityEngine.GUIContent
textureProp MaterialProperty
extraProperty1 MaterialProperty
label2 UnityEngine.GUIContent
extraProperty2 MaterialProperty
return UnityEngine.Rect
        void DoSpecularMetallicArea(Material material)
        {
            SpecularMode specularMode = (SpecularMode)material.GetInt("_SpecularMode");

            if (specularMode == SpecularMode.BlinnPhong)
            {
                if (specularMap.textureValue == null)
                {
                    m_MaterialEditor.TexturePropertyTwoLines(Styles.specularMapText, specularMap, specularColor, Styles.smoothnessText, smoothness);
                }
                else
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap);
                    m_MaterialEditor.ShaderProperty(reflectanceMin, Styles.reflectanceMinText.text, 2);
                    m_MaterialEditor.ShaderProperty(reflectanceMax, Styles.reflectanceMaxText.text, 2);
                }
            }
            else if (specularMode == SpecularMode.Metallic)
            {
                if (metallicMap.textureValue == null)
                {
                    m_MaterialEditor.TexturePropertyTwoLines(Styles.metallicMapText, metallicMap, metallic, Styles.smoothnessText, smoothness);
                }
                else
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap);
                }
            }
        }
 void DoSpecularMetallicArea()
 {
     if (m_WorkflowMode == WorkflowMode.Specular)
     {
         if (specularMap.textureValue == null)
         {
             m_MaterialEditor.TexturePropertyTwoLines(Styles.specularMapText, specularMap, specularColor, Styles.smoothnessText, smoothness);
         }
         else
         {
             m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap);
         }
     }
     else if (m_WorkflowMode == WorkflowMode.Metallic)
     {
         if (metallicMap.textureValue == null)
         {
             m_MaterialEditor.TexturePropertyTwoLines(Styles.metallicMapText, metallicMap, metallic, Styles.smoothnessText, smoothness);
         }
         else
         {
             m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap);
         }
     }
 }
示例#3
0
        void DoSpecularMetallicArea()
        {
            if (m_WorkflowMode == WorkflowMode.Specular)
            {
                if (specularMap.textureValue == null)
                {
                    if (smoothnessInAlbedo == null)
                    {
                        m_MaterialEditor.TexturePropertyTwoLines(Styles.specularMapText, specularMap, specularColor, Styles.smoothnessText, smoothness);
                    }
                    else
                    {
                        m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap, specularColor);
                        int indent = 3;
                        EditorGUI.indentLevel += indent;
                        if (!SmoothnessInAlbedoToggle())
                        {
                            m_MaterialEditor.ShaderProperty(smoothness, Styles.smoothnessText.text);
                        }
                        EditorGUI.indentLevel -= indent;
                    }
                }
                else
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap);

                    if (specularMapColorTweak != null)
                    {
                        m_MaterialEditor.ColorProperty(specularMapColorTweak, specularMapColorTweak.displayName);
                    }

                    if (smoothnessTweak1 != null && smoothnessTweak2 != null)
                    {
                        m_MaterialEditor.ShaderProperty(smoothnessTweak1, smoothnessTweak1.displayName);
                        m_MaterialEditor.ShaderProperty(smoothnessTweak2, smoothnessTweak2.displayName);

                        if (GUI.changed && smoothnessTweaks != null)
                        {
                            smoothnessTweaks.vectorValue = new Vector4(smoothnessTweak1.floatValue, smoothnessTweak2.floatValue);
                        }
                    }
                }
            }
            else if (m_WorkflowMode == WorkflowMode.Metallic)
            {
                if (metallicMap.textureValue == null)
                {
                    m_MaterialEditor.TexturePropertyTwoLines(Styles.metallicMapText, metallicMap, metallic, Styles.smoothnessText, smoothness);
                }
                else
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap);
                }
            }
        }
        bool ShaderPropertiesGUI(MaterialEditor materialEditor)
        {
            EditorGUI.BeginChangeCheck();

            // albedo
            materialEditor.TexturePropertySingleLine(_albedoText, _mainTex, _color);

            // metallic / smoothness
            if (_metallicGlossMap.textureValue == null)
                materialEditor.TexturePropertyTwoLines(_metallicText, _metallicGlossMap, _metallic, _smoothnessText, _glossiness);
            else
                materialEditor.TexturePropertySingleLine(_metallicText, _metallicGlossMap);

            // normal map
            materialEditor.TexturePropertySingleLine(_normalMapText, _bumpMap, _bumpMap.textureValue != null ? _bumpScale : null);

            // occlusion
            materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue != null ? _occlusionStrength : null);

            // emission
            bool hadEmissionTexture = _emissionMap.textureValue != null;
            materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, _colorPickerHDRConfig, false);

            // if texture was assigned and color was black set color to white
            if (_emissionMap.textureValue != null && !hadEmissionTexture)
                if (_emissionColor.colorValue.maxColorComponent <= 0)
                    _emissionColor.colorValue = Color.white;

            return EditorGUI.EndChangeCheck();
        }
示例#5
0
        void DoSpecularMetallicArea()
        {
            if (m_WorkflowMode == WorkflowMode.Specular)
            {
                if (specularMap.textureValue == null)         // 不加入spe贴图,直接读取smooth参数
                {
                    m_MaterialEditor.TexturePropertyTwoLines(Styles.specularMapText, specularMap, specularColor, Styles.smoothnessText, smoothness);
                }
                else
                {
                    //有spe贴图,分别读取spe和smooth,增加调节选项
                    m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap);
                    m_MaterialEditor.TexturePropertySingleLine(Styles.smoothMapText, smoothMap);

                    if (specularMapColorTweak != null)
                    {
                        m_MaterialEditor.ColorProperty(specularMapColorTweak, specularMapColorTweak.displayName);
                    }

                    if (smoothnessTweak1 != null && smoothnessTweak2 != null)
                    {
                        m_MaterialEditor.ShaderProperty(smoothnessTweak1, smoothnessTweak1.displayName);
                        m_MaterialEditor.ShaderProperty(smoothnessTweak2, smoothnessTweak2.displayName);

                        //把spe的倍增值和哑光值放到smoothnewssTweaks的x和y值中
                        if (GUI.changed && smoothnessTweaks != null)
                        {
                            smoothnessTweaks.vectorValue = new Vector4(smoothnessTweak1.floatValue, smoothnessTweak2.floatValue);
                        }
                    }
                }
            }
            else if (m_WorkflowMode == WorkflowMode.Metallic)
            {
                if (metallicMap.textureValue == null)
                {
                    m_MaterialEditor.TexturePropertyTwoLines(Styles.metallicMapText, metallicMap, metallic, Styles.smoothnessText, smoothness);
                }
                else
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap);
                }
            }
        }
        void DoClearCoatArea(Material material)
        {
            bool hadTexture = flakesBumpMap.textureValue != null;

            m_MaterialEditor.TexturePropertyTwoLines(Styles.flakesBumpMapText, flakesBumpMap, flakesBumpMap.textureValue != null ? flakesBumpMapScale : null, Styles.flakesBumpMapScaleText, flakesBumpMap.textureValue != null ? flakesBumpStrength : null);


            //if (hadTexture)
            {
                m_MaterialEditor.ShaderProperty(reflectionSpecular, Styles.reflectionSpecularText);
                m_MaterialEditor.ShaderProperty(reflectionGlossiness, Styles.reflectionGlossinessText);
            }
        }
示例#7
0
        void DoSpecularMetallicArea(Material material)
        {
            if (m_WorkflowMode == WorkflowMode.Specular)
            {
                GUILayout.Label(Styles.specularLabel, EditorStyles.boldLabel);

                // MAIN
                if (specularMap.textureValue == null)
                {
                    m_MaterialEditor.TexturePropertyTwoLines(Styles.specularMapText, specularMap, specularColor, Styles.smoothnessText, smoothness);
                }
                else
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap);
                }

                // TOP
                if (topMultiplier.floatValue > MIN_VALUE)
                {
                    if (specularMapTop.textureValue == null)
                    {
                        m_MaterialEditor.TexturePropertyTwoLines(Styles.specularMapTextTop, specularMapTop, specularColorTop, Styles.smoothnessTextTop, smoothnessTop);
                    }
                    else
                    {
                        m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapTextTop, specularMapTop);
                    }
                }

                // BOTTOM
                if (bottomMultiplier.floatValue > MIN_VALUE)
                {
                    if (specularMapBottom.textureValue == null)
                    {
                        m_MaterialEditor.TexturePropertyTwoLines(Styles.specularMapTextBottom, specularMapBottom, specularColorBottom, Styles.smoothnessTextBottom, smoothnessBottom);
                    }
                    else
                    {
                        m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapTextBottom, specularMapBottom);
                    }
                }
            }
            else if (m_WorkflowMode == WorkflowMode.Metallic)
            {
                GUILayout.Label(Styles.metallicLabel, EditorStyles.boldLabel);

                // MAIN
                if (metallicMap.textureValue == null)
                {
                    m_MaterialEditor.TexturePropertyTwoLines(Styles.metallicMapText, metallicMap, metallic, Styles.smoothnessText, smoothness);
                }
                else
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap);
                }

                // TOP
                if (topMultiplier.floatValue > MIN_VALUE)
                {
                    if (metallicMapTop.textureValue == null)
                    {
                        m_MaterialEditor.TexturePropertyTwoLines(Styles.metallicMapTextTop, metallicMapTop, metallicTop, Styles.smoothnessTextTop, smoothnessTop);
                    }
                    else
                    {
                        m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapTextTop, metallicMapTop);
                    }
                }

                // BOTTOM
                if (bottomMultiplier.floatValue > MIN_VALUE)
                {
                    if (metallicMapBottom.textureValue == null)
                    {
                        m_MaterialEditor.TexturePropertyTwoLines(Styles.metallicMapTextBottom, metallicMapBottom, metallicBottom, Styles.smoothnessTextBottom, smoothnessBottom);
                    }
                    else
                    {
                        m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapTextBottom, metallicMapBottom);
                    }
                }
            }
        }
 void DoSpecularArea(Material material)
 {
     m_MaterialEditor.TexturePropertyTwoLines(Styles.specularText, specularMask, specularColor, Styles.shininessText, shininess);
 }
        bool ShaderPropertiesGUI(MaterialEditor materialEditor)
        {
            EditorGUI.BeginChangeCheck();

            EditorGUILayout.LabelField("Front-face properties", EditorStyles.boldLabel);

            EditorGUILayout.Space();

            // albedo
            materialEditor.TexturePropertySingleLine(_albedoText, _mainTex, _color);

            // metallic / smoothness
            if (_metallicGlossMap.textureValue == null)
                materialEditor.TexturePropertyTwoLines(_metallicText, _metallicGlossMap, _metallic, _smoothnessText, _glossiness);
            else
                materialEditor.TexturePropertySingleLine(_metallicText, _metallicGlossMap);

            // normal map
            materialEditor.TexturePropertySingleLine(_normalMapText, _bumpMap, _bumpMap.textureValue != null ? _bumpScale : null);

            // occlusion
            materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue != null ? _occlusionStrength : null);

            // emission
            bool hadEmissionTexture = _emissionMap.textureValue != null;
            materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, _colorPickerHDRConfig, false);

            // if texture was assigned and color was black set color to white
            if (_emissionMap.textureValue != null && !hadEmissionTexture)
                if (_emissionColor.colorValue.maxColorComponent <= 0)
                    _emissionColor.colorValue = Color.white;

            EditorGUILayout.Space();

            // backface properties
            EditorGUILayout.LabelField("Back-face properties", EditorStyles.boldLabel);

            EditorGUILayout.Space();

            materialEditor.ShaderProperty(_backColor, "Color");
            materialEditor.ShaderProperty(_backMetallic, "Matallic");
            materialEditor.ShaderProperty(_backGlossiness, "Smoothness");

            return EditorGUI.EndChangeCheck();
        }