summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorNyx Linden <nyx@lindenlab.com>2013-05-02 13:56:10 -0400
committerNyx Linden <nyx@lindenlab.com>2013-05-02 13:56:10 -0400
commitaf1431731802320e241037486b8bff0003a4d827 (patch)
treefb6c1fc2351872760c3b23f1b9257c9e50d64ab6 /indra/newview
parentfcb4f8265dd7ca80ebf858e31b86ac523465e74d (diff)
SH-4060 FIX avatar hover being set to minimum at seemingly random times
avatar hover was being temporarily set to -2.0 for the preview render, which was triggering the minimum enforcement, even when the user's requested value is no where near the minimum. Added a flag to disable the minimum enforcement if we are temporarily changing the value.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lltoolmorph.cpp12
-rw-r--r--indra/newview/llviewerwearable.h4
-rwxr-xr-xindra/newview/llvoavatar.cpp30
-rwxr-xr-xindra/newview/llvoavatar.h3
4 files changed, 49 insertions, 0 deletions
diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp
index 148e5a015b..f39b98dd31 100644
--- a/indra/newview/lltoolmorph.cpp
+++ b/indra/newview/lltoolmorph.cpp
@@ -54,6 +54,7 @@
#include "llviewercamera.h"
#include "llviewertexturelist.h"
#include "llviewerobject.h"
+#include "llviewerwearable.h"
#include "llviewerwindow.h"
#include "llvoavatarself.h"
#include "pipeline.h"
@@ -147,6 +148,11 @@ BOOL LLVisualParamHint::needsRender()
void LLVisualParamHint::preRender(BOOL clear_depth)
{
+ LLViewerWearable* wearable = (LLViewerWearable*)mWearablePtr;
+ if (wearable)
+ {
+ wearable->setVolitile(TRUE);
+ }
mLastParamWeight = mVisualParam->getWeight();
mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
@@ -239,6 +245,12 @@ BOOL LLVisualParamHint::render()
}
gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight, FALSE);
+ LLViewerWearable* wearable = (LLViewerWearable*)mWearablePtr;
+ if (wearable)
+ {
+ wearable->setVolitile(FALSE);
+ }
+
gAgentAvatarp->updateVisualParams();
gGL.color4f(1,1,1,1);
mGLTexturep->setGLTextureCreated(true);
diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h
index 65566f23a5..047b2ce143 100644
--- a/indra/newview/llviewerwearable.h
+++ b/indra/newview/llviewerwearable.h
@@ -68,6 +68,8 @@ public:
void setParamsToDefaults();
void setTexturesToDefaults();
+ void setVolitile(BOOL volitle) { mVolitle = volitle; } // TRUE when doing preview renders, some updates will be suppressed.
+ BOOL getVolitile() { return mVolitle; }
/*virtual*/ LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const;
@@ -96,6 +98,8 @@ protected:
LLAssetID mAssetID;
LLTransactionID mTransactionID;
+ BOOL mVolitle; // True when rendering preview images. Can suppress some updates.
+
LLUUID mItemID; // ID of the inventory item in the agent's inventory
};
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index a56e09cde0..919627c47c 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5214,6 +5214,36 @@ void LLVOAvatar::updateVisualParams()
updateHeadOffset();
}
+/*virtual*/
+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.
+ // Camera positioning and other things start to break down when your avatar is "walking" while being fully underground
+ if (isSelf() && getWearableData())
+ {
+ LLViewerWearable* shape = (LLViewerWearable*)getWearableData()->getWearable(LLWearableType::WT_SHAPE, 0);
+ if (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);
+
+ }
+ }
+ }
+}
+
+
//-----------------------------------------------------------------------------
// isActive()
//-----------------------------------------------------------------------------
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 98e8491cb1..19ad49d3a1 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -212,6 +212,9 @@ public:
/*virtual*/ LLVector3 getPosAgentFromGlobal(const LLVector3d &position);
virtual void updateVisualParams();
+ /*virtual*/ void computeBodySize();
+
+
/** Inherited
** **