Plugins/Assimp: Fix handling of attachments nodes

This commit is contained in:
SirLynix 2023-01-12 23:13:20 +01:00
parent cc1246dcac
commit 3de7297bd8
1 changed files with 10 additions and 1 deletions

View File

@ -506,7 +506,16 @@ std::shared_ptr<Nz::SubMesh> ProcessSubMesh(const std::filesystem::path& originP
for (unsigned int boneIndex = 0; boneIndex < meshData->mNumBones; ++boneIndex)
{
const aiBone* bone = meshData->mBones[boneIndex];
unsigned int jointIndex = Nz::Retrieve(boneToJointIndex, bone);
auto it = boneToJointIndex.find(bone);
if (it == boneToJointIndex.end())
{
// Some nodes are not attached to vertices but may influence other nodes or serve as attachment points
assert(bone->mNumWeights == 0);
continue;
}
unsigned int jointIndex = it->second;
for (unsigned int weightIndex = 0; weightIndex < bone->mNumWeights; ++weightIndex)
{