diff options
Diffstat (limited to 'indra/llcharacter')
-rw-r--r-- | indra/llcharacter/llbvhloader.h | 1 | ||||
-rw-r--r-- | indra/llcharacter/llcharacter.cpp | 16 | ||||
-rw-r--r-- | indra/llcharacter/llcharacter.h | 6 | ||||
-rw-r--r-- | indra/llcharacter/lleditingmotion.cpp | 2 | ||||
-rw-r--r-- | indra/llcharacter/llheadrotmotion.cpp | 11 | ||||
-rw-r--r-- | indra/llcharacter/lljoint.cpp | 1 | ||||
-rw-r--r-- | indra/llcharacter/llkeyframemotion.h | 1 | ||||
-rw-r--r-- | indra/llcharacter/llkeyframestandmotion.cpp | 2 | ||||
-rw-r--r-- | indra/llcharacter/llkeyframewalkmotion.cpp | 12 | ||||
-rw-r--r-- | indra/llcharacter/llstatemachine.cpp | 2 | ||||
-rw-r--r-- | indra/llcharacter/llvisualparam.cpp | 26 | ||||
-rw-r--r-- | indra/llcharacter/llvisualparam.h | 14 |
12 files changed, 59 insertions, 35 deletions
diff --git a/indra/llcharacter/llbvhloader.h b/indra/llcharacter/llbvhloader.h index 85ab035e61..38617bd6d4 100644 --- a/indra/llcharacter/llbvhloader.h +++ b/indra/llcharacter/llbvhloader.h @@ -166,6 +166,7 @@ public: Translation() { mIgnore = FALSE; + mIgnorePositions = FALSE; mRelativePositionKey = FALSE; mRelativeRotationKey = FALSE; mPriorityModifier = 0; diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index e68672d46f..40a9752268 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -181,16 +181,18 @@ void LLCharacter::requestStopMotion( LLMotion* motion) // updateMotions() //----------------------------------------------------------------------------- static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation"); +static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim"); void LLCharacter::updateMotions(e_update_t update_type) { - LLFastTimer t(FTM_UPDATE_ANIMATION); if (update_type == HIDDEN_UPDATE) { + LLFastTimer t(FTM_UPDATE_HIDDEN_ANIMATION); mMotionController.updateMotionsMinimal(); } else { + LLFastTimer t(FTM_UPDATE_ANIMATION); // unpause if the number of outstanding pause requests has dropped to the initial one if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1) { @@ -273,13 +275,13 @@ void LLCharacter::removeAnimationData(std::string name) //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(LLVisualParam* which_param, F32 weight, BOOL set_by_user) +BOOL LLCharacter::setVisualParamWeight(LLVisualParam* which_param, F32 weight, BOOL upload_bake) { 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, set_by_user); + index_iter->second->setWeight(weight, upload_bake); return TRUE; } return FALSE; @@ -288,7 +290,7 @@ BOOL LLCharacter::setVisualParamWeight(LLVisualParam* which_param, F32 weight, B //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL set_by_user) +BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake) { std::string tname(param_name); LLStringUtil::toLower(tname); @@ -296,7 +298,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, set_by_user); + name_iter->second->setWeight(weight, upload_bake); return TRUE; } llwarns << "LLCharacter::setVisualParamWeight() Invalid visual parameter: " << param_name << llendl; @@ -306,12 +308,12 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight, BOOL set_by_user) +BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake) { visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index); if (index_iter != mVisualParamIndexMap.end()) { - index_iter->second->setWeight(weight, set_by_user); + index_iter->second->setWeight(weight, upload_bake); return TRUE; } llwarns << "LLCharacter::setVisualParamWeight() Invalid visual parameter index: " << index << llendl; diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index cb44a32e8a..27e2a51c62 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -203,9 +203,9 @@ public: void addVisualParam(LLVisualParam *param); void addSharedVisualParam(LLVisualParam *param); - virtual BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL set_by_user = FALSE ); - virtual BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL set_by_user = FALSE ); - virtual BOOL setVisualParamWeight(S32 index, F32 weight, BOOL set_by_user = FALSE ); + 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 ); // get visual param weight by param or name F32 getVisualParamWeight(LLVisualParam *distortion); diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp index 381d19e614..57554bdc35 100644 --- a/indra/llcharacter/lleditingmotion.cpp +++ b/indra/llcharacter/lleditingmotion.cpp @@ -221,7 +221,7 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask) if (!target.isFinite()) { llerrs << "Non finite target in editing motion with target distance of " << target_dist << - " and focus point " << focus_pt << " and pointAtPt: " << *pointAtPt << llendl; + " and focus point " << focus_pt << llendl; } mTarget.setPosition( target + mParentJoint.getPosition()); diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp index 88cd77f7af..0ee378f3b8 100644 --- a/indra/llcharacter/llheadrotmotion.cpp +++ b/indra/llcharacter/llheadrotmotion.cpp @@ -251,10 +251,13 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) mLastHeadRot = head_rot_local; // Set the head rotation. - LLQuaternion torsoRotLocal = mNeckState->getJoint()->getParent()->getWorldRotation() * currentInvRootRotWorld; - head_rot_local = head_rot_local * ~torsoRotLocal; - mNeckState->setRotation( nlerp(NECK_LAG, LLQuaternion::DEFAULT, head_rot_local) ); - mHeadState->setRotation( nlerp(1.f - NECK_LAG, LLQuaternion::DEFAULT, head_rot_local)); + if(mNeckState->getJoint() && mNeckState->getJoint()->getParent()) + { + LLQuaternion torsoRotLocal = mNeckState->getJoint()->getParent()->getWorldRotation() * currentInvRootRotWorld; + head_rot_local = head_rot_local * ~torsoRotLocal; + mNeckState->setRotation( nlerp(NECK_LAG, LLQuaternion::DEFAULT, head_rot_local) ); + mHeadState->setRotation( nlerp(1.f - NECK_LAG, LLQuaternion::DEFAULT, head_rot_local)); + } return TRUE; } diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 37afcb7cda..5c49214051 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -70,6 +70,7 @@ LLJoint::LLJoint(const std::string &name, LLJoint *parent) mXform.setScaleChildOffset(TRUE); mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f)); mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY; + mUpdateXform = FALSE; mJointNum = 0; setName(name); diff --git a/indra/llcharacter/llkeyframemotion.h b/indra/llcharacter/llkeyframemotion.h index 7e8c84488c..50d9d05046 100644 --- a/indra/llcharacter/llkeyframemotion.h +++ b/indra/llcharacter/llkeyframemotion.h @@ -47,7 +47,6 @@ #include "llquaternion.h" #include "v3dmath.h" #include "v3math.h" -#include "llapr.h" #include "llbvhconsts.h" class LLKeyframeDataCache; diff --git a/indra/llcharacter/llkeyframestandmotion.cpp b/indra/llcharacter/llkeyframestandmotion.cpp index 1d42298f4d..1ae0ddeea0 100644 --- a/indra/llcharacter/llkeyframestandmotion.cpp +++ b/indra/llcharacter/llkeyframestandmotion.cpp @@ -190,7 +190,7 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) if (dot(mPelvisState->getJoint()->getWorldRotation(), mLastGoodPelvisRotation) < ROTATION_THRESHOLD) { mLastGoodPelvisRotation = mPelvisState->getJoint()->getWorldRotation(); - mLastGoodPelvisRotation.normQuat(); + mLastGoodPelvisRotation.normalize(); mTrackAnkles = TRUE; } else if ((mCharacter->getCharacterPosition() - mLastGoodPosition).magVecSquared() > POSITION_THRESHOLD) diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index b5817e5bde..461309bee9 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -58,11 +58,15 @@ const F32 MAX_ROLL = 0.6f; // LLKeyframeWalkMotion() // Class Constructor //----------------------------------------------------------------------------- -LLKeyframeWalkMotion::LLKeyframeWalkMotion(const LLUUID &id) : LLKeyframeMotion(id) +LLKeyframeWalkMotion::LLKeyframeWalkMotion(const LLUUID &id) + : LLKeyframeMotion(id), + + mCharacter(NULL), + mCyclePhase(0.0f), + mRealTimeLast(0.0f), + mAdjTimeLast(0.0f), + mDownFoot(0) { - mRealTimeLast = 0.0f; - mAdjTimeLast = 0.0f; - mCharacter = NULL; } diff --git a/indra/llcharacter/llstatemachine.cpp b/indra/llcharacter/llstatemachine.cpp index 73c6951211..e6fa4d7985 100644 --- a/indra/llcharacter/llstatemachine.cpp +++ b/indra/llcharacter/llstatemachine.cpp @@ -54,6 +54,7 @@ bool operator!=(const LLUniqueID &a, const LLUniqueID &b) //----------------------------------------------------------------------------- LLStateDiagram::LLStateDiagram() { + mDefaultState = NULL; mUseDefaultState = FALSE; } @@ -305,6 +306,7 @@ LLStateMachine::LLStateMachine() // we haven't received a starting state yet mCurrentState = NULL; mLastState = NULL; + mLastTransition = NULL; mStateDiagram = NULL; } diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp index 9e4957342c..297322fe58 100644 --- a/indra/llcharacter/llvisualparam.cpp +++ b/indra/llcharacter/llvisualparam.cpp @@ -173,7 +173,8 @@ LLVisualParam::LLVisualParam() mTargetWeight( 0.f ), mIsAnimating( FALSE ), mID( -1 ), - mInfo( 0 ) + mInfo( 0 ), + mIsDummy(FALSE) { } @@ -224,7 +225,7 @@ BOOL LLVisualParam::parseData(LLXmlTreeNode *node) //----------------------------------------------------------------------------- // setWeight() //----------------------------------------------------------------------------- -void LLVisualParam::setWeight(F32 weight, BOOL set_by_user) +void LLVisualParam::setWeight(F32 weight, BOOL upload_bake) { if (mIsAnimating) { @@ -242,15 +243,22 @@ void LLVisualParam::setWeight(F32 weight, BOOL set_by_user) if (mNext) { - mNext->setWeight(weight, set_by_user); + mNext->setWeight(weight, upload_bake); } } //----------------------------------------------------------------------------- // setAnimationTarget() //----------------------------------------------------------------------------- -void LLVisualParam::setAnimationTarget(F32 target_value, BOOL set_by_user) +void LLVisualParam::setAnimationTarget(F32 target_value, BOOL upload_bake) { + // don't animate dummy parameters + if (mIsDummy) + { + setWeight(target_value, upload_bake); + return; + } + if (mInfo) { if (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) @@ -266,7 +274,7 @@ void LLVisualParam::setAnimationTarget(F32 target_value, BOOL set_by_user) if (mNext) { - mNext->setAnimationTarget(target_value, set_by_user); + mNext->setAnimationTarget(target_value, upload_bake); } } @@ -283,24 +291,24 @@ void LLVisualParam::setNextParam( LLVisualParam *next ) //----------------------------------------------------------------------------- // animate() //----------------------------------------------------------------------------- -void LLVisualParam::animate( F32 delta, BOOL set_by_user ) +void LLVisualParam::animate( F32 delta, BOOL upload_bake ) { if (mIsAnimating) { F32 new_weight = ((mTargetWeight - mCurWeight) * delta) + mCurWeight; - setWeight(new_weight, set_by_user); + setWeight(new_weight, upload_bake); } } //----------------------------------------------------------------------------- // stopAnimating() //----------------------------------------------------------------------------- -void LLVisualParam::stopAnimating(BOOL set_by_user) +void LLVisualParam::stopAnimating(BOOL upload_bake) { if (mIsAnimating && getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) { mIsAnimating = FALSE; - setWeight(mTargetWeight, set_by_user); + setWeight(mTargetWeight, upload_bake); } } diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index 0b516b9374..12b45e6ebe 100644 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -113,10 +113,10 @@ public: //virtual BOOL parseData( LLXmlTreeNode *node ) = 0; virtual void apply( ESex avatar_sex ) = 0; // Default functions - virtual void setWeight(F32 weight, BOOL set_by_user); - virtual void setAnimationTarget( F32 target_value, BOOL set_by_user ); - virtual void animate(F32 delta, BOOL set_by_user); - virtual void stopAnimating(BOOL set_by_user); + 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 BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params); virtual void resetDrivenParams(); @@ -148,15 +148,19 @@ public: LLVisualParam* getNextParam() { return mNext; } void setNextParam( LLVisualParam *next ); - virtual void setAnimating(BOOL is_animating) { mIsAnimating = is_animating; } + virtual void setAnimating(BOOL is_animating) { mIsAnimating = is_animating && !mIsDummy; } BOOL getAnimating() const { return mIsAnimating; } + void setIsDummy(BOOL is_dummy) { mIsDummy = is_dummy; } + protected: F32 mCurWeight; // current weight F32 mLastWeight; // last weight LLVisualParam* mNext; // next param in a shared chain F32 mTargetWeight; // interpolation target BOOL mIsAnimating; // this value has been given an interpolation target + BOOL mIsDummy; // this is used to prevent dummy visual params from animating + S32 mID; // id for storing weight/morphtarget compares compactly LLVisualParamInfo *mInfo; |