private void ImportModel(Polymodel original) { int oldNumTextures = original.NumTextures; List <string> newTextureNames = new List <string>(); openFileDialog1.Filter = "Parallax Object Files|*.pof"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { string traceto = ""; if (bool.Parse(StandardUI.options.GetOption("TraceModels", bool.FalseString))) { string bareFilename = Path.GetFileName(openFileDialog1.FileName); traceto = StandardUI.options.GetOption("TraceDir", ".") + Path.DirectorySeparatorChar + Path.ChangeExtension(bareFilename, "txt"); } Polymodel model = POFReader.ReadPOFFile(openFileDialog1.FileName, traceto); model.ExpandSubmodels(); //int numTextures = model.n_textures; //datafile.ReplaceModel(ElementNumber, model); datafile.replacedModels[ElementNumber] = model; model.replacementID = ReplacedElementComboBox.SelectedIndex; UpdateModelPanel(ElementNumber); } }
private void btnImportModel_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { string traceto = ""; if (bool.Parse(StandardUI.options.GetOption("TraceModels", bool.FalseString))) { string bareFilename = Path.GetFileName(openFileDialog1.FileName); traceto = StandardUI.options.GetOption("TraceDir", ".") + Path.DirectorySeparatorChar + Path.ChangeExtension(bareFilename, "txt"); } Stream stream = File.OpenRead(openFileDialog1.FileName); Polymodel newmodel = POFReader.ReadPOFFile(stream); stream.Close(); stream.Dispose(); newmodel.ExpandSubmodels(); //datafile.ReplaceModel(ElementNumber, model); ModelReplaceTransaction transaction = new ModelReplaceTransaction("Load model", (object)model, newmodel, modelID, tabPage); transactionManager.ApplyTransaction(transaction); Update(model, modelID); } }