diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2016-04-18 19:31:29 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2016-04-18 19:31:29 -0400 |
commit | 223f0907092966e595890830be76ddf77776e123 (patch) | |
tree | 804245970427512f25ae133c45ce9b601ddbaf06 /indra | |
parent | 5adc782341fd2de7a791f989c991c07d3060b862 (diff) |
SL-371 - more tracking on partial joint overrides
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/llappearance/llavatarappearance.cpp | 1 | ||||
-rwxr-xr-x | indra/llcharacter/lljoint.cpp | 52 | ||||
-rwxr-xr-x | indra/llcharacter/lljoint.h | 12 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 44 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.h | 1 |
5 files changed, 107 insertions, 3 deletions
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index 9b9657b4c8..4f01665449 100755 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -608,6 +608,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent // SL-315 joint->setPosition(info->mPos); + joint->setDefaultPosition(info->mPos); joint->setRotation(mayaQ(info->mRot.mV[VX], info->mRot.mV[VY], info->mRot.mV[VZ], LLQuaternion::XYZ)); joint->setScale(info->mScale); diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 4812c46077..3ad919072d 100755 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -351,6 +351,15 @@ void LLJoint::setPosition( const LLVector3& pos ) touch(MATRIX_DIRTY | POSITION_DIRTY); } +void LLJoint::setDefaultPosition( const LLVector3& pos ) +{ + mDefaultPosition = pos; +} + +const LLVector3& LLJoint::getDefaultPosition() const +{ + return mDefaultPosition; +} void showJointPosOverrides( const LLJoint& joint, const std::string& note, const std::string& av_info ) { std::ostringstream os; @@ -427,6 +436,49 @@ void LLJoint::clearAttachmentPosOverrides() } //-------------------------------------------------------------------- +// showAttachmentPosOverrides() +//-------------------------------------------------------------------- +void LLJoint::showAttachmentPosOverrides(const std::string& av_info) const +{ + LLVector3 active_override; + bool has_active_override; + LLUUID mesh_id; + has_active_override = m_attachmentOverrides.findActiveOverride(mesh_id,active_override); + U32 count = m_attachmentOverrides.count(); + if (count==1) + { + LLPosOverrideMap::map_type::const_iterator it = m_attachmentOverrides.getMap().begin(); + std::string highlight = (has_active_override && (it->second == active_override)) ? "*" : ""; + LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() + << " has single attachment pos override " << highlight << "" << it->second << " default " << mDefaultPosition << LL_ENDL; + } + else if (count>1) + { + LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " has " << count << " attachment pos overrides" << LL_ENDL; + std::set<LLVector3> distinct_offsets; + LLPosOverrideMap::map_type::const_iterator it = m_attachmentOverrides.getMap().begin(); + for (; it != m_attachmentOverrides.getMap().end(); ++it) + { + distinct_offsets.insert(it->second); + } + if (distinct_offsets.size()>1) + { + LL_DEBUGS("Avatar") << "CONFLICTS, " << distinct_offsets.size() << " different values" << LL_ENDL; + } + else + { + LL_DEBUGS("Avatar") << "no conflicts" << LL_ENDL; + } + std::set<LLVector3>::iterator dit = distinct_offsets.begin(); + for ( ; dit != distinct_offsets.end(); ++dit) + { + std::string highlight = (has_active_override && *dit == active_override) ? "*" : ""; + LL_DEBUGS("Avatar") << " POS " << highlight << "" << (*dit) << " default " << mDefaultPosition << LL_ENDL; + } + } +} + +//-------------------------------------------------------------------- // updatePos() //-------------------------------------------------------------------- void LLJoint::updatePos(const std::string& av_info) diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index fa4d0a5326..c967770cff 100755 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -62,8 +62,10 @@ public: void add(const LLUUID& mesh_id, const LLVector3& pos); bool remove(const LLUUID& mesh_id); void clear(); -private: + typedef std::map<LLUUID,LLVector3> map_type; + const map_type& getMap() const { return m_map; } +private: map_type m_map; }; @@ -111,6 +113,8 @@ protected: LLUUID mId; + LLVector3 mDefaultPosition; + public: U32 mDirtyFlags; BOOL mUpdateXform; @@ -207,9 +211,10 @@ public: const LLVector3& getPosition(); void setPosition( const LLVector3& pos ); - // BENTO - history? Not implemented or used. + // Tracks the default position defined by the skeleton void setDefaultPosition( const LLVector3& pos ); - + const LLVector3& getDefaultPosition() const; + // get/set world position LLVector3 getWorldPosition(); LLVector3 getLastWorldPosition(); @@ -253,6 +258,7 @@ public: void removeAttachmentPosOverride( const LLUUID& mesh_id, const std::string& av_info ); bool hasAttachmentPosOverride( LLVector3& pos, LLUUID& mesh_id ) const; void clearAttachmentPosOverrides(); + void showAttachmentPosOverrides(const std::string& av_info) const; //Accessor for the joint id LLUUID getId( void ) { return mId; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d3ea864800..a82f92b01a 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5339,6 +5339,49 @@ void LLVOAvatar::addAttachmentPosOverridesForObject(LLViewerObject *vo) { postPelvisSetRecalc(); } + + showAttachmentPosOverrides(); +} + +//----------------------------------------------------------------------------- +// showAttachmentPosOverrides +//----------------------------------------------------------------------------- +void LLVOAvatar::showAttachmentPosOverrides() const +{ + LLVector3 pos; + LLUUID mesh_id; + S32 count = 0; + + // Bones + for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin(); + iter != mSkeleton.end(); ++iter) + { + const LLJoint* pJoint = (*iter); + if (pJoint && pJoint->hasAttachmentPosOverride(pos,mesh_id)) + { + pJoint->showAttachmentPosOverrides(getFullname()); + count++; + } + } + + // Attachment points + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + const LLViewerJointAttachment *attachment_pt = (*iter).second; + if (attachment_pt && attachment_pt->hasAttachmentPosOverride(pos,mesh_id)) + { + attachment_pt->showAttachmentPosOverrides(getFullname()); + count++; + } + } + + if (count) + { + LL_DEBUGS("Avatar") << avString() << " end of pos overrides" << LL_ENDL; + LL_DEBUGS("Avatar") << "=================================" << LL_ENDL; + } } //----------------------------------------------------------------------------- @@ -5553,6 +5596,7 @@ BOOL LLVOAvatar::loadSkeletonNode () if (info->mHasPosition) { attachment->setOriginalPosition(info->mPosition); + attachment->setDefaultPosition(info->mPosition); } if (info->mHasRotation) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 76b40fb90a..0e58d7f626 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -204,6 +204,7 @@ public: void resetJointPositionsOnDetach(const LLUUID& mesh_id); void resetJointPositionsOnDetach(LLViewerObject *vo); void clearAttachmentPosOverrides(); + void showAttachmentPosOverrides() const; /*virtual*/ const LLUUID& getID() const; /*virtual*/ void addDebugText(const std::string& text); |