summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/llcharacter/lljoint.cpp35
-rwxr-xr-xindra/llcharacter/lljoint.h9
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp4
-rwxr-xr-xindra/newview/llvoavatar.cpp8
-rwxr-xr-xindra/newview/llvoavatar.h2
-rwxr-xr-xindra/newview/llvovolume.cpp4
6 files changed, 31 insertions, 31 deletions
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index bad9c198ad..97293bf134 100755
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -45,9 +45,9 @@ LLJoint::AttachmentOverrideRecord::AttachmentOverrideRecord()
}
template <class T>
-bool attachment_map_iter_compare_name(const T& a, const T& b)
+bool attachment_map_iter_compare_key(const T& a, const T& b)
{
- return a.second.name < b.second.name;
+ return a.first < b.first;
}
//-----------------------------------------------------------------------------
@@ -257,61 +257,60 @@ void LLJoint::setPosition( const LLVector3& pos )
//--------------------------------------------------------------------
// addAttachmentPosOverride()
//--------------------------------------------------------------------
-void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const std::string& attachment_name )
+void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh_id, const std::string& av_info )
{
- if (attachment_name.empty())
+ if (mesh_id.isNull())
{
return;
}
if (m_attachmentOverrides.empty())
{
- LL_DEBUGS("Avatar") << getName() << " saving m_posBeforeOverrides " << getPosition() << LL_ENDL;
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " saving m_posBeforeOverrides " << getPosition() << LL_ENDL;
m_posBeforeOverrides = getPosition();
}
AttachmentOverrideRecord rec;
- rec.name = attachment_name;
rec.pos = pos;
- m_attachmentOverrides[attachment_name] = rec;
- LL_DEBUGS("Avatar") << getName() << " addAttachmentPosOverride for " << attachment_name << " pos " << pos << LL_ENDL;
- updatePos();
+ m_attachmentOverrides[mesh_id] = rec;
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " addAttachmentPosOverride for mesh " << mesh_id << " pos " << pos << LL_ENDL;
+ updatePos(av_info);
}
//--------------------------------------------------------------------
// removeAttachmentPosOverride()
//--------------------------------------------------------------------
-void LLJoint::removeAttachmentPosOverride( const std::string& attachment_name )
+void LLJoint::removeAttachmentPosOverride( const LLUUID& mesh_id, const std::string& av_info )
{
- if (attachment_name.empty())
+ if (mesh_id.isNull())
{
return;
}
- attachment_map_t::iterator it = m_attachmentOverrides.find(attachment_name);
+ attachment_map_t::iterator it = m_attachmentOverrides.find(mesh_id);
if (it != m_attachmentOverrides.end())
{
- LL_DEBUGS("Avatar") << getName() << " removeAttachmentPosOverride for " << attachment_name << LL_ENDL;
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " removeAttachmentPosOverride for " << mesh_id << LL_ENDL;
m_attachmentOverrides.erase(it);
}
- updatePos();
+ updatePos(av_info);
}
//--------------------------------------------------------------------
// updatePos()
//--------------------------------------------------------------------
-void LLJoint::updatePos()
+void LLJoint::updatePos(const std::string& av_info)
{
LLVector3 pos;
attachment_map_t::iterator it = std::max_element(m_attachmentOverrides.begin(),
m_attachmentOverrides.end(),
- attachment_map_iter_compare_name<LLJoint::attachment_map_t::value_type>);
+ attachment_map_iter_compare_key<LLJoint::attachment_map_t::value_type>);
if (it != m_attachmentOverrides.end())
{
AttachmentOverrideRecord& rec = it->second;
- LL_DEBUGS("Avatar") << getName() << " updatePos, winner of " << m_attachmentOverrides.size() << " is attachment " << rec.name << " pos " << rec.pos << LL_ENDL;
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " updatePos, winner of " << m_attachmentOverrides.size() << " is mesh " << it->first << " pos " << rec.pos << LL_ENDL;
pos = rec.pos;
}
else
{
- LL_DEBUGS("Avatar") << getName() << " updatePos, winner is posBeforeOverrides " << m_posBeforeOverrides << LL_ENDL;
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " updatePos, winner is posBeforeOverrides " << m_posBeforeOverrides << LL_ENDL;
pos = m_posBeforeOverrides;
}
setPosition(pos);
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index 0ef054d9c1..951cafad94 100755
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -103,13 +103,12 @@ public:
{
AttachmentOverrideRecord();
LLVector3 pos;
- std::string name;
};
- typedef std::map<std::string,AttachmentOverrideRecord> attachment_map_t;
+ typedef std::map<LLUUID,AttachmentOverrideRecord> attachment_map_t;
attachment_map_t m_attachmentOverrides;
LLVector3 m_posBeforeOverrides;
- void updatePos();
+ void updatePos(const std::string& av_info);
public:
LLJoint();
@@ -192,8 +191,8 @@ public:
S32 getJointNum() const { return mJointNum; }
- void addAttachmentPosOverride( const LLVector3& pos, const std::string& attachment_name );
- void removeAttachmentPosOverride( const std::string& attachment_name );
+ void addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh_id, const std::string& av_info );
+ void removeAttachmentPosOverride( const LLUUID& mesh_id, const std::string& av_info );
//Accessor for the joint id
LLUUID getId( void ) { return mId; }
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 195a7f5ffe..73bf7f3e23 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -1935,7 +1935,9 @@ bool LLModelLoader::doLoadModel()
LLJoint* pJoint = mPreview->getPreviewAvatar()->getJoint( lookingForJoint );
if ( pJoint )
{
- pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), mFilename);
+ LLUUID fake_mesh_id;
+ fake_mesh_id.generate();
+ pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), fake_mesh_id, gAgentAvatarp->avString());
}
else
{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 3763ea79c6..157c402795 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5076,7 +5076,7 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name )
//-----------------------------------------------------------------------------
// resetJointPositionsOnDetach
//-----------------------------------------------------------------------------
-void LLVOAvatar::resetJointPositionsOnDetach(const std::string& attachment_name)
+void LLVOAvatar::resetJointPositionsOnDetach(const LLUUID& mesh_id)
{
//Subsequent joints are relative to pelvis
avatar_joint_list_t::iterator iter = mSkeleton.begin();
@@ -5091,7 +5091,7 @@ void LLVOAvatar::resetJointPositionsOnDetach(const std::string& attachment_name)
if ( pJoint && pJoint != pJointPelvis)
{
pJoint->setId( LLUUID::null );
- pJoint->removeAttachmentPosOverride(attachment_name);
+ pJoint->removeAttachmentPosOverride(mesh_id, avString());
}
else
if ( pJoint && pJoint == pJointPelvis)
@@ -5761,8 +5761,8 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO )
&& pSkinData->mJointNames.size() > JOINT_COUNT_REQUIRED_FOR_FULLRIG // full rig
&& pSkinData->mAlternateBindMatrix.size() > 0 )
{
- const std::string& attachment_name = pVO->getAttachmentItemName();
- LLVOAvatar::resetJointPositionsOnDetach(attachment_name);
+ const LLUUID& mesh_id = pSkinData->mMeshID;
+ LLVOAvatar::resetJointPositionsOnDetach(mesh_id);
//Need to handle the repositioning of the cam, updating rig data etc during outfit editing
//This handles the case where we detach a replacement rig.
if ( gAgentCamera.cameraCustomizeAvatar() )
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 4d5e616906..0fde732b6f 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -200,7 +200,7 @@ public:
virtual LLJoint* getJoint(const std::string &name);
- void resetJointPositionsOnDetach(const std::string& attachment_name);
+ void resetJointPositionsOnDetach(const LLUUID& mesh_id);
/*virtual*/ const LLUUID& getID() const;
/*virtual*/ void addDebugText(const std::string& text);
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 9d16ce5a7b..35893a0354 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4637,8 +4637,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
const LLVector3& jointPos = pSkinData->mAlternateBindMatrix[i].getTranslation();
//Set the joint position
- const std::string& attachment_name = drawablep->getVObj()->getAttachmentItemName();
- pJoint->addAttachmentPosOverride( jointPos, attachment_name );
+ const LLUUID& mesh_id = pSkinData->mMeshID;
+ pJoint->addAttachmentPosOverride( jointPos, mesh_id, pAvatarVO->avString() );
//If joint is a pelvis then handle old/new pelvis to foot values
if ( lookingForJoint == "mPelvis" )