Changed: #964 Skip over deleted bones in skinning when exporting from max.

This commit is contained in:
kaetemi 2010-09-01 15:15:30 +02:00
parent d0388890e9
commit 773d034a30

View file

@ -747,17 +747,22 @@ uint CExportNel::buildSkinning (CMesh::CMeshBuild& buildMesh, const TInodePtrInt
for (uint bone=0; bone<boneCount; bone++) for (uint bone=0; bone<boneCount; bone++)
{ {
if (blendedInterface) if (blendedInterface)
{
// Get node
INode *node=blendedInterface->GetNode(bone);
if (node == NULL)
{
nlwarning("node == NULL; bone = %i / %i", bone, boneCount);
}
else
{ {
// Get the bone weight // Get the bone weight
float weight=blendedInterface->GetWeight(bone); float weight=blendedInterface->GetWeight(bone);
// Get node
INode *node=blendedInterface->GetNode(bone);
nlassert (node);
// Insert in the map // Insert in the map
weightMap.insert (std::map<float, INode*>::value_type (weight, node)); weightMap.insert (std::map<float, INode*>::value_type (weight, node));
} }
}
else else
{ {
// Get node // Get node
@ -1191,17 +1196,31 @@ void CExportNel::addSkeletonBindPos (INode& skinedNode, mapBoneBindPos& boneBind
for (boneIndex=0; boneIndex<count; boneIndex++) for (boneIndex=0; boneIndex<count; boneIndex++)
{ {
// Get the bone pointer // Get the bone pointer
INode *bone=blendedInterface->GetNode(boneIndex); INode *bone = blendedInterface->GetNode(boneIndex);
if (bone == NULL)
{
nlwarning("bone == NULL; boneIndex = %i / %i", boneIndex, count);
}
else
{
// Get the bind matrix of the bone // Get the bind matrix of the bone
Matrix3 bindPos; Matrix3 bindPos;
int res=physiqueInterface->GetInitNodeTM (bone, bindPos); int res = physiqueInterface->GetInitNodeTM (bone, bindPos);
nlassert (res==MATRIX_RETURNED);
if (res != MATRIX_RETURNED)
{
nlwarning("res != MATRIX_RETURNED; res = %i; boneIndex = %i / %i", res, boneIndex, count);
nlwarning("bone = %i", (uint32)(void *)bone);
std::string boneName = getName (*bone);
nlwarning("boneName = %s", boneName.c_str());
nlassert(false);
}
// Add an entry inthe map // Add an entry inthe map
if (boneBindPos.insert (mapBoneBindPos::value_type (bone, bindPos)).second) if (boneBindPos.insert (mapBoneBindPos::value_type (bone, bindPos)).second)
{ {
#ifdef NL_DEBUG #ifdef NL_DEBUG
// *** Debug info // *** Debug info
// Bone name // Bone name
@ -1237,6 +1256,7 @@ void CExportNel::addSkeletonBindPos (INode& skinedNode, mapBoneBindPos& boneBind
} }
} }
} }
}
// Release vertex interfaces // Release vertex interfaces
localData->ReleaseVertexInterface (vertexInterface); localData->ReleaseVertexInterface (vertexInterface);