summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2018-04-06 20:29:32 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2018-04-06 20:29:32 +0100
commitb35cfb489a78110b705f7afe878d258523727fa6 (patch)
treec2ebd0244181b8461c50c6fb0418c963b83cbe27
parent501351915ce2df618241c5f6923cc0c0a869fdcd (diff)
MAINT-8239 - avatar remembers which meshes it knows overrides for, making some updates more efficient. addAttachmentOverrides() called in rebuildGeom()
-rw-r--r--indra/newview/llvoavatar.cpp22
-rw-r--r--indra/newview/llvoavatar.h4
-rw-r--r--indra/newview/llvovolume.cpp7
3 files changed, 29 insertions, 4 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index edb7856de1..a31d48dc4f 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5794,6 +5794,8 @@ void LLVOAvatar::clearAttachmentOverrides()
{
LLScopedContextString str("clearAttachmentOverrides " + getFullname());
+ mActiveOverrideMeshes.clear();
+
for (S32 i=0; i<LL_CHARACTER_MAX_ANIMATED_JOINTS; i++)
{
LLJoint *pJoint = getJoint(i);
@@ -5920,10 +5922,24 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo)
const F32 pelvisZOffset = pSkinData->mPelvisOffset;
const LLUUID& mesh_id = pSkinData->mMeshID;
- LL_DEBUGS("AnimatedObjects") << "adding attachment overrides for " << mesh_id << " to root object " << root_object->getID() << LL_ENDL;
+ bool mesh_overrides_loaded = (mActiveOverrideMeshes.find(mesh_id) != mActiveOverrideMeshes.end());
+ if (mesh_overrides_loaded)
+ {
+ LL_DEBUGS("AnimatedObjects") << "skipping add attachment overrides for " << mesh_id
+ << " to root object " << root_object->getID()
+ << ", already loaded"
+ << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("AnimatedObjects") << "adding attachment overrides for " << mesh_id
+ << " to root object " << root_object->getID() << LL_ENDL;
+ }
bool fullRig = (jointCnt>=JOINT_COUNT_REQUIRED_FOR_FULLRIG) ? true : false;
- if ( fullRig )
+ if ( fullRig && !mesh_overrides_loaded )
{
+ mActiveOverrideMeshes.insert(mesh_id);
+
for ( int i=0; i<jointCnt; ++i )
{
std::string lookingForJoint = pSkinData->mJointNames[i].c_str();
@@ -6127,6 +6143,8 @@ void LLVOAvatar::removeAttachmentOverridesForObject(LLViewerObject *vo)
//-----------------------------------------------------------------------------
void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id)
{
+ mActiveOverrideMeshes.erase(mesh_id);
+
//Subsequent joints are relative to pelvis
avatar_joint_list_t::iterator iter = mSkeleton.begin();
avatar_joint_list_t::iterator end = mSkeleton.end();
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index d7b67de2ad..92ea40affd 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -214,7 +214,9 @@ public:
void showAttachmentOverrides(bool verbose = false) const;
void getAttachmentOverrideNames(std::set<std::string>& pos_names,
std::set<std::string>& scale_names) const;
-
+
+ std::set<LLUUID> mActiveOverrideMeshes;
+
/*virtual*/ const LLUUID& getID() const;
/*virtual*/ void addDebugText(const std::string& text);
/*virtual*/ F32 getTimeDilation();
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 094b0b77dd..9f8c8aba74 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3530,7 +3530,7 @@ void LLVOVolume::afterReparent()
// notifyMeshLoaded() not being called reliably enough.
// was: getControlAvatar()->addAttachmentOverridesForObject(this);
- getControlAvatar()->rebuildAttachmentOverrides();
+ //getControlAvatar()->rebuildAttachmentOverrides();
getControlAvatar()->updateAnimations();
}
else
@@ -5152,6 +5152,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
drawablep->clearState(LLDrawable::HAS_ALPHA);
+ if (vobj->isRiggedMesh() && vobj->getAvatar())
+ {
+ vobj->getAvatar()->addAttachmentOverridesForObject(vobj);
+ }
+
// Standard rigged mesh attachments:
bool rigged = !vobj->isAnimatedObject() && vobj->isRiggedMesh() && vobj->isAttachment();
// Animated objects. Have to check for isRiggedMesh() to