diff options
| -rw-r--r-- | indra/llcharacter/lljoint.cpp | 19 | ||||
| -rw-r--r-- | indra/llcharacter/lljoint.h | 8 | ||||
| -rw-r--r-- | indra/newview/llfloatermodelpreview.cpp | 11 | ||||
| -rw-r--r-- | indra/newview/llvoavatar.cpp | 35 | ||||
| -rw-r--r-- | indra/newview/llvoavatar.h | 1 | ||||
| -rw-r--r-- | indra/newview/llvoavatarself.cpp | 22 | ||||
| -rw-r--r-- | indra/newview/llvoavatarself.h | 4 | 
7 files changed, 94 insertions, 6 deletions
| diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 2449b01e15..522d760c7d 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -239,6 +239,17 @@ void LLJoint::setPosition( const LLVector3& pos )  	}  } + +//-------------------------------------------------------------------- +// setPosition() +//-------------------------------------------------------------------- +void LLJoint::setDefaultFromCurrentXform( void ) +{ +	mDefaultXform = mXform; +	touch(MATRIX_DIRTY | POSITION_DIRTY); +	 +} +  //--------------------------------------------------------------------  // storeCurrentXform()  //-------------------------------------------------------------------- @@ -254,6 +265,14 @@ void LLJoint::restoreOldXform( void )  {  	mXform = mOldXform;  } +//-------------------------------------------------------------------- +// restoreOldXform() +//-------------------------------------------------------------------- +void LLJoint::restoreToDefaultXform( void ) +{	 +	mXform = mDefaultXform; +	setPosition( mXform.getPosition() );	 +}  //--------------------------------------------------------------------  // getWorldPosition() diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index cf644e899f..6506f8ad03 100644 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -87,6 +87,7 @@ protected:  	// explicit transformation members  	LLXformMatrix		mXform;  	LLXformMatrix		mOldXform; +	LLXformMatrix		mDefaultXform;  public:  	U32				mDirtyFlags; @@ -137,7 +138,9 @@ public:  	// get/set local position  	const LLVector3& getPosition();  	void setPosition( const LLVector3& pos ); - +	 +	void setDefaultPosition( const LLVector3& pos ); +	  	// get/set world position  	LLVector3 getWorldPosition();  	LLVector3 getLastWorldPosition(); @@ -181,6 +184,9 @@ public:  	void setJointNum(S32 joint_num) { mJointNum = joint_num; }  	void restoreOldXform( void ); +	void restoreToDefaultXform( void ); +	void setDefaultFromCurrentXform( void ); +	  	void storeCurrentXform( const LLVector3& pos );  };  #endif // LL_LLJOINT_H diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index d939d27fa9..82d3a07345 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2219,9 +2219,16 @@ void LLModelPreview::loadModel(std::string filename, S32 lod)  		mModelLoader = NULL;  	} -	if (filename.empty() && mBaseModel.empty()) +	if (filename.empty())  	{ -		mFMP->closeFloater(false); +		if (mBaseModel.empty()) +		{ +			// this is the initial file picking. Close the whole floater +			// if we don't have a base model to show for high LOD. +			mFMP->closeFloater(false); +		} + +		mFMP->mLoading = false;  		return;  	} diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 63c3e61598..8fd2d7a016 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1631,7 +1631,8 @@ BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent  							 info->mRot.mV[VZ], LLQuaternion::XYZ));  	joint->setScale(info->mScale); - +	joint->setDefaultFromCurrentXform(); +	  	if (info->mIsJoint)  	{  		joint->setSkinOffset( info->mPivot ); @@ -4785,6 +4786,38 @@ void LLVOAvatar::resetJointPositions( void )  	}  }  //----------------------------------------------------------------------------- +// resetJointPositionsToDefault +//----------------------------------------------------------------------------- +void LLVOAvatar::resetJointPositionsToDefault( void ) +{ +	const LLVector3& avPos = getCharacterPosition(); +	 +	//Reposition the pelvis +	LLJoint* pPelvis = mRoot.findJoint("mPelvis"); +	if ( pPelvis ) +	{ +		pPelvis->setPosition( avPos + pPelvis->getPosition() ); +	} +	else  +	{ +		llwarns<<"Can't get pelvis joint."<<llendl;	 +		return; +	} + +	//Subsequent joints are relative to pelvis +	for( S32 i = 0; i < (S32)mNumJoints; ++i ) +	{ +		LLJoint* pJoint = (LLJoint*)&mSkeleton[i]; +		//restore joints to default positions, however skip over the pelvis +		if ( pJoint && pPelvis != pJoint ) +		{ +			pJoint->restoreToDefaultXform(); +		} +	} +} + + +//-----------------------------------------------------------------------------  // getCharacterPosition()  //-----------------------------------------------------------------------------  LLVector3 LLVOAvatar::getCharacterPosition() diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 4a8f3bf9ef..f4e27c675b 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -171,6 +171,7 @@ public:  	virtual LLJoint*     	getRootJoint() { return &mRoot; }  	void					resetJointPositions( void ); +	void					resetJointPositionsToDefault( void );  	virtual const char*		getAnimationPrefix() { return "avatar"; }  	virtual const LLUUID&   getID(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index fd519cb3a9..0298bcc80b 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -62,6 +62,8 @@  #include "llviewerstats.h"  #include "llviewerregion.h"  #include "llappearancemgr.h" +#include "llmeshrepository.h" +#include "llvovolume.h"  #if LL_MSVC  // disable boost::lexical_cast warning @@ -655,6 +657,10 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)  	return LLVOAvatar::getJoint(name);  } +void LLVOAvatarSelf::resetJointPositions( void ) +{ +	return LLVOAvatar::resetJointPositionsToDefault(); +}  // virtual  BOOL LLVOAvatarSelf::setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake )  { @@ -1119,8 +1125,22 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view  BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)  {  	const LLUUID attachment_id = viewer_object->getAttachmentItemID(); -	if (LLVOAvatar::detachObject(viewer_object)) +	if ( LLVOAvatar::detachObject(viewer_object) )  	{ +		//If a VO has a skin that we'll reset the joint positions to their default +		if ( viewer_object->mDrawable ) +		{ +			LLVOVolume* pVObj = viewer_object->mDrawable->getVOVolume(); +			if ( pVObj ) +			{ +				const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( pVObj->getVolume()->getParams().getSculptID() ); +				if ( pSkinData ) +				{ +					resetJointPositions(); +				}				 +			} +		} +		  		// the simulator should automatically handle permission revocation  		stopMotionFromSource(attachment_id); diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 23a799ea3a..141a419fc8 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -83,7 +83,9 @@ public:  	/*virtual*/ void 		stopMotionFromSource(const LLUUID& source_id);  	/*virtual*/ void 		requestStopMotion(LLMotion* motion);  	/*virtual*/ LLJoint*	getJoint(const std::string &name); - +	 +				void		resetJointPositions( void ); +	  	/*virtual*/ BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE );  	/*virtual*/ BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake = FALSE );  	/*virtual*/ BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE ); | 
