Exemple #1
0
        public void NextBrush()
        {
            var values = Enum.GetValues(typeof(VoxelBrushType));
            var enumer = values.GetEnumerator();

            enumer.MoveNext();
            VoxelBrushType first = (VoxelBrushType)enumer.Current;

            if (currentBrush != null)
            {
                do
                {
                    if ((VoxelBrushType)enumer.Current == currentBrush.BrushType)
                    {
                        if (enumer.MoveNext())
                        {
                            // kinda hacky but so is the matrix selection tool...
                            if ((VoxelBrushType)enumer.Current == VoxelBrushType.Select || (VoxelBrushType)enumer.Current == VoxelBrushType.MatrixSelect || currentBrush.BrushType == VoxelBrushType.MatrixSelect)
                            {
                                continue;
                            }
                            SetCurrentBrush((VoxelBrushType)enumer.Current);
                            return;
                        }
                    }
                } while (enumer.MoveNext());
            }

            SetCurrentBrush(first);
        }
Exemple #2
0
        public UndoData(VoxelBrushType type, QbMatrix matrix, VoxelVolume volume, Colort color, Dictionary <double, VoxelUndoData> data)
        {
            this.brush  = type;
            this.matrix = matrix;
            this.volume = volume;
            this.color  = color;
            this.data   = new Dictionary <double, VoxelUndoData>();

            foreach (var c in data)
            {
                this.data.Add(c.Key, c.Value);
            }
        }
Exemple #3
0
        public void SetCurrentBrush(VoxelBrushType type)
        {
            if (previousBrush != null)
            {
                currentBrush.Disable();

                //super super hacks
                if (currentBrush.BrushType != VoxelBrushType.Select || currentBrush.BrushType != VoxelBrushType.MatrixSelect || currentBrush.BrushType != VoxelBrushType.ColorSelect)
                {
                    previousBrush = currentBrush;
                }
            }
            else
            {
                if (currentBrush?.BrushType != VoxelBrushType.Select || currentBrush?.BrushType != VoxelBrushType.MatrixSelect || currentBrush?.BrushType != VoxelBrushType.MatrixSelect)
                {
                    previousBrush = currentBrush;
                }
            }
            currentBrush = brushes[type];
            currentBrush.Enable();

            // ensure onselectionchanged is called when changing brushes
            // even if the raycaster isn't over a new voxel
            if (Singleton <Raycaster> .INSTANCE != null)
            {
                Singleton <Raycaster> .INSTANCE.lastHit = new RaycastHit()
                {
                    distance = 10000
                }
            }
            ;

            if (Singleton <GUI> .INSTANCE?.OverWidget == false)
            {
                window.Cursor = currentBrush.Cursor;
            }
        }
Exemple #4
0
 public void AddUndo(VoxelBrushType type, QbMatrix matrix, VoxelVolume volume, Colort color, Dictionary <double, VoxelUndoData> data)
 {
     redos.Clear();
     undos.Push(new UndoData(type, matrix, volume, color, data));
 }