1
0
mirror of synced 2024-12-02 02:57:23 +01:00

Get textures in the active bfres first for texture pattern animations to avoid conflicts

This commit is contained in:
KillzXGaming 2019-07-12 21:01:16 -04:00
parent 46c7141486
commit c02e248a7b
6 changed files with 29 additions and 11 deletions

Binary file not shown.

View File

@ -499,19 +499,28 @@ namespace Bfres.Structs
public override STGenericTexture GetActiveTexture(int index)
{
string name = "";
try
{
name = MatAnimWrapper.Textures[(int)index];
}
catch
{
throw new Exception("Index out of range " + index);
}
var bfres = (BFRES)MatAnimWrapper.Parent.Parent.Parent;
var BfresTextures = bfres.GetBNTX;
if (BfresTextures != null)
{
if (BfresTextures.Textures.ContainsKey(name))
return BfresTextures.Textures[name];
}
foreach (var bntx in PluginRuntime.bntxContainers)
{
try
{
string name = MatAnimWrapper.Textures[(int)index];
if (bntx.Textures.ContainsKey(name))
return bntx.Textures[name];
}
catch
{
throw new Exception("Index out of range " + index);
}
if (bntx.Textures.ContainsKey(name))
return bntx.Textures[name];
}
return null;
}

View File

@ -149,6 +149,15 @@ namespace Bfres.Structs
public override STGenericTexture GetActiveTexture(int index)
{
string name = GetActiveTextureNameByIndex(index);
var bfres = (BFRES)AnimWrapper.Parent.Parent.Parent;
var BfresTextures = bfres.GetFTEXContainer;
if (BfresTextures != null)
{
if (BfresTextures.ResourceNodes.ContainsKey(name))
return (STGenericTexture)BfresTextures.ResourceNodes[name];
}
foreach (var ftexFolder in PluginRuntime.ftexContainers)
{
if (ftexFolder.ResourceNodes.ContainsKey(name))