summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2014-08-28 17:32:22 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2014-08-28 17:32:22 -0400
commit8b88633761b0ebffebdec24be038868b439971f3 (patch)
treed89be40d78441141b4fa1b853c00881592a2c26c
parent94f945c2c65fcd791bf86c58168fd457837e2acd (diff)
MAINT-4158 WIP - track position overrides requested by attachments so they can be undone intelligently
-rwxr-xr-xindra/llappearance/llavatarappearance.cpp2
-rw-r--r--indra/llappearance/llpolyskeletaldistortion.cpp2
-rwxr-xr-xindra/llcharacter/lljoint.cpp56
-rwxr-xr-xindra/llcharacter/lljoint.h17
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp3
-rwxr-xr-xindra/newview/llvovolume.cpp3
6 files changed, 31 insertions, 52 deletions
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index c1107f674e..9904f454d6 100755
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -605,7 +605,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
info->mRot.mV[VZ], LLQuaternion::XYZ));
joint->setScale(info->mScale);
- joint->setDefaultFromCurrentXform();
+ //joint->setDefaultFromCurrentXform();
if (info->mIsJoint)
{
diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp
index ea29cbd451..fbc312c426 100644
--- a/indra/llappearance/llpolyskeletaldistortion.cpp
+++ b/indra/llappearance/llpolyskeletaldistortion.cpp
@@ -213,7 +213,7 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
LLVector3 scaleDelta = iter->second;
newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta);
//An aspect of attached mesh objects (which contain joint offsets) that need to be cleaned up when detached
- joint->storeScaleForReset( newScale );
+ // needed? // joint->storeScaleForReset( newScale );
joint->setScale(newScale);
}
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index f6e95fdc8d..bad9c198ad 100755
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -36,6 +36,20 @@
S32 LLJoint::sNumUpdates = 0;
S32 LLJoint::sNumTouches = 0;
+
+//-----------------------------------------------------------------------------
+// LLJoint::AttachmentOverrideRecord::AttachmentOverrideRecord()
+//-----------------------------------------------------------------------------
+LLJoint::AttachmentOverrideRecord::AttachmentOverrideRecord()
+{
+}
+
+template <class T>
+bool attachment_map_iter_compare_name(const T& a, const T& b)
+{
+ return a.second.name < b.second.name;
+}
+
//-----------------------------------------------------------------------------
// LLJoint()
// Class Constructor
@@ -48,8 +62,6 @@ void LLJoint::init()
mParent = NULL;
mXform.setScaleChildOffset(TRUE);
mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f));
- mOldXform.setScaleChildOffset(TRUE);
- mOldXform.setScale(LLVector3(1.0f, 1.0f, 1.0f));
mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY;
mUpdateXform = TRUE;
}
@@ -242,15 +254,6 @@ void LLJoint::setPosition( const LLVector3& pos )
touch(MATRIX_DIRTY | POSITION_DIRTY);
}
-
-//--------------------------------------------------------------------
-// setDefaultFromCurrentXform()
-//--------------------------------------------------------------------
-void LLJoint::setDefaultFromCurrentXform( void )
-{
- mDefaultXform = mXform;
-}
-
//--------------------------------------------------------------------
// addAttachmentPosOverride()
//--------------------------------------------------------------------
@@ -262,14 +265,14 @@ void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const std::string&
}
if (m_attachmentOverrides.empty())
{
- LL_WARNS() << "saving m_posBeforeOverrides " << getPosition() << LL_ENDL;
+ LL_DEBUGS("Avatar") << 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_WARNS() << "addAttachmentPosOverride for " << attachment_name << " pos " << pos << LL_ENDL;
+ LL_DEBUGS("Avatar") << getName() << " addAttachmentPosOverride for " << attachment_name << " pos " << pos << LL_ENDL;
updatePos();
}
@@ -285,47 +288,36 @@ void LLJoint::removeAttachmentPosOverride( const std::string& attachment_name )
attachment_map_t::iterator it = m_attachmentOverrides.find(attachment_name);
if (it != m_attachmentOverrides.end())
{
- LL_WARNS() << "removeAttachmentPosOverride for " << attachment_name << LL_ENDL;
+ LL_DEBUGS("Avatar") << getName() << " removeAttachmentPosOverride for " << attachment_name << LL_ENDL;
m_attachmentOverrides.erase(it);
}
updatePos();
}
+//--------------------------------------------------------------------
+// updatePos()
+//--------------------------------------------------------------------
void LLJoint::updatePos()
{
LLVector3 pos;
attachment_map_t::iterator it = std::max_element(m_attachmentOverrides.begin(),
- m_attachmentOverrides.end());
+ m_attachmentOverrides.end(),
+ attachment_map_iter_compare_name<LLJoint::attachment_map_t::value_type>);
if (it != m_attachmentOverrides.end())
{
AttachmentOverrideRecord& rec = it->second;
- LL_WARNS() << "updatePos, winner is attachment " << rec.name << " pos " << rec.pos << LL_ENDL;
+ LL_DEBUGS("Avatar") << getName() << " updatePos, winner of " << m_attachmentOverrides.size() << " is attachment " << rec.name << " pos " << rec.pos << LL_ENDL;
pos = rec.pos;
}
else
{
- LL_WARNS() << "updatePos, winner is posBeforeOverrides " << m_posBeforeOverrides << LL_ENDL;
+ LL_DEBUGS("Avatar") << getName() << " updatePos, winner is posBeforeOverrides " << m_posBeforeOverrides << LL_ENDL;
pos = m_posBeforeOverrides;
}
setPosition(pos);
}
//--------------------------------------------------------------------
-// storeScaleForReset()
-//--------------------------------------------------------------------
-void LLJoint::storeScaleForReset( const LLVector3& scale )
-{
- mOldXform.setScale( scale );
-}
-//--------------------------------------------------------------------
-// restoreOldXform()
-//--------------------------------------------------------------------
-void LLJoint::restoreOldXform( void )
-{
- mXform = mOldXform;
- mDirtyFlags = ALL_DIRTY;
-}
-//--------------------------------------------------------------------
// getWorldPosition()
//--------------------------------------------------------------------
LLVector3 LLJoint::getWorldPosition()
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index f6f1cd2fe4..0ef054d9c1 100755
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -79,8 +79,6 @@ protected:
// explicit transformation members
LLXformMatrix mXform;
- LLXformMatrix mOldXform;
- LLXformMatrix mDefaultXform;
LLUUID mId;
@@ -103,16 +101,9 @@ public:
struct AttachmentOverrideRecord
{
- AttachmentOverrideRecord()
- {
- }
+ AttachmentOverrideRecord();
LLVector3 pos;
std::string name;
-
- bool operator<(const AttachmentOverrideRecord& other) const
- {
- return name < other.name;
- }
};
typedef std::map<std::string,AttachmentOverrideRecord> attachment_map_t;
attachment_map_t m_attachmentOverrides;
@@ -177,7 +168,7 @@ public:
// get/set local scale
const LLVector3& getScale();
void setScale( const LLVector3& scale );
- void storeScaleForReset( const LLVector3& scale );
+
// get/set world matrix
const LLMatrix4 &getWorldMatrix();
void setWorldMatrix( const LLMatrix4& mat );
@@ -200,10 +191,6 @@ public:
virtual BOOL isAnimatable() const { return TRUE; }
S32 getJointNum() const { return mJointNum; }
-
- void restoreOldXform( void );
- void setDefaultFromCurrentXform( void );
- void storeCurrentXform( const LLVector3& pos );
void addAttachmentPosOverride( const LLVector3& pos, const std::string& attachment_name );
void removeAttachmentPosOverride( const std::string& attachment_name );
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 039ff848cb..93c18c5c8b 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 )
{
- LL_WARNS() << "Aieee, now what!" << LL_ENDL;
+ pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), mFilename);
+ //LL_WARNS() << "Aieee, now what!" << LL_ENDL;
//pJoint->storeCurrentXform( jointTransform.getTranslation() );
}
else
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 0ef48c4c70..0dc5ae5058 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4626,8 +4626,7 @@ 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->storeCurrentXform( jointPos );
+ const std::string& attachment_name = drawablep->getVObj()->getAttachmentItemName();
pJoint->addAttachmentPosOverride( jointPos, attachment_name );
//If joint is a pelvis then handle old/new pelvis to foot values