mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
fix: parentIndex is relative to current bone index
This commit is contained in:
parent
f653530714
commit
75e22b1750
@ -314,10 +314,13 @@ namespace
|
|||||||
// Other boneInfo data is filled when calculating bone bounds
|
// Other boneInfo data is filled when calculating bone bounds
|
||||||
xmodel.boneInfo[boneIndex].collmap = -1;
|
xmodel.boneInfo[boneIndex].collmap = -1;
|
||||||
|
|
||||||
if (xmodel.numRootBones < boneIndex)
|
if (xmodel.numRootBones <= boneIndex)
|
||||||
{
|
{
|
||||||
const auto nonRootIndex = boneIndex - xmodel.numRootBones;
|
const auto nonRootIndex = boneIndex - xmodel.numRootBones;
|
||||||
xmodel.parentList[nonRootIndex] = static_cast<unsigned char>(bone.parentIndex.value_or(0u));
|
const auto parentBoneIndex = static_cast<unsigned char>(bone.parentIndex.value_or(0u));
|
||||||
|
assert(parentBoneIndex < boneIndex);
|
||||||
|
|
||||||
|
xmodel.parentList[nonRootIndex] = static_cast<unsigned char>(boneIndex - parentBoneIndex);
|
||||||
|
|
||||||
auto& trans = xmodel.trans[nonRootIndex];
|
auto& trans = xmodel.trans[nonRootIndex];
|
||||||
trans.x = bone.localOffset[0];
|
trans.x = bone.localOffset[0];
|
||||||
|
@ -136,7 +136,7 @@ namespace
|
|||||||
if (model->partClassification[boneNum])
|
if (model->partClassification[boneNum])
|
||||||
{
|
{
|
||||||
if (boneNum < model->numRootBones
|
if (boneNum < model->numRootBones
|
||||||
|| model->partClassification[model->parentList[boneNum - model->numRootBones]] != model->partClassification[boneNum])
|
|| model->partClassification[boneNum - model->parentList[boneNum - model->numRootBones]] != model->partClassification[boneNum])
|
||||||
{
|
{
|
||||||
std::cerr << std::format("Part: {:02} = {}\n", model->partClassification[boneNum], bone.name);
|
std::cerr << std::format("Part: {:02} = {}\n", model->partClassification[boneNum], bone.name);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user