public void Perform(Document document) { var objects = _groupedObjects .Select(x => document.Map.WorldSpawn.FindByID(x)) .Where(x => x != null && x.Parent != null) .ToList(); _originalChildParents = objects.ToDictionary(x => x.ID, x => x.Parent.ID); _groupId = document.Map.IDGenerator.GetNextObjectID(); var group = new Group(_groupId); objects.ForEach(x => x.SetParent(group)); group.SetParent(document.Map.WorldSpawn); group.UpdateBoundingBox(); Mediator.Publish(EditorMediator.DocumentTreeStructureChanged); }
public void Perform(Document document) { var objects = _groupedObjects .Select(x => document.Map.WorldSpawn.FindByID(x)) .Where(x => x != null && x.Parent != null) .ToList(); _originalChildParents = objects.ToDictionary(x => x.ID, x => x.Parent.ID); if (_groupId == 0) _groupId = document.Map.IDGenerator.GetNextObjectID(); var group = new Group(_groupId) {Colour = Colour.GetRandomGroupColour()}; objects.ForEach(x => x.SetParent(group)); objects.ForEach(x => x.Colour = group.Colour.Vary()); group.SetParent(document.Map.WorldSpawn); group.UpdateBoundingBox(); if (group.GetChildren().All(x => x.IsSelected)) { document.Selection.Select(group); Mediator.Publish(EditorMediator.SelectionChanged); } Mediator.Publish(EditorMediator.DocumentTreeStructureChanged); }
private MapObject GetBrush(Box bounds, IDGenerator idg) { var brush = BrushManager.CurrentBrush; var ti = Document.TextureCollection.SelectedTexture; var texture = ti != null ? ti.GetTexture() : null; var created = brush.Create(idg, bounds, texture, BrushManager.RoundCreatedVertices ? 0 : 2).ToList(); if (created.Count > 1) { var g = new Group(idg.GetNextObjectID()); created.ForEach(x => x.SetParent(g)); g.UpdateBoundingBox(); return g; } return created.FirstOrDefault(); }
private static Group ReadMapGroup(BinaryReader br, List<Visgroup> visgroups, IDGenerator generator) { var grp = new Group(generator.GetNextObjectID()); ReadMapBase(br, grp, visgroups, generator); grp.UpdateBoundingBox(false); return grp; }