diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2016-03-10 10:12:25 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2016-03-10 10:12:25 -0500 |
commit | 05bd94268d99a34b4f4b1556e3088cbf134034f9 (patch) | |
tree | 12a585c5a1c6fd6297f31e5e3b7b312b0cde67b1 | |
parent | d56533609431b213810928d204e3720fecd42b82 (diff) |
SL-315 - wip on joint reset
-rwxr-xr-x | indra/llappearance/llavatarappearance.cpp | 29 | ||||
-rwxr-xr-x | indra/llcharacter/llvisualparam.h | 1 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 21 |
3 files changed, 39 insertions, 12 deletions
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index 3bf8ae6036..9b9657b4c8 100755 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -643,9 +643,11 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent //----------------------------------------------------------------------------- BOOL LLAvatarAppearance::allocateCharacterJoints( U32 num ) { - clearSkeleton(); - - mSkeleton = avatar_joint_list_t(num,NULL); + if (mSkeleton.size() != num) + { + clearSkeleton(); + mSkeleton = avatar_joint_list_t(num,NULL); + } return TRUE; } @@ -1510,16 +1512,19 @@ LLTexLayerSet* LLAvatarAppearance::getAvatarLayerSet(EBakedTextureIndex baked_in //----------------------------------------------------------------------------- BOOL LLAvatarAppearance::allocateCollisionVolumes( U32 num ) { - delete_and_clear_array(mCollisionVolumes); - mNumCollisionVolumes = 0; - - mCollisionVolumes = new LLAvatarJointCollisionVolume[num]; - if (!mCollisionVolumes) - { - return FALSE; - } + if (mNumCollisionVolumes !=num) + { + delete_and_clear_array(mCollisionVolumes); + mNumCollisionVolumes = 0; - mNumCollisionVolumes = num; + mCollisionVolumes = new LLAvatarJointCollisionVolume[num]; + if (!mCollisionVolumes) + { + return FALSE; + } + + mNumCollisionVolumes = num; + } return TRUE; } diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index c6b97d7e8b..0ad063fd1e 100755 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -150,6 +150,7 @@ public: F32 getWeight() const { return mIsAnimating ? mTargetWeight : mCurWeight; } F32 getCurrentWeight() const { return mCurWeight; } F32 getLastWeight() const { return mLastWeight; } + void setLastWeight(F32 val) { mLastWeight = val; } BOOL isAnimating() const { return mIsAnimating; } BOOL isTweakable() const { return (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) || (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4d6f0f78b2..9bee4380eb 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1807,6 +1807,27 @@ void LLVOAvatar::buildCharacter() void LLVOAvatar::resetSkeleton() { LL_DEBUGS("Avatar") << avString() << LL_ENDL; + + // Reset params + for (LLVisualParam *param = getFirstVisualParam(); + param; + param = getNextVisualParam()) + { + if (param->isAnimating()) + { + continue; + } + param->setLastWeight(param->getDefaultWeight()); + } + + // Reset all bones and collision volumes to their initial skeleton state. + if( !buildSkeleton(sAvatarSkeletonInfo) ) + { + LL_ERRS() << "Error resetting skeleton" << LL_ENDL; + } + + // Apply params + updateVisualParams(); } //----------------------------------------------------------------------------- |