1
0
mirror of synced 2025-01-19 01:14:08 +01:00

Automatically link attributes again to prevent any crash issues

This commit is contained in:
KillzXGaming 2019-05-27 20:32:26 -04:00
parent f787c59627
commit 0d7dfb734b
3 changed files with 27 additions and 1 deletions

View File

@ -751,6 +751,19 @@ namespace FirstPlugin
{
MemoryStream mem = new MemoryStream();
var Models = GetModels();
if (Models != null)
{
foreach (FMDL mdl in Models)
{
for (int s = 0; s < mdl.shapes.Count; s++)
{
SetShaderAssignAttributes(mdl.shapes[s]);
}
}
}
if (IsWiiU)
SaveWiiU(mem);
else
@ -759,6 +772,17 @@ namespace FirstPlugin
return mem.ToArray();
}
public TreeNodeCollection GetModels()
{
foreach (var folder in Nodes)
{
if (folder is BFRESGroupNode && ((BFRESGroupNode)folder).Type == BRESGroupType.Models)
return ((BFRESGroupNode)folder).Nodes;
}
return null;
}
public ResFile resFile = null;
public ResU.ResFile resFileU = null;
@ -1513,8 +1537,10 @@ namespace FirstPlugin
}
}
public static void SetShaderAssignAttributes(FMAT.ShaderAssign shd, FSHP shape)
public static void SetShaderAssignAttributes(FSHP shape)
{
var shd = shape.GetMaterial().shaderassign;
foreach (var att in shape.vertexAttributes)
{
if (!shd.attributes.ContainsValue(att.Name))