summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorprep@lindenlab.com <prep@lindenlab.com>2013-08-06 16:44:01 -0500
committerprep@lindenlab.com <prep@lindenlab.com>2013-08-06 16:44:01 -0500
commit8b612cab394dc46b52a359b2b24863c49a5bd2d7 (patch)
treee4405f770dd9c2c4fd4b1ed2d215549d89ace957 /indra
parenta1fadad9c0bd1ba261f827d6da572db5621f5bed (diff)
Fixes for SH-4321. Also removed some unnecessary transform updates, and unused joint resetting code
Diffstat (limited to 'indra')
-rwxr-xr-xindra/llcharacter/lljoint.cpp13
-rwxr-xr-xindra/llcharacter/lljoint.h1
-rwxr-xr-xindra/newview/llvoavatar.cpp49
-rwxr-xr-xindra/newview/llvoavatar.h3
4 files changed, 27 insertions, 39 deletions
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index 672d9faee4..5cd33fe709 100755
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -248,20 +248,18 @@ void LLJoint::setPosition( const LLVector3& pos )
// setPosition()
//--------------------------------------------------------------------
void LLJoint::setDefaultFromCurrentXform( void )
-{
+{
mDefaultXform = mXform;
- touch(ALL_DIRTY);
}
//--------------------------------------------------------------------
// storeCurrentXform()
//--------------------------------------------------------------------
void LLJoint::storeCurrentXform( const LLVector3& pos )
-{
+{
mOldXform = mXform;
mResetAfterRestoreOldXform = true;
setPosition( pos );
-
touch(ALL_DIRTY);
}
@@ -277,10 +275,9 @@ void LLJoint::storeScaleForReset( const LLVector3& scale )
//--------------------------------------------------------------------
void LLJoint::restoreOldXform( void )
{
- mXform = mOldXform;
- mXform.setScaleChildOffset( mOldXform.getScaleChildOffset() );
+ mXform = mDefaultXform;
mResetAfterRestoreOldXform = false;
- mDirtyFlags = ALL_DIRTY;
+ mDirtyFlags = ALL_DIRTY;
}
//--------------------------------------------------------------------
// getWorldPosition()
@@ -298,8 +295,6 @@ LLVector3 LLJoint::getLastWorldPosition()
{
return mXform.getWorldPosition();
}
-
-
//--------------------------------------------------------------------
// setWorldPosition()
//--------------------------------------------------------------------
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index aeb16f796a..a6a439a965 100755
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -196,6 +196,7 @@ public:
//If the old transform flag has been set, then the reset logic in avatar needs to be aware(test) of it
const BOOL doesJointNeedToBeReset( void ) const { return mResetAfterRestoreOldXform; }
+ void setJointResetFlag( bool val ) { mResetAfterRestoreOldXform = val; }
};
#endif // LL_LLJOINT_H
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 83b7ac9e75..a0a2ce0caf 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1294,6 +1294,8 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
mImpostorOffset = LLVector3(pos_group.getF32ptr())-getRenderPosition();
mDrawable->setPositionGroup(pos_group);
}
+
+
}
void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
@@ -3510,6 +3512,9 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
//mesh vertices need to be reskinned
mNeedsSkin = TRUE;
+
+
+
return TRUE;
}
//-----------------------------------------------------------------------------
@@ -4927,28 +4932,6 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name )
return jointp;
}
//-----------------------------------------------------------------------------
-// resetSpecificJointPosition
-//-----------------------------------------------------------------------------
-void LLVOAvatar::resetSpecificJointPosition( const std::string& name )
-{
- LLJoint* pJoint = mRoot->findJoint( name );
-
- if ( pJoint && pJoint->doesJointNeedToBeReset() )
- {
- pJoint->restoreOldXform();
- pJoint->setId( LLUUID::null );
- //If we're reseting the pelvis position make sure not to apply offset
- if ( name == "mPelvis" )
- {
- mHasPelvisOffset = false;
- }
- }
- else
- {
- llinfos<<"Did not find "<< name.c_str()<<llendl;
- }
-}
-//-----------------------------------------------------------------------------
// resetJointPositionsToDefault
//-----------------------------------------------------------------------------
void LLVOAvatar::resetJointPositionsToDefault( void )
@@ -4956,20 +4939,30 @@ void LLVOAvatar::resetJointPositionsToDefault( void )
//Subsequent joints are relative to pelvis
avatar_joint_list_t::iterator iter = mSkeleton.begin();
avatar_joint_list_t::iterator end = mSkeleton.end();
+
+ LLJoint* pJointPelvis = getJoint("mPelvis");
+
for (; iter != end; ++iter)
{
LLJoint* pJoint = (*iter);
- if ( pJoint && pJoint->doesJointNeedToBeReset() )
+ //Reset joints except for pelvis
+ if ( pJoint && pJoint != pJointPelvis && pJoint->doesJointNeedToBeReset() )
{
pJoint->setId( LLUUID::null );
pJoint->restoreOldXform();
}
- }
-
+ else
+ if ( pJoint && pJoint == pJointPelvis && pJoint->doesJointNeedToBeReset() )
+ {
+ pJoint->setId( LLUUID::null );
+ pJoint->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) );
+ pJoint->setJointResetFlag( false );
+ }
+ }
+
//make sure we don't apply the joint offset
mHasPelvisOffset = false;
mPelvisFixup = mLastPelvisFixup;
-
postPelvisSetRecalc();
}
//-----------------------------------------------------------------------------
@@ -5125,7 +5118,7 @@ BOOL LLVOAvatar::loadSkeletonNode ()
{
attachment->setOriginalPosition(info->mPosition);
}
-
+
if (info->mHasRotation)
{
LLQuaternion rotation;
@@ -5195,7 +5188,6 @@ void LLVOAvatar::updateVisualParams()
dirtyMesh();
updateHeadOffset();
}
-
//-----------------------------------------------------------------------------
// isActive()
//-----------------------------------------------------------------------------
@@ -5534,6 +5526,7 @@ void LLVOAvatar::lazyAttach()
void LLVOAvatar::resetHUDAttachments()
{
+
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end();
++iter)
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 90ade85177..8bf31e3cb3 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -200,7 +200,6 @@ public:
virtual LLJoint* getJoint(const std::string &name);
void resetJointPositionsToDefault( void );
- void resetSpecificJointPosition( const std::string& name );
/*virtual*/ const LLUUID& getID() const;
/*virtual*/ void addDebugText(const std::string& text);
@@ -209,7 +208,7 @@ public:
/*virtual*/ F32 getPixelArea() const;
/*virtual*/ LLVector3d getPosGlobalFromAgent(const LLVector3 &position);
/*virtual*/ LLVector3 getPosAgentFromGlobal(const LLVector3d &position);
- virtual void updateVisualParams();
+ virtual void updateVisualParams();
/** Inherited