From 62ebe50a561694d2072dcf4db27119303c686bb8 Mon Sep 17 00:00:00 2001 From: Seraph Linden Date: Sun, 3 Apr 2011 21:16:34 -0400 Subject: Added duplicate morph to handle breast bounce/clap. Took out unused params in llphysicsmotion.cpp. --- indra/newview/character/avatar_lad.xml | 78 +++++++++++++++------ indra/newview/llphysicsmotion.cpp | 96 +++++++++----------------- indra/newview/llpolymesh.cpp | 69 ++++++++++++------ indra/newview/skins/default/xui/en/strings.xml | 4 +- 4 files changed, 136 insertions(+), 111 deletions(-) diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index f8229ec465..d0158cf9f8 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -4042,6 +4042,25 @@ + + + + + + + + @@ -4310,12 +4348,12 @@ id="1201" group="1" sex="female" - name="Breast_Female_Cleavage" + name="Breast_Physics_InOut_Driven" wearable="shape" edit_group="driven" value_default="0" - value_min="-.3" - value_max="1.3"> + value_min="-1" + value_max="1"> @@ -11719,19 +11757,15 @@ render_pass="bump"> + value_min="-1" + value_max="1" + value_default="0"> @@ -11739,17 +11773,15 @@ render_pass="bump"> + value_min="-1" + value_max="1" + value_default="0"> diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index eab66749d0..acf8973f03 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -72,17 +72,7 @@ class LLPhysicsMotion { public: /* - param_user_name: The param (if any) that the user sees and controls. This is what - the particular property would look like without physics. For example, it may be - the breast gravity. This param's value should will not be altered, and is only - used as a reference point for the rest position of the body party. This is usually - a driver param and the param(s) that physics is altering are the driven params. - - param_driven_name: The param whose value is actually set by the physics. If you - leave this blank (which should suffice normally), the physics will assume that - param_user_name is a driver param and will set the params that the driver is - in charge of (i.e. the "driven" params). - + param_driver_name: The param that controls the params that are being affected by the physics. joint_name: The joint that the body part is attached to. The joint is used to determine the orientation (rotation) of the body part. @@ -95,19 +85,15 @@ public: controllers: The various settings (e.g. spring force, mass) that determine how the body part behaves. */ - LLPhysicsMotion(const std::string ¶m_user_name, - const std::string ¶m_driven_name, + LLPhysicsMotion(const std::string ¶m_driver_name, const std::string &joint_name, LLCharacter *character, const LLVector3 &motion_direction_vec, const controller_map_t &controllers) : - mParamUserName(param_user_name), - mParamDrivenName(param_driven_name), + mParamDriverName(param_driver_name), mJointName(joint_name), mMotionDirectionVec(motion_direction_vec), - mParamUser(NULL), - mParamDriven(NULL), - + mParamDriver(NULL), mParamControllers(controllers), mCharacter(character), mLastTime(0), @@ -147,8 +133,8 @@ protected: F32 calculateAcceleration_local(F32 velocity_local, const F32 time_delta); private: - const std::string mParamDrivenName; - const std::string mParamUserName; + const std::string mParamDriverName; + const std::string mParamControllerName; const LLVector3 mMotionDirectionVec; const std::string mJointName; @@ -160,8 +146,7 @@ private: F32 mPositionLastUpdate_local; LLVector3 mPosition_world; - LLViewerVisualParam *mParamUser; - LLViewerVisualParam *mParamDriven; + LLViewerVisualParam *mParamDriver; const controller_map_t mParamControllers; LLPointer mJointState; @@ -193,12 +178,10 @@ BOOL LLPhysicsMotion::initialize() return FALSE; mJointState->setUsage(LLJointState::ROT); - mParamUser = (LLViewerVisualParam*)mCharacter->getVisualParam(mParamUserName.c_str()); - if (mParamDrivenName != "") - mParamDriven = (LLViewerVisualParam*)mCharacter->getVisualParam(mParamDrivenName.c_str()); - if (mParamUser == NULL) + mParamDriver = (LLViewerVisualParam*)mCharacter->getVisualParam(mParamDriverName.c_str()); + if (mParamDriver == NULL) { - llinfos << "Failure reading in [ " << mParamUserName << " ]" << llendl; + llinfos << "Failure reading in [ " << mParamDriverName << " ]" << llendl; return FALSE; } @@ -248,7 +231,6 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller["Spring"] = "Breast_Physics_InOut_Spring"; controller["Gain"] = "Breast_Physics_InOut_Gain"; LLPhysicsMotion *motion = new LLPhysicsMotion("Breast_Physics_InOut_Controller", - "", "mChest", character, LLVector3(-1,0,0), @@ -272,7 +254,6 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller["Spring"] = "Breast_Physics_UpDown_Spring"; controller["Gain"] = "Breast_Physics_UpDown_Gain"; LLPhysicsMotion *motion = new LLPhysicsMotion("Breast_Physics_UpDown_Controller", - "", "mChest", character, LLVector3(0,0,1), @@ -296,7 +277,6 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller["Spring"] = "Breast_Physics_LeftRight_Spring"; controller["Gain"] = "Breast_Physics_LeftRight_Gain"; LLPhysicsMotion *motion = new LLPhysicsMotion("Breast_Physics_LeftRight_Controller", - "", "mChest", character, LLVector3(0,-1,0), @@ -319,7 +299,6 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller["Spring"] = "Butt_Physics_UpDown_Spring"; controller["Gain"] = "Butt_Physics_UpDown_Gain"; LLPhysicsMotion *motion = new LLPhysicsMotion("Butt_Physics_UpDown_Controller", - "", "mPelvis", character, LLVector3(0,0,-1), @@ -343,7 +322,6 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller["Spring"] = "Butt_Physics_LeftRight_Spring"; controller["Gain"] = "Butt_Physics_LeftRight_Gain"; LLPhysicsMotion *motion = new LLPhysicsMotion("Butt_Physics_LeftRight_Controller", - "", "mPelvis", character, LLVector3(0,-1,0), @@ -367,7 +345,6 @@ LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter controller["Spring"] = "Belly_Physics_UpDown_Spring"; controller["Gain"] = "Belly_Physics_UpDown_Gain"; LLPhysicsMotion *motion = new LLPhysicsMotion("Belly_Physics_UpDown_Controller", - "", "mPelvis", character, LLVector3(0,0,-1), @@ -459,7 +436,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) { // static FILE *mFileWrite = fopen("c:\\temp\\avatar_data.txt","w"); - if (!mParamUser) + if (!mParamDriver) return FALSE; if (!mLastTime) @@ -513,8 +490,8 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) // We have to use normalized values because there may be more than one driven param, // and each of these driven params may have its own range. // This means we'll do all our calculations in normalized [0,1] local coordinates. - F32 position_user_local = mParamUser->getWeight(); - position_user_local = (position_user_local - mParamUser->getMinWeight()) / (mParamUser->getMaxWeight() - mParamUser->getMinWeight()); + F32 position_user_local = mParamDriver->getWeight(); + position_user_local = (position_user_local - mParamDriver->getMinWeight()) / (mParamDriver->getMaxWeight() - mParamDriver->getMinWeight()); // If the effect is turned off then don't process unless we need one more update // to set the position to the default (i.e. user) position. @@ -610,37 +587,26 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) min_val, max_val); - // Set the new param. - // If a specific param has been declared, then set that one. - // Otherwise, assume that the param is a driver param, and - // set the params that it drives. - if (mParamDriven) + LLDriverParam *driver_param = dynamic_cast(mParamDriver); + llassert_always(driver_param); + if (driver_param) { - setParamValue(mParamDriven,position_new_local_clamped); - } - else - { - LLDriverParam *driver_param = dynamic_cast(mParamUser); - llassert_always(driver_param); - if (driver_param) + // If this is one of our "hidden" driver params, then make sure it's + // the default value. + if ((driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) && + (driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT)) + { + mCharacter->setVisualParamWeight(driver_param, + 0, + FALSE); + } + for (LLDriverParam::entry_list_t::iterator iter = driver_param->mDriven.begin(); + iter != driver_param->mDriven.end(); + ++iter) { - // If this is one of our "hidden" driver params, then make sure it's - // the default value. - if ((driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) && - (driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT)) - { - mCharacter->setVisualParamWeight(driver_param, - 0, - FALSE); - } - for (LLDriverParam::entry_list_t::iterator iter = driver_param->mDriven.begin(); - iter != driver_param->mDriven.end(); - ++iter) - { - LLDrivenEntry &entry = (*iter); - LLViewerVisualParam *driven_param = entry.mParam; - setParamValue(driven_param,position_new_local_clamped); - } + LLDrivenEntry &entry = (*iter); + LLViewerVisualParam *driven_param = entry.mParam; + setParamValue(driven_param,position_new_local_clamped); } } diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp index f0910d404a..bacaa0cd76 100644 --- a/indra/newview/llpolymesh.cpp +++ b/indra/newview/llpolymesh.cpp @@ -46,9 +46,11 @@ extern LLControlGroup gSavedSettings; // read only -LLPolyMorphData *clone_morph_param(const LLPolyMorphData *src_data, - const LLVector3 &direction, - const std::string &name); +LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data, + const std::string &name); +LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data, + const LLVector3 &direction, + const std::string &name); LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data, F32 scale, const std::string &name); @@ -617,38 +619,49 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) "Breast_Physics_LeftRight_Driven")); } + if (!strcmp(morphName, "Breast_Female_Cleavage")) + { + mMorphData.insert(clone_morph_param_duplicate(morph_data, + "Breast_Physics_InOut_Driven")); + } + if (!strcmp(morphName, "Breast_Gravity")) + { + mMorphData.insert(clone_morph_param_duplicate(morph_data, + "Breast_Physics_UpDown_Driven")); + } + if (!strcmp(morphName, "Big_Belly_Torso")) { - mMorphData.insert(clone_morph_param(morph_data, - LLVector3(0,0,0.05f), - "Belly_Physics_Torso_UpDown_Driven")); + mMorphData.insert(clone_morph_param_direction(morph_data, + LLVector3(0,0,0.05f), + "Belly_Physics_Torso_UpDown_Driven")); } if (!strcmp(morphName, "Big_Belly_Legs")) { - mMorphData.insert(clone_morph_param(morph_data, - LLVector3(0,0,0.05f), - "Belly_Physics_Legs_UpDown_Driven")); + mMorphData.insert(clone_morph_param_direction(morph_data, + LLVector3(0,0,0.05f), + "Belly_Physics_Legs_UpDown_Driven")); } if (!strcmp(morphName, "skirt_belly")) { - mMorphData.insert(clone_morph_param(morph_data, - LLVector3(0,0,0.05f), - "Belly_Physics_Skirt_UpDown_Driven")); + mMorphData.insert(clone_morph_param_direction(morph_data, + LLVector3(0,0,0.05f), + "Belly_Physics_Skirt_UpDown_Driven")); } if (!strcmp(morphName, "Small_Butt")) { - mMorphData.insert(clone_morph_param(morph_data, - LLVector3(0,0,0.05f), - "Butt_Physics_UpDown_Driven")); + mMorphData.insert(clone_morph_param_direction(morph_data, + LLVector3(0,0,0.05f), + "Butt_Physics_UpDown_Driven")); } if (!strcmp(morphName, "Small_Butt")) { - mMorphData.insert(clone_morph_param(morph_data, - LLVector3(0,0.03f,0), - "Butt_Physics_LeftRight_Driven")); + mMorphData.insert(clone_morph_param_direction(morph_data, + LLVector3(0,0.03f,0), + "Butt_Physics_LeftRight_Driven")); } } @@ -1207,9 +1220,23 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex ) } -LLPolyMorphData *clone_morph_param(const LLPolyMorphData *src_data, - const LLVector3 &direction, - const std::string &name) +LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data, + const std::string &name) +{ + LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data); + cloned_morph_data->mName = name; + for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) + { + cloned_morph_data->mCoords[v] = src_data->mCoords[v]; + cloned_morph_data->mNormals[v] = src_data->mNormals[v]; + cloned_morph_data->mBinormals[v] = src_data->mBinormals[v]; + } + return cloned_morph_data; +} + +LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data, + const LLVector3 &direction, + const std::string &name) { LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data); cloned_morph_data->mName = name; diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 548d49308f..3b59642bfb 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2500,8 +2500,8 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. Body Thin Bow Legged -Breast Buoyancy -Breast Cleavage +Breast Buoyancy +Breast Cleavage Breast Size Bridge Width Broad -- cgit v1.2.3