summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2010-02-04 15:56:46 -0500
committerNyx (Neal Orman) <nyx@lindenlab.com>2010-02-04 15:56:46 -0500
commit20c49c78483e7608242b8f34bfc71fbf40837494 (patch)
tree443bcc6db9f068ac757a2a4f50948bc7a3114376 /indra
parent21adf86c567d3cad81e762c0215c8ec8f8c5eab6 (diff)
parent303b84c533d2c6ec7426252915661214ff883f01 (diff)
Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0/
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llagentwearables.cpp2
-rw-r--r--indra/newview/lldriverparam.cpp33
-rw-r--r--indra/newview/lldriverparam.h3
-rw-r--r--indra/newview/llviewervisualparam.h1
-rw-r--r--indra/newview/llvoavatarself.cpp1
-rw-r--r--indra/newview/llwearable.cpp24
-rw-r--r--indra/newview/llwearable.h3
7 files changed, 65 insertions, 2 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index acbf02678c..7cbd7e46a9 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -761,6 +761,8 @@ void LLAgentWearables::wearableUpdated(LLWearable *wearable)
wearable->refreshName();
wearable->setLabelUpdated();
+ wearable->pullCrossWearableValues();
+
// Hack pt 2. If the wearable we just loaded has definition version 24,
// then force a re-save of this wearable after slamming the version number to 22.
// This number was incorrectly incremented for internal builds before release, and
diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp
index 3961afe9af..8ebfa471f3 100644
--- a/indra/newview/lldriverparam.cpp
+++ b/indra/newview/lldriverparam.cpp
@@ -39,6 +39,7 @@
#include "llvoavatarself.h"
#include "llagent.h"
#include "llwearable.h"
+#include "llagentwearables.h"
//-----------------------------------------------------------------------------
// LLDriverParamInfo
@@ -528,6 +529,38 @@ void LLDriverParam::resetDrivenParams()
mDriven.reserve(getInfo()->mDrivenInfoList.size());
}
+void LLDriverParam::updateCrossDrivenParams(EWearableType driven_type)
+{
+ bool needs_update = (getWearableType()==driven_type);
+
+ // if the driver has a driven entry for the passed-in wearable type, we need to refresh the value
+ for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ {
+ LLDrivenEntry* driven = &(*iter);
+ if (driven && driven->mParam && driven->mParam->getCrossWearable() && driven->mParam->getWearableType() == driven_type)
+ {
+ needs_update = true;
+ }
+ }
+
+
+ if (needs_update)
+ {
+ EWearableType driver_type = (EWearableType)getWearableType();
+
+ // If we've gotten here, we've added a new wearable of type "type"
+ // Thus this wearable needs to get updates from the driver wearable.
+ // The call to setVisualParamWeight seems redundant, but is necessary
+ // as the number of driven wearables has changed since the last update. -Nyx
+ LLWearable *wearable = gAgentWearables.getTopWearable(driver_type);
+ if (wearable)
+ {
+ wearable->setVisualParamWeight(mID, wearable->getVisualParamWeight(mID), false);
+ }
+ }
+}
+
+
//-----------------------------------------------------------------------------
// getDrivenWeight()
//-----------------------------------------------------------------------------
diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h
index 4e2daf5ba7..e963a2d55a 100644
--- a/indra/newview/lldriverparam.h
+++ b/indra/newview/lldriverparam.h
@@ -34,6 +34,7 @@
#define LL_LLDRIVERPARAM_H
#include "llviewervisualparam.h"
+#include "llwearabledictionary.h"
class LLVOAvatar;
class LLWearable;
@@ -93,6 +94,7 @@ public:
void setWearable(LLWearable *wearablep);
void setAvatar(LLVOAvatar *avatarp);
+ void updateCrossDrivenParams(EWearableType driven_type);
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
@@ -112,6 +114,7 @@ public:
/*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh);
/*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh);
/*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);
+
protected:
F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight);
void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake);
diff --git a/indra/newview/llviewervisualparam.h b/indra/newview/llviewervisualparam.h
index 3550a46fbf..1a3975eb99 100644
--- a/indra/newview/llviewervisualparam.h
+++ b/indra/newview/llviewervisualparam.h
@@ -111,6 +111,7 @@ public:
F32 getSimpleMax() const { return getInfo()->mSimpleMax; }
BOOL getCrossWearable() const { return getInfo()->mCrossWearable; }
+
};
#endif // LL_LLViewerVisualParam_H
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index ecd6b05ded..b1ea8a1bbb 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1966,6 +1966,7 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)
// Don't know if this is needed
updateMeshTextures();
+
}
//-----------------------------------------------------------------------------
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index d093031bea..acfbc23f62 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -625,7 +625,9 @@ void LLWearable::writeToAvatar()
// Pull params
for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
{
- if( (((LLViewerVisualParam*)param)->getWearableType() == mType) )
+ // cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
+ // avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.
+ if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) )
{
S32 param_id = param->getID();
F32 weight = getVisualParamWeight(param_id);
@@ -1085,6 +1087,26 @@ void LLWearable::destroyTextures()
mSavedTEMap.clear();
}
+void LLWearable::pullCrossWearableValues()
+{
+ // scan through all of the avatar's visual parameters
+ LLVOAvatar* avatar = gAgent.getAvatarObject();
+ for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam();
+ param;
+ param = (LLViewerVisualParam*) avatar->getNextVisualParam())
+ {
+ if( param )
+ {
+ LLDriverParam *driver_param = dynamic_cast<LLDriverParam*>(param);
+ if(driver_param)
+ {
+ // parameter is a driver parameter, have it update its
+ driver_param->updateCrossDrivenParams(getType());
+ }
+ }
+ }
+}
+
void LLWearable::setLabelUpdated() const
{
diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h
index dae983bcf3..7bd5305079 100644
--- a/indra/newview/llwearable.h
+++ b/indra/newview/llwearable.h
@@ -128,6 +128,7 @@ public:
void revertValues();
void saveValues();
+ void pullCrossWearableValues();
BOOL isOnTop() const;
@@ -145,7 +146,7 @@ private:
void createLayers(S32 te);
void createVisualParams();
void syncImages(te_map_t &src, te_map_t &dst);
- void destroyTextures();
+ void destroyTextures();
static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml.
S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created.