Пример #1
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.LabelField("Grass Limit", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(grassPainter.i.ToString() + "/", EditorStyles.label);
            grassPainter.grassLimit = EditorGUILayout.IntField(grassPainter.grassLimit);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Paint Status (Right-Mouse Button to paint)", EditorStyles.boldLabel);
            grassPainter.toolbarInt = GUILayout.Toolbar(grassPainter.toolbarInt, toolbarStrings);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Brush Settings", EditorStyles.boldLabel);
            var lsdfga = LayerMask.GetMask(GetLayers());
            //LayerMask tempMask = EditorGUILayout.MaskField("Hit Mask", lsdfga, GetLayers());
            LayerMask tempMask = EditorGUILayout.MaskField("Hit Mask", InternalEditorUtility.LayerMaskToConcatenatedLayersMask(grassPainter.hitMask), GetLayers());

            //grassPainter.hitMask = LayerMask.;
            grassPainter.hitMask = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(tempMask);
            LayerMask tempMask2 = EditorGUILayout.MaskField("Painting Mask", InternalEditorUtility.LayerMaskToConcatenatedLayersMask(grassPainter.paintMask), InternalEditorUtility.layers);

            //grassPainter.paintMask = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(tempMask2);

            grassPainter.brushSize   = EditorGUILayout.Slider("Brush Size", grassPainter.brushSize, 0.1f, 10f);
            grassPainter.density     = EditorGUILayout.Slider("Density", grassPainter.density, 0.1f, 10f);
            grassPainter.normalLimit = EditorGUILayout.Slider("Normal Limit", grassPainter.normalLimit, 0f, 1f);


            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Width and Length ", EditorStyles.boldLabel);
            grassPainter.sizeWidth  = EditorGUILayout.Slider("Grass Width", grassPainter.sizeWidth, 0f, 2f);
            grassPainter.sizeLength = EditorGUILayout.Slider("Grass Length", grassPainter.sizeLength, 0f, 2f);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Color", EditorStyles.boldLabel);
            grassPainter.AdjustedColor = EditorGUILayout.ColorField("Brush Color", grassPainter.AdjustedColor);
            EditorGUILayout.LabelField("Random Color Variation", EditorStyles.boldLabel);
            grassPainter.rangeR = EditorGUILayout.Slider("Red", grassPainter.rangeR, 0f, 1f);
            grassPainter.rangeG = EditorGUILayout.Slider("Green", grassPainter.rangeG, 0f, 1f);
            grassPainter.rangeB = EditorGUILayout.Slider("Blue", grassPainter.rangeB, 0f, 1f);

            if (GUILayout.Button("Clear Mesh"))
            {
                if (EditorUtility.DisplayDialog("Clear Painted Mesh?",
                                                "Are you sure you want to clear the mesh?", "Clear", "Don't Clear"))
                {
                    grassPainter.ClearMesh();
                }
            }
        }