summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2017-12-21 20:03:56 +0000
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2017-12-21 20:03:56 +0000
commit095dd1b800d82a0fc97177a6fb668ddc72943613 (patch)
tree072626099b6549557b401069567ea8116facb22e /indra
parentb78354ac79385bcb28316aa3f43913393ad8c5ab (diff)
SL-859 - create control avatar if needed when animation request received
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llviewermessage.cpp1
-rw-r--r--indra/newview/llviewerobject.cpp28
-rw-r--r--indra/newview/llviewerobject.h2
-rw-r--r--indra/newview/llvovolume.cpp35
4 files changed, 36 insertions, 30 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index bfaad30fc1..46dcf06ebd 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5103,6 +5103,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data)
return;
}
+ volp->updateControlAvatar();
LLControlAvatar *avatarp = volp->getControlAvatar();
if (!avatarp)
{
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 915b4348b4..fdfc54b67e 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -2947,6 +2947,34 @@ LLControlAvatar *LLViewerObject::getControlAvatar() const
return getRootEdit()->mControlAvatar.get();
}
+void LLViewerObject::updateControlAvatar()
+{
+ LLViewerObject *root = getRootEdit();
+ if (root->isAnimatedObject() && !root->getControlAvatar())
+ {
+ bool any_mesh = root->isMesh();
+ LLViewerObject::const_child_list_t& child_list = root->getChildren();
+ for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ const LLViewerObject* child = *iter;
+ any_mesh = any_mesh || child->isMesh();
+ }
+ if (any_mesh)
+ {
+ std::string vobj_name = llformat("Vol%u", (U32) root);
+ LL_DEBUGS("AnimatedObjects") << vobj_name << " calling linkControlAvatar()" << LL_ENDL;
+ root->linkControlAvatar();
+ }
+ }
+ if (!root->isAnimatedObject() && root->getControlAvatar())
+ {
+ std::string vobj_name = llformat("Vol%u", (U32) root);
+ LL_DEBUGS("AnimatedObjects") << vobj_name << " calling unlinkControlAvatar()" << LL_ENDL;
+ root->unlinkControlAvatar();
+ }
+}
+
void LLViewerObject::linkControlAvatar()
{
if (!getControlAvatar() && isRootEdit())
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 4a2ccd4e3a..237529f213 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -703,6 +703,8 @@ public:
void linkControlAvatar();
// Remove any reference to control av for this prim
void unlinkControlAvatar();
+ // Link or unlink as needed
+ void updateControlAvatar();
virtual bool isAnimatedObject() const;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index ad72fa9480..1725ae4c8a 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5046,38 +5046,13 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
rigged = rigged || (vobj->isAnimatedObject() && vobj->isRiggedMesh() &&
vobj->getControlAvatar() && vobj->getControlAvatar()->mPlaying);
- if (vobj->isAnimatedObject())
+ vobj->updateControlAvatar();
+ if (vobj->getControlAvatar())
{
- if (!vobj->getControlAvatar())
- {
- F32 tri_count = vobj->getRootEdit()->recursiveGetEstTrianglesMax();
- if (tri_count <= 0.f)
- {
- LL_DEBUGS("AnimatedObjects") << vobj_name << " not calling linkControlAvatar(), because no tris" << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("AnimatedObjects") << vobj_name << " calling linkControlAvatar()" << LL_ENDL;
- vobj->linkControlAvatar();
- }
- }
- if (vobj->getControlAvatar())
- {
- rigged_av = vobj->getControlAvatar();
- rigged_av->rebuildAttachmentOverrides();
- }
+ rigged_av = vobj->getControlAvatar();
+ rigged_av->rebuildAttachmentOverrides();
}
- else
- {
- // Not animated but has a control avatar - probably
- // the checkbox has changed since the last rebuild.
- if (vobj->getControlAvatar())
- {
- LL_DEBUGS("AnimatedObjects") << vobj_name << " calling unlinkControlAvatar()" << LL_ENDL;
- vobj->unlinkControlAvatar();
- }
- }
-
+
bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic();
bool any_rigged_face = false;