/// <summary>
/// The inject mesh from obj tool strip menu item_ click.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
/// <remarks></remarks>
private void injectMeshFromOBJToolStripMenuItem_Click(object sender, EventArgs e)
{
folderBrowserDialog.SelectedPath = Prefs.pathExtractsFolder;
if (folderBrowserDialog.ShowDialog() == DialogResult.Cancel)
{
return;
}
Prefs.pathExtractsFolder = folderBrowserDialog.SelectedPath;
Form tempForm = new Form();
tempForm.ControlBox = false;
tempForm.FormBorderStyle = FormBorderStyle.FixedDialog;
tempForm.Size = new Size(250, 100);
Label tempLabel = new Label();
tempLabel.AutoSize = true;
tempLabel.Location = new Point(20, 20);
tempLabel.Text = "Loading BSP, please wait...";
ProgressBar tempPB = new ProgressBar();
tempPB.Location = new Point(20, 60);
tempPB.Size = new Size(210, 20);
tempPB.Minimum = 0;
tempPB.Maximum = 100;
tempForm.Controls.Add(tempLabel);
tempForm.Controls.Add(tempPB);
tempForm.Show();
Application.DoEvents();
BSPModel pm = new BSPModel(ref map.SelectedMeta);
tempLabel.Text = "Loading Model...";
tempPB.Value = 35;
Application.DoEvents();
Meta addme = pm.InjectModel(folderBrowserDialog.SelectedPath, map.SelectedMeta);
/*
addme.name += "(new)";
addme.name = getNameDialog.Show("Choose injection name", "Meta Name:", addme.name, "OK");
*/
ArrayList oi = new ArrayList();
oi.Add(addme);
tempLabel.Text = "Analyzing Layout...";
tempPB.Value = 60;
Application.DoEvents();
MapAnalyzer analyze = new MapAnalyzer();
MapLayout layout = analyze.ScanMapForLayOut(map, false);
layout.ReadChunks(map);
tempLabel.Text = "Rebuilding Map...";
tempPB.Value = 70;
Application.DoEvents();
Builder build = new Builder();
build.MapBuilder(oi, ref layout, map, false);
tempLabel.Text = "Refreshing Map...";
tempPB.Value = 95;
Application.DoEvents();
map = Map.Refresh(map);
formFuncs.AddMetasToTreeView(map, treeView1, metaView, false);
this.Enabled = true;
#region Remove form that shows progress
tempForm.Dispose();
#endregion
MessageBox.Show("Done");
}