コード例 #1
0
 public Warning(WarningTypes type, string title, string message, int level)
 {
     Type         = type;
     Title        = title;
     Message      = message;
     Level        = level;
     CreationDate = DateTime.Now;
 }
コード例 #2
0
 // Callback used to display & fade warnings in the material inspector.
 void EditorUpdate()
 {
     if (EditorApplication.timeSinceStartup > m_warningTimeStamp)
     {
         EditorApplication.update -= EditorUpdate;
         m_warning = WarningTypes.None;
         this.Repaint();
     }
 }
コード例 #3
0
    protected override void OnHeaderGUI()
    {
        EditorGUI.BeginChangeCheck();
        base.OnHeaderGUI();
        if (EditorGUI.EndChangeCheck())
        {
            m_foldout.editorPanel = InternalEditorUtility.GetIsInspectorExpanded(base.target);
        }
        GUI.skin.GetStyle("HelpBox").richText = true;
        WarningTypes warning = m_warning;

        if (warning == WarningTypes.FontAtlasMismatch)
        {
            EditorGUILayout.HelpBox(m_warningMsg, MessageType.Warning);
        }
    }
コード例 #4
0
 // Callback used to display & fade warnings in the material inspector.
 void EditorUpdate()
 {
     if (EditorApplication.timeSinceStartup > m_warningTimeStamp)
     {
         EditorApplication.update -= EditorUpdate;
         m_warning = WarningTypes.None;
         this.Repaint();
     }
 }
コード例 #5
0
    private void DragAndDropGUI()
    {
        Event evt = Event.current;

        Rect dropArea = new Rect(m_inspectorStartRegion.x, m_inspectorStartRegion.y, m_inspectorEndRegion.width, m_inspectorEndRegion.y - m_inspectorStartRegion.y);

        switch (evt.type)
        {
            case EventType.dragUpdated:
            case EventType.DragPerform:
                if (!dropArea.Contains(evt.mousePosition))
                    break;

                DragAndDrop.visualMode = DragAndDropVisualMode.Generic;

                if (evt.type == EventType.DragPerform)
                {
                    DragAndDrop.AcceptDrag();

                    // Do something 
                    Material currentMaterial = target as Material;

                    Material newMaterial = DragAndDrop.objectReferences[0] as Material;

                    // Check to make sure we have a valid material and that the font atlases match.
                    if (!newMaterial || newMaterial == currentMaterial || newMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID() != currentMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID())
                    {
                        if (newMaterial && newMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID() != currentMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID())
                        {
                            m_warning = WarningTypes.FontAtlasMismatch;
                            EditorApplication.update += EditorUpdate;
                            m_warningTimeStamp = EditorApplication.timeSinceStartup + 15;
                            m_warningMsg = "\nThe Font Atlas of the new material <color=yellow>" + newMaterial.name + "</color> does not match the Font Atlas of the currently assigned Font Asset. Select a material which was duplicated from this current Font Asset.\n";
                        }
                        break;
                    }

                    // Check if this material is assigned to an object and active. 
                    GameObject go = Selection.activeGameObject;
                    if (go != null && !go.activeInHierarchy)
                    {
                        
                        if (go.GetComponent<TextMeshPro>() != null)
                        {
                            Undo.RecordObject(go.GetComponent<TextMeshPro>(), "Material Assignment");
                            go.GetComponent<TextMeshPro>().fontSharedMaterial = newMaterial;
                        }

#if UNITY_4_6 || UNITY_5
                        if (go.GetComponent<TextMeshProUGUI>() != null)
                        {
                            Undo.RecordObject(go.GetComponent<TextMeshProUGUI>(), "Material Assignment");
                            go.GetComponent<TextMeshProUGUI>().fontSharedMaterial = newMaterial;
                        }
#endif
                    }

                    TMPro_EventManager.ON_DRAG_AND_DROP_MATERIAL_CHANGED(go, currentMaterial, newMaterial);
                    //SceneView.RepaintAll();
                    EditorUtility.SetDirty(go);
                }

                evt.Use();
                break;
        }
    }
コード例 #6
0
    public override void OnInspectorGUI()
    {
        // Control visibility of material inspector
        if (!m_foldout.editorPanel) return;

        Material targetMaterial = target as Material;

        // If multiple materials have been selected and are not using the same shader, we simply return.
        if (targets.Length > 1)
        {
            for (int i = 0; i < targets.Length; i++)
            {
                Material mat = targets[i] as Material;

                if (targetMaterial.shader != mat.shader)
                {
                    return;
                }
            }
        }

        ReadMaterialProperties();

        if (!targetMaterial.HasProperty(ShaderUtilities.ID_GradientScale))
        {
            m_warning = WarningTypes.ShaderMismatch;
        //  m_warningTimeStamp = EditorApplication.timeSinceStartup + 15;
            m_warningMsg = "The selected Shader is not compatible with the currently selected Font Asset type.";
            EditorGUILayout.HelpBox(m_warningMsg, MessageType.Warning);
            return;
        }


        // Retrieve Shader Multi_Compile Keywords
        m_Keywords = targetMaterial.shaderKeywords;
        isBevelEnabled = m_Keywords.Contains("BEVEL_ON");
        isGlowEnabled = m_Keywords.Contains("GLOW_ON");
        //isUnderlayEnabled = m_Keywords.Contains("UNDERLAY_ON") | m_Keywords.Contains("UNDERLAY_INNER");
        isRatiosEnabled = !m_Keywords.Contains("RATIOS_OFF");

        if (m_Keywords.Contains("UNDERLAY_ON"))
        {
            isUnderlayEnabled = true;
            m_underlaySelection = Underlay_Types.Normal;
        }
        else if (m_Keywords.Contains("UNDERLAY_INNER"))
        {
            isUnderlayEnabled = true;
            m_underlaySelection = Underlay_Types.Inner;
        }
        else
            isUnderlayEnabled = false;


        if (m_Keywords.Contains("MASK_HARD")) m_mask = MaskingTypes.MaskHard;
        else if (m_Keywords.Contains("MASK_SOFT")) m_mask = MaskingTypes.MaskSoft;
        else m_mask = MaskingTypes.MaskOff;

        //m_mask = (MaskingTypes)m_maskID.floatValue;


        if (m_shaderFlags.hasMixedValue)
            m_bevelSelection = 2;
        else
            m_bevelSelection = (int)m_shaderFlags.floatValue & 1;


        // Define the Drag-n-Drop Region (Start)
        m_inspectorStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));


        EditorGUIUtility.LookLikeControls(130, 50);

        // FACE PANEL
        EditorGUI.indentLevel = 0;
        if (GUILayout.Button("<b>Face</b> - <i>Settings</i> -", TMP_UIStyleManager.Group_Label))
            m_foldout.face = !m_foldout.face;

        if (m_foldout.face)
        {
            EditorGUI.BeginChangeCheck();

            EditorGUI.indentLevel = 1;
            ColorProperty(m_faceColor, "Color");

            if (targetMaterial.HasProperty("_FaceTex"))
            {
                DrawTextureProperty(m_faceTex, "Texture");
                DrawUVProperty(new MaterialProperty[] { m_faceUVSpeedX, m_faceUVSpeedY }, "UV Speed");
            }

            DrawRangeProperty(m_outlineSoftness, "Softness");

            DrawRangeProperty(m_faceDilate, "Dilate");
            if (targetMaterial.HasProperty("_FaceShininess")) DrawRangeProperty(m_faceShininess, "Gloss");

            if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
        }


        // OUTLINE PANEL
        EditorGUI.indentLevel = 0;
        if (GUILayout.Button("<b>Outline</b> - <i>Settings</i> -", TMP_UIStyleManager.Group_Label))
            m_foldout.outline = !m_foldout.outline;

        if (m_foldout.outline)
        {
            EditorGUI.BeginChangeCheck();

            EditorGUI.indentLevel = 1;
            ColorProperty(m_outlineColor, "Color");

            if (targetMaterial.HasProperty("_OutlineTex"))
            { 
                DrawTextureProperty(m_outlineTex, "Texture");
                DrawUVProperty(new MaterialProperty[] { m_outlineUVSpeedX, m_outlineUVSpeedY }, "UV Speed");
            }
            DrawRangeProperty(m_outlineThickness, "Thickness");

            if (targetMaterial.HasProperty("_OutlineShininess")) DrawRangeProperty(m_outlineShininess, "Gloss");

            if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
        }


        // UNDERLAY PANEL
        if (targetMaterial.HasProperty("_UnderlayColor"))
        {
            string underlayKeyword = m_underlaySelection == Underlay_Types.Normal ? "UNDERLAY_ON" : "UNDERLAY_INNER";
            isUnderlayEnabled = DrawTogglePanel(FoldoutType.underlay, "<b>Underlay</b> - <i>Settings</i> -", isUnderlayEnabled, underlayKeyword);


            if (m_foldout.underlay)
            {
                EditorGUI.BeginChangeCheck();

                EditorGUI.indentLevel = 1;

                m_underlaySelection = (Underlay_Types)EditorGUILayout.EnumPopup("Underlay Type", m_underlaySelection);
                if (GUI.changed) SetUnderlayKeywords();

                ColorProperty(m_underlayColor, "Color");
                DrawRangeProperty(m_underlayOffsetX, "OffsetX");
                DrawRangeProperty(m_underlayOffsetY, "OffsetY");
                DrawRangeProperty(m_underlayDilate, "Dilate");
                DrawRangeProperty(m_underlaySoftness, "Softness");

                if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
            }
        }

        // BEVEL PANEL
        if (targetMaterial.HasProperty("_Bevel"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.bevel, "<b>Bevel</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");

            if (m_foldout.bevel)
            {
                EditorGUI.indentLevel = 1;
                GUI.changed = false;
                m_bevelSelection = EditorGUILayout.Popup("Type", m_bevelSelection, m_bevelOptions) & 1;
                if (GUI.changed)
                {
                    havePropertiesChanged = true;
                    m_shaderFlags.floatValue = m_bevelSelection;
                }

                EditorGUI.BeginChangeCheck();

                DrawRangeProperty(m_bevel, "Amount");
                DrawRangeProperty(m_bevelOffset, "Offset");
                DrawRangeProperty(m_bevelWidth, "Width");
                DrawRangeProperty(m_bevelRoundness, "Roundness");
                DrawRangeProperty(m_bevelClamp, "Clamp");

                if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
            }
        }


        // LIGHTING PANEL
        if (targetMaterial.HasProperty("_SpecularColor") || targetMaterial.HasProperty("_SpecColor"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.light, "<b>Lighting</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");

            if (m_foldout.light)
            {
                EditorGUI.BeginChangeCheck();

                EditorGUI.indentLevel = 1;
                if (targetMaterial.HasProperty("_LightAngle"))
                { // Non Surface Shader
                    DrawRangeProperty(m_lightAngle, "Light Angle");
                    ColorProperty(m_specularColor, "Specular Color");
                    DrawRangeProperty(m_specularPower, "Specular Power");
                    DrawRangeProperty(m_reflectivity, "Reflectivity Power");
                    DrawRangeProperty(m_diffuse, "Diffuse Shadow");
                    DrawRangeProperty(m_ambientLight, "Ambient Shadow");
                }
                else
                    ColorProperty(m_specColor, "Specular Color");

                if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
            }
        }


        // BUMPMAP PANEL
        if (targetMaterial.HasProperty("_BumpMap"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.bump, "<b>BumpMap</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");

            if (m_foldout.bump)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUI.indentLevel = 1;
                DrawTextureProperty(m_bumpMap, "Texture");
                DrawRangeProperty(m_bumpFace, "Face");
                DrawRangeProperty(m_bumpOutline, "Outline");

                if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
            }
        }


        // ENVMAP PANEL
        if (targetMaterial.HasProperty("_Cube"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.env, "<b>EnvMap</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");

            if (m_foldout.env)
            {
                EditorGUI.BeginChangeCheck();

                EditorGUI.indentLevel = 1;
                ColorProperty(m_reflectFaceColor, "Face Color");
                ColorProperty(m_reflectOutlineColor, "Outline Color");
                DrawTextureProperty(m_reflectTex, "Texture");
                if (targetMaterial.HasProperty("_Cube"))
                {
                    DrawVectorProperty(m_reflectRotation, "EnvMap Rotation");
                    //var matrix = targetMaterial.GetMatrix("_EnvMatrix");
                  
                }

                if (EditorGUI.EndChangeCheck())
                {                   
                    //var m = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(m_matrixRotation), new Vector3(1f, 1f, 1f));
                    //targetMaterial.SetMatrix("_EnvMatrix", m);
                    havePropertiesChanged = true;
                }
            }

           
        }


        // GLOW PANEL
        if (targetMaterial.HasProperty("_GlowColor"))
        {
            isGlowEnabled = DrawTogglePanel(FoldoutType.glow, "<b>Glow</b> - <i>Settings</i> -", isGlowEnabled, "GLOW_ON");

            if (m_foldout.glow)
            {
                EditorGUI.BeginChangeCheck();

                EditorGUI.indentLevel = 1;
                ColorProperty(m_glowColor, "Color");
                DrawRangeProperty(m_glowOffset, "Offset");
                DrawRangeProperty(m_glowInner, "Inner");
                DrawRangeProperty(m_glowOuter, "Outer");
                DrawRangeProperty(m_glowPower, "Power");

                if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
            }
        }


        // DEBUG PANEL
        if (targetMaterial.HasProperty("_GradientScale"))
        {
            EditorGUI.indentLevel = 0;
            if (GUILayout.Button("<b>Debug</b> - <i>Settings</i> -", TMP_UIStyleManager.Group_Label))
                m_foldout.debug = !m_foldout.debug;

            if (m_foldout.debug)
            {
                EditorGUI.indentLevel = 1;

                EditorGUI.BeginChangeCheck();

                DrawTextureProperty(m_mainTex, "Font Atlas");
                DrawFloatProperty(m_gradientScale, "Gradient Scale");
                DrawFloatProperty(m_texSampleWidth, "Texture Width");
                DrawFloatProperty(m_texSampleHeight, "Texture Height");
                GUILayout.Space(20);

                DrawFloatProperty(m_scaleX, "Scale X");
                DrawFloatProperty(m_scaleY, "Scale Y");
                DrawRangeProperty(m_PerspectiveFilter, "Perspective Filter");

                GUILayout.Space(20);

                DrawFloatProperty(m_vertexOffsetX, "Offset X");
                DrawFloatProperty(m_vertexOffsetY, "Offset Y");

                if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;

                // Mask
                if (targetMaterial.HasProperty("_ClipRect"))
                {
                    GUILayout.Space(15);

                    // HANDLE 2D Rect Mask
                    //if (m_useClipRect.floatValue != 0)
                    //{
                    //    EditorGUI.BeginChangeCheck();

                    //    DrawFloatProperty(m_maskSoftnessX, "Softness X");
                    //    DrawFloatProperty(m_maskSoftnessY, "Softness Y");

                    //    if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
                    //}
                    //else
                    //{
                        m_mask = (MaskingTypes)EditorGUILayout.EnumPopup("Mask", m_mask);
                        if (GUI.changed)
                        {
                            havePropertiesChanged = true;
                            //SetMaskID(m_mask);

                            // TODO Add check for _UseClipRect
                            SetMaskKeywords(m_mask);
                        }

                        if (m_mask != MaskingTypes.MaskOff)
                        {
                            EditorGUI.BeginChangeCheck();

                            Draw2DBoundsProperty(m_clipRect, "Mask Bounds");
                            DrawFloatProperty(m_maskSoftnessX, "Softness X");
                            DrawFloatProperty(m_maskSoftnessY, "Softness Y");

                            //DrawTextureProperty(m_maskTex, "Mask Texture");
                            if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
                        }
                    //}
                    
                    GUILayout.Space(15);
                }

                GUILayout.Space(20);

                // Stencil
                if (targetMaterial.HasProperty("_Stencil"))
                {
                    FloatProperty(m_stencilID, "Stencil ID");
                    FloatProperty(m_stencilComp, "Stencil Comp");
                    //FloatProperty(m_stencilOp, "Stencil Op");
                    //FloatProperty(m_stencilReadMask, "Read Mask");
                    //FloatProperty(m_stencilWriteMask, "Write Mask");
                }
                
                GUILayout.Space(20);

                
                // Ratios
                GUI.changed = false;
                isRatiosEnabled = EditorGUILayout.Toggle("Enable Ratios?", isRatiosEnabled);
                if (GUI.changed)
                {
                    SetKeyword(!isRatiosEnabled, "RATIOS_OFF");
                }

                EditorGUI.BeginChangeCheck();

                DrawFloatProperty(m_scaleRatio_A, "Scale Ratio A");
                DrawFloatProperty(m_scaleRatio_B, "Scale Ratio B");
                DrawFloatProperty(m_scaleRatio_C, "Scale Ratio C");

                if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
                
            }
        }

        // Define the Drag-n-Drop Region (End)
        m_inspectorEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));


        // Handle Material Drag-n-Drop
        DragAndDropGUI();


        if (havePropertiesChanged)
        {
            //Debug.Log("Material Editor properties have changed. Target is " + target.name); 
            havePropertiesChanged = false;

            PropertiesChanged();
            EditorUtility.SetDirty(target);
            //TMPro_EditorUtility.RepaintAll(); // Look into using SetDirty.
            TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, target as Material);
            
        }
    }
コード例 #7
0
    private void DragAndDropGUI()
    {
        Event evt = Event.current;

        Rect dropArea = new Rect(m_inspectorStartRegion.x, m_inspectorStartRegion.y, m_inspectorEndRegion.width, m_inspectorEndRegion.y - m_inspectorStartRegion.y);

        switch (evt.type)
        {
        case EventType.dragUpdated:
        case EventType.DragPerform:
            if (!dropArea.Contains(evt.mousePosition))
            {
                break;
            }

            DragAndDrop.visualMode = DragAndDropVisualMode.Generic;

            if (evt.type == EventType.DragPerform)
            {
                DragAndDrop.AcceptDrag();

                // Do something
                Material currentMaterial = target as Material;

                Material newMaterial = DragAndDrop.objectReferences[0] as Material;

                // Check to make sure we have a valid material and that the font atlases match.
                if (!newMaterial || newMaterial == currentMaterial || newMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID() != currentMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID())
                {
                    if (newMaterial && newMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID() != currentMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID())
                    {
                        m_warning = WarningTypes.FontAtlasMismatch;
                        EditorApplication.update += EditorUpdate;
                        m_warningTimeStamp        = EditorApplication.timeSinceStartup + 15;
                        m_warningMsg              = "\nThe Font Atlas of the new material <color=yellow>" + newMaterial.name + "</color> does not match the Font Atlas of the currently assigned Font Asset. Select a material which was duplicated from this current Font Asset.\n";
                    }
                    break;
                }

                // Check if this material is assigned to an object and active.
                GameObject go = Selection.activeGameObject;
                if (go != null && !go.activeInHierarchy)
                {
                    if (go.GetComponent <TextMeshPro>() != null)
                    {
                        Undo.RecordObject(go.GetComponent <TextMeshPro>(), "Material Assignment");
                        go.GetComponent <TextMeshPro>().fontSharedMaterial = newMaterial;
                    }

#if UNITY_4_6 || UNITY_5
                    if (go.GetComponent <TextMeshProUGUI>() != null)
                    {
                        Undo.RecordObject(go.GetComponent <TextMeshProUGUI>(), "Material Assignment");
                        go.GetComponent <TextMeshProUGUI>().fontSharedMaterial = newMaterial;
                    }
#endif
                }

                TMPro_EventManager.ON_DRAG_AND_DROP_MATERIAL_CHANGED(go, currentMaterial, newMaterial);
                //SceneView.RepaintAll();
                EditorUtility.SetDirty(go);
            }

            evt.Use();
            break;
        }
    }
コード例 #8
0
    public override void OnInspectorGUI()
    {
        // Control visibility of material inspector
        if (!m_foldout.editorPanel)
        {
            return;
        }

        Material targetMaterial = target as Material;

        // If multiple materials have been selected and are not using the same shader, we simply return.
        if (targets.Length > 1)
        {
            for (int i = 0; i < targets.Length; i++)
            {
                Material mat = targets[i] as Material;

                if (targetMaterial.shader != mat.shader)
                {
                    return;
                }
            }
        }

        ReadMaterialProperties();

        if (!targetMaterial.HasProperty(ShaderUtilities.ID_GradientScale))
        {
            m_warning = WarningTypes.ShaderMismatch;
            //  m_warningTimeStamp = EditorApplication.timeSinceStartup + 15;
            m_warningMsg = "The selected Shader is not compatible with the currently selected Font Asset type.";
            EditorGUILayout.HelpBox(m_warningMsg, MessageType.Warning);
            return;
        }


        // Retrieve Shader Multi_Compile Keywords
        m_Keywords     = targetMaterial.shaderKeywords;
        isBevelEnabled = m_Keywords.Contains("BEVEL_ON");
        isGlowEnabled  = m_Keywords.Contains("GLOW_ON");
        //isUnderlayEnabled = m_Keywords.Contains("UNDERLAY_ON") | m_Keywords.Contains("UNDERLAY_INNER");
        isRatiosEnabled = !m_Keywords.Contains("RATIOS_OFF");

        if (m_Keywords.Contains("UNDERLAY_ON"))
        {
            isUnderlayEnabled   = true;
            m_underlaySelection = Underlay_Types.Normal;
        }
        else if (m_Keywords.Contains("UNDERLAY_INNER"))
        {
            isUnderlayEnabled   = true;
            m_underlaySelection = Underlay_Types.Inner;
        }
        else
        {
            isUnderlayEnabled = false;
        }


        if (m_Keywords.Contains("MASK_HARD"))
        {
            m_mask = MaskingTypes.MaskHard;
        }
        else if (m_Keywords.Contains("MASK_SOFT"))
        {
            m_mask = MaskingTypes.MaskSoft;
        }
        else
        {
            m_mask = MaskingTypes.MaskOff;
        }

        //m_mask = (MaskingTypes)m_maskID.floatValue;


        if (m_shaderFlags.hasMixedValue)
        {
            m_bevelSelection = 2;
        }
        else
        {
            m_bevelSelection = (int)m_shaderFlags.floatValue & 1;
        }


        // Define the Drag-n-Drop Region (Start)
        m_inspectorStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));


        EditorGUIUtility.LookLikeControls(130, 50);

        // FACE PANEL
        EditorGUI.indentLevel = 0;
        if (GUILayout.Button("<b>Face</b> - <i>Settings</i> -", TMP_UIStyleManager.Group_Label))
        {
            m_foldout.face = !m_foldout.face;
        }

        if (m_foldout.face)
        {
            EditorGUI.BeginChangeCheck();

            EditorGUI.indentLevel = 1;
            ColorProperty(m_faceColor, "Color");

            if (targetMaterial.HasProperty("_FaceTex"))
            {
                DrawTextureProperty(m_faceTex, "Texture");
                DrawUVProperty(new MaterialProperty[] { m_faceUVSpeedX, m_faceUVSpeedY }, "UV Speed");
            }

            DrawRangeProperty(m_outlineSoftness, "Softness");

            DrawRangeProperty(m_faceDilate, "Dilate");
            if (targetMaterial.HasProperty("_FaceShininess"))
            {
                DrawRangeProperty(m_faceShininess, "Gloss");
            }

            if (EditorGUI.EndChangeCheck())
            {
                havePropertiesChanged = true;
            }
        }


        // OUTLINE PANEL
        EditorGUI.indentLevel = 0;
        if (GUILayout.Button("<b>Outline</b> - <i>Settings</i> -", TMP_UIStyleManager.Group_Label))
        {
            m_foldout.outline = !m_foldout.outline;
        }

        if (m_foldout.outline)
        {
            EditorGUI.BeginChangeCheck();

            EditorGUI.indentLevel = 1;
            ColorProperty(m_outlineColor, "Color");

            if (targetMaterial.HasProperty("_OutlineTex"))
            {
                DrawTextureProperty(m_outlineTex, "Texture");
                DrawUVProperty(new MaterialProperty[] { m_outlineUVSpeedX, m_outlineUVSpeedY }, "UV Speed");
            }
            DrawRangeProperty(m_outlineThickness, "Thickness");

            if (targetMaterial.HasProperty("_OutlineShininess"))
            {
                DrawRangeProperty(m_outlineShininess, "Gloss");
            }

            if (EditorGUI.EndChangeCheck())
            {
                havePropertiesChanged = true;
            }
        }


        // UNDERLAY PANEL
        if (targetMaterial.HasProperty("_UnderlayColor"))
        {
            string underlayKeyword = m_underlaySelection == Underlay_Types.Normal ? "UNDERLAY_ON" : "UNDERLAY_INNER";
            isUnderlayEnabled = DrawTogglePanel(FoldoutType.underlay, "<b>Underlay</b> - <i>Settings</i> -", isUnderlayEnabled, underlayKeyword);


            if (m_foldout.underlay)
            {
                EditorGUI.BeginChangeCheck();

                EditorGUI.indentLevel = 1;

                m_underlaySelection = (Underlay_Types)EditorGUILayout.EnumPopup("Underlay Type", m_underlaySelection);
                if (GUI.changed)
                {
                    SetUnderlayKeywords();
                }

                ColorProperty(m_underlayColor, "Color");
                DrawRangeProperty(m_underlayOffsetX, "OffsetX");
                DrawRangeProperty(m_underlayOffsetY, "OffsetY");
                DrawRangeProperty(m_underlayDilate, "Dilate");
                DrawRangeProperty(m_underlaySoftness, "Softness");

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }

        // BEVEL PANEL
        if (targetMaterial.HasProperty("_Bevel"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.bevel, "<b>Bevel</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");

            if (m_foldout.bevel)
            {
                EditorGUI.indentLevel = 1;
                GUI.changed           = false;
                m_bevelSelection      = EditorGUILayout.Popup("Type", m_bevelSelection, m_bevelOptions) & 1;
                if (GUI.changed)
                {
                    havePropertiesChanged    = true;
                    m_shaderFlags.floatValue = m_bevelSelection;
                }

                EditorGUI.BeginChangeCheck();

                DrawRangeProperty(m_bevel, "Amount");
                DrawRangeProperty(m_bevelOffset, "Offset");
                DrawRangeProperty(m_bevelWidth, "Width");
                DrawRangeProperty(m_bevelRoundness, "Roundness");
                DrawRangeProperty(m_bevelClamp, "Clamp");

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }


        // LIGHTING PANEL
        if (targetMaterial.HasProperty("_SpecularColor") || targetMaterial.HasProperty("_SpecColor"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.light, "<b>Lighting</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");

            if (m_foldout.light)
            {
                EditorGUI.BeginChangeCheck();

                EditorGUI.indentLevel = 1;
                if (targetMaterial.HasProperty("_LightAngle"))
                { // Non Surface Shader
                    DrawRangeProperty(m_lightAngle, "Light Angle");
                    ColorProperty(m_specularColor, "Specular Color");
                    DrawRangeProperty(m_specularPower, "Specular Power");
                    DrawRangeProperty(m_reflectivity, "Reflectivity Power");
                    DrawRangeProperty(m_diffuse, "Diffuse Shadow");
                    DrawRangeProperty(m_ambientLight, "Ambient Shadow");
                }
                else
                {
                    ColorProperty(m_specColor, "Specular Color");
                }

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }


        // BUMPMAP PANEL
        if (targetMaterial.HasProperty("_BumpMap"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.bump, "<b>BumpMap</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");

            if (m_foldout.bump)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUI.indentLevel = 1;
                DrawTextureProperty(m_bumpMap, "Texture");
                DrawRangeProperty(m_bumpFace, "Face");
                DrawRangeProperty(m_bumpOutline, "Outline");

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }


        // ENVMAP PANEL
        if (targetMaterial.HasProperty("_Cube"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.env, "<b>EnvMap</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");

            if (m_foldout.env)
            {
                EditorGUI.BeginChangeCheck();

                EditorGUI.indentLevel = 1;
                ColorProperty(m_reflectFaceColor, "Face Color");
                ColorProperty(m_reflectOutlineColor, "Outline Color");
                DrawTextureProperty(m_reflectTex, "Texture");
                if (targetMaterial.HasProperty("_Cube"))
                {
                    DrawVectorProperty(m_reflectRotation, "EnvMap Rotation");
                    //var matrix = targetMaterial.GetMatrix("_EnvMatrix");
                }

                if (EditorGUI.EndChangeCheck())
                {
                    //var m = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(m_matrixRotation), new Vector3(1f, 1f, 1f));
                    //targetMaterial.SetMatrix("_EnvMatrix", m);
                    havePropertiesChanged = true;
                }
            }
        }


        // GLOW PANEL
        if (targetMaterial.HasProperty("_GlowColor"))
        {
            isGlowEnabled = DrawTogglePanel(FoldoutType.glow, "<b>Glow</b> - <i>Settings</i> -", isGlowEnabled, "GLOW_ON");

            if (m_foldout.glow)
            {
                EditorGUI.BeginChangeCheck();

                EditorGUI.indentLevel = 1;
                ColorProperty(m_glowColor, "Color");
                DrawRangeProperty(m_glowOffset, "Offset");
                DrawRangeProperty(m_glowInner, "Inner");
                DrawRangeProperty(m_glowOuter, "Outer");
                DrawRangeProperty(m_glowPower, "Power");

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }


        // DEBUG PANEL
        if (targetMaterial.HasProperty("_GradientScale"))
        {
            EditorGUI.indentLevel = 0;
            if (GUILayout.Button("<b>Debug</b> - <i>Settings</i> -", TMP_UIStyleManager.Group_Label))
            {
                m_foldout.debug = !m_foldout.debug;
            }

            if (m_foldout.debug)
            {
                EditorGUI.indentLevel = 1;

                EditorGUI.BeginChangeCheck();

                DrawTextureProperty(m_mainTex, "Font Atlas");
                DrawFloatProperty(m_gradientScale, "Gradient Scale");
                DrawFloatProperty(m_texSampleWidth, "Texture Width");
                DrawFloatProperty(m_texSampleHeight, "Texture Height");
                GUILayout.Space(20);

                DrawFloatProperty(m_scaleX, "Scale X");
                DrawFloatProperty(m_scaleY, "Scale Y");
                DrawRangeProperty(m_PerspectiveFilter, "Perspective Filter");

                GUILayout.Space(20);

                DrawFloatProperty(m_vertexOffsetX, "Offset X");
                DrawFloatProperty(m_vertexOffsetY, "Offset Y");

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }

                // Mask
                if (targetMaterial.HasProperty("_ClipRect"))
                {
                    GUILayout.Space(15);

                    // HANDLE 2D Rect Mask
                    //if (m_useClipRect.floatValue != 0)
                    //{
                    //    EditorGUI.BeginChangeCheck();

                    //    DrawFloatProperty(m_maskSoftnessX, "Softness X");
                    //    DrawFloatProperty(m_maskSoftnessY, "Softness Y");

                    //    if (EditorGUI.EndChangeCheck()) havePropertiesChanged = true;
                    //}
                    //else
                    //{
                    m_mask = (MaskingTypes)EditorGUILayout.EnumPopup("Mask", m_mask);
                    if (GUI.changed)
                    {
                        havePropertiesChanged = true;
                        //SetMaskID(m_mask);

                        // TODO Add check for _UseClipRect
                        SetMaskKeywords(m_mask);
                    }

                    if (m_mask != MaskingTypes.MaskOff)
                    {
                        EditorGUI.BeginChangeCheck();

                        Draw2DBoundsProperty(m_clipRect, "Mask Bounds");
                        DrawFloatProperty(m_maskSoftnessX, "Softness X");
                        DrawFloatProperty(m_maskSoftnessY, "Softness Y");

                        //DrawTextureProperty(m_maskTex, "Mask Texture");
                        if (EditorGUI.EndChangeCheck())
                        {
                            havePropertiesChanged = true;
                        }
                    }
                    //}

                    GUILayout.Space(15);
                }

                GUILayout.Space(20);

                // Stencil
                if (targetMaterial.HasProperty("_Stencil"))
                {
                    FloatProperty(m_stencilID, "Stencil ID");
                    FloatProperty(m_stencilComp, "Stencil Comp");
                    //FloatProperty(m_stencilOp, "Stencil Op");
                    //FloatProperty(m_stencilReadMask, "Read Mask");
                    //FloatProperty(m_stencilWriteMask, "Write Mask");
                }

                GUILayout.Space(20);


                // Ratios
                GUI.changed     = false;
                isRatiosEnabled = EditorGUILayout.Toggle("Enable Ratios?", isRatiosEnabled);
                if (GUI.changed)
                {
                    SetKeyword(!isRatiosEnabled, "RATIOS_OFF");
                }

                EditorGUI.BeginChangeCheck();

                DrawFloatProperty(m_scaleRatio_A, "Scale Ratio A");
                DrawFloatProperty(m_scaleRatio_B, "Scale Ratio B");
                DrawFloatProperty(m_scaleRatio_C, "Scale Ratio C");

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }

        // Define the Drag-n-Drop Region (End)
        m_inspectorEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));


        // Handle Material Drag-n-Drop
        DragAndDropGUI();


        if (havePropertiesChanged)
        {
            //Debug.Log("Material Editor properties have changed. Target is " + target.name);
            havePropertiesChanged = false;

            PropertiesChanged();
            EditorUtility.SetDirty(target);
            //TMPro_EditorUtility.RepaintAll(); // Look into using SetDirty.
            TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, target as Material);
        }
    }
コード例 #9
0
    public override void OnInspectorGUI()
    {
        if (!m_foldout.editorPanel)
        {
            return;
        }
        Material material = base.target as Material;

        if (base.targets.Length > 1)
        {
            for (int i = 0; i < base.targets.Length; i++)
            {
                Material material2 = base.targets[i] as Material;
                if (material.shader != material2.shader)
                {
                    return;
                }
            }
        }
        ReadMaterialProperties();
        if (!material.HasProperty(ShaderUtilities.ID_GradientScale))
        {
            m_warning    = WarningTypes.ShaderMismatch;
            m_warningMsg = "The selected Shader is not compatible with the currently selected Font Asset type.";
            EditorGUILayout.HelpBox(m_warningMsg, MessageType.Warning);
            return;
        }
        m_Keywords       = material.shaderKeywords;
        isOutlineEnabled = m_Keywords.Contains("OUTLINE_ON");
        isBevelEnabled   = m_Keywords.Contains("BEVEL_ON");
        isGlowEnabled    = m_Keywords.Contains("GLOW_ON");
        isRatiosEnabled  = !m_Keywords.Contains("RATIOS_OFF");
        if (m_Keywords.Contains("UNDERLAY_ON"))
        {
            isUnderlayEnabled   = true;
            m_underlaySelection = Underlay_Types.Normal;
        }
        else if (m_Keywords.Contains("UNDERLAY_INNER"))
        {
            isUnderlayEnabled   = true;
            m_underlaySelection = Underlay_Types.Inner;
        }
        else
        {
            isUnderlayEnabled = false;
        }
        if (m_Keywords.Contains("MASK_HARD"))
        {
            m_mask = MaskingTypes.MaskHard;
        }
        else if (m_Keywords.Contains("MASK_SOFT"))
        {
            m_mask = MaskingTypes.MaskSoft;
        }
        else
        {
            m_mask = MaskingTypes.MaskOff;
        }
        if (m_shaderFlags.hasMixedValue)
        {
            m_bevelSelection = 2;
        }
        else
        {
            m_bevelSelection = ((int)m_shaderFlags.floatValue & 1);
        }
        m_inspectorStartRegion      = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
        EditorGUIUtility.labelWidth = 130f;
        EditorGUIUtility.fieldWidth = 50f;
        EditorGUI.indentLevel       = 0;
        if (GUILayout.Button("<b>Face</b> - <i>Settings</i> -", TMP_UIStyleManager.Group_Label))
        {
            m_foldout.face = !m_foldout.face;
        }
        if (m_foldout.face)
        {
            EditorGUI.BeginChangeCheck();
            EditorGUI.indentLevel = 1;
            ColorProperty(m_faceColor, "Color");
            if (material.HasProperty("_FaceTex"))
            {
                DrawTextureProperty(m_faceTex, "Texture");
                DrawUVProperty(new MaterialProperty[2]
                {
                    m_faceUVSpeedX,
                    m_faceUVSpeedY
                }, "UV Speed");
            }
            DrawRangeProperty(m_outlineSoftness, "Softness");
            DrawRangeProperty(m_faceDilate, "Dilate");
            if (material.HasProperty("_FaceShininess"))
            {
                DrawRangeProperty(m_faceShininess, "Gloss");
            }
            if (EditorGUI.EndChangeCheck())
            {
                havePropertiesChanged = true;
            }
        }
        if (material.HasProperty("_OutlineColor"))
        {
            if (material.HasProperty("_Bevel"))
            {
                if (GUILayout.Button("<b>Outline</b> - <i>Settings</i> -", TMP_UIStyleManager.Group_Label))
                {
                    m_foldout.outline = !m_foldout.outline;
                }
            }
            else
            {
                isOutlineEnabled = DrawTogglePanel(FoldoutType.outline, "<b>Outline</b> - <i>Settings</i> -", isOutlineEnabled, "OUTLINE_ON");
            }
            EditorGUI.indentLevel = 0;
            if (m_foldout.outline)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUI.indentLevel = 1;
                ColorProperty(m_outlineColor, "Color");
                if (material.HasProperty("_OutlineTex"))
                {
                    DrawTextureProperty(m_outlineTex, "Texture");
                    DrawUVProperty(new MaterialProperty[2]
                    {
                        m_outlineUVSpeedX,
                        m_outlineUVSpeedY
                    }, "UV Speed");
                }
                DrawRangeProperty(m_outlineThickness, "Thickness");
                if (material.HasProperty("_OutlineShininess"))
                {
                    DrawRangeProperty(m_outlineShininess, "Gloss");
                }
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }
        if (material.HasProperty("_UnderlayColor"))
        {
            string keyword = (m_underlaySelection == Underlay_Types.Normal) ? "UNDERLAY_ON" : "UNDERLAY_INNER";
            isUnderlayEnabled = DrawTogglePanel(FoldoutType.underlay, "<b>Underlay</b> - <i>Settings</i> -", isUnderlayEnabled, keyword);
            if (m_foldout.underlay)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUI.indentLevel = 1;
                m_underlaySelection   = (Underlay_Types)(object)EditorGUILayout.EnumPopup("Underlay Type", m_underlaySelection);
                if (GUI.changed)
                {
                    SetUnderlayKeywords();
                }
                ColorProperty(m_underlayColor, "Color");
                DrawRangeProperty(m_underlayOffsetX, "OffsetX");
                DrawRangeProperty(m_underlayOffsetY, "OffsetY");
                DrawRangeProperty(m_underlayDilate, "Dilate");
                DrawRangeProperty(m_underlaySoftness, "Softness");
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }
        if (material.HasProperty("_Bevel"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.bevel, "<b>Bevel</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");
            if (m_foldout.bevel)
            {
                EditorGUI.indentLevel = 1;
                GUI.changed           = false;
                m_bevelSelection      = (EditorGUILayout.Popup("Type", m_bevelSelection, m_bevelOptions) & 1);
                if (GUI.changed)
                {
                    havePropertiesChanged    = true;
                    m_shaderFlags.floatValue = m_bevelSelection;
                }
                EditorGUI.BeginChangeCheck();
                DrawRangeProperty(m_bevel, "Amount");
                DrawRangeProperty(m_bevelOffset, "Offset");
                DrawRangeProperty(m_bevelWidth, "Width");
                DrawRangeProperty(m_bevelRoundness, "Roundness");
                DrawRangeProperty(m_bevelClamp, "Clamp");
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }
        if (material.HasProperty("_SpecularColor") || material.HasProperty("_SpecColor"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.light, "<b>Lighting</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");
            if (m_foldout.light)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUI.indentLevel = 1;
                if (material.HasProperty("_LightAngle"))
                {
                    DrawRangeProperty(m_lightAngle, "Light Angle");
                    ColorProperty(m_specularColor, "Specular Color");
                    DrawRangeProperty(m_specularPower, "Specular Power");
                    DrawRangeProperty(m_reflectivity, "Reflectivity Power");
                    DrawRangeProperty(m_diffuse, "Diffuse Shadow");
                    DrawRangeProperty(m_ambientLight, "Ambient Shadow");
                }
                else
                {
                    ColorProperty(m_specColor, "Specular Color");
                }
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }
        if (material.HasProperty("_BumpMap"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.bump, "<b>BumpMap</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");
            if (m_foldout.bump)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUI.indentLevel = 1;
                DrawTextureProperty(m_bumpMap, "Texture");
                DrawRangeProperty(m_bumpFace, "Face");
                DrawRangeProperty(m_bumpOutline, "Outline");
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }
        if (material.HasProperty("_Cube"))
        {
            isBevelEnabled = DrawTogglePanel(FoldoutType.env, "<b>EnvMap</b> - <i>Settings</i> -", isBevelEnabled, "BEVEL_ON");
            if (m_foldout.env)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUI.indentLevel = 1;
                ColorProperty(m_reflectFaceColor, "Face Color");
                ColorProperty(m_reflectOutlineColor, "Outline Color");
                DrawTextureProperty(m_reflectTex, "Texture");
                if (material.HasProperty("_Cube"))
                {
                    DrawVectorProperty(m_reflectRotation, "EnvMap Rotation");
                }
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }
        if (material.HasProperty("_GlowColor"))
        {
            isGlowEnabled = DrawTogglePanel(FoldoutType.glow, "<b>Glow</b> - <i>Settings</i> -", isGlowEnabled, "GLOW_ON");
            if (m_foldout.glow)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUI.indentLevel = 1;
                ColorProperty(m_glowColor, "Color");
                DrawRangeProperty(m_glowOffset, "Offset");
                DrawRangeProperty(m_glowInner, "Inner");
                DrawRangeProperty(m_glowOuter, "Outer");
                DrawRangeProperty(m_glowPower, "Power");
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }
        if (material.HasProperty("_GradientScale"))
        {
            EditorGUI.indentLevel = 0;
            if (GUILayout.Button("<b>Debug</b> - <i>Settings</i> -", TMP_UIStyleManager.Group_Label))
            {
                m_foldout.debug = !m_foldout.debug;
            }
            if (m_foldout.debug)
            {
                EditorGUI.indentLevel = 1;
                EditorGUI.BeginChangeCheck();
                DrawTextureProperty(m_mainTex, "Font Atlas");
                DrawFloatProperty(m_gradientScale, "Gradient Scale");
                DrawFloatProperty(m_texSampleWidth, "Texture Width");
                DrawFloatProperty(m_texSampleHeight, "Texture Height");
                GUILayout.Space(20f);
                DrawFloatProperty(m_scaleX, "Scale X");
                DrawFloatProperty(m_scaleY, "Scale Y");
                DrawRangeProperty(m_PerspectiveFilter, "Perspective Filter");
                GUILayout.Space(20f);
                DrawFloatProperty(m_vertexOffsetX, "Offset X");
                DrawFloatProperty(m_vertexOffsetY, "Offset Y");
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
                if (material.HasProperty("_ClipRect"))
                {
                    GUILayout.Space(15f);
                    m_mask = (MaskingTypes)(object)EditorGUILayout.EnumPopup("Mask", m_mask);
                    if (GUI.changed)
                    {
                        havePropertiesChanged = true;
                        SetMaskKeywords(m_mask);
                    }
                    if (m_mask != 0)
                    {
                        EditorGUI.BeginChangeCheck();
                        Draw2DBoundsProperty(m_maskCoord, "Mask Bounds");
                        DrawFloatProperty(m_maskSoftnessX, "Softness X");
                        DrawFloatProperty(m_maskSoftnessY, "Softness Y");
                        if (material.HasProperty("_MaskEdgeColor"))
                        {
                            DrawTextureProperty(m_maskTex, "Mask Texture");
                            bool value = (m_maskTexInverse.floatValue != 0f) ? true : false;
                            value = EditorGUILayout.Toggle("Inverse Mask", value);
                            ColorProperty(m_maskTexEdgeColor, "Edge Color");
                            RangeProperty(m_maskTexEdgeSoftness, "Edge Softness");
                            RangeProperty(m_maskTexWipeControl, "Wipe Position");
                            if (EditorGUI.EndChangeCheck())
                            {
                                m_maskTexInverse.floatValue = (value ? 1 : 0);
                                havePropertiesChanged       = true;
                            }
                        }
                    }
                    GUILayout.Space(15f);
                }
                EditorGUI.BeginChangeCheck();
                Draw2DRectBoundsProperty(m_clipRect, "_ClipRect");
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
                GUILayout.Space(20f);
                if (material.HasProperty("_Stencil"))
                {
                    FloatProperty(m_stencilID, "Stencil ID");
                    FloatProperty(m_stencilComp, "Stencil Comp");
                }
                GUILayout.Space(20f);
                GUI.changed     = false;
                isRatiosEnabled = EditorGUILayout.Toggle("Enable Ratios?", isRatiosEnabled);
                if (GUI.changed)
                {
                    SetKeyword(!isRatiosEnabled, "RATIOS_OFF");
                }
                EditorGUI.BeginChangeCheck();
                DrawFloatProperty(m_scaleRatio_A, "Scale Ratio A");
                DrawFloatProperty(m_scaleRatio_B, "Scale Ratio B");
                DrawFloatProperty(m_scaleRatio_C, "Scale Ratio C");
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
            }
        }
        m_inspectorEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
        DragAndDropGUI();
        if (havePropertiesChanged)
        {
            havePropertiesChanged = false;
            PropertiesChanged();
            EditorUtility.SetDirty(base.target);
            TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, base.target as Material);
        }
    }