summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2016-06-15 15:24:54 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2016-06-15 15:24:54 -0400
commitd2302886bc132f5afe96612c8f13702775f0a303 (patch)
treeed7ff6d21559b8d73bd3d77211834f8e93d1edba /indra
parent27bb57126ce3849bd72d4bb56e659f25ac5a35db (diff)
MAINT-6380, SL-399 - vertical flicker related to joint offsets for mPelvis. Having a joint offset for mPelvis is still a bad idea, but it won't cause as much flickering now.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcharacter/lljoint.cpp58
-rw-r--r--indra/llcharacter/lljoint.h4
-rw-r--r--indra/llprimitive/lldaeloader.cpp3
-rw-r--r--indra/newview/llvoavatar.cpp15
4 files changed, 51 insertions, 29 deletions
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index c4eda0b432..6e6208a617 100644
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -361,8 +361,11 @@ void LLJoint::setPosition( const LLVector3& requested_pos, bool apply_attachment
LL_DEBUGS("Avatar") << "CONTEXT:\n" << "====================\n" << con_status << "====================" << LL_ENDL;
LL_DEBUGS("Avatar") << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL;
}
- mXform.setPosition(pos);
- touch(MATRIX_DIRTY | POSITION_DIRTY);
+ if (pos != getPosition())
+ {
+ mXform.setPosition(pos);
+ touch(MATRIX_DIRTY | POSITION_DIRTY);
+ }
}
void LLJoint::setDefaultPosition( const LLVector3& pos )
@@ -392,8 +395,9 @@ bool above_joint_pos_threshold(const LLVector3& diff)
//--------------------------------------------------------------------
// addAttachmentPosOverride()
//--------------------------------------------------------------------
-void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh_id, const std::string& av_info )
+void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed )
{
+ active_override_changed = false;
if (mesh_id.isNull())
{
return;
@@ -407,6 +411,10 @@ void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh
}
return;
}
+
+ LLVector3 before_pos;
+ LLUUID before_mesh_id;
+ bool has_active_override_before = hasAttachmentPosOverride( before_pos, before_mesh_id );
if (!m_attachmentOverrides.count())
{
if (do_debug_joint(getName()))
@@ -416,31 +424,49 @@ void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh
m_posBeforeOverrides = getPosition();
}
m_attachmentOverrides.add(mesh_id,pos);
- if (do_debug_joint(getName()))
- {
- LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " addAttachmentPosOverride for mesh " << mesh_id << " pos " << pos << LL_ENDL;
- }
- updatePos(av_info);
+ LLVector3 after_pos;
+ LLUUID after_mesh_id;
+ hasAttachmentPosOverride(after_pos, after_mesh_id);
+ if (!has_active_override_before || (after_pos != before_pos))
+ {
+ active_override_changed = true;
+ if (do_debug_joint(getName()))
+ {
+ 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 LLUUID& mesh_id, const std::string& av_info )
+void LLJoint::removeAttachmentPosOverride( const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed )
{
+ active_override_changed = false;
if (mesh_id.isNull())
{
return;
}
+ LLVector3 before_pos;
+ LLUUID before_mesh_id;
+ hasAttachmentPosOverride( before_pos, before_mesh_id );
if (m_attachmentOverrides.remove(mesh_id))
{
- if (do_debug_joint(getName()))
- {
- LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName()
- << " removeAttachmentPosOverride for " << mesh_id << LL_ENDL;
- showJointPosOverrides(*this, "remove", av_info);
- }
- updatePos(av_info);
+ LLVector3 after_pos;
+ LLUUID after_mesh_id;
+ bool has_active_override_after = hasAttachmentPosOverride(after_pos, after_mesh_id);
+ if (!has_active_override_after || (after_pos != before_pos))
+ {
+ active_override_changed = true;
+ if (do_debug_joint(getName()))
+ {
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName()
+ << " removeAttachmentPosOverride for " << mesh_id << LL_ENDL;
+ showJointPosOverrides(*this, "remove", av_info);
+ }
+ updatePos(av_info);
+ }
}
}
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index d2c573864b..40e0a2749b 100644
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -254,8 +254,8 @@ public:
virtual BOOL isAnimatable() const { return TRUE; }
- 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 );
+ void addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed );
+ void removeAttachmentPosOverride( const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed );
bool hasAttachmentPosOverride( LLVector3& pos, LLUUID& mesh_id ) const;
void clearAttachmentPosOverrides();
void showAttachmentPosOverrides(const std::string& av_info) const;
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index 38b061dd79..2642dea6d8 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -1404,7 +1404,8 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
// incorrect.
LLUUID fake_mesh_id;
fake_mesh_id.generate();
- pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), fake_mesh_id, "");
+ bool dummy; // not used
+ pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), fake_mesh_id, "", dummy);
}
else
{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 7a3a72d789..0448fc6138 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5451,17 +5451,11 @@ void LLVOAvatar::addAttachmentPosOverridesForObject(LLViewerObject *vo)
{
pJoint->setId( currentId );
const LLVector3& jointPos = pSkinData->mAlternateBindMatrix[i].getTranslation();
- //Set the joint position
- LLUUID curr_mesh_id;
- LLVector3 joint_pos_before;
- bool has_pos_before = pJoint->hasAttachmentPosOverride( joint_pos_before, curr_mesh_id );
- pJoint->addAttachmentPosOverride( jointPos, mesh_id, avString() );
+ bool override_changed;
+ pJoint->addAttachmentPosOverride( jointPos, mesh_id, avString(), override_changed );
- LLVector3 joint_pos_after;
- pJoint->hasAttachmentPosOverride( joint_pos_after, curr_mesh_id );
-
- if (!has_pos_before || joint_pos_before != joint_pos_after)
+ if (override_changed)
{
//If joint is a pelvis then handle old/new pelvis to foot values
if ( lookingForJoint == "mPelvis" )
@@ -5633,8 +5627,9 @@ void LLVOAvatar::resetJointPositionsOnDetach(const LLUUID& mesh_id)
//Reset joints except for pelvis
if ( pJoint )
{
+ bool dummy; // unused
pJoint->setId( LLUUID::null );
- pJoint->removeAttachmentPosOverride(mesh_id, avString());
+ pJoint->removeAttachmentPosOverride(mesh_id, avString(), dummy);
}
if ( pJoint && pJoint == pJointPelvis)
{