Add errors if a bone does not exist from an imported model.

This commit is contained in:
KillzXGaming 2019-04-30 17:42:35 -04:00
parent 02b4c1682c
commit 8fbd734096
7 changed files with 25 additions and 0 deletions

Binary file not shown.

View file

@ -622,7 +622,15 @@ namespace Bfres.Structs
shape.CreateIndexList(obj, this);
shape.ApplyImportSettings(csvsettings, GetMaterial(shape.MaterialIndex));
shape.BoneIndices = shape.GetIndices(Skeleton);
shape.VertexSkinCount = obj.GetMaxSkinInfluenceCount();
if (shape.VertexSkinCount == 1)
{
int boneIndex = shape.BoneIndices[0];
shape.BoneIndex = boneIndex;
}
Console.WriteLine($"VertexSkinCount {shape.VertexSkinCount}");
shape.SaveShape(IsWiiU);
shape.SaveVertexBuffer();

View file

@ -726,17 +726,23 @@ namespace Bfres.Structs
CurNode++;
}
List<string> BonesNotMatched = new List<string>();
int vtxIndex = 0;
foreach (Vertex v in ob.vertices)
{
List<int> RigidIds = new List<int>();
foreach (string bn in v.boneNames)
{
bool HasMatch = false;
int i = 0;
foreach (var defBn in nodeArrStrings.Select((Value, Index) => new { Value, Index }))
{
if (bn == defBn.Value)
{
HasMatch = true;
//Add these after smooth matrices
if (nodeRigidIndex[i] != -1)
{
@ -753,7 +759,14 @@ namespace Bfres.Structs
}
i++;
}
if (!HasMatch && !BonesNotMatched.Contains(bn))
{
BonesNotMatched.Add(bn);
STConsole.WriteLine($"No bone matches {bn}. Vertices will remain unmapped for this bone!", System.Drawing.Color.Red);
}
}
if (RigidIds.Count > 0)
{
foreach (int id in RigidIds)
@ -762,7 +775,11 @@ namespace Bfres.Structs
v.boneIds.Add(id);
}
}
vtxIndex++;
}
BonesNotMatched.Clear();
}
public void CreateNewBoundingBoxes()
{