Skip to content

Commit

Permalink
FLVER2 static update
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadowth117 committed Oct 7, 2023
1 parent 614cd04 commit 922f93a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
18 changes: 17 additions & 1 deletion AquaModelLibrary/Extra/SoulsConvert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,12 @@ public static AquaObject FlverToAqua(IFlver flver, out AquaNode aqn, bool useMet
useNormalWTransform = true;
}
break;
case FLVER.LayoutSemantic.BoneIndices:
foundBoneIndices = true;
break;
case FLVER.LayoutSemantic.BoneWeights:
foundBoneWeights = true;
break;
}
}
}
Expand Down Expand Up @@ -974,10 +980,20 @@ public static AquaObject FlverToAqua(IFlver flver, out AquaNode aqn, bool useMet
{
var f2Mesh = (FLVER2.Mesh)mesh;
bool useDefaultBoneIndex = false;
if (f2Mesh.Dynamic == 0)
if (f2Mesh.Dynamic == 0 && vert.NormalW < flver.Bones.Count)
{
boneTransformationIndex = vert.NormalW;
}
else if (useIndexNoWeightTransform && vert.BoneIndices[0] != -1 && f2Mesh.Dynamic == 0)
{
if(f2Mesh.BoneIndices?.Count > 0 && f2Mesh.BoneIndices[0] != -1)
{
boneTransformationIndex = f2Mesh.BoneIndices[vert.BoneIndices[0]];
} else
{
boneTransformationIndex = vert.BoneIndices[0];
}
}
else if (useDefaultBoneTransform && flver.Bones.Count > f2Mesh.DefaultBoneIndex)
{
boneTransformationIndex = f2Mesh.DefaultBoneIndex;
Expand Down
9 changes: 8 additions & 1 deletion AquaModelLibrary/Nova/AAIMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@ public static AquaMotion ReadAAI(string filePath)
List<NodeOffsetSet> sets = new List<NodeOffsetSet>();
for (int j = 0; j < keyNodeCount; j++)
{
NodeOffsetSet set = streamReader.Read<NodeOffsetSet>();
NodeOffsetSet set = new NodeOffsetSet() { nodeId = streamReader.Read<ushort>(), offset = streamReader.Read<ushort>()};
if (j < nodes.Count)
{
set.nodeName = nodes[j].name;
} else
{
set.nodeName = $"node_{j}";
}
sets.Add(set);
}
setsList.Add(sets);
Expand Down
1 change: 1 addition & 0 deletions AquaModelLibrary/Nova/Structures/NodeOffsetSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace AquaModelLibrary.Nova.Structures
{
public struct NodeOffsetSet
{
public string nodeName;
public ushort nodeId;
public ushort offset;
}
Expand Down

0 comments on commit 922f93a

Please sign in to comment.