Commits

Seraph Linden  committed cc0f0e8

Added duplicate morph to handle breast bounce/clap. Took out unused params in llphysicsmotion.cpp.

  • Participants
  • Parent commits c2ab402

Comments (0)

Files changed (4)

File indra/newview/character/avatar_lad.xml

     </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"
     </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"
      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>
      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>
 
   <!-- ==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" />
     </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" />

File indra/newview/llphysicsmotion.cpp

 {
 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.
 
           controllers: The various settings (e.g. spring force, mass) that determine how
           the body part behaves.
         */
-        LLPhysicsMotion(const std::string &param_user_name, 
-                        const std::string &param_driven_name,
+        LLPhysicsMotion(const std::string &param_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),
         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;
 
         F32 mPositionLastUpdate_local;
         LLVector3 mPosition_world;
 
-        LLViewerVisualParam *mParamUser;
-        LLViewerVisualParam *mParamDriven;
+        LLViewerVisualParam *mParamDriver;
         const controller_map_t mParamControllers;
         
         LLPointer<LLJointState> mJointState;
                 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;
         }
 
                 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),
                 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),
                 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),
                 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),
                 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),
                 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),
 {
         // static FILE *mFileWrite = fopen("c:\\temp\\avatar_data.txt","w");
         
-        if (!mParamUser)
+        if (!mParamDriver)
                 return FALSE;
 
         if (!mLastTime)
         // 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.
                                                        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))
                 {
-                        // 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);
-                        }
+                        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);
                 }
         }
         

File indra/newview/llpolymesh.cpp

 
 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);
                                                                                      "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"));
                                 }
                         }
 
 }
 
 
-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;

File indra/newview/skins/default/xui/en/strings.xml

 <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>