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(); }
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; } }
static void UpdateChildrenModel(CSGModel model, Transform container) { if (External == null) { return; } if (model == null) { return; } for (int i = 0; i < container.childCount; i++) { var child = container.GetChild(i); var nodeObj = child.GetComponent(TypeConstants.CSGNodeType); if (nodeObj) { var op = nodeObj as CSGOperation; if (op && !op.PassThrough) { // make sure the node has already been initialized, otherwise // assume it'll still get initialized at some point, in which // case we shouldn't update it's hierarchy here if (!op.IsRegistered) { continue; } if (op.ChildData.Model != model) { if (model) // assume we're still initializing { SetCSGOperationHierarchy(op, op.ChildData.Parent, model); } } else { // assume that if this operation already has the // correct model, then it's children will have the same model break; } } var brush = nodeObj as CSGBrush; if (brush) { // make sure the node has already been initialized, otherwise // assume it'll still get initialized at some point, in which // case we shouldn't update it's hierarchy here if (!brush.IsRegistered) { continue; } if (brush.ChildData.Model != model) { if (model) // assume we're still initializing { SetCSGBrushHierarchy(brush, brush.ChildData.Parent, model); InternalCSGModelManager.CheckSurfaceModifications(brush); } } else { // assume that if this brush already has the // correct model, then it's children will have the same model break; } } } UpdateChildrenModel(model, child); } }
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; } }