summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2013-06-05 16:28:33 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2013-06-05 16:28:33 -0400
commita5e41af80978babb5e8046d390d6730f57423294 (patch)
treec734b7984172f523b4a1fd3d0fcd4b6cdeadd3ed /indra/newview/llvoavatar.cpp
parentca806315a98627b29a4933cbf8b27431ca43dd0f (diff)
parent3340eb8c7146c6690876e1927c19a11188210814 (diff)
merge
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rwxr-xr-xindra/newview/llvoavatar.cpp56
1 files changed, 46 insertions, 10 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 1dbcabf2b3..4593541f35 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5220,24 +5220,60 @@ void LLVOAvatar::computeBodySize()
LLAvatarAppearance::computeBodySize();
// Certain configurations of avatars can force the overall height (with offset) to go negative.
- // Enforce a constraint to make sure we don't go below 0.1 meters.
+ // Enforce a constraint to make sure we don't go below 1.1 meters (server-enforced limit)
// Camera positioning and other things start to break down when your avatar is "walking" while being fully underground
+ const LLViewerObject * last_object = NULL;
if (isSelf() && getWearableData() && isFullyLoaded() && !LLApp::isQuitting())
{
- LLViewerWearable* shape = (LLViewerWearable*)getWearableData()->getWearable(LLWearableType::WT_SHAPE, 0);
- if (shape && !shape->getVolitile())
+ // Do not force a hover parameter change while we have pending attachments, which may be mesh-based with
+ // joint offsets.
+ if (LLAppearanceMgr::instance().getNumAttachmentsInCOF() == getNumAttachments())
{
- F32 hover_value = shape->getVisualParamWeight(AVATAR_HOVER);
- if (hover_value < 0.0f && (mBodySize.mV[VZ] + hover_value < 1.1f))
+ LLViewerWearable* shape = (LLViewerWearable*)getWearableData()->getWearable(LLWearableType::WT_SHAPE, 0);
+ BOOL loaded = TRUE;
+ for (attachment_map_t::const_iterator points_iter = mAttachmentPoints.begin();
+ points_iter != mAttachmentPoints.end() && loaded;
+ ++points_iter)
{
- hover_value = -(mBodySize.mV[VZ] - 1.1f); // avoid floating point rounding making the above check continue to fail.
- llassert(mBodySize.mV[VZ] + hover_value >= 1.1f);
+ const LLViewerJointAttachment *attachment_pt = (*points_iter).second;
+ if (attachment_pt)
+ {
+ for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator attach_iter = attachment_pt->mAttachedObjects.begin(); attach_iter != attachment_pt->mAttachedObjects.end(); attach_iter++)
+ {
+ const LLViewerObject* object = (LLViewerObject*)*attach_iter;
+ if (object)
+ {
+ last_object = object;
+ llwarns << "attachment at point: " << (*points_iter).first << " object exists: " << object->getAttachmentItemID() << llendl;
+ loaded &=!object->isDrawableState(LLDrawable::REBUILD_ALL);
+ if (!loaded && shape && !shape->getVolitile())
+ {
+ llwarns << "caught unloaded attachment! skipping enforcement" << llendl;
+ }
+ }
+ }
+ }
+ }
- hover_value = llmin(hover_value, 0.0f); // don't force the hover value to be greater than 0.
+ if (last_object)
+ {
+ LL_DEBUGS("Avatar") << "scanned at least one object!" << LL_ENDL;
+ }
+ if (loaded && shape && !shape->getVolitile())
+ {
+ F32 hover_value = shape->getVisualParamWeight(AVATAR_HOVER);
+ if (hover_value < 0.0f && (mBodySize.mV[VZ] + hover_value < 1.1f))
+ {
+ hover_value = -(mBodySize.mV[VZ] - 1.1f); // avoid floating point rounding making the above check continue to fail.
+ llassert(mBodySize.mV[VZ] + hover_value >= 1.1f);
+
+ hover_value = llmin(hover_value, 0.0f); // don't force the hover value to be greater than 0.
- mAvatarOffset.mV[VZ] = hover_value;
- shape->setVisualParamWeight(AVATAR_HOVER,hover_value, FALSE);
+ LL_DEBUGS("Avatar") << "changed hover value to: " << hover_value << " from: " << mAvatarOffset.mV[VZ] << LL_ENDL;
+ mAvatarOffset.mV[VZ] = hover_value;
+ shape->setVisualParamWeight(AVATAR_HOVER,hover_value, FALSE);
+ }
}
}
}