Load channel ocmponents for some formats
This commit is contained in:
parent
d100a974eb
commit
6a7fe523e3
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -364,6 +364,11 @@ namespace Bfres.Structs
|
|||||||
ArrayCount = tex.ArrayLength;
|
ArrayCount = tex.ArrayLength;
|
||||||
MipCount = tex.MipCount;
|
MipCount = tex.MipCount;
|
||||||
|
|
||||||
|
RedChannel = SetChannel(texture.CompSelR);
|
||||||
|
GreenChannel = SetChannel(texture.CompSelG);
|
||||||
|
BlueChannel = SetChannel(texture.CompSelB);
|
||||||
|
AlphaChannel = SetChannel(texture.CompSelA);
|
||||||
|
|
||||||
if (tex.ArrayLength == 0)
|
if (tex.ArrayLength == 0)
|
||||||
ArrayCount = tex.Depth; //Some older bfres don't use array length????
|
ArrayCount = tex.Depth; //Some older bfres don't use array length????
|
||||||
|
|
||||||
@ -371,6 +376,16 @@ namespace Bfres.Structs
|
|||||||
MipCount = 1;
|
MipCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private STChannelType SetChannel(GX2CompSel comp)
|
||||||
|
{
|
||||||
|
if (comp == GX2CompSel.ChannelR) return STChannelType.Red;
|
||||||
|
else if (comp == GX2CompSel.ChannelG) return STChannelType.Green;
|
||||||
|
else if (comp == GX2CompSel.ChannelB) return STChannelType.Blue;
|
||||||
|
else if (comp == GX2CompSel.ChannelA) return STChannelType.Alpha;
|
||||||
|
else if (comp == GX2CompSel.Always0) return STChannelType.Zero;
|
||||||
|
else return STChannelType.One;
|
||||||
|
}
|
||||||
|
|
||||||
public void UpdateMipMaps()
|
public void UpdateMipMaps()
|
||||||
{
|
{
|
||||||
LoadTex2Bfres();
|
LoadTex2Bfres();
|
||||||
@ -675,7 +690,7 @@ namespace Bfres.Structs
|
|||||||
LibraryGUI.Instance.LoadEditor(editor);
|
LibraryGUI.Instance.LoadEditor(editor);
|
||||||
}
|
}
|
||||||
editor.Text = Text;
|
editor.Text = Text;
|
||||||
editor.LoadProperties(this.texture);
|
editor.LoadProperties(this.texture, OnPropertyChanged);
|
||||||
editor.LoadImage(this);
|
editor.LoadImage(this);
|
||||||
|
|
||||||
if (texture.UserData != null)
|
if (texture.UserData != null)
|
||||||
@ -690,5 +705,23 @@ namespace Bfres.Structs
|
|||||||
userEditor.LoadUserData(texture.UserData);
|
userEditor.LoadUserData(texture.UserData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPropertyChanged()
|
||||||
|
{
|
||||||
|
Text = texture.Name;
|
||||||
|
|
||||||
|
MessageBox.Show("UPDATE PROB");
|
||||||
|
|
||||||
|
RedChannel = SetChannel(texture.CompSelR);
|
||||||
|
GreenChannel = SetChannel(texture.CompSelG);
|
||||||
|
BlueChannel = SetChannel(texture.CompSelB);
|
||||||
|
AlphaChannel = SetChannel(texture.CompSelA);
|
||||||
|
|
||||||
|
ImageEditorBase editor = (ImageEditorBase)LibraryGUI.Instance.GetActiveContent(typeof(ImageEditorBase));
|
||||||
|
if (editor != null)
|
||||||
|
{
|
||||||
|
editor.UpdateMipDisplay();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -796,6 +796,10 @@ namespace FirstPlugin
|
|||||||
MipCount = (uint)tex.TextureData[0].Count;
|
MipCount = (uint)tex.TextureData[0].Count;
|
||||||
Format = ConvertFormat(tex.Format);
|
Format = ConvertFormat(tex.Format);
|
||||||
|
|
||||||
|
RedChannel = SetChannel(tex.ChannelRed);
|
||||||
|
GreenChannel = SetChannel(tex.ChannelGreen);
|
||||||
|
BlueChannel = SetChannel(tex.ChannelBlue);
|
||||||
|
AlphaChannel = SetChannel(tex.ChannelAlpha);
|
||||||
ContextMenuStrip = new STContextMenuStrip();
|
ContextMenuStrip = new STContextMenuStrip();
|
||||||
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Export", null, Export, Keys.Control | Keys.E));
|
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Export", null, Export, Keys.Control | Keys.E));
|
||||||
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Replace", null, Replace, Keys.Control | Keys.R));
|
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Replace", null, Replace, Keys.Control | Keys.R));
|
||||||
@ -804,6 +808,17 @@ namespace FirstPlugin
|
|||||||
ContextMenuStrip.Items.Add(new ToolStripSeparator());
|
ContextMenuStrip.Items.Add(new ToolStripSeparator());
|
||||||
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Delete", null, Remove, Keys.Control | Keys.Delete));
|
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Delete", null, Remove, Keys.Control | Keys.Delete));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private STChannelType SetChannel(ChannelType channelType)
|
||||||
|
{
|
||||||
|
if (channelType == ChannelType.Red) return STChannelType.Red;
|
||||||
|
else if (channelType == ChannelType.Green) return STChannelType.Green;
|
||||||
|
else if (channelType == ChannelType.Blue) return STChannelType.Blue;
|
||||||
|
else if (channelType == ChannelType.Alpha) return STChannelType.Alpha;
|
||||||
|
else if (channelType == ChannelType.Zero) return STChannelType.Zero;
|
||||||
|
else return STChannelType.One;
|
||||||
|
}
|
||||||
|
|
||||||
public static SurfaceFormat GenericToBntxSurfaceFormat(TEX_FORMAT texFormat)
|
public static SurfaceFormat GenericToBntxSurfaceFormat(TEX_FORMAT texFormat)
|
||||||
{
|
{
|
||||||
switch (texFormat)
|
switch (texFormat)
|
||||||
@ -979,9 +994,20 @@ namespace FirstPlugin
|
|||||||
|
|
||||||
editor.Text = Text;
|
editor.Text = Text;
|
||||||
|
|
||||||
editor.LoadProperties(Texture);
|
editor.LoadProperties(Texture, OnPropertyChanged);
|
||||||
editor.LoadImage(this);
|
editor.LoadImage(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPropertyChanged()
|
||||||
|
{
|
||||||
|
Text = Texture.Name;
|
||||||
|
|
||||||
|
RedChannel = SetChannel(Texture.ChannelRed);
|
||||||
|
GreenChannel = SetChannel(Texture.ChannelGreen);
|
||||||
|
BlueChannel = SetChannel(Texture.ChannelBlue);
|
||||||
|
AlphaChannel = SetChannel(Texture.ChannelAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
private void Remove(object sender, EventArgs args)
|
private void Remove(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
((BNTX)Parent).RemoveTexture(this);
|
((BNTX)Parent).RemoveTexture(this);
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -235,7 +235,7 @@ namespace Switch_Toolbox.Library.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadProperties(object prop) => propertiesEditor.LoadProperties(prop);
|
public void LoadProperties(object prop, Action OnPropertyChanged = null) => propertiesEditor.LoadProperties(prop, OnPropertyChanged);
|
||||||
|
|
||||||
public void LoadImage(STGenericTexture texture)
|
public void LoadImage(STGenericTexture texture)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ namespace Switch_Toolbox.Library.Forms
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadProperties(object prop)
|
public void LoadProperties(object prop, Action OnPropertyChanged)
|
||||||
{
|
{
|
||||||
if (stPropertyGrid1.InvokeRequired)
|
if (stPropertyGrid1.InvokeRequired)
|
||||||
{
|
{
|
||||||
@ -98,9 +98,6 @@ namespace Switch_Toolbox.Library.Forms
|
|||||||
stPropertyGrid1.Refresh();
|
stPropertyGrid1.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void OnPropertyChanged() { }
|
|
||||||
|
|
||||||
public void ResetChannels()
|
public void ResetChannels()
|
||||||
{
|
{
|
||||||
imgList.Images.Clear();
|
imgList.Images.Clear();
|
||||||
|
@ -45,6 +45,11 @@ namespace Switch_Toolbox.Library
|
|||||||
{
|
{
|
||||||
RenderableTex = new RenderableTex();
|
RenderableTex = new RenderableTex();
|
||||||
RenderableTex.GLInitialized = false;
|
RenderableTex.GLInitialized = false;
|
||||||
|
|
||||||
|
RedChannel = STChannelType.Red;
|
||||||
|
GreenChannel = STChannelType.Green;
|
||||||
|
BlueChannel = STChannelType.Blue;
|
||||||
|
AlphaChannel = STChannelType.Alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user