RangeProperty() public method

public RangeProperty ( MaterialProperty prop, string label ) : float
prop MaterialProperty
label string
return float
        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.RangeProperty(occlusionStrength, "Occlusion Strength");
                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);
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }
        }
示例#2
0
        void DoEmissionArea(Material material)
        {
            // Emission for GI?
            if (m_MaterialEditor.EmissionEnabledProperty())
            {
                bool hadEmissionTexture = emissionMap.textureValue != null;

                // Texture and HDR color controls
                m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, m_ColorPickerHDRConfig, false);

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

                // change the GI flag and fix it up with emissive as black if necessary
                m_MaterialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true);

                m_MaterialEditor.RangeProperty(_EmissionMultiplier, CustomStyles._EmissionMultiplier);
            }
        }
        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);
                m_MaterialEditor.ColorProperty(sectionColor, "_SectionColor");
                if (inverse != null)
                {
                    m_MaterialEditor.ShaderProperty(inverse, Styles.inverseText);
                }
                if (stencilMask != null)
                {
                    m_MaterialEditor.RangeProperty(stencilMask, "_StencilMask");
                }
                // 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();
                if (retractBackfaces != null)
                {
                    m_MaterialEditor.ShaderProperty(retractBackfaces, Styles.retractBackfacesText);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }

            EditorGUILayout.Space();

            GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
            m_MaterialEditor.RenderQueueField();
            m_MaterialEditor.EnableInstancingField();
        }
        private void AdditionalSettings(Material material)
        {
            //----------------------------------------HDR MULTIPLIER
            //----------------------------------------
            if (Properties.m_HDRMultiplier != null)
            {
                if ((LightingModes)m_LightingMode.floatValue == LightingModes.MultiLightEmissive ||
                    (LightingModes)m_LightingMode.floatValue == LightingModes.LitEmissive)
                {
                    m_MaterialEditor.RegisterPropertyChangeUndo(Styles.m_HDRMultiplierText.text);
                    m_MaterialEditor.FloatProperty(Properties.m_HDRMultiplier, Styles.m_HDRMultiplierText.text);
                }
            }
            EditorGUILayout.Space();

            //----------------------------------------SHADOW CUTOFF
            //----------------------------------------
            if (Properties.m_Cutoff != null)
            {
                m_MaterialEditor.RegisterPropertyChangeUndo(Styles.m_CutoffText.text);
                m_MaterialEditor.RangeProperty(Properties.m_Cutoff, Styles.m_CutoffText.text);
            }
            EditorGUILayout.Space();

            //----------------------------------------THICKNESS
            //----------------------------------------
            if (Properties.m_Thickness != null)
            {
                m_MaterialEditor.RegisterPropertyChangeUndo(Styles.m_ThicknessText.text);
                m_MaterialEditor.RangeProperty(Properties.m_Thickness, Styles.m_ThicknessText.text);
            }
            EditorGUILayout.Space();

            //----------------------------------------ALPHA TRANSMITANCE
            //----------------------------------------
            if (Properties.m_AlphaTransmitance != null)
            {
                var backLight = EditorGUILayout.Toggle(Styles.m_AlphaTransmitanceToggle, m_AlphaTransmitanceEnabled);

                if (backLight)
                {
                    material.EnableKeyword(Keywords.AlphaTransmitance);

                    m_MaterialEditor.RegisterPropertyChangeUndo(Styles.m_AlphaTransmitanceText.text);
                    m_MaterialEditor.RangeProperty(Properties.m_AlphaTransmitance, Styles.m_AlphaTransmitanceText.text);
                    m_MaterialEditor.RegisterPropertyChangeUndo(Styles.m_AlphaContrastText.text);
                    m_MaterialEditor.RangeProperty(Properties.m_AlphaContrast, Styles.m_AlphaContrastText.text);
                }
                else
                {
                    material.DisableKeyword(Keywords.AlphaTransmitance);
                }
            }
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            //----------------------------------------ADDITIONAL SETTINGS
            //----------------------------------------
            GUILayout.Label(Styles.HeaderOptional, EditorStyles.boldLabel);
            //----------------------------------------SOFT PARTICLES
            //----------------------------------------
            if (Properties.m_InvFade != null)
            {
                var softParticles = EditorGUILayout.Toggle(Styles.m_SoftParticlesToggle, m_SoftParticlesEnabled);

                if (softParticles)
                {
                    material.EnableKeyword(Keywords.SoftParticles);

                    m_MaterialEditor.RegisterPropertyChangeUndo(Styles.m_InvFadeText.text);
                    m_MaterialEditor.RangeProperty(Properties.m_InvFade, Styles.m_InvFadeText.text);
                }
                else
                {
                    material.DisableKeyword(Keywords.SoftParticles);
                }
            }
            EditorGUILayout.Space();

            //----------------------------------------DISTANCE FADE
            //----------------------------------------
            if (Properties.m_DistanceFadeStart != null && Properties.m_DistanceFadeEnd != null)
            {
                var distanceFade = EditorGUILayout.Toggle(Styles.m_DistanceFadeToggle, m_DistanceFadeEnabled);

                if (distanceFade)
                {
                    material.EnableKeyword(Keywords.DistanceFade);

                    m_MaterialEditor.RegisterPropertyChangeUndo(Styles.m_DistanceFadeStartText.text);
                    m_MaterialEditor.FloatProperty(Properties.m_DistanceFadeStart, Styles.m_DistanceFadeStartText.text);
                    m_MaterialEditor.RegisterPropertyChangeUndo(Styles.m_DistanceFadeEndText.text);
                    m_MaterialEditor.FloatProperty(Properties.m_DistanceFadeEnd, Styles.m_DistanceFadeEndText.text);
                }
                else
                {
                    material.DisableKeyword(Keywords.DistanceFade);
                }
            }
        }
示例#5
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");

                m_MaterialEditor.RangeProperty(topMultiplier, "Top Multiplier");
                m_MaterialEditor.RangeProperty(bottomMultiplier, "Bottom Multiplier");

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

                DoAlbedoArea(material);
                DoSpecularMetallicArea(material);

                // bump
                GUILayout.Label(Styles.normalLabel, EditorStyles.boldLabel);

                m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                if (topMultiplier.floatValue > MIN_VALUE)
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapTextTop, bumpMapTop, bumpMapTop.textureValue != null ? bumpScaleTop : null);
                }
                if (bottomMultiplier.floatValue > MIN_VALUE)
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapTextBottom, bumpMapBottom, bumpMapBottom.textureValue != null ? bumpScaleBottom : null);
                }

                DoEmissionArea(material);

                // MAIN
                EditorGUILayout.Space();
                GUILayout.Label(Styles.textureScaleOffset, EditorStyles.boldLabel);
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);

                // TOP
                if (topMultiplier.floatValue > MIN_VALUE)
                {
                    EditorGUILayout.Space();
                    GUILayout.Label(Styles.textureScaleOffsetTop, EditorStyles.boldLabel);
                    m_MaterialEditor.TextureScaleOffsetProperty(albedoMapTop);
                }

                // BOTTOM
                if (bottomMultiplier.floatValue > MIN_VALUE)
                {
                    EditorGUILayout.Space();
                    GUILayout.Label(Styles.textureScaleOffsetBottom, EditorStyles.boldLabel);
                    m_MaterialEditor.TextureScaleOffsetProperty(albedoMapBottom);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                MaterialChanged(material, m_WorkflowMode);
            }
        }
        }                          //end onGUI

        public void ShaderPropertiesGUI(Material material, MaterialProperty[] props)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                Color bCol = GUI.backgroundColor;
                GUI.backgroundColor = new Color(0.9f, 1.0f, 0.9f, 0.9f);
                GUI.backgroundColor = bCol;


                //===============================================================================================
                EditorGUILayout.BeginVertical("Button");                 /////////////////////////////////////////////////// MAIN
                GUILayout.Label(Titles.mainMapsText, EditorStyles.boldLabel);
                // show/hide block
                if (true)                  //_MainShown.floatValue==1) {
                {
                    Color col = GUI.color;
                    GUI.color = new Color(1.0f, 0.0f, 0.0f, 1f);
                    Rect rect = GUILayoutUtility.GetLastRect();
                    rect.x += EditorGUIUtility.currentViewWidth - 50;
                    EditorGUI.BeginChangeCheck();
                    float nval = EditorGUI.Foldout(rect, _MainShown.floatValue == 1, "") ? 1 : 0;
                    if (EditorGUI.EndChangeCheck())
                    {
                        _MainShown.floatValue = nval;
                    }
                    GUI.color = col;
                }
                if (_MainShown.floatValue == 1)                  //------------------------------ready to reveal parameters

                {
                    GUILayout.Label(Titles.globalHeaderText, EditorStyles.boldLabel);
                    m_MaterialEditor.RangeProperty(overallIntensity, "Fade Out Effects on Material");
                    m_MaterialEditor.TexturePropertySingleLine(Titles.maskText, maskMap);
                    m_MaterialEditor.TextureScaleOffsetProperty(maskMap);


                    GUILayout.Space(25);

                    GUILayout.Label(Titles.mainHeaderText, EditorStyles.boldLabel);
                    m_MaterialEditor.TexturePropertySingleLine(Titles.baseMapText, baseMap, baseMapColor);
                    m_MaterialEditor.TexturePropertySingleLine(Titles.baseNormal1Text, normalMain1, normalMainPOW);
                    m_MaterialEditor.TexturePropertySingleLine(Titles.specMapText, baseGlossMap, baseGlossColor);


                    if (baseGlossMap.textureValue == null)
                    {
                        m_MaterialEditor.ShaderProperty(mainGloss, "Smoothness", 2);
                    }
                    m_MaterialEditor.ShaderProperty(mainNormalBlendChoice, "Choose Normal Channel", 2);
                    m_MaterialEditor.ShaderProperty(mainNormalMultiplier, "Blend Tile Multiplier", 2);
                    m_MaterialEditor.ShaderProperty(mainNormalDetailBlend, "Blend Normals Amount", 2);

                    m_MaterialEditor.TextureScaleOffsetProperty(baseMap);


                    //m_MaterialEditor.RangeProperty (mainGloss, "Main Smoothness");



                    //albedoMap2.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.EndVertical();                 /////////////////////////////////////////////////////////////////
                //===============================================================================================

                EditorGUILayout.Space();

                //===============================================================================================
                EditorGUILayout.BeginVertical("Button");                 ////////////////////////////////////////////////// TOP
                GUI.backgroundColor = bCol;
                GUILayout.Label(Titles.topMapsText, EditorStyles.boldLabel);
                // show/hide block
                if (true)
                {
                    Color col = GUI.color;
                    GUI.color = new Color(1.0f, 1.0f, 0f, 1f);
                    Rect rect = GUILayoutUtility.GetLastRect();
                    rect.x += EditorGUIUtility.currentViewWidth - 47;

                    EditorGUI.BeginChangeCheck();
                    float nval = EditorGUI.Foldout(rect, _TopShown.floatValue == 1, "") ? 1 : 0;
                    if (EditorGUI.EndChangeCheck())
                    {
                        _TopShown.floatValue = nval;
                    }

                    GUI.color = col;
                }
                if (_TopShown.floatValue == 1)
                {
                    //====================================================================Actual properties to dislay
                    EditorGUILayout.BeginVertical("box");
                    m_MaterialEditor.ShaderProperty(topDirection, "Top direction");
                    m_MaterialEditor.RangeProperty(topGlossAmount, "Top Smoothness");
                    m_MaterialEditor.RangeProperty(topLevel, "Top Level");
                    m_MaterialEditor.RangeProperty(topDepth, "Top Depth");

                    EditorGUILayout.EndVertical();
                    GUILayout.Space(10);
                    m_MaterialEditor.TexturePropertySingleLine(Titles.topMapText, topBase, topColor);
                    m_MaterialEditor.RangeProperty(topBlendAlbedo, "Top Albedo Multiply");
                    m_MaterialEditor.TexturePropertySingleLine(Titles.topNormal1Text, topNorm, topNormPOW);
                    m_MaterialEditor.ShaderProperty(topNormBlendChoice, "Normal Blend Channel");
                    m_MaterialEditor.ShaderProperty(topDetailMultiplier, "Tile Normal Channel");
                    m_MaterialEditor.RangeProperty(topBlendNorm, "Blend Top Normals");

                    m_MaterialEditor.TextureScaleOffsetProperty(topBase);
                    GUILayout.Space(10);


                    //===============================================================================================
                    EditorGUILayout.BeginVertical("Button");                     /////////////////////////////////////////////////// TOP MASK
                    GUILayout.Label(Titles.topMapMaskText, EditorStyles.boldLabel);
                    // show/hide block
                    if (true)
                    {
                        Color col = GUI.color;
                        GUI.color = new Color(1.0f, 0.0f, 0.0f, 1f);
                        Rect rect = GUILayoutUtility.GetLastRect();
                        rect.x += EditorGUIUtility.currentViewWidth - 57;
                        EditorGUI.BeginChangeCheck();
                        float nval = EditorGUI.Foldout(rect, _Mask1Shown.floatValue == 1, "") ? 1 : 0;
                        if (EditorGUI.EndChangeCheck())
                        {
                            _Mask1Shown.floatValue = nval;
                        }
                        GUI.color = col;
                    }
                    if (_Mask1Shown.floatValue == 1)
                    {
                        m_MaterialEditor.ShaderProperty(topMaskChoice, "Top Mask Channel 1");
                        m_MaterialEditor.ShaderProperty(showTopMask, "Visualize Mask");
                        m_MaterialEditor.ShaderProperty(topMaskDepth, "Mask Depth");
                        m_MaterialEditor.ShaderProperty(topMaskIntensityDepth, "Intensity Depth");
                        m_MaterialEditor.ShaderProperty(topMaskTiling, "Mask 1 Tiling");
                        GUILayout.Space(10);

                        m_MaterialEditor.ShaderProperty(topMaskChoice2, "Top Mask Channel 2");
                        m_MaterialEditor.ShaderProperty(topMaskTiling2, "Mask 2 Tiling");
                        m_MaterialEditor.ShaderProperty(topMaskBlendStyle, "Blend Style");
                        m_MaterialEditor.ShaderProperty(topMask2BlendAmount, "Blend Amount");
                        m_MaterialEditor.ShaderProperty(topMaskDepth2, "2nd Mask Depth");
                        m_MaterialEditor.ShaderProperty(topMaskIntensityDepth2, "2nd Intensity Depth");
                        GUILayout.Space(10);
                    }
                    EditorGUILayout.EndVertical();             ///////////////////////////////////////////////////////////////// END TOP MASK
                }
                EditorGUILayout.EndVertical();                 /////////////////////////////////////////////////////// END TOP
                //===============================================================================================

                EditorGUILayout.Space();


                //===============================================================================================
                EditorGUILayout.BeginVertical("Button");                 ////////////////////////////////////////////////// SNOW
                GUI.backgroundColor = bCol;
                GUILayout.Label(Titles.snowMapsText, EditorStyles.boldLabel);
                // show/hide block
                if (true)
                {
                    Color col = GUI.color;
                    GUI.color = new Color(1.0f, 1.0f, 0f, 1f);
                    Rect rect = GUILayoutUtility.GetLastRect();
                    rect.x += EditorGUIUtility.currentViewWidth - 47;

                    EditorGUI.BeginChangeCheck();
                    float nval = EditorGUI.Foldout(rect, _SnowShown.floatValue == 1, "") ? 1 : 0;
                    //float nval =EditorGUILayout.ToggleLeft (Titles.snowMapsText, _SnowShown.floatValue == 1, EditorStyles.boldLabel) ? 1 : 0;
                    if (EditorGUI.EndChangeCheck())
                    {
                        _SnowShown.floatValue = nval;
                    }

                    GUI.color = col;
                }
                if (_SnowShown.floatValue == 1)
                {
                    //====================================================================Actual properties to dislay
                    EditorGUILayout.BeginVertical("box");
                    m_MaterialEditor.ShaderProperty(snowDisplace, "Vertex Snow Displacement?");
                    m_MaterialEditor.ShaderProperty(snowDirection, "Snow direction");
                    m_MaterialEditor.RangeProperty(snowGlossAmount, "Smoothness");
                    m_MaterialEditor.RangeProperty(snowLevel, "Snow Level");
                    m_MaterialEditor.RangeProperty(snowDepth, "Snow Depth");
                    EditorGUILayout.EndVertical();
                    GUILayout.Space(10);
                    m_MaterialEditor.TexturePropertySingleLine(Titles.snowMapText, snowBase, snowColor);
                    m_MaterialEditor.TexturePropertySingleLine(Titles.snowNormal1Text, snowNorm, snowNormPOW);
                    m_MaterialEditor.TexturePropertySingleLine(Titles.snowNormal2Text, snowNorm2);
                    m_MaterialEditor.RangeProperty(snowBlendNorm, "Blend Normals");
                    m_MaterialEditor.TexturePropertySingleLine(Titles.snowspecMapText, snowGlossMap, snowGlossTiling);
                    m_MaterialEditor.TextureScaleOffsetProperty(snowBase);
                    GUILayout.Space(10);



                    //===============================================================================================
                    EditorGUILayout.BeginVertical("Button");                     /////////////////////////////////////////////////// SNOW MASK
                    GUILayout.Label(Titles.snowMapMaskText, EditorStyles.boldLabel);
                    // show/hide block
                    if (true)
                    {
                        Color col = GUI.color;
                        GUI.color = new Color(1.0f, 0.0f, 0.0f, 1f);
                        Rect rect = GUILayoutUtility.GetLastRect();
                        rect.x += EditorGUIUtility.currentViewWidth - 57;
                        EditorGUI.BeginChangeCheck();
                        float nval = EditorGUI.Foldout(rect, _SnowMaskShown.floatValue == 1, "") ? 1 : 0;
                        if (EditorGUI.EndChangeCheck())
                        {
                            _SnowMaskShown.floatValue = nval;
                        }
                        GUI.color = col;
                    }
                    if (_SnowMaskShown.floatValue == 1)
                    {
                        //====================================================== Now show parameters
                        m_MaterialEditor.ShaderProperty(snowMaskChoice, "Snow Mask Channel 1");
                        m_MaterialEditor.ShaderProperty(showSnowMask, "Visualize Snow Mask");
                        m_MaterialEditor.ShaderProperty(snowMaskDepth, "Main Mask Depth");
                        m_MaterialEditor.ShaderProperty(snowMaskIntensityDepth, "Intensity Depth");
                        m_MaterialEditor.ShaderProperty(snowMaskTiling, "1st Mask Tiling");
                        GUILayout.Space(10);

                        m_MaterialEditor.ShaderProperty(snowMaskChoice2, "Snow Mask Channel 2");
                        m_MaterialEditor.ShaderProperty(snowMaskTiling2, "2nd Mask Tiling");
                        m_MaterialEditor.ShaderProperty(snowMaskBlendStyle, "Blend Style");
                        m_MaterialEditor.ShaderProperty(snowMask2BlendAmount, "Blend Amount");
                        m_MaterialEditor.ShaderProperty(snowMaskDepth2, "2nd Mask Depth");
                        m_MaterialEditor.ShaderProperty(snowMaskIntensityDepth2, "2nd Intensity Depth");
                        GUILayout.Space(10);
                    }
                    EditorGUILayout.EndVertical(); ///////////////////////////////////////////////////////////////// END SNOW MASK
                }
                EditorGUILayout.EndVertical();     /////////////////////////////////////////////////////// END SNOW
                //===============================================================================================
            }                                      ///END BeginChangeCheck

            if (EditorGUI.EndChangeCheck())
            {
                //
            }
        } //end ShaderPropertiesGUI
示例#7
0
        public void ShaderPropertiesGUI(Material material, MaterialProperty[] properties)
        {
            EditorGUIUtility.labelWidth = 0f;

            GUILayout.Label("Leaf form and size", EditorStyles.boldLabel);

            ShowShapeTypePopUp();

            m_MaterialEditor.ShaderProperty(_Size, "Leaf Length");

            m_MaterialEditor.RangeProperty(_LowerWidth, "Base width");
            m_MaterialEditor.RangeProperty(_UpperWidth, "Upper width");

            EditorGUILayout.Space();

            GUILayout.Label("Leafs detail", EditorStyles.boldLabel);

            m_MaterialEditor.RangeProperty(_LeafCuts, "Leaf cuts (Leaf Quality)");
            m_MaterialEditor.RangeProperty(_VisibleRange, "Visible range");
            m_MaterialEditor.RangeProperty(_LODDistance, "LoD Distance");
            m_MaterialEditor.RangeProperty(_DetailReductionFactor, "Detail reduction factor");

            ShowLeafsPerTrianglePopUp();

            EditorGUILayout.Space();

            m_MaterialEditor.ShaderProperty(_EnableBasePlane, "Enable mesh base");

            EditorGUILayout.Space();

            GUILayout.Label("Color", EditorStyles.boldLabel);

            m_MaterialEditor.ShaderProperty(_EnableGradient, "Enable Gradient");
            m_MaterialEditor.ColorProperty(_BaseColor, "Base color");

            if (_EnableGradient.floatValue == 1)
            {
                m_MaterialEditor.ColorProperty(_MiddleColor, "Middle color");
                m_MaterialEditor.ColorProperty(_TopColor, "Top color");

                m_MaterialEditor.RangeProperty(_GradientCenter, "Gradient center");
            }

            EditorGUILayout.Space();

            GUILayout.Label("Noise", EditorStyles.boldLabel);

            m_MaterialEditor.ShaderProperty(_EnableNoise, "Enable Noise");

            if (_EnableNoise.floatValue == 1)
            {
                m_MaterialEditor.ShaderProperty(_NoiseTex, "Noise texture");

                m_MaterialEditor.ShaderProperty(_NoiseStrength, "Noise Strength");
                m_MaterialEditor.ShaderProperty(_EnableRandomLength, "Enable Random Length");

                if (_EnableRandomLength.floatValue == 1)
                {
                    m_MaterialEditor.ShaderProperty(_LengthIntensity, "Length Intensity Strength");
                    m_MaterialEditor.ShaderProperty(_LengthMaxDiference, "Max length difference");
                }
            }

            EditorGUILayout.Space();

            GUILayout.Label("Wind", EditorStyles.boldLabel);

            m_MaterialEditor.ShaderProperty(_EnableWind, "Enable wind");

            if (_EnableWind.floatValue == 1.0)
            {
                m_MaterialEditor.TextureProperty(_WindTex, "Wind Texture", true);
                m_MaterialEditor.ShaderProperty(_WindTexCol, "Colors to look for");
                m_MaterialEditor.ShaderProperty(_WindStrength, "Strength");
                m_MaterialEditor.ShaderProperty(_WindSpeed, "Speed");
            }

            EditorGUILayout.Space();

            GUILayout.Label("Mesh Grass Mask", EditorStyles.boldLabel);

            m_MaterialEditor.ShaderProperty(_EnableMask, "Enable mask");

            if (_EnableMask.floatValue == 1.0)
            {
                m_MaterialEditor.ShaderProperty(_AffectBase, "Affect Mesh Base");
                m_MaterialEditor.TextureProperty(_MaskTex, "Mask Texture", true);
            }

            GUILayout.Label("Smash", EditorStyles.boldLabel);

            m_MaterialEditor.ShaderProperty(_EnablePressure, "Enable smash");

            if (_EnablePressure.floatValue == 1.0)
            {
                m_MaterialEditor.TextureProperty(_PressureTex, "Smash texture", true);
                m_MaterialEditor.RangeProperty(_PressureStrength, "Smash Strength");
            }
        }
        void DoBaseColorArea(Material material)
        {
            GUILayout.Space(4);
            DrawTexorColorProp(material, "_BaseTex", Styles.BaseColorText, BaseColorTex, BaseColor, IsBaseColor);
            DrawTexorColorProp(material, "_ShadowTex", Styles.ShadowColorText, ShadowColorTex, ShadowColor, IsShadowColor);
            m_MaterialEditor.TexturePropertySingleLine(Styles.ShadowMapText, ShadowMapTex);
            m_MaterialEditor.TexturePropertySingleLine(Styles.ToonTexText, ToonTex);

            m_MaterialEditor.ShaderProperty(LightingDir, Styles.LightingDirText);
            keyModes.lightingMode = LightingDir.floatValue;

            GUILayout.Space(4);
            DoDrawVector3Field(AnchorPoint, Styles.AnchorPointText);

            GUILayout.Space(4);
            m_MaterialEditor.ShaderProperty(NormalSpherical, Styles.NormalSphericalText);
            DoDrawVector3Field(SphericalCenter, Styles.SphericalCenterText);

            GUILayout.Space(4);
            DoDrawVector3Field(MappingScale, Styles.MappingScaleText);

            GUILayout.Space(4);
            DoDrawVector2Field(MappingRotation, Styles.MappingRotationText);

            GUILayout.Space(4);
            m_MaterialEditor.RangeProperty(MainLightAffect, Styles.MainLightAffectText);
            m_MaterialEditor.RangeProperty(AmbientLightColor, Styles.AmbientLightColorText);
            m_MaterialEditor.RangeProperty(AmbientTilt, Styles.AmbientTiltText);
            m_MaterialEditor.RangeProperty(AddLightAffect, Styles.AddLightAffectText);
            m_MaterialEditor.RangeProperty(SaturatedValue, Styles.SaturatedValueText);
            m_MaterialEditor.RangeProperty(ShadowAffect, Styles.ShadowAffectText);

            GUILayout.Space(4);
            m_MaterialEditor.RangeProperty(SystemShadowAffect, Styles.SystemShadowAffectText);
            m_MaterialEditor.RangeProperty(AddSystemShadowAffect, Styles.AddSystemShadowAffectText);
            m_MaterialEditor.ShaderProperty(HandleShadow, Styles.HandlwShadowText);
            keyModes.handlwShadow = HandleShadow.floatValue;
            if (HandleShadow.floatValue == 1)
            {
                DrawTexorColorProp(material, "_SystemShadowColorTex", Styles.SystemShadowColorTexText, SystemShadowColorTex, SystemShadowColor, IsSystemShadowColor);
            }

            GUILayout.Space(4);
        }
    private void RefractionControl(MaterialEditor target, bool noDisablegroup)
    {
        Header("Refraction", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:fx:liquid#refraction_map");

        target.TextureProperty(_refractionNormal, "Refraction Map");
        target.RangeProperty(_refractionStrength, "Strength");

        GUILayout.Space(10f);
        DrawWideBox(1f);
    }
    private void ReflectionControl(MaterialEditor target, bool noDisablegroup)
    {
        Header("Reflection", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:reflection#reflection_texture");

        target.TextureProperty(_reflectionScreenMap, "Reflection Texture");
        target.RangeProperty(_reflectionStrength, "Strength");
        target.RangeProperty(_reflectionBlur, "Blur");

        GUILayout.Space(5f);

        target.TextureProperty(_reflectionMask, "Mask", scaleOffset: false);
        target.RangeProperty(_reflectionScrollingX, "X-Axis scrolling");
        target.RangeProperty(_reflectionScrollingY, "Y-Axis scrolling");

        GUILayout.Space(10f);
        DrawWideBox(1f);

        //Turn off the Disable group?
        if (noDisablegroup) return;
        if (!_shaderCompileKeywords.Contains(ShaderFeature.Reflection.GetString()))
            EditorGUI.EndDisabledGroup();
    }
    private void CurvatureControl(MaterialEditor target)
    {
        Header("Curvature", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:fx:lava#curvature");

        target.TextureProperty(_curvatureMap, "Curvature Map");
        target.RangeProperty(_curvatureDepth, "Depth");
        target.ColorProperty(_curvatureHighlight, "Highlight Color");
        target.RangeProperty(_curvatureGloss, "Gloss");

        GUILayout.Space(10f);
        DrawWideBox(1f);
        if (!_shaderCompileKeywords.Contains(ShaderFeature.Curvature.GetString()))
            EditorGUI.EndDisabledGroup();
    }
        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();
        }
示例#13
0
        private void AdditionalSettings(Material material)
        {
            if (m_HDRMultiplier != null)
            {
                if ((LightingModes)m_LightingMode.floatValue == LightingModes.MultiLightEmissive ||
                    (LightingModes)m_LightingMode.floatValue == LightingModes.LitEmissive)
                {
                    m_MaterialEditor.RegisterPropertyChangeUndo(Styles.m_HDRMultiplierText.text);
                    m_MaterialEditor.FloatProperty(m_HDRMultiplier, Styles.m_HDRMultiplierText.text);
                }
            }

            EditorGUILayout.Space();

            if (m_Cutoff != null)
            {
                m_MaterialEditor.RangeProperty(m_Cutoff, Styles.m_CutoffText.text);
            }

            EditorGUILayout.Space();

            if (m_Thickness != null)
            {
                m_MaterialEditor.RangeProperty(m_Thickness, Styles.m_ThicknessText.text);
            }

            if (m_Backlight)
            {
                EditorGUI.BeginChangeCheck();
                var backLight = EditorGUILayout.Toggle(Styles.m_BacklightToggle, m_Backlight);
                EditorGUI.EndChangeCheck();
                {
                    m_MaterialEditor.RegisterPropertyChangeUndo(Styles.m_BacklightToggle.text);
                    if (backLight)
                    {
                        material.EnableKeyword("BACKLIGHT_ON");
                    }
                    else
                    {
                        material.DisableKeyword("BACKLIGHT_ON");
                    }
                }
            }

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

            if (m_InvFade != null)
            {
                EditorGUI.BeginChangeCheck();
                var softParticles = EditorGUILayout.Toggle(Styles.m_SoftParticlesToggle, m_SoftParticles);
                EditorGUI.EndChangeCheck();
                {
                    m_MaterialEditor.RegisterPropertyChangeUndo("Enable Soft Particle");
                    if (softParticles)
                    {
                        material.EnableKeyword("SOFTPARTICLE_ON");

                        m_MaterialEditor.RangeProperty(m_InvFade, Styles.m_InvFadeText.text);
                    }
                    else
                    {
                        material.DisableKeyword("SOFTPARTICLE_ON");
                    }
                }
            }

            EditorGUILayout.Space();

            if (m_DistanceFadeStart != null && m_DistanceFadeEnd != null)
            {
                EditorGUI.BeginChangeCheck();
                var distanceFade = EditorGUILayout.Toggle(Styles.m_DistanceFadeToggle, m_DistanceFade);
                EditorGUI.EndChangeCheck();
                {
                    m_MaterialEditor.RegisterPropertyChangeUndo("Distance Fade");
                    if (distanceFade)
                    {
                        material.EnableKeyword("DISTANCEFADE_ON");

                        m_MaterialEditor.FloatProperty(m_DistanceFadeStart, Styles.m_DistanceFadeStartText.text);
                        m_MaterialEditor.FloatProperty(m_DistanceFadeEnd, Styles.m_DistanceFadeEndText.text);
                    }
                    else
                    {
                        material.DisableKeyword("DISTANCEFADE_ON");
                    }
                }
            }
        }
    //This is the Main view with all shader controlls
    private void MainView(MaterialEditor materialEditor)
    {
        GUILayout.Space(5f);

        switch (_setPanel)
        {
            case SettingsMode.Sprites:
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:sprite");
                GUILayout.Space(10f);
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(5f);

                materialEditor.TextureProperty(_mainSprite, "Sprite", scaleOffset: false);

                DrawWideBox();
                GUILayout.Space(10f);

                GUILayout.BeginHorizontal();
                materialEditor.ColorProperty(_mainSpriteTint, "Tint");
                if (GUILayout.Button("Reset Tint"))
                {
                    _matTarget.SetColor(ShaderColor.Sprite.GetString(), Color.white);
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(15f);

                ToggleFeature(_matTarget, "Main Layer Scrolling", ShaderFeature.SpriteScrolling);
                GUILayout.Space(5f);
                materialEditor.RangeProperty(_spriteLayer1ScrollingX, "X-Axis");
                materialEditor.RangeProperty(_spriteLayer1ScrollingY, "Y-Axis");
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Reset Scrolling"))
                {
                    _matTarget.SetFloat(ShaderFloat.SpriteLayer0ScrollingX.GetString(), 0f);
                    _matTarget.SetFloat(ShaderFloat.SpriteLayer0ScrollingY.GetString(), 0f);

                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                EditorGUI.EndDisabledGroup();


                GUILayout.Space(5f);

                DrawWideBox();
                GUILayout.Space(5f);
                ToggleFeature(_matTarget, "Multi Layer", ShaderFeature.SpriteMultiLayer, disableGroup: false);
                if (_matTarget.IsKeywordEnabled(ShaderFeature.SpriteMultiLayer.GetString()))
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:sprite#multi_layer");
                    GUILayout.Space(10f);
                    EditorGUILayout.EndHorizontal();

                    ToggleFeature(_matTarget, "Stencil Mask", ShaderFeature.SpriteStencil, disableGroup: true);
                    materialEditor.TextureProperty(_spriteLayerStencil, "Stencil Mask");
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    EditorGUILayout.HelpBox("Red: Layer 1# | Green: Layer 2# | Blue: Layer 3#", MessageType.None);
                    GUILayout.FlexibleSpace();
                    EditorGUILayout.EndHorizontal();
                    DrawWideBox();
                    EditorGUI.EndDisabledGroup();

                    GUILayout.Box("Layer 1#", EditorStyles.miniButton);
                    materialEditor.TextureProperty(_spriteLayer2Tex, "Sprite");
                    GUILayout.Space(10f);
                    materialEditor.RangeProperty(_spriteLayer2Opacity, "Opacity");
                    materialEditor.ColorProperty(_spriteLayer2Color, "Tint");
                    materialEditor.RangeProperty(_spriteLayer2ScrollingX, "Scrolling X-Axis");
                    materialEditor.RangeProperty(_spriteLayer2ScrollingY, "Scrolling Y-Axis");

                    GUILayout.Space(10f);
                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Reset"))
                    {
                        _matTarget.SetFloat(ShaderFloat.SpriteLayer1Opacity.GetString(), 1f);
                        _matTarget.SetColor(ShaderColor.SpriteLayer1.GetString(), Color.white);
                        _matTarget.SetFloat(ShaderFloat.SpriteLayer1ScrollingX.GetString(), 0f);
                        _matTarget.SetFloat(ShaderFloat.SpriteLayer1ScrollingY.GetString(), 0f);
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.Space(10f);

                    DrawWideBox();
                    GUILayout.Box("Layer 2#", EditorStyles.miniButton);
                    materialEditor.TextureProperty(_spriteLayer3Tex, "Sprite");
                    GUILayout.Space(10f);
                    materialEditor.RangeProperty(_spriteLayer3Opacity, "Opacity");
                    materialEditor.ColorProperty(_spriteLayer3Color, "Tint");
                    materialEditor.RangeProperty(_spriteLayer3ScrollingX, "Scrolling X-Axis");
                    materialEditor.RangeProperty(_spriteLayer3ScrollingY, "Scrolling Y-Axis");

                    GUILayout.Space(10f);
                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Reset"))
                    {
                        _matTarget.SetFloat(ShaderFloat.SpriteLayer2Opacity.GetString(), 1f);
                        _matTarget.SetColor(ShaderColor.SpriteLayer2.GetString(), Color.white);
                        _matTarget.SetFloat(ShaderFloat.SpriteLayer2ScrollingX.GetString(), 0f);
                        _matTarget.SetFloat(ShaderFloat.SpriteLayer2ScrollingY.GetString(), 0f);
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.Space(10f);

                    DrawWideBox();
                    GUILayout.Box("Layer 3#", EditorStyles.miniButton);
                    materialEditor.TextureProperty(_spriteLayer4Tex, "Sprite");
                    GUILayout.Space(10f);
                    materialEditor.RangeProperty(_spriteLayer4Opacity, "Opacity");
                    materialEditor.ColorProperty(_spriteLayer4Color, "Tint");
                    materialEditor.RangeProperty(_spriteLayer4ScrollingX, "Scrolling X-Axis");
                    materialEditor.RangeProperty(_spriteLayer4ScrollingY, "Scrolling Y-Axis");

                    GUILayout.Space(10f);
                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Reset"))
                    {
                        _matTarget.SetFloat(ShaderFloat.SpriteLayer3Opacity.GetString(), 1f);
                        _matTarget.SetColor(ShaderColor.SpriteLayer3.GetString(), Color.white);
                        _matTarget.SetFloat(ShaderFloat.SpriteLayer3ScrollingX.GetString(), 0f);
                        _matTarget.SetFloat(ShaderFloat.SpriteLayer3ScrollingY.GetString(), 0f);
                    }
                    GUILayout.EndHorizontal();
                }
                break;
            case SettingsMode.Curvature:
                GUILayout.BeginHorizontal();
                ToggleFeature(_matTarget, "Curvature", ShaderFeature.Curvature);
                GUILayout.FlexibleSpace();
                ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:curvature");
                GUILayout.Space(10f);
                GUILayout.EndHorizontal();

                GUILayout.Space(5f);

                materialEditor.TextureProperty(_curvatureMap, "Curvature Map");
                GUILayout.Space(10f);
                DrawWideBox();
                GUILayout.Space(10f);

                materialEditor.ColorProperty(_curvatureHighlight, "Highlight Tint");
                GUILayout.Space(10f);

                DrawWideBox();
                GUILayout.Space(10f);

                materialEditor.RangeProperty(_curvatureDepth, "Depth");
                GUILayout.Space(10f);

                materialEditor.RangeProperty(_curvatureGloss, "Surface Glossiness");
                GUILayout.Space(10f);

                DrawWideBox();
                GUILayout.Space(5f);

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Reset Properties"))
                {
                    _matTarget.SetFloat(ShaderFloat.CurvatureDepth.GetString(), 0.5f);
                    _matTarget.SetColor(ShaderColor.Curvature.GetString(), Color.gray);
                    _matTarget.SetFloat(ShaderFloat.CurvatureGloss.GetString(), 0.5f);
                }
                GUILayout.EndHorizontal();

                EditorGUI.EndDisabledGroup();
                break;
            case SettingsMode.Reflection:
                GUILayout.BeginHorizontal();
                ToggleFeature(_matTarget, "Reflection", ShaderFeature.Reflection);
                GUILayout.FlexibleSpace();
                ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:reflection");
                GUILayout.Space(10f);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);

                materialEditor.TextureProperty(_reflectionScreenMap, "Reflection");
                EditorGUILayout.HelpBox("Texture should have Wrap Mode set to Repeat.", MessageType.None);

                DrawWideBox();
                materialEditor.RangeProperty(_reflectionStrength, "Reflection Strength");
                GUILayout.Space(5f);
                materialEditor.RangeProperty(_reflectionBlur, "Blur");
                GUILayout.Space(5f);

                DrawWideBox();
                materialEditor.RangeProperty(_reflectionScrollingX, "Scrolling speed X");
                GUILayout.Space(10f);
                materialEditor.RangeProperty(_reflectionScrollingY, "Scrolling speed Y");
                DrawWideBox();

                GUILayout.Space(5f);

                materialEditor.TextureProperty(_reflectionMask, "Mask");

                DrawWideBox();
                GUILayout.Space(5f);

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();

                if (GUILayout.Button("Reset Properties"))
                {
                    _matTarget.SetFloat(ShaderFloat.ReflectionScrollSpeedX.GetString(), 0.25f);
                    _matTarget.SetFloat(ShaderFloat.ReflectionScrollSpeedY.GetString(), 0.25f);
                    _matTarget.SetFloat(ShaderFloat.ReflectionStrength.GetString(), 0f);
                    _matTarget.SetFloat(ShaderFloat.ReflectionBlur.GetString(), 0f);
                }
                GUILayout.EndHorizontal();

                EditorGUI.EndDisabledGroup();
                break;
            case SettingsMode.Emission:
                var animationOn = _matTarget.IsKeywordEnabled(ShaderFeature.EmissionPulse.GetString());

                GUILayout.BeginHorizontal();
                ToggleFeature(_matTarget, "Emission", ShaderFeature.Emission);
                GUILayout.FlexibleSpace();
                ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:emission");
                GUILayout.Space(10f);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);

                GUILayout.BeginHorizontal();
                EditorGUILayout.HelpBox("Mask Channels\n\nRed: Layer 1#\nGreen: Layer 2#\nBlue: Layer 3#", MessageType.None);
                materialEditor.TextureProperty(_emissionMask, "Emission Mask");
                GUILayout.EndHorizontal();

                GUILayout.Space(5f);
                DrawWideBox();
                GUILayout.Box("Layer 1# - Mask Channel Red", EditorStyles.miniButton);
                GUILayout.Space(10f);
                materialEditor.RangeProperty(_emissionStrength, "Intensity");
                GUILayout.Space(10f);
                materialEditor.ColorProperty(_emissionTint, "Tint");
                GUILayout.Space(5f);

                EditorGUI.BeginDisabledGroup(!animationOn);
                materialEditor.RangeProperty(_emissionLayer1AninSpeed, "Pulse Speed");
                materialEditor.RangeProperty(_emissionLayer1AninBlend, "Blend Animation");
                EditorGUI.EndDisabledGroup();
                GUILayout.Space(5f);

                DrawWideBox();
                GUILayout.Box("Layer 2# - Mask Channel Green", EditorStyles.miniButton);
                GUILayout.Space(10f);
                materialEditor.RangeProperty(_emissionLayer2Strength, "Intensity");
                GUILayout.Space(10f);
                materialEditor.ColorProperty(_emissionLayer2Tint, "Tint");
                GUILayout.Space(5f);

                EditorGUI.BeginDisabledGroup(!animationOn);
                materialEditor.RangeProperty(_emissionLayer2AninSpeed, "Pulse Speed");
                materialEditor.RangeProperty(_emissionLayer2AninBlend, "Blend Animation");
                EditorGUI.EndDisabledGroup();
                GUILayout.Space(5f);

                DrawWideBox();
                GUILayout.Box("Layer 3# - Mask Channel Blue", EditorStyles.miniButton);
                GUILayout.Space(10f);
                materialEditor.RangeProperty(_emissionLayer3Strength, "Intensity");
                GUILayout.Space(10f);
                materialEditor.ColorProperty(_emissionLayer3Tint, "Tint");
                GUILayout.Space(5f);
                EditorGUI.BeginDisabledGroup(!animationOn);
                materialEditor.RangeProperty(_emissionLayer3AninSpeed, "Pulse Speed");
                materialEditor.RangeProperty(_emissionLayer3AninBlend, "Blend Animation");
                EditorGUI.EndDisabledGroup();
                GUILayout.Space(5f);

                DrawWideBox();
                GUILayout.Space(5f);
                GUILayout.BeginHorizontal();
                ToggleFeature(_matTarget, "Pulse Animation", ShaderFeature.EmissionPulse, disableGroup: false);
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Reset Properties"))
                {
                    _matTarget.SetFloat(ShaderFloat.EmissionIntensity.GetString(), 0f);
                    _matTarget.SetColor(ShaderColor.Emission.GetString(), Color.white);
                    _matTarget.SetFloat(ShaderFloat.EmissionLayer1BlendAnimation.GetString(), 1f);
                    _matTarget.SetFloat(ShaderFloat.EmissionLayer1PulseSpeed.GetString(), 0f);
                    _matTarget.SetFloat(ShaderFloat.EmissionLayer2Intensity.GetString(), 0f);
                    _matTarget.SetColor(ShaderColor.EmissionLayer2.GetString(), Color.white);
                    _matTarget.SetFloat(ShaderFloat.EmissionLayer2BlendAnimation.GetString(), 1f);
                    _matTarget.SetFloat(ShaderFloat.EmissionLayer2PulseSpeed.GetString(), 0f);
                    _matTarget.SetFloat(ShaderFloat.EmissionLayer3Intensity.GetString(), 0f);
                    _matTarget.SetColor(ShaderColor.EmissionLayer3.GetString(), Color.white);
                    _matTarget.SetFloat(ShaderFloat.EmissionLayer3BlendAnimation.GetString(), 1f);
                    _matTarget.SetFloat(ShaderFloat.EmissionLayer3PulseSpeed.GetString(), 0f);
                }
                GUILayout.EndHorizontal();
                break;
            case SettingsMode.Translucency:
                GUILayout.BeginHorizontal();
                ToggleFeature(_matTarget, "Transmission", ShaderFeature.Transmission);
                GUILayout.FlexibleSpace();
                ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:transmission");
                GUILayout.Space(10f);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);

                materialEditor.TextureProperty(_transmissionMap, "Texture");
                GUILayout.Space(10f);
                DrawWideBox();
                GUILayout.Space(10f);

                materialEditor.RangeProperty(_transmissionDensity, "Density");
                EditorGUI.EndDisabledGroup();
                break;
            case SettingsMode.Dissolve:
                GUILayout.BeginHorizontal();
                ToggleFeature(_matTarget, "Dissolve", ShaderFeature.Dissolve);
                GUILayout.FlexibleSpace();
                ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:dissolve");
                GUILayout.Space(10f);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);

                materialEditor.TextureProperty(_dissolveMap, "Dissolve Pattern", scaleOffset: false);
                DrawWideBox();
                GUILayout.Space(15f);
                materialEditor.RangeProperty(_dissolveBlend, "Blending");
                GUILayout.Space(10f);
                materialEditor.RangeProperty(_dissolveBorderWidth, "Border Width");
                GUILayout.Space(10f);
                materialEditor.RangeProperty(_dissolveGlowStrength, "Border Glow");
                GUILayout.Space(10f);
                materialEditor.ColorProperty(_dissolveGlowColor, "Glow Color");

                EditorGUI.EndDisabledGroup();
                break;
            case SettingsMode.Extras:
                ShaderLightingSelection(_matTarget, materialEditor);

                GUILayout.Space(5f);
                //check Shader Keywords for Pixel Snapping
                GUILayout.BeginHorizontal();
                ToggleFeature(_matTarget, "Pixel Snapping", ShaderFeature.PixelSnap, disableGroup: false, height: 30f);
                ToggleFeature(_matTarget, "Doublesided", ShaderFeature.DoubleSided, disableGroup: false, height: 30f);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);

                DrawWideBox();
                GUILayout.Space(5f);

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();

                if (GUILayout.Button(_btnWiki, GUILayout.Height(64f), GUILayout.MaxWidth(140f)))
					EditorApplication.delayCall += ()=> { Application.OpenURL("http://wiki.next-gen-sprites.com/"); };
                
				if (GUILayout.Button(_btnWidget, GUILayout.Height(64f), GUILayout.MaxWidth(140f)))
					EditorApplication.delayCall += ()=> { EditorApplication.ExecuteMenuItem("Window/NextGenSprites/Widget"); };
				
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                GUILayout.Space(10f);

                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();

                if (GUILayout.Button(_btnSaveCollection, GUILayout.Height(64f), GUILayout.MaxWidth(140f)))
					EditorApplication.delayCall += ()=> { EditorApplication.ExecuteMenuItem("Assets/Create/NextGenSprites/Properties Collection from selection"); };
                
				if (GUILayout.Button(_btnLoadCollection, GUILayout.Height(64f), GUILayout.MaxWidth(140f)))
					EditorApplication.delayCall += ()=> { EditorApplication.ExecuteMenuItem("GameObject/NextGenSprites/Apply Properties Collection to selection"); };

                GUILayout.FlexibleSpace();
				EditorGUILayout.EndHorizontal();
                
				GUILayout.Space(10f);
                DrawWideBox();
                GUILayout.Space(10f);

                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                EditorGUILayout.HelpBox("Version 1.2.1", MessageType.None);
                EditorGUILayout.HelpBox("Copyright 2015 Ruben de la Torre", MessageType.None);
                EditorGUILayout.EndHorizontal();
                break;
        }
    }
        void DoSpecularMetallicArea()
        {
            // m_MaterialEditor.ColorProperty(lightcol, "_LColor");
            // m_MaterialEditor.VectorProperty(lightpos,"_WSLP");



            m_MaterialEditor.RangeProperty(giglossiness, "GiGlossiness");
            m_MaterialEditor.RangeProperty(gidarkness, "GiDarkness");

            if (m_WorkflowMode == WorkflowMode.Skin)
            {
                // m_MaterialEditor.ColorProperty(skincolor, "SkinColor");
                // m_MaterialEditor.ColorProperty(clothcolor, "ClothColor");
                m_MaterialEditor.RangeProperty(hues, "Skin HVS");
                m_MaterialEditor.RangeProperty(sats, "Skin SAT");
                m_MaterialEditor.RangeProperty(vals, "Skin VAL");
                m_MaterialEditor.RangeProperty(huec, "Cloth HVS");
                m_MaterialEditor.RangeProperty(satc, "Cloth SAT");
                m_MaterialEditor.RangeProperty(valc, "Cloth VAL");
            }
            bool hasGlossMap = false;

            if (m_WorkflowMode == WorkflowMode.Specular)
            {
                hasGlossMap = specularMap.textureValue != null;
                m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap, hasGlossMap ? null : specularColor);
            }
            else if (m_WorkflowMode == WorkflowMode.Gloss || m_WorkflowMode == WorkflowMode.Skin)
            {
                hasGlossMap = metallicMap.textureValue != null;
                m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap, hasGlossMap ? null : metallic);
            }

            else if (m_WorkflowMode == WorkflowMode.LMap)
            {
                hasGlossMap = metallicMap.textureValue != null;
                m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap, hasGlossMap ? null : metallic);
                m_MaterialEditor.ColorProperty(lightcol, "_LColor");
                m_MaterialEditor.VectorProperty(lightpos, "_WSLP");
            }

            else if (m_WorkflowMode == WorkflowMode.LMap20)
            {
                // hasGlossMap = metallicMap.textureValue != null;
                // m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap, hasGlossMap ? null : metallic);
                m_MaterialEditor.ColorProperty(lightcol, "_LColor");
                m_MaterialEditor.VectorProperty(lightpos, "_WSLP");
            }

            bool showSmoothnessScale = hasGlossMap;

            if (smoothnessMapChannel != null)
            {
                int smoothnessChannel = (int)smoothnessMapChannel.floatValue;
                if (smoothnessChannel == (int)SmoothnessMapChannel.AlbedoAlpha)
                {
                    showSmoothnessScale = true;
                }
            }

            //int indentation = 2; // align with labels of texture properties
            //m_MaterialEditor.ShaderProperty(showSmoothnessScale ? smoothnessScale : smoothness, showSmoothnessScale ? Styles.smoothnessScaleText : Styles.smoothnessText, indentation);
            // smoothness = 0.8f;
            // smoothnessScale = 0.8f;
            m_MaterialEditor.RangeProperty(smoothness, "Smoothness value");
            m_MaterialEditor.RangeProperty(smoothnessScale, "Smoothness scale factor");

            //++indentation;
            // if (smoothnessMapChannel != null)
            //     m_MaterialEditor.ShaderProperty(smoothnessMapChannel, Styles.smoothnessMapChannelText, indentation);
        }
        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();
                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);

                EditorGUILayout.Space();

                //Terrain blending
                GUILayout.Label(Styles.terrainBlendingText, EditorStyles.boldLabel);
                m_MaterialEditor.RangeProperty(terrainBlendingStart, "Terrain blending start");
                m_MaterialEditor.RangeProperty(terrainBlendingEnd, "Terrain blending end");

                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();
        }
    private void EmissionControl(MaterialEditor target, bool noDisablegroup)
    {
        Header("Emission", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:emission");

        target.RangeProperty(_emissionStrength, "Strength");
        if (_hasEmissionTint)
        {
            target.ColorProperty(_emissionTint, "Tint");
            GUILayout.Space(5f);
            target.TextureProperty(_emissionMask, "Mask");
        }


        GUILayout.Space(10f);
        DrawWideBox(1f);
        //Turn off the Disable group?
        if (noDisablegroup) return;
        if (!_shaderCompileKeywords.Contains(ShaderFeature.Emission.GetString()))
            EditorGUI.EndDisabledGroup();
    }
    private void DissolveControl(MaterialEditor target)
    {
        Header("Dissolve", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:dissolve");

        target.TextureProperty(_dissolveMap, "Dissolve Pattern", scaleOffset: false);
        target.RangeProperty(_dissolveBlend, "Blend");

        GUILayout.Space(5f);

        target.RangeProperty(_dissolveBorderWidth, "Border Width");
        target.ColorProperty(_dissolveGlowColor, "Border Glow Tint");
        target.RangeProperty(_dissolveGlowStrength, "Border Glow width");

        GUILayout.Space(10f);
        DrawWideBox(1f);
        if (!_shaderCompileKeywords.Contains(ShaderFeature.Dissolve.GetString()))
            EditorGUI.EndDisabledGroup();
    }
    private void FlowControl(MaterialEditor target)
    {
        Header("Flow", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:fx:liquid#flow_map");

        if (_hasCurvatureMap)
            target.TextureProperty(_curvatureMap, "Curvature Map", scaleOffset: false);

        target.TextureProperty(_flowMap, "Flow Map", scaleOffset: false);
        target.RangeProperty(_flowIntensity, "Intensity");
        target.RangeProperty(_flowSpeed, "Speed");
        GUILayout.Space(10f);

        ToggleShader(_targetMaterial, "Auto scrolling", ShaderFeature.AutoScrolling.GetString());
        target.RangeProperty(_FlowScrollAuto, "Auto scroll Speed");
        EditorGUI.EndDisabledGroup();

        GUILayout.Space(5f);
        var modeLbl = (_targetMaterial.IsKeywordEnabled(ShaderFeature.AutoScrolling.GetString()) ? "Automatic" : "By Position");
        GUILayout.Box(string.Format("Current Scrolling Mode: {0}", modeLbl));
        GUILayout.Space(5f);

        target.RangeProperty(_FlowScrollX, "Scroll Speed X");
        target.RangeProperty(_FlowScrollY, "Scroll Speed Y");

        
        GUILayout.Space(10f);
        DrawWideBox(1f);
    }
示例#20
0
        void DoAlbedoArea(Material material)
        {
            float MaxRim = rimMax.floatValue;
            float MinRim = rimMin.floatValue;

            m_MaterialEditor.TexturePropertySingleLine(Styles.albedoText, albedoMap, albedoColor);
            m_MaterialEditor.ShaderProperty(useProbe, Styles.probeText);
            m_MaterialEditor.TexturePropertySingleLine(Styles.fallbackText, fallbackMap);

            if (((BlendMode)material.GetFloat("_Mode") == BlendMode.Cutout))
            {
                m_MaterialEditor.ShaderProperty(alphaCutoff, Styles.alphaCutoffText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1);
            }

            if (stylizeSpec.floatValue == 1)
            {
                GUILayout.Space(17);
                GUILayout.Label("Custom Specular", EditorStyles.boldLabel);
                GUILayout.BeginHorizontal();
                m_MaterialEditor.ShaderProperty(specularBrightness, "Specular Brightness");
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }

            if (stylizeRim.floatValue == 1)
            {
                float rimVal = litRim.floatValue;
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.MinMaxSlider("Rim (Min / Max)", ref MinRim, ref MaxRim, 0f, 1f);
                rimVal = GUILayout.Toggle(litRim.floatValue == 1, "Directional Rim", "Button", GUILayout.MaxWidth(100)) ? 1 : 0;
                if (EditorGUI.EndChangeCheck())
                {
                    litRim.floatValue = rimVal;
                    rimMax.floatValue = MaxRim;
                    rimMin.floatValue = MinRim;
                }
            }

            if (stylizeRamp.floatValue == 1)
            {
                float shadowVal = shadowToggle.floatValue;
                EditorGUI.BeginChangeCheck();
                GUILayout.Space(17);
                GUILayout.Label("Custom Ramp", EditorStyles.boldLabel);
                EditorGUI.showMixedValue = shadowToggle.hasMixedValue;
                shadowVal = EditorGUILayout.Toggle("Tint Shadows?", shadowToggle.floatValue == 1, GUILayout.MaxWidth(EditorGUIUtility.labelWidth + 13.0f)) ? 1 : 0;
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    shadowToggle.floatValue = shadowVal;
                }
                GUILayout.Space(-17);

                GUILayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(shadowToggle.floatValue == 0);
                GUILayout.Space(20);
                ProperColorBox(ref shadowColor, " ");
                EditorGUI.EndDisabledGroup();
                GUILayout.EndHorizontal();

                m_MaterialEditor.ShaderProperty(rampOff, Styles.rampOffText);
            }
            if (stylizeRamp.floatValue == 1 || stylizeSpec.floatValue == 1)
            {
                m_MaterialEditor.ShaderProperty(rampHard, Styles.rampHardText); GUILayout.Space(17);
            }

            if (outlineEnabled.floatValue > 0)
            {
                GUILayout.Label("Outlines", EditorStyles.boldLabel);
                ProperColorBox(ref outlineColor, "Outline Color");

                GUILayout.BeginHorizontal();
                m_MaterialEditor.ShaderProperty(stencilRef, "Stencil [0-255]");
                if (GUILayout.Button("Randomize"))
                {
                    stencilRef.floatValue = Mathf.RoundToInt(UnityEngine.Random.Range(0f, 255f));
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                m_MaterialEditor.RangeProperty(outlineColorMix, "Tint");
                m_MaterialEditor.ShaderProperty(outlineWidth, "Width");
                //m_MaterialEditor.ShaderProperty(angleAdjust, "Edge Fix Angle");
            }
            GUILayout.Space(17);
            GUILayout.FlexibleSpace();

            m_MaterialEditor.ShaderProperty(fakeLight, Styles.fakeLightText);
        }
示例#21
0
		override public void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor) {
			bool inactiveFlag = false;
			if (!checkNormalmapsUsage(editor.target as Material, label)) return;
			if (!checkDetailUsage(editor.target as Material, label)) return;
			if (!checkSpecUsage(editor.target as Material, label)) return;
			#if UNITY_5
				if (prop.name=="unity_SpecCube" || prop.name=="unity_SpecCube1") return;
			#endif

			if (checkVisible (editor, label, ref inactiveFlag)) {
				EditorGUI.BeginDisabledGroup(inactiveFlag);
				switch (prop.type) {
					case MaterialProperty.PropType.Range: // float ranges
					{
						editor.RangeProperty(position, prop, label);
						break;
					}
					case MaterialProperty.PropType.Float: // floats
					{
						editor.FloatProperty(position, prop, label);
						break;
					}
					case MaterialProperty.PropType.Color: // colors
					{
						editor.ColorProperty(position, prop, label);
						break;
					}
					case MaterialProperty.PropType.Texture: // textures
					{
						editor.TextureProperty(position, prop, label, texTileOffset);
						break;
					}
					case MaterialProperty.PropType.Vector: // vectors
					{
						position.x+=12;
						position.width-=12;
						editor.VectorProperty(position, prop, label);
						break;
					}
					default:
					{
						GUILayout.Label("Unknown prop type... ("+label+")");
						break;
					}
				}
				EditorGUI.EndDisabledGroup();
			}
		}