diff options
-rwxr-xr-x | indra/llappearance/llavatarappearance.cpp | 54 | ||||
-rwxr-xr-x | indra/llappearance/llavatarappearance.h | 7 | ||||
-rwxr-xr-x | indra/llcharacter/llbvhloader.cpp | 33 | ||||
-rwxr-xr-x | indra/llcharacter/llbvhloader.h | 2 | ||||
-rwxr-xr-x | indra/llcharacter/lljoint.h | 4 | ||||
-rw-r--r-- | indra/llprimitive/lldaeloader.cpp | 85 | ||||
-rw-r--r-- | indra/llprimitive/lldaeloader.h | 4 | ||||
-rwxr-xr-x | indra/llprimitive/llmodel.h | 2 | ||||
-rw-r--r-- | indra/llprimitive/llmodelloader.cpp | 187 | ||||
-rw-r--r-- | indra/llprimitive/llmodelloader.h | 10 | ||||
-rwxr-xr-x | indra/newview/CMakeLists.txt | 1 | ||||
-rwxr-xr-x | indra/newview/app_settings/joint_aliases.xml | 97 | ||||
-rwxr-xr-x | indra/newview/character/avatar_skeleton.xml | 40 | ||||
-rwxr-xr-x | indra/newview/llfloaterbvhpreview.cpp | 13 | ||||
-rwxr-xr-x | indra/newview/llfloaterbvhpreview.h | 3 | ||||
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 34 | ||||
-rwxr-xr-x | indra/newview/llfloatermodelpreview.h | 5 | ||||
-rw-r--r-- | indra/newview/llskinningutil.cpp | 18 | ||||
-rwxr-xr-x | indra/newview/llviewercontrol.cpp | 1 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 14 |
20 files changed, 249 insertions, 365 deletions
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index a464ffcb43..81834204f5 100755 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -44,6 +44,7 @@ #include "lltexglobalcolor.h" #include "llwearabledata.h" #include "boost/bind.hpp" +#include "boost/tokenizer.hpp" #if LL_MSVC @@ -88,6 +89,7 @@ public: private: std::string mName; std::string mSupport; + std::string mAliases; BOOL mIsJoint; LLVector3 mPos; LLVector3 mRot; @@ -119,6 +121,7 @@ public: private: S32 mNumBones; S32 mNumCollisionVolumes; + LLAvatarAppearance::joint_alias_map_t mJointAliasMap; typedef std::vector<LLAvatarBoneInfo*> bone_info_list_t; bone_info_list_t mBoneInfoList; }; @@ -1529,6 +1532,9 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node) LL_WARNS() << "Bone without name" << LL_ENDL; return FALSE; } + + static LLStdStringHandle aliases_string = LLXmlTree::addAttributeString("aliases"); + node->getFastAttributeString(aliases_string, mAliases ); //Aliases are not required. } else if (node->hasName("collision_volume")) { @@ -1628,6 +1634,54 @@ BOOL LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) return TRUE; } +//Make aliases for joint and push to map. +void LLAvatarAppearance::makeJointAliases(LLAvatarBoneInfo *bone_info) +{ + if (! bone_info->mIsJoint ) + { + return; + } + + std::string bone_name = bone_info->mName; + mJointAliasMap[bone_name] = bone_name; //Actual name is a valid alias. + + std::string aliases = bone_info->mAliases; + + boost::char_separator<char> sep(" "); + boost::tokenizer<boost::char_separator<char> > tok(aliases, sep); + for(boost::tokenizer<boost::char_separator<char> >::iterator i = tok.begin(); i != tok.end(); ++i) + { + if ( mJointAliasMap.find(*i) != mJointAliasMap.end() ) + { + LL_WARNS() << "avatar skeleton: Joint alias \"" << *i << "\" remapped from " << mJointAliasMap[*i] << " to " << bone_name << LL_ENDL; + } + mJointAliasMap[*i] = bone_name; + } + + LLAvatarBoneInfo::child_list_t::const_iterator iter; + for (iter = bone_info->mChildList.begin(); iter != bone_info->mChildList.end(); ++iter) + { + makeJointAliases( *iter ); + } +} + +const LLAvatarAppearance::joint_alias_map_t& LLAvatarAppearance::getJointAliases () +{ + LLAvatarAppearance::joint_alias_map_t alias_map; + if (mJointAliasMap.empty()) + { + + LLAvatarSkeletonInfo::bone_info_list_t::const_iterator iter; + for (iter = sAvatarSkeletonInfo->mBoneInfoList.begin(); iter != sAvatarSkeletonInfo->mBoneInfoList.end(); ++iter) + { + //LLAvatarBoneInfo *bone_info = *iter; + makeJointAliases( *iter ); + } + } + + return mJointAliasMap; +} + //----------------------------------------------------------------------------- // parseXmlSkeletonNode(): parses <skeleton> nodes from XML tree diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h index 43a5274840..5cff1eef1e 100755 --- a/indra/llappearance/llavatarappearance.h +++ b/indra/llappearance/llavatarappearance.h @@ -127,6 +127,9 @@ protected: virtual LLAvatarJoint* createAvatarJoint() = 0; virtual LLAvatarJoint* createAvatarJoint(S32 joint_num) = 0; virtual LLAvatarJointMesh* createAvatarJointMesh() = 0; + void makeJointAliases(LLAvatarBoneInfo *bone_info); + + public: F32 getPelvisToFoot() const { return mPelvisToFoot; } /*virtual*/ LLJoint* getRootJoint() { return mRoot; } @@ -142,6 +145,9 @@ public: public: typedef std::vector<LLAvatarJoint*> avatar_joint_list_t; const avatar_joint_list_t& getSkeleton() { return mSkeleton; } + typedef std::map<std::string, std::string> joint_alias_map_t; + const joint_alias_map_t& getJointAliases(); + protected: static BOOL parseSkeletonFile(const std::string& filename); @@ -156,6 +162,7 @@ protected: BOOL mIsBuilt; // state of deferred character building avatar_joint_list_t mSkeleton; LLPosOverrideMap mPelvisFixups; + joint_alias_map_t mJointAliasMap; //-------------------------------------------------------------------- // Pelvis height adjustment members. diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index cc2505a5ab..a3c95fa8c9 100755 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -123,39 +123,17 @@ LLQuaternion::Order bvhStringToOrder( char *str ) // LLBVHLoader() //----------------------------------------------------------------------------- -LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &errorLine, std::deque<std::string>& legal_joint_names) +LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &errorLine, std::map<std::string, std::string>& joint_alias_map ) { reset(); errorLine = 0; // Recognize all names we've been told are legal. - for (std::deque<std::string>::iterator joint_name_it = legal_joint_names.begin(); - joint_name_it != legal_joint_names.end(); ++joint_name_it) + std::map<std::string, std::string>::iterator iter; + for (iter = joint_alias_map.begin(); iter != joint_alias_map.end(); iter++) { - const std::string& name = *joint_name_it; - - makeTranslation(name, name); + makeTranslation( iter->first , iter->second ); } - - mStatus = loadAliases("joint_aliases.xml"); //Load joint name aliases - loadStatus = mStatus; - LL_INFOS("BVH") << "Load Status 00 : " << loadStatus << LL_ENDL; - if (mStatus == E_ST_NO_XLT_FILE) - { - LL_WARNS("BVH") << "NOTE: No translation table found." << LL_ENDL; - loadStatus = mStatus; - return; - } - else - { - if (mStatus != E_ST_OK) - { - LL_WARNS("BVH") << "ERROR: [line: " << getLineNumber() << "] " << mStatus << LL_ENDL; - errorLine = getLineNumber(); - loadStatus = mStatus; - return; - } - } char error_text[128]; /* Flawfinder: ignore */ S32 error_line; @@ -478,8 +456,7 @@ ELoadStatus LLBVHLoader::loadBVHFile(const char *buffer, char* error_text, S32 & return E_ST_NO_CHANNELS; } - // FIXME BENTO do we want to open up motion of non-hip joints or - // not? Already effectively allowed via .anim upload. + // Animating position (via mNumChannels = 6) is only supported for mPelvis. int res = sscanf(line.c_str(), " CHANNELS %d", &joint->mNumChannels); if ( res != 1 ) { diff --git a/indra/llcharacter/llbvhloader.h b/indra/llcharacter/llbvhloader.h index a0207750ed..01a7c8ad16 100755 --- a/indra/llcharacter/llbvhloader.h +++ b/indra/llcharacter/llbvhloader.h @@ -230,7 +230,7 @@ public: // Constructor // LLBVHLoader(const char* buffer); LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &errorLine); - LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &errorLine, std::deque<std::string>& legal_joint_names); + LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &errorLine, std::map<std::string, std::string>& joint_alias_map ); ~LLBVHLoader(); /* diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index 113742ad74..8d380cdc82 100755 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -40,9 +40,9 @@ #include "xform.h" const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; -// BENTO JOINT COUNT LIMIT +// BENTO JOINT COUNT LIMIT - need to set this to final skeleton size + 2 const U32 LL_CHARACTER_MAX_JOINTS = 152; // must be divisible by 4! -const U32 LL_MAX_JOINTS_PER_MESH_OBJECT = 132; +const U32 LL_MAX_JOINTS_PER_MESH_OBJECT = 110; // FIXME BENTO - these should be higher than the joint_num of any // other joint, to avoid conflicts in updateMotionsByType() diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 63457512ff..400b8563c1 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -810,8 +810,8 @@ LLDAELoader::LLDAELoader( void* opaque_userdata, JointTransformMap& jointTransformMap, JointNameSet& jointsFromNodes, - JointNameSet& legalJointNames, - std::string jointAliasesFilename, + std::map<std::string, std::string>& jointAliasMap, + U32 maxJointsPerMesh, U32 modelLimit) : LLModelLoader( filename, @@ -823,8 +823,8 @@ LLDAELoader::LLDAELoader( opaque_userdata, jointTransformMap, jointsFromNodes, - legalJointNames, - jointAliasesFilename), + jointAliasMap, + maxJointsPerMesh), mGeneratedModelLimit(modelLimit) { } @@ -1187,6 +1187,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do extractTranslation( pTranslateA, workingTransform ); } else + { if ( pTranslateB ) { extractTranslation( pTranslateB, workingTransform ); @@ -1211,9 +1212,10 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do } } + } - //Store the joint transform w/respect to it's name. - mJointList[(*jointIt).second.c_str()] = workingTransform; + //Store the joint transform w/respect to its name. + mJointList[(*jointIt).second.c_str()] = workingTransform; } } @@ -1259,8 +1261,6 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do name = mJointMap[name]; } model->mSkinInfo.mJointNames.push_back(name); - // BENTO this does not appear to be used anywhere. - // model->mSkinInfo.mJointMap[name] = j; } } else @@ -1278,8 +1278,6 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do name = mJointMap[name]; } model->mSkinInfo.mJointNames.push_back(name); - // BENTO not used? - // model->mSkinInfo.mJointMap[name] = j; } } } @@ -1323,35 +1321,40 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do if ( !missingSkeletonOrScene ) { - //Set the joint translations on the avatar - if it's a full mapping - //The joints are reset in the dtor - if ( getRigWithSceneParity() ) - { - JointMap :: const_iterator masterJointIt = mJointMap.begin(); - JointMap :: const_iterator masterJointItEnd = mJointMap.end(); - for (;masterJointIt!=masterJointItEnd;++masterJointIt ) - { - std::string lookingForJoint = (*masterJointIt).first.c_str(); - - if ( mJointList.find( lookingForJoint ) != mJointList.end() ) - { - //LL_INFOS()<<"joint "<<lookingForJoint.c_str()<<LL_ENDL; - LLMatrix4 jointTransform = mJointList[lookingForJoint]; - LLJoint* pJoint = mJointLookupFunc(lookingForJoint,mOpaqueData); - if ( pJoint ) - { - LLUUID fake_mesh_id; - fake_mesh_id.generate(); - pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), fake_mesh_id, ""); - } - else - { - //Most likely an error in the asset. - LL_WARNS()<<"Tried to apply joint position from .dae, but it did not exist in the avatar rig." << LL_ENDL; - } - } - } - } + //Set the joint translations on the avatar + JointMap :: const_iterator masterJointIt = mJointMap.begin(); + JointMap :: const_iterator masterJointItEnd = mJointMap.end(); + for (;masterJointIt!=masterJointItEnd;++masterJointIt ) + { + std::string lookingForJoint = (*masterJointIt).first.c_str(); + + if ( mJointList.find( lookingForJoint ) != mJointList.end() ) + { + //LL_INFOS()<<"joint "<<lookingForJoint.c_str()<<LL_ENDL; + LLMatrix4 jointTransform = mJointList[lookingForJoint]; + LLJoint* pJoint = mJointLookupFunc(lookingForJoint,mOpaqueData); + if ( pJoint ) + { + // FIXME: mesh_id is used to determine which + // mesh gets to set the joint offset, in the + // event of a conflict. Since we don't know + // the mesh id yet, we can't guarantee that + // joint offsets will be applied with the same + // priority as in the uploaded model. If the + // file contains multiple meshes with + // conflicting joint offsets, preview may be + // incorrect. + LLUUID fake_mesh_id; + fake_mesh_id.generate(); + pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), fake_mesh_id, ""); + } + else + { + //Most likely an error in the asset. + LL_WARNS()<<"Tried to apply joint position from .dae, but it did not exist in the avatar rig." << LL_ENDL; + } + } + } } //missingSkeletonOrScene //We need to construct the alternate bind matrix (which contains the new joint positions) @@ -1373,7 +1376,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do } else { - LL_WARNS()<<"Possibly misnamed/missing joint [" <<lookingForJoint.c_str()<<" ] "<<LL_ENDL; + LL_DEBUGS("Mesh")<<"Possibly misnamed/missing joint [" <<lookingForJoint.c_str()<<"] "<<LL_ENDL; } } @@ -1820,7 +1823,7 @@ daeElement* LLDAELoader::getChildFromElement( daeElement* pElement, std::string { return pChildOfElement; } - LL_WARNS()<< "Could not find a child [" << name << "] for the element: \"" << pElement->getAttribute("id") << "\"" << LL_ENDL; + LL_DEBUGS("Mesh")<< "Could not find a child [" << name << "] for the element: \"" << pElement->getAttribute("id") << "\"" << LL_ENDL; return NULL; } diff --git a/indra/llprimitive/lldaeloader.h b/indra/llprimitive/lldaeloader.h index 52ad9d4705..f8965d1d5d 100644 --- a/indra/llprimitive/lldaeloader.h +++ b/indra/llprimitive/lldaeloader.h @@ -56,8 +56,8 @@ public: void* opaque_userdata, JointTransformMap& jointTransformMap, JointNameSet& jointsFromNodes, - JointNameSet& legalJointNames, - std::string jointAliasesFilename, + std::map<std::string, std::string>& jointAliasMap, + U32 maxJointsPerMesh, U32 modelLimit); virtual ~LLDAELoader() ; diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 56844ac16d..5f98942340 100755 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -47,8 +47,6 @@ public: std::vector<LLMatrix4> mInvBindMatrix; std::vector<LLMatrix4> mAlternateBindMatrix; std::vector<U32> mJointRemap; - // BENTO not used? - //std::map<std::string, U32> mJointMap; LLMeshSkinInfo() { } LLMeshSkinInfo(LLSD& data); diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index b4bd467c64..9bfd6dc3e6 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -111,13 +111,14 @@ LLModelLoader::LLModelLoader( void* opaque_userdata, JointTransformMap& jointTransformMap, JointNameSet& jointsFromNodes, - JointNameSet& legalJointNames, - std::string jointAliasFilename) + JointMap& legalJointNamesMap, + U32 maxJointsPerMesh) : mJointList( jointTransformMap ) , mJointsFromNode( jointsFromNodes ) , LLThread("Model Loader") , mFilename(filename) , mLod(lod) +, mTrySLM(false) , mFirstTransform(TRUE) , mNumOfFetchingTextures(0) , mLoadCallback(load_cb) @@ -125,38 +126,14 @@ LLModelLoader::LLModelLoader( , mTextureLoadFunc(texture_load_func) , mStateCallback(state_cb) , mOpaqueData(opaque_userdata) +, mRigValidJointUpload(true) +, mLegacyRigValid(true) , mNoNormalize(false) , mNoOptimize(false) , mCacheOnlyHitIfRigged(false) -{ - // 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 - 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(); - } - +, mMaxJointsPerMesh(maxJointsPerMesh) +, mJointMap(legalJointNamesMap) +{ //move into joint mapper class //1. joints for joint offset verification mMasterJointList.push_front("mPelvis"); @@ -426,8 +403,6 @@ void LLModelLoader::loadModelCallback() //----------------------------------------------------------------------------- void LLModelLoader::critiqueRigForUploadApplicability( const std::vector<std::string> &jointListFromAsset ) { - critiqueJointToNodeMappingFromScene(); - //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 @@ -435,59 +410,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 + // mesh. + setRigValidForJointPositionUpload( false ); } - if ( isRigLegacyOK) + if ( !isRigLegacyOK) { - setLegacyRigValid( true ); + // This starts out true, becomes false if false for any loaded + // mesh. + 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() //----------------------------------------------------------------------------- @@ -499,68 +442,80 @@ bool LLModelLoader::isRigLegacy( const std::vector<std::string> &jointListFromAs return false; } - bool result = 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 due to too many joints" << 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() << "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; + } + // 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<std::string> :: const_iterator modelJointIt = jointListFromAsset.begin(); std::vector<std::string> :: 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<std::string> &jointListFromAsset ) { - bool result = false; - JointNameSet :: const_iterator masterJointIt = mMasterJointList.begin(); JointNameSet :: const_iterator masterJointEndIt = mMasterJointList.end(); std::vector<std::string> :: const_iterator modelJointIt = jointListFromAsset.begin(); std::vector<std::string> :: 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; } diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h index 20c3aee649..568b3ead4e 100644 --- a/indra/llprimitive/llmodelloader.h +++ b/indra/llprimitive/llmodelloader.h @@ -117,6 +117,7 @@ public: JointMap mJointMap; JointTransformMap& mJointList; JointNameSet& mJointsFromNode; + U32 mMaxJointsPerMesh; LLModelLoader( std::string filename, @@ -128,8 +129,8 @@ public: void* opaque_userdata, JointTransformMap& jointTransformMap, JointNameSet& jointsFromNodes, - JointNameSet& legalJointNames, - std::string jointAliasFilename); + JointMap& legalJointNamesMap, + U32 maxJointsPerMesh); virtual ~LLModelLoader() ; virtual void setNoNormalize() { mNoNormalize = true; } @@ -160,7 +161,6 @@ public: //Determines the viability of an asset to be used as an avatar rig (w or w/o joint upload caps) void critiqueRigForUploadApplicability( const std::vector<std::string> &jointListFromAsset ); - void critiqueJointToNodeMappingFromScene( void ); //Determines if a rig is a legacy from the joint list bool isRigLegacy( const std::vector<std::string> &jointListFromAsset ); @@ -168,9 +168,6 @@ public: //Determines if a rig is suitable for upload bool isRigSuitableForJointPositionUpload( const std::vector<std::string> &jointListFromAsset ); - void setRigWithSceneParity( bool state ) { mRigParityWithScene = state; } - const bool getRigWithSceneParity( void ) const { return mRigParityWithScene; } - const bool isRigValidForJointPositionUpload( void ) const { return mRigValidJointUpload; } void setRigValidForJointPositionUpload( bool rigValid ) { mRigValidJointUpload = rigValid; } @@ -193,7 +190,6 @@ protected: LLModelLoader::state_callback_t mStateCallback; void* mOpaqueData; - bool mRigParityWithScene; bool mRigValidJointUpload; bool mLegacyRigValid; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index b371939fb5..3c6b1c7903 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1605,7 +1605,6 @@ set(viewer_APPSETTINGS_FILES app_settings/grass.xml app_settings/high_graphics.xml app_settings/ignorable_dialogs.xml - app_settings/joint_aliases.xml app_settings/keys.xml app_settings/keywords_lsl_default.xml app_settings/logcontrol.xml diff --git a/indra/newview/app_settings/joint_aliases.xml b/indra/newview/app_settings/joint_aliases.xml deleted file mode 100755 index 1e4a233837..0000000000 --- a/indra/newview/app_settings/joint_aliases.xml +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="US-ASCII" standalone="yes"?> -<llsd> -<map> - <key>avatar_mPelvis</key> - <string>mPelvis</string> - <key>avatar_mTorso</key> - <string>mTorso</string> - <key>avatar_mChest</key> - <string>mChest</string> - <key>avatar_mNeck</key> - <string>mNeck</string> - <key>avatar_mHead</key> - <string>mHead</string> - <key>avatar_mSkull</key> - <string>mSkull</string> - <key>avatar_mEyeRight</key> - <string>mEyeRight</string> - <key>avatar_mEyeLeft</key> - <string>mEyeLeft</string> - <key>avatar_mCollarLeft</key> - <string>mCollarLeft</string> - <key>avatar_mShoulderLeft</key> - <string>mShoulderLeft</string> - <key>avatar_mElbowLeft</key> - <string>mElbowLeft</string> - <key>avatar_mWristLeft</key> - <string>mWristLeft</string> - <key>avatar_mCollarRight</key> - <string>mCollarRight</string> - <key>avatar_mShoulderRight</key> - <string>mShoulderRight</string> - <key>avatar_mElbowRight</key> - <string>mElbowRight</string> - <key>avatar_mWristRight</key> - <string>mWristRight</string> - <key>avatar_mHipRight</key> - <string>mHipRight</string> - <key>avatar_mKneeRight</key> - <string>mKneeRight</string> - <key>avatar_mAnkleRight</key> - <string>mAnkleRight</string> - <key>avatar_mFootRight</key> - <string>mFootRight</string> - <key>avatar_mToeRight</key> - <string>mToeRight</string> - <key>avatar_mHipLeft</key> - <string>mHipLeft</string> - <key>avatar_mKneeLeft</key> - <string>mKneeLeft</string> - <key>avatar_mAnkleLeft</key> - <string>mAnkleLeft</string> - <key>avatar_mFootLeft</key> - <string>mFootLeft</string> - <key>avatar_mToeLeft</key> - <string>mToeLeft</string> - <key>hip</key> - <string>mPelvis</string> - <key>abdomen</key> - <string>mTorso</string> - <key>chest</key> - <string>mChest</string> - <key>neck</key> - <string>mNeck</string> - <key>head</key> - <string>mHead</string> - <key>figureHair</key> - <string>mSkull</string> - <key>lCollar</key> - <string>mCollarLeft</string> - <key>lShldr</key> - <string>mShoulderLeft</string> - <key>lForeArm</key> - <string>mElbowLeft</string> - <key>lHand</key> - <string>mWristLeft</string> - <key>rCollar</key> - <string>mCollarRight</string> - <key>rShldr</key> - <string>mShoulderRight</string> - <key>rForeArm</key> - <string>mElbowRight</string> - <key>rHand</key> - <string>mWristRight</string> - <key>rThigh</key> - <string>mHipRight</string> - <key>rShin</key> - <string>mKneeRight</string> - <key>rFoot</key> - <string>mFootRight</string> - <key>lThigh</key> - <string>mHipLeft</string> - <key>lShin</key> - <string>mKneeLeft</string> - <key>lFoot</key> - <string>mFootLeft</string> -</map> -</llsd> diff --git a/indra/newview/character/avatar_skeleton.xml b/indra/newview/character/avatar_skeleton.xml index 7a088484d8..47182620d2 100755 --- a/indra/newview/character/avatar_skeleton.xml +++ b/indra/newview/character/avatar_skeleton.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="US-ASCII" standalone="yes"?> <linden_skeleton version="1.0" num_bones="53" num_collision_volumes="29"> -<bone name="mPelvis" pos="0.000 0.000 1.067" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 0.000000 1.067015"> +<bone name="mPelvis" pos="0.000 0.000 1.067" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 0.000000 1.067015" aliases="hip pelvis"> <bone name="mTail_1" pos="0.000 0.000 0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.25 0.000000 0.000000"> <bone name="mTail_2" pos="-0.2500 0.000 0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-.25000000 0.000000 0.000000"> <bone name="mTail_3" pos="-0.2500 0.000 0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.2500000 0.000000 0.000000"> @@ -11,12 +11,12 @@ </bone> <collision_volume name="PELVIS" pos = "-0.01 0 -0.02" rot="0.000000 8.00000 0.000000" scale="0.12 0.16 0.17"/> <collision_volume name="BUTT" pos = "-0.06 0 -0.1" rot="0.000000 0.00000 0.000000" scale="0.1 0.1 0.1"/> - <bone name="mTorso" pos="0.000 0.000 0.084" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 0.000000 0.084073"> + <bone name="mTorso" pos="0.000 0.000 0.084" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 0.000000 0.084073" aliases="abdomen"> <collision_volume name="BELLY" pos = "0.028 0 0.04" rot="0.000000 8.00000 0.000000" scale="0.09 0.13 0.15"/> <collision_volume name="LOWER_BACK" pos = "0.0 0.0 0.023" rot="0.000000 0.00000 0.000000" scale="0.09 0.13 0.15"/> <collision_volume name="LEFT_HANDLE" pos = "0.0 0.10 0.058" rot="0.000000 0.00000 0.000000" scale="0.05 0.05 0.05"/> <collision_volume name="RIGHT_HANDLE" pos = "0.0 -0.10 0.058" rot="0.000000 0.00000 0.000000" scale="0.05 0.05 0.05"/> - <bone name="mChest" pos="-0.015 0.000 0.205" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.015368 0.000000 0.204877"> + <bone name="mChest" pos="-0.015 0.000 0.205" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.015368 0.000000 0.204877" aliases="chest"> <bone name="mRightWingShoulder" pos="-0.07 -0.082 0.165" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.07 -0.082 0.165"> <bone name="mRightWingElbow" pos="-0.085 -0.115 0" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.085 -0.115 0"> <bone name="mRightWingWrist" pos="0.000 -0.231 -0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 -.231 -0.000000"> @@ -37,11 +37,11 @@ <collision_volume name="UPPER_BACK" pos = "0.0 0.0 0.017" rot="0.000000 0.00000 0.000000" scale="0.09 0.13 0.15"/> <collision_volume name="LEFT_PEC" pos = "0.119 0.082 0.042" rot="0.000000 4.29000 0.000000" scale="0.05 0.05 0.05"/> <collision_volume name="RIGHT_PEC" pos = "0.119 -0.082 0.042" rot="0.000000 4.29000 0.000000" scale="0.05 0.05 0.05"/> - <bone name="mNeck" pos="-0.010 0.000 0.251" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.009507 0.000000 0.251108"> + <bone name="mNeck" pos="-0.010 0.000 0.251" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.009507 0.000000 0.251108" aliases="neck"> <collision_volume name="NECK" pos = "0.0 0 0.02" rot="0.000000 0.000000 0.000000" scale="0.05 0.06 0.08"/> - <bone name="mHead" pos="0.000 -0.000 0.076" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 -0.000000 0.075630"> + <bone name="mHead" pos="0.000 -0.000 0.076" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 -0.000000 0.075630" aliases="head"> <collision_volume name="HEAD" pos = "0.02 0 0.07" rot="0.000000 0.000000 0.000000" scale="0.11 0.09 0.12"/> - <bone name="mSkull" pos="0.000 0.000 0.079" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 0.000000 0.079000"> + <bone name="mSkull" pos="0.000 0.000 0.079" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 0.000000 0.079000" aliases="figureHair"> </bone> <bone name="mEyeRight" pos="0.098 -0.036 0.079" rot="0.000000 0.000000 -0.000000" scale="1.000 1.000 1.000" pivot="0.098466 -0.036000 0.079000"> </bone> @@ -49,25 +49,25 @@ </bone> </bone> </bone> - <bone name="mCollarLeft" pos="-0.021 0.085 0.165" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.020927 0.084665 0.165396"> + <bone name="mCollarLeft" pos="-0.021 0.085 0.165" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.020927 0.084665 0.165396" aliases="lCollar"> <collision_volume name="L_CLAVICLE" pos = "0.02 0 0.02" rot="0.000000 0.00000 0.000000" scale="0.07 0.14 0.05"/> - <bone name="mShoulderLeft" pos="0.000 0.079 -0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 0.079000 -0.000000"> + <bone name="mShoulderLeft" pos="0.000 0.079 -0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 0.079000 -0.000000" aliases="lShldr"> <collision_volume name="L_UPPER_ARM" pos = "0.0 0.12 0.01" rot="-5.000000 0.00000 0.000000" scale="0.05 0.17 0.05"/> - <bone name="mElbowLeft" pos="0.000 0.248 0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 0.248000 0.000000"> + <bone name="mElbowLeft" pos="0.000 0.248 0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 0.248000 0.000000" aliases="lForeArm"> <collision_volume name="L_LOWER_ARM" pos = "0.0 0.1 0.0" rot="-3.000000 0.00000 0.000000" scale="0.04 0.14 0.04"/> - <bone name="mWristLeft" pos="-0.000 0.205 0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.000000 0.204846 0.000000"> + <bone name="mWristLeft" pos="-0.000 0.205 0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.000000 0.204846 0.000000" aliases="lHand"> <collision_volume name="L_HAND" pos = "0.01 0.05 0.0" rot="-3.000000 0.00000 -10.000000" scale="0.05 0.08 0.03"/> </bone> </bone> </bone> </bone> - <bone name="mCollarRight" pos="-0.021 -0.085 0.165" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.020927 -0.085000 0.165396"> + <bone name="mCollarRight" pos="-0.021 -0.085 0.165" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.020927 -0.085000 0.165396" aliases="rCollar"> <collision_volume name="R_CLAVICLE" pos = "0.02 0 0.02" rot="0.000000 0.00000 0.000000" scale="0.07 0.14 0.05"/> - <bone name="mShoulderRight" pos="0.000 -0.079 -0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 -0.079418 -0.000000"> + <bone name="mShoulderRight" pos="0.000 -0.079 -0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 -0.079418 -0.000000" aliases="rShldr"> <collision_volume name="R_UPPER_ARM" pos = "0.0 -0.12 0.01" rot="5.000000 0.00000 0.000000" scale="0.05 0.17 0.05"/> - <bone name="mElbowRight" pos="0.000 -0.248 -0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 -0.248000 -0.000000"> + <bone name="mElbowRight" pos="0.000 -0.248 -0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.000000 -0.248000 -0.000000" aliases="rForeArm"> <collision_volume name="R_LOWER_ARM" pos = "0.0 -0.1 0.0" rot="3.000000 0.00000 0.000000" scale="0.04 0.14 0.04"/> - <bone name="mWristRight" pos="0.000 -0.205 -0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.000000 -0.205000 -0.000000"> + <bone name="mWristRight" pos="0.000 -0.205 -0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.000000 -0.205000 -0.000000" aliases="rHand"> <collision_volume name="R_HAND" pos = "0.01 -0.05 0.0" rot="3.000000 0.00000 10.000000" scale="0.05 0.08 0.03"/> </bone> </bone> @@ -75,26 +75,26 @@ </bone> </bone> </bone> - <bone name="mHipRight" pos="0.034 -0.129 -0.041" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.033620 -0.128806 -0.041086"> + <bone name="mHipRight" pos="0.034 -0.129 -0.041" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.033620 -0.128806 -0.041086" aliases="rThigh"> <collision_volume name="R_UPPER_LEG" pos = "-0.02 0.05 -0.22" rot="0.000000 0.00000 0.000000" scale="0.09 0.09 0.32"/> - <bone name="mKneeRight" pos="-0.001 0.049 -0.491" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.000780 0.048635 -0.490922"> + <bone name="mKneeRight" pos="-0.001 0.049 -0.491" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.000780 0.048635 -0.490922" aliases="rShin"> <collision_volume name="R_LOWER_LEG" pos = "-0.02 0.0 -0.2" rot="0.000000 0.00000 0.000000" scale="0.06 0.06 0.25"/> <bone name="mAnkleRight" pos="-0.029 0.000 -0.468" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.028869 0.000000 -0.468494"> <collision_volume name="R_FOOT" pos = "0.077 0.0 -0.041" rot="0.000000 10.00000 0.000000" scale="0.13 0.05 0.05"/> - <bone name="mFootRight" pos="0.112 -0.000 -0.061" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.111956 -0.000000 -0.060637"> + <bone name="mFootRight" pos="0.112 -0.000 -0.061" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.111956 -0.000000 -0.060637" aliases="rFoot"> <bone name="mToeRight" pos="0.109 0.000 0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.105399 -0.010408 -0.000104"> </bone> </bone> </bone> </bone> </bone> - <bone name="mHipLeft" pos="0.034 0.127 -0.041" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.033757 0.126765 -0.040998"> + <bone name="mHipLeft" pos="0.034 0.127 -0.041" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.033757 0.126765 -0.040998" aliases="lThigh"> <collision_volume name="L_UPPER_LEG" pos = "-0.02 -0.05 -0.22" rot="0.000000 0.00000 0.000000" scale="0.09 0.09 0.32"/> - <bone name="mKneeLeft" pos="-0.001 -0.046 -0.491" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.000887 -0.045568 -0.491053"> + <bone name="mKneeLeft" pos="-0.001 -0.046 -0.491" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.000887 -0.045568 -0.491053" aliases="lShin"> <collision_volume name="L_LOWER_LEG" pos = "-0.02 0.0 -0.2" rot="0.000000 0.00000 0.000000" scale="0.06 0.06 0.25"/> <bone name="mAnkleLeft" pos="-0.029 0.001 -0.468" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="-0.028887 0.001378 -0.468449"> <collision_volume name="L_FOOT" pos = "0.077 0.0 -0.041" rot="0.000000 10.00000 0.000000" scale="0.13 0.05 0.05"/> - <bone name="mFootLeft" pos="0.112 -0.000 -0.061" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.111956 -0.000000 -0.060620"> + <bone name="mFootLeft" pos="0.112 -0.000 -0.061" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.111956 -0.000000 -0.060620" aliases="lFoot"> <bone name="mToeLeft" pos="0.109 0.000 0.000" rot="0.000000 0.000000 0.000000" scale="1.000 1.000 1.000" pivot="0.105387 0.008270 0.000871"> </bone> </bone> diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 97769838e8..543b6ff813 100755 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -178,14 +178,12 @@ void LLFloaterBvhPreview::setAnimCallbacks() getChild<LLUICtrl>("ease_out_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseOut, this, _1)); } -void LLFloaterBvhPreview::getLegalJointNames(std::deque<std::string>& legal_joint_names) +std::map <std::string, std::string> LLFloaterBvhPreview::getJointAliases() { - // Get all standard skeleton joints from the preview avatar. LLPointer<LLVOAvatar> av = (LLVOAvatar*)mAnimPreview->getDummyAvatar(); - av->getLegalJointNames(legal_joint_names, false); + return av->getJointAliases(); } - //----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- @@ -252,9 +250,10 @@ BOOL LLFloaterBvhPreview::postBuild() LL_INFOS() << "Loading BVH file " << mFilename << LL_ENDL; ELoadStatus load_status = E_ST_OK; S32 line_number = 0; - std::deque<std::string> legal_joint_names; - getLegalJointNames(legal_joint_names); - loaderp = new LLBVHLoader(file_buffer, load_status, line_number, legal_joint_names); + + std::map<std::string, std::string> joint_alias_map = getJointAliases(); + + loaderp = new LLBVHLoader(file_buffer, load_status, line_number, joint_alias_map); std::string status = getString(STATUS[load_status]); if(load_status == E_ST_NO_XLT_FILE) diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h index 74d77d0004..20d15d9603 100755 --- a/indra/newview/llfloaterbvhpreview.h +++ b/indra/newview/llfloaterbvhpreview.h @@ -109,7 +109,8 @@ public: S32 status, LLExtStat ext_status); private: void setAnimCallbacks() ; - void getLegalJointNames(std::deque<std::string>& legal_joint_names); + std::map <std::string, std::string> getJointAliases(); + protected: void draw(); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 30051a79f1..9ab81a74a1 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1184,7 +1184,6 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) , mPhysicsSearchLOD( LLModel::LOD_PHYSICS ) , mResetJoints( false ) , mModelNoErrors( true ) -, mRigParityWithScene( false ) , mLastJointUpdate( false ) { mNeedsUpdate = TRUE; @@ -1708,27 +1707,17 @@ void LLModelPreview::clearModel(S32 lod) mScene[lod].clear(); } -void LLModelPreview::getLegalJointNames(JointNameSet& legal_joint_names) +void LLModelPreview::getJointAliases( JointMap& joint_map) { // Get all standard skeleton joints from the preview avatar. LLVOAvatar *av = getPreviewAvatar(); - - av->getLegalJointNames(legal_joint_names, true); - const LLVOAvatar::avatar_joint_list_t &skel = av->getSkeleton(); - for (S32 i=0; i<skel.size(); i++) - { - LLAvatarJoint *joint = skel[i]; - if (joint) - { - legal_joint_names.push_back(joint->getName()); - } - } - std::stringstream cvstr; + //Joint names and aliases come from avatar_skeleton.xml + + joint_map = av->getJointAliases(); for (S32 i = 0; i < av->mNumCollisionVolumes; i++) { - legal_joint_names.push_back(av->mCollisionVolumes[i].getName()); - cvstr << legal_joint_names[i]; + joint_map[av->mCollisionVolumes[i].getName()] = av->mCollisionVolumes[i].getName(); } } @@ -1774,13 +1763,9 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable clearGLODGroup(); } - JointNameSet legal_joint_names; - getLegalJointNames(legal_joint_names); + std::map<std::string, std::string> joint_alias_map; + getJointAliases(joint_alias_map); - std::string joint_aliases_filename = - gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"joint_aliases.xml"); - - mModelLoader = new LLDAELoader( filename, lod, @@ -1791,8 +1776,8 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable this, mJointTransformMap, mJointsFromNode, - legal_joint_names, - joint_aliases_filename, + joint_alias_map, + LLSkinningUtil::getMaxJointCount(), gSavedSettings.getU32("ImporterModelLimit")); if (force_disable_slm) @@ -3584,6 +3569,7 @@ BOOL LLModelPreview::render() fmp->enableViewOption("show_skin_weight"); fmp->setViewOptionEnabled("show_joint_positions", skin_weight); mFMP->childEnable("upload_skin"); + mFMP->childSetValue("show_skin_weight", skin_weight); } } else diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index d9351029ec..a0aeda0a3c 100755 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -259,7 +259,7 @@ public: virtual BOOL needsRender() { return mNeedsUpdate; } void setPreviewLOD(S32 lod); void clearModel(S32 lod); - void getLegalJointNames(JointNameSet& legal_joint_names); + void getJointAliases(JointMap& joint_map); void loadModel(std::string filename, S32 lod, bool force_disable_slm = false); void loadModelCallback(S32 lod); void genLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); @@ -297,8 +297,6 @@ public: void setLoadState( U32 state ) { mLoadState = state; } U32 getLoadState() { return mLoadState; } - void setRigWithSceneParity( bool state ) { mRigParityWithScene = state; } - const bool getRigWithSceneParity( void ) const { return mRigParityWithScene; } static bool sIgnoreLoadedCallback; @@ -346,7 +344,6 @@ private: bool mLoading; U32 mLoadState; bool mResetJoints; - bool mRigParityWithScene; bool mModelNoErrors; std::map<std::string, bool> mViewOption; diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 5fd2248060..279035d769 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -85,9 +85,7 @@ U32 get_proxy_joint_index(U32 joint_index, LLVOAvatar *avatar, std::vector<std:: U32 j_proxy = get_valid_joint_index(joint_names[joint_index], avatar, joint_names); LLJoint *joint = avatar->getJoint(joint_names[j_proxy]); llassert(joint); - // BENTO - test of simple push-to-base-ancestor - // complexity reduction scheme. Find the first - // ancestor that's not flagged as extended, or the + // Find the first ancestor that's not flagged as extended, or the // last ancestor that's rigged in this mesh, whichever // comes first. while (1) @@ -113,6 +111,7 @@ U32 get_proxy_joint_index(U32 joint_index, LLVOAvatar *avatar, std::vector<std:: void LLSkinningUtil::initClass() { sIncludeEnhancedSkeleton = gSavedSettings.getBOOL("IncludeEnhancedSkeleton"); + // BENTO - remove MaxJointsPerMeshObject before release. sMaxJointsPerMeshObject = gSavedSettings.getU32("MaxJointsPerMeshObject"); } @@ -233,7 +232,18 @@ void LLSkinningUtil::initSkinningMatrixPalette( { LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); mat[j] = skin->mInvBindMatrix[j]; - mat[j] *= joint->getWorldMatrix(); + if (joint) + { + mat[j] *= joint->getWorldMatrix(); + } + else + { + // This shouldn't happen - in mesh upload, skinned + // rendering should be disabled unless all joints are + // valid. In other cases of skinned rendering, invalid + // joints should already have been removed during remap. + LL_WARNS_ONCE("Avatar") << "Rigged to invalid joint name " << skin->mJointNames[j] << LL_ENDL; + } } } diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 4e4aaf5f8e..7af76259a8 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -768,6 +768,7 @@ void settings_setup_listeners() gSavedSettings.getControl("SpellCheck")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("LoginLocation")->getSignal()->connect(boost::bind(&handleLoginLocationChanged)); + // BENTO - remove MaxJointsPerMeshObject before release gSavedSettings.getControl("MaxJointsPerMeshObject")->getCommitSignal()->connect(boost::bind(&handleDeferredDebugSettingChanged, _2)); gSavedSettings.getControl("IncludeEnhancedSkeleton")->getCommitSignal()->connect(boost::bind(&handleDeferredDebugSettingChanged, _2)); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d14ec7e55b..b6924e5904 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -940,15 +940,13 @@ std::string LLVOAvatar::rezStatusToString(S32 rez_status) void LLVOAvatar::getLegalJointNames(std::deque<std::string>& legal_joint_names, bool include_collision_volumes) { - // Get all standard skeleton joints from the preview avatar. - const LLVOAvatar::avatar_joint_list_t &skel = getSkeleton(); - for (S32 i=0; i<skel.size(); i++) + LLAvatarAppearance::joint_alias_map_t alias_map = getJointAliases(); + + std::map<std::string, std::string>::iterator iter; + + for (iter = alias_map.begin(); iter != alias_map.end(); ++iter) { - LLAvatarJoint *joint = skel[i]; - if (joint) - { - legal_joint_names.push_back(joint->getName()); - } + legal_joint_names.push_back(iter->first); } if (include_collision_volumes) |