protected override void ExecuteCommand() { _originalSelectionState = _selectionManager.GetStateCopy(); using (new WaitCursor()) { var meshService = new MeshSplitterService(); var splitMeshes = meshService.SplitMesh(_objectToSplit.Geometry); _logger.Here().Information($"{splitMeshes.Count} meshes generated from splitting"); var parent = _objectToSplit.Parent; if (parent is GroupNode groupNode && groupNode.IsUngroupable) { parent = parent.Parent; } _newGroupNode = (GroupNode)parent.AddObject(new GroupNode(_objectToSplit.Name + "_Collection") { IsSelectable = true, IsUngroupable = true, IsLockable = true }); int counter = 0; List <Rmv2MeshNode> createdMeshes = new List <Rmv2MeshNode>(); foreach (var mesh in splitMeshes) { var hack = _objectToSplit as Rmv2MeshNode; var originalRmvModel = hack.MeshModel; var context = new GeometryGraphicsContext(_resourceLib.GraphicsDevice); var meshNode = new Rmv2MeshNode(hack.MeshModel.Clone(), context, _resourceLib, hack.AnimationPlayer, mesh); meshNode.Name = $"{_objectToSplit.Name}_submesh_{counter++}"; createdMeshes.Add(meshNode); _newGroupNode.AddObject(meshNode); } _objectToSplit.Parent.RemoveObject(_objectToSplit as SceneNode); var newState = (ObjectSelectionState)_selectionManager.CreateSelectionSate(GeometrySelectionMode.Object); foreach (var node in createdMeshes) { newState.ModifySelection(node, false); } } }