From 0d6f1d125eb0f6de766d617978a022fc74b4aec7 Mon Sep 17 00:00:00 2001 From: Neal Orman Date: Mon, 19 Oct 2009 18:23:19 +0000 Subject: EXT-1664 bugfix for male avatars have female bodies Found a couple bugs in the code relating to cross-wearable visual param linking. Fixed with this patch - cross-wearable and inter-wearable visual params should now link properly for both wearable-owned and avatar-owned parameters. Code reviewed by Seraph --- indra/llcharacter/llvisualparam.cpp | 6 ++++++ indra/llcharacter/llvisualparam.h | 1 + indra/newview/lldriverparam.cpp | 25 ++++++------------------- indra/newview/lldriverparam.h | 1 + indra/newview/llvoavatar.cpp | 6 ++++++ indra/newview/llwearable.cpp | 3 ++- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp index e948913a68..c4763c6331 100644 --- a/indra/llcharacter/llvisualparam.cpp +++ b/indra/llcharacter/llvisualparam.cpp @@ -311,3 +311,9 @@ BOOL LLVisualParam::linkDrivenParams(visual_param_mapper mapper, bool only_cross return TRUE; } +//virtual +void LLVisualParam::resetDrivenParams() +{ + // nothing to do for non-driver parameters + return; +} diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index b2b697766f..e6503d611d 100644 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -120,6 +120,7 @@ public: virtual void stopAnimating(BOOL set_by_user); virtual BOOL linkDrivenParams(visual_param_mapper mapper, bool only_cross_params); + virtual void resetDrivenParams(); // Interface methods S32 getID() const { return mID; } diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 87a8557a88..e7295512c1 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -180,23 +180,6 @@ BOOL LLDriverParam::setInfo(LLDriverParamInfo *info) setWeight(getDefaultWeight(), FALSE ); - BOOL success; - if (mWearablep) - { - LLVisualParam*(LLWearable::*function)(S32)const = &LLWearable::getVisualParam; // need this line to disambiguate between versions of LLCharacter::getVisualParam() - success = linkDrivenParams(boost::bind(function,(LLWearable*)mWearablep, _1), false); - } - else - { - LLVisualParam*(LLCharacter::*function)(S32)const = &LLCharacter::getVisualParam; // need this line to disambiguate between versions of LLCharacter::getVisualParam() - success = linkDrivenParams(boost::bind(function,(LLCharacter*)mAvatarp, _1), false); - } - if(!success) - { - mInfo = NULL; - return FALSE; - } - return TRUE; } @@ -502,8 +485,6 @@ BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, bool only_cross { BOOL success = TRUE; LLDriverParamInfo::entry_info_list_t::iterator iter; - mDriven.clear(); - mDriven.reserve(getInfo()->mDrivenInfoList.size()); for (iter = getInfo()->mDrivenInfoList.begin(); iter != getInfo()->mDrivenInfoList.end(); ++iter) { LLDrivenEntryInfo *driven_info = &(*iter); @@ -537,6 +518,12 @@ BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, bool only_cross return success; } +void LLDriverParam::resetDrivenParams() +{ + mDriven.clear(); + mDriven.reserve(getInfo()->mDrivenInfoList.size()); +} + //----------------------------------------------------------------------------- // getDrivenWeight() //----------------------------------------------------------------------------- diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h index c5dce62fa6..c73e740574 100644 --- a/indra/newview/lldriverparam.h +++ b/indra/newview/lldriverparam.h @@ -103,6 +103,7 @@ public: /*virtual*/ void setAnimationTarget( F32 target_value, BOOL set_by_user ); /*virtual*/ void stopAnimating(BOOL set_by_user); /*virtual*/ BOOL linkDrivenParams(visual_param_mapper mapper, bool only_cross_params); + /*virtual*/ void resetDrivenParams(); // LLViewerVisualParam Virtual functions /*virtual*/ F32 getTotalDistortion(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 398c311808..d793ea0ea5 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4751,6 +4751,12 @@ BOOL LLVOAvatar::loadAvatar() if (driver_param->setInfo(info)) { addVisualParam( driver_param ); + LLVisualParam*(LLVOAvatar::*avatar_function)(S32)const = &LLVOAvatar::getVisualParam; + if( !driver_param->linkDrivenParams(boost::bind(avatar_function,(LLVOAvatar*)this,_1 ), false)) + { + llwarns << "could not link driven params for avatar " << this->getFullname() << " id: " << driver_param->getID() << llendl; + continue; + } } else { diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index 1675ee1adc..09e8c522b0 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -194,11 +194,12 @@ void LLWearable::createVisualParams() LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; // need this line to disambiguate between versions of LLCharacter::getVisualParam() LLVisualParam*(LLVOAvatarSelf::*avatar_function)(S32)const = &LLVOAvatarSelf::getVisualParam; + param->resetDrivenParams(); if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) { if( !param->linkDrivenParams(boost::bind(avatar_function,(LLVOAvatarSelf*)avatar,_1 ), true)) { - llwarns << "could not link driven params for wearable " << getName() << llendl; + llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; continue; } } -- cgit v1.2.3