public void LoadProperty(XTX.TextureInfo tex) { pictureBoxCustom1.Image = Imaging.GetLoadingImage(); LoadImage(); CurMipDisplayLevel = 0; CurArrayDisplayLevel = 0; textureData = tex; UpdateMipDisplay(); PropGridData prop = new PropGridData(); prop.Name = textureData.Text; prop.Width = textureData.Width; prop.Height = textureData.Height; // prop.MipCount = (uint)textureData.blocksCompressed[0].Count; // prop.ArrayCount = (uint)textureData.blocksCompressed.Count; prop.Height = textureData.Height; prop.Format = ((NUTEXB.NUTEXImageFormat)textureData.Format).ToString(); propertyGrid1.PropertySort = PropertySort.Categorized; propertyGrid1.SelectedObject = prop; }
private void UpdateMipDisplay() { mipLevelCounterLabel.Text = $"{CurMipDisplayLevel} / {textureData.mipmaps[CurArrayDisplayLevel].Count - 1}"; arrayLevelCounterLabel.Text = $"{CurArrayDisplayLevel} / {textureData.mipmaps.Count - 1}"; if (Thread != null && Thread.IsAlive) { Thread.Abort(); } Thread = new Thread((ThreadStart)(() => { pictureBoxCustom1.Image = Imaging.GetLoadingImage(); pictureBoxCustom1.Image = textureData.DisplayTexture(CurMipDisplayLevel, CurArrayDisplayLevel); // texSizeMipsLabel.Text = $"Width = {pictureBoxCustom1.Image.Width} Height = {pictureBoxCustom1.Image.Height}"; })); Thread.Start(); if (CurMipDisplayLevel != textureData.mipmaps[CurArrayDisplayLevel].Count - 1) { BtnMipsRight.Enabled = true; } else { BtnMipsRight.Enabled = false; } if (CurMipDisplayLevel != 0) { BtmMipsLeft.Enabled = true; } else { BtmMipsLeft.Enabled = false; } if (CurArrayDisplayLevel != textureData.mipmaps.Count - 1) { btnRightArray.Enabled = true; } else { btnRightArray.Enabled = false; } if (CurArrayDisplayLevel != 0) { btnLeftArray.Enabled = true; } else { btnLeftArray.Enabled = false; } }
private void LoadImage() { Thread = new Thread((ThreadStart)(() => { pictureBoxCustom1.Image = Imaging.GetLoadingImage(); pictureBoxCustom1.Image = textureData.GetBitmap(CurMipDisplayLevel, CurArrayDisplayLevel);; })); Thread.Start(); }
public void LoadProperty(TextureData tex) { pictureBoxCustom1.Image = Imaging.GetLoadingImage(); LoadImage(); CurMipDisplayLevel = 0; CurArrayDisplayLevel = 0; textureData = tex; Texture texture = tex.Texture; propertyGrid1.PropertySort = PropertySort.Categorized; propertyGrid1.SelectedObject = texture; UpdateMipDisplay(); }
private void LoadImage() { if (Thread != null && Thread.IsAlive) { Thread.Abort(); } Thread = new Thread((ThreadStart)(() => { pictureBoxCustom1.Image = Imaging.GetLoadingImage(); pictureBoxCustom1.Image = textureData.DisplayTexture(CurMipDisplayLevel, CurArrayDisplayLevel); })); Thread.Start(); GC.Collect(); }
private void UpdateImage() { if (activeTexture == null) { return; } Thread = new Thread((ThreadStart)(() => { pictureBoxCustom1.Image = Imaging.GetLoadingImage(); var image = activeTexture.GetBitmap(0, 0); var mipmaps = STGenericTexture.CompressBlock(BitmapExtension.ImageToByte(activeImage), activeImage.Width, activeImage.Height, Format, 0.5f); newImage = BitmapExtension.SwapBlueRedChannels(STGenericTexture.DecodeBlockGetBitmap(mipmaps, (uint)image.Width, (uint)image.Height, Format)); pictureBoxCustom1.Image = newImage; })); Thread.Start(); pictureBoxCustom1.Image = newImage; }
public void LoadEmitter(PTCL.Emitter Emitter) { ActiveEmitter = Emitter; Reset(); LoadColors(Emitter); if (Emitter.DrawableTex.Count <= 0) { return; } if (Emitter.DrawableTex[0].MipCount > 0) { pictureBox1.Image = Imaging.GetLoadingImage(); pictureBox1.Image = Emitter.DrawableTex[0].GetBitmap(); TBTexture0.Text = Emitter.DrawableTex[0].Text; } if (Emitter.DrawableTex.Count < 2) { return; } if (Emitter.DrawableTex[1].MipCount > 0) { pictureBox2.Image = Imaging.GetLoadingImage(); pictureBox2.Image = Emitter.DrawableTex[1].GetBitmap(); TBTexture1.Text = Emitter.DrawableTex[1].Text; } if (Emitter.DrawableTex.Count < 3) { return; } if (Emitter.DrawableTex[2].MipCount > 0) { pictureBox3.Image = Imaging.GetLoadingImage(); pictureBox3.Image = Emitter.DrawableTex[2].GetBitmap(); TBTexture2.Text = Emitter.DrawableTex[2].Text; } Thread = new Thread((ThreadStart)(() => { })); try { /* Thread Thread2 = new Thread((ThreadStart)(() => * { * pictureBox2.Image = Imaging.GetLoadingImage(); * pictureBox2.Image = Emitter.DrawableTex[1].GetBitmap(); * })); * Thread Thread3 = new Thread((ThreadStart)(() => * { * pictureBox3.Image = Imaging.GetLoadingImage(); * pictureBox3.Image = Emitter.DrawableTex[2].GetBitmap(); * }));*/ } catch { } }
public void LoadEmitter(PTCL.Emitter Emitter) { ActiveEmitter = Emitter; Reset(); for (int i = 0; i < 8; i++) { } color0Index0.BackColor = Emitter.Color0s[0]; color0Index1.BackColor = Emitter.Color0s[1]; color0Index2.BackColor = Emitter.Color0s[2]; color0Index3.BackColor = Emitter.Color0s[3]; color0Index4.BackColor = Emitter.Color0s[4]; color0Index5.BackColor = Emitter.Color0s[5]; color0Index6.BackColor = Emitter.Color0s[6]; color0Index7.BackColor = Emitter.Color0s[7]; color1Index0.BackColor = Emitter.Color1s[0]; color1Index1.BackColor = Emitter.Color1s[1]; color1Index2.BackColor = Emitter.Color1s[2]; color1Index3.BackColor = Emitter.Color1s[3]; color1Index4.BackColor = Emitter.Color1s[4]; color1Index5.BackColor = Emitter.Color1s[5]; color1Index6.BackColor = Emitter.Color1s[6]; color1Index7.BackColor = Emitter.Color1s[7]; color0TB.Text = Utils.ColorToHex(Emitter.Color0s[0]); color0TB2.Text = Utils.ColorToHex(Emitter.Color0s[1]); color0TB3.Text = Utils.ColorToHex(Emitter.Color0s[2]); color0TB4.Text = Utils.ColorToHex(Emitter.Color0s[3]); color0TB5.Text = Utils.ColorToHex(Emitter.Color0s[4]); color0TB6.Text = Utils.ColorToHex(Emitter.Color0s[5]); color0TB7.Text = Utils.ColorToHex(Emitter.Color0s[6]); color0TB8.Text = Utils.ColorToHex(Emitter.Color0s[7]); color1TB.Text = Utils.ColorToHex(Emitter.Color1s[0]); color1TB2.Text = Utils.ColorToHex(Emitter.Color1s[1]); color1TB3.Text = Utils.ColorToHex(Emitter.Color1s[2]); color1TB4.Text = Utils.ColorToHex(Emitter.Color1s[3]); color1TB5.Text = Utils.ColorToHex(Emitter.Color1s[4]); color1TB6.Text = Utils.ColorToHex(Emitter.Color1s[5]); color1TB7.Text = Utils.ColorToHex(Emitter.Color1s[6]); color1TB8.Text = Utils.ColorToHex(Emitter.Color1s[7]); if (Emitter.DrawableTex.Count <= 0) { return; } if (Emitter.DrawableTex[0].MipCount > 0) { var contextMenuStrip1 = new ContextMenuStrip(); contextMenuStrip1.Items.Add("Replace", null, ReplaceImage0); contextMenuStrip1.Items.Add("Export", null, ExportImage0); pictureBox1.Image = Imaging.GetLoadingImage(); pictureBox1.Image = Emitter.DrawableTex[0].GetBitmap(); pictureBox1.ContextMenuStrip = contextMenuStrip1; TBTexture0.Text = Emitter.DrawableTex[0].Text; } if (Emitter.DrawableTex.Count < 2) { return; } if (Emitter.DrawableTex[1].MipCount > 0) { pictureBox2.Image = Imaging.GetLoadingImage(); pictureBox2.Image = Emitter.DrawableTex[1].GetBitmap(); TBTexture1.Text = Emitter.DrawableTex[1].Text; } if (Emitter.DrawableTex.Count < 3) { return; } if (Emitter.DrawableTex[2].MipCount > 0) { pictureBox3.Image = Imaging.GetLoadingImage(); pictureBox3.Image = Emitter.DrawableTex[2].GetBitmap(); TBTexture2.Text = Emitter.DrawableTex[2].Text; } Thread = new Thread((ThreadStart)(() => { })); try { /* Thread Thread2 = new Thread((ThreadStart)(() => * { * pictureBox2.Image = Imaging.GetLoadingImage(); * pictureBox2.Image = Emitter.DrawableTex[1].GetBitmap(); * })); * Thread Thread3 = new Thread((ThreadStart)(() => * { * pictureBox3.Image = Imaging.GetLoadingImage(); * pictureBox3.Image = Emitter.DrawableTex[2].GetBitmap(); * }));*/ } catch { } }