private void findMaterialsThatUseTextureOfNameToolStripMenuItem_Click(object sender, EventArgs e) { F_NGN lev = TabControl.GetLevel(); if (lev != null) { InputDialog id = new InputDialog(); List <string> tlocations = new List <string>(); if (id.ShowDialog() == DialogResult.OK) { string inp = id.input; int reltexid = lev.TexNameToGlobalID(inp); foreach (Character chr in lev.characters) { foreach (Shape shape in chr.shapes) { for (int i = 0; i < shape.materials.Count; i++) { if (shape.materials[i].textureIndexRelative == reltexid) { tlocations.Add(String.Format("Found Texture : {0} > {1} > Material {2}", chr.name, (shape.name == "") ? "<Shape" + i + ">" : shape.name, i)); } } } } foreach (Geometry geo in lev.Geometries) { for (int s = 0; s < geo.shapes.Count; s++) { Shape shape = geo.shapes[s]; for (int i = 0; i < shape.materials.Count; i++) { if (shape.materials[i].textureIndexRelative == reltexid) { tlocations.Add(String.Format("Found Texture : {0} > {1} > Material {2}", geo.name, (shape.name == "")? "<Shape" + i + ">" : shape.name, i)); } } } } SessionManager.Report("Search for " + inp + " in level returned " + tlocations.Count + " results :\n" + string.Join("\n", tlocations)); } } }
private void replaceSelectedValuesToolStripMenuItem_Click(object sender, EventArgs e) { //NOTE when we use dgvShapeData.SelectedCells[0] we are assuming that the column contamination protection has done its job correctly //if (contextDGV.Tag == "color") { // if (dgvShapeData.Columns[dgvShapeData.SelectedCells[0].ColumnIndex] is DataGridViewButtonColumn) { // ColorDialog cd = new ColorDialog { // Color = dgvShapeData.SelectedCells[0].Style.BackColor, // FullOpen = true // }; // if (cd.ShowDialog() == DialogResult.OK) { // foreach (DataGridViewCell cell in dgvShapeData.SelectedCells) { // cell.Style.BackColor = cd.Color; // loadedShape.rawVertexShading[loadedShape.rawPrimitives[comboPrimitive.SelectedIndex].vertices[cell.RowIndex]] = cd.Color; // } // } // } else { // using (InputDialog input = new InputDialog()) { // if (input.ShowDialog() == DialogResult.OK) { // foreach (DataGridViewCell cell in dgvShapeData.SelectedCells) { // cell.Value = input.input; // SessionManager.ReportEx("INPUT NOT IMPL!", SessionManager.RType.ERROR); // } // } // } // } //} System.Drawing.Color CDC; string CID = null; if (dgvShapeData.SelectedCells[0].ColumnIndex == 7) { ColorDialog cd = new ColorDialog { Color = dgvShapeData.SelectedCells[0].Style.BackColor, FullOpen = true }; if (cd.ShowDialog() == DialogResult.OK) { foreach (DataGridViewCell cell in dgvShapeData.SelectedCells) { cell.Style.BackColor = cd.Color; //loadedShape.rawVertexShading[loadedShape.rawPrimitives[comboPrimitive.SelectedIndex].vertices[cell.RowIndex]] = cd.Color; } } else { //id say we just assume nothing else is gonna happen and we bust outta here... return; } } else { using (InputDialog input = new InputDialog()) { if (input.ShowDialog() == DialogResult.OK) { CID = input.input; } else { //id say we just assume nothing else is gonna happen and...feel like i've said this before... return; } } } foreach (DataGridViewCell cell in dgvShapeData.SelectedCells) { UpdateFromDGV(cell.ColumnIndex, cell.RowIndex, CID ?? cell.Value); } }