Remove incorrect animation data in some b3d models, see #4829

This commit is contained in:
Benau 2023-01-05 11:15:50 +08:00
parent 8544f19b59
commit 7ecaf74dd3

View File

@ -142,13 +142,20 @@ SP::SPMesh* B3DMeshLoader::toSPM(scene::CSkinnedMesh* mesh)
wi[b].push_back(core::array<JointInfluence>());
}
const bool skinned_mesh = !mesh->RootJoints.empty() &&
bool skinned_mesh = !mesh->RootJoints.empty() &&
mesh->getFrameCount() > 0;
unsigned idx = 0;
if (skinned_mesh)
{
unsigned idx = 0;
for (unsigned i = 0; i < mesh->RootJoints.size(); i++)
computeWeightInfluence(mesh->RootJoints[i], idx, wi);
}
// Some b3d models has incorrect animation data, remove it and treat them
// as static mesh
if (idx == 0)
skinned_mesh = false;
if (skinned_mesh)
{
spm->m_total_joints = idx;
spm->m_joint_using = idx;
spm->m_bind_frame = m_straight_frame;