From 3de7297bd81c42beae295353458b9fb650448728 Mon Sep 17 00:00:00 2001 From: SirLynix Date: Thu, 12 Jan 2023 23:13:20 +0100 Subject: [PATCH] Plugins/Assimp: Fix handling of attachments nodes --- plugins/Assimp/Plugin.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/Assimp/Plugin.cpp b/plugins/Assimp/Plugin.cpp index c8b633e58..81476d2c7 100644 --- a/plugins/Assimp/Plugin.cpp +++ b/plugins/Assimp/Plugin.cpp @@ -506,7 +506,16 @@ std::shared_ptr 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) {