From ae15778eebafa6c8f69cedd51fe5fe1a5f7b543b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 1 Jun 2012 15:51:14 -0500 Subject: Add some timers. --- indra/llcharacter/llcharacter.cpp | 6 +++++- indra/llcharacter/lleditingmotion.cpp | 3 +++ indra/llcharacter/llkeyframewalkmotion.cpp | 4 ++++ indra/llcharacter/llmotioncontroller.cpp | 24 ++++++++++++++++++++---- 4 files changed, 32 insertions(+), 5 deletions(-) (limited to 'indra/llcharacter') diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index c9fb8534f1..0a6a8f9fa6 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -189,6 +189,7 @@ void LLCharacter::requestStopMotion( LLMotion* motion) //----------------------------------------------------------------------------- static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation"); static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim"); +static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS("Update Motions"); void LLCharacter::updateMotions(e_update_t update_type) { @@ -206,7 +207,10 @@ void LLCharacter::updateMotions(e_update_t update_type) mMotionController.unpauseAllMotions(); } bool force_update = (update_type == FORCE_UPDATE); - mMotionController.updateMotions(force_update); + { + LLFastTimer t(FTM_UPDATE_MOTIONS); + mMotionController.updateMotions(force_update); + } } } diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp index 66b3c2bd25..830e323476 100644 --- a/indra/llcharacter/lleditingmotion.cpp +++ b/indra/llcharacter/lleditingmotion.cpp @@ -158,11 +158,14 @@ BOOL LLEditingMotion::onActivate() return TRUE; } +static LLFastTimer::DeclareTimer FTM_EDITING_MOTION("Editing Motion"); + //----------------------------------------------------------------------------- // LLEditingMotion::onUpdate() //----------------------------------------------------------------------------- BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask) { + LLFastTimer t(FTM_EDITING_MOTION); LLVector3 focus_pt; LLVector3* pointAtPt = (LLVector3*)mCharacter->getAnimationData("PointAtPoint"); diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index d52eb89a5c..ea63f9f8dc 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -196,11 +196,15 @@ BOOL LLWalkAdjustMotion::onActivate() return TRUE; } +static LLFastTimer::DeclareTimer FTM_WALK_ADJUST_MOTION("Walk Adjust"); + //----------------------------------------------------------------------------- // LLWalkAdjustMotion::onUpdate() //----------------------------------------------------------------------------- BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) { + LLFastTimer t(FTM_WALK_ADJUST_MOTION); + // delta_time is guaranteed to be non zero F32 delta_time = llclamp(time - mLastTime, TIME_EPSILON, MAX_TIME_DELTA); mLastTime = time; diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index bb892f4a7f..e7ec83efc0 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -539,11 +539,14 @@ void LLMotionController::updateIdleActiveMotions() } } +static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS_BY_TYPE("Update Motions By Type"); + //----------------------------------------------------------------------------- // updateMotionsByType() //----------------------------------------------------------------------------- void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type) { + LLFastTimer t(FTM_UPDATE_MOTIONS_BY_TYPE); BOOL update_result = TRUE; U8 last_joint_signature[LL_CHARACTER_MAX_JOINTS]; @@ -795,6 +798,9 @@ void LLMotionController::updateLoadingMotions() // call updateMotion() or updateMotionsMinimal() every frame //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_UPDATE_MOTION_PURGE_EXCESS("Purge Excess Motions"); +static LLFastTimer::DeclareTimer FTM_UPDATE_LOADING_MOTIONS("Update Loading Motions"); + //----------------------------------------------------------------------------- // updateMotion() //----------------------------------------------------------------------------- @@ -808,8 +814,11 @@ void LLMotionController::updateMotions(bool force_update) mPrevTimerElapsed = cur_time; mLastTime = mAnimTime; - // Always cap the number of loaded motions - purgeExcessMotions(); + { + LLFastTimer t(FTM_UPDATE_MOTION_PURGE_EXCESS); + // Always cap the number of loaded motions + purgeExcessMotions(); + } // Update timing info for this time step. if (!mPaused) @@ -831,7 +840,11 @@ void LLMotionController::updateMotions(bool force_update) mLastInterp = interp; } - updateLoadingMotions(); + { + LLFastTimer t(FTM_UPDATE_LOADING_MOTIONS); + updateLoadingMotions(); + } + return; } @@ -849,7 +862,10 @@ void LLMotionController::updateMotions(bool force_update) } } - updateLoadingMotions(); + { + LLFastTimer t(FTM_UPDATE_LOADING_MOTIONS); + updateLoadingMotions(); + } resetJointSignatures(); -- cgit v1.2.3 From 92ee373e45b34d5eb7e403480ae1f579b27c4eb6 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 5 Jun 2012 12:55:17 -0500 Subject: MAINT-646 Factor std::set out of lloctree --- indra/llcharacter/llcharacter.cpp | 7 ------- indra/llcharacter/lleditingmotion.cpp | 3 --- indra/llcharacter/llkeyframewalkmotion.cpp | 4 ---- indra/llcharacter/llmotioncontroller.cpp | 29 +++++++---------------------- 4 files changed, 7 insertions(+), 36 deletions(-) (limited to 'indra/llcharacter') diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 0a6a8f9fa6..07f0baae51 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -187,20 +187,14 @@ void LLCharacter::requestStopMotion( LLMotion* motion) //----------------------------------------------------------------------------- // updateMotions() //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation"); -static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim"); -static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS("Update Motions"); - void LLCharacter::updateMotions(e_update_t update_type) { 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) { @@ -208,7 +202,6 @@ void LLCharacter::updateMotions(e_update_t update_type) } bool force_update = (update_type == FORCE_UPDATE); { - LLFastTimer t(FTM_UPDATE_MOTIONS); mMotionController.updateMotions(force_update); } } diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp index 830e323476..66b3c2bd25 100644 --- a/indra/llcharacter/lleditingmotion.cpp +++ b/indra/llcharacter/lleditingmotion.cpp @@ -158,14 +158,11 @@ BOOL LLEditingMotion::onActivate() return TRUE; } -static LLFastTimer::DeclareTimer FTM_EDITING_MOTION("Editing Motion"); - //----------------------------------------------------------------------------- // LLEditingMotion::onUpdate() //----------------------------------------------------------------------------- BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask) { - LLFastTimer t(FTM_EDITING_MOTION); LLVector3 focus_pt; LLVector3* pointAtPt = (LLVector3*)mCharacter->getAnimationData("PointAtPoint"); diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index ea63f9f8dc..d52eb89a5c 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -196,15 +196,11 @@ BOOL LLWalkAdjustMotion::onActivate() return TRUE; } -static LLFastTimer::DeclareTimer FTM_WALK_ADJUST_MOTION("Walk Adjust"); - //----------------------------------------------------------------------------- // LLWalkAdjustMotion::onUpdate() //----------------------------------------------------------------------------- BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) { - LLFastTimer t(FTM_WALK_ADJUST_MOTION); - // delta_time is guaranteed to be non zero F32 delta_time = llclamp(time - mLastTime, TIME_EPSILON, MAX_TIME_DELTA); mLastTime = time; diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index e7ec83efc0..236b8c616d 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -539,14 +539,11 @@ void LLMotionController::updateIdleActiveMotions() } } -static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS_BY_TYPE("Update Motions By Type"); - //----------------------------------------------------------------------------- // updateMotionsByType() //----------------------------------------------------------------------------- void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type) { - LLFastTimer t(FTM_UPDATE_MOTIONS_BY_TYPE); BOOL update_result = TRUE; U8 last_joint_signature[LL_CHARACTER_MAX_JOINTS]; @@ -798,9 +795,6 @@ void LLMotionController::updateLoadingMotions() // call updateMotion() or updateMotionsMinimal() every frame //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_UPDATE_MOTION_PURGE_EXCESS("Purge Excess Motions"); -static LLFastTimer::DeclareTimer FTM_UPDATE_LOADING_MOTIONS("Update Loading Motions"); - //----------------------------------------------------------------------------- // updateMotion() //----------------------------------------------------------------------------- @@ -814,12 +808,9 @@ void LLMotionController::updateMotions(bool force_update) mPrevTimerElapsed = cur_time; mLastTime = mAnimTime; - { - LLFastTimer t(FTM_UPDATE_MOTION_PURGE_EXCESS); - // Always cap the number of loaded motions - purgeExcessMotions(); - } - + // Always cap the number of loaded motions + purgeExcessMotions(); + // Update timing info for this time step. if (!mPaused) { @@ -840,11 +831,8 @@ void LLMotionController::updateMotions(bool force_update) mLastInterp = interp; } - { - LLFastTimer t(FTM_UPDATE_LOADING_MOTIONS); - updateLoadingMotions(); - } - + updateLoadingMotions(); + return; } @@ -862,11 +850,8 @@ void LLMotionController::updateMotions(bool force_update) } } - { - LLFastTimer t(FTM_UPDATE_LOADING_MOTIONS); - updateLoadingMotions(); - } - + updateLoadingMotions(); + resetJointSignatures(); if (mPaused && !force_update) -- cgit v1.2.3 From 575aa87300725146dbec95f5ad20ba0b70f5edea Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 6 Jun 2012 17:16:16 -0500 Subject: MAINT-646 Vectorize LLPolyMesh --- indra/llcharacter/llcharacter.cpp | 7 +++++++ indra/llcharacter/llmotioncontroller.cpp | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'indra/llcharacter') diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 07f0baae51..0a6a8f9fa6 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -187,14 +187,20 @@ void LLCharacter::requestStopMotion( LLMotion* motion) //----------------------------------------------------------------------------- // updateMotions() //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation"); +static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim"); +static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS("Update Motions"); + void LLCharacter::updateMotions(e_update_t update_type) { 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) { @@ -202,6 +208,7 @@ void LLCharacter::updateMotions(e_update_t update_type) } bool force_update = (update_type == FORCE_UPDATE); { + LLFastTimer t(FTM_UPDATE_MOTIONS); mMotionController.updateMotions(force_update); } } diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 236b8c616d..4f6351709e 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -542,6 +542,8 @@ void LLMotionController::updateIdleActiveMotions() //----------------------------------------------------------------------------- // updateMotionsByType() //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_MOTION_ON_UPDATE("Motion onUpdate"); + void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type) { BOOL update_result = TRUE; @@ -699,7 +701,10 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty } // perform motion update - update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); + { + LLFastTimer t(FTM_MOTION_ON_UPDATE); + update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); + } } //********************** @@ -862,11 +867,12 @@ void LLMotionController::updateMotions(bool force_update) { // update additive motions updateAdditiveMotions(); + resetJointSignatures(); - + // update all regular motions updateRegularMotions(); - + if (use_quantum) { mPoseBlender.blendAndCache(TRUE); -- cgit v1.2.3 From 08f35b6a14f4643f8110e3940f061b1319a1bb32 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 26 Jul 2012 17:07:12 +0200 Subject: STORM-1899: Avatar hand poses randomly get stuck in spread position --- indra/llcharacter/llhandmotion.cpp | 60 ++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) (limited to 'indra/llcharacter') diff --git a/indra/llcharacter/llhandmotion.cpp b/indra/llcharacter/llhandmotion.cpp index 63937d8255..696dba0d95 100644 --- a/indra/llcharacter/llhandmotion.cpp +++ b/indra/llcharacter/llhandmotion.cpp @@ -132,18 +132,68 @@ BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask) { if (mNewPose != HAND_POSE_RELAXED && mNewPose != mCurrentPose) { - mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f); + // Only set param weight for poses other than + // default (HAND_POSE_SPREAD); HAND_POSE_SPREAD + // is not an animatable morph! + if (mNewPose != HAND_POSE_SPREAD) + { + mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f); + } + + // Reset morph weight for current pose back to its + // full extend or it might be stuck somewhere in the middle if a + // pose is requested and the old pose is requested again shortly + // after while still blending to the other pose! + if (mCurrentPose != HAND_POSE_SPREAD) + { + mCharacter->setVisualParamWeight(gHandPoseNames[mCurrentPose], 1.f); + } + + // Update visual params now if we won't blend + if (mCurrentPose == HAND_POSE_RELAXED) + { + mCharacter->updateVisualParams(); + } } mNewPose = HAND_POSE_RELAXED; } else { - // this is a new morph we didn't know about before - if (*requestedHandPose != mNewPose && mNewPose != mCurrentPose && mNewPose != HAND_POSE_SPREAD) + // Sometimes we seem to get garbage here, with poses that are out of bounds. + // So check for a valid pose first. + if (*requestedHandPose >= 0 && *requestedHandPose < NUM_HAND_POSES) + { + // This is a new morph we didn't know about before: + // Reset morph weight for both current and new pose + // back their starting values while still blending. + if (*requestedHandPose != mNewPose && mNewPose != mCurrentPose) + { + if (mNewPose != HAND_POSE_SPREAD) + { + mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f); + } + + // Reset morph weight for current pose back to its full extend + // or it might be stuck somewhere in the middle if a pose is + // requested and the old pose is requested again shortly after + // while still blending to the other pose! + if (mCurrentPose != HAND_POSE_SPREAD) + { + mCharacter->setVisualParamWeight(gHandPoseNames[mCurrentPose], 1.f); + } + + // Update visual params now if we won't blend + if (mCurrentPose == *requestedHandPose) + { + mCharacter->updateVisualParams(); + } + } + mNewPose = *requestedHandPose; + } + else { - mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f); + llwarns << "Requested hand pose out of range. Ignoring requested pose." << llendl; } - mNewPose = *requestedHandPose; } mCharacter->removeAnimationData("Hand Pose"); -- cgit v1.2.3