diff options
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 93e470e0fb..8c3a180570 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -671,7 +671,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mCachedInMuteList(false), mIsControlAvatar(false), mIsUIAvatar(false), - mEnableDefaultMotions(true) + mEnableDefaultMotions(true), + mRiggingInfoNeedsUpdate(true) { LL_DEBUGS("AvatarRender") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL; @@ -1279,8 +1280,12 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) } } +static LLTrace::BlockTimerStatHandle FTM_AVATAR_EXTENT_UPDATE("Avatar Update Extent"); + void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) { + LL_RECORD_BLOCK_TIME(FTM_AVATAR_EXTENT_UPDATE); + S32 box_detail = gSavedSettings.getS32("AvatarBoundingBoxComplexity"); LLVector4a buffer(0.0); LLVector4a pos; @@ -1364,7 +1369,13 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) // Stretch bounding box by rigged mesh joint boxes if (box_detail>=3) { - updateRiggingInfo(); + // AXON try to cache unless something has changed about attached rigged meshes. + // Needs more logic based on volume states. + //if (mRiggingInfoNeedsUpdate) + { + updateRiggingInfo(); + mRiggingInfoNeedsUpdate = false; + } for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++) { LLJoint *joint = getJoint(joint_num); @@ -5854,8 +5865,6 @@ void LLVOAvatar::clearAttachmentOverrides() { LLScopedContextString str("clearAttachmentOverrides " + getFullname()); - mActiveOverrideMeshes.clear(); - for (S32 i=0; i<LL_CHARACTER_MAX_ANIMATED_JOINTS; i++) { LLJoint *pJoint = getJoint(i); @@ -5876,6 +5885,9 @@ void LLVOAvatar::clearAttachmentOverrides() } postPelvisSetRecalc(); } + + mActiveOverrideMeshes.clear(); + onActiveOverrideMeshesChanged(); } //----------------------------------------------------------------------------- @@ -6130,8 +6142,6 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL bool fullRig = (jointCnt>=JOINT_COUNT_REQUIRED_FOR_FULLRIG) ? true : false; if ( fullRig && !mesh_overrides_loaded ) { - mActiveOverrideMeshes.insert(mesh_id); - for ( int i=0; i<jointCnt; ++i ) { std::string lookingForJoint = pSkinData->mJointNames[i].c_str(); @@ -6174,6 +6184,8 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL } } + mActiveOverrideMeshes.insert(mesh_id); + onActiveOverrideMeshesChanged(); } } } @@ -6335,8 +6347,6 @@ void LLVOAvatar::removeAttachmentOverridesForObject(LLViewerObject *vo) //----------------------------------------------------------------------------- void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id) { - mActiveOverrideMeshes.erase(mesh_id); - LLJoint* pJointPelvis = getJoint("mPelvis"); const std::string av_string = avString(); for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++) @@ -6357,6 +6367,9 @@ void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id) } postPelvisSetRecalc(); + + mActiveOverrideMeshes.erase(mesh_id); + onActiveOverrideMeshesChanged(); } //----------------------------------------------------------------------------- // getCharacterPosition() @@ -9444,20 +9457,7 @@ void LLVOAvatar::updateLODRiggedAttachments() rebuildRiggedAttachments(); } -S32 countRigInfoTab(joint_rig_info_tab& tab) -{ - S32 count=0; - for (S32 i=0; i<tab.size(); i++) - { - if (tab[i].isRiggedTo()) - { - count++; - } - } - return count; -} - -void showRigInfoTabExtents(LLVOAvatar *avatar, joint_rig_info_tab& tab, S32& count_rigged, S32& count_box) +void showRigInfoTabExtents(LLVOAvatar *avatar, LLJointRiggingInfoTab& tab, S32& count_rigged, S32& count_box) { count_rigged = count_box = 0; LLVector4a zero_vec; @@ -9494,7 +9494,7 @@ void LLVOAvatar::updateRiggingInfo() { LLViewerObject* attached_object = *attach_iter; attached_object->updateRiggingInfo(); - mergeRigInfoTab(mJointRiggingInfoTab, attached_object->mJointRiggingInfoTab); + mJointRiggingInfoTab.merge(attached_object->mJointRiggingInfoTab); //LL_INFOS() << "after merge rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL; @@ -9504,7 +9504,7 @@ void LLVOAvatar::updateRiggingInfo() { LLViewerObject *childp = *it; childp->updateRiggingInfo(); - mergeRigInfoTab(mJointRiggingInfoTab, childp->mJointRiggingInfoTab); + mJointRiggingInfoTab.merge(childp->mJointRiggingInfoTab); //LL_INFOS() << "after merge rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL; } } @@ -9515,9 +9515,8 @@ void LLVOAvatar::updateRiggingInfo() LLVOVolume *volp = control_av->mRootVolp; if (volp && !volp->isAttachment()) { - volp->updateRiggingInfo(); - mergeRigInfoTab(mJointRiggingInfoTab, volp->mJointRiggingInfoTab); - LL_DEBUGS("RigSpammish") << getFullname() << " after cav update rig tab:" << LL_ENDL; + mJointRiggingInfoTab.merge(volp->mJointRiggingInfoTab); + LL_DEBUGS("RigSpammish") << getFullname() << " mRootVolp " << control_av->mRootVolp << " after cav update rig tab:" << LL_ENDL; S32 joint_count, box_count; showRigInfoTabExtents(this, mJointRiggingInfoTab, joint_count, box_count); LL_DEBUGS("RigSpammish") << "uses " << joint_count << " joints " << " nonzero boxes: " << box_count << LL_ENDL; @@ -9529,7 +9528,7 @@ void LLVOAvatar::updateRiggingInfo() { LLViewerObject *childp = *it; childp->updateRiggingInfo(); - mergeRigInfoTab(mJointRiggingInfoTab, childp->mJointRiggingInfoTab); + mJointRiggingInfoTab.merge(childp->mJointRiggingInfoTab); LL_DEBUGS("RigSpammish") << getFullname() << " after cav child update rig tab:" << LL_ENDL; S32 joint_count, box_count; @@ -9547,6 +9546,12 @@ void LLVOAvatar::updateRiggingInfo() LL_DEBUGS("RigSpammish") << "uses " << joint_count << " joints " << " nonzero boxes: " << box_count << LL_ENDL; } +// virtual +void LLVOAvatar::onActiveOverrideMeshesChanged() +{ + mRiggingInfoNeedsUpdate = true; +} + U32 LLVOAvatar::getPartitionType() const { // Avatars merely exist as drawables in the bridge partition |