From be429a3ae9bdb45b1fe4bbc185814604167ab18c Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 13 Nov 2009 18:19:22 -0500 Subject: EXT-2429 body parts out of sync with COF Visual param definitions weren't working properly when the wearable being loaded had fewer visual parameters than the current definition of the wearable. This occurred when you were loading wearables that had been created in older versions of the client (or from the library). Added missing parameters to mSavedVisualParamMap, and modified revertValues() to ensure that the two maps are kept fully in sync on finishing loading the wearable and when reverting the values. Code reviewed by Vir --HG-- branch : avatar-pipeline --- indra/newview/llwearable.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index c5c97e7649..e37dffd526 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -831,6 +831,7 @@ void LLWearable::addVisualParam(LLVisualParam *param) } param->setIsDummy(FALSE); mVisualParamIndexMap[param->getID()] = param; + mSavedVisualParamMap[param->getID()] = param->getDefaultWeight(); } void LLWearable::setVisualParams() @@ -933,11 +934,39 @@ void LLWearable::setClothesColor( S32 te, const LLColor4& new_color, BOOL upload void LLWearable::revertValues() { //update saved settings so wearable is no longer dirty + // non-driver params first for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) { S32 id = iter->first; F32 value = iter->second; - setVisualParamWeight(id, value, TRUE); + LLVisualParam *param = getVisualParam(id); + if(param && !dynamic_cast(param) ) + { + setVisualParamWeight(id, value, TRUE); + } + } + + //then driver params + for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) + { + S32 id = iter->first; + F32 value = iter->second; + LLVisualParam *param = getVisualParam(id); + if(param && dynamic_cast(param) ) + { + setVisualParamWeight(id, value, TRUE); + } + } + + // make sure that saved values are sane + for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) + { + S32 id = iter->first; + LLVisualParam *param = getVisualParam(id); + if( param ) + { + mSavedVisualParamMap[id] = param->getWeight(); + } } syncImages(mSavedTEMap, mTEMap); -- cgit v1.2.3