Example #1
0
    /// <inheritdoc/>
    protected override void FindProperties(MaterialProperty[] props)
    {
        this.renderingMode = ShaderGUI.FindProperty("_RenderingMode", props);
        this.cullMode      = ShaderGUI.FindProperty("_CullMode", props);
        this.cutoff        = ShaderGUI.FindProperty("_Cutoff", props);
        this.zwrite        = ShaderGUI.FindProperty("_ZWrite", props);

        this.mainTex   = ShaderGUI.FindProperty("_MainTex", props);
        this.tintColor = ShaderGUI.FindProperty("_TintColor", props);

        this.decalTex = ShaderGUI.FindProperty("_DecalTex", props);

        this.dissloveTex    = ShaderGUI.FindProperty("_DissloveTex", props);
        this.dissloveAmount = ShaderGUI.FindProperty("_DissloveAmount", props);

        this.uvNoise          = ShaderGUI.FindProperty("_UVNoise", props);
        this.uvNoiseBias      = ShaderGUI.FindProperty("_UVNoiseBias", props);
        this.uvNoiseIntensity = ShaderGUI.FindProperty("_UVNoiseIntensity", props);
        this.uvNoiseSpeed     = ShaderGUI.FindProperty("_UVNoiseSpeed", props);

        this.glowTex   = ShaderGUI.FindProperty("_GlowTex", props);
        this.glowSpeed = ShaderGUI.FindProperty("_GlowSpeed", props);
        this.glowColor = ShaderGUI.FindProperty("_GlowColor", props);

        this.rimColor     = ShaderGUI.FindProperty("_RimColor", props);
        this.rimIntensity = ShaderGUI.FindProperty("_RimIntensity", props);
        this.rimFresnel   = ShaderGUI.FindProperty("_RimFresnel", props);

        this.rimLightColor     = ShaderGUI.FindProperty("_RimLightColor", props);
        this.rimLightIntensity = ShaderGUI.FindProperty("_RimLightIntensity", props);
        this.rimLightFresnel   = ShaderGUI.FindProperty("_RimLightFresnel", props);
    }
    override public void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
    {
        MaterialProperty _MainTexture = ShaderGUI.FindProperty("_MainTexture", properties);
        MaterialProperty _TopTexture  = ShaderGUI.FindProperty("_TopTexture", properties);
        MaterialProperty _TopSpread   = ShaderGUI.FindProperty("_TopSpread", properties);
        //__________________________________________________________________________________
        MaterialProperty _LightRamp    = ShaderGUI.FindProperty("_LightRamp", properties);
        MaterialProperty _SpecularRamp = ShaderGUI.FindProperty("_SpecularRamp", properties);
        //__________________________________________________________________________________
        MaterialProperty _Noise = ShaderGUI.FindProperty("_Noise", properties);
        //__________________________________________________________________________________
        MaterialProperty _Normal        = ShaderGUI.FindProperty("_Normal", properties);
        MaterialProperty _SpecularColor = ShaderGUI.FindProperty("_SpecularColor", properties);
        //__________________________________________________________________________________
        MaterialProperty _UseGlossSpec = ShaderGUI.FindProperty("_UseGlossSpec", properties);
        //__________________________________________________________________________________
        MaterialProperty _UseOutline = ShaderGUI.FindProperty("_UseOutline", properties);

        EditorGUILayout.Space();
        materialEditor.TexturePropertySingleLine(new GUIContent("Main Texture", ""), _MainTexture);
        materialEditor.TexturePropertySingleLine(new GUIContent("Top Texture", ""), _TopTexture, _TopSpread);
        materialEditor.TexturePropertySingleLine(new GUIContent("Normal", ""), _Normal);
        materialEditor.TextureScaleOffsetProperty(_MainTexture);
        _TopTexture.textureScaleAndOffset = _Normal.textureScaleAndOffset = _MainTexture.textureScaleAndOffset;
        EditorGUILayout.Space();
        //__________________________________________________________________________________
        materialEditor.TexturePropertySingleLine(new GUIContent("Light Ramp", ""), _LightRamp);
        materialEditor.TexturePropertySingleLine(new GUIContent("Specular Ramp", ""), _SpecularRamp);
        EditorGUILayout.Space();
        //__________________________________________________________________________________
        materialEditor.TexturePropertySingleLine(new GUIContent("Noise", ""), _Noise);
        materialEditor.TextureScaleOffsetProperty(_Noise);
        EditorGUILayout.Space();
        //__________________________________________________________________________________
        EditorGUILayout.Space();
        materialEditor.ShaderProperty(_UseGlossSpec, _UseGlossSpec.displayName);

        if (_UseGlossSpec.floatValue == 1)
        {
            MaterialProperty _GlossSpec = ShaderGUI.FindProperty("_GlossSpec", properties);
            materialEditor.TexturePropertySingleLine(new GUIContent("GlossSpec", ""), _GlossSpec);
        }
        else
        {
            materialEditor.ShaderProperty(_SpecularColor, _SpecularColor.displayName);
        }

        EditorGUILayout.Space();
        //__________________________________________________________________________________
        EditorGUILayout.Space();
        materialEditor.ShaderProperty(_UseOutline, _UseOutline.displayName);

        if (_UseOutline.floatValue == 1)
        {
            MaterialProperty _OutlineThickness = ShaderGUI.FindProperty("_OutlineThickness", properties);
            MaterialProperty _OutlineColor     = ShaderGUI.FindProperty("_OutlineColor", properties);
            materialEditor.ShaderProperty(_OutlineThickness, _OutlineThickness.displayName);
            materialEditor.ShaderProperty(_OutlineColor, _OutlineColor.displayName);
        }
    }
Example #3
0
    override protected void FindProperties(MaterialProperty[] props)
    {
        this.renderingMode = ShaderGUI.FindProperty("_RenderingMode", props);
        this.cutoff        = ShaderGUI.FindProperty("_Cutoff", props);
        this.mainTex       = ShaderGUI.FindProperty("_MainTex", props);
        this.mainColor     = ShaderGUI.FindProperty("_MainColor", props);
        this.emissionColor = ShaderGUI.FindProperty("_EmissionColor", props);

        this.specularPower     = ShaderGUI.FindProperty("_SpecularPower", props);
        this.specularIntensity = ShaderGUI.FindProperty("_SpecularIntensity", props);
        this.specularColor     = ShaderGUI.FindProperty("_SpecularColor", props);

        this.reflectionOpacity   = ShaderGUI.FindProperty("_ReflectionOpacity", props);
        this.reflectionIntensity = ShaderGUI.FindProperty("_ReflectionIntensity", props);
        this.reflectionFresnel   = ShaderGUI.FindProperty("_ReflectionFresnel", props);
        this.reflectionMetallic  = ShaderGUI.FindProperty("_ReflectionMetallic", props);

        this.rimColor     = ShaderGUI.FindProperty("_RimColor", props);
        this.rimIntensity = ShaderGUI.FindProperty("_RimIntensity", props);
        this.rimFresnel   = ShaderGUI.FindProperty("_RimFresnel", props);

        this.rimLightColor     = ShaderGUI.FindProperty("_RimLightColor", props);
        this.rimLightIntensity = ShaderGUI.FindProperty("_RimLightIntensity", props);
        this.rimLightFresnel   = ShaderGUI.FindProperty("_RimLightFresnel", props);
    }
    public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
    {
        base.OnGUI(materialEditor, properties);

        Material material = materialEditor.target as Material;

        MaterialProperty _Emission = ShaderGUI.FindProperty("_Emission", properties);

        if (_Emission.floatValue == 1.0f)
        {
            material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive;
        }
        else
        {
            material.globalIlluminationFlags  = MaterialGlobalIlluminationFlags.BakedEmissive;
            material.globalIlluminationFlags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack;
        }

        //  Needed to make the Selection Outline work
        if (material.HasProperty("_MainTex") && material.HasProperty("_BaseMap"))
        {
            if (material.GetTexture("_BaseMap") != null)
            {
                material.SetTexture("_MainTex", material.GetTexture("_BaseMap"));
            }
        }
    }
    private void Blur(MaterialEditor materialEditor, MaterialProperty[] properties, GUIStyle style, bool toggle)
    {
        bool ini = toggle;

        toggle = EditorGUILayout.BeginToggleGroup("14.Blur", toggle);
        if (ini != toggle && !Application.isPlaying)
        {
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
        if (toggle)
        {
            targetMat.EnableKeyword("BLUR_ON");
            EditorGUILayout.BeginVertical(style);
            {
                materialEditor.ShaderProperty(properties[60], properties[60].displayName);
                materialEditor.ShaderProperty(properties[61], properties[61].displayName);
                MaterialProperty blurIsHd = ShaderGUI.FindProperty("_BlurHD", properties);
                if (blurIsHd.floatValue == 1)
                {
                    targetMat.EnableKeyword("BLURISHD_ON");
                }
                else
                {
                    targetMat.DisableKeyword("BLURISHD_ON");
                }
            }
            EditorGUILayout.EndVertical();
        }
        else
        {
            targetMat.DisableKeyword("BLUR_ON");
        }
        EditorGUILayout.EndToggleGroup();
    }
    public override void OnGUI(MaterialEditor materialEditor, MaterialProperty [] properties)
    {
        MaterialProperty outlineColor = ShaderGUI.FindProperty("_OutlineColor", properties);

        materialEditor.ShaderProperty(outlineColor, outlineColor.displayName);
        base.OnGUI(materialEditor, properties);
    }
Example #7
0
    /// <inheritdoc/>
    protected override void FindProperties(MaterialProperty[] props)
    {
        this.waveScale = ShaderGUI.FindProperty(
            "_WaveScale", props);
        this.waveSpeed = ShaderGUI.FindProperty(
            "_WaveSpeed", props);
        this.bumpMap = ShaderGUI.FindProperty(
            "_BumpMap", props);
        this.reflectiveColor = ShaderGUI.FindProperty(
            "_ReflectiveColor", props);

        this.refractionDistort = ShaderGUI.FindProperty(
            "_RefractionDistort", props);
        this.refractionOpacity = ShaderGUI.FindProperty(
            "_RefractionOpacity", props);

        this.waveTex = ShaderGUI.FindProperty(
            "_WaveTex", props);
        this.waveDistort = ShaderGUI.FindProperty(
            "_WaveDistort", props);

        this.specularDir = ShaderGUI.FindProperty(
            "_SpecularDir", props);
        this.specularPow = ShaderGUI.FindProperty(
            "_SpecularPow", props);
    }
Example #8
0
        protected override bool OnInitProperties(MaterialProperty[] props)
        {
            var _prop_Mode = ShaderGUI.FindProperty("_Mode", props);

            if (_prop_Mode != null)
            {
                var _prop_BlendOp  = FindProperty("_BlendOp", props);
                var _prop_SrcBlend = FindProperty("_SrcBlend", props);
                var _prop_DstBlend = FindProperty("_DstBlend", props);
                var _prop_ZWrite   = FindProperty("_ZWrite", props);
                var _prop_ZTest    = FindProperty("_ZTest", props);
                if (_prop_SrcBlend != null && _prop_DstBlend != null && _prop_ZWrite != null && _prop_ZTest != null)
                {
                    m_prop_Mode             = _prop_Mode;
                    m_prop_BlendOp          = _prop_BlendOp;
                    m_prop_SrcBlend         = _prop_SrcBlend;
                    m_prop_DstBlend         = _prop_DstBlend;
                    m_prop_ZWrite           = _prop_ZWrite;
                    m_prop_ZTest            = _prop_ZTest;
                    m_prop_AlphaPremultiply = FindProperty("_AlphaPremultiply", props, false);
                    m_prop_AutoRenderQueue  = FindProperty("_AutoRenderQueue", props, false);

                    m_prop_Cutoff        = FindProperty("_Cutoff", props, false);
                    m_prop_ColorKey      = FindProperty("_ColorKey", props, false);
                    m_prop_MainTex_Alpha = FindProperty("_MainTex_Alpha", props, false);
                    return(true);
                }
            }
            return(false);
        }
Example #9
0
    public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
    {
        // Find properties
        _RGBTex         = ShaderGUI.FindProperty("_RGBTex", properties);
        _ZTex           = ShaderGUI.FindProperty("_ZTex", properties);
        _StencilTex     = ShaderGUI.FindProperty("_StencilTex", properties);
        _BlendTex       = ShaderGUI.FindProperty("_BlendTex", properties);
        _SeparateRGBZ   = ShaderGUI.FindProperty("_SeparateRGBZ", properties);
        _StencilEnabled = ShaderGUI.FindProperty("_StencilEnabled", properties);
        _BlendEnabled   = ShaderGUI.FindProperty("_BlendEnabled", properties);

        // Show RGB tex properties
        materialEditor.ShaderProperty(_RGBTex, _RGBTex.displayName);

        // Show Z tex properties
        materialEditor.ShaderProperty(_SeparateRGBZ, _SeparateRGBZ.displayName);
        if (_SeparateRGBZ.floatValue == 1)
        {
            materialEditor.ShaderProperty(_ZTex, _ZTex.displayName);
        }

        // Show Stencil tex properties
        materialEditor.ShaderProperty(_StencilEnabled, _StencilEnabled.displayName);
        if (_StencilEnabled.floatValue == 1)
        {
            materialEditor.ShaderProperty(_StencilTex, _StencilTex.displayName);
        }

        // Show Blend tex properties
        materialEditor.ShaderProperty(_BlendEnabled, _BlendEnabled.displayName);
        if (_BlendEnabled.floatValue == 1)
        {
            materialEditor.ShaderProperty(_BlendTex, _BlendTex.displayName);
        }

        EditorGUILayout.Vector2Field("test", Vector2.zero);

        //base.OnGUI(materialEditor, properties);

        //Material targetMat = materialEditor.target as Material;


        //bool stencil = Array.IndexOf(targetMat.shaderKeywords, "STENCIL_ON") != -1;
        //bool proxy = Array.IndexOf(targetMat.shaderKeywords, "PROXY_ON") != -1;

        //EditorGUI.BeginChangeCheck();
        //stencil = EditorGUILayout.Toggle("Stencil", stencil);
        //proxy = EditorGUILayout.Toggle("Proxy", proxy);
        //if (EditorGUI.EndChangeCheck())
        //{
        //    if (stencil)
        //        targetMat.EnableKeyword("STENCIL_ON");
        //    else
        //        targetMat.DisableKeyword("STENCIL_ON");
        //    if (proxy)
        //        targetMat.EnableKeyword("PROXY_ON");
        //    else
        //        targetMat.DisableKeyword("PROXY_ON");
        //}
    }
 //-----------------------------
 // Methods
 //-----------------------------
 private void FindProperties(MaterialProperty[] props)
 {
     this.albedoMap     = ShaderGUI.FindProperty(ShaderConstants.TEXTURE_DIFFUSE, props);
     this.bumpMap       = ShaderGUI.FindProperty(ShaderConstants.TEXTURE_NORMAL, props);
     this.emissionMap   = ShaderGUI.FindProperty(ShaderConstants.TEXTURE_EMISSION, props);
     this.specSmoothMap = ShaderGUI.FindProperty(ShaderConstants.TEXTURE_SPECSMOOTH, props);
 }
    private void Posterize(MaterialEditor materialEditor, MaterialProperty[] properties, GUIStyle style, bool toggle)
    {
        bool ini = toggle;

        toggle = EditorGUILayout.BeginToggleGroup("13.Posterize", toggle);
        if (ini != toggle && !Application.isPlaying)
        {
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
        if (toggle)
        {
            targetMat.EnableKeyword("POSTERIZE_ON");
            EditorGUILayout.BeginVertical(style);
            {
                materialEditor.ShaderProperty(properties[57], properties[57].displayName);
                materialEditor.ShaderProperty(properties[58], properties[58].displayName);
                materialEditor.ShaderProperty(properties[59], properties[59].displayName);
                MaterialProperty posterizeOut = ShaderGUI.FindProperty("_PosterizeOutline", properties);
                if (posterizeOut.floatValue == 1)
                {
                    targetMat.EnableKeyword("POSTERIZEOUTLINE_ON");
                }
                else
                {
                    targetMat.DisableKeyword("POSTERIZEOUTLINE_ON");
                }
            }
            EditorGUILayout.EndVertical();
        }
        else
        {
            targetMat.DisableKeyword("POSTERIZE_ON");
        }
        EditorGUILayout.EndToggleGroup();
    }
    private void GreyScale(MaterialEditor materialEditor, MaterialProperty[] properties, GUIStyle style, bool toggle)
    {
        bool ini = toggle;

        toggle = EditorGUILayout.BeginToggleGroup("12.Greyscale", toggle);
        if (ini != toggle && !Application.isPlaying)
        {
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
        if (toggle)
        {
            targetMat.EnableKeyword("GREYSCALE_ON");
            EditorGUILayout.BeginVertical(style);
            {
                materialEditor.ShaderProperty(properties[54], properties[54].displayName);
                materialEditor.ShaderProperty(properties[55], properties[55].displayName);
                materialEditor.ShaderProperty(properties[56], properties[56].displayName);
                MaterialProperty greyScaleOut = ShaderGUI.FindProperty("_GreyscaleOutline", properties);
                if (greyScaleOut.floatValue == 1)
                {
                    targetMat.EnableKeyword("GREYSCALEOUTLINE_ON");
                }
                else
                {
                    targetMat.DisableKeyword("GREYSCALEOUTLINE_ON");
                }
            }
            EditorGUILayout.EndVertical();
        }
        else
        {
            targetMat.DisableKeyword("GREYSCALE_ON");
        }
        EditorGUILayout.EndToggleGroup();
    }
    private void ZWrite(MaterialEditor materialEditor, MaterialProperty[] properties, GUIStyle style, string inspector)
    {
        MaterialProperty zWrite = ShaderGUI.FindProperty("_ZWrite", properties);
        bool             toggle = zWrite.floatValue > 0.9f ? true : false;
        bool             ini    = toggle;

        toggle = EditorGUILayout.BeginToggleGroup(inspector, toggle);
        if (ini != toggle && !Application.isPlaying)
        {
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
        if (toggle)
        {
            EditorGUILayout.BeginVertical(style);
            {
                GUILayout.Label("Usually used to sort Billboarded sprites", style);
                GUILayout.Label("Use effect instead 23.Alpha Cutoff for more optimum results", style);
                zWrite.floatValue = 1.0f;
            }
            EditorGUILayout.EndVertical();
        }
        else
        {
            zWrite.floatValue = 0.0f;
        }
        EditorGUILayout.EndToggleGroup();
    }
    private void ColorRamp(MaterialEditor materialEditor, MaterialProperty[] properties, GUIStyle style, bool toggle)
    {
        bool ini = toggle;

        toggle = EditorGUILayout.BeginToggleGroup("8.Color Ramp", toggle);
        if (ini != toggle && !Application.isPlaying)
        {
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
        if (toggle)
        {
            targetMat.EnableKeyword("COLORRAMP_ON");
            EditorGUILayout.BeginVertical(style);
            {
                materialEditor.ShaderProperty(properties[51], properties[51].displayName);
                materialEditor.ShaderProperty(properties[52], properties[52].displayName);
                materialEditor.ShaderProperty(properties[53], properties[53].displayName);
                MaterialProperty colorRampOut = ShaderGUI.FindProperty("_ColorRampOutline", properties);
                if (colorRampOut.floatValue == 1)
                {
                    targetMat.EnableKeyword("COLORRAMPOUTLINE_ON");
                }
                else
                {
                    targetMat.DisableKeyword("COLORRAMPOUTLINE_ON");
                }
            }
            EditorGUILayout.EndVertical();
        }
        else
        {
            targetMat.DisableKeyword("COLORRAMP_ON");
        }
        EditorGUILayout.EndToggleGroup();
    }
    private void Billboard(MaterialEditor materialEditor, MaterialProperty[] properties, GUIStyle style, bool toggle, string inspector, string flag)
    {
        bool ini = toggle;

        toggle = EditorGUILayout.BeginToggleGroup(inspector, toggle);
        if (ini != toggle && !Application.isPlaying)
        {
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
        if (toggle)
        {
            targetMat.EnableKeyword(flag);
            EditorGUILayout.BeginVertical(style);
            {
                GUILayout.Label("Don't use this feature on UI elements!", style);
                materialEditor.ShaderProperty(properties[129], properties[129].displayName);
                MaterialProperty billboardY = ShaderGUI.FindProperty("_BillboardY", properties);
                if (billboardY.floatValue == 1)
                {
                    targetMat.EnableKeyword("BILBOARDY_ON");
                }
                else
                {
                    targetMat.DisableKeyword("BILBOARDY_ON");
                }
            }
            EditorGUILayout.EndVertical();
        }
        else
        {
            targetMat.DisableKeyword(flag);
        }
        EditorGUILayout.EndToggleGroup();
    }
Example #16
0
        public void DrawGUI(ShaderGUI shaderGUI, MaterialEditor materialEditor, MaterialProperty[] properties)
        {
            if (shaderGUI != this.shaderGUI)
            {
                this.shaderGUI          = shaderGUI;
                this.materialEditor     = materialEditor;
                this.materialProperties = properties;

                this.miscProperties.Clear();
                foreach (var it in properties)
                {
                    this.miscProperties.Add(it);
                }
                this.OnFirstApply();
            }

            bool changed = false;

            this.OnPreGUI();
            using (var chk = new EditorGUI.ChangeCheckScope())
            {
                if (this.rootItem != null)
                {
                    this.rootItem.OnGUIFamily(this);
                }
                changed = chk.changed;
            }
            this.OnPostGUI(changed);
        }
    public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
    {
        base.OnGUI(materialEditor, properties);

        Material material = materialEditor.target as Material;

        if (material.HasProperty("_Culling"))
        {
            var _Culling = ShaderGUI.FindProperty("_Culling", properties);
            if (_Culling.floatValue == 0.0f)
            {
                if (material.doubleSidedGI == false)
                {
                    Debug.Log("Double Sided Global Illumination enabled.");
                }
                material.doubleSidedGI = true;
            }
        }

        //material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
        //material.SetOverrideTag("RenderType", "TransparentCutout");

        //  Needed to make the Selection Outline work
        if (material.HasProperty("_MainTex") && material.HasProperty("_BaseMap"))
        {
            if (material.GetTexture("_BaseMap") != null)
            {
                material.SetTexture("_MainTex", material.GetTexture("_BaseMap"));
            }
        }
    }
    private void ZTest(string inspector, string keyword)
    {
        bool             toggle = oldKeyWords.Contains(keyword);
        MaterialProperty zTestM = ShaderGUI.FindProperty("_ZTestMode", matProperties);

        if (zTestM.floatValue == 0)
        {
            zTestM.floatValue = 4;
        }
        bool ini = toggle;

        toggle = EditorGUILayout.BeginToggleGroup(inspector, toggle);
        if (ini != toggle && !Application.isPlaying)
        {
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
        if (toggle)
        {
            targetMat.EnableKeyword(keyword);
            EditorGUILayout.BeginVertical(style);
            {
                GUILayout.Label("Look for 'ShaderLab culling and depth testing' \nif you don't know what this is", smallLabelStyle);
                zTestMode         = (CompareFunction)zTestM.floatValue;
                zTestMode         = (CompareFunction)EditorGUILayout.EnumPopup("zTestMode", zTestMode);
                zTestM.floatValue = (float)(zTestMode);
            }
            EditorGUILayout.EndVertical();
        }
        else
        {
            targetMat.DisableKeyword(keyword);
        }
        EditorGUILayout.EndToggleGroup();
    }
    public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
    {
        MaterialProperty _Color1 = ShaderGUI.FindProperty("_Color1", properties);
        MaterialProperty _Color2 = ShaderGUI.FindProperty("_Color2", properties);

        MaterialProperty _UpVector = ShaderGUI.FindProperty("_UpVector", properties);

        MaterialProperty _Intensity = ShaderGUI.FindProperty("_Intensity", properties);
        MaterialProperty _Exponent  = ShaderGUI.FindProperty("_Exponent", properties);

        materialEditor.ShaderProperty(_Color1, _Color1.displayName);
        materialEditor.ShaderProperty(_Color2, _Color2.displayName);

        EditorGUI.BeginDisabledGroup(true);
        materialEditor.ShaderProperty(_UpVector, _UpVector.displayName);
        EditorGUI.EndDisabledGroup();

        materialEditor.ShaderProperty(_Intensity, _Intensity.displayName);
        materialEditor.ShaderProperty(_Exponent, _Exponent.displayName);

        EditorGUILayout.Space();
        EditorGUILayout.HelpBox("Some features are not available in the free edition of Minimalist", MessageType.Warning);
        if (GUILayout.Button("Get full version of Minimalist"))
        {
            Application.OpenURL("http://bit.ly/fr_minimalist");
        }
    }
    private void ZTest(MaterialEditor materialEditor, MaterialProperty[] properties, GUIStyle style, bool toggle, string inspector, string flag)
    {
        MaterialProperty zTestM = ShaderGUI.FindProperty("_ZTestMode", properties);

        if (zTestM.floatValue == 0)
        {
            zTestM.floatValue = 4;
        }
        bool ini = toggle;

        toggle = EditorGUILayout.BeginToggleGroup(inspector, toggle);
        if (ini != toggle && !Application.isPlaying)
        {
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
        if (toggle)
        {
            targetMat.EnableKeyword(flag);
            EditorGUILayout.BeginVertical(style);
            {
                GUILayout.Label("Look for 'ShaderLab culling and depth testing' if you don't know what this is", style);
                zTestMode         = (UnityEngine.Rendering.CompareFunction)zTestM.floatValue;
                zTestMode         = (UnityEngine.Rendering.CompareFunction)EditorGUILayout.EnumPopup("zTestMode", zTestMode);
                zTestM.floatValue = (float)(zTestMode);
            }
            EditorGUILayout.EndVertical();
        }
        else
        {
            targetMat.DisableKeyword(flag);
        }
        EditorGUILayout.EndToggleGroup();
    }
Example #21
0
    protected void ShowToggleBlock(string name, string macroname, System.Action callback)
    {
        EditorGUI.BeginChangeCheck();
        ShowPropertys(name);
        var property = ShaderGUI.FindProperty(name, properties);

        //if (property.floatValue > 0.5) {
        //    property.floatValue = GUILayout.Toggle(property.floatValue > 0.5, property.displayName, BoldStyle)?1:0;
        //}
        //else {
        //    property.floatValue = GUILayout.Toggle(property.floatValue > 0.5, property.displayName)?1:0;
        //}

        if (property.floatValue > 0.5)
        {
            //GUILayout.Label(name, EditorStyles.boldLabel);
            EditorGUI.indentLevel += 1;
            callback();
            EditorGUI.indentLevel -= 1;
            GUILayout.Space(15);
        }

        if (EditorGUI.EndChangeCheck())
        {
            SetKeyword(macroname, property.floatValue > 0.5);
        }
    }
Example #22
0
    void ShowMain()
    {
        var prop  = ShaderGUI.FindProperty("_MainTex", properties);
        var prop2 = ShaderGUI.FindProperty("_Color", properties);

        this.editor.TexturePropertySingleLine(MakeLabel(prop), prop, prop2);
        GUILayout.Space(15);
    }
Example #23
0
        public void FindProperties(MaterialProperty[] props)
        {
            this._MainTex     = ShaderGUI.FindProperty("_MainTex", props);
            this._BumpMap     = ShaderGUI.FindProperty("_BumpMap", props);
            this._ParallaxMap = ShaderGUI.FindProperty("_ParallaxMap", props);

            this._Tessellation = ShaderGUI.FindProperty("_Tessellation", props);
        }
            public override void OnFindProperty(MaterialProperty[] props)
            {
                base.OnFindProperty(props);

                if (!string.IsNullOrEmpty(ExtraPropertyName))
                {
                    m_ExtraProperty = ShaderGUI.FindProperty(ExtraPropertyName, props, IsMandatory);
                }
            }
Example #25
0
    protected Vector4 ShowVector4(string name)
    {
        var property = ShaderGUI.FindProperty(name, properties);
        var res      = target.GetVector(name);
        var val      = EditorGUILayout.Vector4Field(property.displayName, res);

        target.SetVector(name, val);
        return(res);
    }
Example #26
0
        private MaterialProperty BeginProperty(string name)
        {
            MaterialProperty materialProperty = ShaderGUI.FindProperty(name, properties);

            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = materialProperty.hasMixedValue;
            editor.BeginAnimatedCheck(materialProperty);
            return(materialProperty);
        }
Example #27
0
    void ShowSoftParticle()
    {
        var _UseSoftParticle = ShaderGUI.FindProperty("_UseSoftParticle", properties);

        editor.ShaderProperty(_UseSoftParticle, _UseSoftParticle.displayName);
        if (FloatEqual(_UseSoftParticle.floatValue, 1))
        {
            ShowPropertys("_InvFade");
        }
    }
Example #28
0
    private void ShowSoftParticle()
    {
        var _UseSoftParticle = ShaderGUI.FindProperty("_UseSoftParticle", this._properties);

        this._editor.ShaderProperty(_UseSoftParticle, _UseSoftParticle.displayName);
        if (_UseSoftParticle.floatValue > 0.5f)
        {
            ShowPropertys("_InvFade");
        }
    }
Example #29
0
    override public void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
    {
        Material         material;
        MaterialProperty _DeepWaterColor;
        MaterialProperty _ShorelineColor;
        MaterialProperty _ShorelineDepth;
        MaterialProperty _WaterSpeed;
        MaterialProperty _WavesIntensity;
        MaterialProperty _WavesDensity;
        MaterialProperty _LightRamp;
        MaterialProperty _shallowWaterColor;
        MaterialProperty _TessellationValue;
        MaterialProperty _UseTessellation;
        MaterialProperty _Foam;
        MaterialProperty _FoamScale;

        material = materialEditor.target as Material;

        _DeepWaterColor    = ShaderGUI.FindProperty("_DeepWaterColor", properties);
        _ShorelineColor    = ShaderGUI.FindProperty("_ShorelineColor", properties);
        _ShorelineDepth    = ShaderGUI.FindProperty("_ShorelineDepth", properties);
        _WaterSpeed        = ShaderGUI.FindProperty("_WaterSpeed", properties);
        _WavesIntensity    = ShaderGUI.FindProperty("_WavesIntensity", properties);
        _WavesDensity      = ShaderGUI.FindProperty("_WavesDensity", properties);
        _LightRamp         = ShaderGUI.FindProperty("_LightRamp", properties);
        _shallowWaterColor = ShaderGUI.FindProperty("_shallowWaterColor", properties);
        _TessellationValue = ShaderGUI.FindProperty("_TessellationValue", properties);
        _UseTessellation   = ShaderGUI.FindProperty("_UseTessellation", properties);
        _Foam      = ShaderGUI.FindProperty("_Foam", properties);
        _FoamScale = ShaderGUI.FindProperty("_FoamScale", properties);
        //__________________________________________________________________________________
        EditorGUILayout.Space();
        materialEditor.TexturePropertySingleLine(new GUIContent("Light Ramp", ""), _LightRamp);
        materialEditor.TexturePropertySingleLine(new GUIContent("Foam", ""), _Foam, _FoamScale);
        //__________________________________________________________________________________
        EditorGUILayout.Space();
        materialEditor.ShaderProperty(_ShorelineDepth, _ShorelineDepth.displayName);
        //__________________________________________________________________________________
        EditorGUILayout.Space();
        materialEditor.ShaderProperty(_ShorelineColor, _ShorelineColor.displayName);
        materialEditor.ShaderProperty(_DeepWaterColor, _DeepWaterColor.displayName);
        materialEditor.ShaderProperty(_shallowWaterColor, _shallowWaterColor.displayName);
        //__________________________________________________________________________________
        EditorGUILayout.Space();
        materialEditor.ShaderProperty(_WaterSpeed, _WaterSpeed.displayName);
        materialEditor.ShaderProperty(_WavesDensity, _WavesDensity.displayName);
        materialEditor.ShaderProperty(_WavesIntensity, _WavesIntensity.displayName);
        //__________________________________________________________________________________
        EditorGUILayout.Space();
        materialEditor.ShaderProperty(_UseTessellation, _UseTessellation.displayName);
        if (_UseTessellation.floatValue == 1)
        {
            materialEditor.ShaderProperty(_TessellationValue, _TessellationValue.displayName);
        }
    }
Example #30
0
    public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
    {
        //Style similar to Standard shader
        this.m_MaterialEditor = materialEditor;
        m_MaterialEditor.SetDefaultGUIWidths();
        m_MaterialEditor.UseDefaultMargins();
        EditorGUIUtility.labelWidth = 0f;

        //Load Properties

        diff            = ShaderGUI.FindProperty("_Diffuse", properties);
        normal          = ShaderGUI.FindProperty("_Normal", properties);
        HoloMask        = ShaderGUI.FindProperty("_HoloMask", properties);
        tint            = ShaderGUI.FindProperty("_Tint", properties);
        ScanlinesToggle = ShaderGUI.FindProperty("_UseScreenSpaceScanlines", properties);
        SSSsize         = ShaderGUI.FindProperty("_SSSsize", properties);
        OSSsize         = ShaderGUI.FindProperty("_OSSsize", properties);
        BigScanFreq     = ShaderGUI.FindProperty("_BigScanFreq", properties);
        BigScanSpeed    = ShaderGUI.FindProperty("_BigScanSpeed", properties);

        Bias  = ShaderGUI.FindProperty("_Bias", properties);
        Scale = ShaderGUI.FindProperty("_Scale", properties);
        Power = ShaderGUI.FindProperty("_Power", properties);

        NoiseValue           = ShaderGUI.FindProperty("_RandomNoiseLevel", properties);
        GlitchToggle         = ShaderGUI.FindProperty("_ToggleGlitch", properties);
        ScanlineDeformToggle = ShaderGUI.FindProperty("_ToggleScanlineDeform", properties);
        DisplacementeToggle  = ShaderGUI.FindProperty("_DisplacementSwitch", properties);



        //Draw Gui
        HeaderGUI();
        GUILayout.Label("Main Textures", EditorStyles.boldLabel);
        GUILayout.Label("Albedo : Diffuse (RGB) and alpha (A)");
        GUIContent diffuseLabel = new GUIContent("", "Diffuse (RGB) and alpha (A)");
        GUIContent tintlabel    = new GUIContent("Tint", "Hologram color");

        //m_MaterialEditor.TexturePropertySingleLine(diffuseLabel, diff);
        m_MaterialEditor.ShaderProperty(diff, diffuseLabel);
        m_MaterialEditor.ShaderProperty(tint, tintlabel);

        GUILayout.Label("Normal");
        GUIContent normalLabel = new GUIContent("");

        m_MaterialEditor.ShaderProperty(normal, normalLabel);

        GUIContent ScanlinesLabel = new GUIContent("Scanlines texture");

        m_MaterialEditor.ShaderProperty(HoloMask, ScanlinesLabel);

        ScanlinesGUI();
        FresnelGUI();
        NoiseGUI();
    }