summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2014-08-27 16:52:52 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2014-08-27 16:52:52 -0400
commit33f66ac2344f996a2310b179173232b98c8bd026 (patch)
treee545f54fc5a4e5ed0314ddafbe5536c69cfaa3e9 /indra/newview
parent79bb641310775c56cb742c5ea938d5681117585c (diff)
WIP on attachment offset management in joints
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp3
-rwxr-xr-xindra/newview/llviewerobject.cpp11
-rwxr-xr-xindra/newview/llviewerobject.h2
-rwxr-xr-xindra/newview/llvoavatar.cpp14
-rwxr-xr-xindra/newview/llvoavatar.h2
-rwxr-xr-xindra/newview/llvovolume.cpp4
6 files changed, 26 insertions, 10 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index b17ce97a2e..039ff848cb 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -1935,7 +1935,8 @@ bool LLModelLoader::doLoadModel()
LLJoint* pJoint = mPreview->getPreviewAvatar()->getJoint( lookingForJoint );
if ( pJoint )
{
- pJoint->storeCurrentXform( jointTransform.getTranslation() );
+ LL_WARNS() << "Aieee, now what!" << LL_ENDL;
+ //pJoint->storeCurrentXform( jointTransform.getTranslation() );
}
else
{
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 4f992fc184..97cefaf33c 100755
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -6193,6 +6193,17 @@ const LLUUID &LLViewerObject::extractAttachmentItemID()
return getAttachmentItemID();
}
+const std::string& LLViewerObject::getAttachmentItemName()
+{
+ static std::string empty;
+ LLInventoryItem *item = gInventory.getItem(getAttachmentItemID());
+ if (isAttachment() && item)
+ {
+ return item->getName();
+ }
+ return empty;
+}
+
//virtual
LLVOAvatar* LLViewerObject::getAvatar() const
{
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index bab107cc57..22ac4ce0db 100755
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -170,6 +170,8 @@ public:
void setOnActiveList(BOOL on_active) { mOnActiveList = on_active; }
virtual BOOL isAttachment() const { return FALSE; }
+ const std::string& getAttachmentItemName();
+
virtual LLVOAvatar* getAvatar() const; //get the avatar this object is attached to, or NULL if object is not an attachment
virtual BOOL isHUDAttachment() const { return FALSE; }
virtual BOOL isTempAttachment() const;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 53da1dbfb8..6bd6570589 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5058,9 +5058,9 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name )
return jointp;
}
//-----------------------------------------------------------------------------
-// resetJointPositionsToDefault
+// resetJointPositionsOnDetach
//-----------------------------------------------------------------------------
-void LLVOAvatar::resetJointPositionsToDefault( void )
+void LLVOAvatar::resetJointPositionsOnDetach(const std::string& attachment_name)
{
//Subsequent joints are relative to pelvis
avatar_joint_list_t::iterator iter = mSkeleton.begin();
@@ -5072,17 +5072,16 @@ void LLVOAvatar::resetJointPositionsToDefault( void )
{
LLJoint* pJoint = (*iter);
//Reset joints except for pelvis
- if ( pJoint && pJoint != pJointPelvis && pJoint->doesJointNeedToBeReset() )
+ if ( pJoint && pJoint != pJointPelvis)
{
pJoint->setId( LLUUID::null );
- pJoint->restoreOldXform();
+ pJoint->removeAttachmentPosOverride(attachment_name);
}
else
- if ( pJoint && pJoint == pJointPelvis && pJoint->doesJointNeedToBeReset() )
+ if ( pJoint && pJoint == pJointPelvis)
{
pJoint->setId( LLUUID::null );
pJoint->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) );
- pJoint->setJointResetFlag( false );
}
}
@@ -5746,7 +5745,8 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO )
&& pSkinData->mJointNames.size() > JOINT_COUNT_REQUIRED_FOR_FULLRIG // full rig
&& pSkinData->mAlternateBindMatrix.size() > 0 )
{
- LLVOAvatar::resetJointPositionsToDefault();
+ const std::string& attachment_name = pVO->getAttachmentItemName();
+ LLVOAvatar::resetJointPositionsOnDetach(attachment_name);
//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 42ff7bff92..66a357ff62 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -199,7 +199,7 @@ public:
virtual LLJoint* getJoint(const std::string &name);
- void resetJointPositionsToDefault( void );
+ void resetJointPositionsOnDetach(const std::string& attachment_name);
/*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 a83e2e020e..0ef48c4c70 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4626,7 +4626,9 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
const LLVector3& jointPos = pSkinData->mAlternateBindMatrix[i].getTranslation();
//Set the joint position
- pJoint->storeCurrentXform( jointPos );
+ const std::string& attachment_name = drawablep->getVObj()->getAttachmentItemName();
+ //pJoint->storeCurrentXform( jointPos );
+ pJoint->addAttachmentPosOverride( jointPos, attachment_name );
//If joint is a pelvis then handle old/new pelvis to foot values
if ( lookingForJoint == "mPelvis" )