Add support for very old switch bfres and some ptcl color adjustments

This commit is contained in:
KillzXGaming 2019-08-17 15:59:17 -04:00
parent 3769cc12c2
commit c1d30f40fc
9 changed files with 62 additions and 10 deletions

Binary file not shown.

View file

@ -1232,6 +1232,13 @@ namespace FirstPlugin
string Name = resFile.ExternalFileDict.GetKey(index++); string Name = resFile.ExternalFileDict.GetKey(index++);
//Bfsha changes versioons alot so ignore these for now
if (Utils.GetExtension(Name) == ".bfsha")
{
externalFilesFolder.AddNode(new ExternalFileData(Name, anim.Data));
continue;
}
var file = STFileLoader.OpenFileFormat(Name, anim.Data, false, true); var file = STFileLoader.OpenFileFormat(Name, anim.Data, false, true);
//Only do once. There's usually one bntx embedded but incase there are multiple //Only do once. There's usually one bntx embedded but incase there are multiple

View file

@ -278,7 +278,7 @@ namespace FirstPlugin
} }
} }
public class TextureFolder : TreeNodeCustom, IContextMenuNode public class TextureFolder : TreeNodeCustom, IContextMenuNode, ITextureIconLoader
{ {
public TextureFolder(string text) public TextureFolder(string text)
{ {
@ -293,6 +293,19 @@ namespace FirstPlugin
}; };
} }
public List<STGenericTexture> IconTextureList
{
get
{
List<STGenericTexture> textures = new List<STGenericTexture>();
foreach (STGenericTexture node in Nodes)
textures.Add(node);
return textures;
}
set { }
}
private void ExportAll(object sender, EventArgs args) private void ExportAll(object sender, EventArgs args)
{ {
List<string> Formats = new List<string>(); List<string> Formats = new List<string>();

View file

@ -23,8 +23,6 @@ namespace FirstPlugin
{ {
public class BNTX : TreeNodeFile, IFileFormat, IContextMenuNode public class BNTX : TreeNodeFile, IFileFormat, IContextMenuNode
{ {
public List<STGenericTexture> IconTextureList { get; set; }
public FileType FileType { get; set; } = FileType.Image; public FileType FileType { get; set; } = FileType.Image;
public bool CanSave { get; set; } public bool CanSave { get; set; }
@ -57,6 +55,20 @@ namespace FirstPlugin
return types.ToArray(); return types.ToArray();
} }
} }
public List<STGenericTexture> IconTextureList
{
get
{
List<STGenericTexture> textures = new List<STGenericTexture>();
foreach (STGenericTexture node in Nodes)
textures.Add(node);
return textures;
}
set { }
}
class MenuExt : IFileMenuExtension class MenuExt : IFileMenuExtension
{ {
public STToolStripItem[] NewFileMenuExtensions => newFileExt; public STToolStripItem[] NewFileMenuExtensions => newFileExt;

View file

@ -51,7 +51,10 @@ namespace FirstPlugin
alphaControl.AlphaFunction = ParseAlphaFunction(renderInfo.ValueString); alphaControl.AlphaFunction = ParseAlphaFunction(renderInfo.ValueString);
break; break;
case "gsys_alpha_test_value": case "gsys_alpha_test_value":
if (renderInfo.ValueFloat != null)
alphaControl.AlphaTestRef = renderInfo.ValueFloat[0]; alphaControl.AlphaTestRef = renderInfo.ValueFloat[0];
if (renderInfo.ValueString != null)
float.TryParse(renderInfo.ValueString[0], out alphaControl.AlphaTestRef);
break; break;
case "gsys_color_blend_alpha_dst_func": case "gsys_color_blend_alpha_dst_func":
break; break;

View file

@ -194,17 +194,34 @@ namespace FirstPlugin
ColorDialog dialog = new ColorDialog(); ColorDialog dialog = new ColorDialog();
if (dialog.ShowDialog() == DialogResult.OK) if (dialog.ShowDialog() == DialogResult.OK)
{ {
if (button.Name.Contains("color0")) Color output;
ActiveEmitter.Color0Array[index].Color = dialog.Color;
else
ActiveEmitter.Color1Array[index].Color = dialog.Color;
button.Color = dialog.Color; if (button.Name.Contains("color0"))
output = SetColor(ActiveEmitter.Color0Array[index].Color, dialog.Color);
else
output = SetColor(ActiveEmitter.Color1Array[index].Color, dialog.Color);
SetEmitterColor(output, index, button.Name.Contains("color0"));
button.Color = output;
RefreshColorBoxes(); RefreshColorBoxes();
} }
} }
} }
private void SetEmitterColor(Color color, int index, bool IsColor0)
{
if (IsColor0)
ActiveEmitter.Color0Array[index].Color = color;
else
ActiveEmitter.Color1Array[index].Color = color;
}
public Color SetColor(Color input, Color output)
{
return Color.FromArgb(input.A, output.R, output.G, output.B);
}
private void hexTB_TextChanged(object sender, EventArgs e) private void hexTB_TextChanged(object sender, EventArgs e)
{ {
if (!IsColorsLoaded) if (!IsColorsLoaded)