Ejemplo n.º 1
0
        public static void UndoRedoPerformed()
        {
            BrushOutlineManager.ClearOutlines();

            CheckForChanges(forceHierarchyUpdate: true);

            if (!IgnoreMaterials)
            {
                foreach (var brush in Brushes)
                {
                    try
                    {
                        //brush.EnsureInitialized();
                        if (brush.Shape != null)
                        {
                            ShapeUtility.CheckMaterials(brush.Shape);
                        }
                    }
                    finally { }
                }
                foreach (var brush in Brushes)
                {
                    try
                    {
                        InternalCSGModelManager.CheckSurfaceModifications(brush, true);
                        //InternalCSGModelManager.ValidateBrush(brush);
                    }
                    finally { }
                }
            }
        }
        void UpdateBrushMeshes(HashSet <CSGBrush> brushes, HashSet <CSGModel> models)
        {
            foreach (var brush in brushes)
            {
                brush.EnsureInitialized();
                ShapeUtility.CheckMaterials(brush.Shape);
//				var brush_cache = InternalCSGModelManager.GetBrushCache(brush);
            }
            foreach (var brush in brushes)
            {
                InternalCSGModelManager.CheckSurfaceModifications(brush, true);
                InternalCSGModelManager.ValidateBrush(brush);
            }
            MeshInstanceManager.UpdateHelperSurfaceVisibility(force: true);
        }
 void UpdateBrushMeshes(HashSet <CSGBrush> brushes, HashSet <CSGModel> models)
 {
     foreach (var brush in brushes)
     {
         brush.EnsureInitialized();
         ShapeUtility.CheckMaterials(brush.Shape);
         var brush_cache = InternalCSGModelManager.GetBrushCache(brush);
         InternalCSGModelManager.RegisterMaterials(brush_cache.childData.Model, brush.Shape, false);
     }
     foreach (var model in models)
     {
         InternalCSGModelManager.UpdateMaterialCount(model);
     }
     foreach (var brush in brushes)
     {
         InternalCSGModelManager.CheckSurfaceModifications(brush, true);
         InternalCSGModelManager.ValidateBrush(brush);
     }
     MeshInstanceManager.UpdateHelperSurfaceVisibility();
 }
Ejemplo n.º 4
0
        public void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (_brushes == null)
                    {
                        return;
                    }

                    if (_brushes.Length > 0)
                    {
                        for (int i = 0; i < _brushes.Length; i++)
                        {
                            if (!_brushes[i])
                            {
                                continue;
                            }
                            _brushes[i].EnsureInitialized();
                            ShapeUtility.CheckMaterials(_brushes[i].Shape);
                        }
                        for (int i = 0; i < _brushes.Length; i++)
                        {
                            if (!_brushes[i])
                            {
                                continue;
                            }
                            InternalCSGModelManager.CheckSurfaceModifications(_brushes[i], true);
                        }
                        if (_undoGroupIndex != -1)
                        {
                            Undo.CollapseUndoOperations(_undoGroupIndex);
                            Undo.FlushUndoRecordObjects();
                        }
                    }
                }
                _brushes      = null;
                disposedValue = true;
            }
        }
Ejemplo n.º 5
0
        public void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (_brushes == null)
                    {
                        return;
                    }

                    if (_brushes.Length > 0)
                    {
                        for (int i = 0; i < _brushes.Length; i++)
                        {
                            if (!_brushes[i])
                            {
                                continue;
                            }
                            _brushes[i].EnsureInitialized();
                            ShapeUtility.CheckMaterials(_brushes[i].Shape);
                            if (_reregisterMaterials)
                            {
                                CSGBrushCache brushCache = InternalCSGModelManager.GetBrushCache(_brushes[i]);
                                if (brushCache != null)
                                {
                                    InternalCSGModelManager.RegisterMaterials(brushCache.childData.Model, _brushes[i].Shape, false);
                                }
                            }
                        }
                        if (_reregisterMaterials)
                        {
                            for (int i = 0; i < _models.Length; i++)
                            {
                                if (!_models[i])
                                {
                                    continue;
                                }
                                InternalCSGModelManager.UpdateMaterialCount(_models[i]);
                            }
                        }
                        for (int i = 0; i < _brushes.Length; i++)
                        {
                            if (!_brushes[i])
                            {
                                continue;
                            }
                            InternalCSGModelManager.CheckSurfaceModifications(_brushes[i], true);
                        }
                        if (_undoGroupIndex != -1)
                        {
                            Undo.CollapseUndoOperations(_undoGroupIndex);
                            Undo.FlushUndoRecordObjects();
                        }
                    }
                }
                _brushes      = null;
                _models       = null;
                disposedValue = true;
            }
        }