Commits

Seraph Linden  committed 514b814

Changed _driven params to cross wearables; major fix so they wouldn't keep getting reset to default values from wearable.
Took out smoothing param.
Redefined maxeffect param to affect range of motion.

  • Participants
  • Parent commits 9a8742e

Comments (0)

Files changed (3)

File indra/newview/character/avatar_lad.xml

      group="1"
      name="Belly_Physics_Torso_UpDown_Driven"
      wearable="physics"
+     cross_wearable="true"
      edit_group="driven"
      value_default="0"
      value_min="-1"
      group="1"
      name="Breast_Physics_LeftRight_Driven"
      wearable="physics"
+     cross_wearable="true"
      edit_group="driven"
      value_default="0"
      value_min="-2"
      group="1"
      name="Belly_Physics_Legs_UpDown_Driven"
      wearable="physics"
+     cross_wearable="true"
      edit_group="driven"
      value_min="-1"
      value_max="1">
       <param_morph />
     </param>
 
-
+    
     <param
      id="1205"
      group="1"
      name="Butt_Physics_UpDown_Driven"
      wearable="physics"
+     cross_wearable="true"
      edit_group="driven"
-     value_default="0">
+     value_default="0"
+     value_min="-1"
+     value_max="1">
       <param_morph />
     </param>
 
      group="1"
      name="Butt_Physics_LeftRight_Driven"
      wearable="physics"
+     cross_wearable="true"
      edit_group="driven"
      value_default="0"
-     value_min="-2"
-     value_max="2">
+     value_min="-1"
+     value_max="1">
       <param_morph />
     </param>
 
      group="1"
      name="Belly_Physics_Skirt_UpDown_Driven"
      wearable="physics"
+     cross_wearable="true"
      edit_group="driven"
      value_default="0"
      value_min="-1"
      id="10001"
      group="0"
      sex="female"
-     name="Breast_Physics_Smoothing"
-     label="Breast Physics Smoothing"
-     wearable="physics"
-     edit_group="physics_advanced"
-     value_default="2"
-     value_min="1"
-     value_max="10">
-	 <param_driver />
-    </param>
-    <param
-     id="10002"
-     group="0"
-     sex="female"
      name="Breast_Physics_Gravity"
      label="Breast Physics Gravity"
      wearable="physics"
     </param>
 
    <param
-     id="10003"
+     id="10002"
      group="0"
      sex="female"
      name="Breast_Physics_Drag"
     </param>
 
    <param
-     id="10004"
+     id="10003"
      group="0"
      sex="female"
      name="Breast_Physics_UpDown_Max_Effect"
      edit_group="physics_breasts_updown"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="10005"
+     id="10004"
      group="0"
      sex="female"
      name="Breast_Physics_UpDown_Spring"
 	 <param_driver />
     </param>
     <param
-     id="10006"
+     id="10005"
      group="0"
      sex="female"
      name="Breast_Physics_UpDown_Gain"
 	 <param_driver />
     </param>
     <param
-     id="10007"
+     id="10006"
      group="0"
      sex="female"
      name="Breast_Physics_UpDown_Damping"
     </param>
 
    <param
-     id="10008"
+     id="10007"
      group="0"
      sex="female"
      name="Breast_Physics_InOut_Max_Effect"
      edit_group="physics_breasts_inout"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="10009"
+     id="10008"
      group="0"
      sex="female"
      name="Breast_Physics_InOut_Spring"
 	 <param_driver />
     </param>
     <param
-     id="10010"
+     id="10009"
      group="0"
      sex="female"
      name="Breast_Physics_InOut_Gain"
 	 <param_driver />
     </param>
     <param
-     id="10011"
+     id="10010"
      group="0"
      sex="female"
      name="Breast_Physics_InOut_Damping"
     </param>
 
     <param
-     id="10012"
+     id="10011"
      group="0"
      name="Belly_Physics_Mass"
      label="Belly Physics Mass"
 	 <param_driver />
     </param>
     <param
-     id="10013"
-     group="0"
-     name="Belly_Physics_Smoothing"
-     label="Belly Physics Smoothing"
-     wearable="physics"
-     edit_group="physics_advanced"
-     value_default="2"
-     value_min="1"
-     value_max="10">
-	 <param_driver />
-    </param>
-    <param
-     id="10014"
+     id="10012"
      group="0"
      name="Belly_Physics_Gravity"
      label="Belly Physics Gravity"
 	 <param_driver />
     </param>
    <param
-     id="10015"
+     id="10013"
      group="0"
      name="Belly_Physics_Drag"
      label="Belly Physics Drag"
 	 <param_driver />
     </param>
    <param
-     id="10016"
+     id="10014"
      group="0"
      name="Belly_Physics_UpDown_Max_Effect"
      label="Belly Physics UpDown Max Effect"
      edit_group="physics_belly_updown"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="10017"
+     id="10015"
      group="0"
      name="Belly_Physics_UpDown_Spring"
      label="Belly Physics UpDown Spring"
 	 <param_driver />
     </param>
     <param
-     id="10018"
+     id="10016"
      group="0"
      name="Belly_Physics_UpDown_Gain"
      label="Belly Physics UpDown Gain"
 	 <param_driver />
     </param>
     <param
-     id="10019"
+     id="10017"
      group="0"
      name="Belly_Physics_UpDown_Damping"
      label="Belly Physics UpDown Damping"
     </param>
 
     <param
-     id="10020"
+     id="10018"
      group="0"
      name="Butt_Physics_Mass"
      label="Butt Physics Mass"
 	 <param_driver />
     </param>
     <param
-     id="10021"
-     group="0"
-     name="Butt_Physics_Smoothing"
-     label="Butt Physics Smoothing"
-     wearable="physics"
-     edit_group="physics_advanced"
-     value_default="2"
-     value_min="1"
-     value_max="10">
-	 <param_driver />
-    </param>
-    <param
-     id="10022"
+     id="10019"
      group="0"
      name="Butt_Physics_Gravity"
      label="Butt Physics Gravity"
 	 <param_driver />
     </param>
    <param
-     id="10023"
+     id="10020"
      group="0"
      name="Butt_Physics_Drag"
      label="Butt Physics Drag"
     </param>
 
    <param
-     id="10024"
+     id="10021"
      group="0"
      name="Butt_Physics_UpDown_Max_Effect"
      label="Butt Physics UpDown Max Effect"
      edit_group="physics_butt_updown"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="10025"
+     id="10022"
      group="0"
      name="Butt_Physics_UpDown_Spring"
      label="Butt Physics UpDown Spring"
 	 <param_driver />
     </param>
     <param
-     id="10026"
+     id="10023"
      group="0"
      name="Butt_Physics_UpDown_Gain"
      label="Butt Physics UpDown Gain"
 	 <param_driver />
     </param>
     <param
-     id="10027"
+     id="10024"
      group="0"
      name="Butt_Physics_UpDown_Damping"
      label="Butt Physics UpDown Damping"
     </param>
 
    <param
-     id="10028"
+     id="10025"
      group="0"
      name="Butt_Physics_LeftRight_Max_Effect"
      label="Butt Physics LeftRight Max Effect"
      edit_group="physics_butt_leftright"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="10029"
+     id="10026"
      group="0"
      name="Butt_Physics_LeftRight_Spring"
      label="Butt Physics LeftRight Spring"
 	 <param_driver />
     </param>
     <param
-     id="10030"
+     id="10027"
      group="0"
      name="Butt_Physics_LeftRight_Gain"
      label="Butt Physics LeftRight Gain"
 	 <param_driver />
     </param>
     <param
-     id="10031"
+     id="10028"
      group="0"
      name="Butt_Physics_LeftRight_Damping"
      label="Butt Physics LeftRight Damping"
     </param>
 
    <param
-     id="10032"
+     id="10029"
      group="0"
      name="Breast_Physics_LeftRight_Max_Effect"
      label="Breast Physics LeftRight Max Effect"
      edit_group="physics_breasts_leftright"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="10033"
+     id="10030"
      group="0"
      name="Breast_Physics_LeftRight_Spring"
      label="Breast Physics LeftRight Spring"
 	 <param_driver />
     </param>
     <param
-     id="10034"
+     id="10031"
      group="0"
      name="Breast_Physics_LeftRight_Gain"
      label="Breast Physics LeftRight Gain"
 	 <param_driver />
     </param>
     <param
-     id="10035"
+     id="10032"
      group="0"
      name="Breast_Physics_LeftRight_Damping"
      label="Breast Physics LeftRight Damping"

File indra/newview/llphysicsmotion.cpp

 {
         default_controller_map_t controller;
         controller["Mass"] = 0.2f;
-        controller["Smoothing"] = 2.0f;
         controller["Gravity"] = 0.0f;
         controller["Damping"] = .05f;
         controller["Drag"] = 0.15f;
-        controller["MaxSpeed"] = 0.1f;
+        controller["MaxEffect"] = 0.1f;
         controller["Spring"] = 0.1f;
         controller["Gain"] = 10.0f;
         return controller;
         {
                 controller_map_t controller;
                 controller["Mass"] = "Breast_Physics_Mass";
-                controller["Smoothing"] = "Breast_Physics_Smoothing";
                 controller["Gravity"] = "Breast_Physics_Gravity";
                 controller["Drag"] = "Breast_Physics_Drag";
                 controller["Damping"] = "Breast_Physics_InOut_Damping";
-                controller["MaxSpeed"] = "Breast_Physics_InOut_Max_Effect";
+                controller["MaxEffect"] = "Breast_Physics_InOut_Max_Effect";
                 controller["Spring"] = "Breast_Physics_InOut_Spring";
                 controller["Gain"] = "Breast_Physics_InOut_Gain";
                 LLPhysicsMotion *motion = new LLPhysicsMotion("Breast_Physics_InOut_Controller",
         {
                 controller_map_t controller;
                 controller["Mass"] = "Breast_Physics_Mass";
-                controller["Smoothing"] = "Breast_Physics_Smoothing";
                 controller["Gravity"] = "Breast_Physics_Gravity";
                 controller["Drag"] = "Breast_Physics_Drag";
                 controller["Damping"] = "Breast_Physics_UpDown_Damping";
-                controller["MaxSpeed"] = "Breast_Physics_UpDown_Max_Effect";
+                controller["MaxEffect"] = "Breast_Physics_UpDown_Max_Effect";
                 controller["Spring"] = "Breast_Physics_UpDown_Spring";
                 controller["Gain"] = "Breast_Physics_UpDown_Gain";
                 LLPhysicsMotion *motion = new LLPhysicsMotion("Breast_Physics_UpDown_Controller",
         {
                 controller_map_t controller;
                 controller["Mass"] = "Breast_Physics_Mass";
-                controller["Smoothing"] = "Breast_Physics_Smoothing";
                 controller["Gravity"] = "Breast_Physics_Gravity";
                 controller["Drag"] = "Breast_Physics_Drag";
                 controller["Damping"] = "Breast_Physics_LeftRight_Damping";
-                controller["MaxSpeed"] = "Breast_Physics_LeftRight_Max_Effect";
+                controller["MaxEffect"] = "Breast_Physics_LeftRight_Max_Effect";
                 controller["Spring"] = "Breast_Physics_LeftRight_Spring";
                 controller["Gain"] = "Breast_Physics_LeftRight_Gain";
                 LLPhysicsMotion *motion = new LLPhysicsMotion("Breast_Physics_LeftRight_Controller",
                 }
                 addMotion(motion);
         }
-        
         // Butt Bounce
         {
                 controller_map_t controller;
                 controller["Mass"] = "Butt_Physics_Mass";
-                controller["Smoothing"] = "Butt_Physics_Smoothing";
                 controller["Gravity"] = "Butt_Physics_Gravity";
                 controller["Drag"] = "Butt_Physics_Drag";
                 controller["Damping"] = "Butt_Physics_UpDown_Damping";
-                controller["MaxSpeed"] = "Butt_Physics_UpDown_Max_Effect";
+                controller["MaxEffect"] = "Butt_Physics_UpDown_Max_Effect";
                 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),
+                                                                                                          LLVector3(0,0,-1),
                                                                                                           controller);
                 if (!motion->initialize())
                 {
         {
                 controller_map_t controller;
                 controller["Mass"] = "Butt_Physics_Mass";
-                controller["Smoothing"] = "Butt_Physics_Smoothing";
                 controller["Gravity"] = "Butt_Physics_Gravity";
                 controller["Drag"] = "Butt_Physics_Drag";
                 controller["Damping"] = "Butt_Physics_LeftRight_Damping";
-                controller["MaxSpeed"] = "Butt_Physics_LeftRight_Max_Effect";
+                controller["MaxEffect"] = "Butt_Physics_LeftRight_Max_Effect";
                 controller["Spring"] = "Butt_Physics_LeftRight_Spring";
                 controller["Gain"] = "Butt_Physics_LeftRight_Gain";
                 LLPhysicsMotion *motion = new LLPhysicsMotion("Butt_Physics_LeftRight_Controller",
         {
                 controller_map_t controller;
                 controller["Mass"] = "Belly_Physics_Mass";
-                controller["Smoothing"] = "Belly_Physics_Smoothing";
                 controller["Gravity"] = "Belly_Physics_Gravity";
                 controller["Drag"] = "Belly_Physics_Drag";
                 controller["Damping"] = "Belly_Physics_UpDown_Damping";
-                controller["MaxSpeed"] = "Belly_Physics_UpDown_Max_Effect";
+                controller["MaxEffect"] = "Belly_Physics_UpDown_Max_Effect";
                 controller["Spring"] = "Belly_Physics_UpDown_Spring";
                 controller["Gain"] = "Belly_Physics_UpDown_Gain";
                 LLPhysicsMotion *motion = new LLPhysicsMotion("Belly_Physics_UpDown_Controller",
 F32 LLPhysicsMotion::calculateAcceleration_local(const F32 velocity_local,
                                                  const F32 time_delta)
 {
-        const F32 smoothing = getParamValue("Smoothing");
+//        const F32 smoothing = getParamValue("Smoothing");
+    static const F32 smoothing = 3.0f; // Removed smoothing param since it's probably not necessary
         const F32 acceleration_local = velocity_local - mVelocityJoint_local;
         
         const F32 smoothed_acceleration_local = 
         const F32 behavior_drag = getParamValue("Drag");
         const BOOL physics_test = gSavedSettings.getBOOL("AvatarPhysicsTest");
         
-        F32 behavior_maxspeed = getParamValue("MaxSpeed");
+        F32 behavior_maxeffect = getParamValue("MaxEffect");
         if (physics_test)
-                behavior_maxspeed = 100.0f;
+                behavior_maxeffect = 1.0f;
+        // Maximum effect is [0,1] range.
+        const F32 min_val = 0.5f-behavior_maxeffect/2.0;
+        const F32 max_val = 0.5f+behavior_maxeffect/2.0;
 
-        if (behavior_maxspeed == 0)
-                return FALSE;
-
+        // mPositon_local should be in normalized 0,1 range already.  Just making sure...
         F32 position_current_local = llclamp(mPosition_local,
                                              0.0f,
-                                             1.0f); // Normalized [0,1] range
+                                             1.0f);
 
         // Normalize the param position to be from [0,1].
         // We have to use normalized values because there may be more than one driven param,
         F32 position_user_local = mParamUser->getWeight();
         position_user_local = (position_user_local - mParamUser->getMinWeight()) / (mParamUser->getMaxWeight() - mParamUser->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.
+        if ((behavior_maxeffect == 0) && (position_current_local == position_user_local))
+        {
+            return FALSE;
+        }
+
         //
         // End parameters and settings
         ////////////////////////////////////////////////////////////////////////////////
         // Calculate the new acceleration based on the net force.
         // a = F/m
         const F32 acceleration_new_local = force_net / behavior_mass;
+        const F32 max_acceleration = 10.0f; // magic number, used to be customizable.
         F32 velocity_new_local = mVelocity_local + acceleration_new_local;
         velocity_new_local = llclamp(velocity_new_local, 
-                                     -behavior_maxspeed, behavior_maxspeed);
+                                     -max_acceleration, max_acceleration);
         
         // Temporary debugging setting to cause all avatars to move, for profiling purposes.
         if (physics_test)
                 velocity_new_local = sin(time*4.0);
         }
         // Calculate the new parameters, or remain unchanged if max speed is 0.
-        const F32 position_new_local = (behavior_maxspeed != 0) ? 
-                (position_current_local + velocity_new_local*time_delta) :
-                position_user_local;
+        F32 position_new_local = position_current_local + velocity_new_local*time_delta;
+        if (behavior_maxeffect == 0)
+            position_new_local = position_user_local;
 
         // Zero out the velocity if the param is being pushed beyond its limits.
-        if (position_new_local < 0 || position_new_local > 1)
+        if ((position_new_local < min_val && velocity_new_local < 0) || 
+            (position_new_local > max_val && velocity_new_local > 0))
         {
                 velocity_new_local = 0;
         }
 
         const F32 position_new_local_clamped = llclamp(position_new_local,
-                                                       0.0f,
-                                                       1.0f);
+                                                       min_val,
+                                                       max_val);
 
         // Set the new param.
         // If a specific param has been declared, then set that one.
                 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) &&
+			    (driver_param->getVisualParamWeight() != 0))
+			{
+				mCharacter->setVisualParamWeight(driver_param,
+								 0,
+								 FALSE);
+			}
                         for (LLDriverParam::entry_list_t::iterator iter = driver_param->mDriven.begin();
                              iter != driver_param->mDriven.end();
                              ++iter)

File indra/newview/llpolymesh.cpp

 #define HEADER_ASCII "Linden Mesh 1.0"
 #define HEADER_BINARY "Linden Binary Mesh 1.0"
 
-extern LLControlGroup gSavedSettings;				// read only
+extern LLControlGroup gSavedSettings;                           // read only
 
 LLPolyMorphData *clone_morph_param(const LLPolyMorphData *src_data,
-				   const LLVector3 &direction,
-				   const std::string &name);
+                                   const LLVector3 &direction,
+                                   const std::string &name);
 LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data,
                                             F32 scale,
                                             const std::string &name);
 //-----------------------------------------------------------------------------
 LLPolyMeshSharedData::LLPolyMeshSharedData()
 {
-	mNumVertices = 0;
-	mBaseCoords = NULL;
-	mBaseNormals = NULL;
-	mBaseBinormals = NULL;
-	mTexCoords = NULL;
-	mDetailTexCoords = NULL;
-	mWeights = NULL;
-	mHasWeights = FALSE;
-	mHasDetailTexCoords = FALSE;
+        mNumVertices = 0;
+        mBaseCoords = NULL;
+        mBaseNormals = NULL;
+        mBaseBinormals = NULL;
+        mTexCoords = NULL;
+        mDetailTexCoords = NULL;
+        mWeights = NULL;
+        mHasWeights = FALSE;
+        mHasDetailTexCoords = FALSE;
 
-	mNumFaces = 0;
-	mFaces = NULL;
+        mNumFaces = 0;
+        mFaces = NULL;
 
-	mNumJointNames = 0;
-	mJointNames = NULL;
+        mNumJointNames = 0;
+        mJointNames = NULL;
 
-	mTriangleIndices = NULL;
-	mNumTriangleIndices = 0;
+        mTriangleIndices = NULL;
+        mNumTriangleIndices = 0;
 
-	mReferenceData = NULL;
+        mReferenceData = NULL;
 
-	mLastIndexOffset = -1;
+        mLastIndexOffset = -1;
 }
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 LLPolyMeshSharedData::~LLPolyMeshSharedData()
 {
-	freeMeshData();
-	for_each(mMorphData.begin(), mMorphData.end(), DeletePointer());
-	mMorphData.clear();
+        freeMeshData();
+        for_each(mMorphData.begin(), mMorphData.end(), DeletePointer());
+        mMorphData.clear();
 }
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void LLPolyMeshSharedData::setupLOD(LLPolyMeshSharedData* reference_data)
 {
-	mReferenceData = reference_data;
+        mReferenceData = reference_data;
 
-	if (reference_data)
-	{
-		mBaseCoords = reference_data->mBaseCoords;
-		mBaseNormals = reference_data->mBaseNormals;
-		mBaseBinormals = reference_data->mBaseBinormals;
-		mTexCoords = reference_data->mTexCoords;
-		mDetailTexCoords = reference_data->mDetailTexCoords;
-		mWeights = reference_data->mWeights;
-		mHasWeights = reference_data->mHasWeights;
-		mHasDetailTexCoords = reference_data->mHasDetailTexCoords;
-	}
+        if (reference_data)
+        {
+                mBaseCoords = reference_data->mBaseCoords;
+                mBaseNormals = reference_data->mBaseNormals;
+                mBaseBinormals = reference_data->mBaseBinormals;
+                mTexCoords = reference_data->mTexCoords;
+                mDetailTexCoords = reference_data->mDetailTexCoords;
+                mWeights = reference_data->mWeights;
+                mHasWeights = reference_data->mHasWeights;
+                mHasDetailTexCoords = reference_data->mHasDetailTexCoords;
+        }
 }
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void LLPolyMeshSharedData::freeMeshData()
 {
-	if (!mReferenceData)
-	{
-		mNumVertices = 0;
+        if (!mReferenceData)
+        {
+                mNumVertices = 0;
 
-		delete [] mBaseCoords;
-		mBaseCoords = NULL;
+                delete [] mBaseCoords;
+                mBaseCoords = NULL;
 
-		delete [] mBaseNormals;
-		mBaseNormals = NULL;
+                delete [] mBaseNormals;
+                mBaseNormals = NULL;
 
-		delete [] mBaseBinormals;
-		mBaseBinormals = NULL;
+                delete [] mBaseBinormals;
+                mBaseBinormals = NULL;
 
-		delete [] mTexCoords;
-		mTexCoords = NULL;
+                delete [] mTexCoords;
+                mTexCoords = NULL;
 
-		delete [] mDetailTexCoords;
-		mDetailTexCoords = NULL;
+                delete [] mDetailTexCoords;
+                mDetailTexCoords = NULL;
 
-		delete [] mWeights;
-		mWeights = NULL;
-	}
+                delete [] mWeights;
+                mWeights = NULL;
+        }
 
-	mNumFaces = 0;
-	delete [] mFaces;
-	mFaces = NULL;
+        mNumFaces = 0;
+        delete [] mFaces;
+        mFaces = NULL;
 
-	mNumJointNames = 0;
-	delete [] mJointNames;
-	mJointNames = NULL;
+        mNumJointNames = 0;
+        delete [] mJointNames;
+        mJointNames = NULL;
 
-	delete [] mTriangleIndices;
-	mTriangleIndices = NULL;
+        delete [] mTriangleIndices;
+        mTriangleIndices = NULL;
 
-//	mVertFaceMap.deleteAllData();
+//      mVertFaceMap.deleteAllData();
 }
 
 // compate_int is used by the qsort function to sort the index array
 //-----------------------------------------------------------------------------
 void LLPolyMeshSharedData::genIndices(S32 index_offset)
 {
-	if (index_offset == mLastIndexOffset)
-	{
-		return;
-	}
+        if (index_offset == mLastIndexOffset)
+        {
+                return;
+        }
 
-	delete []mTriangleIndices;
-	mTriangleIndices = new U32[mNumTriangleIndices];
+        delete []mTriangleIndices;
+        mTriangleIndices = new U32[mNumTriangleIndices];
 
-	S32 cur_index = 0;
-	for (S32 i = 0; i < mNumFaces; i++)
-	{
-		mTriangleIndices[cur_index] = mFaces[i][0] + index_offset;
-		cur_index++;
-		mTriangleIndices[cur_index] = mFaces[i][1] + index_offset;
-		cur_index++;
-		mTriangleIndices[cur_index] = mFaces[i][2] + index_offset;
-		cur_index++;
-	}
+        S32 cur_index = 0;
+        for (S32 i = 0; i < mNumFaces; i++)
+        {
+                mTriangleIndices[cur_index] = mFaces[i][0] + index_offset;
+                cur_index++;
+                mTriangleIndices[cur_index] = mFaces[i][1] + index_offset;
+                cur_index++;
+                mTriangleIndices[cur_index] = mFaces[i][2] + index_offset;
+                cur_index++;
+        }
 
-	mLastIndexOffset = index_offset;
+        mLastIndexOffset = index_offset;
 }
 
 //--------------------------------------------------------------------
 //--------------------------------------------------------------------
 U32 LLPolyMeshSharedData::getNumKB()
 {
-	U32 num_kb = sizeof(LLPolyMesh);
+        U32 num_kb = sizeof(LLPolyMesh);
 
-	if (!isLOD())
-	{
-		num_kb += mNumVertices *
-					( sizeof(LLVector3) +	// coords
-					sizeof(LLVector3) +		// normals
-					sizeof(LLVector2) );	// texCoords
-	}
+        if (!isLOD())
+        {
+                num_kb += mNumVertices *
+                        ( sizeof(LLVector3) +   // coords
+                          sizeof(LLVector3) +             // normals
+                          sizeof(LLVector2) );    // texCoords
+        }
 
-	if (mHasDetailTexCoords && !isLOD())
-	{
-		num_kb += mNumVertices * sizeof(LLVector2);	// detailTexCoords
-	}
+        if (mHasDetailTexCoords && !isLOD())
+        {
+                num_kb += mNumVertices * sizeof(LLVector2);     // detailTexCoords
+        }
 
-	if (mHasWeights && !isLOD())
-	{
-		num_kb += mNumVertices * sizeof(float);		// weights
-	}
+        if (mHasWeights && !isLOD())
+        {
+                num_kb += mNumVertices * sizeof(float);         // weights
+        }
 
-	num_kb += mNumFaces * sizeof(LLPolyFace);	// faces
+        num_kb += mNumFaces * sizeof(LLPolyFace);       // faces
 
-	num_kb /= 1024;
-	return num_kb;
+        num_kb /= 1024;
+        return num_kb;
 }
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices )
 {
-	U32 i;
-	mBaseCoords = new LLVector3[ numVertices ];
-	mBaseNormals = new LLVector3[ numVertices ];
-	mBaseBinormals = new LLVector3[ numVertices ];
-	mTexCoords = new LLVector2[ numVertices ];
-	mDetailTexCoords = new LLVector2[ numVertices ];
-	mWeights = new F32[ numVertices ];
-	for (i = 0; i < numVertices; i++)
-	{
-		mWeights[i] = 0.f;
-	}
-	mNumVertices = numVertices;
-	return TRUE;
+        U32 i;
+        mBaseCoords = new LLVector3[ numVertices ];
+        mBaseNormals = new LLVector3[ numVertices ];
+        mBaseBinormals = new LLVector3[ numVertices ];
+        mTexCoords = new LLVector2[ numVertices ];
+        mDetailTexCoords = new LLVector2[ numVertices ];
+        mWeights = new F32[ numVertices ];
+        for (i = 0; i < numVertices; i++)
+        {
+                mWeights[i] = 0.f;
+        }
+        mNumVertices = numVertices;
+        return TRUE;
 }
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 BOOL LLPolyMeshSharedData::allocateFaceData( U32 numFaces )
 {
-	mFaces = new LLPolyFace[ numFaces ];
-	mNumFaces = numFaces;
-	mNumTriangleIndices = mNumFaces * 3;
-	return TRUE;
+        mFaces = new LLPolyFace[ numFaces ];
+        mNumFaces = numFaces;
+        mNumTriangleIndices = mNumFaces * 3;
+        return TRUE;
 }
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 BOOL LLPolyMeshSharedData::allocateJointNames( U32 numJointNames )
 {
-	mJointNames = new std::string[ numJointNames ];
-	mNumJointNames = numJointNames;
-	return TRUE;
+        mJointNames = new std::string[ numJointNames ];
+        mNumJointNames = numJointNames;
+        return TRUE;
 }
 
 //--------------------------------------------------------------------
 //--------------------------------------------------------------------
 BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
 {
-	//-------------------------------------------------------------------------
-	// Open the file
-	//-------------------------------------------------------------------------
-	if(fileName.empty())
-	{
-		llerrs << "Filename is Empty!" << llendl;
-		return FALSE;
-	}
-	LLFILE* fp = LLFile::fopen(fileName, "rb");			/*Flawfinder: ignore*/
-	if (!fp)
-	{
-		llerrs << "can't open: " << fileName << llendl;
-		return FALSE;
-	}
+        //-------------------------------------------------------------------------
+        // Open the file
+        //-------------------------------------------------------------------------
+        if(fileName.empty())
+        {
+                llerrs << "Filename is Empty!" << llendl;
+                return FALSE;
+        }
+        LLFILE* fp = LLFile::fopen(fileName, "rb");                     /*Flawfinder: ignore*/
+        if (!fp)
+        {
+                llerrs << "can't open: " << fileName << llendl;
+                return FALSE;
+        }
 
-	//-------------------------------------------------------------------------
-	// Read a chunk
-	//-------------------------------------------------------------------------
-	char header[128];		/*Flawfinder: ignore*/
-	if (fread(header, sizeof(char), 128, fp) != 128)
-	{
-		llwarns << "Short read" << llendl;
-	}
+        //-------------------------------------------------------------------------
+        // Read a chunk
+        //-------------------------------------------------------------------------
+        char header[128];               /*Flawfinder: ignore*/
+        if (fread(header, sizeof(char), 128, fp) != 128)
+        {
+                llwarns << "Short read" << llendl;
+        }
 
-	//-------------------------------------------------------------------------
-	// Check for proper binary header
-	//-------------------------------------------------------------------------
-	BOOL status = FALSE;
-	if ( strncmp(header, HEADER_BINARY, strlen(HEADER_BINARY)) == 0 )	/*Flawfinder: ignore*/
-	{
-		lldebugs << "Loading " << fileName << llendl;
+        //-------------------------------------------------------------------------
+        // Check for proper binary header
+        //-------------------------------------------------------------------------
+        BOOL status = FALSE;
+        if ( strncmp(header, HEADER_BINARY, strlen(HEADER_BINARY)) == 0 )       /*Flawfinder: ignore*/
+        {
+                lldebugs << "Loading " << fileName << llendl;
 
-		//----------------------------------------------------------------
-		// File Header (seek past it)
-		//----------------------------------------------------------------
-		fseek(fp, 24, SEEK_SET);
+                //----------------------------------------------------------------
+                // File Header (seek past it)
+                //----------------------------------------------------------------
+                fseek(fp, 24, SEEK_SET);
 
-		//----------------------------------------------------------------
-		// HasWeights
-		//----------------------------------------------------------------
-		U8 hasWeights;
-		size_t numRead = fread(&hasWeights, sizeof(U8), 1, fp);
-		if (numRead != 1)
-		{
-			llerrs << "can't read HasWeights flag from " << fileName << llendl;
-			return FALSE;
-		}
-		if (!isLOD())
-		{
-			mHasWeights = (hasWeights==0) ? FALSE : TRUE;
-		}
+                //----------------------------------------------------------------
+                // HasWeights
+                //----------------------------------------------------------------
+                U8 hasWeights;
+                size_t numRead = fread(&hasWeights, sizeof(U8), 1, fp);
+                if (numRead != 1)
+                {
+                        llerrs << "can't read HasWeights flag from " << fileName << llendl;
+                        return FALSE;
+                }
+                if (!isLOD())
+                {
+                        mHasWeights = (hasWeights==0) ? FALSE : TRUE;
+                }
 
-		//----------------------------------------------------------------
-		// HasDetailTexCoords
-		//----------------------------------------------------------------
-		U8 hasDetailTexCoords;
-		numRead = fread(&hasDetailTexCoords, sizeof(U8), 1, fp);
-		if (numRead != 1)
-		{
-			llerrs << "can't read HasDetailTexCoords flag from " << fileName << llendl;
-			return FALSE;
-		}
+                //----------------------------------------------------------------
+                // HasDetailTexCoords
+                //----------------------------------------------------------------
+                U8 hasDetailTexCoords;
+                numRead = fread(&hasDetailTexCoords, sizeof(U8), 1, fp);
+                if (numRead != 1)
+                {
+                        llerrs << "can't read HasDetailTexCoords flag from " << fileName << llendl;
+                        return FALSE;
+                }
 
-		//----------------------------------------------------------------
-		// Position
-		//----------------------------------------------------------------
-		LLVector3 position;
-		numRead = fread(position.mV, sizeof(float), 3, fp);
-		llendianswizzle(position.mV, sizeof(float), 3);
-		if (numRead != 3)
-		{
-			llerrs << "can't read Position from " << fileName << llendl;
-			return FALSE;
-		}
-		setPosition( position );
+                //----------------------------------------------------------------
+                // Position
+                //----------------------------------------------------------------
+                LLVector3 position;
+                numRead = fread(position.mV, sizeof(float), 3, fp);
+                llendianswizzle(position.mV, sizeof(float), 3);
+                if (numRead != 3)
+                {
+                        llerrs << "can't read Position from " << fileName << llendl;
+                        return FALSE;
+                }
+                setPosition( position );
 
-		//----------------------------------------------------------------
-		// Rotation
-		//----------------------------------------------------------------
-		LLVector3 rotationAngles;
-		numRead = fread(rotationAngles.mV, sizeof(float), 3, fp);
-		llendianswizzle(rotationAngles.mV, sizeof(float), 3);
-		if (numRead != 3)
-		{
-			llerrs << "can't read RotationAngles from " << fileName << llendl;
-			return FALSE;
-		}
+                //----------------------------------------------------------------
+                // Rotation
+                //----------------------------------------------------------------
+                LLVector3 rotationAngles;
+                numRead = fread(rotationAngles.mV, sizeof(float), 3, fp);
+                llendianswizzle(rotationAngles.mV, sizeof(float), 3);
+                if (numRead != 3)
+                {
+                        llerrs << "can't read RotationAngles from " << fileName << llendl;
+                        return FALSE;
+                }
 
-		U8 rotationOrder;
-		numRead = fread(&rotationOrder, sizeof(U8), 1, fp);
+                U8 rotationOrder;
+                numRead = fread(&rotationOrder, sizeof(U8), 1, fp);
 
-		if (numRead != 1)
-		{
-			llerrs << "can't read RotationOrder from " << fileName << llendl;
-			return FALSE;
-		}
+                if (numRead != 1)
+                {
+                        llerrs << "can't read RotationOrder from " << fileName << llendl;
+                        return FALSE;
+                }
 
-		rotationOrder = 0;
+                rotationOrder = 0;
 
-		setRotation( mayaQ(	rotationAngles.mV[0],
-							rotationAngles.mV[1],
-							rotationAngles.mV[2],
-							(LLQuaternion::Order)rotationOrder ) );
+                setRotation( mayaQ(     rotationAngles.mV[0],
+                                        rotationAngles.mV[1],
+                                        rotationAngles.mV[2],
+                                        (LLQuaternion::Order)rotationOrder ) );
 
-		//----------------------------------------------------------------
-		// Scale
-		//----------------------------------------------------------------
-		LLVector3 scale;
-		numRead = fread(scale.mV, sizeof(float), 3, fp);
-		llendianswizzle(scale.mV, sizeof(float), 3);
-		if (numRead != 3)
-		{
-			llerrs << "can't read Scale from " << fileName << llendl;
-			return FALSE;
-		}
-		setScale( scale );
+                //----------------------------------------------------------------
+                // Scale
+                //----------------------------------------------------------------
+                LLVector3 scale;
+                numRead = fread(scale.mV, sizeof(float), 3, fp);
+                llendianswizzle(scale.mV, sizeof(float), 3);
+                if (numRead != 3)
+                {
+                        llerrs << "can't read Scale from " << fileName << llendl;
+                        return FALSE;
+                }
+                setScale( scale );
 
-		//-------------------------------------------------------------------------
-		// Release any existing mesh geometry
-		//-------------------------------------------------------------------------
-		freeMeshData();
+                //-------------------------------------------------------------------------
+                // Release any existing mesh geometry
+                //-------------------------------------------------------------------------
+                freeMeshData();
 
-		U16 numVertices = 0;
+                U16 numVertices = 0;
 
-		//----------------------------------------------------------------
-		// NumVertices
-		//----------------------------------------------------------------
-		if (!isLOD())
-		{
-			numRead = fread(&numVertices, sizeof(U16), 1, fp);
-			llendianswizzle(&numVertices, sizeof(U16), 1);
-			if (numRead != 1)
-			{
-				llerrs << "can't read NumVertices from " << fileName << llendl;
-				return FALSE;
-			}
+                //----------------------------------------------------------------
+                // NumVertices
+                //----------------------------------------------------------------
+                if (!isLOD())
+                {
+                        numRead = fread(&numVertices, sizeof(U16), 1, fp);
+                        llendianswizzle(&numVertices, sizeof(U16), 1);
+                        if (numRead != 1)
+                        {
+                                llerrs << "can't read NumVertices from " << fileName << llendl;
+                                return FALSE;
+                        }
 
-			allocateVertexData( numVertices );	
+                        allocateVertexData( numVertices );      
 
-			//----------------------------------------------------------------
-			// Coords
-			//----------------------------------------------------------------
-			numRead = fread(mBaseCoords, 3*sizeof(float), numVertices, fp);
-			llendianswizzle(mBaseCoords, sizeof(float), 3*numVertices);
-			if (numRead != numVertices)
-			{
-				llerrs << "can't read Coordinates from " << fileName << llendl;
-				return FALSE;
-			}
+                        //----------------------------------------------------------------
+                        // Coords
+                        //----------------------------------------------------------------
+                        numRead = fread(mBaseCoords, 3*sizeof(float), numVertices, fp);
+                        llendianswizzle(mBaseCoords, sizeof(float), 3*numVertices);
+                        if (numRead != numVertices)
+                        {
+                                llerrs << "can't read Coordinates from " << fileName << llendl;
+                                return FALSE;
+                        }
 
-			//----------------------------------------------------------------
-			// Normals
-			//----------------------------------------------------------------
-			numRead = fread(mBaseNormals, 3*sizeof(float), numVertices, fp);
-			llendianswizzle(mBaseNormals, sizeof(float), 3*numVertices);
-			if (numRead != numVertices)
-			{
-				llerrs << " can't read Normals from " << fileName << llendl;
-				return FALSE;
-			}
+                        //----------------------------------------------------------------
+                        // Normals
+                        //----------------------------------------------------------------
+                        numRead = fread(mBaseNormals, 3*sizeof(float), numVertices, fp);
+                        llendianswizzle(mBaseNormals, sizeof(float), 3*numVertices);
+                        if (numRead != numVertices)
+                        {
+                                llerrs << " can't read Normals from " << fileName << llendl;
+                                return FALSE;
+                        }
 
-			//----------------------------------------------------------------
-			// Binormals
-			//----------------------------------------------------------------
-			numRead = fread(mBaseBinormals, 3*sizeof(float), numVertices, fp);
-			llendianswizzle(mBaseBinormals, sizeof(float), 3*numVertices);
-			if (numRead != numVertices)
-			{
-				llerrs << " can't read Binormals from " << fileName << llendl;
-				return FALSE;
-			}
+                        //----------------------------------------------------------------
+                        // Binormals
+                        //----------------------------------------------------------------
+                        numRead = fread(mBaseBinormals, 3*sizeof(float), numVertices, fp);
+                        llendianswizzle(mBaseBinormals, sizeof(float), 3*numVertices);
+                        if (numRead != numVertices)
+                        {
+                                llerrs << " can't read Binormals from " << fileName << llendl;
+                                return FALSE;
+                        }
 
 
-			//----------------------------------------------------------------
-			// TexCoords
-			//----------------------------------------------------------------
-			numRead = fread(mTexCoords, 2*sizeof(float), numVertices, fp);
-			llendianswizzle(mTexCoords, sizeof(float), 2*numVertices);
-			if (numRead != numVertices)
-			{
-				llerrs << "can't read TexCoords from " << fileName << llendl;
-				return FALSE;
-			}
+                        //----------------------------------------------------------------
+                        // TexCoords
+                        //----------------------------------------------------------------
+                        numRead = fread(mTexCoords, 2*sizeof(float), numVertices, fp);
+                        llendianswizzle(mTexCoords, sizeof(float), 2*numVertices);
+                        if (numRead != numVertices)
+                        {
+                                llerrs << "can't read TexCoords from " << fileName << llendl;
+                                return FALSE;
+                        }
 
-			//----------------------------------------------------------------
-			// DetailTexCoords
-			//----------------------------------------------------------------
-			if (mHasDetailTexCoords)
-			{
-				numRead = fread(mDetailTexCoords, 2*sizeof(float), numVertices, fp);
-				llendianswizzle(mDetailTexCoords, sizeof(float), 2*numVertices);
-				if (numRead != numVertices)
-				{
-					llerrs << "can't read DetailTexCoords from " << fileName << llendl;
-					return FALSE;
-				}
-			}
+                        //----------------------------------------------------------------
+                        // DetailTexCoords
+                        //----------------------------------------------------------------
+                        if (mHasDetailTexCoords)
+                        {
+                                numRead = fread(mDetailTexCoords, 2*sizeof(float), numVertices, fp);
+                                llendianswizzle(mDetailTexCoords, sizeof(float), 2*numVertices);
+                                if (numRead != numVertices)
+                                {
+                                        llerrs << "can't read DetailTexCoords from " << fileName << llendl;
+                                        return FALSE;
+                                }
+                        }
 
-			//----------------------------------------------------------------
-			// Weights
-			//----------------------------------------------------------------
-			if (mHasWeights)
-			{
-				numRead = fread(mWeights, sizeof(float), numVertices, fp);
-				llendianswizzle(mWeights, sizeof(float), numVertices);
-				if (numRead != numVertices)
-				{
-					llerrs << "can't read Weights from " << fileName << llendl;
-					return FALSE;
-				}
-			}
-		}
+                        //----------------------------------------------------------------
+                        // Weights
+                        //----------------------------------------------------------------
+                        if (mHasWeights)
+                        {
+                                numRead = fread(mWeights, sizeof(float), numVertices, fp);
+                                llendianswizzle(mWeights, sizeof(float), numVertices);
+                                if (numRead != numVertices)
+                                {
+                                        llerrs << "can't read Weights from " << fileName << llendl;
+                                        return FALSE;
+                                }
+                        }
+                }
 
-		//----------------------------------------------------------------
-		// NumFaces
-		//----------------------------------------------------------------
-		U16 numFaces;
-		numRead = fread(&numFaces, sizeof(U16), 1, fp);
-		llendianswizzle(&numFaces, sizeof(U16), 1);
-		if (numRead != 1)
-		{
-			llerrs << "can't read NumFaces from " << fileName << llendl;
-			return FALSE;
-		}
-		allocateFaceData( numFaces );
+                //----------------------------------------------------------------
+                // NumFaces
+                //----------------------------------------------------------------
+                U16 numFaces;
+                numRead = fread(&numFaces, sizeof(U16), 1, fp);
+                llendianswizzle(&numFaces, sizeof(U16), 1);
+                if (numRead != 1)
+                {
+                        llerrs << "can't read NumFaces from " << fileName << llendl;
+                        return FALSE;
+                }
+                allocateFaceData( numFaces );
 
 
-		//----------------------------------------------------------------
-		// Faces
-		//----------------------------------------------------------------
-		U32 i;
-		U32 numTris = 0;
-		for (i = 0; i < numFaces; i++)
-		{
-			S16 face[3];
-			numRead = fread(face, sizeof(U16), 3, fp);
-			llendianswizzle(face, sizeof(U16), 3);
-			if (numRead != 3)
-			{
-				llerrs << "can't read Face[" << i << "] from " << fileName << llendl;
-				return FALSE;
-			}
-			if (mReferenceData)
-			{
-				llassert(face[0] < mReferenceData->mNumVertices);
-				llassert(face[1] < mReferenceData->mNumVertices);
-				llassert(face[2] < mReferenceData->mNumVertices);
-			}
-			
-			if (isLOD())
-			{
-				// store largest index in case of LODs
-				for (S32 j = 0; j < 3; j++)
-				{
-					if (face[j] > mNumVertices - 1)
-					{
-						mNumVertices = face[j] + 1;
-					}
-				}
-			}
-			mFaces[i][0] = face[0];
-			mFaces[i][1] = face[1];
-			mFaces[i][2] = face[2];
+                //----------------------------------------------------------------
+                // Faces
+                //----------------------------------------------------------------
+                U32 i;
+                U32 numTris = 0;
+                for (i = 0; i < numFaces; i++)
+                {
+                        S16 face[3];
+                        numRead = fread(face, sizeof(U16), 3, fp);
+                        llendianswizzle(face, sizeof(U16), 3);
+                        if (numRead != 3)
+                        {
+                                llerrs << "can't read Face[" << i << "] from " << fileName << llendl;
+                                return FALSE;
+                        }
+                        if (mReferenceData)
+                        {
+                                llassert(face[0] < mReferenceData->mNumVertices);
+                                llassert(face[1] < mReferenceData->mNumVertices);
+                                llassert(face[2] < mReferenceData->mNumVertices);
+                        }
+                        
+                        if (isLOD())
+                        {
+                                // store largest index in case of LODs
+                                for (S32 j = 0; j < 3; j++)
+                                {
+                                        if (face[j] > mNumVertices - 1)
+                                        {
+                                                mNumVertices = face[j] + 1;
+                                        }
+                                }
+                        }
+                        mFaces[i][0] = face[0];
+                        mFaces[i][1] = face[1];
+                        mFaces[i][2] = face[2];
 
-//			S32 j;
-//			for(j = 0; j < 3; j++)
-//			{
-//				LLDynamicArray<S32> *face_list = mVertFaceMap.getIfThere(face[j]);
-//				if (!face_list)
-//				{
-//					face_list = new LLDynamicArray<S32>;
-//					mVertFaceMap.addData(face[j], face_list);
-//				}
-//				face_list->put(i);
-//			}
+//                      S32 j;
+//                      for(j = 0; j < 3; j++)
+//                      {
+//                              LLDynamicArray<S32> *face_list = mVertFaceMap.getIfThere(face[j]);
+//                              if (!face_list)
+//                              {
+//                                      face_list = new LLDynamicArray<S32>;
+//                                      mVertFaceMap.addData(face[j], face_list);
+//                              }
+//                              face_list->put(i);
+//                      }
 
-			numTris++;
-		}
+                        numTris++;
+                }
 
-		lldebugs << "verts: " << numVertices 
-			<< ", faces: "   << numFaces
-			<< ", tris: "    << numTris
-			<< llendl;
+                lldebugs << "verts: " << numVertices 
+                         << ", faces: "   << numFaces
+                         << ", tris: "    << numTris
+                         << llendl;
 
-		//----------------------------------------------------------------
-		// NumSkinJoints
-		//----------------------------------------------------------------
-		if (!isLOD())
-		{
-			U16 numSkinJoints = 0;
-			if ( mHasWeights )
-			{
-				numRead = fread(&numSkinJoints, sizeof(U16), 1, fp);
-				llendianswizzle(&numSkinJoints, sizeof(U16), 1);
-				if (numRead != 1)
-				{
-					llerrs << "can't read NumSkinJoints from " << fileName << llendl;
-					return FALSE;
-				}
-				allocateJointNames( numSkinJoints );
-			}
+                //----------------------------------------------------------------
+                // NumSkinJoints
+                //----------------------------------------------------------------
+                if (!isLOD())
+                {
+                        U16 numSkinJoints = 0;
+                        if ( mHasWeights )
+                        {
+                                numRead = fread(&numSkinJoints, sizeof(U16), 1, fp);
+                                llendianswizzle(&numSkinJoints, sizeof(U16), 1);
+                                if (numRead != 1)
+                                {
+                                        llerrs << "can't read NumSkinJoints from " << fileName << llendl;
+                                        return FALSE;
+                                }
+                                allocateJointNames( numSkinJoints );
+                        }
 
-			//----------------------------------------------------------------
-			// SkinJoints
-			//----------------------------------------------------------------
-			for (i=0; i < numSkinJoints; i++)
-			{
-				char jointName[64+1];
-				numRead = fread(jointName, sizeof(jointName)-1, 1, fp);
-				jointName[sizeof(jointName)-1] = '\0'; // ensure nul-termination
-				if (numRead != 1)
-				{
-					llerrs << "can't read Skin[" << i << "].Name from " << fileName << llendl;
-					return FALSE;
-				}
+                        //----------------------------------------------------------------
+                        // SkinJoints
+                        //----------------------------------------------------------------
+                        for (i=0; i < numSkinJoints; i++)
+                        {
+                                char jointName[64+1];
+                                numRead = fread(jointName, sizeof(jointName)-1, 1, fp);
+                                jointName[sizeof(jointName)-1] = '\0'; // ensure nul-termination
+                                if (numRead != 1)
+                                {
+                                        llerrs << "can't read Skin[" << i << "].Name from " << fileName << llendl;
+                                        return FALSE;
+                                }
 
-				std::string *jn = &mJointNames[i];
-				*jn = jointName;
-			}
+                                std::string *jn = &mJointNames[i];
+                                *jn = jointName;
+                        }
 
-			//-------------------------------------------------------------------------
-			// look for morph section
-			//-------------------------------------------------------------------------
-			char morphName[64+1];
-			morphName[sizeof(morphName)-1] = '\0'; // ensure nul-termination
-			while(fread(&morphName, sizeof(char), 64, fp) == 64)
-			{
-				if (!strcmp(morphName, "End Morphs"))
-				{
-					// we reached the end of the morphs
-					break;
-				}
-				LLPolyMorphData* morph_data = new LLPolyMorphData(std::string(morphName));
+                        //-------------------------------------------------------------------------
+                        // look for morph section
+                        //-------------------------------------------------------------------------
+                        char morphName[64+1];
+                        morphName[sizeof(morphName)-1] = '\0'; // ensure nul-termination
+                        while(fread(&morphName, sizeof(char), 64, fp) == 64)
+                        {
+                                if (!strcmp(morphName, "End Morphs"))
+                                {
+                                        // we reached the end of the morphs
+                                        break;
+                                }
+                                LLPolyMorphData* morph_data = new LLPolyMorphData(std::string(morphName));
 
-				BOOL result = morph_data->loadBinary(fp, this);
+                                BOOL result = morph_data->loadBinary(fp, this);
 
-				if (!result)
-				{
-					delete morph_data;
-					continue;
-				}
+                                if (!result)
+                                {
+                                        delete morph_data;
+                                        continue;
+                                }
 
-				mMorphData.insert(morph_data);
+                                mMorphData.insert(morph_data);
 
-				if (!strcmp(morphName, "Breast_Female_Cleavage"))
-				{
-                                    mMorphData.insert(clone_morph_param_cleavage(morph_data,
-                                                                                 0.5f,
-                                                                                 "Breast_Physics_LeftRight_Driven"));
-				}
+                                if (!strcmp(morphName, "Breast_Female_Cleavage"))
+                                {
+                                        mMorphData.insert(clone_morph_param_cleavage(morph_data,
+                                                                                     .75f,
+                                                                                     "Breast_Physics_LeftRight_Driven"));
+                                }
 
-				if (!strcmp(morphName, "Big_Belly_Torso"))
-				{
-					mMorphData.insert(clone_morph_param(morph_data,
-									    LLVector3(0,0,0.03f),
-									    "Belly_Physics_Torso_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"));
+                                }
 
-				if (!strcmp(morphName, "Big_Belly_Legs"))
-				{
-					mMorphData.insert(clone_morph_param(morph_data,
-									    LLVector3(0,0,0.03f),
-									    "Belly_Physics_Legs_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"));
+                                }
 
-				if (!strcmp(morphName, "skirt_belly"))
-				{
-					mMorphData.insert(clone_morph_param(morph_data,
-									    LLVector3(0,0,0.03f),
-									    "Belly_Physics_Skirt_UpDown_Driven"));
-				}
+                                if (!strcmp(morphName, "skirt_belly"))
+                                {
+                                        mMorphData.insert(clone_morph_param(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.015f),
-									    "Butt_Physics_UpDown_Driven"));
-				}
-				if (!strcmp(morphName, "Small_Butt"))
-				{
-					mMorphData.insert(clone_morph_param(morph_data,
-									    LLVector3(0,0.015f,0),
-									    "Butt_Physics_LeftRight_Driven"));
-				}
-			}
+                                if (!strcmp(morphName, "Small_Butt"))
+                                {
+                                        mMorphData.insert(clone_morph_param(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.02f,0),
+                                                                            "Butt_Physics_LeftRight_Driven"));
+                                }
+                        }
 
-			S32 numRemaps;
-			if (fread(&numRemaps, sizeof(S32), 1, fp) == 1)
-			{
-				llendianswizzle(&numRemaps, sizeof(S32), 1);
-				for (S32 i = 0; i < numRemaps; i++)
-				{
-					S32 remapSrc;
-					S32 remapDst;
-					if (fread(&remapSrc, sizeof(S32), 1, fp) != 1)
-					{
-						llerrs << "can't read source vertex in vertex remap data" << llendl;
-						break;
-					}
-					if (fread(&remapDst, sizeof(S32), 1, fp) != 1)
-					{
-						llerrs << "can't read destination vertex in vertex remap data" << llendl;
-						break;
-					}
-					llendianswizzle(&remapSrc, sizeof(S32), 1);
-					llendianswizzle(&remapDst, sizeof(S32), 1);
+                        S32 numRemaps;
+                        if (fread(&numRemaps, sizeof(S32), 1, fp) == 1)
+                        {
+                                llendianswizzle(&numRemaps, sizeof(S32), 1);
+                                for (S32 i = 0; i < numRemaps; i++)
+                                {
+                                        S32 remapSrc;
+                                        S32 remapDst;
+                                        if (fread(&remapSrc, sizeof(S32), 1, fp) != 1)
+                                        {
+                                                llerrs << "can't read source vertex in vertex remap data" << llendl;
+                                                break;
+                                        }
+                                        if (fread(&remapDst, sizeof(S32), 1, fp) != 1)
+                                        {
+                                                llerrs << "can't read destination vertex in vertex remap data" << llendl;
+                                                break;
+                                        }
+                                        llendianswizzle(&remapSrc, sizeof(S32), 1);
+                                        llendianswizzle(&remapDst, sizeof(S32), 1);
 
-					mSharedVerts[remapSrc] = remapDst;
-				}
-			}
-		}
+                                        mSharedVerts[remapSrc] = remapDst;
+                                }
+                        }
+                }
 
-		status = TRUE;
-	}
-	else
-	{
-		llerrs << "invalid mesh file header: " << fileName << llendl;
-		status = FALSE;
-	}
+                status = TRUE;
+        }
+        else
+        {
+                llerrs << "invalid mesh file header: " << fileName << llendl;
+                status = FALSE;
+        }
 
-	if (0 == mNumJointNames)
-	{
-		allocateJointNames(1);
-	}
+        if (0 == mNumJointNames)
+        {
+                allocateJointNames(1);
+        }
 
-	fclose( fp );
+        fclose( fp );
 
-	return status;
+        return status;
 }
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 const S32 *LLPolyMeshSharedData::getSharedVert(S32 vert)
 {
-	if (mSharedVerts.count(vert) > 0)
-	{
-		return &mSharedVerts[vert];
-	}
-	return NULL;
+        if (mSharedVerts.count(vert) > 0)
+        {
+                return &mSharedVerts[vert];
+        }
+        return NULL;
 }
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 const LLVector2 &LLPolyMeshSharedData::getUVs(U32 index)
 {
-	// TODO: convert all index variables to S32
-	llassert((S32)index < mNumVertices);
+        // TODO: convert all index variables to S32
+        llassert((S32)index < mNumVertices);
 
-	return mTexCoords[index];
+        return mTexCoords[index];
 }
 
 //-----------------------------------------------------------------------------
 // LLPolyMesh()
 //-----------------------------------------------------------------------------
 LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_mesh)
-{	
-	LLMemType mt(LLMemType::MTYPE_AVATAR_MESH);
+{       
+        LLMemType mt(LLMemType::MTYPE_AVATAR_MESH);
 
-	llassert(shared_data);
+        llassert(shared_data);
 
-	mSharedData = shared_data;
-	mReferenceMesh = reference_mesh;
-	mAvatarp = NULL;
-	mVertexData = NULL;
+        mSharedData = shared_data;
+        mReferenceMesh = reference_mesh;
+        mAvatarp = NULL;
+        mVertexData = NULL;
 
-	mCurVertexCount = 0;
-	mFaceIndexCount = 0;
-	mFaceIndexOffset = 0;
-	mFaceVertexCount = 0;
-	mFaceVertexOffset = 0;
+        mCurVertexCount = 0;
+        mFaceIndexCount = 0;
+        mFaceIndexOffset = 0;
+        mFaceVertexCount = 0;
+        mFaceVertexOffset = 0;
 
-	if (shared_data->isLOD() && reference_mesh)
-	{
-		mCoords = reference_mesh->mCoords;
-		mNormals = reference_mesh->mNormals;
-		mScaledNormals = reference_mesh->mScaledNormals;
-		mBinormals = reference_mesh->mBinormals;
-		mScaledBinormals = reference_mesh->mScaledBinormals;
-		mTexCoords = reference_mesh->mTexCoords;
-		mClothingWeights = reference_mesh->mClothingWeights;
-	}
-	else
-	{
-#if 1	// Allocate memory without initializing every vector
-		// NOTE: This makes asusmptions about the size of LLVector[234]
-		int nverts = mSharedData->mNumVertices;
-		int nfloats = nverts * (3*5 + 2 + 4);
-		mVertexData = new F32[nfloats];
-		int offset = 0;
-		mCoords = 				(LLVector3*)(mVertexData + offset); offset += 3*nverts;
-		mNormals = 				(LLVector3*)(mVertexData + offset); offset += 3*nverts;
-		mScaledNormals = 		(LLVector3*)(mVertexData + offset); offset += 3*nverts;
-		mBinormals = 			(LLVector3*)(mVertexData + offset); offset += 3*nverts;
-		mScaledBinormals = 		(LLVector3*)(mVertexData + offset); offset += 3*nverts;
-		mTexCoords = 			(LLVector2*)(mVertexData + offset); offset += 2*nverts;
-		mClothingWeights = 	(LLVector4*)(mVertexData + offset); offset += 4*nverts;
+        if (shared_data->isLOD() && reference_mesh)
+        {
+                mCoords = reference_mesh->mCoords;
+                mNormals = reference_mesh->mNormals;
+                mScaledNormals = reference_mesh->mScaledNormals;
+                mBinormals = reference_mesh->mBinormals;
+                mScaledBinormals = reference_mesh->mScaledBinormals;
+                mTexCoords = reference_mesh->mTexCoords;
+                mClothingWeights = reference_mesh->mClothingWeights;
+        }
+        else
+        {
+#if 1   // Allocate memory without initializing every vector
+                // NOTE: This makes asusmptions about the size of LLVector[234]
+                int nverts = mSharedData->mNumVertices;
+                int nfloats = nverts * (3*5 + 2 + 4);
+                mVertexData = new F32[nfloats];
+                int offset = 0;
+                mCoords =                               (LLVector3*)(mVertexData + offset); offset += 3*nverts;
+                mNormals =                              (LLVector3*)(mVertexData + offset); offset += 3*nverts;
+                mScaledNormals =                (LLVector3*)(mVertexData + offset); offset += 3*nverts;
+                mBinormals =                    (LLVector3*)(mVertexData + offset); offset += 3*nverts;
+                mScaledBinormals =              (LLVector3*)(mVertexData + offset); offset += 3*nverts;
+                mTexCoords =                    (LLVector2*)(mVertexData + offset); offset += 2*nverts;
+                mClothingWeights =      (LLVector4*)(mVertexData + offset); offset += 4*nverts;
 #else
-		mCoords = new LLVector3[mSharedData->mNumVertices];
-		mNormals = new LLVector3[mSharedData->mNumVertices];
-		mScaledNormals = new LLVector3[mSharedData->mNumVertices];
-		mBinormals = new LLVector3[mSharedData->mNumVertices];
-		mScaledBinormals = new LLVector3[mSharedData->mNumVertices];
-		mTexCoords = new LLVector2[mSharedData->mNumVertices];
-		mClothingWeights = new LLVector4[mSharedData->mNumVertices];
-		memset(mClothingWeights, 0, sizeof(LLVector4) * mSharedData->mNumVertices);
+                mCoords = new LLVector3[mSharedData->mNumVertices];
+                mNormals = new LLVector3[mSharedData->mNumVertices];
+                mScaledNormals = new LLVector3[mSharedData->mNumVertices];
+                mBinormals = new LLVector3[mSharedData->mNumVertices];
+                mScaledBinormals = new LLVector3[mSharedData->mNumVertices];
+                mTexCoords = new LLVector2[mSharedData->mNumVertices];
+                mClothingWeights = new LLVector4[mSharedData->mNumVertices];
+                memset(mClothingWeights, 0, sizeof(LLVector4) * mSharedData->mNumVertices);
 #endif
-		initializeForMorph();
-	}
+                initializeForMorph();
+        }
 }
 
 
 //-----------------------------------------------------------------------------
 LLPolyMesh::~LLPolyMesh()
 {
-	S32 i;
-	for (i = 0; i < mJointRenderData.count(); i++)
-	{
-		delete mJointRenderData[i];
-		mJointRenderData[i] = NULL;
-	}
+        S32 i;
+        for (i = 0; i < mJointRenderData.count(); i++)
+        {
+                delete mJointRenderData[i];
+                mJointRenderData[i] = NULL;
+        }
 #if 0 // These are now allocated as one big uninitialized chunk
-	delete [] mCoords;
-	delete [] mNormals;
-	delete [] mScaledNormals;
-	delete [] mBinormals;
-	delete [] mScaledBinormals;
-	delete [] mClothingWeights;
-	delete [] mTexCoords;
+        delete [] mCoords;
+        delete [] mNormals;
+        delete [] mScaledNormals;
+        delete [] mBinormals;
+        delete [] mScaledBinormals;
+        delete [] mClothingWeights;
+        delete [] mTexCoords;
 #else
-	delete [] mVertexData;
+        delete [] mVertexData;
 #endif
 }
 
 //-----------------------------------------------------------------------------
 LLPolyMesh *LLPolyMesh::getMesh(const std::string &name, LLPolyMesh* reference_mesh)
 {
-	//-------------------------------------------------------------------------
-	// search for an existing mesh by this name
-	//-------------------------------------------------------------------------
-	LLPolyMeshSharedData* meshSharedData = get_if_there(sGlobalSharedMeshList, name, (LLPolyMeshSharedData*)NULL);
-	if (meshSharedData)
-	{
-//		llinfos << "Polymesh " << name << " found in global mesh table." << llendl;
-		LLPolyMesh *poly_mesh = new LLPolyMesh(meshSharedData, reference_mesh);
-		return poly_mesh;
-	}
+        //-------------------------------------------------------------------------
+        // search for an existing mesh by this name
+        //-------------------------------------------------------------------------
+        LLPolyMeshSharedData* meshSharedData = get_if_there(sGlobalSharedMeshList, name, (LLPolyMeshSharedData*)NULL);
+        if (meshSharedData)
+        {
+//              llinfos << "Polymesh " << name << " found in global mesh table." << llendl;
+                LLPolyMesh *poly_mesh = new LLPolyMesh(meshSharedData, reference_mesh);
+                return poly_mesh;
+        }
 
-	//-------------------------------------------------------------------------
-	// if not found, create a new one, add it to the list
-	//-------------------------------------------------------------------------
-	std::string full_path;
-	full_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,name);
+        //-------------------------------------------------------------------------
+        // if not found, create a new one, add it to the list
+        //-------------------------------------------------------------------------
+        std::string full_path;
+        full_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,name);
 
-	LLPolyMeshSharedData *mesh_data = new LLPolyMeshSharedData();
-	if (reference_mesh)
-	{
-		mesh_data->setupLOD(reference_mesh->getSharedData());
-	}
-	if ( ! mesh_data->loadMesh( full_path ) )
-	{
-		delete mesh_data;
-		return NULL;
-	}
+        LLPolyMeshSharedData *mesh_data = new LLPolyMeshSharedData();
+        if (reference_mesh)
+        {
+                mesh_data->setupLOD(reference_mesh->getSharedData());
+        }
+        if ( ! mesh_data->loadMesh( full_path ) )
+        {
+                delete mesh_data;
+                return NULL;
+        }
 
-	LLPolyMesh *poly_mesh = new LLPolyMesh(mesh_data, reference_mesh);
+        LLPolyMesh *poly_mesh = new LLPolyMesh(mesh_data, reference_mesh);
 
-//	llinfos << "Polymesh " << name << " added to global mesh table." << llendl;
-	sGlobalSharedMeshList[name] = poly_mesh->mSharedData;
+//      llinfos << "Polymesh " << name << " added to global mesh table." << llendl;
+        sGlobalSharedMeshList[name] = poly_mesh->mSharedData;
 
-	return poly_mesh;
+        return poly_mesh;
 }
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void LLPolyMesh::freeAllMeshes()
 {
-	// delete each item in the global lists
-	for_each(sGlobalSharedMeshList.begin(), sGlobalSharedMeshList.end(), DeletePairedPointer());
-	sGlobalSharedMeshList.clear();
+        // delete each item in the global lists
+        for_each(sGlobalSharedMeshList.begin(), sGlobalSharedMeshList.end(), DeletePairedPointer());
+        sGlobalSharedMeshList.clear();
 }
 
 LLPolyMeshSharedData *LLPolyMesh::getSharedData() const
 {
-	return mSharedData;
+        return mSharedData;
 }