summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
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/newview/llviewerobject.cpp
parentb78354ac79385bcb28316aa3f43913393ad8c5ab (diff)
SL-859 - create control avatar if needed when animation request received
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--indra/newview/llviewerobject.cpp28
1 files changed, 28 insertions, 0 deletions
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())