summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llmodelloader.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2015-11-09 14:57:00 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2015-11-09 14:57:00 -0500
commitbe11d020ca6b941ec86622718c9eeafd5fddb7b5 (patch)
tree7e59f74dd279f6f6d5ff1ee221216bf7709097dd /indra/llprimitive/llmodelloader.cpp
parent3cf938bcec9a4925a4f7d8becb9b89ff559eb2e3 (diff)
SL-266 WIP - removed obsolete rigParityWithScene code, set legacy and joint offset upload based on AND-ing state of all meshes in file.
Diffstat (limited to 'indra/llprimitive/llmodelloader.cpp')
-rw-r--r--indra/llprimitive/llmodelloader.cpp96
1 files changed, 39 insertions, 57 deletions
diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp
index 4acf695f22..b12d1042da 100644
--- a/indra/llprimitive/llmodelloader.cpp
+++ b/indra/llprimitive/llmodelloader.cpp
@@ -126,9 +126,8 @@ LLModelLoader::LLModelLoader(
, mTextureLoadFunc(texture_load_func)
, mStateCallback(state_cb)
, mOpaqueData(opaque_userdata)
-, mRigParityWithScene(false)
-, mRigValidJointUpload(false)
-, mLegacyRigValid(false)
+, mRigValidJointUpload(true)
+, mLegacyRigValid(true)
, mNoNormalize(false)
, mNoOptimize(false)
, mCacheOnlyHitIfRigged(false)
@@ -461,15 +460,6 @@ void LLModelLoader::loadModelCallback()
//-----------------------------------------------------------------------------
void LLModelLoader::critiqueRigForUploadApplicability( const std::vector<std::string> &jointListFromAsset )
{
- critiqueJointToNodeMappingFromScene();
-
- if (jointListFromAsset.size()>mMaxJointsPerMesh)
- {
- LL_WARNS() << "Rigged to " << jointListFromAsset.size() << " joints, max is " << mMaxJointsPerMesh << LL_ENDL;
- LL_WARNS() << "Skinning disabled" << LL_ENDL;
- return;
- }
-
//Determines the following use cases for a rig:
//1. It is suitable for upload with skin weights & joint positions, or
//2. It is suitable for upload as standard av with just skin weights
@@ -477,59 +467,27 @@ void LLModelLoader::critiqueRigForUploadApplicability( const std::vector<std::st
bool isJointPositionUploadOK = isRigSuitableForJointPositionUpload( jointListFromAsset );
bool isRigLegacyOK = isRigLegacy( jointListFromAsset );
- //It's OK that both could end up being true, both default to false
- if ( isJointPositionUploadOK )
+ // It's OK that both could end up being true.
+
+ // Both start out as true and are forced to false if any mesh in
+ // the model file is not vald by that criterion. Note that a file
+ // can contain multiple meshes.
+ if ( !isJointPositionUploadOK )
{
- setRigValidForJointPositionUpload( true );
+ // This starts out true, becomes false if false for any loaded
+ // model. May be multiple loaded models.
+ setRigValidForJointPositionUpload( false );
}
- if ( isRigLegacyOK)
+ if ( !isRigLegacyOK)
{
- setLegacyRigValid( true );
+ // This starts out true, becomes false if false for any loaded
+ // model. May be multiple loaded models.
+ setLegacyRigValid( false );
}
}
-//-----------------------------------------------------------------------------
-// critiqueJointToNodeMappingFromScene()
-//-----------------------------------------------------------------------------
-void LLModelLoader::critiqueJointToNodeMappingFromScene( void )
-{
- //Do the actual nodes back the joint listing from the dae?
- //if yes then this is a fully rigged asset, otherwise it's just a partial rig
-
- JointNameSet::iterator jointsFromNodeIt = mJointsFromNode.begin();
- JointNameSet::iterator jointsFromNodeEndIt = mJointsFromNode.end();
- bool result = true;
- if ( !mJointsFromNode.empty() )
- {
- for ( ;jointsFromNodeIt!=jointsFromNodeEndIt;++jointsFromNodeIt )
- {
- std::string name = *jointsFromNodeIt;
- if ( mJointTransformMap.find( name ) != mJointTransformMap.end() )
- {
- continue;
- }
- else
- {
- LL_INFOS() <<"critiqueJointToNodeMappingFromScene is missing a: " << name << LL_ENDL;
- result = false;
- }
- }
- }
- else
- {
- result = false;
- }
-
- //Determines the following use cases for a rig:
- //1. Full av rig w/1-1 mapping from the scene and joint array
- //2. Partial rig but w/o parity between the scene and joint array
- if ( result )
- {
- setRigWithSceneParity( true );
- }
-}
//-----------------------------------------------------------------------------
// isRigLegacy()
//-----------------------------------------------------------------------------
@@ -541,6 +499,30 @@ bool LLModelLoader::isRigLegacy( const std::vector<std::string> &jointListFromAs
return false;
}
+ // Too many joints in asset
+ if (jointListFromAsset.size()>mMaxJointsPerMesh)
+ {
+ LL_WARNS() << "Rigged to " << jointListFromAsset.size() << " joints, max is " << mMaxJointsPerMesh << LL_ENDL;
+ LL_WARNS() << "Skinning disabled" << LL_ENDL;
+ return false;
+ }
+
+ // Unknown joints in asset
+ S32 unknown_joint_count = 0;
+ for (std::vector<std::string>::const_iterator it = jointListFromAsset.begin();
+ it != jointListFromAsset.end(); ++it)
+ {
+ if (mJointMap.find(*it)==mJointMap.end())
+ {
+ LL_WARNS() << "Rig to unrecognized name " << *it << ", isRigLegacy() will fail" << LL_ENDL;
+ unknown_joint_count++;
+ }
+ }
+ if (unknown_joint_count>0)
+ {
+ return false;
+ }
+
bool result = false;
JointNameSet :: const_iterator masterJointIt = mMasterLegacyJointList.begin();