public void RenameBrush(DecorPaintObjectPlacementBrush brush, string newName)
 {
     if (ContainsBrush(brush))
     {
         _brushes.RenameEntity(brush, newName);
     }
 }
        private static DecorPaintObjectPlacementBrush CreateNewBrushWithUniqueName(string name, List <string> existingBrushNames)
        {
            DecorPaintObjectPlacementBrush newBrush = Octave3DWorldBuilder.ActiveInstance.CreateScriptableObject <DecorPaintObjectPlacementBrush>();

            newBrush.Name = UniqueEntityNameGenerator.GenerateUniqueName(name, existingBrushNames);

            return(newBrush);
        }
        public void SetActiveBrush(DecorPaintObjectPlacementBrush newActiveBrush)
        {
            if (!ContainsBrush(newActiveBrush))
            {
                return;
            }

            _brushes.MarkEntity(newActiveBrush);
        }
        public void RemoveAndDestroyBrush(DecorPaintObjectPlacementBrush brush)
        {
            if (ContainsBrush(brush))
            {
                _brushes.RemoveEntity(brush);
                // ToDo: Send message that brush was removed

                UndoEx.DestroyObjectImmediate(brush);
            }
        }
Exemple #5
0
 private void RenderCreateNewBrushButton()
 {
     if (GUILayout.Button(GetContentForCreateNewBrushButton(), GUILayout.Width(EditorGUILayoutEx.PreferedActionButtonWidth)))
     {
         UndoEx.RecordForToolAction(_database);
         DecorPaintObjectPlacementBrush newBrush = _database.CreateBrush(ViewData.NameForNewBrush);
         if (newBrush != null)
         {
             _database.SetActiveBrush(newBrush);
         }
     }
 }
        private void AdjustBrushShapeSizeForMouseWheelScroll(Event e)
        {
            DecorPaintObjectPlacementBrush activeBrush = DecorPaintObjectPlacementBrushDatabase.Get().ActiveBrush;

            if (activeBrush != null)
            {
                BrushDecorPaintModeObjectPlacementSettings brushDecorPaintSettings = ObjectPlacementSettings.Get().DecorPaintObjectPlacementSettings.BrushDecorPaintModeSettings;
                int sizeAdjustAmount = (int)(-e.delta.y * brushDecorPaintSettings.ScrollWheelCircleRadiusAdjustmentSpeed);

                UndoEx.RecordForToolAction(activeBrush);
                activeBrush.Radius += sizeAdjustAmount;

                Octave3DWorldBuilder.ActiveInstance.Inspector.EditorWindow.Repaint();
                SceneView.RepaintAll();
            }
        }
Exemple #7
0
        public void BeginSession(DecorPaintObjectPlacementBrushCircle workingBrushCircle, DecorPaintObjectPlacementBrush workingBrush)
        {
            if (workingBrushCircle == null || workingBrush == null)
            {
                return;
            }

            _workingBrushCircle = workingBrushCircle;
            _workingBrush       = workingBrush;
            if (!AcquireNecessaryBrushElementData())
            {
                return;
            }

            _isSessionActive = true;
            _brushElementSpawnChanceTable = _workingBrush.CalculateElementSpawnChanceTable(true);
        }
        public DecorPaintObjectPlacementBrush CreateBrush(string brushName)
        {
            if (!string.IsNullOrEmpty(brushName))
            {
                DecorPaintObjectPlacementBrush newBrush = DecorPaintObjectPlacementBrushFactory.Create(brushName, GetAllBrushNames());
                _brushes.AddEntity(newBrush);

                if (NumberOfBrushes == 1)
                {
                    SetActiveBrush(newBrush);
                }

                return(newBrush);
            }

            return(null);
        }
 public bool ContainsBrush(DecorPaintObjectPlacementBrush brush)
 {
     return(_brushes.ContainsEntity(brush));
 }
 public int GetBrushIndex(DecorPaintObjectPlacementBrush brush)
 {
     return(_brushes.GetEntityIndex(brush));
 }
Exemple #11
0
 public DecorPaintObjectPlacementBrushView(DecorPaintObjectPlacementBrush brush)
 {
     _brush = brush;
 }