public MeleeTextureSelector(MeleeDataObjectNode mdon, TextureNode Texture) { InitializeComponent(); this.SelectedTexture = Texture; this.meleeDataObjectNode = mdon; DialogResult = DialogResult.None; DatDOBJ[] DOBJS = mdon.GetRoot().Root.GetDataObjects(); ImageList imageList1 = new ImageList(); imageList1.ColorDepth = ColorDepth.Depth24Bit; listView1.Scrollable = true; listView1.View = View.LargeIcon; imageList1.ImageSize = new Size(115, 115); listView1.LargeImageList = imageList1; // Grab all unique textures List <byte[]> Used = new List <byte[]>(); List <DatTexture> Textures = new List <DatTexture>(); for (int i = 0; i < DOBJS.Length; i++) { foreach (DatTexture t in DOBJS[i].Material.Textures) { if (t.ImageData == null || Used.Contains(t.ImageData.Data)) { continue; } else { Used.Add(t.ImageData.Data); ListViewItem lstItem = new ListViewItem(); lstItem.ImageIndex = Textures.Count; lstItem.Text = "Texture_" + lstItem.ImageIndex + "_" + (t.ImageData != null ? t.ImageData.Format.ToString() + "\n" + t.ImageData.Width + "x" + t.ImageData.Height : ""); lstItem.Tag = t; listView1.Items.Add(lstItem); imageList1.Images.Add(t.GetStaticBitmap()); Textures.Add(t); } } } // Setup Combo Boxes foreach (var enu in Enum.GetValues(typeof(TPL_TextureFormat))) { CBFormat.Items.Add(enu); } foreach (var enu in Enum.GetValues(typeof(TPL_PaletteFormat))) { CBPalette.Items.Add(enu); } CBFormat.SelectedItem = TPL_TextureFormat.CMP; CBPalette.SelectedItem = TPL_PaletteFormat.RGB565; }
private void textureListBox_SelectedIndexChanged(object sender, EventArgs e) { if (TempBitmap != null) { //TempBitmap.Dispose(); TempBitmap = null; } EnabledPanelContents(tabControl2, false); ButtonChooseTexture.Enabled = false; if (textureListBox.SelectedItem != null) { EnabledPanelContents(tabControl2, true); ButtonChooseTexture.Enabled = true; selectedTexture = (TextureNode)textureListBox.SelectedItem; if (selectedTexture != null && selectedTexture.Texture != null && selectedTexture.Texture.ImageData != null) { TempBitmap = selectedTexture.Texture.GetStaticBitmap(); } textureFlagsTB.Text = selectedTexture.Texture.UnkFlags.ToString("X"); CBWrapS.SelectedItem = (selectedTexture.Texture.WrapS); CBWrapT.SelectedItem = (selectedTexture.Texture.WrapT); CBTexGenSrc.SelectedIndex = selectedTexture.Texture.GXTexGenSrc; CBTexID.SelectedItem = selectedTexture.Texture.TexMapID; CBTexMag.SelectedItem = selectedTexture.Texture.MagFilter; TBBlending.Text = selectedTexture.Texture.Blending.ToString(); TBTX.Text = selectedTexture.Texture.TX.ToString(); TBTY.Text = selectedTexture.Texture.TY.ToString(); TBTZ.Text = selectedTexture.Texture.TZ.ToString(); TBRX.Text = selectedTexture.Texture.RX.ToString(); TBRY.Text = selectedTexture.Texture.RY.ToString(); TBRZ.Text = selectedTexture.Texture.RZ.ToString(); TBSX.Text = selectedTexture.Texture.SX.ToString(); TBSY.Text = selectedTexture.Texture.SY.ToString(); TBSZ.Text = selectedTexture.Texture.SZ.ToString(); CBEnableLOD.Checked = (selectedTexture.Texture.LOD != null); } pictureBox1.Image = TempBitmap; }
public void Reload() { selectedTexture = null; buttonDIF.BackColor = DOBJ.Material.MaterialColor.DIF; buttonSPC.BackColor = DOBJ.Material.MaterialColor.SPC; buttonAMB.BackColor = DOBJ.Material.MaterialColor.AMB; numericGlossiness.Value = (decimal)DOBJ.Material.MaterialColor.Glossiness; numericTransparency.Value = (decimal)DOBJ.Material.MaterialColor.Transparency; flagsTB.Text = DOBJ.Material.Flags.ToString("X"); textureListBox.Items.Clear(); foreach (DatTexture t in DOBJ.Material.Textures) { textureListBox.Items.Add(new TextureNode(t)); } pixelProcessingCB.Checked = DOBJ.Material.PixelProcessing != null; }