diff options
| author | Seraph Linden <none@none> | 2011-04-03 21:16:34 -0400 | 
|---|---|---|
| committer | Seraph Linden <none@none> | 2011-04-03 21:16:34 -0400 | 
| commit | 62ebe50a561694d2072dcf4db27119303c686bb8 (patch) | |
| tree | 344cc148a0ca5f9e48d14a7ac32cefd9f4c60688 | |
| parent | 01c236df47c2bc48af26e96d2a7bde8d32cf3514 (diff) | |
Added duplicate morph to handle breast bounce/clap.  Took out unused params in llphysicsmotion.cpp.
| -rw-r--r-- | indra/newview/character/avatar_lad.xml | 78 | ||||
| -rw-r--r-- | indra/newview/llphysicsmotion.cpp | 96 | ||||
| -rw-r--r-- | indra/newview/llpolymesh.cpp | 69 | ||||
| -rw-r--r-- | 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 @@ -4043,6 +4043,25 @@      </param>      <param +     id="507" +     group="0" +     sex="female" +     name="Breast_Gravity" +     label="Breast Buoyancy" +     wearable="shape" +     edit_group="shape_torso" +     edit_group_order="7" +     label_min="Less Gravity" +     label_max="More Gravity" +     value_default="0" +     value_min="-1.5" +     value_max="2" +     camera_elevation=".3" +     camera_distance=".8"> +      <param_morph /> +    </param> +     +    <param       id="628"       group="1"       name="Displace_Loose_Upperbody" @@ -4093,6 +4112,25 @@      </param>      <param +     id="684" +     group="0" +     sex="female" +     name="Breast_Female_Cleavage" +     label="Breast Cleavage" +     wearable="shape" +     edit_group="shape_torso" +     edit_group_order="8" +     label_min="Separate" +     label_max="Join" +     value_default="0" +     value_min="-.3" +     value_max="1.3" +     camera_elevation=".3" +     camera_distance=".8"> +      <param_morph /> +    </param> +     +    <param       id="685"       group="0"       sex="male" @@ -4297,11 +4335,11 @@       id="1200"       group="1"       sex="female" -     name="Breast_Gravity" +     name="Breast_Physics_UpDown_Driven"       wearable="shape"       edit_group="driven"       value_default="0" -     value_min="-1.5" +     value_min="-2"       value_max="2">        <param_morph />      </param> @@ -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">        <param_morph />      </param> @@ -11719,19 +11757,15 @@ render_pass="bump">    <!-- ==PHYSICS PARAMETERS======================================= -->     <param -     id="507" -     group="0" +     id="1100" +     group="1"       sex="female" +     wearable="physics"       name="Breast_Physics_UpDown_Controller"       label="Breast Physics UpDown Controller" -     wearable="shape" -     edit_group="shape_torso" -     edit_group_order="7" -     value_default="0" -     value_min="-1.5" -     value_max="2" -     camera_elevation=".3" -     camera_distance=".8"> +     value_min="-1" +     value_max="1" +     value_default="0">        <param_driver>          <driven           id="1200" /> @@ -11739,17 +11773,15 @@ render_pass="bump">      </param>     <param -     id="684" -     group="0" +     id="1101" +     group="1"       sex="female" +     wearable="physics"       name="Breast_Physics_InOut_Controller"       label="Breast Physics InOut Controller" -     wearable="shape" -     edit_group="shape_torso" -     edit_group_order="8" -     value_default="0" -     value_min="-.3" -     value_max="1.3"> +     value_min="-1" +     value_max="1" +     value_default="0">        <param_driver>          <driven           id="1201" /> 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<LLJointState> 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<LLDriverParam *>(mParamDriver);
 +        llassert_always(driver_param);
 +        if (driver_param)
          {
 -                setParamValue(mParamDriven,position_new_local_clamped);
 -        }
 -        else
 -        {
 -                LLDriverParam *driver_param = dynamic_cast<LLDriverParam *>(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].  <string name="Body Thin">Body Thin</string>  <string name="Bow Legged">Bow Legged</string> -<string name="Breast Physics UpDown Controller">Breast Buoyancy</string> -<string name="Breast Physics InOut Controller">Breast Cleavage</string> +<string name="Breast Buoyancy">Breast Buoyancy</string> +<string name="Breast Cleavage">Breast Cleavage</string>  <string name="Breast Size">Breast Size</string>  <string name="Bridge Width">Bridge Width</string>  <string name="Broad">Broad</string> | 
