summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2018-06-04 14:43:06 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2018-06-04 14:43:06 +0100
commit228525aa27b05cc1aa8be27de4ae59f5ec590ae3 (patch)
treedde50d01034b34b0c4f15a6ed2fd13efe30eb1e8 /indra/newview/llvoavatar.cpp
parente86839fac19753d0fa4006296c7f8909fe781013 (diff)
SL-915 - tracking joint is rigged state
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r--indra/newview/llvoavatar.cpp91
1 files changed, 84 insertions, 7 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 277f8e4533..50a012ad82 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1355,17 +1355,23 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
}
// Stretch bounding box by rigged mesh joint boxes
+ updateRiggingInfo();
for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++)
{
LLJoint *joint = getJoint(joint_num);
-
- // FIXME TEMP HACK FOR TESTING
- if (joint)
+ LLJointRiggingInfo *rig_info = NULL;
+ if (joint_num < mJointRiggingInfoTab.size())
{
- joint->getRiggingInfo().setIsRiggedTo(true);
+ rig_info = &mJointRiggingInfoTab[joint_num];
}
- if (joint && joint->getRiggingInfo().isRiggedTo())
+ // FIXME TEMP HACK FOR TESTING
+ //if (joint)
+ //{
+ // rig_info.setIsRiggedTo(true);
+ //}
+
+ if (joint && rig_info && rig_info->isRiggedTo())
{
LLViewerJointAttachment *as_joint_attach = dynamic_cast<LLViewerJointAttachment*>(joint);
if (as_joint_attach && as_joint_attach->getIsHUDAttachment())
@@ -1376,7 +1382,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
LLMatrix4a mat;
LLVector4a new_extents[2];
mat.loadu(joint->getWorldMatrix());
- matMulBoundBox(mat, joint->getRiggingInfo().getRiggedExtents(), new_extents);
+ matMulBoundBox(mat, rig_info->getRiggedExtents(), new_extents);
update_min_max(newMin, newMax, new_extents[0]);
update_min_max(newMin, newMax, new_extents[1]);
//if (isSelf())
@@ -5777,6 +5783,7 @@ bool LLVOAvatar::getRiggedMeshID(LLViewerObject* pVO, LLUUID& mesh_id)
return false;
}
+// AXON update to use LLRiggingInfo
bool LLVOAvatar::jointIsRiggedTo(const std::string& joint_name)
{
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
@@ -5798,6 +5805,7 @@ bool LLVOAvatar::jointIsRiggedTo(const std::string& joint_name)
return false;
}
+// AXON update to use LLRiggingInfo
bool LLVOAvatar::jointIsRiggedTo(const std::string& joint_name, const LLViewerObject *vo)
{
// Process all children
@@ -9420,11 +9428,80 @@ BOOL LLVOAvatar::updateLOD()
return res;
}
-void LLVOAvatar::updateLODRiggedAttachments( void )
+void LLVOAvatar::updateLODRiggedAttachments()
{
updateLOD();
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;
+}
+
+// virtual
+void LLVOAvatar::updateRiggingInfo()
+{
+ mJointRiggingInfoTab.clear();
+ //LL_INFOS() << "starting update rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL;
+ for ( attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter )
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+ LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_end = attachment->mAttachedObjects.end();
+
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_iter = attachment->mAttachedObjects.begin();
+ attach_iter != attach_end; ++attach_iter)
+ {
+ LLViewerObject* attached_object = *attach_iter;
+ attached_object->updateRiggingInfo();
+ mergeRigInfoTab(mJointRiggingInfoTab, attached_object->mJointRiggingInfoTab);
+ //LL_INFOS() << "after merge rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL;
+
+
+ LLViewerObject::const_child_list_t& children = attached_object->getChildren();
+ for (LLViewerObject::const_child_list_t::const_iterator it = children.begin();
+ it != children.end(); ++it)
+ {
+ LLViewerObject *childp = *it;
+ childp->updateRiggingInfo();
+ mergeRigInfoTab(mJointRiggingInfoTab, childp->mJointRiggingInfoTab);
+ //LL_INFOS() << "after merge rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL;
+ }
+ }
+ }
+ LLControlAvatar *control_av = dynamic_cast<LLControlAvatar*>(this);
+ if (control_av)
+ {
+ LLVOVolume *volp = control_av->mRootVolp;
+ if (volp && !volp->isAttachment())
+ {
+ volp->updateRiggingInfo();
+ mergeRigInfoTab(mJointRiggingInfoTab, volp->mJointRiggingInfoTab);
+ //LL_INFOS() << "cav after merge rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL;
+
+ LLViewerObject::const_child_list_t& children = volp->getChildren();
+ for (LLViewerObject::const_child_list_t::const_iterator it = children.begin();
+ it != children.end(); ++it)
+ {
+ LLViewerObject *childp = *it;
+ childp->updateRiggingInfo();
+ mergeRigInfoTab(mJointRiggingInfoTab, childp->mJointRiggingInfoTab);
+ //LL_INFOS() << "cav after merge rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL;
+ }
+ }
+ }
+
+ //LL_INFOS() << "done update rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL;
+}
+
U32 LLVOAvatar::getPartitionType() const
{
// Avatars merely exist as drawables in the bridge partition