private void importToolStripMenuItem_Click(object sender, EventArgs e) { if (importFileDialog.ShowDialog() == DialogResult.OK) { string filePath = importFileDialog.FileName; DialogResult userClearLevelResult = MessageBox.Show("Do you want to clear the level models first?", "Clear Level?", MessageBoxButtons.YesNoCancel); if (userClearLevelResult == DialogResult.Cancel) { return; } else if (userClearLevelResult == DialogResult.Yes) { DialogResult clearAnimsResult = MessageBox.Show("Do you also want to clear any animated level models?", "Clear anims too?", MessageBoxButtons.YesNo); LevelData.ClearLevelGeometry(); if (clearAnimsResult == DialogResult.Yes) { LevelData.ClearLevelGeoAnims(); } } LevelData.ImportFromFile(filePath, cam, out bool errorFlag, out string errorMsg, selectedItems); if (errorFlag) { MessageBox.Show(errorMsg); } } }
// Import models to stage private void ImportLevelItem(bool multiple = false) { importFileDialog.InitialDirectory = modFolder; if (importFileDialog.ShowDialog() != DialogResult.OK) { return; } DialogResult userClearLevelResult = MessageBox.Show("Do you want to clear the level models first?", "Clear Level?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (userClearLevelResult == DialogResult.Cancel) { return; } if (userClearLevelResult == DialogResult.Yes) { DialogResult clearAnimsResult = MessageBox.Show("Do you also want to clear any animated level models?", "Clear anims too?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); LevelData.ClearLevelGeometry(); if (clearAnimsResult == DialogResult.Yes) { LevelData.ClearLevelGeoAnims(); } selectedItems.Clear(); } foreach (string s in importFileDialog.FileNames) { List <Item> newItems = LevelData.ImportFromFile(s, cam, out bool errorFlag, out string errorMsg, selectedItems, osd, multiple); if (errorFlag) { osd.AddMessage(errorMsg + "\n", 300); } if (!multiple) { selectedItems.Add(newItems); } else { selectedItems.Clear(); } } LevelData.InvalidateRenderState(); unsaved = true; }
private void clearLevelToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult clearAnimsResult = MessageBox.Show("Do you also want to clear any animated level models?", "Clear anims too?", MessageBoxButtons.YesNoCancel); if (clearAnimsResult == DialogResult.Cancel) { return; } LevelData.ClearLevelGeometry(); if (clearAnimsResult == DialogResult.Yes) { LevelData.ClearLevelGeoAnims(); } }
// Add a level animation private void ImportLevelAnimation() { importFileDialog.InitialDirectory = modFolder; if (importFileDialog.ShowDialog() != DialogResult.OK) { return; } string animpath = Path.ChangeExtension(importFileDialog.FileName, ".saanim"); // Load saanim file if it isn't found if (!File.Exists(animpath)) { using (OpenFileDialog ofd = new OpenFileDialog { Title = "Import Level Animation", DefaultExt = "saanim", Filter = "Animation Files|*.saanim", Multiselect = false }) { if (ofd.ShowDialog() != DialogResult.OK) { return; } animpath = ofd.FileName; } } // Update level animations LevelAnim newanim = LevelData.ImportLevelAnimation(new ModelFile(importFileDialog.FileName).Model, NJS_MOTION.Load(animpath), selectedItems); if (LevelData.LevelAnims == null) { LevelData.ClearLevelGeoAnims(); } LevelData.geo.Anim.Add(newanim.GeoAnimationData); LevelData.AddLevelAnim(newanim); unsaved = true; selectedItems.Clear(); selectedItems.Add(newanim); LevelData.InvalidateRenderState(); playAnimButton.Enabled = prevFrameButton.Enabled = nextFrameButton.Enabled = resetAnimButton.Enabled = LevelData.LevelAnimCount > 0; }