private void editExistingBillboardAtlasToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDlg fileDlg = new OpenFileDlg(); fileDlg.ShowBaseData = false; fileDlg.Caption = "Open existing Billboard Atlas file"; fileDlg.Description = "Browse directories to open an existing texture atlas file. Then press OK to edit the atlas."; fileDlg.InitialDirectory = EditorManager.Project.ProjectDir; fileDlg.Filter = new string[] { ".atlas" }; // start with selected model (if it is an .atlas file) if (TerrainEditor.CurrentDecorationModel != null && string.Compare(Path.GetExtension(TerrainEditor.CurrentDecorationModel.Filename), ".atlas", true) == 0) fileDlg.FileName = EditorManager.Project.MakeAbsolute(TerrainEditor.CurrentDecorationModel.Filename); if (fileDlg.ShowDialog() != DialogResult.OK) return; TextureAtlas atlas = TextureAtlas.CreateFromFile(EditorManager.Project.MakeRelative(fileDlg.FileName)); if (atlas == null) { EditorManager.ShowMessageBox("Error loading atlas file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TextureAtlasEditorDlg dlg = new TextureAtlasEditorDlg(true); dlg.Atlas = atlas; if (dlg.ShowDialog(this) != DialogResult.OK) return; dlg.Atlas.SaveToFile(null); }
private void createNewBillboardAtlasToolStripMenuItem_Click(object sender, EventArgs e) { CreateFileDlg fileDlg = new CreateFileDlg(); fileDlg.Caption = "Create a new Billboard Atlas file"; fileDlg.Description = "Enter the name of the new atlas file and select the directory to create it in. Then press OK to continue."; fileDlg.InitialDirectory = EditorManager.Project.ProjectDir; fileDlg.Ext = ".atlas"; fileDlg.AllowOverwrite = false; fileDlg.Filter = new string[] { ".atlas" }; if (fileDlg.ShowDialog() != DialogResult.OK) return; TextureAtlas atlas = new TextureAtlas(); atlas.Filename = EditorManager.Project.MakeRelative(fileDlg.FileName); TextureAtlasEditorDlg dlg = new TextureAtlasEditorDlg(true); dlg.Atlas = atlas; if (dlg.ShowDialog(this) != DialogResult.OK) return; dlg.Atlas.SaveToFile(null); }