Beispiel #1
0
 private void OnDestroy()
 {
     if (instance == this)
     {
         instance = null; //set instance to null
     }
 }
Beispiel #2
0
        //initialize the popup window
        public static void Init(List <BrushObject> brushes, EditorWindow parent)
        {
            //check if a window is already open
            if (instance != null)
            {
                return;
            }


            //create window
            instance = ScriptableObject.CreateInstance <AddObjectPopup>();

            //cache the brushes from the main editor window for later use
            instance.brushes = brushes;
            //cache the reference to the parent for later repaint
            instance.parent = parent;

            //calculate window position (center of the parent window)
            float x = parent.position.x + (parent.position.width - 350) * 0.5f;
            float y = parent.position.y + (parent.position.height - 75) * 0.5f;

            instance.position = new Rect(x, y, 350, 75);

            //show window as "utility"
            instance.ShowUtility();
            instance.name = windowName;
        }
Beispiel #3
0
        //initialize the popup window
        public static void Init(List <BrushObject> brushes, EditorWindow parent)
        {
            //create window
            AddObjectPopup window = ScriptableObject.CreateInstance <AddObjectPopup>();

            //cache the brushes from the main editor window for later use
            window.brushes = brushes;
            //cache the reference to the parent for later repaint
            window.parent = parent;

            //calculate window position (center of the parent window)
            float x = parent.position.x + (parent.position.width - 350) * 0.5f;
            float y = parent.position.y + (parent.position.height - 75) * 0.5f;

            window.position = new Rect(x, y, 350, 75);

            window.ShowPopup();
        }
        void OnGUI()
        {
            if (!Application.isPlaying)
            {
                SerializedObject serializedObject_brushObject = null;
                int prevSelectedBrushCollectionIndex          = selectedBrushCollectionIndex;
                if (brushes != null)
                {
                    serializedObject_brushObject = new SerializedObject(brushes);
                }
                EditorGUIUtility.wideMode = true;


                #region Header

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Brush Collection:", EditorStyles.boldLabel);
                BrushCollection.BrushCollectionList brushCollectionList = BrushCollection.GetBrushCollectionsInProject();
                selectedBrushCollectionIndex = EditorGUILayout.Popup(selectedBrushCollectionIndex, brushCollectionList.GetNameList());
                if (prevSelectedBrushCollectionIndex != selectedBrushCollectionIndex)                                                       //select only when brush collection changed
                {
                    brushes = brushCollectionList.brushCollections[selectedBrushCollectionIndex];
                    brushes.SetLastUsedBrushCollection();
                }
                if (GUILayout.Button("+"))
                {
                    StringPopupWindow.Init(this, BrushCollection.CreateInstance, BrushCollection.newBrushCollectionName, "Create new BrushCollection", "Asset Name");
                }
                EditorGUILayout.EndHorizontal();


                //The active BrushList asset
                //brushes = EditorGUILayout.ObjectField(brushes, typeof(Object), true) as BrushCollection;


                #endregion

                #region Scroll view
                //scroll view
                scrollViewScrollPosition = EditorGUILayout.BeginScrollView(scrollViewScrollPosition, false, false);
                int rowLength    = 1;
                int maxRowLength = Mathf.FloorToInt((this.position.width - 35) / 100);
                if (maxRowLength < 1)
                {
                    maxRowLength = 1;
                }

                foreach (BrushObject brObj in brushes.brushes)
                {
                    //check if brushObject is null, if so skip this brush
                    if (brObj == null || brObj.brushObject == null)
                    {
                        continue;
                    }

                    //check if row is longer than max row length
                    if (rowLength > maxRowLength)
                    {
                        rowLength = 1;
                        EditorGUILayout.EndHorizontal();
                    }
                    //begin row if rowLength == 1
                    if (rowLength == 1)
                    {
                        EditorGUILayout.BeginHorizontal();
                    }

                    //change color
                    Color guiColor = GUI.backgroundColor;
                    if (brushes.selectedBrushes.Contains(brObj))
                    {
                        GUI.backgroundColor = SelectedColor;
                        if (brushes.primarySelectedBrush == brObj)
                        {
                            GUI.backgroundColor = PrimarySelectedColor;
                        }
                    }

                    //Create the brush entry in the scroll view and check if the user clicked on the created button (change the currently selected/edited brush accordingly and add it to the current brushes if possible)
                    GUIContent btnContent = new GUIContent(AssetPreview.GetAssetPreview(brObj.brushObject), brObj.brushObject.name);
                    if (GUILayout.Button(btnContent, GUILayout.Width(100), GUILayout.Height(100)))
                    {
                        //Add and remove brushes from the current brushes list
                        if (Event.current.control && !brushes.selectedBrushes.Contains(brObj))
                        {
                            brushes.selectedBrushes.Add(brObj);
                        }
                        else if (brushes.selectedBrushes.Contains(brObj))
                        {
                            brushes.selectedBrushes.Remove(brObj);
                        }

                        //select the currently edited brush and deselect all selected brushes
                        if (!Event.current.control)
                        {
                            brushes.selectedBrushes.Clear();
                            brushes.primarySelectedBrush = brObj;
                            brushes.selectedBrushes.Add(brObj);
                        }
                    }

                    GUI.backgroundColor = guiColor;
                    rowLength++;
                }

                //check if row is longer than max row length
                if (rowLength > maxRowLength)
                {
                    rowLength = 1;
                    EditorGUILayout.EndHorizontal();
                }
                //begin row if rowLength == 1
                if (rowLength == 1)
                {
                    EditorGUILayout.BeginHorizontal();
                }

                //add button
                if (GUILayout.Button("+", GUILayout.Width(100), GUILayout.Height(100)))
                {
                    AddObjectPopup.Init(brushes.brushes, this);
                }
                Color guiColorBGC = GUI.backgroundColor;

                //end horizontal and scroll view again
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndScrollView();

                #endregion

                #region Actions Group


                EditorGUILayout.BeginHorizontal();

                GUI.backgroundColor = green;
                if (GUILayout.Button(new GUIContent("Add Brush", "Add a new brush to the selection.")))
                {
                    AddObjectPopup.Init(brushes.brushes, this);
                }

                EditorGUI.BeginDisabledGroup(brushes.selectedBrushes.Count == 0 || brushes.primarySelectedBrush == null);
                GUI.backgroundColor = red;
                //remove selected brushes button
                if (GUILayout.Button(new GUIContent("Remove Current Brush(es)", "Removes the currently selected brush.")))
                {
                    if (brushes.selectedBrushes != null)
                    {
                        foreach (BrushObject brush in brushes.selectedBrushes)
                        {
                            brushes.brushes.Remove(brush);
                        }
                        brushes.selectedBrushes = new List <BrushObject>();
                    }
                }
                EditorGUI.EndDisabledGroup();
                //remove all brushes button
                EditorGUI.BeginDisabledGroup(brushes.brushes.Count == 0);
                if (GUILayout.Button(new GUIContent("Clear Brushes", "Removes all brushes.")) && RemoveAllBrushes_Dialog(brushes.brushes.Count))
                {
                    brushes.RemoveAllBrushes();
                    copy = null;
                }
                EditorGUI.EndDisabledGroup();

                EditorGUILayout.EndHorizontal();
                GUI.backgroundColor = guiColorBGC;

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Actions", EditorStyles.boldLabel);
                EditorGUILayout.BeginHorizontal();
                isPlacingEnabled = EditorGUILayout.Toggle(new GUIContent("Painting ebanled", "Should painting of gameobjects via left click be enabled?"), isPlacingEnabled);
                isErasingEnabled = EditorGUILayout.Toggle(new GUIContent("Erasing ebanled", "Should erasing of gameobjects via right click be enabled?"), isErasingEnabled);
                EditorGUILayout.EndHorizontal();
                guiColorBGC = GUI.backgroundColor;

                if (brushes.selectedBrushes.Count > 0)
                {
                    EditorGUI.BeginDisabledGroup(brushes.spawnedObjects.Count == 0);

                    GUI.backgroundColor = green;
                    if (GUILayout.Button(new GUIContent("Permanently Apply Spawned GameObjects (" + brushes.spawnedObjects.Count + ")", "Permanently apply the gameobjects that have been spawned with GO brush, so they can not be erased by accident anymore.")))
                    {
                        brushes.ApplyCachedObjects();
                        lastPlacementPositions.Clear();
                    }


                    GUI.backgroundColor = red;
                    if (GUILayout.Button(new GUIContent("Remove All Spawned GameObjects (" + brushes.spawnedObjects.Count + ")", "Removes all spawned objects from the scene that have not been applied before.")) && RemoveAllCachedObjects_Dialog(brushes.spawnedObjects.Count))
                    {
                        brushes.DeleteSpawnedObjects();
                        lastPlacementPositions.Clear();
                    }
                    EditorGUI.EndDisabledGroup();
                }



                GUI.backgroundColor = guiColorBGC;

                #endregion

                #region Brush Details
                //don't show the details of the current brush if we do not have selected a current brush
                if (brushes.selectedBrushes != null && brushes.primarySelectedBrush != null && brushes.brushes.Count > 0 && brushes.selectedBrushes.Count > 0)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.Space();
                    EditorGUILayout.Space();

                    EditorGUILayout.BeginHorizontal();
                    GUI.backgroundColor = yellow;
                    EditorGUILayout.LabelField("Brush Details" + " - (" + brushes.primarySelectedBrush.brushObject.name + ")", EditorStyles.boldLabel);
                    if (GUILayout.Button(new GUIContent("Copy", "Copies the brush."), GUILayout.MaxWidth(50)))
                    {
                        copy = brushes.primarySelectedBrush;
                    }
                    EditorGUI.BeginDisabledGroup(copy == null);
                    if (GUILayout.Button(new GUIContent("Paste", "Pastes the details of the brush in the clipboard."), GUILayout.MaxWidth(50)))
                    {
                        brushes.primarySelectedBrush.PasteDetails(copy);
                    }
                    GUI.backgroundColor = guiColorBGC;
                    EditorGUI.EndDisabledGroup();
                    if (GUILayout.Button(new GUIContent("Reset", "Restores the defaults settings of the brush details."), GUILayout.MaxWidth(50)))
                    {
                        brushes.primarySelectedBrush.ResetDetails();
                    }
                    EditorGUILayout.EndHorizontal();

                    brushes.primarySelectedBrush.parentContainer    = EditorGUILayout.ObjectField("Parent", brushes.primarySelectedBrush.parentContainer, typeof(Transform), true) as Transform;
                    brushes.primarySelectedBrush.density            = EditorGUILayout.Slider(new GUIContent("Density", "Changes the density of the brush, i.e. how many gameobjects are spawned inside the radius of the brush."), brushes.primarySelectedBrush.density, 0f, 5f);
                    brushes.primarySelectedBrush.brushSize          = EditorGUILayout.Slider(new GUIContent("Brush Size", "The radius of the brush."), brushes.primarySelectedBrush.brushSize, 0f, 25f);
                    brushes.primarySelectedBrush.offsetFromPivot    = EditorGUILayout.Vector3Field(new GUIContent("Offset from Pivot", "Changes the offset of the spawned gameobject from the calculated position. This allows you to correct the position of the spawned objects, if you find they are floating for example due to a not that correct pivot on the gameobject/prefab."), brushes.primarySelectedBrush.offsetFromPivot);
                    brushes.primarySelectedBrush.rotOffsetFromPivot = EditorGUILayout.Vector3Field(new GUIContent("Rotational Offset", "Changes the rotational offset that is applied to the prefab/gameobject when spawning it. This allows you to current the rotation of the spawned objects."), brushes.primarySelectedBrush.rotOffsetFromPivot);


                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(new GUIContent("Min and Max Scale", "The min and max range of the spawned gameobject. If they are not the same value a random value in between the min and max is going to be picked."));
                    EditorGUILayout.MinMaxSlider(ref brushes.primarySelectedBrush.minScale, ref brushes.primarySelectedBrush.maxScale, 0.001f, 50);
                    brushes.primarySelectedBrush.minScale = EditorGUILayout.FloatField(brushes.primarySelectedBrush.minScale);
                    brushes.primarySelectedBrush.maxScale = EditorGUILayout.FloatField(brushes.primarySelectedBrush.maxScale);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    brushes.primarySelectedBrush.randomizeXRotation = EditorGUILayout.Toggle(new GUIContent("Randomize X Rotation", "Should the rotation be randomized on the x axis?"), brushes.primarySelectedBrush.randomizeXRotation);
                    brushes.primarySelectedBrush.randomizeYRotation = EditorGUILayout.Toggle(new GUIContent("Randomize Y Rotation", "Should the rotation be randomized on the y axis?"), brushes.primarySelectedBrush.randomizeYRotation);
                    brushes.primarySelectedBrush.randomizeZRotation = EditorGUILayout.Toggle(new GUIContent("Randomize Z Rotation", "Should the rotation be randomized on the z axis?"), brushes.primarySelectedBrush.randomizeZRotation);
                    EditorGUILayout.EndHorizontal();

                    brushes.primarySelectedBrush.alignToSurface = EditorGUILayout.Toggle(new GUIContent("Align to Surface", "This option allows you to align the instantiated gameobjects to the surface you are painting on."), brushes.primarySelectedBrush.alignToSurface);

                    brushes.primarySelectedBrush.allowIntercollision = EditorGUILayout.Toggle(new GUIContent("Allow Intercollision", "Should the spawned objects be considered for the spawning of new objects? If so, newly spawned objects can be placed on top of previously (not yet applied) objects."), brushes.primarySelectedBrush.allowIntercollision);


                    EditorGUILayout.Space();
                    EditorGUILayout.Space();


                    GUI.backgroundColor = yellow;
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Filters" + " - (" + brushes.primarySelectedBrush.brushObject.name + ")", EditorStyles.boldLabel);
                    if (GUILayout.Button(new GUIContent("Copy", "Copies the brush."), GUILayout.MaxWidth(50)))
                    {
                        copy = brushes.primarySelectedBrush;
                    }
                    EditorGUI.BeginDisabledGroup(copy == null);
                    if (GUILayout.Button(new GUIContent("Paste", "Pastes the filters of the brush in the clipboard."), GUILayout.MaxWidth(50)))
                    {
                        brushes.primarySelectedBrush.PasteFilters(copy);
                    }
                    EditorGUI.EndDisabledGroup();
                    GUI.backgroundColor = guiColorBGC;
                    if (GUILayout.Button(new GUIContent("Reset", "Restores the defaults settings of the brush filters."), GUILayout.MaxWidth(50)))
                    {
                        brushes.primarySelectedBrush.ResetFilters();
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(new GUIContent("Min and Max Slope", "The range of slope that is required for an object to be placed. If the slope is not in that range, no object is going to be placed."));
                    EditorGUILayout.MinMaxSlider(ref brushes.primarySelectedBrush.minSlope, ref brushes.primarySelectedBrush.maxSlope, 0, 360);
                    brushes.primarySelectedBrush.minSlope = EditorGUILayout.FloatField(brushes.primarySelectedBrush.minSlope);
                    brushes.primarySelectedBrush.maxSlope = EditorGUILayout.FloatField(brushes.primarySelectedBrush.maxSlope);
                    EditorGUILayout.EndHorizontal();

                    SerializedProperty sp = serializedObject_brushObject.FindProperty("primarySelectedBrush").FindPropertyRelative("layerFilter");

                    EditorGUILayout.BeginHorizontal();
                    brushes.primarySelectedBrush.isTagFilteringEnabled = EditorGUILayout.Toggle("Enable Tag Filtering", brushes.primarySelectedBrush.isTagFilteringEnabled);
                    if (brushes.primarySelectedBrush.isTagFilteringEnabled)
                    {
                        brushes.primarySelectedBrush.tagFilter = EditorGUILayout.TagField(new GUIContent("Tag Filter", "Limits the painting to objects that have a specific tag on them."), brushes.primarySelectedBrush.tagFilter);
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.Space();
                    EditorGUILayout.Space();

                    serializedObject_brushObject.ApplyModifiedProperties();
                }

                //save AssetDatabase on any change
                if (GUI.changed && brushes != null)
                {
                    brushes.Save();
                }
                #endregion
            }
        }
        public void OnGUI()
        {
            SerializedObject so = new SerializedObject(this);

            EditorGUIUtility.wideMode = true;

            if (currentBrushes != null && currentBrushes.Count > 0)
            {
                EditorGUILayout.LabelField("Your Brushes (Current: " + GetCurrentBrushesString() + ")", EditorStyles.boldLabel);
            }
            else
            {
                EditorGUILayout.LabelField("Your Brushes", EditorStyles.boldLabel);
            }

            //scroll view
            scrollViewScrollPosition = EditorGUILayout.BeginScrollView(scrollViewScrollPosition, false, false);
            EditorGUILayout.BeginHorizontal();
            foreach (BrushObject brObj in brushes)
            {
                Color guiColor = GUI.backgroundColor;
                if (currentBrushes.Contains(brObj))
                {
                    GUI.backgroundColor = lightBlue;
                    if (selectedBrush == brObj)
                    {
                        GUI.backgroundColor = darkBlue;
                    }
                }

                //Create the brush entry in the scroll view and check if the user clicked on the created button (change the currently selected/edited brush accordingly and add it to the current brushes if possible)
                GUIContent btnContent = new GUIContent(AssetPreview.GetAssetPreview(brObj.brushObject), "Select the " + brObj.brushObject.name + " brush");
                if (GUILayout.Button(btnContent, GUILayout.Width(100), GUILayout.Height(100)))
                {
                    //Add and remove brushes from the current brushes list
                    if (Event.current.control && !currentBrushes.Contains(brObj))
                    {
                        currentBrushes.Add(brObj);
                    }
                    else if (currentBrushes.Contains(brObj))
                    {
                        currentBrushes.Remove(brObj);
                    }

                    //select the currently edited brush and deselect all selected brushes
                    if (!Event.current.control)
                    {
                        currentBrushes.Clear();
                        selectedBrush = brObj;
                        currentBrushes.Add(brObj);
                    }
                }
                GUI.backgroundColor = guiColor;
            }

            //add button
            if (GUILayout.Button("+", GUILayout.Width(100), GUILayout.Height(100)))
            {
                AddObjectPopup.Init(brushes, this);
            }


            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndScrollView();

            //gui below the scroll view
            Color guiColorBGC = GUI.backgroundColor;

            EditorGUILayout.BeginHorizontal();

            GUI.backgroundColor = green;
            if (GUILayout.Button(new GUIContent("Add Brush", "Add a new brush to the selection.")))
            {
                AddObjectPopup.Init(brushes, this);
            }
            GUI.backgroundColor = red;
            if (GUILayout.Button(new GUIContent("Remove Current Brush(es)", "Removes the currently selected brush.")))
            {
                if (currentBrushes != null)
                {
                    foreach (BrushObject brush in currentBrushes)
                    {
                        brushes.Remove(brush);
                    }
                    currentBrushes = new List <BrushObject>();
                }
            }
            if (GUILayout.Button(new GUIContent("Clear Brushes", "Removes all brushes.")))
            {
                brushes.Clear();
                currentBrushes = new List <BrushObject>();
            }
            EditorGUILayout.EndHorizontal();
            GUI.backgroundColor = guiColorBGC;

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Actions", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            isPlacingEnabled = EditorGUILayout.Toggle(new GUIContent("Painting ebanled", "Should painting of gameobjects via left click be enabled?"), isPlacingEnabled);
            isErasingEnabled = EditorGUILayout.Toggle(new GUIContent("Erasing ebanled", "Should erasing of gameobjects via right click be enabled?"), isErasingEnabled);
            EditorGUILayout.EndHorizontal();



            guiColorBGC         = GUI.backgroundColor;
            GUI.backgroundColor = green;
            if (GUILayout.Button(new GUIContent("Permanently Apply Spawned GameObjects (" + spawnedObjects.Count + ")", "Permanently apply the gameobjects that have been spawned with GO brush, so they can not be erased by accident anymore.")))
            {
                ApplyMeshedPermanently();
            }

            GUI.backgroundColor = red;
            if (GUILayout.Button(new GUIContent("Remove All Spawned GameObjects (" + spawnedObjects.Count + ")", "Removes all spawned objects from the scene that have not been applied before.")))
            {
                RemoveAllSpawnedObjects();
            }
            GUI.backgroundColor = guiColorBGC;

            //don't show the details of the current brush if we do not have selected a current brush
            if (currentBrushes != null && selectedBrush.brushObject != null)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                EditorGUILayout.Space();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Brush Details", EditorStyles.boldLabel);

                if (GUILayout.Button(new GUIContent("Copy", "Copies the brush."), GUILayout.MaxWidth(50)))
                {
                    copy = selectedBrush;
                }
                if (GUILayout.Button(new GUIContent("Paste", "Pastes the details of the brush in the clipboard."), GUILayout.MaxWidth(50)))
                {
                    selectedBrush.PasteDetails(copy);
                }
                if (GUILayout.Button(new GUIContent("Reset", "Restores the defaults settings of the brush details."), GUILayout.MaxWidth(50)))
                {
                    selectedBrush.ResetDetails();
                }
                EditorGUILayout.EndHorizontal();

                selectedBrush.density            = EditorGUILayout.Slider(new GUIContent("Density", "Changes the density of the brush, i.e. how many gameobjects are spawned inside the radius of the brush."), selectedBrush.density, 0f, 5f);
                selectedBrush.brushSize          = EditorGUILayout.Slider(new GUIContent("Brush Size", "The radius of the brush."), selectedBrush.brushSize, 0f, 25f);
                selectedBrush.offsetFromPivot    = EditorGUILayout.Vector3Field(new GUIContent("Offset from Pivot", "Changes the offset of the spawned gameobject from the calculated position. This allows you to correct the position of the spawned objects, if you find they are floating for example due to a not that correct pivot on the gameobject/prefab."), selectedBrush.offsetFromPivot);
                selectedBrush.rotOffsetFromPivot = EditorGUILayout.Vector3Field(new GUIContent("Rotational Offset", "Changes the rotational offset that is applied to the prefab/gameobject when spawning it. This allows you to current the rotation of the spawned objects."), selectedBrush.rotOffsetFromPivot);


                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Min and Max Scale", "The min and max range of the spawned gameobject. If they are not the same value a random value in between the min and max is going to be picked."));
                EditorGUILayout.MinMaxSlider(ref selectedBrush.minScale, ref selectedBrush.maxScale, 0.001f, 50);
                selectedBrush.minScale = EditorGUILayout.FloatField(selectedBrush.minScale);
                selectedBrush.maxScale = EditorGUILayout.FloatField(selectedBrush.maxScale);
                EditorGUILayout.EndHorizontal();

                selectedBrush.alignToSurface = EditorGUILayout.Toggle(new GUIContent("Align to Surface", "This option allows you to align the instantiated gameobjects to the surface you are painting on."), selectedBrush.alignToSurface);

                EditorGUILayout.BeginHorizontal();
                selectedBrush.randomizeXRotation = EditorGUILayout.Toggle(new GUIContent("Randomize X Rotation", "Should the rotation be randomized on the x axis?"), selectedBrush.randomizeXRotation);
                selectedBrush.randomizeYRotation = EditorGUILayout.Toggle(new GUIContent("Randomize Y Rotation", "Should the rotation be randomized on the y axis?"), selectedBrush.randomizeYRotation);
                selectedBrush.randomizeZRotation = EditorGUILayout.Toggle(new GUIContent("Randomize Z Rotation", "Should the rotation be randomized on the z axis?"), selectedBrush.randomizeZRotation);
                EditorGUILayout.EndHorizontal();

                selectedBrush.allowIntercollision = EditorGUILayout.Toggle(new GUIContent("Allow Intercollision", "Should the spawned objects be considered for the spawning of new objects? If so, newly spawned objects can be placed on top of previously (not yet applied) objects."), selectedBrush.allowIntercollision);


                EditorGUILayout.Space();
                EditorGUILayout.Space();


                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Filters", EditorStyles.boldLabel);
                if (GUILayout.Button(new GUIContent("Copy", "Copies the brush."), GUILayout.MaxWidth(50)))
                {
                    copy = selectedBrush;
                }
                if (GUILayout.Button(new GUIContent("Paste", "Pastes the filters of the brush in the clipboard."), GUILayout.MaxWidth(50)))
                {
                    selectedBrush.PasteFilters(copy);
                }
                if (GUILayout.Button(new GUIContent("Reset", "Restores the defaults settings of the brush filters."), GUILayout.MaxWidth(50)))
                {
                    selectedBrush.ResetFilters();
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Min and Max Slope", "The range of slope that is required for an object to be placed. If the slope is not in that range, no object is going to be placed."));
                EditorGUILayout.MinMaxSlider(ref selectedBrush.minSlope, ref selectedBrush.maxSlope, 0, 360);
                selectedBrush.minSlope = EditorGUILayout.FloatField(selectedBrush.minSlope);
                selectedBrush.maxSlope = EditorGUILayout.FloatField(selectedBrush.maxSlope);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.PropertyField(so.FindProperty("selectedBrush").FindPropertyRelative("layerFilter"), true);

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(so.FindProperty("selectedBrush").FindPropertyRelative("isTagFilteringEnabled"), true);
                if (selectedBrush.isTagFilteringEnabled)
                {
                    selectedBrush.tagFilter = EditorGUILayout.TagField(new GUIContent("Tag Filter", "Limits the painting to objects that have a specific tag on them."), selectedBrush.tagFilter);
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();
                EditorGUILayout.Space();

                so.ApplyModifiedProperties();
            }
        }