public override void DrawItem(Rect position, int index)
        {
            //To-be modified original-- caching original position
            Rect pos   = position;
            var  splat = this[index];

            //Insert top padding & set height
            pos.y     += 8f;
            pos.height = CTRL_HEIGHT * 2.5f;

            if (splat.Diffuse == null)
            {
                EditorGUI.HelpBox(pos, "This splat material does not have a selected diffuse texture.", MessageType.Warning);
                pos.y += CTRL_HEIGHT * 2.5f + PADDING_SM;
            }
            else
            {
                float texWidth = (pos.width / 2) - PADDING;

                Rect texPos   = new Rect(pos.x, pos.y, texWidth, TEX_HEIGHT);
                Rect labelPos = new Rect(texPos.x, texPos.y + TEX_HEIGHT + PADDING_SM, texWidth, TEX_CAPTION_HEIGHT);

                GUIStyle centeredStyle = GUI.skin.GetStyle("Label");
                centeredStyle.alignment = TextAnchor.UpperCenter;

                EditorGUI.ObjectField(texPos, splat.Diffuse, typeof(Texture2D), false);
                EditorGUI.LabelField(labelPos, "Diffuse", centeredStyle);

                if (splat.Normal != null)
                {
                    texPos.x   += texPos.width + 8;
                    labelPos.x += texPos.width + PADDING;

                    splat.Normal = (Texture2D)EditorGUI.ObjectField(texPos, splat.Normal, typeof(Texture2D), false);
                    EditorGUI.LabelField(labelPos, "Normal", centeredStyle);
                }

                //Update position
                pos.y += TEX_HEIGHT + labelPos.height + PADDING;
            }

            //Reset referenced height
            pos.height = CTRL_HEIGHT;

            if (GUI.Button(new Rect(pos.x, pos.y, pos.width, pos.height + 2), "Edit Material"))
            {
                AddTextureWindow.Init(ref splat);
            }
            pos.y += CTRL_HEIGHT + PADDING;

            //Blend factor
            splat.Blend = EditorGUI.FloatField(pos, "Blend Amount", splat.Blend);
            pos.y      += CTRL_HEIGHT + PADDING_SM;

            //Constrain Height
            splat.ConstrainHeight = EditorGUI.Toggle(pos, "Constrain Height", splat.ConstrainHeight);
            pos.y += CTRL_HEIGHT + PADDING_SM;
            if (splat.ConstrainHeight)
            {
                EditorGUI.indentLevel++;
                splat.HeightConstraint = EditorGUIExtension.DrawConstraintRange(pos, "Height", splat.HeightConstraint, 0, 1);

                pos.y += (CTRL_HEIGHT + PADDING_SM) * 2;

                float startX = pos.x;
                pos.x = EditorGUI.IndentedRect(pos).x;
                EditorGUI.indentLevel--;

                //Checkboxes for infinity & -infinity heights
                EditorGUI.BeginChangeCheck();
                if (splat.IsMaxHeight || !_detail.IsMaxHeightSelected)
                {
                    splat.IsMaxHeight = EditorGUI.Toggle(pos, "Is Highest Material", splat.IsMaxHeight);
                    pos.y            += CTRL_HEIGHT + PADDING_SM;
                }
                if (EditorGUI.EndChangeCheck())
                {
                    _detail.IsMaxHeightSelected = splat.IsMaxHeight;
                }

                EditorGUI.BeginChangeCheck();
                if (splat.IsMinHeight || !_detail.IsMinHeightSelected)
                {
                    splat.IsMinHeight = EditorGUI.Toggle(pos, "Is Lowest Material", splat.IsMinHeight);
                    pos.y            += CTRL_HEIGHT + PADDING_SM;
                }
                if (EditorGUI.EndChangeCheck())
                {
                    _detail.IsMinHeightSelected = splat.IsMinHeight;
                }

                pos.x = startX;
            }

            //Constrain Angle
            splat.ConstrainAngle = EditorGUI.Toggle(pos, "Constrain Angle", splat.ConstrainAngle);
            pos.y += CTRL_HEIGHT + PADDING_SM;
            if (splat.ConstrainAngle)
            {
                EditorGUI.indentLevel++;
                splat.AngleConstraint = EditorGUIExtension.DrawConstraintRange(pos, "Angle", splat.AngleConstraint, 0, 90);
                EditorGUI.indentLevel--;
            }
        }
        public override void DrawItem(Rect position, int index)
        {
            //To-be modified original-- caching original position
            Rect pos = position;

            TerrainPaint.SplatSetting splat = Settings.SplatSettings[index];

            //Set the title
            //ReorderableListGUI.Title("Elevation Material " + (index + 1));

            //Insert top padding & set height
            pos.y     += 8f;
            pos.height = CTRL_HEIGHT * 2.5f;

            if (splat.Diffuse == null)
            {
                EditorGUI.HelpBox(pos, "This splat material does not have a selected diffuse texture.", MessageType.Warning);
                pos.y += CTRL_HEIGHT * 2.5f + PADDING_SM;
            }
            else
            {
                float texWidth = (pos.width / 2) - PADDING;

                Rect texPos   = new Rect(pos.x, pos.y, texWidth, TEX_HEIGHT);
                Rect labelPos = new Rect(texPos.x, texPos.y + TEX_HEIGHT + PADDING_SM, texWidth, TEX_CAPTION_HEIGHT);

                GUIStyle centeredStyle = GUI.skin.GetStyle("Label");
                centeredStyle.alignment = TextAnchor.UpperCenter;

                EditorGUI.ObjectField(texPos, splat.Diffuse, typeof(Texture2D), false);
                EditorGUI.LabelField(labelPos, "Diffuse", centeredStyle);

                if (splat.Normal != null)
                {
                    texPos.x   += texPos.width + 8;
                    labelPos.x += texPos.width + PADDING;

                    splat.Normal = (Texture2D)EditorGUI.ObjectField(texPos, splat.Normal, typeof(Texture2D), false);
                    EditorGUI.LabelField(labelPos, "Normal", centeredStyle);
                }

                //Update position
                pos.y += TEX_HEIGHT + labelPos.height + PADDING;
            }

            //Reset referenced height
            pos.height = CTRL_HEIGHT;

            if (GUI.Button(new Rect(pos.x, pos.y, pos.width, pos.height + 2), "Edit Material"))
            {
                AddTextureWindow.Init(ref splat);
            }
            pos.y += CTRL_HEIGHT + PADDING;

            //Blend factor
            splat.Blend = EditorGUI.FloatField(pos, "Blend Amount", splat.Blend);
            pos.y      += CTRL_HEIGHT + PADDING_SM;

            //GUI for different placement types
            splat.PlacementType = (TerrainPaint.PlacementType)EditorGUI.EnumPopup(pos, "Placement Type", splat.PlacementType);
            pos.y += CTRL_HEIGHT + PADDING_SM;

            switch (splat.PlacementType)
            {
            case TerrainPaint.PlacementType.Angle:
                EditorGUI.LabelField(pos, "Min Angle", splat.AngleMin.ToString("0") + " deg");
                pos.y += CTRL_HEIGHT + PADDING_SM;

                EditorGUI.LabelField(pos, "Max Angle", splat.AngleMax.ToString("0") + " deg");
                pos.y += CTRL_HEIGHT + PADDING_SM;

                EditorGUI.MinMaxSlider(pos, ref splat.AngleMin, ref splat.AngleMax, 0f, 90f);
                pos.y += CTRL_HEIGHT + PADDING_SM;

                break;

            case TerrainPaint.PlacementType.ElevationRange:
                if (!splat.IsMaxHeight)
                {
                    splat.MaxRange = EditorGUI.FloatField(pos, "Max Height", splat.MaxRange);
                    pos.y         += CTRL_HEIGHT + PADDING_SM;
                }
                if (!splat.IsMinHeight)
                {
                    splat.MinRange = EditorGUI.FloatField(pos, "Min Height", splat.MinRange);
                    pos.y         += CTRL_HEIGHT + PADDING_SM;
                }

                //Checkboxes for infinity & -infinity heights
                EditorGUI.BeginChangeCheck();
                if (splat.IsMaxHeight || !Settings.IsMaxHeightSelected)
                {
                    splat.IsMaxHeight = EditorGUI.Toggle(pos, "Is Highest Material", splat.IsMaxHeight);
                    pos.y            += CTRL_HEIGHT + PADDING_SM;
                }
                if (EditorGUI.EndChangeCheck())
                {
                    Settings.IsMaxHeightSelected = splat.IsMaxHeight;
                }

                EditorGUI.BeginChangeCheck();
                if (splat.IsMinHeight || !Settings.IsMinHeightSelected)
                {
                    splat.IsMinHeight = EditorGUI.Toggle(pos, "Is Lowest Material", splat.IsMinHeight);
                    pos.y            += CTRL_HEIGHT + PADDING_SM;
                }
                if (EditorGUI.EndChangeCheck())
                {
                    Settings.IsMinHeightSelected = splat.IsMinHeight;
                }

                //if (splat.MinRange > splat.MaxRange) splat.MinRange = splat.MaxRange;
                break;
            }
        }