private void MeshComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (manuallychangedmodel) { ObjMaterialComboBox.Items.Clear(); manuallychangedmodel = false; Mesh Tempmesh = new Mesh(); //List<string> matlist = new List<string>(); string tempmat = String.Empty; string tempname = "TempNameDeleteMePlease"; Tempmesh = Meshes.Load(tempname, MeshComboBox.GetItemText(MeshComboBox.SelectedItem)); foreach (MeshPart msh in Tempmesh.Parts) { ObjMaterialComboBox.Items.Add("Checker"); } } }
private void PropetriesApplyButton_Click(object sender, EventArgs e) { try { Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].MeshName = MeshComboBox.GetItemText(MeshComboBox.SelectedItem); //List<string> matlist = new List<string>(); //string tempmat = String.Empty; int Counter = 0; //foreach (MeshPart msh in Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Parts) //{ // Count++; //} Counter = Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Parts.Count; Meshes.Unload(Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex]); Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex] = Meshes.Load(NameBox.Text, MeshComboBox.GetItemText(MeshComboBox.SelectedItem)); for (int i = 0; i < Counter; i++) Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Parts[i].Material = Materials.Load(ObjMaterialComboBox.Items[i].ToString()); if (Counter < Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Parts.Count && Counter > 0) { for (int i = Counter; i < Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Parts.Count; i++) Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Parts[i].Material = Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Parts[0].Material; } try { //Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].FileName = Settings.Paths.Meshes + ObjFileTextBox.Text; } catch (Exception ex) { Log.WriteLineRed("Map saving error."); Log.WriteLineYellow(ex.Message); //ObjFileTextBox.Clear(); } //Engine content //if (Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].EngineContent == true) // EngineCheckBox1.Checked = true; //else // EngineCheckBox1.Checked = false; //Visible if (VisibleCheckBox1.Checked == true) Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Visible = true; else Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Visible = false; //Position Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Position.X = (float)Convert.ToDouble(XtextBox1.Text); Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Position.Y = (float)Convert.ToDouble(YtextBox2.Text); Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Position.Z = (float)Convert.ToDouble(ZtextBox3.Text); //Rotation Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Rotation.X = MathHelper.DegreesToRadians((float)Convert.ToDouble(RotBoxX.Text)); Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Rotation.Y = MathHelper.DegreesToRadians((float)Convert.ToDouble(RotBoxY.Text)); Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Rotation.Z = MathHelper.DegreesToRadians((float)Convert.ToDouble(RotBoxZ.Text)); //Scale Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Scale.X = (float)Convert.ToDouble(SclBoxX.Text); Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Scale.Y = (float)Convert.ToDouble(SclBoxY.Text); Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes[listBox1.SelectedIndex].Scale.Z = (float)Convert.ToDouble(SclBoxZ.Text); int temp_index = listBox1.SelectedIndex; listBox1.Items.Clear(); foreach (Mesh element in Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes) { listBox1.Items.Add(element.Name); } listBox1.SelectedIndex = temp_index; objcountlabel.Visible = true; objcountlabel.Text = Models.MODELS[ModelsComboBox1.SelectedIndex].Meshes.Count().ToString() + " object(s)"; } catch { } }