From 228525aa27b05cc1aa8be27de4ae59f5ec590ae3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 4 Jun 2018 14:43:06 +0100 Subject: SL-915 - tracking joint is rigged state --- indra/newview/llvoavatar.cpp | 91 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 84 insertions(+), 7 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') 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(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; isecond; + 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(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 -- cgit v1.2.3