From ebad0c6868b924ba607a1b2256ae7621cab62bf4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 1 Oct 2015 11:05:29 -0400 Subject: DRTVWR-412 WIP - more work for importer merge from viewer-release --- indra/llprimitive/llmodelloader.cpp | 63 ++++++++++++++----------------------- 1 file changed, 23 insertions(+), 40 deletions(-) (limited to 'indra/llprimitive/llmodelloader.cpp') diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index 81d92d151b..9cf0f10a7e 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -102,16 +102,17 @@ void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3& // LLModelLoader //----------------------------------------------------------------------------- LLModelLoader::LLModelLoader( - std::string filename, - S32 lod, + std::string filename, + S32 lod, load_callback_t load_cb, joint_lookup_func_t joint_lookup_func, texture_load_func_t texture_load_func, - state_callback_t state_cb, - void* opaque_userdata, - JointTransformMap& jointMap, - JointSet& jointsFromNodes ) -: mJointList( jointMap ) + state_callback_t state_cb, + void* opaque_userdata, + JointTransformMap& jointTransformMap, + JointNameSet& jointsFromNodes, + JointNameSet& legalJointNames) +: mJointList( jointTransformMap ) , mJointsFromNode( jointsFromNodes ) , LLThread("Model Loader") , mFilename(filename) @@ -127,33 +128,15 @@ LLModelLoader::LLModelLoader( , mNoOptimize(false) , mCacheOnlyHitIfRigged(false) { - mJointMap["mPelvis"] = "mPelvis"; - mJointMap["mTorso"] = "mTorso"; - mJointMap["mChest"] = "mChest"; - mJointMap["mNeck"] = "mNeck"; - mJointMap["mHead"] = "mHead"; - mJointMap["mSkull"] = "mSkull"; - mJointMap["mEyeRight"] = "mEyeRight"; - mJointMap["mEyeLeft"] = "mEyeLeft"; - mJointMap["mCollarLeft"] = "mCollarLeft"; - mJointMap["mShoulderLeft"] = "mShoulderLeft"; - mJointMap["mElbowLeft"] = "mElbowLeft"; - mJointMap["mWristLeft"] = "mWristLeft"; - mJointMap["mCollarRight"] = "mCollarRight"; - mJointMap["mShoulderRight"] = "mShoulderRight"; - mJointMap["mElbowRight"] = "mElbowRight"; - mJointMap["mWristRight"] = "mWristRight"; - mJointMap["mHipRight"] = "mHipRight"; - mJointMap["mKneeRight"] = "mKneeRight"; - mJointMap["mAnkleRight"] = "mAnkleRight"; - mJointMap["mFootRight"] = "mFootRight"; - mJointMap["mToeRight"] = "mToeRight"; - mJointMap["mHipLeft"] = "mHipLeft"; - mJointMap["mKneeLeft"] = "mKneeLeft"; - mJointMap["mAnkleLeft"] = "mAnkleLeft"; - mJointMap["mFootLeft"] = "mFootLeft"; - mJointMap["mToeLeft"] = "mToeLeft"; - + // Recognize all names we've been told are legal. + for (JointNameSet::iterator joint_name_it = legalJointNames.begin(); + joint_name_it != legalJointNames.end(); ++joint_name_it) + { + const std::string& name = *joint_name_it; + mJointMap[name] = name; + } + + // Also support various legacy aliases for commonly used joints mJointMap["avatar_mPelvis"] = "mPelvis"; mJointMap["avatar_mTorso"] = "mTorso"; mJointMap["avatar_mChest"] = "mChest"; @@ -501,8 +484,8 @@ 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 - JointSet::iterator jointsFromNodeIt = mJointsFromNode.begin(); - JointSet::iterator jointsFromNodeEndIt = mJointsFromNode.end(); + JointNameSet::iterator jointsFromNodeIt = mJointsFromNode.begin(); + JointNameSet::iterator jointsFromNodeEndIt = mJointsFromNode.end(); bool result = true; if ( !mJointsFromNode.empty() ) @@ -547,8 +530,8 @@ bool LLModelLoader::isRigLegacy( const std::vector &jointListFromAs bool result = false; - JointSet :: const_iterator masterJointIt = mMasterLegacyJointList.begin(); - JointSet :: const_iterator masterJointEndIt = mMasterLegacyJointList.end(); + JointNameSet :: const_iterator masterJointIt = mMasterLegacyJointList.begin(); + JointNameSet :: const_iterator masterJointEndIt = mMasterLegacyJointList.end(); std::vector :: const_iterator modelJointIt = jointListFromAsset.begin(); std::vector :: const_iterator modelJointItEnd = jointListFromAsset.end(); @@ -581,8 +564,8 @@ bool LLModelLoader::isRigSuitableForJointPositionUpload( const std::vector :: const_iterator modelJointIt = jointListFromAsset.begin(); std::vector :: const_iterator modelJointItEnd = jointListFromAsset.end(); -- cgit v1.2.3 From ded9b10d5dd60cb85934d0ab029e8c5a297d4123 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 29 Oct 2015 16:09:22 -0400 Subject: SL-114 WIP - constrain uploaded meshes based on max joints per mesh. Set max joints per mesh to 110. Also fixed some uninitialized members of LLModelLoader. --- indra/llprimitive/llmodelloader.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive/llmodelloader.cpp') diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index 9cf0f10a7e..4acf695f22 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -111,12 +111,14 @@ LLModelLoader::LLModelLoader( void* opaque_userdata, JointTransformMap& jointTransformMap, JointNameSet& jointsFromNodes, - JointNameSet& legalJointNames) + JointNameSet& legalJointNames, + U32 maxJointsPerMesh) : mJointList( jointTransformMap ) , mJointsFromNode( jointsFromNodes ) , LLThread("Model Loader") , mFilename(filename) , mLod(lod) +, mTrySLM(false) , mFirstTransform(TRUE) , mNumOfFetchingTextures(0) , mLoadCallback(load_cb) @@ -124,9 +126,13 @@ LLModelLoader::LLModelLoader( , mTextureLoadFunc(texture_load_func) , mStateCallback(state_cb) , mOpaqueData(opaque_userdata) +, mRigParityWithScene(false) +, mRigValidJointUpload(false) +, mLegacyRigValid(false) , mNoNormalize(false) , mNoOptimize(false) , mCacheOnlyHitIfRigged(false) +, mMaxJointsPerMesh(maxJointsPerMesh) { // Recognize all names we've been told are legal. for (JointNameSet::iterator joint_name_it = legalJointNames.begin(); @@ -456,7 +462,14 @@ void LLModelLoader::loadModelCallback() void LLModelLoader::critiqueRigForUploadApplicability( const std::vector &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 -- cgit v1.2.3 From be11d020ca6b941ec86622718c9eeafd5fddb7b5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 9 Nov 2015 14:57:00 -0500 Subject: SL-266 WIP - removed obsolete rigParityWithScene code, set legacy and joint offset upload based on AND-ing state of all meshes in file. --- indra/llprimitive/llmodelloader.cpp | 96 +++++++++++++++---------------------- 1 file changed, 39 insertions(+), 57 deletions(-) (limited to 'indra/llprimitive/llmodelloader.cpp') 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 &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 &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::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(); -- cgit v1.2.3 From b72480ddb9b01202f1bbe4bfb84595549faeacf3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 10 Nov 2015 15:52:41 -0500 Subject: SL-114 WIP - made mesh upload errors/warnings slightly more informative and less spammy. --- indra/llprimitive/llmodelloader.cpp | 74 ++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 43 deletions(-) (limited to 'indra/llprimitive/llmodelloader.cpp') diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index b12d1042da..bdecfe243b 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -475,14 +475,14 @@ void LLModelLoader::critiqueRigForUploadApplicability( const std::vector &jointListFromAs if (jointListFromAsset.size()>mMaxJointsPerMesh) { LL_WARNS() << "Rigged to " << jointListFromAsset.size() << " joints, max is " << mMaxJointsPerMesh << LL_ENDL; - LL_WARNS() << "Skinning disabled" << LL_ENDL; + LL_WARNS() << "Skinning disabled due to too many joints" << LL_ENDL; return false; } @@ -514,77 +514,65 @@ bool LLModelLoader::isRigLegacy( const std::vector &jointListFromAs { if (mJointMap.find(*it)==mJointMap.end()) { - LL_WARNS() << "Rig to unrecognized name " << *it << ", isRigLegacy() will fail" << LL_ENDL; + LL_WARNS() << "Rigged to unrecognized joint name " << *it << LL_ENDL; unknown_joint_count++; } } if (unknown_joint_count>0) { + LL_WARNS() << "Skinning disabled due to unknown joints" << LL_ENDL; return false; } - bool result = false; - + // Note that this is basically the same code as + // isRigSuitableForJointPositionUpload(), but the set of joints is + // different. JointNameSet :: const_iterator masterJointIt = mMasterLegacyJointList.begin(); JointNameSet :: const_iterator masterJointEndIt = mMasterLegacyJointList.end(); std::vector :: const_iterator modelJointIt = jointListFromAsset.begin(); std::vector :: const_iterator modelJointItEnd = jointListFromAsset.end(); - + + S32 missing_joint_count = 0; for ( ;masterJointIt!=masterJointEndIt;++masterJointIt ) { - result = false; - modelJointIt = jointListFromAsset.begin(); - - for ( ;modelJointIt!=modelJointItEnd; ++modelJointIt ) - { - if ( *masterJointIt == *modelJointIt ) - { - result = true; - break; - } - } - if ( !result ) - { - LL_INFOS() <<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< LL_ENDL; - break; - } + if (std::find(modelJointIt,modelJointItEnd,*masterJointIt)==modelJointItEnd) + { + LL_INFOS() <<" Asset did not contain a joint required for skinned mesh upload: " << *masterJointIt<< LL_ENDL; + missing_joint_count++; + } } - return result; + if (missing_joint_count>0) + { + LL_WARNS() << "Skinning disabled due to missing joints" << LL_ENDL; + } + return missing_joint_count==0; } //----------------------------------------------------------------------------- // isRigSuitableForJointPositionUpload() //----------------------------------------------------------------------------- bool LLModelLoader::isRigSuitableForJointPositionUpload( const std::vector &jointListFromAsset ) { - bool result = false; - JointNameSet :: const_iterator masterJointIt = mMasterJointList.begin(); JointNameSet :: const_iterator masterJointEndIt = mMasterJointList.end(); std::vector :: const_iterator modelJointIt = jointListFromAsset.begin(); std::vector :: const_iterator modelJointItEnd = jointListFromAsset.end(); + S32 missing_joint_count = 0; for ( ;masterJointIt!=masterJointEndIt;++masterJointIt ) { - result = false; - modelJointIt = jointListFromAsset.begin(); - - for ( ;modelJointIt!=modelJointItEnd; ++modelJointIt ) - { - if ( *masterJointIt == *modelJointIt ) - { - result = true; - break; - } - } - if ( !result ) - { - LL_INFOS() <<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< LL_ENDL; - break; - } + if (std::find(modelJointIt,modelJointItEnd,*masterJointIt)==modelJointItEnd) + { + LL_INFOS() <<" Asset did not contain a joint required for joint position upload: " << *masterJointIt<< LL_ENDL; + missing_joint_count++; + } } - return result; + if (missing_joint_count>0) + { + LL_WARNS() << "Joint upload disabled due to missing joints" << LL_ENDL; + } + return missing_joint_count==0; } -- cgit v1.2.3 From 146919fa764bed09bfa5e27bc30d02ce2afb6188 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Wed, 11 Nov 2015 13:44:51 -0800 Subject: animations and meshes will recognize all joint names in joint_aliases.xml --- indra/llprimitive/llmodelloader.cpp | 71 +++++++++++-------------------------- 1 file changed, 21 insertions(+), 50 deletions(-) (limited to 'indra/llprimitive/llmodelloader.cpp') diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index 9cf0f10a7e..b4bd467c64 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -111,7 +111,8 @@ LLModelLoader::LLModelLoader( void* opaque_userdata, JointTransformMap& jointTransformMap, JointNameSet& jointsFromNodes, - JointNameSet& legalJointNames) + JointNameSet& legalJointNames, + std::string jointAliasFilename) : mJointList( jointTransformMap ) , mJointsFromNode( jointsFromNodes ) , LLThread("Model Loader") @@ -135,57 +136,27 @@ LLModelLoader::LLModelLoader( const std::string& name = *joint_name_it; mJointMap[name] = name; } + // Also support various legacy aliases for commonly used joints - mJointMap["avatar_mPelvis"] = "mPelvis"; - mJointMap["avatar_mTorso"] = "mTorso"; - mJointMap["avatar_mChest"] = "mChest"; - mJointMap["avatar_mNeck"] = "mNeck"; - mJointMap["avatar_mHead"] = "mHead"; - mJointMap["avatar_mSkull"] = "mSkull"; - mJointMap["avatar_mEyeRight"] = "mEyeRight"; - mJointMap["avatar_mEyeLeft"] = "mEyeLeft"; - mJointMap["avatar_mCollarLeft"] = "mCollarLeft"; - mJointMap["avatar_mShoulderLeft"] = "mShoulderLeft"; - mJointMap["avatar_mElbowLeft"] = "mElbowLeft"; - mJointMap["avatar_mWristLeft"] = "mWristLeft"; - mJointMap["avatar_mCollarRight"] = "mCollarRight"; - mJointMap["avatar_mShoulderRight"] = "mShoulderRight"; - mJointMap["avatar_mElbowRight"] = "mElbowRight"; - mJointMap["avatar_mWristRight"] = "mWristRight"; - mJointMap["avatar_mHipRight"] = "mHipRight"; - mJointMap["avatar_mKneeRight"] = "mKneeRight"; - mJointMap["avatar_mAnkleRight"] = "mAnkleRight"; - mJointMap["avatar_mFootRight"] = "mFootRight"; - mJointMap["avatar_mToeRight"] = "mToeRight"; - mJointMap["avatar_mHipLeft"] = "mHipLeft"; - mJointMap["avatar_mKneeLeft"] = "mKneeLeft"; - mJointMap["avatar_mAnkleLeft"] = "mAnkleLeft"; - mJointMap["avatar_mFootLeft"] = "mFootLeft"; - mJointMap["avatar_mToeLeft"] = "mToeLeft"; - - - mJointMap["hip"] = "mPelvis"; - mJointMap["abdomen"] = "mTorso"; - mJointMap["chest"] = "mChest"; - mJointMap["neck"] = "mNeck"; - mJointMap["head"] = "mHead"; - mJointMap["figureHair"] = "mSkull"; - mJointMap["lCollar"] = "mCollarLeft"; - mJointMap["lShldr"] = "mShoulderLeft"; - mJointMap["lForeArm"] = "mElbowLeft"; - mJointMap["lHand"] = "mWristLeft"; - mJointMap["rCollar"] = "mCollarRight"; - mJointMap["rShldr"] = "mShoulderRight"; - mJointMap["rForeArm"] = "mElbowRight"; - mJointMap["rHand"] = "mWristRight"; - mJointMap["rThigh"] = "mHipRight"; - mJointMap["rShin"] = "mKneeRight"; - mJointMap["rFoot"] = "mFootRight"; - mJointMap["lThigh"] = "mHipLeft"; - mJointMap["lShin"] = "mKneeLeft"; - mJointMap["lFoot"] = "mFootLeft"; - + LLSD aliases_sd; + llifstream input_stream; + input_stream.open(jointAliasFilename.c_str(), std::ios::in | std::ios::binary); + + if(input_stream.is_open()) + { + LLSDSerialize::fromXML(aliases_sd, input_stream); + for(LLSD::map_iterator alias_iter = aliases_sd.beginMap(); + alias_iter != aliases_sd.endMap(); + ++alias_iter) + { + LLSD::String alias_name = alias_iter->first; + LLSD::String joint_name = alias_iter->second; + mJointMap[ alias_name ] = joint_name; + } + input_stream.close(); + } + //move into joint mapper class //1. joints for joint offset verification mMasterJointList.push_front("mPelvis"); -- cgit v1.2.3 From 299c04fa42d04f3ecf717a63d326d99efbe77c88 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 20 Jan 2016 10:52:37 -0500 Subject: SL-319 - removed specific joint requirements for skinned mesh and joint offset uploads. --- indra/llprimitive/llmodelloader.cpp | 80 +------------------------------------ 1 file changed, 2 insertions(+), 78 deletions(-) (limited to 'indra/llprimitive/llmodelloader.cpp') diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index 9bfd6dc3e6..816ebc558a 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -134,41 +134,6 @@ LLModelLoader::LLModelLoader( , mMaxJointsPerMesh(maxJointsPerMesh) , mJointMap(legalJointNamesMap) { - //move into joint mapper class - //1. joints for joint offset verification - mMasterJointList.push_front("mPelvis"); - mMasterJointList.push_front("mTorso"); - mMasterJointList.push_front("mChest"); - mMasterJointList.push_front("mNeck"); - mMasterJointList.push_front("mHead"); - mMasterJointList.push_front("mCollarLeft"); - mMasterJointList.push_front("mShoulderLeft"); - mMasterJointList.push_front("mElbowLeft"); - mMasterJointList.push_front("mWristLeft"); - mMasterJointList.push_front("mCollarRight"); - mMasterJointList.push_front("mShoulderRight"); - mMasterJointList.push_front("mElbowRight"); - mMasterJointList.push_front("mWristRight"); - mMasterJointList.push_front("mHipRight"); - mMasterJointList.push_front("mKneeRight"); - mMasterJointList.push_front("mFootRight"); - mMasterJointList.push_front("mHipLeft"); - mMasterJointList.push_front("mKneeLeft"); - mMasterJointList.push_front("mFootLeft"); - - //2. legacy joint list - used to verify rigs that will not be using joint offsets - mMasterLegacyJointList.push_front("mPelvis"); - mMasterLegacyJointList.push_front("mTorso"); - mMasterLegacyJointList.push_front("mChest"); - mMasterLegacyJointList.push_front("mNeck"); - mMasterLegacyJointList.push_front("mHead"); - mMasterLegacyJointList.push_front("mHipRight"); - mMasterLegacyJointList.push_front("mKneeRight"); - mMasterLegacyJointList.push_front("mFootRight"); - mMasterLegacyJointList.push_front("mHipLeft"); - mMasterLegacyJointList.push_front("mKneeLeft"); - mMasterLegacyJointList.push_front("mFootLeft"); - assert_main_thread(); sActiveLoaderList.push_back(this) ; } @@ -467,55 +432,14 @@ bool LLModelLoader::isRigLegacy( const std::vector &jointListFromAs return false; } - // Note that this is basically the same code as - // isRigSuitableForJointPositionUpload(), but the set of joints is - // different. - JointNameSet :: const_iterator masterJointIt = mMasterLegacyJointList.begin(); - JointNameSet :: const_iterator masterJointEndIt = mMasterLegacyJointList.end(); - - std::vector :: const_iterator modelJointIt = jointListFromAsset.begin(); - std::vector :: const_iterator modelJointItEnd = jointListFromAsset.end(); - - S32 missing_joint_count = 0; - for ( ;masterJointIt!=masterJointEndIt;++masterJointIt ) - { - if (std::find(modelJointIt,modelJointItEnd,*masterJointIt)==modelJointItEnd) - { - LL_INFOS() <<" Asset did not contain a joint required for skinned mesh upload: " << *masterJointIt<< LL_ENDL; - missing_joint_count++; - } - } - if (missing_joint_count>0) - { - LL_WARNS() << "Skinning disabled due to missing joints" << LL_ENDL; - } - return missing_joint_count==0; + return true; } //----------------------------------------------------------------------------- // isRigSuitableForJointPositionUpload() //----------------------------------------------------------------------------- bool LLModelLoader::isRigSuitableForJointPositionUpload( const std::vector &jointListFromAsset ) { - JointNameSet :: const_iterator masterJointIt = mMasterJointList.begin(); - JointNameSet :: const_iterator masterJointEndIt = mMasterJointList.end(); - - std::vector :: const_iterator modelJointIt = jointListFromAsset.begin(); - std::vector :: const_iterator modelJointItEnd = jointListFromAsset.end(); - - S32 missing_joint_count = 0; - for ( ;masterJointIt!=masterJointEndIt;++masterJointIt ) - { - if (std::find(modelJointIt,modelJointItEnd,*masterJointIt)==modelJointItEnd) - { - LL_INFOS() <<" Asset did not contain a joint required for joint position upload: " << *masterJointIt<< LL_ENDL; - missing_joint_count++; - } - } - if (missing_joint_count>0) - { - LL_WARNS() << "Joint upload disabled due to missing joints" << LL_ENDL; - } - return missing_joint_count==0; + return true; } -- cgit v1.2.3 From 72d5ff36f56c4afee85f5863f64f237980341014 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 17 Aug 2016 16:31:28 -0400 Subject: MAINT-6647 - ignore previously created slm files on model upload. SL-442 - change coloring for show bones, to highlight joint positions and rigging --- indra/llprimitive/llmodelloader.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'indra/llprimitive/llmodelloader.cpp') diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index 816ebc558a..4e468ff45f 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -150,6 +150,23 @@ void LLModelLoader::run() doOnIdleOneTime(boost::bind(&LLModelLoader::loadModelCallback,this)); } +// static +bool LLModelLoader::getSLMFilename(const std::string& model_filename, std::string& slm_filename) +{ + slm_filename = model_filename; + + std::string::size_type i = model_filename.rfind("."); + if (i != std::string::npos) + { + slm_filename.replace(i, model_filename.size()-1, ".slm"); + return true; + } + else + { + return false; + } +} + bool LLModelLoader::doLoadModel() { //first, look for a .slm file of the same name that was modified later @@ -157,20 +174,17 @@ bool LLModelLoader::doLoadModel() if (mTrySLM) { - std::string filename = mFilename; - - std::string::size_type i = filename.rfind("."); - if (i != std::string::npos) - { - filename.replace(i, filename.size()-1, ".slm"); + std::string slm_filename; + if (getSLMFilename(mFilename, slm_filename)) + { llstat slm_status; - if (LLFile::stat(filename, &slm_status) == 0) + if (LLFile::stat(slm_filename, &slm_status) == 0) { //slm file exists llstat dae_status; if (LLFile::stat(mFilename, &dae_status) != 0 || dae_status.st_mtime < slm_status.st_mtime) { - if (loadFromSLM(filename)) + if (loadFromSLM(slm_filename)) { //slm successfully loaded, if this fails, fall through and //try loading from dae -- cgit v1.2.3