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 e3ea920741
commit f362c9363b

View file

@ -747,17 +747,22 @@ uint CExportNel::buildSkinning (CMesh::CMeshBuild& buildMesh, const TInodePtrInt
for (uint bone=0; bone<boneCount; bone++)
{
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
float weight=blendedInterface->GetWeight(bone);
// Get node
INode *node=blendedInterface->GetNode(bone);
nlassert (node);
// Insert in the map
weightMap.insert (std::map<float, INode*>::value_type (weight, node));
}
}
else
{
// Get node
@ -1191,17 +1196,31 @@ void CExportNel::addSkeletonBindPos (INode& skinedNode, mapBoneBindPos& boneBind
for (boneIndex=0; boneIndex<count; boneIndex++)
{
// 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
Matrix3 bindPos;
int res=physiqueInterface->GetInitNodeTM (bone, bindPos);
nlassert (res==MATRIX_RETURNED);
int res = physiqueInterface->GetInitNodeTM (bone, bindPos);
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
if (boneBindPos.insert (mapBoneBindPos::value_type (bone, bindPos)).second)
{
#ifdef NL_DEBUG
#ifdef NL_DEBUG
// *** Debug info
// Bone name
@ -1237,6 +1256,7 @@ void CExportNel::addSkeletonBindPos (INode& skinedNode, mapBoneBindPos& boneBind
}
}
}
}
// Release vertex interfaces
localData->ReleaseVertexInterface (vertexInterface);