1
0
mirror of synced 2024-11-12 10:10:50 +01:00

A fix for editing specific splices in bntx

This commit is contained in:
KillzXGaming 2019-07-19 21:45:37 -04:00
parent 5735fcf806
commit 0a7a94bcb9
5 changed files with 19 additions and 6 deletions

View File

@ -1342,7 +1342,7 @@ namespace FirstPlugin
public override string ReplaceFilter => FileFilters.BNTX_TEX;
public override void Replace(string FileName) {
Replace(FileName, MipCount, Format, Texture.SurfaceDim);
Replace(FileName, MipCount, 0, Format, Texture.SurfaceDim);
}
public override void Export(string FileName) {
@ -1351,7 +1351,7 @@ namespace FirstPlugin
//Max mip level will be set automatically unless overwritten
//The tex format can be adjusted in the function if necessary. Will normally be set to format in settings
public void Replace(string FileName, uint MaxMipLevel = 0, TEX_FORMAT DefaultFormat = TEX_FORMAT.BC1_UNORM_SRGB, SurfaceDim surfaceDim = SurfaceDim.Dim2D)
public void Replace(string FileName, uint MaxMipLevel = 0, uint ArrayIndex = 0, TEX_FORMAT DefaultFormat = TEX_FORMAT.BC1_UNORM_SRGB, SurfaceDim surfaceDim = SurfaceDim.Dim2D)
{
Console.WriteLine("surfaceDim" + surfaceDim);
@ -1363,6 +1363,8 @@ namespace FirstPlugin
setting.SurfaceDim = surfaceDim;
var ImageDataCached = Texture.TextureData;
switch (ext)
{
case ".bftex":
@ -1397,6 +1399,15 @@ namespace FirstPlugin
}
break;
}
//After image data is replaced, use original and swap the specific array index
for (int i = 0; i < ImageDataCached.Count; i++)
{
if (i == ArrayIndex)
ImageDataCached[i] = Texture.TextureData[0];
}
Texture.TextureData = ImageDataCached;
}
public void ApplyImportSettings(TextureImporterSettings setting,STCompressionMode CompressionMode)
{

View File

@ -321,7 +321,7 @@ namespace FirstPlugin
{
var bntxFile = new BNTX();
var tex = new TextureData();
tex.Replace(ofd.FileName, MipCount, Format);
tex.Replace(ofd.FileName, MipCount,0, Format);
//If it's null, the operation is cancelled
if (tex.Texture == null)

View File

@ -438,7 +438,7 @@ namespace FirstPlugin
{
var bntxFile = new BNTX();
var tex = new TextureData();
tex.Replace(FileName, MipCount, Format);
tex.Replace(FileName, MipCount, 0, Format);
//If it's null, the operation is cancelled
if (tex.Texture == null)

View File

@ -170,7 +170,10 @@ namespace FirstPlugin.Forms
if (ofd.ShowDialog() == DialogResult.OK)
{
image.Replace(ofd.FileName);
if (IsBntx)
((TextureData)image).Replace(ofd.FileName, 0, 0, image.Format, ((TextureData)image).Texture.SurfaceDim);
else
image.Replace(ofd.FileName);
}
UpdateImagePanel(ImageIndex);

View File

@ -300,7 +300,6 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1096, 560);
this.KeyPreview = true;
this.Name = "BinaryTextureImporterList";
this.Text = "Texture Importer";
this.Load += new System.EventHandler(this.BinaryTextureImporterList_Load);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.BinaryTextureImporterList_KeyDown);