diff options
| author | prep <prep@lindenlab.com> | 2013-07-24 16:01:36 -0400 | 
|---|---|---|
| committer | prep <prep@lindenlab.com> | 2013-07-24 16:01:36 -0400 | 
| commit | a1fadad9c0bd1ba261f827d6da572db5621f5bed (patch) | |
| tree | 6d86c1751ea25052603d85e9e8997d387f91aca5 /indra/llcharacter | |
| parent | 28a5015074e3f6e0ba961dc260edcb9662e6f14b (diff) | |
Sh-4321 # Fixes for detach deformations. General code cleanup as well.
Diffstat (limited to 'indra/llcharacter')
| -rwxr-xr-x | indra/llcharacter/lljoint.cpp | 43 | ||||
| -rwxr-xr-x | indra/llcharacter/lljoint.h | 7 | 
2 files changed, 24 insertions, 26 deletions
| diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 09a7c11a22..672d9faee4 100755 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -48,8 +48,11 @@ void LLJoint::init()  	mParent = NULL;  	mXform.setScaleChildOffset(TRUE);  	mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f)); +	mOldXform.setScaleChildOffset(TRUE); +	mOldXform.setScale(LLVector3(1.0f, 1.0f, 1.0f));  	mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY;  	mUpdateXform = TRUE; +	mResetAfterRestoreOldXform = false;	  }  LLJoint::LLJoint() : @@ -57,7 +60,6 @@ LLJoint::LLJoint() :  {  	init();  	touch(); -	mResetAfterRestoreOldXform = false;  }  LLJoint::LLJoint(S32 joint_num) : @@ -65,7 +67,6 @@ LLJoint::LLJoint(S32 joint_num) :  {  	init();  	touch(); -	mResetAfterRestoreOldXform = false;  } @@ -78,7 +79,6 @@ LLJoint::LLJoint(const std::string &name, LLJoint *parent) :  {  	init();  	mUpdateXform = FALSE; -	// *TODO: mResetAfterRestoreOldXform is not initialized!!!  	setName(name);  	if (parent) @@ -239,11 +239,8 @@ const LLVector3& LLJoint::getPosition()  //--------------------------------------------------------------------  void LLJoint::setPosition( const LLVector3& pos )  { -//	if (mXform.getPosition() != pos) -	{ -		mXform.setPosition(pos); -		touch(MATRIX_DIRTY | POSITION_DIRTY); -	} +	mXform.setPosition(pos); +	touch(MATRIX_DIRTY | POSITION_DIRTY);  } @@ -251,10 +248,9 @@ void LLJoint::setPosition( const LLVector3& pos )  // setPosition()  //--------------------------------------------------------------------  void LLJoint::setDefaultFromCurrentXform( void ) -{ +{	  	mDefaultXform = mXform; -	touch(MATRIX_DIRTY | POSITION_DIRTY); -	 +	touch(ALL_DIRTY);	  }  //-------------------------------------------------------------------- @@ -263,26 +259,29 @@ void LLJoint::setDefaultFromCurrentXform( void )  void LLJoint::storeCurrentXform( const LLVector3& pos )  {  	mOldXform = mXform; -	mResetAfterRestoreOldXform = true; +	mResetAfterRestoreOldXform = true;	  	setPosition( pos ); + +	touch(ALL_DIRTY);	  } +  //-------------------------------------------------------------------- -// restoreOldXform() +// storeScaleForReset()  //-------------------------------------------------------------------- -void LLJoint::restoreOldXform( void ) +void LLJoint::storeScaleForReset( const LLVector3& scale )  { -	mResetAfterRestoreOldXform = false; -	mXform = mOldXform; +	mOldXform.setScale( scale );  }  //--------------------------------------------------------------------  // restoreOldXform()  //-------------------------------------------------------------------- -void LLJoint::restoreToDefaultXform( void ) +void LLJoint::restoreOldXform( void )  {	 -	mXform = mDefaultXform; -	setPosition( mXform.getPosition() );	 +	mXform = mOldXform; +	mXform.setScaleChildOffset( mOldXform.getScaleChildOffset() ); +	mResetAfterRestoreOldXform = false; +	mDirtyFlags = ALL_DIRTY;  } -  //--------------------------------------------------------------------  // getWorldPosition()  //-------------------------------------------------------------------- @@ -404,7 +403,7 @@ void LLJoint::setWorldRotation( const LLQuaternion& rot )  //--------------------------------------------------------------------  const LLVector3& LLJoint::getScale()  { -	return mXform.getScale(); +	return mXform.getScale();	  }  //-------------------------------------------------------------------- @@ -413,7 +412,7 @@ const LLVector3& LLJoint::getScale()  void LLJoint::setScale( const LLVector3& scale )  {  //	if (mXform.getScale() != scale) -	{ +	{	  		mXform.setScale(scale);  		touch();  	} diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index 2b1e2005c6..aeb16f796a 100755 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -84,6 +84,7 @@ protected:  	LLXformMatrix		mDefaultXform;  	LLUUID				mId; +  public:  	U32				mDirtyFlags;  	BOOL			mUpdateXform; @@ -160,7 +161,7 @@ public:  	// get/set local scale  	const LLVector3& getScale();  	void setScale( const LLVector3& scale ); - +	void storeScaleForReset( const LLVector3& scale );  	// get/set world matrix  	const LLMatrix4 &getWorldMatrix();  	void setWorldMatrix( const LLMatrix4& mat ); @@ -185,7 +186,6 @@ public:  	S32 getJointNum() const { return mJointNum; }  	void restoreOldXform( void ); -	void restoreToDefaultXform( void );  	void setDefaultFromCurrentXform( void );  	void storeCurrentXform( const LLVector3& pos ); @@ -196,8 +196,7 @@ public:  	//If the old transform flag has been set, then the reset logic in avatar needs to be aware(test) of it  	const BOOL doesJointNeedToBeReset( void ) const { return mResetAfterRestoreOldXform; } -	//Setter for joint reset flag -	void setJointToBeReset( BOOL val ) { mResetAfterRestoreOldXform = val; } +	  };  #endif // LL_LLJOINT_H | 
