public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
        {
            InitializeMatProps(properties);
            EditorGUI.BeginChangeCheck();
            {
                materialEditor.ColorProperty(_Color1, "Color 1");
                materialEditor.ColorProperty(_Color2, "Color 2");

                materialEditor.FloatProperty(_Intensity, "Intensity");
                materialEditor.FloatProperty(_Exponent, "Exponent");

                materialEditor.RangeProperty(_DirY, "Pitch");
                materialEditor.RangeProperty(_DirX, "Yaw");

                float x = _DirX.floatValue * Mathf.Deg2Rad;
                float y = _DirY.floatValue * Mathf.Deg2Rad;

                _UpVector.vectorValue = new Vector4(Mathf.Sin(y) * Mathf.Sin(x), Mathf.Cos(y),
                                                    Mathf.Sin(y) * Mathf.Cos(x), 0.0f);
            }
            if (EditorGUI.EndChangeCheck())
            {
                InitializeMatProps(properties);
            }
        }
예제 #2
0
    void BasicUI()
    {
        MaterialProperty mainTex      = FindProperty("_MainTex", properties);
        GUIContent       mainTexLabel = new GUIContent(mainTex.displayName);

        editor.TextureProperty(mainTex, mainTexLabel.text);

        MaterialProperty color      = FindProperty("_Color", properties);
        GUIContent       colorLabel = new GUIContent(color.displayName);

        editor.ColorProperty(color, colorLabel.text);

        MaterialProperty edgeColor      = FindProperty("_EdgeColor", properties);
        GUIContent       edgeColorLabel = new GUIContent(edgeColor.displayName);

        editor.ColorProperty(edgeColor, edgeColorLabel.text);

        MaterialProperty depthFactor      = FindProperty("_DepthFactor", properties);
        GUIContent       depthFactorLabel = new GUIContent(depthFactor.displayName);

        editor.FloatProperty(depthFactor, depthFactorLabel.text);

        MaterialProperty distortStrength      = FindProperty("_DistortStrength", properties);
        GUIContent       distortStrengthLabel = new GUIContent(distortStrength.displayName);

        editor.FloatProperty(distortStrength, distortStrengthLabel.text);
    }
예제 #3
0
    private void DrawUVTransform()
    {
        EditorGUI.BeginChangeCheck();
        bool ison = _material.IsKeywordEnabled("TRANSFER_UV");

        ison = EditorGUILayout.Toggle("Transform UV", ison);
        if (EditorGUI.EndChangeCheck())
        {
            if (ison)
            {
                _material.EnableKeyword("TRANSFER_UV");
            }
            else
            {
                _material.DisableKeyword("TRANSFER_UV");
            }
        }

        if (_material.IsKeywordEnabled("TRANSFER_UV"))
        {
            _currEditor.FloatProperty(_rotate, "Rotate");
            _currEditor.VectorProperty(_offsets, "Offset(xy)/Scale(zw)");
            _currEditor.VectorProperty(_pivot, "Pivot(xy)");
        }
    }
예제 #4
0
        public override void OnGUI(MaterialEditor editor, MaterialProperty[] props)
        {
            Material material = editor.target as Material;

            FindProperties(material, props);

            EditorGUI.BeginChangeCheck();
            {
                editor.TexturePropertySingleLine(new GUIContent("Texture"), _texture);
                editor.TexturePropertySingleLine(new GUIContent("Normal Map"), _normalMap);
                editor.TexturePropertySingleLine(new GUIContent("Palette"), _palette);
                EditorGUILayout.Space();
                editor.TexturePropertySingleLine(new GUIContent("Palette 2"), _palette2);
                editor.FloatProperty(_paletteMix, "Palette Mix");
                EditorGUILayout.Space();
                editor.VectorProperty(_lightDirection, "Light Direction");
                editor.FloatProperty(_dither, "Dither");
                _shadowsEnabled = EditorGUILayout.Toggle("Shadows", _shadowsEnabled);
            }
            if (EditorGUI.EndChangeCheck())
            {
                SetKeywords(material);
            }

            if (_isFirstRun)
            {
                SetKeywords(material);
                _isFirstRun = false;
            }
        }
예제 #5
0
    protected virtual bool RenderEmissionProperties()
    {
        bool dataChanged = false;

        bool mixedValue;
        bool emission = IsKeywordEnabled(_materialEditor, "_EMISSION", out mixedValue);

        EditorGUI.BeginChangeCheck();
        EditorGUI.showMixedValue = mixedValue;
        emission = BoldToggleField(_emissionToggleText, emission);
        EditorGUI.showMixedValue = false;
        if (EditorGUI.EndChangeCheck())
        {
            SetKeyword(_materialEditor, "_EMISSION", emission);
            mixedValue  = false;
            dataChanged = true;
        }

        if (emission && !mixedValue)
        {
            EditorGUI.BeginChangeCheck();
            _materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, true);
            _materialEditor.FloatProperty(_emissionPower, _emissionPowerText.text);
            dataChanged |= EditorGUI.EndChangeCheck();
        }

        return(dataChanged);
    }
예제 #6
0
 protected virtual void RenderEmissionProperties(Material material)
 {
     if (ToggleHeadingKeyword("Emission", material, "_EMISSION"))
     {
         _materialEditor.TexturePropertyWithHDRColor(new GUIContent("Emission"), _emissionMap, _emissionColor, new ColorPickerHDRConfig(0, 1, 0.01010101f, 3), true);
         _materialEditor.FloatProperty(_emissionPower, "Emission Power");
     }
 }
예제 #7
0
    void DrawEffect(MaterialEditor materialEditor, MaterialProperty[] property, int layer)
    {
        GUIStyle style = EditorStyles.helpBox;

        style.margin = new RectOffset(20, 20, 0, 0);

        EditorGUILayout.BeginVertical(style);
        materialEditor.TexturePropertySingleLine(new GUIContent("效果纹理"), property.GetByName(GetNameByLayer("EffectTexture", layer)));
        materialEditor.TexturePropertySingleLine(new GUIContent("移动纹理"), property.GetByName(GetNameByLayer("MotionTexture", layer)));

        materialEditor.ColorProperty(property.GetByName(GetNameByLayer("EffectColor", layer)), "效果颜色");

        materialEditor.FloatProperty(property.GetByName(GetNameByLayer("MotionSpeed", layer)), "移动速度");
        materialEditor.FloatProperty(property.GetByName(GetNameByLayer("RotationSpeed", layer)), "旋转速度");

        //materialEditor.VectorProperty(property.GetByName(GetNameByLayer("Pivot", layer)), "锚点");

        Vector4 translation = property.GetByName(GetNameByLayer("Position", layer)).vectorValue;

        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.LabelField("位置");
            translation.x = EditorGUILayout.FloatField(translation.x);
            translation.y = EditorGUILayout.FloatField(translation.y);
        }
        EditorGUILayout.EndHorizontal();
        property.GetByName(GetNameByLayer("Position", layer)).vectorValue = translation;

        Vector4 pivot = property.GetByName(GetNameByLayer("Pivot", layer)).vectorValue;

        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.LabelField("锚点");
            pivot.x = EditorGUILayout.FloatField(pivot.x);
            pivot.y = EditorGUILayout.FloatField(pivot.y);
        }
        EditorGUILayout.EndHorizontal();
        property.GetByName(GetNameByLayer("Pivot", layer)).vectorValue = pivot;

        Vector4 scale = property.GetByName(GetNameByLayer("Scale", layer)).vectorValue;

        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.LabelField("缩放");
            scale.x = EditorGUILayout.FloatField(scale.x);
            scale.y = EditorGUILayout.FloatField(scale.y);
        }
        EditorGUILayout.EndHorizontal();
        property.GetByName(GetNameByLayer("Scale", layer)).vectorValue = scale;

        bool foreground = property.GetByName(GetNameByLayer("Foreground", layer)).floatValue == 1 ? true : false;

        foreground = EditorGUILayout.Toggle("前景?", foreground);
        property.GetByName(GetNameByLayer("Foreground", layer)).floatValue = foreground  ? 1 : 0;


        EditorGUILayout.EndVertical();
    }
예제 #8
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
        {
            InitializeMatProps(properties);
            EditorGUI.BeginChangeCheck();
            {
                materialEditor.ColorProperty(_Color1, "Color 1");
                materialEditor.ColorProperty(_Color2, "Color 2");

                materialEditor.FloatProperty(_Intensity, "Intensity");
                materialEditor.FloatProperty(_Exponent, "Exponent");

                // EditorGUI.BeginDisabledGroup(true);
                // {
                materialEditor.RangeProperty(_DirY, "Pitch");
                materialEditor.RangeProperty(_DirX, "Yaw");
                // }
                // EditorGUI.EndDisabledGroup();

                materialEditor.VectorProperty(_UpVector, "Upvector");

                EditorGUILayout.HelpBox("Some Features are not available in the free version of Minimalist", MessageType.Warning);

                if (GUILayout.Button("Get the full fersion of Minimalist"))
                {
                    Application.OpenURL("https://assetstore.unity.com/packages/vfx/shaders/minimalist-lowpoly-flat-gradient-shader-91366");
                }


                EditorGUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("Forum"))
                    {
                        Application.OpenURL("https://forum.unity.com/threads/minimalist-lowpoly-gradient-shader.478507");
                    }

                    if (GUILayout.Button("Email"))
                    {
                        Application.OpenURL("mailto://[email protected]");
                    }

                    if (GUILayout.Button("Rate/Review"))
                    {
                        Application.OpenURL("https://assetstore.unity.com/packages/vfx/shaders/minimalist-free-lowpoly-flat-gradient-shader-96148");
                    }
                }

                EditorGUILayout.EndHorizontal();
            }
            if (EditorGUI.EndChangeCheck())
            {
                InitializeMatProps(properties);
            }
        }
예제 #9
0
 private void UVNoiseGUI(MaterialEditor materialEditor, Material[] materials)
 {
     if (this.CheckOption(materials, "Enable UV Noise", "ENABLE_UV_NOISE"))
     {
         EditorGUI.indentLevel = 1;
         materialEditor.TextureProperty(this.uvNoise, "UV Noise");
         materialEditor.FloatProperty(this.uvNoiseBias, "Noise Bias");
         materialEditor.FloatProperty(this.uvNoiseIntensity, "Noise Intensity");
         materialEditor.VectorProperty(this.uvNoiseSpeed, "UV Speed");
         EditorGUI.indentLevel = 0;
     }
 }
예제 #10
0
    private void ColorGUI(MaterialEditor materialEditor, Material[] materials)
    {
        // main texture, main color
        {
            materialEditor.TextureProperty(this.mainTex, "Main Texture");
            if (this.CheckOption(materials, "Enable Main Color", "ENABLE_MAIN_COLOR"))
            {
                EditorGUI.indentLevel = 1;
                materialEditor.ColorProperty(this.mainColor, "Main Color");
                EditorGUI.indentLevel = 0;
            }
        }

        // emission
        {
            if (this.CheckOption(materials, "Enable Emission", "ENABLE_EMISSION"))
            {
                EditorGUI.indentLevel = 1;
                materialEditor.ColorProperty(this.emissionColor, "Emission Color");
                if (this.mainTex.textureValue != null)
                {
                    this.CheckOption(
                        materials,
                        "Alpha Control",
                        "ENABLE_EMISSION_ALPHA_CONTROL");
                }

                EditorGUI.indentLevel = 0;
            }
        }

        // specular
        {
            var specularOptions = new string[] { "No Specular", "Specular", "Specular Dir" };
            var specularKeys    = new string[] { "_", "ENABLE_SEPCULAR", "ENABLE_SEPCULAR_DIR" };
            if (this.ListOptions(materials, specularOptions, specularKeys) > 0)
            {
                this.specularEnabled  = true;
                EditorGUI.indentLevel = 1;

                materialEditor.FloatProperty(this.specularPower, "Specular Power");
                materialEditor.FloatProperty(this.specularIntensity, "Specular Intensity");
                materialEditor.ColorProperty(this.specularColor, "Specular Color");

                EditorGUI.indentLevel = 0;
            }
            else
            {
                this.specularEnabled = false;
            }
        }
    }
예제 #11
0
    public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
    {
        //base.OnGUI(materialEditor, properties);

        Material material = materialEditor.target as Material;

        m_MaterialEditor = materialEditor;

        FindMaterialProperties(properties);

        EditorGUI.BeginChangeCheck();
        {
            DoBlendMode();
            SetupBillboard(material);
            SetupZWrite(material);
            m_MaterialEditor.TextureScaleOffsetProperty(albedoMapProp);
            m_MaterialEditor.FloatProperty(intensityProperty, "intensity");
        }
        if (EditorGUI.EndChangeCheck())
        {
            foreach (var obj in blendModeProp.targets)
            {
                MaterialChanged((Material)obj);
            }
        }

        materialEditor.RenderQueueField();
    }
예제 #12
0
        private void DrawProperty(MaterialProperty property)
        {
            string propName = property.displayName;

            switch (property.type)
            {
            case MaterialProperty.PropType.Color:
                materialEditor.ColorProperty(property, propName);
                break;

            case MaterialProperty.PropType.Float:
                materialEditor.FloatProperty(property, propName);
                break;

            case MaterialProperty.PropType.Range:
                materialEditor.RangeProperty(property, propName);
                break;

            case MaterialProperty.PropType.Texture:
                materialEditor.TexturePropertySingleLine(new GUIContent(propName), property);
                if (!property.flags.HasFlag((System.Enum)MaterialProperty.PropFlags.NoScaleOffset))
                {
                    materialEditor.TextureScaleOffsetProperty(property);
                }
                break;

            case MaterialProperty.PropType.Vector:
                materialEditor.VectorProperty(property, propName);
                break;
            }
        }
    public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
    {
        mainTexture        = FindProperty("_MainTex", properties);
        ambientColor       = FindProperty("_AmbColor", properties);
        diffuseRate        = FindProperty("_DiffuseRate", properties);
        rimThickness       = FindProperty("_RimThick", properties);
        rimColor           = FindProperty("_RimColor", properties);
        stencilMask        = FindProperty("_Mask", properties);
        stencilCompareMode = FindProperty("_CompareMode", properties);

        EditorGUIUtility.labelWidth = 0f;

        EditorGUI.BeginChangeCheck();
        {
        }
        EditorGUI.EndChangeCheck();


        materialEditor.TexturePropertySingleLine(new GUIContent(mainTexture.displayName, "Main Color Texture (RGB)"), mainTexture);
        materialEditor.ColorProperty(ambientColor, ambientColor.displayName);
        materialEditor.RangeProperty(diffuseRate, diffuseRate.displayName);
        materialEditor.RangeProperty(rimThickness, rimThickness.displayName);
        materialEditor.ColorProperty(rimColor, rimColor.displayName);

        materialEditor.FloatProperty(stencilMask, stencilMask.displayName);
        int currentCompareMode = (int)stencilCompareMode.floatValue;
        int newCompareMode     = EditorGUILayout.Popup(stencilCompareMode.displayName, currentCompareMode, Enum.GetNames(typeof(UnityEngine.Rendering.CompareFunction)));

        if (currentCompareMode != newCompareMode)
        {
            stencilCompareMode.floatValue = (float)newCompareMode;
        }
        materialEditor.RenderQueueField();
    }
예제 #14
0
    void addProperty(MaterialProperty property, string title, int labelWidth = 150)
    {
        GUILayout.BeginHorizontal();
        float lw = EditorGUIUtility.labelWidth;

        EditorGUIUtility.labelWidth = labelWidth;        //Screen.width - labelWidth;

        switch (property.type)
        {
        case MaterialProperty.PropType.Color:
            materialEditor.ColorProperty(property, title);
            break;

        case MaterialProperty.PropType.Float:
            materialEditor.FloatProperty(property, title);
            break;

        case MaterialProperty.PropType.Vector:
            materialEditor.VectorProperty(property, title);
            break;

        case MaterialProperty.PropType.Range:
            materialEditor.RangeProperty(property, title);
            break;
        }

        EditorGUIUtility.labelWidth = lw;
        GUILayout.EndHorizontal();
    }
예제 #15
0
    public void ShaderPropertiesGUI(Material material)
    {
        // Use default labelWidth
        EditorGUIUtility.labelWidth = 0f;

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

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

            // Secondary properties

            m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
            m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
            m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
            //m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

            EditorGUILayout.Space();


            GUILayout.Label(Styles.UVScrollSettings, EditorStyles.boldLabel);
            //纹理混合
            m_MaterialEditor.TexturePropertySingleLine(Styles.UVScrollMapText, UVScrollMap, UVScrollTintColor);
            m_MaterialEditor.TextureScaleOffsetProperty(UVScrollMap);
            m_MaterialEditor.TexturePropertySingleLine(Styles.UVScrollMaskMapText, UVScrollMask);
            m_MaterialEditor.TextureScaleOffsetProperty(UVScrollMask);
            m_MaterialEditor.FloatProperty(UVScrollColorStrength, Styles.UVScrollColorStrengthText.text);
            UVScrollBlendModePopup();
            //// 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);
            }
        }
    }
예제 #16
0
    //draw property
    private void DrawProperty(MaterialProperty property)
    {
        switch (property.type)
        {
        case MaterialProperty.PropType.Range: // float ranges
            m_MaterialEditor.RangeProperty(property, property.displayName);
            break;

        case MaterialProperty.PropType.Float: // floats
            m_MaterialEditor.FloatProperty(property, property.displayName);
            break;

        case MaterialProperty.PropType.Color: // colors
            m_MaterialEditor.ColorProperty(property, property.displayName);
            break;

        case MaterialProperty.PropType.Texture: // textures
            m_MaterialEditor.TextureProperty(property, property.displayName);

            GUILayout.Space(6);
            break;

        case MaterialProperty.PropType.Vector: // vectors
            m_MaterialEditor.VectorProperty(property, property.displayName);
            break;

        default:
            GUILayout.Label("ARGH" + property.displayName + " : " + property.type);
            break;
        }
    }
예제 #17
0
        public static void DrawProperty(Rect rect, MaterialProperty prop, string label, MaterialEditor editor)
        {
            switch (prop.type)
            {
            case MaterialProperty.PropType.Color:
                prop.colorValue = editor.ColorProperty(rect, prop, prop.displayName);
                break;

            case MaterialProperty.PropType.Float:
                prop.floatValue = editor.FloatProperty(rect, prop, prop.displayName);
                break;

            case MaterialProperty.PropType.Range:
                prop.floatValue = editor.RangeProperty(rect, prop, prop.displayName);
                break;

            case MaterialProperty.PropType.Texture:
                rect.height      *= 4;
                prop.textureValue = editor.TextureProperty(rect, prop, prop.displayName);
                break;

            case MaterialProperty.PropType.Vector:
                prop.vectorValue = editor.VectorProperty(rect, prop, prop.displayName);
                break;

            default:
                break;
            }
        }
예제 #18
0
    // Not in use atm
    void DrawDefaultField(Rect position, MaterialProperty prop, MaterialEditor editor, string label)
    {
        switch (prop.type)
        {
        case MaterialProperty.PropType.Float:
            prop.floatValue = editor.FloatProperty(position, prop, label);
            break;

        case MaterialProperty.PropType.Color:
            prop.colorValue = editor.ColorProperty(position, prop, label);
            break;

        case MaterialProperty.PropType.Range:
            prop.floatValue = EditorGUILayout.Slider(label, prop.floatValue, prop.rangeLimits.x, prop.rangeLimits.y);
            break;

        case MaterialProperty.PropType.Texture:
            prop.textureValue = editor.TextureProperty(position, prop, label);
            break;

        case MaterialProperty.PropType.Vector:
            prop.vectorValue = editor.VectorProperty(position, prop, label);
            break;

        default:
            throw new System.NotImplementedException(prop.type.ToString());
        }
    }
예제 #19
0
        public static void DrawProperty(MaterialEditor editor, MaterialProperty prop)
        {
            switch (prop.type)
            {
            case MaterialProperty.PropType.Color:
                prop.colorValue = editor.ColorProperty(prop, prop.displayName);
                break;

            case MaterialProperty.PropType.Float:
                prop.floatValue = editor.FloatProperty(prop, prop.displayName);
                break;

            case MaterialProperty.PropType.Range:
                prop.floatValue = editor.RangeProperty(prop, prop.displayName);
                break;

            case MaterialProperty.PropType.Texture:
                prop.textureValue = editor.TextureProperty(prop, prop.displayName);
                break;

            case MaterialProperty.PropType.Vector:
                prop.vectorValue = editor.VectorProperty(prop, prop.displayName);
                break;

            default:
                break;
            }
        }
    void DisplayFloatProperty(MaterialEditor me, CSProperty prop, bool randomizable = true)
    {
        bool randomizationEnabled = propertiesWithRandomization.Contains(prop.prop.name);

        if (randomizationEnabled && randomizingCurrentPass)
        {
            // TODO: make ranges more configurable
            prop.prop.floatValue = (float)(rng.NextDouble() * 100);
        }
        me.FloatProperty(prop.prop, prop.prop.displayName);
        if (randomizable && showRandomizerOptions)
        {
            bool newState = EditorGUILayout.ToggleLeft(Styles.shouldRandomizeCheckboxText, randomizationEnabled);
            if (newState != randomizationEnabled)
            {
                if (newState)
                {
                    propertiesWithRandomization.Add(prop.prop.name);
                }
                else
                {
                    propertiesWithRandomization.Remove(prop.prop.name);
                }
            }
        }
    }
예제 #21
0
    private void ColorGUI(MaterialEditor materialEditor, Material[] materials)
    {
        materialEditor.TextureProperty(this.splat0, "Layer 0");
        materialEditor.TextureProperty(this.splat1, "Layer 1");
        materialEditor.TextureProperty(this.control, "Control");

        if (this.CheckOption(materials, "Enable Specular", "ENABLE_SEPCULAR"))
        {
            EditorGUI.indentLevel = 1;

            materialEditor.FloatProperty(this.specularPower, "Specular Power");
            materialEditor.FloatProperty(this.specularIntensity, "Specular Intensity");
            materialEditor.ColorProperty(this.specularColor, "Specular Color");

            EditorGUI.indentLevel = 0;
        }
    }
 private void DrawTexture()
 {
     for (int i = 0; i < _textures.Length; i++)
     {
         _currEditor.TexturePropertySingleLine(new GUIContent("Tex_" + i), _textures[i]);
         _currEditor.FloatProperty(_rotate[i], "Rotate");
         _currEditor.VectorProperty(_offsets[i], "offset(x,y)/scale(z,w)");
         _currEditor.VectorProperty(_pivots[i], "pivot(x,y)");
     }
 }
예제 #23
0
    private void DoDrawDistanceArea(Material material)
    {
        materialEditor.FloatProperty(drawDistance, Styles.DrawDistanceText);

        using (new GUILayout.HorizontalScope())
        {
            GUILayout.Space(30);
            GUILayout.Label(Styles.DrawDistanceTipText);
        }
    }
    private void DrawOutlines()
    {
        outlinesExpanded = Section("Outlines", outlinesExpanded);
        if (!outlinesExpanded)
        {
            return;
        }

        editor.FloatProperty(outlineWidth, "Outline Width");
        editor.TexturePropertySingleLine(new GUIContent("Outline Texture", "The main texture (RGBA) and color tint used for the outlines. Alpha determines outline width."), outlineTex, outlineColor);
        editor.ShaderProperty(outlineAlphaAffectsWidth, new GUIContent("Alpha affects width", "Whether the outline texture's alpha should affect the outline width in that area."));
        editor.ShaderProperty(outlineScreenspace, new GUIContent("Screenspace outlines", "Whether the outlines should be screenspace (always equally large, no matter the distance)"));

        if (outlineScreenspace.floatValue == 1)
        {
            // Draw multi-slider for min/max distance
            float minDist = outlineScreenspaceMinDistance.floatValue;
            float maxDist = outlineScreenspaceMaxDistance.floatValue;
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.MinMaxSlider("Size Limits (Min / Max)", ref minDist, ref maxDist, 0f, 10f);
            if (EditorGUI.EndChangeCheck())
            {
                outlineScreenspaceMinDistance.floatValue = minDist;
                outlineScreenspaceMaxDistance.floatValue = maxDist;
            }

            editor.FloatProperty(outlineScreenspaceMinDistance, "Min Size");
            editor.FloatProperty(outlineScreenspaceMaxDistance, "Max Size");
        }

        editor.ShaderProperty(outlineStencilComp, new GUIContent("Outline Mode", "Outer Only will only render the outlines on the outer edges of the model."));
        editor.ShaderProperty(outlineCutout, new GUIContent("Cutout Outlines", "Whether the outlines should be subject to cutout."));

        //Display a warning if the user attempts to use outlines to create double-sidedness.
        if (
            outlineWidth.floatValue == 0 &&
            outlineTex.textureValue != null && mainTex.textureValue != null &&
            outlineTex.textureValue.GetInstanceID() == mainTex.textureValue.GetInstanceID())
        {
            EditorGUILayout.HelpBox("Outlines should not be used to make your model double-sided. Use the \"Sidedness\" property under Main instead.", MessageType.Warning);
        }
    }
예제 #25
0
    void DoCurve()
    {
        GUILayout.Label("Curve", EditorStyles.boldLabel);

        MaterialProperty offset = FindProperty("_QOffset");

        editor.VectorProperty(offset, "World offset");

        MaterialProperty dist = FindProperty("_Dist");

        editor.FloatProperty(dist, "Effect distance");
    }
예제 #26
0
    public override void OnGUI(MaterialEditor editor, MaterialProperty[] props)
    {
        EditorGUI.BeginChangeCheck();

        // Base maps
        EditorGUILayout.LabelField("Base Maps", EditorStyles.boldLabel);

        editor.TexturePropertySingleLine(
            Labels.normalMap, FindProperty("_NormalMap", props)
            );

        editor.TexturePropertySingleLine(
            Labels.occlusionMap, FindProperty("_OcclusionMap", props)
            );

        editor.TexturePropertySingleLine(
            Labels.curvatureMap, FindProperty("_CurvatureMap", props)
            );

        EditorGUILayout.Space();

        // Channel 1
        EditorGUILayout.LabelField("Channel 1", EditorStyles.boldLabel);
        editor.ColorProperty(FindProperty("_Color1", props), "Color");
        editor.RangeProperty(FindProperty("_Metallic1", props), "Metallic");
        editor.RangeProperty(FindProperty("_Smoothness1", props), "Smoothness");

        EditorGUILayout.Space();

        // Channel 2
        EditorGUILayout.LabelField("Channel 2", EditorStyles.boldLabel);
        editor.ColorProperty(FindProperty("_Color2", props), "Color");
        editor.RangeProperty(FindProperty("_Metallic2", props), "Metallic");
        editor.RangeProperty(FindProperty("_Smoothness2", props), "Smoothness");

        EditorGUILayout.Space();

        // Detail maps
        EditorGUILayout.LabelField("Detail Maps", EditorStyles.boldLabel);

        editor.TexturePropertySingleLine(
            Labels.albedoMap, FindProperty("_DetailAlbedoMap", props)
            );

        editor.TexturePropertySingleLine(
            Labels.normalMap,
            FindProperty("_DetailNormalMap", props),
            FindProperty("_DetailNormalMapScale", props)
            );

        editor.FloatProperty(FindProperty("_DetailMapScale", props), "Scale");
    }
예제 #27
0
		public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
		{
			EditorGUI.BeginChangeCheck();
			editor.FloatProperty(prop, label.text);
			int queue = (int) prop.floatValue;
			if (EditorGUI.EndChangeCheck())
			{
				queue = Mathf.Clamp(queue, 1000, 5000);
				prop.floatValue = queue;
				foreach (Material m in editor.targets)
				{
					m.renderQueue = queue;
				}
			}
		}
예제 #28
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
        {
            _target     = materialEditor.target as Material;
            _editor     = materialEditor;
            _properties = properties;

            DrawTextureSingleLine("_MaskTex", "_MaskMultiplier");
            EditorGUILayout.Space();

            DrawTextureSingleLine("_MainTex", "_Color");
            EditorGUI.indentLevel += 2;
            DecalBlendMode blendMode = (DecalBlendMode)_target.GetFloat("_DecalBlendMode");

            blendMode = (DecalBlendMode)EditorGUILayout.EnumPopup(new GUIContent("Blend Mode"), blendMode);
            ApplyBlendMode(blendMode);
            EditorGUI.indentLevel -= 2;

            if (_target.HasProperty("_NormalTex"))
            {
                EditorGUILayout.Space();
                DrawTextureSingleLine("_NormalTex", "_NormalMultiplier");
            }
            if (_target.HasProperty("_NormalBlendMode"))
            {
                EditorGUI.indentLevel += 2;
                NormalBlendMode normalBlendMode = (NormalBlendMode)_target.GetFloat("_NormalBlendMode");
                normalBlendMode = (NormalBlendMode)EditorGUILayout.EnumPopup(new GUIContent("Blend Mode"), normalBlendMode);
                _target.SetFloat("_NormalBlendMode", (float)normalBlendMode);
                bool maskNormals = (_target.GetInt("_MaskNormals") != 0);
                maskNormals = EditorGUILayout.Toggle(new GUIContent("Mask Normals?"), maskNormals);
                _target.SetFloat("_MaskNormals", (maskNormals ? 1.0f : 0.0f));
                EditorGUI.indentLevel -= 2;
                EditorGUILayout.Space();
            }

            DrawTextureSingleLine("_SpecularTex", "_SpecularMultiplier");
            DrawTextureSingleLine("_SmoothnessTex", "_SmoothnessMultiplier");
            EditorGUILayout.Space();

            DrawTextureSingleLine("_EmissionMap", "_EmissionColor");
            EditorGUILayout.Space();

            _editor.TextureScaleOffsetProperty(FindProperty("_MainTex", _properties));

            EditorGUILayout.Space();

            _editor.FloatProperty(FindProperty("_AngleLimit", _properties), "Angle Limit");
        }
    public void ShaderPropertiesGUI(Material material)
    {
        EditorGUIUtility.labelWidth = 0f;

        EditorGUI.BeginChangeCheck();
        {
            ModePopup();
            ZwritePopup();
            CullPopup();
            m_MaterialEditor.ColorProperty(_TintColor, _TintColor.displayName);
            m_MaterialEditor.TextureProperty(_MainTex, _MainTex.displayName);
            m_MaterialEditor.FloatProperty(_InvFade, _InvFade.displayName);
        }
        if (EditorGUI.EndChangeCheck())
        {
            MaterialChanged(material);
        }
    }
예제 #30
0
        public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
        {
            EditorGUI.BeginChangeCheck();
            editor.FloatProperty(prop, label.text);
            int queue = (int)prop.floatValue;

            // var rect = EditorGUILayout.GetControlRect();
            // EditorGUI.showMixedValue = prop.hasMixedValue;
            // int queue = EditorGUI.IntField(rect, label, (int)prop.floatValue);
            if (EditorGUI.EndChangeCheck())
            {
                queue           = Mathf.Clamp(queue, 1000, 5000);
                prop.floatValue = queue;
                foreach (Material m in editor.targets)
                {
                    m.renderQueue = queue;
                }
            }
            // EditorGUI.showMixedValue = false;
        }