public void DeleteSelection() { m_Action = new VCEAction(); VCEditor.s_Mirror.CalcPrepare(VCEditor.s_Scene.m_Setting.m_VoxelSize); foreach (KeyValuePair <int, byte> kvp in m_SelectionMgr.m_Selection) { // Mirror if (VCEditor.s_Mirror.Enabled_Masked) { IntVector3 pos = VCIsoData.KeyToIPos(kvp.Key); VCEditor.s_Mirror.MirrorVoxel(pos); float strength = (float)(kvp.Value) / 255.0f; for (int i = 0; i < VCEditor.s_Mirror.OutputCnt; ++i) { if (VCEditor.s_Scene.m_IsoData.IsPointIn(VCEditor.s_Mirror.Output[i])) { int voxel_pos = VCIsoData.IPosToKey(VCEditor.s_Mirror.Output[i]); VCVoxel old_voxel = VCEditor.s_Scene.m_IsoData.GetVoxel(voxel_pos); VCVoxel new_voxel = old_voxel; new_voxel.VolumeF = new_voxel.VolumeF * (1 - strength); if (old_voxel != new_voxel) { VCEAlterVoxel modify = new VCEAlterVoxel(voxel_pos, old_voxel, new_voxel); modify.Redo(); m_Action.Modifies.Add(modify); } } } } // No mirror else { float strength = (float)(kvp.Value) / 255.0f; int voxel_pos = kvp.Key; VCVoxel old_voxel = VCEditor.s_Scene.m_IsoData.GetVoxel(voxel_pos); VCVoxel new_voxel = old_voxel; new_voxel.VolumeF = new_voxel.VolumeF * (1 - strength); if (old_voxel != new_voxel) { VCEAlterVoxel modify = new VCEAlterVoxel(voxel_pos, old_voxel, new_voxel); m_Action.Modifies.Add(modify); } } } ColorSelection(VCIsoData.BLANK_COLOR, false, true); if (m_Action.Modifies.Count > 0) { m_Action.DoButNotRegister(); VCUtils.ISOCut(VCEditor.s_Scene.m_IsoData, m_Action); m_Action.Register(); VCEStatusBar.ShowText("Selected voxels have been removed".ToLocalizationString(), 2); } ClearSelection(); }