TextureScaleOffsetProperty() public static méthode

public static TextureScaleOffsetProperty ( Rect position, Vector4 scaleOffset ) : Vector4
position UnityEngine.Rect
scaleOffset Vector4
Résultat Vector4
Exemple #1
0
    public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
    {
        FindProperties (props); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly

        // Use default labelWidth
        EditorGUIUtility.labelWidth = 0f;

        // Detect any changes to the material
        EditorGUI.BeginChangeCheck();
        {
            GUILayout.Label (Styles.material0Header, EditorStyles.boldLabel);

            // Texture
            materialEditor.TexturePropertySingleLine (Styles.albedo, albedoMap);
            materialEditor.TexturePropertySingleLine (Styles.specular, specularMap);
            materialEditor.TexturePropertySingleLine (Styles.normal, bumpMap);
            materialEditor.TextureScaleOffsetProperty (albedoMap);

            GUILayout.Label (Styles.maskHeader, EditorStyles.boldLabel);

            materialEditor.TexturePropertySingleLine (Styles.blendMask, blendMask);
            materialEditor.TextureScaleOffsetProperty (blendMask);

            GUILayout.Label (Styles.material1Header, EditorStyles.boldLabel);

            materialEditor.TexturePropertySingleLine (Styles.albedo, albedoMap2);
            materialEditor.TexturePropertySingleLine (Styles.specular, specularMap2);
            materialEditor.TexturePropertySingleLine (Styles.normal, bumpMap2);
            materialEditor.TextureScaleOffsetProperty (albedoMap2);
        }
    }
Exemple #2
0
 protected static void DrawTileOffset(MaterialEditor materialEditor, MaterialProperty textureProp)
 {
     if (textureProp != null)
     {
         materialEditor.TextureScaleOffsetProperty(textureProp);
     }
 }
Exemple #3
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset;             // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);

                //m_MaterialEditor.TexturePropertyWithHDRColor(Styles.albedoText, albedoMap, albedoTint, m_ColorPickerHDRConfig, true);
                m_MaterialEditor.TexturePropertySingleLine(Styles.albedoText, albedoMap, albedoTint);
                m_MaterialEditor.RangeProperty(alphaTestCutoff, Styles.alphaTestCutoff);

                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                if (EditorGUI.EndChangeCheck())
                {
                    siMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset;
                }

                EditorGUILayout.Space();

                m_MaterialEditor.TexturePropertySingleLine(Styles.ppcMapText, PPCMap);
                m_MaterialEditor.RangeProperty(metalnessPower, Styles.metalnessText);
                m_MaterialEditor.RangeProperty(roughnessPower, Styles.roughnessText);
                m_MaterialEditor.ShaderProperty(roughnessInvert, Styles.roughnessInvertText);

                EditorGUILayout.Space();

                m_MaterialEditor.ShaderProperty(aoEnabled, Styles.aoEnabled);
                if (aoEnabled.floatValue == 1)
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.aoText, aoMap, aoPower);
                }

                EditorGUILayout.Space();

                DoEmissionArea(material);

                EditorGUILayout.Space();

                DoFASSArea(material);

                EditorGUILayout.Space();
            }

            if (EditorGUI.EndChangeCheck())
            {
                MaterialChanged(material);
            }

            EditorGUILayout.Space();

            GUILayout.Label(Styles.advancedPropertiesText, EditorStyles.boldLabel);
            m_MaterialEditor.ShaderProperty(cullMode, Styles.cullText);
            m_MaterialEditor.EnableInstancingField();
            m_MaterialEditor.RenderQueueField();
        }
 protected virtual void PrimaryShaderProperties(Material material)
 {
     GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
     DoAlbedoArea(material);
     DoSpecularMetallicArea();
     DoNormalArea();
     m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
     m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
     m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
     DoEmissionArea(material);
     EditorGUI.BeginChangeCheck();
     m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
     if (EditorGUI.EndChangeCheck())
     {
         emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset;                 // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
     }
 }
Exemple #6
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                m_MaterialEditor.ShaderProperty(cullModeValue, Styles.cullModeText);

                EditorGUILayout.Space();

                // Third properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }

            EditorGUILayout.Space();

            // NB renderqueue editor is not shown on purpose: we want to override it based on blend mode
            GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
            m_MaterialEditor.EnableInstancingField();
            m_MaterialEditor.DoubleSidedGIField();
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                GUILayout.Label(Styles.blendingOptionsText, EditorStyles.boldLabel);

                BlendModePopup();
                ColorModePopup();

                EditorGUILayout.Space();
                GUILayout.Label(Styles.mainOptionsText, EditorStyles.boldLabel);

                FlipbookModePopup();
                TwoSidedPopup(material);
                FadingPopup(material);
                DistortionPopup(material);

                EditorGUILayout.Space();
                GUILayout.Label(Styles.mapsOptionsText, EditorStyles.boldLabel);

                DoAlbedoArea(material);
                DoSpecularMetallicArea(material);
                DoNormalMapArea(material);
                DoEmissionArea(material);

                if (!flipbookMode.hasMixedValue && (FlipbookMode)flipbookMode.floatValue != FlipbookMode.Blended)
                {
                    EditorGUI.BeginChangeCheck();
                    m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                    if (EditorGUI.EndChangeCheck())
                    {
                        emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                    }
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj);
                }
            }

            EditorGUILayout.Space();

            GUILayout.Label(Styles.advancedOptionsText, EditorStyles.boldLabel);
            m_MaterialEditor.RenderQueueField();

            EditorGUILayout.Space();

            GUILayout.Label(Styles.requiredVertexStreamsText, EditorStyles.boldLabel);
            DoVertexStreamsArea(material);
        }
Exemple #8
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                TriplanarSpacePopup();
                m_MaterialEditor.RangeProperty(texturePower, "Texture Power");

                if (vertexColorStrength != null)
                {
                    m_MaterialEditor.RangeProperty(vertexColorStrength, Styles.vertexColorStrengthText.text);
                }

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                DoEmissionArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset;                     // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
            }
            if (EditorGUI.EndChangeCheck())
            {
                MaterialChanged(material, m_WorkflowMode);
            }
        }
Exemple #9
0
 public virtual void DoAlbedoArea()
 {
     if (shininess != null)
     {
         m_MaterialEditor.ShaderProperty(shininess, Styles.shininessText.text);
     }
     m_MaterialEditor.TexturePropertySingleLine(Styles.albedoText, albedoMap);
     m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
     m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap);
 }
Exemple #10
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                //m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                DoEmissionArea(material);
                //m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset;             // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                //GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                //m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                //m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                //m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                //m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                EditorGUILayout.Space();

                GUILayout.Label(Styles.DissloveSettings, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.DissloveMap_Tips, DissloveMap, DisslovePower);
                // m_MaterialEditor.FloatProperty(EffectSceneBrightnessScale, Styles.EffectSceneBrightnessScale_Tips.text);
                // Third properties
                //GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                //if (highlights != null)
                //    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                //if (reflections != null)
                //    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                DoEmissionArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);

                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);
                m_MaterialEditor.ShaderProperty(nearCurve, Styles.nearCurveLabel.text);
                m_MaterialEditor.ShaderProperty(farCurve, Styles.farCurveLabel.text);
                m_MaterialEditor.ShaderProperty(dist, Styles.distLabel.text);
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }
        }
Exemple #12
0
 void DoTextureScaleArea(Material material)
 {
     GUILayout.Label(Styles.textureScaleOffset, EditorStyles.boldLabel);
     m_MaterialEditor.TextureScaleOffsetProperty(mainTex);
     if (bottomMultiplier != null)
     {
         // TOP
         if (topMultiplier.floatValue > MIN_VALUE)
         {
             EditorGUILayout.Space();
             GUILayout.Label(Styles.textureScaleOffsetTop, EditorStyles.boldLabel);
             m_MaterialEditor.TextureScaleOffsetProperty(topMainTex);
         }
         // BOTTOM
         if (bottomMultiplier.floatValue > MIN_VALUE)
         {
             EditorGUILayout.Space();
             GUILayout.Label(Styles.textureScaleOffsetBottom, EditorStyles.boldLabel);
             m_MaterialEditor.TextureScaleOffsetProperty(bottomMainTex);
         }
     }
 }
        private void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;


            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);

                // Albedo, normal and uv scale/offset
                _materialEditor.TexturePropertySingleLine(Styles.albedoText, _albedoMap);
                _materialEditor.TexturePropertySingleLine(Styles.normalText, _normalMap);
                _materialEditor.TextureScaleOffsetProperty(_albedoMap);

                // Primary properties
                GUILayout.Label(Styles.crossHatchingText, EditorStyles.boldLabel);

                // Tonal Art Maps and uv scale/offset
                _materialEditor.TexturePropertySingleLine(Styles.tam0Text, _tam0);
                _materialEditor.TexturePropertySingleLine(Styles.tam1Text, _tam1);
                _materialEditor.TexturePropertySingleLine(Styles.tam2Text, _tam2);
                _materialEditor.TexturePropertySingleLine(Styles.tam3Text, _tam3);
                _materialEditor.TexturePropertySingleLine(Styles.tam4Text, _tam4);
                _materialEditor.TexturePropertySingleLine(Styles.tam5Text, _tam5);
                _materialEditor.TextureScaleOffsetProperty(_tam0);

                // Ink color
                _materialEditor.ColorProperty(_inkColor, "Ink Color");
            }
            // Setup the TAM texture array
            if (EditorGUI.EndChangeCheck())
            {
                SetupTexArray(material);
            }
        }
        public void ShaderPropertiesGUI(Material material)
        {
            EditorGUIUtility.labelWidth = 0f;

            EditorGUI.BeginChangeCheck();
            {
                GUILayout.Label(Styles.HeaderMain, EditorStyles.boldLabel);
                LightingModePopup(material);
                AlphaModePopup(material);
                BlendModePopup(material);

                EditorGUILayout.Space();
                EditorGUILayout.Space();
                m_MaterialEditor.TexturePropertySingleLine(Styles.m_MainTextureText, Properties.m_MainTexture, Properties.m_TintColor);
                m_MaterialEditor.TextureScaleOffsetProperty(Properties.m_MainTexture);


                AdditionalSettings(material);
            }
        }
        bool ShaderPropertiesGUI(MaterialEditor materialEditor)
        {
            EditorGUI.BeginChangeCheck();

            materialEditor.ShaderProperty(_colorMode, "Color Mode");

            if (_colorMode.floatValue > 0)
            {
                var rect = EditorGUILayout.GetControlRect();
                rect.x += EditorGUIUtility.labelWidth;
                rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2 - 2;
                materialEditor.ShaderProperty(rect, _color, "");
                rect.x += rect.width + 4;
                materialEditor.ShaderProperty(rect, _color2, "");
            }
            else
            {
                materialEditor.ShaderProperty(_color, " ");
            }

            EditorGUILayout.Space();

            materialEditor.ShaderProperty(_metallic, "Metallic");
            materialEditor.ShaderProperty(_smoothness, "Smoothness");

            EditorGUILayout.Space();

            materialEditor.TexturePropertySingleLine(_albedoText, _albedoMap, null);
            materialEditor.TexturePropertySingleLine(_normalMapText, _normalMap, _normalMap.textureValue ? _normalScale : null);
            materialEditor.TextureScaleOffsetProperty(_albedoMap);

            EditorGUILayout.Space();

            materialEditor.ShaderProperty(_occHeight, "Occlusion Height");
            materialEditor.ShaderProperty(_occExp, "Occlusion Exponent");
            materialEditor.ShaderProperty(_occToColor, "Occlusion To Color");

            return EditorGUI.EndChangeCheck();
        }
Exemple #16
0
        public void ShaderPropertiesGUI(Material material)
        {
            EditorGUIUtility.labelWidth = 0f;

            GUILayout.Label("Primary Textures", EditorStyles.boldLabel);
            m_MaterialEditor.TexturePropertySingleLine(Styles.tex, tex, color);

            m_MaterialEditor.TexturePropertySingleLine(Styles.norm, norm);

            m_MaterialEditor.TexturePropertySingleLine(Styles.detailNorm, detailNorm, detailNormIntensity);
            m_MaterialEditor.TextureScaleOffsetProperty(detailNorm);

            m_MaterialEditor.ShaderProperty(lodBiasDiff, Styles.lodBiasDiff);
            m_MaterialEditor.ShaderProperty(detailNormIntensitySpec, Styles.detailNormIntensitySpec);

            GUILayout.Label("Material Properties", EditorStyles.boldLabel);

            m_MaterialEditor.TexturePropertySingleLine(Styles.s_ao_sss, s_ao_sss);

            m_MaterialEditor.ShaderProperty(aoStr, Styles.aoStr);
            m_MaterialEditor.ShaderProperty(smoothRemapBlackBase, Styles.smoothRemapBlackBase);
            m_MaterialEditor.ShaderProperty(smoothRemapWhiteBase, Styles.smoothRemapWhiteBase);
            m_MaterialEditor.ShaderProperty(smoothRemapBlack, Styles.smoothRemapBlack);
            m_MaterialEditor.ShaderProperty(smoothRemapWhite, Styles.smoothRemapWhite);
            m_MaterialEditor.ShaderProperty(sssRemapBlack, Styles.sssRemapBlack);
            m_MaterialEditor.ShaderProperty(sssRemapWhite, Styles.sssRemapWhite);

            GUILayout.Label("Subsurface Scattering", EditorStyles.boldLabel);
            m_MaterialEditor.ShaderProperty(sssColor, Styles.sssColor);
            m_MaterialEditor.ShaderProperty(sssPower, Styles.sssPower);
            m_MaterialEditor.ShaderProperty(sssAmb, Styles.sssAmb);
            m_MaterialEditor.ShaderProperty(sssDist, Styles.sssDist);
            m_MaterialEditor.ShaderProperty(sssEdgeValue, Styles.sssEdgeValue);

            m_MaterialEditor.ShaderProperty(sssEdgePowerMin, Styles.sssEdgePowerMin);
            m_MaterialEditor.ShaderProperty(sssEdgePowerMax, Styles.sssEdgePowerMax);
        }
Exemple #17
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                // Blend mode
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);

                // Albedo
                _materialEditor.TexturePropertySingleLine(Styles.albedoText, _albedoMap);
                if (((BlendMode)material.GetFloat("_Mode") == BlendMode.Cutout))
                {
                    _materialEditor.ShaderProperty(_alphaCutoff, Styles.alphaCutoffText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1);
                }

                // Normal
                _materialEditor.TexturePropertySingleLine(Styles.normalText, _normalMap);

                // Emission
                bool hadEmissionTexture = _emissionMap.textureValue != null;

                // Texture and HDR color controls
                _materialEditor.TexturePropertyWithHDRColor(Styles.emissionText, _emissionMap, _emissionColor, _ColorPickerHDRConfig, false);

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

                // Draw the tiliding and offset panels of the albedo map (which we'll use for the other textures too)
                EditorGUI.BeginChangeCheck();
                _materialEditor.TextureScaleOffsetProperty(_albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    _emissionMap.textureScaleAndOffset = _normalMap.textureScaleAndOffset = _albedoMap.textureScaleAndOffset;
                }

                // HSV
                GUILayout.Label(Styles.hsvText, EditorStyles.boldLabel);
                _materialEditor.ShaderProperty(_hue, Styles.hueText.text);
                _materialEditor.ShaderProperty(_saturation, Styles.saturationText.text);
                _materialEditor.ShaderProperty(_value, Styles.valueText.text);
            }
            if (EditorGUI.EndChangeCheck())
            {
                // Set again the rendering tags and keywords
                foreach (var obj in _blendMode.targets)
                {
                    Material mat = (Material)obj;
                    switch ((BlendMode)mat.GetFloat("_Mode"))
                    {
                    case BlendMode.Opaque:
                        mat.SetOverrideTag("RenderType", "Opaque");
                        mat.DisableKeyword("_ALPHATEST_ON");
                        mat.renderQueue = -1;
                        break;

                    case BlendMode.Cutout:
                        mat.SetOverrideTag("RenderType", "TransparentCutout");
                        mat.EnableKeyword("_ALPHATEST_ON");
                        mat.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
                        break;
                    }
                }
            }
        }
Exemple #18
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            bool blendModeChanged = false;

            {
                blendModeChanged = BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                DoNormalArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Third properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }

                EditorGUILayout.Space();

                GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);

                m_MaterialEditor.RenderQueueField();
            }
            if (blendModeChanged)
            {
                foreach (var obj in blendMode.targets)
                {
                    SetupMaterialWithBlendMode((Material)obj, (BlendMode)((Material)obj).GetFloat("_Mode"), true);
                }
            }

            m_MaterialEditor.EnableInstancingField();
            m_MaterialEditor.DoubleSidedGIField();
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea(material);

                if (brightness != null)
                {
                    m_MaterialEditor.ShaderProperty(brightness, Styles.brightnessText, 0);
                }
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                DoEmissionArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset;                     // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Third properties
                GUILayout.Label(Styles.babylonText, EditorStyles.boldLabel);

                if (wireframe != null)
                {
                    m_MaterialEditor.ShaderProperty(wireframe, Styles.wireframeText);
                }

                if (cameraContrast != null)
                {
                    m_MaterialEditor.ShaderProperty(cameraContrast, Styles.cameraContrastText);
                }

                if (cameraExposure != null)
                {
                    m_MaterialEditor.ShaderProperty(cameraExposure, Styles.cameraExposureText);
                }

                if (directIntensity != null)
                {
                    m_MaterialEditor.ShaderProperty(directIntensity, Styles.directIntensityText);
                }

                if (emissiveIntensity != null)
                {
                    m_MaterialEditor.ShaderProperty(emissiveIntensity, Styles.emissiveIntensityText);
                }

                if (specularIntensity != null)
                {
                    m_MaterialEditor.ShaderProperty(specularIntensity, Styles.specularIntensityText);
                }

                if (backFaceCulling != null)
                {
                    m_MaterialEditor.ShaderProperty(backFaceCulling, Styles.backFaceCullingText);
                }

                if (twoSidedLighting != null)
                {
                    m_MaterialEditor.ShaderProperty(twoSidedLighting, Styles.twoSidedLightingText);
                }

                if (alphaMode != null)
                {
                    m_MaterialEditor.ShaderProperty(alphaMode, Styles.alphaModeText);
                }

                if (refractionTexture != null)
                {
                    m_MaterialEditor.ShaderProperty(refractionTexture, Styles.refractionTextureText);
                }

                if (indexOfRefraction != null)
                {
                    m_MaterialEditor.ShaderProperty(indexOfRefraction, Styles.indexOfRefractionText);
                }

                if (linkRefractionWithTransparency != null)
                {
                    m_MaterialEditor.ShaderProperty(linkRefractionWithTransparency, Styles.linkRefractionWithTransparencyText);
                }

                if (disableLighting != null)
                {
                    m_MaterialEditor.ShaderProperty(disableLighting, Styles.disableLightingText);
                }

                if (maxSimultaneousLights != null)
                {
                    m_MaterialEditor.ShaderProperty(maxSimultaneousLights, Styles.maxSimultaneousLightsText);
                }

                if (useEmissiveAsIllumination != null)
                {
                    m_MaterialEditor.ShaderProperty(useEmissiveAsIllumination, Styles.useEmissiveAsIlluminationText);
                }

                if (useSpecularOverAlpha != null)
                {
                    m_MaterialEditor.ShaderProperty(useSpecularOverAlpha, Styles.useSpecularOverAlphaText);
                }

                if (useRadianceOverAlpha != null)
                {
                    m_MaterialEditor.ShaderProperty(useRadianceOverAlpha, Styles.useRadianceOverAlphaText);
                }

                if (usePhysicalLightFalloff != null)
                {
                    m_MaterialEditor.ShaderProperty(usePhysicalLightFalloff, Styles.usePhysicalLightFalloffText);
                }

                // Forth properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }
                if (reflectionScale != null)
                {
                    m_MaterialEditor.ShaderProperty(reflectionScale, Styles.reflectionScaleText);
                }
                if (lightmapScale != null)
                {
                    m_MaterialEditor.ShaderProperty(lightmapScale, Styles.lightmapScaleText);
                }
                if (environmentScale != null)
                {
                    m_MaterialEditor.ShaderProperty(environmentScale, Styles.environmentScaleText);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                DoEmissionArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }

                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Third properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }

                GUILayout.Label(Styles.bakeryText, EditorStyles.boldLabel);

                m_MaterialEditor.ShaderProperty(enableDoubleSidedOn, Styles.doubleSidedLabel);
                enableDoubleSided.floatValue = enableDoubleSidedOn.floatValue > 0 ? 0 : 2;

                m_MaterialEditor.ShaderProperty(enableVertexLM, Styles.vertexLMLabel);
                if (enableVertexLM.floatValue > 0)
                {
                    m_MaterialEditor.ShaderProperty(enableVertexLMdir, Styles.vertexLMdirLabel);
                    //if (enableVertexLMdir.floatValue > 0) enableVertexLMSH.floatValue = 0;
                }
                if (enableVertexLM.floatValue > 0)
                {
                    m_MaterialEditor.ShaderProperty(enableVertexLMSH, Styles.vertexLMSHLabel);
                    //if (enableVertexLMSH.floatValue > 0) enableVertexLMdir.floatValue = 0;
                }
                if (enableVertexLM.floatValue > 0)
                {
                    m_MaterialEditor.ShaderProperty(enableVertexLMmask, Styles.vertexLMMaskLabel);
                }
                m_MaterialEditor.ShaderProperty(enableRNM, Styles.rnmLabel);
                m_MaterialEditor.ShaderProperty(enableSH, Styles.shLabel);
                if (enableSH.floatValue > 0 || enableVertexLMSH.floatValue > 0)
                {
                    m_MaterialEditor.ShaderProperty(enableSHN, Styles.shnLabel);
                }
                m_MaterialEditor.ShaderProperty(enableSpec, Styles.specLabel);
                m_MaterialEditor.ShaderProperty(enableBicubic, Styles.bicubicLabel);
                m_MaterialEditor.ShaderProperty(enablePSHN, Styles.pshnLabel);

                EditorGUILayout.Space();
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                GUILayout.Label(Styles.tessellationText, EditorStyles.boldLabel);
                if (m_WorkflowMode == WorkflowMode.Distance)
                {
                    m_MaterialEditor.ShaderProperty(tessellation, Styles.tessFacText.text);
                    m_MaterialEditor.ShaderProperty(maxdist, Styles.tessMaxText.text);
                }
                else
                {
                    m_MaterialEditor.ShaderProperty(tessellation, Styles.edgelenText.text);
                }
                m_MaterialEditor.ShaderProperty(tessphong, Styles.tessPhongText.text);
                EditorGUILayout.Space();

                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                if (!hasDispTexture)
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.albedoText2, albedoMap, albedoColor);
                }
                else
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.albedoText, albedoMap, albedoColor);
                }
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.dispmapText, dispMap);
                m_MaterialEditor.TextureScaleOffsetProperty(dispMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TextureScaleOffsetProperty(bumpMap);
                EditorGUILayout.Space();

                GUILayout.Label(Styles.displacementText, EditorStyles.boldLabel);
                m_MaterialEditor.ShaderProperty(displacement, Styles.dispScaleText.text);
                m_MaterialEditor.ShaderProperty(dispoffset, Styles.dispOffsetText.text);
                if (!hasDispTexture)
                {
                    m_MaterialEditor.ShaderProperty(displacementto, Styles.dispTileText.text);
                }
                else
                {
                    GUILayout.Label(Styles.displacementText, EditorStyles.boldLabel);
                }
                EditorGUILayout.Space();

                GUILayout.Label(Styles.matParamsText, EditorStyles.boldLabel);
                m_MaterialEditor.ShaderProperty(metallic, Styles.metallicText.text);
                m_MaterialEditor.ShaderProperty(smoothness, Styles.smoothnessText.text);
                m_MaterialEditor.ShaderProperty(specburn, Styles.specBurnText.text);
                m_MaterialEditor.ShaderProperty(specao, Styles.specularAOText.text);
                m_MaterialEditor.ShaderProperty(diffuseao, Styles.diffuseAOText.text);
                m_MaterialEditor.ShaderProperty(giao, Styles.giAOText.text);
                EditorGUILayout.Space();

                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.ShaderProperty(detailao, Styles.detailAOText.text);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                //m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);
                SetKeywords(material);
            }
        }
Exemple #22
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                GUILayout.Label(Styles.tessellationText, EditorStyles.boldLabel);
                m_MaterialEditor.ShaderProperty(tessmode, Styles.tessModeText.text);
                CheckTessMode();
                if (m_TessWorkflowMode == TessWorkflowMode.Distance)
                {
                    m_MaterialEditor.ShaderProperty(tessellation, Styles.tessFacText.text);
                    m_MaterialEditor.ShaderProperty(maxdist, Styles.tessMaxText.text);
                }
                else
                {
                    m_MaterialEditor.ShaderProperty(tessellation, Styles.edgelenText.text);
                }
                m_MaterialEditor.ShaderProperty(shadowgen, Styles.shoadowGenText.text);
                EditorGUILayout.Space();

                GUILayout.Label(Styles.displacementText, EditorStyles.boldLabel);
                m_MaterialEditor.ShaderProperty(phong, Styles.phongText.text);
                m_MaterialEditor.ShaderProperty(displacement, Styles.dispScaleText.text);
                m_MaterialEditor.ShaderProperty(dispoffset, Styles.dispOffsetText.text);
                EditorGUILayout.Space();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Third properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode, m_TessWorkflowMode);
                }
            }

            EditorGUILayout.Space();

            GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
            m_MaterialEditor.RenderQueueField();
            m_MaterialEditor.EnableInstancingField();
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();
                //ProjectionModePopup();
                if (EditorGUILayout.Toggle("Show Back Face", cullFace.floatValue > 0))
                {
                    cullFace.floatValue = 0.0f;
                    switch ((BlendMode)material.GetFloat("_Mode"))
                    {
                    case BlendMode.Opaque:
                        break;

                    case BlendMode.Cutout:
                        material.renderQueue = 2450;
                        break;

                    case BlendMode.Fade:
                        material.renderQueue = 3000;
                        break;

                    case BlendMode.Transparent:
                        material.renderQueue = 3000;
                        break;
                    }
                }
                else
                {
                    cullFace.floatValue = 2.0f;
                    switch ((BlendMode)material.GetFloat("_Mode"))
                    {
                    case BlendMode.Opaque:
                        break;

                    case BlendMode.Cutout:
                        material.renderQueue = 2450;
                        break;

                    case BlendMode.Fade:
                        material.renderQueue = 3000;
                        break;

                    case BlendMode.Transparent:
                        material.renderQueue = 3000;
                        break;
                    }
                }
                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                DoEmissionArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                m_MaterialEditor.ShaderProperty(unlit, Styles.unlitText.text);
                bool bUnlit = (unlit.floatValue != 0.0f);

                BlendModePopup();

                if (!bUnlit)
                {
                    SpecularModePopup();
                }

                EditorGUILayout.Space();

                //GUILayout.Label( Styles.primaryMapsText, EditorStyles.boldLabel );
                DoAlbedoArea(material);
                if (!bUnlit)
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                    DoSpecularMetallicArea(material);
                    m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                    if (occlusionMap.textureValue != null)
                    {
                        m_MaterialEditor.ShaderProperty(occlusionStrengthDirectDiffuse, Styles.occlusionStrengthDirectDiffuseText.text, 2);
                        m_MaterialEditor.ShaderProperty(occlusionStrengthDirectSpecular, Styles.occlusionStrengthDirectSpecularText.text, 2);
                        m_MaterialEditor.ShaderProperty(occlusionStrengthIndirectDiffuse, Styles.occlusionStrengthIndirectDiffuseText.text, 2);
                        m_MaterialEditor.ShaderProperty(occlusionStrengthIndirectSpecular, Styles.occlusionStrengthIndirectSpecularText.text, 2);
                    }
                    m_MaterialEditor.ShaderProperty(cubeMapScalar, Styles.cubeMapScalarText.text, 0);
                }
                //m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                DoEmissionArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                if (!bUnlit)
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.overrideLightmapText, overrideLightmap);
                }

                EditorGUI.BeginChangeCheck(); // !!! AV - This is from Unity's script. Can these Begin/End calls be nested like this?
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }

                if (worldAlignedTexture != null)
                {
                    m_MaterialEditor.ShaderProperty(worldAlignedTexture, Styles.worldAlignedTextureText.text);

                    if (worldAlignedTexture.floatValue != 0.0f)
                    {
                        EditorGUI.indentLevel = 2;
                        Vector3GUI(Styles.worldAlignedTextureSizeText, worldAlignedTextureSize);
                        Vector3GUI(Styles.worldAlignedTextureNormalText, worldAlignedTextureNormal);
                        Vector3GUI(Styles.worldAlignedTexturePositionText, worldAlignedTexturePosition);
                        EditorGUI.indentLevel = 0;
                    }
                }

                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                if (!bUnlit)
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                }
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj);
                }

                foreach (var obj in specularMode.targets)
                {
                    MaterialChanged((Material)obj);
                }
            }
        }
        //GUI update
        public void ShaderPropertiesGUI(Material material)
        {
            EditorGUIUtility.labelWidth = 0f;

            int indentation = 0;

            m_MaterialEditor.RenderQueueField();
            m_MaterialEditor.EnableInstancingField();

            indentation = 1;
            if (imageType.floatValue == 0)
            {
                //Mask
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.ShaderProperty(imageType, Styles.imageTypeText);
                m_MaterialEditor.ShaderProperty(maskBlendMode, Styles.maskBlendModeText, indentation);
                m_MaterialEditor.ShaderProperty(showMaskImage, Styles.showMaskImageText, indentation);
                if (EditorGUI.EndChangeCheck())
                {
                    UpdateAlphaBlendMode(material);
                    if (maskBlendMode.floatValue == (int)MaskBlend.Customize)
                    {
                        _isBlendOpen = true;
                    }
                }
            }
            else
            {
                //Image
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.ShaderProperty(imageType, Styles.imageTypeText);
                m_MaterialEditor.ShaderProperty(imageBlendMode, Styles.imageBlendModeText, indentation);
                if (EditorGUI.EndChangeCheck())
                {
                    UpdateColorBlendMode(material);
                    if (imageBlendMode.floatValue == (int)ImageBlend.Customize)
                    {
                        _isBlendOpen = true;
                    }
                }
            }
            m_MaterialEditor.ShaderProperty(multiplyAlpha, Styles.multiplyAlphaText, indentation);

            //BlendMode
            bool isBlendFoldoutOpne = EditorGUILayout.Foldout(_isBlendOpen, "BlendMode");

            if (_isBlendOpen != isBlendFoldoutOpne)
            {
                _isBlendOpen = isBlendFoldoutOpne;
            }
            if (isBlendFoldoutOpne)
            {
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.ShaderProperty(blendSrc, Styles.blendSrcText, indentation);
                m_MaterialEditor.ShaderProperty(blendDst, Styles.blendDstText, indentation);
                m_MaterialEditor.ShaderProperty(blendAlphaSrc, Styles.blendAlphaSrcText, indentation);
                m_MaterialEditor.ShaderProperty(blendAlphaDst, Styles.blendAlphaDstText, indentation);
                m_MaterialEditor.ShaderProperty(blendColorOp, Styles.blendColorOpText, indentation);
                m_MaterialEditor.ShaderProperty(blendAlphaOp, Styles.blendAlphaOpText, indentation);
                if (EditorGUI.EndChangeCheck())
                {
                    material.SetFloat("_ImageBlendMode", (float)ImageBlend.Customize);
                    material.SetFloat("_MaskBlendMode", (float)MaskBlend.Customize);
                }
            }

            indentation = 0;

            m_MaterialEditor.ShaderProperty(useAlphaMaskMap, Styles.useAlphaMaskMapText, indentation);
            if (useAlphaMaskMap.floatValue != 0)
            {
                m_MaterialEditor.TexturePropertySingleLine(Styles.alphaMaskMapText, alphaMaskMap);
                m_MaterialEditor.TextureScaleOffsetProperty(alphaMaskMap);
            }

            //MaskSetting
            m_MaterialEditor.ShaderProperty(useMaskChannel, Styles.useMaskChannelText, indentation);
            m_MaterialEditor.ShaderProperty(alphaMaskTransiton, Styles.alphaMaskTransitonText, indentation);
            m_MaterialEditor.ShaderProperty(alphaMaskEdge, Styles.alphaMaskEdgeText, indentation);       //エッジ
            m_MaterialEditor.ShaderProperty(alphaMaskInverse, Styles.alphaMaskInverseText, indentation); //Alpha反転

            m_MaterialEditor.ShaderProperty(imageIntensity, Styles.imageIntensityText, indentation);     //Alpha反転
            m_MaterialEditor.ShaderProperty(mainSpeedU, Styles.mainSpeedUText, indentation);
            m_MaterialEditor.ShaderProperty(mainSpeedV, Styles.mainSpeedVText, indentation);
            m_MaterialEditor.ShaderProperty(scale, Styles.scaleText, indentation);
            m_MaterialEditor.ShaderProperty(pixelSnap, Styles.pixelSnapText, indentation);

            //AlphaClip
            m_MaterialEditor.ShaderProperty(useUIAlphaClip, Styles.useUIAlphaClipText, indentation);
            m_MaterialEditor.ShaderProperty(cutoff, Styles.cutoffText, indentation);
            m_MaterialEditor.ShaderProperty(clipInverse, Styles.clipInverseText, indentation);
            m_MaterialEditor.ShaderProperty(alphaToMask, Styles.alphaToMaskText, indentation);

            //CullOff
            m_MaterialEditor.ShaderProperty(cullMode, Styles.cullModeText, indentation);

            //ColorMask
            m_MaterialEditor.ShaderProperty(colorMask, Styles.colorMaskText, indentation);

            //Stencil
            m_MaterialEditor.ShaderProperty(stencilComp, Styles.stencilCompText, indentation);
            m_MaterialEditor.ShaderProperty(stencilRef, Styles.stencilRefText, indentation);
            m_MaterialEditor.ShaderProperty(stencilPass, Styles.stencilPassText, indentation);

            //depth
            m_MaterialEditor.ShaderProperty(zWriteParam, Styles.zWriteParamText, indentation);
            m_MaterialEditor.ShaderProperty(zTestMode, Styles.zTestModeText, indentation);
        }
Exemple #26
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();
                m_MaterialEditor.ShaderProperty(cullMode, Styles.cullText);
                if (outlineEnabled.floatValue == 0)
                {
                    stencilRef.floatValue = 0;
                }

                GUILayout.BeginHorizontal();
                ButtonToggle(ref stylizeRamp, "Custom Ramp");
                ButtonToggle(ref stylizeSpec, "Custom Specular");
                ButtonToggle(ref stylizeRim, "Custom Rim");
                ButtonToggle(ref outlineEnabled, "Outlines");
                GUILayout.EndHorizontal();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                DoNormalArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                if (advancedChannels.floatValue == 1)
                {
                    ProperPopup(ref heightEnum, 100);
                }
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                if (advancedChannels.floatValue == 1)
                {
                    ProperPopup(ref occlusionEnum, 90);
                }
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                if (advancedChannels.floatValue == 1)
                {
                    ProperPopup(ref maskEnum, 102);
                }
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap, detailColor);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Third properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }

            EditorGUILayout.Space();

            // NB renderqueue editor is not shown on purpose: we want to override it based on blend mode
            GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
            m_MaterialEditor.ShaderProperty(advancedChannels, Styles.advancedChannelsText);
            m_MaterialEditor.EnableInstancingField();
            m_MaterialEditor.DoubleSidedGIField();
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                DoEmissionArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }

                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Third properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }

                GUILayout.Label(Styles.bakeryText, EditorStyles.boldLabel);

                m_MaterialEditor.ShaderProperty(enableDoubleSidedOn, Styles.doubleSidedLabel);
                enableDoubleSided.floatValue = enableDoubleSidedOn.floatValue > 0 ? 0 : 2;

                m_MaterialEditor.ShaderProperty(enableVertexLM, Styles.vertexLMLabel);
                if (enableVertexLM.floatValue > 0)
                {
                    m_MaterialEditor.ShaderProperty(enableVertexLMdir, Styles.vertexLMdirLabel);
                    //if (enableVertexLMdir.floatValue > 0) enableVertexLMSH.floatValue = 0;
                }
                if (enableVertexLM.floatValue > 0)
                {
                    m_MaterialEditor.ShaderProperty(enableVertexLMSH, Styles.vertexLMSHLabel);
                    //if (enableVertexLMSH.floatValue > 0) enableVertexLMdir.floatValue = 0;
                }
                if (enableVertexLM.floatValue > 0)
                {
                    m_MaterialEditor.ShaderProperty(enableVertexLMmask, Styles.vertexLMMaskLabel);
                }
                m_MaterialEditor.ShaderProperty(enableRNM, Styles.rnmLabel);
                m_MaterialEditor.ShaderProperty(enableSH, Styles.shLabel);
                if (enableSH.floatValue > 0 || enableVertexLMSH.floatValue > 0)
                {
                    m_MaterialEditor.ShaderProperty(enableSHN, Styles.shnLabel);
                }
                m_MaterialEditor.ShaderProperty(enableSpec, Styles.specLabel);
                m_MaterialEditor.ShaderProperty(enableBicubic, Styles.bicubicLabel);
                m_MaterialEditor.ShaderProperty(enablePSHN, Styles.pshnLabel);

                m_MaterialEditor.ShaderProperty(enableVolumes, Styles.volLabel);
                if (enableVolumes.floatValue > 0)
                {
                    var prevAssignedVolume = assignedVolume;
                    assignedVolume = EditorGUILayout.ObjectField(volume0.textureValue == null ? "Assign volume" : "Assign different volume", assignedVolume, typeof(BakeryVolume), true) as BakeryVolume;
                    if (prevAssignedVolume != assignedVolume)
                    {
                        volume0.textureValue    = assignedVolume.bakedTexture0;
                        volume1.textureValue    = assignedVolume.bakedTexture1;
                        volume2.textureValue    = assignedVolume.bakedTexture2;
                        volumeMask.textureValue = assignedVolume.bakedMask;
                        var b = assignedVolume.bounds;
                        volumeMin.vectorValue     = b.min;
                        volumeInvSize.vectorValue = new Vector3(1.0f / b.size.x, 1.0f / b.size.y, 1.0f / b.size.z);
                        assignedVolume            = null;
                    }
                    if (volume0.textureValue != null)
                    {
                        if (GUILayout.Button("Unset volume"))
                        {
                            volume0.textureValue      = null;
                            volume1.textureValue      = null;
                            volume2.textureValue      = null;
                            volumeMask.textureValue   = null;
                            volumeMin.vectorValue     = Vector3.zero;
                            volumeInvSize.vectorValue = Vector3.one * 1000001;
                        }
                    }
                    EditorGUILayout.LabelField("Current Volume: " + (volume0.textureValue == null ? "<none or global>" : volume0.textureValue.name.Substring(0, volume0.textureValue.name.Length - 1)));
                    EditorGUI.BeginDisabledGroup(true);
                    m_MaterialEditor.TexturePropertySingleLine(Styles.volLabel0, volume0);
                    m_MaterialEditor.TexturePropertySingleLine(Styles.volLabel1, volume1);
                    m_MaterialEditor.TexturePropertySingleLine(Styles.volLabel2, volume2);
                    m_MaterialEditor.TexturePropertySingleLine(Styles.volLabelMask, volumeMask);
                    var bmin4   = volumeMin.vectorValue;
                    var bmin    = new Vector3(bmin4.x, bmin4.y, bmin4.z);
                    var invSize = volumeInvSize.vectorValue;
                    var bmax    = new Vector3(1.0f / invSize.x + bmin.x, 1.0f / invSize.y + bmin.y, 1.0f / invSize.z + bmin.z);
                    EditorGUILayout.LabelField("Min: " + bmin);
                    EditorGUILayout.LabelField("Max: " + bmax);
                    EditorGUI.EndDisabledGroup();
                }

                EditorGUILayout.Space();
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();
            }

            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj);
                }
            }

            EditorGUI.BeginChangeCheck();
            {
                EditorGUILayout.Space();

                if ((BlendMode)material.GetFloat("_Mode") == BlendMode.Opaque || (BlendMode)material.GetFloat("_Mode") == BlendMode.Cutout)
                {
                    m_MaterialEditor.ShaderProperty(player, Styles.playerText.text);
                }

                TwoSidedPopup(material);

                if ((BlendMode)material.GetFloat("_Mode") == BlendMode.Opaque || (BlendMode)material.GetFloat("_Mode") == BlendMode.Cutout)
                {
                    m_MaterialEditor.ShaderProperty(vertexColorEnable, Styles.vertexColorEnableText.text);
                    if (vertexColorEnable.floatValue == 1)
                    {
                        m_MaterialEditor.ShaderProperty(vertexColor, Styles.vertexColorText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel);
                    }
                }

                if ((BlendMode)material.GetFloat("_Mode") == BlendMode.Fade || (BlendMode)material.GetFloat("_Mode") == BlendMode.Transparent)
                {
                    m_MaterialEditor.ShaderProperty(vertexAlpha, Styles.vertexAlphaText.text);
                    if (vertexAlpha.floatValue == 1)
                    {
                        m_MaterialEditor.ShaderProperty(vertexAlphaValue, Styles.vertexAlphaValueText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel);
                    }

                    m_MaterialEditor.ShaderProperty(extendAlpha, Styles.extendAlphaText.text);

                    ZWritePopup(material);
                }

                m_MaterialEditor.ShaderProperty(receiveFog, Styles.receiveFogText.text);

                DoVertexAnimation();


                DoRimArea(material);
                EditorGUILayout.Space();

                EditorGUILayout.Space();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                m_MaterialEditor.ShaderProperty(uvAnimation, Styles.uvAnimationText.text);
                EditorGUILayout.Space();

                DoSpecularMetallicArea();
                EditorGUILayout.Space();

                DoNormalArea();

                EditorGUILayout.Space();

                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                EditorGUILayout.Space();

                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                EditorGUILayout.Space();

                DoEmissionArea(material);
                EditorGUILayout.Space();

                EditorGUI.BeginChangeCheck();

                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.ShaderProperty(detailBlendMode, Styles.detailBlendModeText.text);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                m_MaterialEditor.TextureScaleOffsetProperty(detailMask);

                EditorGUILayout.Space();

                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);

                EditorGUILayout.Space();

                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);

                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);
                m_MaterialEditor.RenderQueueField();
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    // MaterialChanged((Material)obj, m_WorkflowMode);
                    SetMaterialKeywords((Material)obj);
                }
            }

            EditorGUILayout.Space();


            // NB renderqueue editor is not shown on purpose: we want to override it based on blend mode
            GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
            m_MaterialEditor.EnableInstancingField();
            //m_MaterialEditor.DoubleSidedGIField();
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup(material);

                EditorGUI.BeginChangeCheck();
                m_OverrideRenderQueue = EditorGUILayout.Toggle("Override Render Queue", m_OverrideRenderQueue);
                if (EditorGUI.EndChangeCheck())
                {
                    if (!m_OverrideRenderQueue)
                    {
                        switch ((BlendMode)blendMode.floatValue)
                        {
                        case BlendMode.Opaque:
                            material.renderQueue = -1;
                            break;

                        case BlendMode.Cutout:
                            material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
                            break;

                        case BlendMode.Fade:
                            material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
                            break;

                        case BlendMode.Transparent:
                            material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
                            break;
                        }
                    }
                }
                if (m_OverrideRenderQueue)
                {
                    m_MaterialEditor.RenderQueueField();
                }

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap, metallicMap.textureValue != null ? null : metallic);
                m_MaterialEditor.TexturePropertySingleLine(Styles.roughnessText, roughnessMap, roughnessMap.textureValue != null ? null : roughness);
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Third properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj);
                }
            }

            EditorGUILayout.Space();

            // NB renderqueue editor is not shown on purpose: we want to override it based on blend mode
            GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
            m_MaterialEditor.EnableInstancingField();
            m_MaterialEditor.DoubleSidedGIField();
        }
Exemple #30
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;


            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj);
                }
            }

            EditorGUI.BeginChangeCheck();
            {
                EditorGUILayout.Space();
                m_MaterialEditor.TexturePropertySingleLine(Styles.animPosTexText, animPosTex);
                m_MaterialEditor.TexturePropertySingleLine(Styles.animNormalTexText, animNormalTex);
                m_MaterialEditor.TexturePropertySingleLine(Styles.animTangentTexText, animTangentTex);
                //m_MaterialEditor.ShaderProperty(startEndFrame, Styles.startEndFrameText);
                //m_MaterialEditor.ShaderProperty(animParam0, Styles.animParam0Text);
                //m_MaterialEditor.ShaderProperty(animParam1, Styles.animParam1Text);

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                DoNormalArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();
                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);
                m_MaterialEditor.RenderQueueField();
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    // MaterialChanged((Material)obj, m_WorkflowMode);
                    SetMaterialKeywords((Material)obj);
                }
            }

            EditorGUILayout.Space();



            // NB renderqueue editor is not shown on purpose: we want to override it based on blend mode
            GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
            m_MaterialEditor.EnableInstancingField();
            m_MaterialEditor.DoubleSidedGIField();
        }
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap, metallicMap.textureValue != null ? null : metallic);
                m_MaterialEditor.TexturePropertySingleLine(Styles.roughnessText, roughnessMap, roughnessMap.textureValue != null ? null : roughness);
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Third properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj);
                }
            }

            EditorGUILayout.Space();

            // NB renderqueue editor is not shown on purpose: we want to override it based on blend mode
            GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
            m_MaterialEditor.EnableInstancingField();

            var ignoreGlobalFX = material.IsKeywordEnabled("_IGNORE_GLOBAL_FX");

            using (var changeScope = new EditorGUI.ChangeCheckScope())
            {
                ignoreGlobalFX = EditorGUILayout.Toggle("Ignore Global FX", ignoreGlobalFX);
                if (changeScope.changed)
                {
                    if (ignoreGlobalFX)
                    {
                        material.EnableKeyword("_IGNORE_GLOBAL_FX");
                    }
                    else
                    {
                        material.DisableKeyword("_IGNORE_GLOBAL_FX");
                    }
                }
            }
        }
Exemple #32
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Main Maps
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary Maps
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Forward Rendering Options
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }

            EditorGUILayout.Space();

            // Advanced Options
            GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
            m_MaterialEditor.RenderQueueField();
            m_MaterialEditor.EnableInstancingField();

            EditorGUILayout.Space();

            // Scan Properties ***
            // GUILayout.Label(Styles.rimTitle, EditorStyles.boldLabel);
            // m_MaterialEditor.ShaderProperty(rimColor, Styles.rimColorText);
            // m_MaterialEditor.ShaderProperty(rimPower, Styles.rimPowerText);
            // *******************
        }