diff options
| author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2016-04-29 11:25:17 -0400 | 
|---|---|---|
| committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2016-04-29 11:25:17 -0400 | 
| commit | ec471497f5dba41e74afc6864ab0f7100659e1d9 (patch) | |
| tree | 76500d30565e03a591b744e4296476627ca63c26 | |
| parent | 3da9762eee8052855089df6aa5d33aea94553c5d (diff) | |
SL-375, SL-378 - rudimentary logging info to list joint offsets during mesh import. dae_tool.py work to enable joint offset tweaking.
| -rwxr-xr-x | indra/llcharacter/lljoint.cpp | 16 | ||||
| -rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 10 | ||||
| -rwxr-xr-x | indra/newview/llvoavatar.cpp | 85 | ||||
| -rwxr-xr-x | indra/newview/llvoavatar.h | 3 | ||||
| -rwxr-xr-x | indra/newview/llvovolume.cpp | 4 | ||||
| -rw-r--r-- | scripts/content_tools/dae_tool.py | 4 | 
6 files changed, 91 insertions, 31 deletions
| diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 8365ab8eb1..c4eda0b432 100755 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -382,6 +382,13 @@ void showJointPosOverrides( const LLJoint& joint, const std::string& note, const          LL_DEBUGS("Avatar") << av_info << " joint " << joint.getName() << " " << note << " " << os.str() << LL_ENDL;  } +bool above_joint_pos_threshold(const LLVector3& diff) +{ +	//return !diff.isNull(); +	const F32 max_joint_pos_offset = 0.0001f; // 0.1 mm +	return diff.lengthSquared() > max_joint_pos_offset * max_joint_pos_offset; +} +  //--------------------------------------------------------------------  // addAttachmentPosOverride()  //-------------------------------------------------------------------- @@ -391,6 +398,15 @@ void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh  	{  		return;  	} +    if (!above_joint_pos_threshold(pos-getDefaultPosition())) +    { +        if (do_debug_joint(getName())) +        { +            LL_DEBUGS("Avatar") << "Attachment pos override ignored for " << getName() +                                << ", pos " << pos << " is same as default pos" << LL_ENDL; +        } +		return; +    }  	if (!m_attachmentOverrides.count())  	{  		if (do_debug_joint(getName())) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index cda704f47b..ec4f8a42e0 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -489,10 +489,18 @@ void LLFloaterModelPreview::onClickCalculateBtn()  	bool upload_skinweights = childGetValue("upload_skin").asBoolean();  	bool upload_joint_positions = childGetValue("upload_joints").asBoolean(); +    if (upload_joint_positions) +    { +        // Diagnostic message showing list of joints for which joint offsets are defined. +        // FIXME - given time, would be much better to put this in the UI, in updateStatusMessages(). +		mModelPreview->getPreviewAvatar()->showAttachmentPosOverrides(); +    } +  	mUploadModelUrl.clear();  	gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale, -			childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, mUploadModelUrl, false, +                          childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, +                          mUploadModelUrl, false,  						  getWholeModelFeeObserverHandle());  	toggleCalculateButton(false); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5d77b1238a..679ea88a44 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5315,13 +5315,6 @@ void LLVOAvatar::clearAttachmentPosOverrides()  	}  } -bool above_joint_pos_threshold(const LLVector3& diff) -{ -    //return !diff.isNull(); -    const F32 max_joint_pos_offset = 0.0001f; // 0.1 mm -    return diff.lengthSquared() > max_joint_pos_offset * max_joint_pos_offset; -} -  //-----------------------------------------------------------------------------  // addAttachmentPosOverridesForObject  //----------------------------------------------------------------------------- @@ -5382,22 +5375,14 @@ void LLVOAvatar::addAttachmentPosOverridesForObject(LLViewerObject *vo)  					{   									  						pJoint->setId( currentId );  						const LLVector3& jointPos = pSkinData->mAlternateBindMatrix[i].getTranslation();									 -                        if (!above_joint_pos_threshold(jointPos-pJoint->getDefaultPosition())) -                        { -                            LL_DEBUGS("Avatar") << "Attachment pos override ignored for " << pJoint->getName() -                                                << ", pos " << jointPos << " is same as default pos" << LL_ENDL; -                        } -                        else -                        { -                            //Set the joint position -                            pJoint->addAttachmentPosOverride( jointPos, mesh_id, avString() ); +                        //Set the joint position +                        pJoint->addAttachmentPosOverride( jointPos, mesh_id, avString() ); -                            //If joint is a pelvis then handle old/new pelvis to foot values -                            if ( lookingForJoint == "mPelvis" ) -                            {	 -                                pelvisGotSet = true;											 -                            }										 -                        } +                        //If joint is a pelvis then handle old/new pelvis to foot values +                        if ( lookingForJoint == "mPelvis" ) +                        {	 +                            pelvisGotSet = true;											 +                        }										  					}										  				}																  				if (pelvisZOffset != 0.0F) @@ -5414,22 +5399,68 @@ void LLVOAvatar::addAttachmentPosOverridesForObject(LLViewerObject *vo)  	{  		postPelvisSetRecalc();  	}		 +} -    if (isSelf()) -    { -        showAttachmentPosOverrides(); +//----------------------------------------------------------------------------- +// getAttachmentOverrideNames +//----------------------------------------------------------------------------- +void LLVOAvatar::getAttachmentOverrideNames(std::set<std::string>& names) const +{ +    LLVector3 pos; +    LLUUID mesh_id; + +    // Bones +	for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin(); +         iter != mSkeleton.end(); ++iter) +	{ +		const LLJoint* pJoint = (*iter); +		if (pJoint && pJoint->hasAttachmentPosOverride(pos,mesh_id)) +		{ +            names.insert(pJoint->getName()); +		} +	} + +    // Attachment points +	for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); +		 iter != mAttachmentPoints.end(); +		 ++iter) +	{ +		const LLViewerJointAttachment *attachment_pt = (*iter).second; +        if (attachment_pt && attachment_pt->hasAttachmentPosOverride(pos,mesh_id)) +        { +            names.insert(attachment_pt->getName()); +        }      } +  }  //-----------------------------------------------------------------------------  // showAttachmentPosOverrides  //----------------------------------------------------------------------------- -void LLVOAvatar::showAttachmentPosOverrides() const +void LLVOAvatar::showAttachmentPosOverrides(bool verbose) const  { +    std::set<std::string> joint_names; +    getAttachmentOverrideNames(joint_names); +    if (joint_names.size()) +    { +        std::stringstream ss; +        std::copy(joint_names.begin(), joint_names.end(), std::ostream_iterator<std::string>(ss, ",")); +        LL_INFOS() << getFullname() << " attachment positions defined for joints: " << ss.str() << "\n" << LL_ENDL; +    } +    else +    { +        LL_INFOS() << getFullname() << " no attachment positions defined for any joints" << "\n" << LL_ENDL; +    } + +    if (!verbose) +    { +        return; +    } +      LLVector3 pos;      LLUUID mesh_id;      S32 count = 0; -     +      // Bones  	for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin();           iter != mSkeleton.end(); ++iter) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 48c0d0e54b..c6bc2fd58f 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -206,7 +206,8 @@ public:      bool					jointIsRiggedTo(const std::string& joint_name);      bool					jointIsRiggedTo(const std::string& joint_name, const LLViewerObject *vo);  	void					clearAttachmentPosOverrides(); -    void                    showAttachmentPosOverrides() const; +    void                    showAttachmentPosOverrides(bool verbose = false) const; +    void                    getAttachmentOverrideNames(std::set<std::string>& names) const;  	/*virtual*/ const LLUUID&	getID() const;  	/*virtual*/ void			addDebugText(const std::string& text); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c2550afcac..9d8ef05cbc 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4777,6 +4777,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)              if (rigged && pAvatarVO)              {                  pAvatarVO->addAttachmentPosOverridesForObject(vobj); +				if (pAvatarVO->isSelf()) +				{ +					//pAvatarVO->showAttachmentPosOverrides(); +				}              }  			//for each face diff --git a/scripts/content_tools/dae_tool.py b/scripts/content_tools/dae_tool.py index 08d78b1df9..8ac6c7582f 100644 --- a/scripts/content_tools/dae_tool.py +++ b/scripts/content_tools/dae_tool.py @@ -47,8 +47,8 @@ def mesh_lock_offsets(tree, joints):              continue          if joint_node.get("type") != "JOINT":              continue -        if joint_node.get("name") in joints: -            for matrix_node in joint_node.iter(): +        if joint_node.get("name") in joints or "bone" in joints: +            for matrix_node in list(joint_node):                  if "matrix" in matrix_node.tag:                      floats = [float(x) for x in matrix_node.text.split()]                      if len(floats) == 16: | 
