diff options
-rw-r--r-- | indra/llappearance/llpolyskeletaldistortion.cpp | 13 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 19 |
2 files changed, 26 insertions, 6 deletions
diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp index f75603e083..fdce8d97ce 100644 --- a/indra/llappearance/llpolyskeletaldistortion.cpp +++ b/indra/llappearance/llpolyskeletaldistortion.cpp @@ -34,6 +34,7 @@ #include "llpolymorph.h" #include "llwearable.h" #include "llfasttimer.h" +#include "llcallstack.h" #include "llpolyskeletaldistortion.h" @@ -134,7 +135,6 @@ LLPolySkeletalDistortion::~LLPolySkeletalDistortion() BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) { - //llassert(mInfo == NULL); if (info->mID < 0) { return FALSE; @@ -154,6 +154,7 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) continue; } + // BENTO remove? //if (mJointScales.find(joint) != mJointScales.end()) //{ // LL_WARNS() << "Scale deformation already supplied for joint " << joint->getName() << "." << LL_ENDL; @@ -177,6 +178,7 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) if (bone_info->mHasPositionDeformation) { + // BENTO remove? //if (mJointOffsets.find(joint) != mJointOffsets.end()) //{ // LL_WARNS() << "Offset deformation already supplied for joint " << joint->getName() << "." << LL_ENDL; @@ -213,9 +215,16 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex ) joint = iter->first; LLVector3 newScale = joint->getScale(); LLVector3 scaleDelta = iter->second; - newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta); + LLVector3 offset = (effective_weight - mLastWeight) * scaleDelta; + newScale = newScale + offset; //An aspect of attached mesh objects (which contain joint offsets) that need to be cleaned up when detached // needed? // joint->storeScaleForReset( newScale ); + + // BENTO debugging stuff can be pulled. + std::stringstream ostr; + ostr << "LLPolySkeletalDistortion::apply, id " << getID() << " " << getName() << " effective wt " << effective_weight << " last wt " << mLastWeight << " scaleDelta " << scaleDelta << " offset " << offset; + LLScopedContextString str(ostr.str()); + joint->setScale(newScale); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 23008839ee..fb7b7d3ef8 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1854,20 +1854,30 @@ void LLVOAvatar::resetSkeleton() return; } - // Stop all animations - // Clear all attachment pos overrides clearAttachmentPosOverrides(); + // Note that we call buildSkeleton twice in this function. The first time is + // just to get the right scale for the collision volumes, because + // this will be used in setting the mJointScales for the + // LLPolySkeletalDistortions of which the CVs are children. + if( !buildSkeleton(sAvatarSkeletonInfo) ) + { + LL_ERRS() << "Error resetting skeleton" << LL_ENDL; + } + // Reset some params to default state, without propagating changes downstream. resetVisualParams(); - // Reset all bones and collision volumes to their initial skeleton state. + // Now we have to reset the skeleton again, because its state + // got clobbered by the resetVisualParams() calls + // above. if( !buildSkeleton(sAvatarSkeletonInfo) ) { LL_ERRS() << "Error resetting skeleton" << LL_ENDL; } - // Reset attachment points + + // Reset attachment points (buildSkeleton only does bones and CVs) bool ignore_hud_joints = true; initAttachmentPoints(ignore_hud_joints); @@ -1897,6 +1907,7 @@ void LLVOAvatar::resetSkeleton() rebuildAttachmentPosOverrides(); // Restart animations + resetAnimations(); LL_DEBUGS("Avatar") << avString() << " reset ends" << LL_ENDL; } |