SL-315 - fixed collision volume scale issue in resetSkeleton()
parent
bb2c147c26
commit
e8afa4c413
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1854,20 +1854,30 @@ void LLVOAvatar::resetSkeleton()
|
|||
return;
|
||||
}
|
||||
|
||||
// Stop all animations
|
||||
|
||||
// Clear all attachment pos overrides
|
||||
clearAttachmentPosOverrides();
|
||||
|
||||
// Reset some params to default state, without propagating changes downstream.
|
||||
resetVisualParams();
|
||||
|
||||
// Reset all bones and collision volumes to their initial skeleton state.
|
||||
// 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 attachment points
|
||||
|
||||
// Reset some params to default state, without propagating changes downstream.
|
||||
resetVisualParams();
|
||||
|
||||
// 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 (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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue