Пример #1
0
        private void ShowPaintModeAsGrid()
        {
            GSelectionGridArgs args0 = new GSelectionGridArgs();

            args0.selectedIndex       = (int)painter.Mode;
            args0.collection          = Enum.GetValues(typeof(GTexturePaintingMode));
            args0.itemSize            = GEditorCommon.selectionGridTileSizeWide;
            args0.itemPerRow          = 2;
            args0.drawPreviewFunction = DrawModePreview;
            EditorGUI.BeginChangeCheck();
            painter.Mode = (GTexturePaintingMode)GEditorCommon.SelectionGrid(args0);
            if (EditorGUI.EndChangeCheck())
            {
                RecordPaintModeAnalytics();
            }

            if (painter.Mode == GTexturePaintingMode.Custom)
            {
                GEditorCommon.Separator();
                List <Type> customPainterTypes = GTerrainTexturePainter.GetCustomPainterTypes();
                if (customPainterTypes.Count == 0)
                {
                    EditorGUILayout.LabelField("No Custom Painter defined!", GEditorCommon.WordWrapItalicLabel);
                }
                else
                {
                    GSelectionGridArgs args1 = new GSelectionGridArgs();
                    args1.selectedIndex        = painter.CustomPainterIndex;
                    args1.collection           = customPainterTypes;
                    args1.itemSize             = GEditorCommon.selectionGridTileSizeWide;
                    args1.itemPerRow           = 2;
                    args1.drawPreviewFunction  = DrawCustomMode;
                    painter.CustomPainterIndex = GEditorCommon.SelectionGrid(args1);
                    GEditorCommon.Separator();
                    painter.CustomPainterArgs = EditorGUILayout.TextField("Custom Args", painter.CustomPainterArgs);
                }
            }
        }
Пример #2
0
        private void ShowPaintModeAsDropdown()
        {
            EditorGUI.BeginChangeCheck();
            painter.Mode = (GTexturePaintingMode)EditorGUILayout.EnumPopup("Paint Mode", painter.Mode);
            if (EditorGUI.EndChangeCheck())
            {
                RecordPaintModeAnalytics();
            }
            if (painter.Mode != GTexturePaintingMode.Custom)
            {
                return;
            }
            List <Type> customPainterTypes = GTerrainTexturePainter.GetCustomPainterTypes();

            string[] labels = new string[customPainterTypes.Count];
            for (int i = 0; i < labels.Length; ++i)
            {
                labels[i] = ObjectNames.NicifyVariableName(GEditorCommon.GetClassDisplayName(customPainterTypes[i]));
            }
            int[] indices = GUtilities.GetIndicesArray(customPainterTypes.Count);

            painter.CustomPainterIndex = EditorGUILayout.IntPopup("Custom Painter", painter.CustomPainterIndex, labels, indices);
            painter.CustomPainterArgs  = EditorGUILayout.DelayedTextField("Custom Args", painter.CustomPainterArgs);
        }