Merge pull request #35 from tarocco/meshupload

Improved mesh model (DAE) loader compatibility
This commit is contained in:
Rye Mutt
2020-10-01 00:10:21 -04:00
committed by GitHub

View File

@@ -1258,6 +1258,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" );
@@ -1483,8 +1485,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
//Now that we've parsed the joint array, let's determine if we have a full rig //Now that we've parsed the joint array, let's determine if we have a full rig
//(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 )
@@ -1720,7 +1721,11 @@ void LLDAELoader::processJointToNodeMapping( domNode* pNode )
std::string nodeName = pNode->getName(); std::string nodeName = pNode->getName();
if (!nodeName.empty()) if (!nodeName.empty())
{ {
mJointsFromNode.push_front(pNode->getName()); mJointsFromNode.push_front(nodeName);
// Alias joint node SIDs to joint names for compatibility
std::string nodeSID = pNode->getSid();
if(!nodeSID.empty())
mJointMap[nodeSID] = mJointMap[nodeName];
} }
//2. Handle the kiddo's //2. Handle the kiddo's
processChildJoints(pNode); processChildJoints(pNode);