1. simon_linden
  2. viewer-rabbit

Commits

nyx  committed 133e024

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

  • Participants
  • Parent commits de3f88f
  • Branches default

Comments (0)

Files changed (6)

File indra/llcharacter/llvisualparam.cpp

View file
 	return TRUE;
 }
 
+//virtual 
+void LLVisualParam::resetDrivenParams()
+{
+	// nothing to do for non-driver parameters
+	return;
+}

File indra/llcharacter/llvisualparam.h

View file
 	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; }

File indra/newview/lldriverparam.cpp

View file
 
 	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;
 }
 
 {
 	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);
 	return success;	
 }
 
+void LLDriverParam::resetDrivenParams()
+{
+	mDriven.clear();
+	mDriven.reserve(getInfo()->mDrivenInfoList.size());
+}
+
 //-----------------------------------------------------------------------------
 // getDrivenWeight()
 //-----------------------------------------------------------------------------

File indra/newview/lldriverparam.h

View file
 	/*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();

File indra/newview/llvoavatar.cpp

View file
 		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
 		{

File indra/newview/llwearable.cpp

View file
 		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;
 			}
 		}