private void CreateDecal(Coordinate origin) { var gd = Document.GameData.Classes.FirstOrDefault(x => x.Name == "infodecal"); if (gd == null) { System.Windows.Forms.MessageBox.Show("`infodecal` was not found in the entity list.", "FGD Data Not Found", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); return; } var selected = Document.TextureCollection.SelectedTexture; var textureName = selected == null ? "{TARGET" : selected.Name; if (Document.TextureCollection.GetItem(textureName) == null) { return; } var decal = new Entity(Document.Map.IDGenerator.GetNextObjectID()) { EntityData = new EntityData(gd), ClassName = gd.Name, Colour = Colour.GetRandomBrushColour(), Origin = origin }; decal.SetDecal(TextureHelper.Get(textureName.ToLowerInvariant())); decal.EntityData.SetPropertyValue("texture", textureName); Document.PerformAction("Apply decal", new Create(Document.Map.WorldSpawn.ID, decal)); }
private void CreateDecal(Coordinate origin) { var gd = Document.GameData.Classes.First(x => x.Name == "infodecal"); var selected = Editor.Instance.GetSelectedTexture(); var textureName = selected == null ? "{TARGET" : selected.Name; if (Document.TextureCollection.GetItem(textureName) == null) { return; } var decal = new Entity(Document.Map.IDGenerator.GetNextObjectID()) { EntityData = new EntityData(gd), ClassName = gd.Name, Colour = Colour.GetRandomBrushColour(), Origin = origin }; decal.SetDecal(TextureHelper.Get(textureName.ToLowerInvariant())); decal.EntityData.SetPropertyValue("texture", textureName); Document.PerformAction("Apply decal", new Create(decal)); }