diff options
Diffstat (limited to 'indra/llcharacter')
-rwxr-xr-x | indra/llcharacter/llcharacter.cpp | 14 | ||||
-rwxr-xr-x | indra/llcharacter/llcharacter.h | 6 | ||||
-rwxr-xr-x | indra/llcharacter/lljoint.cpp | 42 | ||||
-rwxr-xr-x | indra/llcharacter/lljoint.h | 8 | ||||
-rwxr-xr-x | indra/llcharacter/llmotioncontroller.cpp | 7 | ||||
-rwxr-xr-x | indra/llcharacter/llvisualparam.cpp | 50 | ||||
-rwxr-xr-x | indra/llcharacter/llvisualparam.h | 11 |
7 files changed, 83 insertions, 55 deletions
diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 82ddfa01ec..4df975ecc5 100755 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -287,13 +287,13 @@ void LLCharacter::removeAnimationData(std::string name) //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight, BOOL upload_bake) +BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight) { S32 index = which_param->getID(); visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index); if (index_iter != mVisualParamIndexMap.end()) { - index_iter->second->setWeight(weight, upload_bake); + index_iter->second->setWeight(weight); return TRUE; } return FALSE; @@ -302,7 +302,7 @@ BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 wei //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake) +BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight) { std::string tname(param_name); LLStringUtil::toLower(tname); @@ -310,7 +310,7 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL visual_param_name_map_t::iterator name_iter = mVisualParamNameMap.find(tableptr); if (name_iter != mVisualParamNameMap.end()) { - name_iter->second->setWeight(weight, upload_bake); + name_iter->second->setWeight(weight); return TRUE; } LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter: " << param_name << LL_ENDL; @@ -320,12 +320,12 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake) +BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight) { visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index); if (index_iter != mVisualParamIndexMap.end()) { - index_iter->second->setWeight(weight, upload_bake); + index_iter->second->setWeight(weight); return TRUE; } LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter index: " << index << LL_ENDL; @@ -395,7 +395,7 @@ void LLCharacter::clearVisualParamWeights() { if (param->isTweakable()) { - param->setWeight( param->getDefaultWeight(), FALSE ); + param->setWeight( param->getDefaultWeight()); } } } diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index b10a8a5f34..d4e3b76386 100755 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -190,9 +190,9 @@ public: void addVisualParam(LLVisualParam *param); void addSharedVisualParam(LLVisualParam *param); - virtual BOOL setVisualParamWeight(const 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 ); + virtual BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight); + virtual BOOL setVisualParamWeight(const char* param_name, F32 weight); + virtual BOOL setVisualParamWeight(S32 index, F32 weight); // get visual param weight by param or name F32 getVisualParamWeight(LLVisualParam *distortion); diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 1492cc172c..dbd6d48a95 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,38 +248,37 @@ void LLJoint::setPosition( const LLVector3& pos ) // setPosition() //-------------------------------------------------------------------- void LLJoint::setDefaultFromCurrentXform( void ) -{ +{ mDefaultXform = mXform; - touch(MATRIX_DIRTY | POSITION_DIRTY); - } //-------------------------------------------------------------------- // storeCurrentXform() //-------------------------------------------------------------------- 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() ); + mResetAfterRestoreOldXform = false; + mDirtyFlags = ALL_DIRTY; } - //-------------------------------------------------------------------- // getWorldPosition() //-------------------------------------------------------------------- @@ -299,8 +295,6 @@ LLVector3 LLJoint::getLastWorldPosition() { return mXform.getWorldPosition(); } - - //-------------------------------------------------------------------- // setWorldPosition() //-------------------------------------------------------------------- @@ -404,7 +398,7 @@ void LLJoint::setWorldRotation( const LLQuaternion& rot ) //-------------------------------------------------------------------- const LLVector3& LLJoint::getScale() { - return mXform.getScale(); + return mXform.getScale(); } //-------------------------------------------------------------------- @@ -413,7 +407,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 6efa13aeb5..b65d6979d4 100755 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -83,6 +83,7 @@ protected: LLXformMatrix mDefaultXform; LLUUID mId; + public: U32 mDirtyFlags; BOOL mUpdateXform; @@ -159,7 +160,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 ); @@ -184,7 +185,6 @@ public: S32 getJointNum() const { return mJointNum; } void restoreOldXform( void ); - void restoreToDefaultXform( void ); void setDefaultFromCurrentXform( void ); void storeCurrentXform( const LLVector3& pos ); @@ -195,8 +195,8 @@ 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; } + void setJointResetFlag( bool val ) { mResetAfterRestoreOldXform = val; } + }; #endif // LL_LLJOINT_H diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 50ccfd75fb..e02b139608 100755 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -172,6 +172,13 @@ void LLMotionController::deleteAllMotions() for_each(mAllMotions.begin(), mAllMotions.end(), DeletePairedPointer()); mAllMotions.clear(); + + // stinson 05/12/20014 : Ownership of the LLMotion pointers is transferred from + // mAllMotions to mDeprecatedMotions in method + // LLMotionController::deprecateMotionInstance(). Thus, we should also clean + // up the mDeprecatedMotions list as well. + for_each(mDeprecatedMotions.begin(), mDeprecatedMotions.end(), DeletePointer()); + mDeprecatedMotions.clear(); } //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp index 0df7fb2bc3..2235496ac5 100755 --- a/indra/llcharacter/llvisualparam.cpp +++ b/indra/llcharacter/llvisualparam.cpp @@ -159,26 +159,42 @@ void LLVisualParamInfo::toStream(std::ostream &out) //----------------------------------------------------------------------------- // LLVisualParam() //----------------------------------------------------------------------------- -LLVisualParam::LLVisualParam() - : - mCurWeight( 0.f ), +LLVisualParam::LLVisualParam() + : mCurWeight( 0.f ), mLastWeight( 0.f ), mNext( NULL ), mTargetWeight( 0.f ), mIsAnimating( FALSE ), + mIsDummy(FALSE), mID( -1 ), mInfo( 0 ), - mIsDummy(FALSE), mParamLocation(LOC_UNKNOWN) { } //----------------------------------------------------------------------------- +// LLVisualParam() +//----------------------------------------------------------------------------- +LLVisualParam::LLVisualParam(const LLVisualParam& pOther) + : mCurWeight(pOther.mCurWeight), + mLastWeight(pOther.mLastWeight), + mNext(pOther.mNext), + mTargetWeight(pOther.mTargetWeight), + mIsAnimating(pOther.mIsAnimating), + mIsDummy(pOther.mIsDummy), + mID(pOther.mID), + mInfo(pOther.mInfo), + mParamLocation(pOther.mParamLocation) +{ +} + +//----------------------------------------------------------------------------- // ~LLVisualParam() //----------------------------------------------------------------------------- LLVisualParam::~LLVisualParam() { delete mNext; + mNext = NULL; } /* @@ -220,7 +236,7 @@ BOOL LLVisualParam::parseData(LLXmlTreeNode *node) //----------------------------------------------------------------------------- // setWeight() //----------------------------------------------------------------------------- -void LLVisualParam::setWeight(F32 weight, BOOL upload_bake) +void LLVisualParam::setWeight(F32 weight) { if (mIsAnimating) { @@ -238,19 +254,19 @@ void LLVisualParam::setWeight(F32 weight, BOOL upload_bake) if (mNext) { - mNext->setWeight(weight, upload_bake); + mNext->setWeight(weight); } } //----------------------------------------------------------------------------- // setAnimationTarget() //----------------------------------------------------------------------------- -void LLVisualParam::setAnimationTarget(F32 target_value, BOOL upload_bake) +void LLVisualParam::setAnimationTarget(F32 target_value) { // don't animate dummy parameters if (mIsDummy) { - setWeight(target_value, upload_bake); + setWeight(target_value); mTargetWeight = mCurWeight; return; } @@ -270,7 +286,7 @@ void LLVisualParam::setAnimationTarget(F32 target_value, BOOL upload_bake) if (mNext) { - mNext->setAnimationTarget(target_value, upload_bake); + mNext->setAnimationTarget(target_value); } } @@ -285,26 +301,34 @@ void LLVisualParam::setNextParam( LLVisualParam *next ) } //----------------------------------------------------------------------------- +// clearNextParam() +//----------------------------------------------------------------------------- +void LLVisualParam::clearNextParam() +{ + mNext = NULL; +} + +//----------------------------------------------------------------------------- // animate() //----------------------------------------------------------------------------- -void LLVisualParam::animate( F32 delta, BOOL upload_bake ) +void LLVisualParam::animate( F32 delta) { if (mIsAnimating) { F32 new_weight = ((mTargetWeight - mCurWeight) * delta) + mCurWeight; - setWeight(new_weight, upload_bake); + setWeight(new_weight); } } //----------------------------------------------------------------------------- // stopAnimating() //----------------------------------------------------------------------------- -void LLVisualParam::stopAnimating(BOOL upload_bake) +void LLVisualParam::stopAnimating() { if (mIsAnimating && isTweakable()) { mIsAnimating = FALSE; - setWeight(mTargetWeight, upload_bake); + setWeight(mTargetWeight); } } diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index a4d9f93e56..c6b97d7e8b 100755 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -120,10 +120,10 @@ public: //virtual BOOL parseData( LLXmlTreeNode *node ) = 0; virtual void apply( ESex avatar_sex ) = 0; // Default functions - virtual void setWeight(F32 weight, BOOL upload_bake); - virtual void setAnimationTarget( F32 target_value, BOOL upload_bake ); - virtual void animate(F32 delta, BOOL upload_bake); - virtual void stopAnimating(BOOL upload_bake); + virtual void setWeight(F32 weight); + virtual void setAnimationTarget( F32 target_value); + virtual void animate(F32 delta); + virtual void stopAnimating(); virtual BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params); virtual void resetDrivenParams(); @@ -155,6 +155,7 @@ public: LLVisualParam* getNextParam() { return mNext; } void setNextParam( LLVisualParam *next ); + void clearNextParam(); virtual void setAnimating(BOOL is_animating) { mIsAnimating = is_animating && !mIsDummy; } BOOL getAnimating() const { return mIsAnimating; } @@ -165,6 +166,8 @@ public: EParamLocation getParamLocation() const { return mParamLocation; } protected: + LLVisualParam(const LLVisualParam& pOther); + F32 mCurWeight; // current weight F32 mLastWeight; // last weight LLVisualParam* mNext; // next param in a shared chain |