diff options
Diffstat (limited to 'indra/llcharacter')
-rw-r--r-- | indra/llcharacter/llheadrotmotion.cpp | 20 | ||||
-rw-r--r-- | indra/llcharacter/lljointstate.h | 2 | ||||
-rw-r--r-- | indra/llcharacter/llmotioncontroller.cpp | 21 | ||||
-rw-r--r-- | indra/llcharacter/llmotioncontroller.h | 2 | ||||
-rw-r--r-- | indra/llcharacter/llvisualparam.h | 4 |
5 files changed, 24 insertions, 25 deletions
diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp index 66b675e34d..cbce927ced 100644 --- a/indra/llcharacter/llheadrotmotion.cpp +++ b/indra/llcharacter/llheadrotmotion.cpp @@ -418,6 +418,10 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) up.setVec(eye_look_at % left); target_eye_rot = LLQuaternion(eye_look_at, left, up); + // convert target rotation to head-local coordinates + target_eye_rot *= ~mHeadJoint->getWorldRotation(); + // constrain target orientation to be in front of avatar's face + target_eye_rot.constrain(EYE_ROT_LIMIT_ANGLE); // calculate vergence F32 interocular_dist = (mLeftEyeState.getJoint()->getWorldPosition() - mRightEyeState.getJoint()->getWorldPosition()).magVec(); @@ -426,7 +430,7 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) } else { - target_eye_rot = mHeadJoint->getWorldRotation(); + target_eye_rot = LLQuaternion::DEFAULT; vergence = 0.f; } @@ -468,18 +472,8 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) vergence_quat.transQuat(); right_eye_rot = vergence_quat * eye_jitter_rot * right_eye_rot; - //set final eye rotations - // start with left - LLQuaternion tQw = mLeftEyeState.getJoint()->getParent()->getWorldRotation(); - LLQuaternion tQh = left_eye_rot * ~tQw; - tQh.constrain(EYE_ROT_LIMIT_ANGLE); - mLeftEyeState.setRotation( tQh ); - - // now do right eye - tQw = mRightEyeState.getJoint()->getParent()->getWorldRotation(); - tQh = right_eye_rot * ~tQw; - tQh.constrain(EYE_ROT_LIMIT_ANGLE); - mRightEyeState.setRotation( tQh ); + mLeftEyeState.setRotation( left_eye_rot ); + mRightEyeState.setRotation( right_eye_rot ); return TRUE; } diff --git a/indra/llcharacter/lljointstate.h b/indra/llcharacter/lljointstate.h index 82a2b345b0..c1c68ff065 100644 --- a/indra/llcharacter/lljointstate.h +++ b/indra/llcharacter/lljointstate.h @@ -98,7 +98,7 @@ public: void setScale( const LLVector3& scale ) { llassert(mUsage & SCALE); mScale = scale; } // get/set priority - const LLJoint::JointPriority getPriority() { return mPriority; } + LLJoint::JointPriority getPriority() { return mPriority; } void setPriority( const LLJoint::JointPriority priority ) { mPriority = priority; } }; diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index fad69fc6e9..592a6bae2c 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -340,7 +340,7 @@ BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset) { if (motion->isStopped()) // motion has been stopped { - deactivateMotion(motion); + deactivateMotion(motion, false); } else if (mTime < motion->mSendStopTimestamp) // motion is still active { @@ -376,7 +376,7 @@ BOOL LLMotionController::stopMotionLocally(const LLUUID &id, BOOL stop_immediate if (stop_immediate) { - deactivateMotion(motion); + deactivateMotion(motion, false); } return TRUE; } @@ -472,7 +472,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty { if (motionp->isStopped() && mTime > motionp->getStopTime() + motionp->getEaseOutDuration()) { - deactivateMotion(motionp); + deactivateMotion(motionp, false); } else if (motionp->isStopped() && mTime > motionp->getStopTime()) { @@ -526,8 +526,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty { if (motionp->isStopped() && mTime > motionp->getStopTime() + motionp->getEaseOutDuration()) { - posep->setWeight(0.f); - deactivateMotion(motionp); + deactivateMotion(motionp, true); } continue; } @@ -553,8 +552,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty } else { - posep->setWeight(0.f); - deactivateMotion(motionp); + deactivateMotion(motionp, true); continue; } } @@ -802,8 +800,15 @@ BOOL LLMotionController::activateMotion(LLMotion *motion, F32 time) //----------------------------------------------------------------------------- // deactivateMotion() //----------------------------------------------------------------------------- -BOOL LLMotionController::deactivateMotion(LLMotion *motion) +BOOL LLMotionController::deactivateMotion(LLMotion *motion, bool remove_weight) { + if( remove_weight ) + { + // immediately remove pose weighting instead of letting it time out + LLPose *posep = motion->getPose(); + posep->setWeight(0.f); + } + motion->deactivate(); mActiveMotions.remove(motion); diff --git a/indra/llcharacter/llmotioncontroller.h b/indra/llcharacter/llmotioncontroller.h index 15791b6318..19bab09a11 100644 --- a/indra/llcharacter/llmotioncontroller.h +++ b/indra/llcharacter/llmotioncontroller.h @@ -162,7 +162,7 @@ protected: void deleteAllMotions(); void addLoadedMotion(LLMotion *motion); BOOL activateMotion(LLMotion *motion, F32 time); - BOOL deactivateMotion(LLMotion *motion); + BOOL deactivateMotion(LLMotion *motion, bool remove_weight); void updateRegularMotions(); void updateAdditiveMotions(); void resetJointSignatures(); diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index 2a8d03d431..d91cba4423 100644 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -88,7 +88,7 @@ public: virtual void stopAnimating(BOOL set_by_user); // Interface methods - const S32 getID() { return mID; } + S32 getID() { return mID; } void setID(S32 id) { llassert(!mInfo); mID = id; } const LLString& getName() const { return mInfo->mName; } @@ -100,7 +100,7 @@ public: void setMaxDisplayName(const char* s) { mInfo->mMaxName = s; } void setMinDisplayName(const char* s) { mInfo->mMinName = s; } - const EVisualParamGroup getGroup() { return mInfo->mGroup; } + EVisualParamGroup getGroup() { return mInfo->mGroup; } F32 getMinWeight() { return mInfo->mMinWeight; } F32 getMaxWeight() { return mInfo->mMaxWeight; } F32 getDefaultWeight() { return mInfo->mDefaultWeight; } |