Improved mesh model (DAE) loader compatibility

Added dynamic SID joint resolution for skinning (adds compatibility for DAE files made using MAXON Cinema 4D)
This commit is contained in:
Tarocco
2020-09-06 20:51:14 -07:00
parent f941bc4334
commit 386528a892

View File

@@ -1266,6 +1266,8 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
skin_info.mBindShapeMatrix = trans; skin_info.mBindShapeMatrix = trans;
} }
// Build the joint to node mapping array and update joint aliases (mJointMap)
buildJointToNodeMappingFromScene(root);
//Some collada setup for accessing the skeleton //Some collada setup for accessing the skeleton
U32 skeleton_count = dae->getDatabase()->getElementCount( NULL, "skeleton" ); U32 skeleton_count = dae->getDatabase()->getElementCount( NULL, "skeleton" );
@@ -1492,7 +1494,6 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
//(which means we have all the joint sthat are required for an avatar versus //(which means we have all the joint sthat are required for an avatar versus
//a skinned asset attached to a node in a file that contains an entire skeleton, //a skinned asset attached to a node in a file that contains an entire skeleton,
//but does not use the skeleton). //but does not use the skeleton).
buildJointToNodeMappingFromScene( root );
critiqueRigForUploadApplicability( model->mSkinInfo.mJointNames ); critiqueRigForUploadApplicability( model->mSkinInfo.mJointNames );
if ( !missingSkeletonOrScene ) if ( !missingSkeletonOrScene )
@@ -1729,6 +1730,8 @@ void LLDAELoader::processJointToNodeMapping( domNode* pNode )
if (!nodeName.empty()) if (!nodeName.empty())
{ {
mJointsFromNode.push_front(pNode->getName()); mJointsFromNode.push_front(pNode->getName());
// Alias joint node SIDs to joint names for compatibility
mJointMap[pNode->getSid()] = mJointMap[pNode->getName()];
} }
//2. Handle the kiddo's //2. Handle the kiddo's
processChildJoints(pNode); processChildJoints(pNode);