diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml
index 4585ba658c04677e6b1e8b6b5ec331efad517f7c..85899603ee7d4e94feca1f272ed9a01ad4bfc0bf 100644
--- a/indra/newview/character/avatar_lad.xml
+++ b/indra/newview/character/avatar_lad.xml
@@ -4042,6 +4042,25 @@
       </param_morph>
     </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"
@@ -4092,6 +4111,25 @@
       </param_morph>
     </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"
@@ -4297,11 +4335,11 @@
      id="1200"
      group="1"
      sex="female"
-     name="Breast_Gravity"
+     name="Breast_Physics_UpDown_Driven"
      wearable="shape"
      edit_group="driven"
      value_default="0"
-     value_min="-1.5"
+     value_min="-2"
      value_max="2">
       <param_morph />
     </param>
@@ -4310,12 +4348,12 @@
      id="1201"
      group="1"
      sex="female"
-     name="Breast_Female_Cleavage"
+     name="Breast_Physics_InOut_Driven"
      wearable="shape"
      edit_group="driven"
      value_default="0"
-     value_min="-.3"
-     value_max="1.3">
+     value_min="-1"
+     value_max="1">
       <param_morph />
     </param>
 
@@ -4324,6 +4362,7 @@
      group="1"
      name="Belly_Physics_Torso_UpDown_Driven"
      wearable="physics"
+     cross_wearable="true"
      edit_group="driven"
      value_default="0"
      value_min="-1"
@@ -4331,6 +4370,19 @@
       <param_morph />
     </param>
 
+    <param
+     id="1207"
+     group="1"
+     name="Breast_Physics_LeftRight_Driven"
+     wearable="physics"
+     cross_wearable="true"
+     edit_group="driven"
+     value_default="0"
+     value_min="-2"
+     value_max="2">
+      <param_morph />
+    </param>
+
     <!--
          #end morph targets
           -->
@@ -4844,20 +4896,24 @@
      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>
 
@@ -4866,14 +4922,14 @@
      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>
 
-
     <!--
             #end morph targets
             -->
@@ -5246,6 +5302,25 @@
      value_max="1"> 
       <param_morph />
     </param>
+
+    <!--
+            #############
+            # physics morphs (not user controlled)
+            #############
+            -->
+    <param
+     id="1203"
+     group="1"
+     name="Belly_Physics_Skirt_UpDown_Driven"
+     wearable="physics"
+     cross_wearable="true"
+     edit_group="driven"
+     value_default="0"
+     value_min="-1"
+     value_max="1">
+      <param_morph />
+    </param>
+
   </mesh>
 
   <mesh
@@ -11682,19 +11757,15 @@ render_pass="bump">
   <!-- ==PHYSICS PARAMETERS======================================= -->
 
    <param
-     id="507"
-     group="0"
+     id="1100"
+     group="1"
      sex="female"
+     wearable="physics"
      name="Breast_Physics_UpDown_Controller"
      label="Breast Physics UpDown Controller"
-     wearable="shape"
-     edit_group="shape_torso"
-     edit_group_order="7"
-     value_default="0"
-     value_min="-1.5"
-     value_max="2"
-     camera_elevation=".3"
-     camera_distance=".8">
+     value_min="-1"
+     value_max="1"
+     value_default="0">
       <param_driver>
         <driven
          id="1200" />
@@ -11702,17 +11773,15 @@ render_pass="bump">
     </param>
 
    <param
-     id="684"
-     group="0"
+     id="1101"
+     group="1"
      sex="female"
+     wearable="physics"
      name="Breast_Physics_InOut_Controller"
      label="Breast Physics InOut Controller"
-     wearable="shape"
-     edit_group="shape_torso"
-     edit_group_order="8"
-     value_default="0"
-     value_min="-.3"
-     value_max="1.3">
+     value_min="-1"
+     value_max="1"
+     value_default="0">
       <param_driver>
         <driven
          id="1201" />
@@ -11720,7 +11789,7 @@ render_pass="bump">
     </param>
 
     <param
-     id="1120"
+     id="1102"
      group="1"
      wearable="physics"
      name="Belly_Physics_UpDown_Controller"
@@ -11739,7 +11808,7 @@ render_pass="bump">
     </param>
 
     <param
-     id="1100"
+     id="1103"
      group="1"
      wearable="shape"
      name="Butt_Physics_UpDown_Controller"
@@ -11754,7 +11823,7 @@ render_pass="bump">
     </param>
 
     <param
-     id="1101"
+     id="1104"
      group="1"
      wearable="shape"
      name="Butt_Physics_LeftRight_Controller"
@@ -11769,7 +11838,22 @@ render_pass="bump">
     </param>
 
     <param
-     id="1110"
+     id="1105"
+     group="1"
+     wearable="shape"
+     name="Breast_Physics_LeftRight_Controller"
+     label="Breast Physics LeftRight Controller"
+     value_min="-1"
+     value_max="1"
+     value_default="0">
+      <param_driver>
+        <driven
+         id="1207" />
+      </param_driver>
+    </param>
+
+    <param
+     id="10000"
      group="0"
      sex="female"
      name="Breast_Physics_Mass"
@@ -11782,47 +11866,48 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1111"
+     id="10001"
      group="0"
      sex="female"
-     name="Breast_Physics_Smoothing"
-     label="Breast Physics Smoothing"
+     name="Breast_Physics_Gravity"
+     label="Breast Physics Gravity"
      wearable="physics"
      edit_group="physics_advanced"
-     value_default="2"
-     value_min="1"
-     value_max="10">
+     value_default="0"
+     value_min="0"
+     value_max=".1">
 	 <param_driver />
     </param>
-    <param
-     id="1112"
+
+   <param
+     id="10002"
      group="0"
      sex="female"
-     name="Breast_Physics_Gravity"
-     label="Breast Physics Gravity"
+     name="Breast_Physics_Drag"
+     label="Breast Physics Drag"
      wearable="physics"
      edit_group="physics_advanced"
-     value_default="0"
+     value_default=".15"
      value_min="0"
-     value_max=".1">
+     value_max=".5">
 	 <param_driver />
     </param>
 
    <param
-     id="1113"
+     id="10003"
      group="0"
      sex="female"
-     name="Breast_Physics_UpDown_Max_Velocity"
-     label="Breast Physics UpDown Max Speed"
+     name="Breast_Physics_UpDown_Max_Effect"
+     label="Breast Physics UpDown Max Effect"
      wearable="physics"
      edit_group="physics_breasts_updown"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="1114"
+     id="10004"
      group="0"
      sex="female"
      name="Breast_Physics_UpDown_Spring"
@@ -11835,7 +11920,7 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1115"
+     id="10005"
      group="0"
      sex="female"
      name="Breast_Physics_UpDown_Gain"
@@ -11848,7 +11933,7 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1116"
+     id="10006"
      group="0"
      sex="female"
      name="Breast_Physics_UpDown_Damping"
@@ -11862,35 +11947,22 @@ render_pass="bump">
      camera_distance=".8">
 	 <param_driver />
     </param>
-   <param
-     id="1117"
-     group="0"
-     sex="female"
-     name="Breast_Physics_UpDown_Drag"
-     label="Breast Physics UpDown Drag"
-     wearable="physics"
-     edit_group="physics_advanced"
-     value_default=".15"
-     value_min="0"
-     value_max=".5">
-	 <param_driver />
-    </param>
 
    <param
-     id="1118"
+     id="10007"
      group="0"
      sex="female"
-     name="Breast_Physics_InOut_Max_Velocity"
-     label="Breast Physics InOut Max Speed"
+     name="Breast_Physics_InOut_Max_Effect"
+     label="Breast Physics InOut Max Effect"
      wearable="physics"
      edit_group="physics_breasts_inout"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="1119"
+     id="10008"
      group="0"
      sex="female"
      name="Breast_Physics_InOut_Spring"
@@ -11903,7 +11975,7 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1120"
+     id="10009"
      group="0"
      sex="female"
      name="Breast_Physics_InOut_Gain"
@@ -11916,7 +11988,7 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1121"
+     id="10010"
      group="0"
      sex="female"
      name="Breast_Physics_InOut_Damping"
@@ -11928,22 +12000,9 @@ render_pass="bump">
      value_max=".1">
 	 <param_driver />
     </param>
-   <param
-     id="1122"
-     group="0"
-     sex="female"
-     name="Breast_Physics_InOut_Drag"
-     label="Breast Physics InOut Drag"
-     wearable="physics"
-     edit_group="physics_advanced"
-     value_default=".15"
-     value_min="0"
-     value_max=".5">
-	 <param_driver />
-    </param>
 
     <param
-     id="1130"
+     id="10011"
      group="0"
      name="Belly_Physics_Mass"
      label="Belly Physics Mass"
@@ -11955,43 +12014,43 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1131"
+     id="10012"
      group="0"
-     name="Belly_Physics_Smoothing"
-     label="Belly Physics Smoothing"
+     name="Belly_Physics_Gravity"
+     label="Belly Physics Gravity"
      wearable="physics"
      edit_group="physics_advanced"
-     value_default="2"
-     value_min="1"
-     value_max="10">
+     value_default="0"
+     value_min="0"
+     value_max=".1">
 	 <param_driver />
     </param>
-    <param
-     id="1132"
+   <param
+     id="10013"
      group="0"
-     name="Belly_Physics_Gravity"
-     label="Belly Physics Gravity"
+     name="Belly_Physics_Drag"
+     label="Belly Physics Drag"
      wearable="physics"
      edit_group="physics_advanced"
-     value_default="0"
+     value_default=".15"
      value_min="0"
-     value_max=".1">
+     value_max=".5">
 	 <param_driver />
     </param>
    <param
-     id="1133"
+     id="10014"
      group="0"
-     name="Belly_Physics_UpDown_Max_Velocity"
-     label="Belly Physics UpDown Max Speed"
+     name="Belly_Physics_UpDown_Max_Effect"
+     label="Belly Physics UpDown Max Effect"
      wearable="physics"
      edit_group="physics_belly_updown"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="1134"
+     id="10015"
      group="0"
      name="Belly_Physics_UpDown_Spring"
      label="Belly Physics UpDown Spring"
@@ -12003,7 +12062,7 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1135"
+     id="10016"
      group="0"
      name="Belly_Physics_UpDown_Gain"
      label="Belly Physics UpDown Gain"
@@ -12015,7 +12074,7 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1136"
+     id="10017"
      group="0"
      name="Belly_Physics_UpDown_Damping"
      label="Belly Physics UpDown Damping"
@@ -12026,21 +12085,9 @@ render_pass="bump">
      value_max=".1">
 	 <param_driver />
     </param>
-   <param
-     id="1137"
-     group="0"
-     name="Belly_Physics_UpDown_Drag"
-     label="Belly Physics UpDown Drag"
-     wearable="physics"
-     edit_group="physics_advanced"
-     value_default=".15"
-     value_min="0"
-     value_max=".5">
-	 <param_driver />
-    </param>
 
     <param
-     id="1140"
+     id="10018"
      group="0"
      name="Butt_Physics_Mass"
      label="Butt Physics Mass"
@@ -12052,43 +12099,44 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1141"
+     id="10019"
      group="0"
-     name="Butt_Physics_Smoothing"
-     label="Butt Physics Smoothing"
+     name="Butt_Physics_Gravity"
+     label="Butt Physics Gravity"
      wearable="physics"
      edit_group="physics_advanced"
-     value_default="2"
-     value_min="1"
-     value_max="10">
+     value_default="0"
+     value_min="0"
+     value_max=".1">
 	 <param_driver />
     </param>
-    <param
-     id="1142"
+   <param
+     id="10020"
      group="0"
-     name="Butt_Physics_Gravity"
-     label="Butt Physics Gravity"
+     name="Butt_Physics_Drag"
+     label="Butt Physics Drag"
      wearable="physics"
      edit_group="physics_advanced"
-     value_default="0"
+     value_default=".15"
      value_min="0"
-     value_max=".1">
+     value_max=".5">
 	 <param_driver />
     </param>
+
    <param
-     id="1143"
+     id="10021"
      group="0"
-     name="Butt_Physics_UpDown_Max_Velocity"
-     label="Butt Physics UpDown Max Speed"
+     name="Butt_Physics_UpDown_Max_Effect"
+     label="Butt Physics UpDown Max Effect"
      wearable="physics"
      edit_group="physics_butt_updown"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="1144"
+     id="10022"
      group="0"
      name="Butt_Physics_UpDown_Spring"
      label="Butt Physics UpDown Spring"
@@ -12100,7 +12148,7 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1145"
+     id="10023"
      group="0"
      name="Butt_Physics_UpDown_Gain"
      label="Butt Physics UpDown Gain"
@@ -12112,7 +12160,7 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1146"
+     id="10024"
      group="0"
      name="Butt_Physics_UpDown_Damping"
      label="Butt Physics UpDown Damping"
@@ -12123,33 +12171,21 @@ render_pass="bump">
      value_max=".1">
 	 <param_driver />
     </param>
-   <param
-     id="1147"
-     group="0"
-     name="Butt_Physics_UpDown_Drag"
-     label="Butt Physics UpDown Drag"
-     wearable="physics"
-     edit_group="physics_advanced"
-     value_default=".15"
-     value_min="0"
-     value_max=".5">
-	 <param_driver />
-    </param>
 
    <param
-     id="1148"
+     id="10025"
      group="0"
-     name="Butt_Physics_LeftRight_Max_Velocity"
-     label="Butt Physics LeftRight Max Speed"
+     name="Butt_Physics_LeftRight_Max_Effect"
+     label="Butt Physics LeftRight Max Effect"
      wearable="physics"
      edit_group="physics_butt_leftright"
      value_default="0"
      value_min="0"
-     value_max="10">
+     value_max="1">
 	 <param_driver />
     </param>
     <param
-     id="1149"
+     id="10026"
      group="0"
      name="Butt_Physics_LeftRight_Spring"
      label="Butt Physics LeftRight Spring"
@@ -12161,7 +12197,7 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1150"
+     id="10027"
      group="0"
      name="Butt_Physics_LeftRight_Gain"
      label="Butt Physics LeftRight Gain"
@@ -12173,7 +12209,7 @@ render_pass="bump">
 	 <param_driver />
     </param>
     <param
-     id="1151"
+     id="10028"
      group="0"
      name="Butt_Physics_LeftRight_Damping"
      label="Butt Physics LeftRight Damping"
@@ -12184,19 +12220,59 @@ render_pass="bump">
      value_max=".1">
 	 <param_driver />
     </param>
+
    <param
-     id="1152"
+     id="10029"
      group="0"
-     name="Butt_Physics_LeftRight_Drag"
-     label="Butt Physics LeftRight Drag"
+     sex="female"
+     name="Breast_Physics_LeftRight_Max_Effect"
+     label="Breast Physics LeftRight Max Effect"
      wearable="physics"
-     edit_group="physics_advanced"
-     value_default=".15"
+     edit_group="physics_breasts_leftright"
+     value_default="0"
      value_min="0"
-     value_max=".5">
+     value_max="1">
+	 <param_driver />
+    </param>
+    <param
+     id="10030"
+     group="0"
+     sex="female"
+     name="Breast_Physics_LeftRight_Spring"
+     label="Breast Physics LeftRight Spring"
+     wearable="physics"
+     edit_group="physics_breasts_leftright"
+     value_default=".1"
+     value_min="0"
+     value_max="1">
+	 <param_driver />
+    </param>
+    <param
+     id="10031"
+     group="0"
+     sex="female"
+     name="Breast_Physics_LeftRight_Gain"
+     label="Breast Physics LeftRight Gain"
+     wearable="physics"
+     edit_group="physics_breasts_leftright"
+     value_default="10"
+     value_min="1"
+     value_max="100">
+	 <param_driver />
+    </param>
+    <param
+     id="10032"
+     group="0"
+     sex="female"
+     name="Breast_Physics_LeftRight_Damping"
+     label="Breast Physics LeftRight Damping"
+     wearable="physics"
+     edit_group="physics_breasts_leftright"
+     value_default=".05"
+     value_min="0"
+     value_max=".1">
 	 <param_driver />
     </param>
-
 
   </driver_parameters>
 
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 4db9a154ea63a60827927ce5a7fcb5d7cdaaf120..8bd2d5ad6abc1375021827b71ad59022e71c1e05 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -51,7 +51,7 @@
 #include "llcolorswatch.h"
 #include "lltexturectrl.h"
 #include "lltextureentry.h"
-#include "llviewercontrol.h"	// gSavedSettings
+#include "llviewercontrol.h"    // gSavedSettings
 #include "llviewertexturelist.h"
 #include "llagentcamera.h"
 #include "llmorphview.h"
@@ -65,42 +65,43 @@ static LLRegisterPanelClassWrapper<LLPanelEditWearable> t_edit_wearable("panel_e
 
 // subparts of the UI for focus, camera position, etc.
 enum ESubpart {
-	SUBPART_SHAPE_HEAD = 1, // avoid 0
-	SUBPART_SHAPE_EYES,
-	SUBPART_SHAPE_EARS,
-	SUBPART_SHAPE_NOSE,
-	SUBPART_SHAPE_MOUTH,
-	SUBPART_SHAPE_CHIN,
-	SUBPART_SHAPE_TORSO,
-	SUBPART_SHAPE_LEGS,
-	SUBPART_SHAPE_WHOLE,
-	SUBPART_SHAPE_DETAIL,
-	SUBPART_SKIN_COLOR,
-	SUBPART_SKIN_FACEDETAIL,
-	SUBPART_SKIN_MAKEUP,
-	SUBPART_SKIN_BODYDETAIL,
-	SUBPART_HAIR_COLOR,
-	SUBPART_HAIR_STYLE,
-	SUBPART_HAIR_EYEBROWS,
-	SUBPART_HAIR_FACIAL,
-	SUBPART_EYES,
-	SUBPART_SHIRT,
-	SUBPART_PANTS,
-	SUBPART_SHOES,
-	SUBPART_SOCKS,
-	SUBPART_JACKET,
-	SUBPART_GLOVES,
-	SUBPART_UNDERSHIRT,
-	SUBPART_UNDERPANTS,
-	SUBPART_SKIRT,
-	SUBPART_ALPHA,
-	SUBPART_TATTOO,
-	SUBPART_PHYSICS_BREASTS_UPDOWN,
-	SUBPART_PHYSICS_BREASTS_INOUT,
-	SUBPART_PHYSICS_BELLY_UPDOWN,
-	SUBPART_PHYSICS_BUTT_UPDOWN,
-	SUBPART_PHYSICS_BUTT_LEFTRIGHT,
-	SUBPART_PHYSICS_ADVANCED,
+        SUBPART_SHAPE_HEAD = 1, // avoid 0
+        SUBPART_SHAPE_EYES,
+        SUBPART_SHAPE_EARS,
+        SUBPART_SHAPE_NOSE,
+        SUBPART_SHAPE_MOUTH,
+        SUBPART_SHAPE_CHIN,
+        SUBPART_SHAPE_TORSO,
+        SUBPART_SHAPE_LEGS,
+        SUBPART_SHAPE_WHOLE,
+        SUBPART_SHAPE_DETAIL,
+        SUBPART_SKIN_COLOR,
+        SUBPART_SKIN_FACEDETAIL,
+        SUBPART_SKIN_MAKEUP,
+        SUBPART_SKIN_BODYDETAIL,
+        SUBPART_HAIR_COLOR,
+        SUBPART_HAIR_STYLE,
+        SUBPART_HAIR_EYEBROWS,
+        SUBPART_HAIR_FACIAL,
+        SUBPART_EYES,
+        SUBPART_SHIRT,
+        SUBPART_PANTS,
+        SUBPART_SHOES,
+        SUBPART_SOCKS,
+        SUBPART_JACKET,
+        SUBPART_GLOVES,
+        SUBPART_UNDERSHIRT,
+        SUBPART_UNDERPANTS,
+        SUBPART_SKIRT,
+        SUBPART_ALPHA,
+        SUBPART_TATTOO,
+        SUBPART_PHYSICS_BREASTS_UPDOWN,
+        SUBPART_PHYSICS_BREASTS_INOUT,
+        SUBPART_PHYSICS_BREASTS_LEFTRIGHT,
+        SUBPART_PHYSICS_BELLY_UPDOWN,
+        SUBPART_PHYSICS_BUTT_UPDOWN,
+        SUBPART_PHYSICS_BUTT_LEFTRIGHT,
+        SUBPART_PHYSICS_ADVANCED,
  };
 
 using namespace LLVOAvatarDefines;
@@ -111,102 +112,102 @@ typedef std::vector<ESubpart> subpart_vec_t;
 
 class LLEditWearableDictionary : public LLSingleton<LLEditWearableDictionary>
 {
-	//--------------------------------------------------------------------
-	// Constructors and Destructors
-	//--------------------------------------------------------------------
+        //--------------------------------------------------------------------
+        // Constructors and Destructors
+        //--------------------------------------------------------------------
 public:
-	LLEditWearableDictionary();
-	virtual ~LLEditWearableDictionary();
-	
-	//--------------------------------------------------------------------
-	// Wearable Types
-	//--------------------------------------------------------------------
+        LLEditWearableDictionary();
+        virtual ~LLEditWearableDictionary();
+        
+        //--------------------------------------------------------------------
+        // Wearable Types
+        //--------------------------------------------------------------------
 public:
-	struct WearableEntry : public LLDictionaryEntry
-	{
-		WearableEntry(LLWearableType::EType type,
-					  const std::string &title,
-					  const std::string &desc_title,
-					  U8 num_color_swatches,  // number of 'color_swatches'
-					  U8 num_texture_pickers, // number of 'texture_pickers'
-					  U8 num_subparts, ... ); // number of subparts followed by a list of ETextureIndex and ESubparts
-
-
-		const LLWearableType::EType mWearableType;
-		const std::string   mTitle;
-		const std::string	mDescTitle;
-		subpart_vec_t		mSubparts;
-		texture_vec_t		mColorSwatchCtrls;
-		texture_vec_t		mTextureCtrls;
-	};
-
-	struct Wearables : public LLDictionary<LLWearableType::EType, WearableEntry>
-	{
-		Wearables();
-	} mWearables;
-
-	const WearableEntry*	getWearable(LLWearableType::EType type) const { return mWearables.lookup(type); }
-
-	//--------------------------------------------------------------------
-	// Subparts
-	//--------------------------------------------------------------------
+        struct WearableEntry : public LLDictionaryEntry
+        {
+                WearableEntry(LLWearableType::EType type,
+                                          const std::string &title,
+                                          const std::string &desc_title,
+                                          U8 num_color_swatches,  // number of 'color_swatches'
+                                          U8 num_texture_pickers, // number of 'texture_pickers'
+                                          U8 num_subparts, ... ); // number of subparts followed by a list of ETextureIndex and ESubparts
+
+
+                const LLWearableType::EType mWearableType;
+                const std::string   mTitle;
+                const std::string       mDescTitle;
+                subpart_vec_t           mSubparts;
+                texture_vec_t           mColorSwatchCtrls;
+                texture_vec_t           mTextureCtrls;
+        };
+
+        struct Wearables : public LLDictionary<LLWearableType::EType, WearableEntry>
+        {
+                Wearables();
+        } mWearables;
+
+        const WearableEntry*    getWearable(LLWearableType::EType type) const { return mWearables.lookup(type); }
+
+        //--------------------------------------------------------------------
+        // Subparts
+        //--------------------------------------------------------------------
 public:
-	struct SubpartEntry : public LLDictionaryEntry
-	{
-		SubpartEntry(ESubpart part,
-					 const std::string &joint,
-					 const std::string &edit_group,
-					 const std::string &param_list,
-					 const std::string &accordion_tab,
-					 const LLVector3d  &target_offset,
-					 const LLVector3d  &camera_offset,
-					 const ESex 	   &sex);
-
-		ESubpart			mSubpart;
-		std::string			mTargetJoint;
-		std::string			mEditGroup;
-		std::string			mParamList;
-		std::string			mAccordionTab;
-		LLVector3d			mTargetOffset;
-		LLVector3d			mCameraOffset;
-		ESex				mSex;
-	};
-
-	struct Subparts : public LLDictionary<ESubpart, SubpartEntry>
-	{
-		Subparts();
-	} mSubparts;
-
-	const SubpartEntry*  getSubpart(ESubpart subpart) const { return mSubparts.lookup(subpart); }
-
-	//--------------------------------------------------------------------
-	// Picker Control Entries
-	//--------------------------------------------------------------------
+        struct SubpartEntry : public LLDictionaryEntry
+        {
+                SubpartEntry(ESubpart part,
+                                         const std::string &joint,
+                                         const std::string &edit_group,
+                                         const std::string &param_list,
+                                         const std::string &accordion_tab,
+                                         const LLVector3d  &target_offset,
+                                         const LLVector3d  &camera_offset,
+                                         const ESex        &sex);
+
+                ESubpart                        mSubpart;
+                std::string                     mTargetJoint;
+                std::string                     mEditGroup;
+                std::string                     mParamList;
+                std::string                     mAccordionTab;
+                LLVector3d                      mTargetOffset;
+                LLVector3d                      mCameraOffset;
+                ESex                            mSex;
+        };
+
+        struct Subparts : public LLDictionary<ESubpart, SubpartEntry>
+        {
+                Subparts();
+        } mSubparts;
+
+        const SubpartEntry*  getSubpart(ESubpart subpart) const { return mSubparts.lookup(subpart); }
+
+        //--------------------------------------------------------------------
+        // Picker Control Entries
+        //--------------------------------------------------------------------
 public:
-	struct PickerControlEntry : public LLDictionaryEntry
-	{
-		PickerControlEntry(ETextureIndex tex_index,
-						   const std::string name,
-						   const LLUUID default_image_id = LLUUID::null,
-						   const bool allow_no_texture = false);
-		ETextureIndex		mTextureIndex;
-		const std::string	mControlName;
-		const LLUUID		mDefaultImageId;
-		const bool			mAllowNoTexture;
-	};
-
-	struct ColorSwatchCtrls : public LLDictionary<ETextureIndex, PickerControlEntry>
-	{
-		ColorSwatchCtrls();
-	} mColorSwatchCtrls;
-
-	struct TextureCtrls : public LLDictionary<ETextureIndex, PickerControlEntry>
-	{
-		TextureCtrls();
-	} mTextureCtrls;
-
-	const PickerControlEntry* getTexturePicker(ETextureIndex index) const { return mTextureCtrls.lookup(index); }
-	const PickerControlEntry* getColorSwatch(ETextureIndex index) const { return mColorSwatchCtrls.lookup(index); }
+        struct PickerControlEntry : public LLDictionaryEntry
+        {
+                PickerControlEntry(ETextureIndex tex_index,
+                                                   const std::string name,
+                                                   const LLUUID default_image_id = LLUUID::null,
+                                                   const bool allow_no_texture = false);
+                ETextureIndex           mTextureIndex;
+                const std::string       mControlName;
+                const LLUUID            mDefaultImageId;
+                const bool                      mAllowNoTexture;
+        };
+
+        struct ColorSwatchCtrls : public LLDictionary<ETextureIndex, PickerControlEntry>
+        {
+                ColorSwatchCtrls();
+        } mColorSwatchCtrls;
+
+        struct TextureCtrls : public LLDictionary<ETextureIndex, PickerControlEntry>
+        {
+                TextureCtrls();
+        } mTextureCtrls;
+
+        const PickerControlEntry* getTexturePicker(ETextureIndex index) const { return mTextureCtrls.lookup(index); }
+        const PickerControlEntry* getColorSwatch(ETextureIndex index) const { return mColorSwatchCtrls.lookup(index); }
 };
 
 LLEditWearableDictionary::LLEditWearableDictionary()
@@ -221,173 +222,174 @@ LLEditWearableDictionary::~LLEditWearableDictionary()
 
 LLEditWearableDictionary::Wearables::Wearables()
 {
-	// note the subpart that is listed first is treated as "default", regardless of what order is in enum.
-	// Please match the order presented in XUI. -Nyx
-	// this will affect what camera angle is shown when first editing a wearable
-	addEntry(LLWearableType::WT_SHAPE, 		new WearableEntry(LLWearableType::WT_SHAPE,"edit_shape_title","shape_desc_text",0,0,9,	SUBPART_SHAPE_WHOLE, SUBPART_SHAPE_HEAD,	SUBPART_SHAPE_EYES,	SUBPART_SHAPE_EARS,	SUBPART_SHAPE_NOSE,	SUBPART_SHAPE_MOUTH, SUBPART_SHAPE_CHIN, SUBPART_SHAPE_TORSO, SUBPART_SHAPE_LEGS));
-	addEntry(LLWearableType::WT_SKIN, 		new WearableEntry(LLWearableType::WT_SKIN,"edit_skin_title","skin_desc_text",0,3,4, TEX_HEAD_BODYPAINT, TEX_UPPER_BODYPAINT, TEX_LOWER_BODYPAINT, SUBPART_SKIN_COLOR, SUBPART_SKIN_FACEDETAIL, SUBPART_SKIN_MAKEUP, SUBPART_SKIN_BODYDETAIL));
-	addEntry(LLWearableType::WT_HAIR, 		new WearableEntry(LLWearableType::WT_HAIR,"edit_hair_title","hair_desc_text",0,1,4, TEX_HAIR, SUBPART_HAIR_COLOR,	SUBPART_HAIR_STYLE,	SUBPART_HAIR_EYEBROWS, SUBPART_HAIR_FACIAL));
-	addEntry(LLWearableType::WT_EYES, 		new WearableEntry(LLWearableType::WT_EYES,"edit_eyes_title","eyes_desc_text",0,1,1, TEX_EYES_IRIS, SUBPART_EYES));
-	addEntry(LLWearableType::WT_SHIRT, 		new WearableEntry(LLWearableType::WT_SHIRT,"edit_shirt_title","shirt_desc_text",1,1,1, TEX_UPPER_SHIRT, TEX_UPPER_SHIRT, SUBPART_SHIRT));
-	addEntry(LLWearableType::WT_PANTS, 		new WearableEntry(LLWearableType::WT_PANTS,"edit_pants_title","pants_desc_text",1,1,1, TEX_LOWER_PANTS, TEX_LOWER_PANTS, SUBPART_PANTS));
-	addEntry(LLWearableType::WT_SHOES, 		new WearableEntry(LLWearableType::WT_SHOES,"edit_shoes_title","shoes_desc_text",1,1,1, TEX_LOWER_SHOES, TEX_LOWER_SHOES, SUBPART_SHOES));
-	addEntry(LLWearableType::WT_SOCKS, 		new WearableEntry(LLWearableType::WT_SOCKS,"edit_socks_title","socks_desc_text",1,1,1, TEX_LOWER_SOCKS, TEX_LOWER_SOCKS, SUBPART_SOCKS));
-	addEntry(LLWearableType::WT_JACKET, 	new WearableEntry(LLWearableType::WT_JACKET,"edit_jacket_title","jacket_desc_text",1,2,1, TEX_UPPER_JACKET, TEX_UPPER_JACKET, TEX_LOWER_JACKET, SUBPART_JACKET));
-	addEntry(LLWearableType::WT_GLOVES, 	new WearableEntry(LLWearableType::WT_GLOVES,"edit_gloves_title","gloves_desc_text",1,1,1, TEX_UPPER_GLOVES, TEX_UPPER_GLOVES, SUBPART_GLOVES));
-	addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry(LLWearableType::WT_UNDERSHIRT,"edit_undershirt_title","undershirt_desc_text",1,1,1, TEX_UPPER_UNDERSHIRT, TEX_UPPER_UNDERSHIRT, SUBPART_UNDERSHIRT));
-	addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry(LLWearableType::WT_UNDERPANTS,"edit_underpants_title","underpants_desc_text",1,1,1, TEX_LOWER_UNDERPANTS, TEX_LOWER_UNDERPANTS, SUBPART_UNDERPANTS));
-	addEntry(LLWearableType::WT_SKIRT, 		new WearableEntry(LLWearableType::WT_SKIRT,"edit_skirt_title","skirt_desc_text",1,1,1, TEX_SKIRT, TEX_SKIRT, SUBPART_SKIRT));
-	addEntry(LLWearableType::WT_ALPHA, 		new WearableEntry(LLWearableType::WT_ALPHA,"edit_alpha_title","alpha_desc_text",0,5,1, TEX_LOWER_ALPHA, TEX_UPPER_ALPHA, TEX_HEAD_ALPHA, TEX_EYES_ALPHA, TEX_HAIR_ALPHA, SUBPART_ALPHA));
-	addEntry(LLWearableType::WT_TATTOO, 	new WearableEntry(LLWearableType::WT_TATTOO,"edit_tattoo_title","tattoo_desc_text",1,3,1, TEX_HEAD_TATTOO, TEX_LOWER_TATTOO, TEX_UPPER_TATTOO, TEX_HEAD_TATTOO, SUBPART_TATTOO));
-	addEntry(LLWearableType::WT_PHYSICS, 	new WearableEntry(LLWearableType::WT_PHYSICS,"edit_physics_title","physics_desc_text",0,0,6, SUBPART_PHYSICS_BREASTS_UPDOWN, SUBPART_PHYSICS_BREASTS_INOUT, SUBPART_PHYSICS_BELLY_UPDOWN, SUBPART_PHYSICS_BUTT_UPDOWN, SUBPART_PHYSICS_BUTT_LEFTRIGHT, SUBPART_PHYSICS_ADVANCED));
+        // note the subpart that is listed first is treated as "default", regardless of what order is in enum.
+        // Please match the order presented in XUI. -Nyx
+        // this will affect what camera angle is shown when first editing a wearable
+        addEntry(LLWearableType::WT_SHAPE,              new WearableEntry(LLWearableType::WT_SHAPE,"edit_shape_title","shape_desc_text",0,0,9,  SUBPART_SHAPE_WHOLE, SUBPART_SHAPE_HEAD,        SUBPART_SHAPE_EYES,     SUBPART_SHAPE_EARS,     SUBPART_SHAPE_NOSE,     SUBPART_SHAPE_MOUTH, SUBPART_SHAPE_CHIN, SUBPART_SHAPE_TORSO, SUBPART_SHAPE_LEGS));
+        addEntry(LLWearableType::WT_SKIN,               new WearableEntry(LLWearableType::WT_SKIN,"edit_skin_title","skin_desc_text",0,3,4, TEX_HEAD_BODYPAINT, TEX_UPPER_BODYPAINT, TEX_LOWER_BODYPAINT, SUBPART_SKIN_COLOR, SUBPART_SKIN_FACEDETAIL, SUBPART_SKIN_MAKEUP, SUBPART_SKIN_BODYDETAIL));
+        addEntry(LLWearableType::WT_HAIR,               new WearableEntry(LLWearableType::WT_HAIR,"edit_hair_title","hair_desc_text",0,1,4, TEX_HAIR, SUBPART_HAIR_COLOR,       SUBPART_HAIR_STYLE,     SUBPART_HAIR_EYEBROWS, SUBPART_HAIR_FACIAL));
+        addEntry(LLWearableType::WT_EYES,               new WearableEntry(LLWearableType::WT_EYES,"edit_eyes_title","eyes_desc_text",0,1,1, TEX_EYES_IRIS, SUBPART_EYES));
+        addEntry(LLWearableType::WT_SHIRT,              new WearableEntry(LLWearableType::WT_SHIRT,"edit_shirt_title","shirt_desc_text",1,1,1, TEX_UPPER_SHIRT, TEX_UPPER_SHIRT, SUBPART_SHIRT));
+        addEntry(LLWearableType::WT_PANTS,              new WearableEntry(LLWearableType::WT_PANTS,"edit_pants_title","pants_desc_text",1,1,1, TEX_LOWER_PANTS, TEX_LOWER_PANTS, SUBPART_PANTS));
+        addEntry(LLWearableType::WT_SHOES,              new WearableEntry(LLWearableType::WT_SHOES,"edit_shoes_title","shoes_desc_text",1,1,1, TEX_LOWER_SHOES, TEX_LOWER_SHOES, SUBPART_SHOES));
+        addEntry(LLWearableType::WT_SOCKS,              new WearableEntry(LLWearableType::WT_SOCKS,"edit_socks_title","socks_desc_text",1,1,1, TEX_LOWER_SOCKS, TEX_LOWER_SOCKS, SUBPART_SOCKS));
+        addEntry(LLWearableType::WT_JACKET,     new WearableEntry(LLWearableType::WT_JACKET,"edit_jacket_title","jacket_desc_text",1,2,1, TEX_UPPER_JACKET, TEX_UPPER_JACKET, TEX_LOWER_JACKET, SUBPART_JACKET));
+        addEntry(LLWearableType::WT_GLOVES,     new WearableEntry(LLWearableType::WT_GLOVES,"edit_gloves_title","gloves_desc_text",1,1,1, TEX_UPPER_GLOVES, TEX_UPPER_GLOVES, SUBPART_GLOVES));
+        addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry(LLWearableType::WT_UNDERSHIRT,"edit_undershirt_title","undershirt_desc_text",1,1,1, TEX_UPPER_UNDERSHIRT, TEX_UPPER_UNDERSHIRT, SUBPART_UNDERSHIRT));
+        addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry(LLWearableType::WT_UNDERPANTS,"edit_underpants_title","underpants_desc_text",1,1,1, TEX_LOWER_UNDERPANTS, TEX_LOWER_UNDERPANTS, SUBPART_UNDERPANTS));
+        addEntry(LLWearableType::WT_SKIRT,              new WearableEntry(LLWearableType::WT_SKIRT,"edit_skirt_title","skirt_desc_text",1,1,1, TEX_SKIRT, TEX_SKIRT, SUBPART_SKIRT));
+        addEntry(LLWearableType::WT_ALPHA,              new WearableEntry(LLWearableType::WT_ALPHA,"edit_alpha_title","alpha_desc_text",0,5,1, TEX_LOWER_ALPHA, TEX_UPPER_ALPHA, TEX_HEAD_ALPHA, TEX_EYES_ALPHA, TEX_HAIR_ALPHA, SUBPART_ALPHA));
+        addEntry(LLWearableType::WT_TATTOO,     new WearableEntry(LLWearableType::WT_TATTOO,"edit_tattoo_title","tattoo_desc_text",1,3,1, TEX_HEAD_TATTOO, TEX_LOWER_TATTOO, TEX_UPPER_TATTOO, TEX_HEAD_TATTOO, SUBPART_TATTOO));
+        addEntry(LLWearableType::WT_PHYSICS,    new WearableEntry(LLWearableType::WT_PHYSICS,"edit_physics_title","physics_desc_text",0,0,7, SUBPART_PHYSICS_BREASTS_UPDOWN, SUBPART_PHYSICS_BREASTS_INOUT, SUBPART_PHYSICS_BREASTS_LEFTRIGHT, SUBPART_PHYSICS_BELLY_UPDOWN, SUBPART_PHYSICS_BUTT_UPDOWN, SUBPART_PHYSICS_BUTT_LEFTRIGHT, SUBPART_PHYSICS_ADVANCED));
 }
 
 LLEditWearableDictionary::WearableEntry::WearableEntry(LLWearableType::EType type,
-					  const std::string &title,
-					  const std::string &desc_title,
-					  U8 num_color_swatches,
-					  U8 num_texture_pickers,
-					  U8 num_subparts, ... ) :
-	LLDictionaryEntry(title),
-	mWearableType(type),
-	mTitle(title),
-	mDescTitle(desc_title)
-{
-	va_list argp;
-	va_start(argp, num_subparts);
-
-	for (U8 i = 0; i < num_color_swatches; ++i)
-	{
-		ETextureIndex index = (ETextureIndex)va_arg(argp,int);
-		mColorSwatchCtrls.push_back(index);
-	}
-
-	for (U8 i = 0; i < num_texture_pickers; ++i)
-	{
-		ETextureIndex index = (ETextureIndex)va_arg(argp,int);
-		mTextureCtrls.push_back(index);
-	}
-
-	for (U8 i = 0; i < num_subparts; ++i)
-	{
-		ESubpart part = (ESubpart)va_arg(argp,int);
-		mSubparts.push_back(part);
-	}
+                                          const std::string &title,
+                                          const std::string &desc_title,
+                                          U8 num_color_swatches,
+                                          U8 num_texture_pickers,
+                                          U8 num_subparts, ... ) :
+        LLDictionaryEntry(title),
+        mWearableType(type),
+        mTitle(title),
+        mDescTitle(desc_title)
+{
+        va_list argp;
+        va_start(argp, num_subparts);
+
+        for (U8 i = 0; i < num_color_swatches; ++i)
+        {
+                ETextureIndex index = (ETextureIndex)va_arg(argp,int);
+                mColorSwatchCtrls.push_back(index);
+        }
+
+        for (U8 i = 0; i < num_texture_pickers; ++i)
+        {
+                ETextureIndex index = (ETextureIndex)va_arg(argp,int);
+                mTextureCtrls.push_back(index);
+        }
+
+        for (U8 i = 0; i < num_subparts; ++i)
+        {
+                ESubpart part = (ESubpart)va_arg(argp,int);
+                mSubparts.push_back(part);
+        }
 }
 
 LLEditWearableDictionary::Subparts::Subparts()
 {
-	addEntry(SUBPART_SHAPE_WHOLE, new SubpartEntry(SUBPART_SHAPE_WHOLE, "mPelvis", "shape_body","shape_body_param_list", "shape_body_tab", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f),SEX_BOTH));
-	addEntry(SUBPART_SHAPE_HEAD, new SubpartEntry(SUBPART_SHAPE_HEAD, "mHead", "shape_head", "shape_head_param_list", "shape_head_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-	addEntry(SUBPART_SHAPE_EYES, new SubpartEntry(SUBPART_SHAPE_EYES, "mHead", "shape_eyes", "shape_eyes_param_list", "shape_eyes_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-	addEntry(SUBPART_SHAPE_EARS, new SubpartEntry(SUBPART_SHAPE_EARS, "mHead", "shape_ears", "shape_ears_param_list", "shape_ears_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-	addEntry(SUBPART_SHAPE_NOSE, new SubpartEntry(SUBPART_SHAPE_NOSE, "mHead", "shape_nose", "shape_nose_param_list", "shape_nose_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-	addEntry(SUBPART_SHAPE_MOUTH, new SubpartEntry(SUBPART_SHAPE_MOUTH, "mHead", "shape_mouth", "shape_mouth_param_list", "shape_mouth_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-	addEntry(SUBPART_SHAPE_CHIN, new SubpartEntry(SUBPART_SHAPE_CHIN, "mHead", "shape_chin", "shape_chin_param_list", "shape_chin_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-	addEntry(SUBPART_SHAPE_TORSO, new SubpartEntry(SUBPART_SHAPE_TORSO, "mTorso", "shape_torso", "shape_torso_param_list", "shape_torso_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(-1.f, 0.15f, 0.3f),SEX_BOTH));
-	addEntry(SUBPART_SHAPE_LEGS, new SubpartEntry(SUBPART_SHAPE_LEGS, "mPelvis", "shape_legs", "shape_legs_param_list", "shape_legs_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
-
-	addEntry(SUBPART_SKIN_COLOR, new SubpartEntry(SUBPART_SKIN_COLOR, "mHead", "skin_color", "skin_color_param_list", "skin_color_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-	addEntry(SUBPART_SKIN_FACEDETAIL, new SubpartEntry(SUBPART_SKIN_FACEDETAIL, "mHead", "skin_facedetail", "skin_face_param_list", "skin_face_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-	addEntry(SUBPART_SKIN_MAKEUP, new SubpartEntry(SUBPART_SKIN_MAKEUP, "mHead", "skin_makeup", "skin_makeup_param_list", "skin_makeup_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-	addEntry(SUBPART_SKIN_BODYDETAIL, new SubpartEntry(SUBPART_SKIN_BODYDETAIL, "mPelvis", "skin_bodydetail", "skin_body_param_list", "skin_body_tab", LLVector3d(0.f, 0.f, -0.2f), LLVector3d(-2.5f, 0.5f, 0.5f),SEX_BOTH));
-
-	addEntry(SUBPART_HAIR_COLOR, new SubpartEntry(SUBPART_HAIR_COLOR, "mHead", "hair_color", "hair_color_param_list", "hair_color_tab", LLVector3d(0.f, 0.f, 0.10f), LLVector3d(-0.4f, 0.05f, 0.10f),SEX_BOTH));
-	addEntry(SUBPART_HAIR_STYLE, new SubpartEntry(SUBPART_HAIR_STYLE, "mHead", "hair_style", "hair_style_param_list", "hair_style_tab", LLVector3d(0.f, 0.f, 0.10f), LLVector3d(-0.4f, 0.05f, 0.10f),SEX_BOTH));
-	addEntry(SUBPART_HAIR_EYEBROWS, new SubpartEntry(SUBPART_HAIR_EYEBROWS, "mHead", "hair_eyebrows", "hair_eyebrows_param_list", "hair_eyebrows_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-	addEntry(SUBPART_HAIR_FACIAL, new SubpartEntry(SUBPART_HAIR_FACIAL, "mHead", "hair_facial", "hair_facial_param_list", "hair_facial_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_MALE));
-
-	addEntry(SUBPART_EYES, new SubpartEntry(SUBPART_EYES, "mHead", "eyes", "eyes_main_param_list", "eyes_main_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
-
-	addEntry(SUBPART_SHIRT, new SubpartEntry(SUBPART_SHIRT, "mTorso", "shirt", "shirt_main_param_list", "shirt_main_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(-1.f, 0.15f, 0.3f),SEX_BOTH));
-	addEntry(SUBPART_PANTS, new SubpartEntry(SUBPART_PANTS, "mPelvis", "pants", "pants_main_param_list", "pants_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
-	addEntry(SUBPART_SHOES, new SubpartEntry(SUBPART_SHOES, "mPelvis", "shoes", "shoes_main_param_list", "shoes_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
-	addEntry(SUBPART_SOCKS, new SubpartEntry(SUBPART_SOCKS, "mPelvis", "socks", "socks_main_param_list", "socks_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
-	addEntry(SUBPART_JACKET, new SubpartEntry(SUBPART_JACKET, "mTorso", "jacket", "jacket_main_param_list", "jacket_main_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(-2.f, 0.1f, 0.3f),SEX_BOTH));
-	addEntry(SUBPART_SKIRT, new SubpartEntry(SUBPART_SKIRT, "mPelvis", "skirt", "skirt_main_param_list", "skirt_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
-	addEntry(SUBPART_GLOVES, new SubpartEntry(SUBPART_GLOVES, "mTorso", "gloves", "gloves_main_param_list", "gloves_main_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(-1.f, 0.15f, 0.f),SEX_BOTH));
-	addEntry(SUBPART_UNDERSHIRT, new SubpartEntry(SUBPART_UNDERSHIRT, "mTorso", "undershirt", "undershirt_main_param_list", "undershirt_main_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(-1.f, 0.15f, 0.3f),SEX_BOTH));
-	addEntry(SUBPART_UNDERPANTS, new SubpartEntry(SUBPART_UNDERPANTS, "mPelvis", "underpants", "underpants_main_param_list", "underpants_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
-	addEntry(SUBPART_ALPHA, new SubpartEntry(SUBPART_ALPHA, "mPelvis", "alpha", "alpha_main_param_list", "alpha_main_tab", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f),SEX_BOTH));
-	addEntry(SUBPART_TATTOO, new SubpartEntry(SUBPART_TATTOO, "mPelvis", "tattoo", "tattoo_main_param_list", "tattoo_main_tab", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f),SEX_BOTH));
-	addEntry(SUBPART_PHYSICS_BREASTS_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BREASTS_UPDOWN, "mTorso", "physics_breasts_updown", "physics_breasts_updown_param_list", "physics_breasts_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_FEMALE));
-	addEntry(SUBPART_PHYSICS_BREASTS_INOUT, new SubpartEntry(SUBPART_PHYSICS_BREASTS_INOUT, "mTorso", "physics_breasts_inout", "physics_breasts_inout_param_list", "physics_breasts_inout_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_FEMALE));
-	addEntry(SUBPART_PHYSICS_BELLY_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BELLY_UPDOWN, "mTorso", "physics_belly_updown", "physics_belly_updown_param_list", "physics_belly_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
-	addEntry(SUBPART_PHYSICS_BUTT_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BUTT_UPDOWN, "mTorso", "physics_butt_updown", "physics_butt_updown_param_list", "physics_butt_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
-	addEntry(SUBPART_PHYSICS_BUTT_LEFTRIGHT, new SubpartEntry(SUBPART_PHYSICS_BUTT_LEFTRIGHT, "mTorso", "physics_butt_leftright", "physics_butt_leftright_param_list", "physics_butt_leftright_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
-	addEntry(SUBPART_PHYSICS_ADVANCED, new SubpartEntry(SUBPART_PHYSICS_ADVANCED, "mTorso", "physics_advanced", "physics_advanced_param_list", "physics_advanced_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
+        addEntry(SUBPART_SHAPE_WHOLE, new SubpartEntry(SUBPART_SHAPE_WHOLE, "mPelvis", "shape_body","shape_body_param_list", "shape_body_tab", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f),SEX_BOTH));
+        addEntry(SUBPART_SHAPE_HEAD, new SubpartEntry(SUBPART_SHAPE_HEAD, "mHead", "shape_head", "shape_head_param_list", "shape_head_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+        addEntry(SUBPART_SHAPE_EYES, new SubpartEntry(SUBPART_SHAPE_EYES, "mHead", "shape_eyes", "shape_eyes_param_list", "shape_eyes_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+        addEntry(SUBPART_SHAPE_EARS, new SubpartEntry(SUBPART_SHAPE_EARS, "mHead", "shape_ears", "shape_ears_param_list", "shape_ears_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+        addEntry(SUBPART_SHAPE_NOSE, new SubpartEntry(SUBPART_SHAPE_NOSE, "mHead", "shape_nose", "shape_nose_param_list", "shape_nose_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+        addEntry(SUBPART_SHAPE_MOUTH, new SubpartEntry(SUBPART_SHAPE_MOUTH, "mHead", "shape_mouth", "shape_mouth_param_list", "shape_mouth_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+        addEntry(SUBPART_SHAPE_CHIN, new SubpartEntry(SUBPART_SHAPE_CHIN, "mHead", "shape_chin", "shape_chin_param_list", "shape_chin_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+        addEntry(SUBPART_SHAPE_TORSO, new SubpartEntry(SUBPART_SHAPE_TORSO, "mTorso", "shape_torso", "shape_torso_param_list", "shape_torso_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(-1.f, 0.15f, 0.3f),SEX_BOTH));
+        addEntry(SUBPART_SHAPE_LEGS, new SubpartEntry(SUBPART_SHAPE_LEGS, "mPelvis", "shape_legs", "shape_legs_param_list", "shape_legs_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
+
+        addEntry(SUBPART_SKIN_COLOR, new SubpartEntry(SUBPART_SKIN_COLOR, "mHead", "skin_color", "skin_color_param_list", "skin_color_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+        addEntry(SUBPART_SKIN_FACEDETAIL, new SubpartEntry(SUBPART_SKIN_FACEDETAIL, "mHead", "skin_facedetail", "skin_face_param_list", "skin_face_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+        addEntry(SUBPART_SKIN_MAKEUP, new SubpartEntry(SUBPART_SKIN_MAKEUP, "mHead", "skin_makeup", "skin_makeup_param_list", "skin_makeup_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+        addEntry(SUBPART_SKIN_BODYDETAIL, new SubpartEntry(SUBPART_SKIN_BODYDETAIL, "mPelvis", "skin_bodydetail", "skin_body_param_list", "skin_body_tab", LLVector3d(0.f, 0.f, -0.2f), LLVector3d(-2.5f, 0.5f, 0.5f),SEX_BOTH));
+
+        addEntry(SUBPART_HAIR_COLOR, new SubpartEntry(SUBPART_HAIR_COLOR, "mHead", "hair_color", "hair_color_param_list", "hair_color_tab", LLVector3d(0.f, 0.f, 0.10f), LLVector3d(-0.4f, 0.05f, 0.10f),SEX_BOTH));
+        addEntry(SUBPART_HAIR_STYLE, new SubpartEntry(SUBPART_HAIR_STYLE, "mHead", "hair_style", "hair_style_param_list", "hair_style_tab", LLVector3d(0.f, 0.f, 0.10f), LLVector3d(-0.4f, 0.05f, 0.10f),SEX_BOTH));
+        addEntry(SUBPART_HAIR_EYEBROWS, new SubpartEntry(SUBPART_HAIR_EYEBROWS, "mHead", "hair_eyebrows", "hair_eyebrows_param_list", "hair_eyebrows_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+        addEntry(SUBPART_HAIR_FACIAL, new SubpartEntry(SUBPART_HAIR_FACIAL, "mHead", "hair_facial", "hair_facial_param_list", "hair_facial_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_MALE));
+
+        addEntry(SUBPART_EYES, new SubpartEntry(SUBPART_EYES, "mHead", "eyes", "eyes_main_param_list", "eyes_main_tab", LLVector3d(0.f, 0.f, 0.05f), LLVector3d(-0.5f, 0.05f, 0.07f),SEX_BOTH));
+
+        addEntry(SUBPART_SHIRT, new SubpartEntry(SUBPART_SHIRT, "mTorso", "shirt", "shirt_main_param_list", "shirt_main_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(-1.f, 0.15f, 0.3f),SEX_BOTH));
+        addEntry(SUBPART_PANTS, new SubpartEntry(SUBPART_PANTS, "mPelvis", "pants", "pants_main_param_list", "pants_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
+        addEntry(SUBPART_SHOES, new SubpartEntry(SUBPART_SHOES, "mPelvis", "shoes", "shoes_main_param_list", "shoes_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
+        addEntry(SUBPART_SOCKS, new SubpartEntry(SUBPART_SOCKS, "mPelvis", "socks", "socks_main_param_list", "socks_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
+        addEntry(SUBPART_JACKET, new SubpartEntry(SUBPART_JACKET, "mTorso", "jacket", "jacket_main_param_list", "jacket_main_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(-2.f, 0.1f, 0.3f),SEX_BOTH));
+        addEntry(SUBPART_SKIRT, new SubpartEntry(SUBPART_SKIRT, "mPelvis", "skirt", "skirt_main_param_list", "skirt_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
+        addEntry(SUBPART_GLOVES, new SubpartEntry(SUBPART_GLOVES, "mTorso", "gloves", "gloves_main_param_list", "gloves_main_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(-1.f, 0.15f, 0.f),SEX_BOTH));
+        addEntry(SUBPART_UNDERSHIRT, new SubpartEntry(SUBPART_UNDERSHIRT, "mTorso", "undershirt", "undershirt_main_param_list", "undershirt_main_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(-1.f, 0.15f, 0.3f),SEX_BOTH));
+        addEntry(SUBPART_UNDERPANTS, new SubpartEntry(SUBPART_UNDERPANTS, "mPelvis", "underpants", "underpants_main_param_list", "underpants_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
+        addEntry(SUBPART_ALPHA, new SubpartEntry(SUBPART_ALPHA, "mPelvis", "alpha", "alpha_main_param_list", "alpha_main_tab", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f),SEX_BOTH));
+        addEntry(SUBPART_TATTOO, new SubpartEntry(SUBPART_TATTOO, "mPelvis", "tattoo", "tattoo_main_param_list", "tattoo_main_tab", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f),SEX_BOTH));
+        addEntry(SUBPART_PHYSICS_BREASTS_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BREASTS_UPDOWN, "mTorso", "physics_breasts_updown", "physics_breasts_updown_param_list", "physics_breasts_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_FEMALE));
+        addEntry(SUBPART_PHYSICS_BREASTS_INOUT, new SubpartEntry(SUBPART_PHYSICS_BREASTS_INOUT, "mTorso", "physics_breasts_inout", "physics_breasts_inout_param_list", "physics_breasts_inout_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_FEMALE));
+        addEntry(SUBPART_PHYSICS_BREASTS_LEFTRIGHT, new SubpartEntry(SUBPART_PHYSICS_BREASTS_LEFTRIGHT, "mTorso", "physics_breasts_leftright", "physics_breasts_leftright_param_list", "physics_breasts_leftright_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_FEMALE));
+        addEntry(SUBPART_PHYSICS_BELLY_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BELLY_UPDOWN, "mTorso", "physics_belly_updown", "physics_belly_updown_param_list", "physics_belly_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
+        addEntry(SUBPART_PHYSICS_BUTT_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BUTT_UPDOWN, "mTorso", "physics_butt_updown", "physics_butt_updown_param_list", "physics_butt_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
+        addEntry(SUBPART_PHYSICS_BUTT_LEFTRIGHT, new SubpartEntry(SUBPART_PHYSICS_BUTT_LEFTRIGHT, "mTorso", "physics_butt_leftright", "physics_butt_leftright_param_list", "physics_butt_leftright_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
+        addEntry(SUBPART_PHYSICS_ADVANCED, new SubpartEntry(SUBPART_PHYSICS_ADVANCED, "mTorso", "physics_advanced", "physics_advanced_param_list", "physics_advanced_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
 }
 
 LLEditWearableDictionary::SubpartEntry::SubpartEntry(ESubpart part,
-					 const std::string &joint,
-					 const std::string &edit_group,
-					 const std::string &param_list,
-					 const std::string &accordion_tab,
-					 const LLVector3d  &target_offset,
-					 const LLVector3d  &camera_offset,
-					 const ESex 	   &sex) :
-	LLDictionaryEntry(edit_group),
-	mSubpart(part),
-	mTargetJoint(joint),
-	mEditGroup(edit_group),
-	mParamList(param_list),
-	mAccordionTab(accordion_tab),
-	mTargetOffset(target_offset),
-	mCameraOffset(camera_offset),
-	mSex(sex)
+                                         const std::string &joint,
+                                         const std::string &edit_group,
+                                         const std::string &param_list,
+                                         const std::string &accordion_tab,
+                                         const LLVector3d  &target_offset,
+                                         const LLVector3d  &camera_offset,
+                                         const ESex        &sex) :
+        LLDictionaryEntry(edit_group),
+        mSubpart(part),
+        mTargetJoint(joint),
+        mEditGroup(edit_group),
+        mParamList(param_list),
+        mAccordionTab(accordion_tab),
+        mTargetOffset(target_offset),
+        mCameraOffset(camera_offset),
+        mSex(sex)
 {
 }
 
 LLEditWearableDictionary::ColorSwatchCtrls::ColorSwatchCtrls()
 {
-	addEntry ( TEX_UPPER_SHIRT,  new PickerControlEntry (TEX_UPPER_SHIRT, "Color/Tint" ));
-	addEntry ( TEX_LOWER_PANTS,  new PickerControlEntry (TEX_LOWER_PANTS, "Color/Tint" ));
-	addEntry ( TEX_LOWER_SHOES,  new PickerControlEntry (TEX_LOWER_SHOES, "Color/Tint" ));
-	addEntry ( TEX_LOWER_SOCKS,  new PickerControlEntry (TEX_LOWER_SOCKS, "Color/Tint" ));
-	addEntry ( TEX_UPPER_JACKET, new PickerControlEntry (TEX_UPPER_JACKET, "Color/Tint" ));
-	addEntry ( TEX_SKIRT,  new PickerControlEntry (TEX_SKIRT, "Color/Tint" ));
-	addEntry ( TEX_UPPER_GLOVES, new PickerControlEntry (TEX_UPPER_GLOVES, "Color/Tint" ));
-	addEntry ( TEX_UPPER_UNDERSHIRT, new PickerControlEntry (TEX_UPPER_UNDERSHIRT, "Color/Tint" ));
-	addEntry ( TEX_LOWER_UNDERPANTS, new PickerControlEntry (TEX_LOWER_UNDERPANTS, "Color/Tint" ));
-	addEntry ( TEX_HEAD_TATTOO, new PickerControlEntry(TEX_HEAD_TATTOO, "Color/Tint" ));
+        addEntry ( TEX_UPPER_SHIRT,  new PickerControlEntry (TEX_UPPER_SHIRT, "Color/Tint" ));
+        addEntry ( TEX_LOWER_PANTS,  new PickerControlEntry (TEX_LOWER_PANTS, "Color/Tint" ));
+        addEntry ( TEX_LOWER_SHOES,  new PickerControlEntry (TEX_LOWER_SHOES, "Color/Tint" ));
+        addEntry ( TEX_LOWER_SOCKS,  new PickerControlEntry (TEX_LOWER_SOCKS, "Color/Tint" ));
+        addEntry ( TEX_UPPER_JACKET, new PickerControlEntry (TEX_UPPER_JACKET, "Color/Tint" ));
+        addEntry ( TEX_SKIRT,  new PickerControlEntry (TEX_SKIRT, "Color/Tint" ));
+        addEntry ( TEX_UPPER_GLOVES, new PickerControlEntry (TEX_UPPER_GLOVES, "Color/Tint" ));
+        addEntry ( TEX_UPPER_UNDERSHIRT, new PickerControlEntry (TEX_UPPER_UNDERSHIRT, "Color/Tint" ));
+        addEntry ( TEX_LOWER_UNDERPANTS, new PickerControlEntry (TEX_LOWER_UNDERPANTS, "Color/Tint" ));
+        addEntry ( TEX_HEAD_TATTOO, new PickerControlEntry(TEX_HEAD_TATTOO, "Color/Tint" ));
 }
 
 LLEditWearableDictionary::TextureCtrls::TextureCtrls()
 {
-	addEntry ( TEX_HEAD_BODYPAINT,  new PickerControlEntry (TEX_HEAD_BODYPAINT,  "Head Tattoos", LLUUID::null, TRUE ));
-	addEntry ( TEX_UPPER_BODYPAINT, new PickerControlEntry (TEX_UPPER_BODYPAINT, "Upper Tattoos", LLUUID::null, TRUE ));
-	addEntry ( TEX_LOWER_BODYPAINT, new PickerControlEntry (TEX_LOWER_BODYPAINT, "Lower Tattoos", LLUUID::null, TRUE ));
-	addEntry ( TEX_HAIR, new PickerControlEntry (TEX_HAIR, "Texture", LLUUID( gSavedSettings.getString( "UIImgDefaultHairUUID" ) ), FALSE ));
-	addEntry ( TEX_EYES_IRIS, new PickerControlEntry (TEX_EYES_IRIS, "Iris", LLUUID( gSavedSettings.getString( "UIImgDefaultEyesUUID" ) ), FALSE ));
-	addEntry ( TEX_UPPER_SHIRT, new PickerControlEntry (TEX_UPPER_SHIRT, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultShirtUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_PANTS, new PickerControlEntry (TEX_LOWER_PANTS, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultPantsUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_SHOES, new PickerControlEntry (TEX_LOWER_SHOES, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultShoesUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_SOCKS, new PickerControlEntry (TEX_LOWER_SOCKS, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultSocksUUID" ) ), FALSE ));
-	addEntry ( TEX_UPPER_JACKET, new PickerControlEntry (TEX_UPPER_JACKET, "Upper Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultJacketUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_JACKET, new PickerControlEntry (TEX_LOWER_JACKET, "Lower Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultJacketUUID" ) ), FALSE ));
-	addEntry ( TEX_SKIRT, new PickerControlEntry (TEX_SKIRT, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultSkirtUUID" ) ), FALSE ));
-	addEntry ( TEX_UPPER_GLOVES, new PickerControlEntry (TEX_UPPER_GLOVES, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultGlovesUUID" ) ), FALSE ));
-	addEntry ( TEX_UPPER_UNDERSHIRT, new PickerControlEntry (TEX_UPPER_UNDERSHIRT, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultUnderwearUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_UNDERPANTS, new PickerControlEntry (TEX_LOWER_UNDERPANTS, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultUnderwearUUID" ) ), FALSE ));
-	addEntry ( TEX_LOWER_ALPHA, new PickerControlEntry (TEX_LOWER_ALPHA, "Lower Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
-	addEntry ( TEX_UPPER_ALPHA, new PickerControlEntry (TEX_UPPER_ALPHA, "Upper Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
-	addEntry ( TEX_HEAD_ALPHA, new PickerControlEntry (TEX_HEAD_ALPHA, "Head Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
-	addEntry ( TEX_EYES_ALPHA, new PickerControlEntry (TEX_EYES_ALPHA, "Eye Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
-	addEntry ( TEX_HAIR_ALPHA, new PickerControlEntry (TEX_HAIR_ALPHA, "Hair Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
-	addEntry ( TEX_LOWER_TATTOO, new PickerControlEntry (TEX_LOWER_TATTOO, "Lower Tattoo", LLUUID::null, TRUE ));
-	addEntry ( TEX_UPPER_TATTOO, new PickerControlEntry (TEX_UPPER_TATTOO, "Upper Tattoo", LLUUID::null, TRUE ));
-	addEntry ( TEX_HEAD_TATTOO, new PickerControlEntry (TEX_HEAD_TATTOO, "Head Tattoo", LLUUID::null, TRUE ));
+        addEntry ( TEX_HEAD_BODYPAINT,  new PickerControlEntry (TEX_HEAD_BODYPAINT,  "Head Tattoos", LLUUID::null, TRUE ));
+        addEntry ( TEX_UPPER_BODYPAINT, new PickerControlEntry (TEX_UPPER_BODYPAINT, "Upper Tattoos", LLUUID::null, TRUE ));
+        addEntry ( TEX_LOWER_BODYPAINT, new PickerControlEntry (TEX_LOWER_BODYPAINT, "Lower Tattoos", LLUUID::null, TRUE ));
+        addEntry ( TEX_HAIR, new PickerControlEntry (TEX_HAIR, "Texture", LLUUID( gSavedSettings.getString( "UIImgDefaultHairUUID" ) ), FALSE ));
+        addEntry ( TEX_EYES_IRIS, new PickerControlEntry (TEX_EYES_IRIS, "Iris", LLUUID( gSavedSettings.getString( "UIImgDefaultEyesUUID" ) ), FALSE ));
+        addEntry ( TEX_UPPER_SHIRT, new PickerControlEntry (TEX_UPPER_SHIRT, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultShirtUUID" ) ), FALSE ));
+        addEntry ( TEX_LOWER_PANTS, new PickerControlEntry (TEX_LOWER_PANTS, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultPantsUUID" ) ), FALSE ));
+        addEntry ( TEX_LOWER_SHOES, new PickerControlEntry (TEX_LOWER_SHOES, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultShoesUUID" ) ), FALSE ));
+        addEntry ( TEX_LOWER_SOCKS, new PickerControlEntry (TEX_LOWER_SOCKS, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultSocksUUID" ) ), FALSE ));
+        addEntry ( TEX_UPPER_JACKET, new PickerControlEntry (TEX_UPPER_JACKET, "Upper Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultJacketUUID" ) ), FALSE ));
+        addEntry ( TEX_LOWER_JACKET, new PickerControlEntry (TEX_LOWER_JACKET, "Lower Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultJacketUUID" ) ), FALSE ));
+        addEntry ( TEX_SKIRT, new PickerControlEntry (TEX_SKIRT, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultSkirtUUID" ) ), FALSE ));
+        addEntry ( TEX_UPPER_GLOVES, new PickerControlEntry (TEX_UPPER_GLOVES, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultGlovesUUID" ) ), FALSE ));
+        addEntry ( TEX_UPPER_UNDERSHIRT, new PickerControlEntry (TEX_UPPER_UNDERSHIRT, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultUnderwearUUID" ) ), FALSE ));
+        addEntry ( TEX_LOWER_UNDERPANTS, new PickerControlEntry (TEX_LOWER_UNDERPANTS, "Fabric", LLUUID( gSavedSettings.getString( "UIImgDefaultUnderwearUUID" ) ), FALSE ));
+        addEntry ( TEX_LOWER_ALPHA, new PickerControlEntry (TEX_LOWER_ALPHA, "Lower Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
+        addEntry ( TEX_UPPER_ALPHA, new PickerControlEntry (TEX_UPPER_ALPHA, "Upper Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
+        addEntry ( TEX_HEAD_ALPHA, new PickerControlEntry (TEX_HEAD_ALPHA, "Head Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
+        addEntry ( TEX_EYES_ALPHA, new PickerControlEntry (TEX_EYES_ALPHA, "Eye Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
+        addEntry ( TEX_HAIR_ALPHA, new PickerControlEntry (TEX_HAIR_ALPHA, "Hair Alpha", LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) ), TRUE ));
+        addEntry ( TEX_LOWER_TATTOO, new PickerControlEntry (TEX_LOWER_TATTOO, "Lower Tattoo", LLUUID::null, TRUE ));
+        addEntry ( TEX_UPPER_TATTOO, new PickerControlEntry (TEX_UPPER_TATTOO, "Upper Tattoo", LLUUID::null, TRUE ));
+        addEntry ( TEX_HEAD_TATTOO, new PickerControlEntry (TEX_HEAD_TATTOO, "Head Tattoo", LLUUID::null, TRUE ));
 }
 
 LLEditWearableDictionary::PickerControlEntry::PickerControlEntry(ETextureIndex tex_index,
-					 const std::string name,
-					 const LLUUID default_image_id,
-					 const bool allow_no_texture) :
-	LLDictionaryEntry(name),
-	mTextureIndex(tex_index),
-	mControlName(name),
-	mDefaultImageId(default_image_id),
-	mAllowNoTexture(allow_no_texture)
+                                         const std::string name,
+                                         const LLUUID default_image_id,
+                                         const bool allow_no_texture) :
+        LLDictionaryEntry(name),
+        mTextureIndex(tex_index),
+        mControlName(name),
+        mDefaultImageId(default_image_id),
+        mAllowNoTexture(allow_no_texture)
 {
 }
 
@@ -397,13 +399,13 @@ LLEditWearableDictionary::PickerControlEntry::PickerControlEntry(ETextureIndex t
 class LLLabledBackButton : public LLButton
 {
 public:
-	struct Params : public LLInitParam::Block<Params, LLButton::Params>
-	{
-		Params() {}
-	};
+        struct Params : public LLInitParam::Block<Params, LLButton::Params>
+        {
+                Params() {}
+        };
 protected:
-	friend class LLUICtrlFactory;
-	LLLabledBackButton(const Params&);
+        friend class LLUICtrlFactory;
+        LLLabledBackButton(const Params&);
 };
 
 static LLDefaultChildRegistry::Register<LLLabledBackButton> labeled_back_btn("labeled_back_button");
@@ -411,9 +413,9 @@ static LLDefaultChildRegistry::Register<LLLabledBackButton> labeled_back_btn("la
 LLLabledBackButton::LLLabledBackButton(const Params& params)
 : LLButton(params)
 {
-	// override hack in LLButton's constructor to use paddings have been set in xml
-	setLeftHPad(params.pad_left);
-	setRightHPad(params.pad_right);
+        // override hack in LLButton's constructor to use paddings have been set in xml
+        setLeftHPad(params.pad_left);
+        setRightHPad(params.pad_right);
 }
 
 // Helper functions.
@@ -434,13 +436,13 @@ typedef boost::function<void(LLPanel* panel, const LLEditWearableDictionary::Pic
 
 typedef struct PickerControlEntryNamePredicate
 {
-	PickerControlEntryNamePredicate(const std::string name) : mName (name) {};
-	bool operator()(const LLEditWearableDictionary::PickerControlEntry* entry) const
-	{
-		return (entry && entry->mName == mName);
-	}
+        PickerControlEntryNamePredicate(const std::string name) : mName (name) {};
+        bool operator()(const LLEditWearableDictionary::PickerControlEntry* entry) const
+        {
+                return (entry && entry->mName == mName);
+        }
 private:
-	const std::string mName;
+        const std::string mName;
 } PickerControlEntryNamePredicate;
 
 // A full specialization of get_pickers_indexes for LLColorSwatchCtrl
@@ -448,12 +450,12 @@ template <>
 const texture_vec_t&
 get_pickers_indexes<LLColorSwatchCtrl> (const LLEditWearableDictionary::WearableEntry *wearable_entry)
 {
-	if (!wearable_entry)
-	{
-		llwarns << "could not get LLColorSwatchCtrl indexes for null wearable entry." << llendl;
-		return null_texture_vec;
-	}
-	return wearable_entry->mColorSwatchCtrls;
+        if (!wearable_entry)
+        {
+                llwarns << "could not get LLColorSwatchCtrl indexes for null wearable entry." << llendl;
+                return null_texture_vec;
+        }
+        return wearable_entry->mColorSwatchCtrls;
 }
 
 // A full specialization of get_pickers_indexes for LLTextureCtrl
@@ -461,12 +463,12 @@ template <>
 const texture_vec_t&
 get_pickers_indexes<LLTextureCtrl> (const LLEditWearableDictionary::WearableEntry *wearable_entry)
 {
-	if (!wearable_entry)
-	{
-		llwarns << "could not get LLTextureCtrl indexes for null wearable entry." << llendl;
-		return null_texture_vec;
-	}
-	return wearable_entry->mTextureCtrls;
+        if (!wearable_entry)
+        {
+                llwarns << "could not get LLTextureCtrl indexes for null wearable entry." << llendl;
+                return null_texture_vec;
+        }
+        return wearable_entry->mTextureCtrls;
 }
 
 // A full specialization of get_picker_entry for LLColorSwatchCtrl
@@ -474,7 +476,7 @@ template <>
 const LLEditWearableDictionary::PickerControlEntry*
 get_picker_entry<LLColorSwatchCtrl> (const ETextureIndex index)
 {
-	return LLEditWearableDictionary::getInstance()->getColorSwatch(index);
+        return LLEditWearableDictionary::getInstance()->getColorSwatch(index);
 }
 
 // A full specialization of get_picker_entry for LLTextureCtrl
@@ -482,162 +484,162 @@ template <>
 const LLEditWearableDictionary::PickerControlEntry*
 get_picker_entry<LLTextureCtrl> (const ETextureIndex index)
 {
-	return LLEditWearableDictionary::getInstance()->getTexturePicker(index);
+        return LLEditWearableDictionary::getInstance()->getTexturePicker(index);
 }
 
 template <typename CtrlType, class Predicate>
 const LLEditWearableDictionary::PickerControlEntry*
 find_picker_ctrl_entry_if(LLWearableType::EType type, const Predicate pred)
 {
-	const LLEditWearableDictionary::WearableEntry *wearable_entry
-		= LLEditWearableDictionary::getInstance()->getWearable(type);
-	if (!wearable_entry)
-	{
-		llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl;
-		return NULL;
-	}
-	const texture_vec_t& indexes = get_pickers_indexes<CtrlType>(wearable_entry);
-	for (texture_vec_t::const_iterator
-			 iter = indexes.begin(),
-			 iter_end = indexes.end();
-		 iter != iter_end; ++iter)
-	{
-		const ETextureIndex te = *iter;
-		const LLEditWearableDictionary::PickerControlEntry*	entry
-			= get_picker_entry<CtrlType>(te);
-		if (!entry)
-		{
-			llwarns << "could not get picker dictionary entry (" << te << ") for wearable of type: " << type << llendl;
-			continue;
-		}
-		if (pred(entry))
-		{
-			return entry;
-		}
-	}
-	return NULL;
+        const LLEditWearableDictionary::WearableEntry *wearable_entry
+                = LLEditWearableDictionary::getInstance()->getWearable(type);
+        if (!wearable_entry)
+        {
+                llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl;
+                return NULL;
+        }
+        const texture_vec_t& indexes = get_pickers_indexes<CtrlType>(wearable_entry);
+        for (texture_vec_t::const_iterator
+                         iter = indexes.begin(),
+                         iter_end = indexes.end();
+                 iter != iter_end; ++iter)
+        {
+                const ETextureIndex te = *iter;
+                const LLEditWearableDictionary::PickerControlEntry*     entry
+                        = get_picker_entry<CtrlType>(te);
+                if (!entry)
+                {
+                        llwarns << "could not get picker dictionary entry (" << te << ") for wearable of type: " << type << llendl;
+                        continue;
+                }
+                if (pred(entry))
+                {
+                        return entry;
+                }
+        }
+        return NULL;
 }
 
 template <typename CtrlType>
 void
 for_each_picker_ctrl_entry(LLPanel* panel, LLWearableType::EType type, function_t fun)
 {
-	if (!panel)
-	{
-		llwarns << "the panel wasn't passed for wearable of type: " << type << llendl;
-		return;
-	}
-	const LLEditWearableDictionary::WearableEntry *wearable_entry
-		= LLEditWearableDictionary::getInstance()->getWearable(type);
-	if (!wearable_entry)
-	{
-		llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl;
-		return;
-	}
-	const texture_vec_t& indexes = get_pickers_indexes<CtrlType>(wearable_entry);
-	for (texture_vec_t::const_iterator
-			 iter = indexes.begin(),
-			 iter_end = indexes.end();
-		 iter != iter_end; ++iter)
-	{
-		const ETextureIndex te = *iter;
-		const LLEditWearableDictionary::PickerControlEntry*	entry
-			= get_picker_entry<CtrlType>(te);
-		if (!entry)
-		{
-			llwarns << "could not get picker dictionary entry (" << te << ") for wearable of type: " << type << llendl;
-			continue;
-		}
-		fun (panel, entry);
-	}
+        if (!panel)
+        {
+                llwarns << "the panel wasn't passed for wearable of type: " << type << llendl;
+                return;
+        }
+        const LLEditWearableDictionary::WearableEntry *wearable_entry
+                = LLEditWearableDictionary::getInstance()->getWearable(type);
+        if (!wearable_entry)
+        {
+                llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl;
+                return;
+        }
+        const texture_vec_t& indexes = get_pickers_indexes<CtrlType>(wearable_entry);
+        for (texture_vec_t::const_iterator
+                         iter = indexes.begin(),
+                         iter_end = indexes.end();
+                 iter != iter_end; ++iter)
+        {
+                const ETextureIndex te = *iter;
+                const LLEditWearableDictionary::PickerControlEntry*     entry
+                        = get_picker_entry<CtrlType>(te);
+                if (!entry)
+                {
+                        llwarns << "could not get picker dictionary entry (" << te << ") for wearable of type: " << type << llendl;
+                        continue;
+                }
+                fun (panel, entry);
+        }
 }
 
 // The helper functions for pickers management
 static void init_color_swatch_ctrl(LLPanelEditWearable* self, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
 {
-	LLColorSwatchCtrl* color_swatch_ctrl = panel->getChild<LLColorSwatchCtrl>(entry->mControlName);
-	if (color_swatch_ctrl)
-	{
-		// Can't get the color from the wearable here, since the wearable may not be set when this is called.
-		color_swatch_ctrl->setOriginal(LLColor4::white);
-	}
+        LLColorSwatchCtrl* color_swatch_ctrl = panel->getChild<LLColorSwatchCtrl>(entry->mControlName);
+        if (color_swatch_ctrl)
+        {
+                // Can't get the color from the wearable here, since the wearable may not be set when this is called.
+                color_swatch_ctrl->setOriginal(LLColor4::white);
+        }
 }
 
 static void init_texture_ctrl(LLPanelEditWearable* self, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
 {
-	LLTextureCtrl* texture_ctrl = panel->getChild<LLTextureCtrl>(entry->mControlName);
-	if (texture_ctrl)
-	{
-		texture_ctrl->setDefaultImageAssetID(entry->mDefaultImageId);
-		texture_ctrl->setAllowNoTexture(entry->mAllowNoTexture);
-		// Don't allow (no copy) or (notransfer) textures to be selected.
-		texture_ctrl->setImmediateFilterPermMask(PERM_NONE);
-		texture_ctrl->setNonImmediateFilterPermMask(PERM_NONE);
-	}
+        LLTextureCtrl* texture_ctrl = panel->getChild<LLTextureCtrl>(entry->mControlName);
+        if (texture_ctrl)
+        {
+                texture_ctrl->setDefaultImageAssetID(entry->mDefaultImageId);
+                texture_ctrl->setAllowNoTexture(entry->mAllowNoTexture);
+                // Don't allow (no copy) or (notransfer) textures to be selected.
+                texture_ctrl->setImmediateFilterPermMask(PERM_NONE);
+                texture_ctrl->setNonImmediateFilterPermMask(PERM_NONE);
+        }
 }
 
 static void update_color_swatch_ctrl(LLPanelEditWearable* self, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
 {
-	LLColorSwatchCtrl* color_swatch_ctrl = panel->getChild<LLColorSwatchCtrl>(entry->mControlName);
-	if (color_swatch_ctrl)
-	{
-		color_swatch_ctrl->set(self->getWearable()->getClothesColor(entry->mTextureIndex));
-		color_swatch_ctrl->closeFloaterColorPicker();
-	}
+        LLColorSwatchCtrl* color_swatch_ctrl = panel->getChild<LLColorSwatchCtrl>(entry->mControlName);
+        if (color_swatch_ctrl)
+        {
+                color_swatch_ctrl->set(self->getWearable()->getClothesColor(entry->mTextureIndex));
+                color_swatch_ctrl->closeFloaterColorPicker();
+        }
 }
 
 static void update_texture_ctrl(LLPanelEditWearable* self, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
 {
-	LLTextureCtrl* texture_ctrl = panel->getChild<LLTextureCtrl>(entry->mControlName);
-	if (texture_ctrl)
-	{
-		LLUUID new_id;
-		LLLocalTextureObject *lto = self->getWearable()->getLocalTextureObject(entry->mTextureIndex);
-		if( lto && (lto->getID() != IMG_DEFAULT_AVATAR) )
-		{
-			new_id = lto->getID();
-		}
-		else
-		{
-			new_id = LLUUID::null;
-		}
-		LLUUID old_id = texture_ctrl->getImageAssetID();
-		if (old_id != new_id)
-		{
-			// texture has changed, close the floater to avoid DEV-22461
-			texture_ctrl->closeDependentFloater();
-		}
-		texture_ctrl->setImageAssetID(new_id);
-	}
+        LLTextureCtrl* texture_ctrl = panel->getChild<LLTextureCtrl>(entry->mControlName);
+        if (texture_ctrl)
+        {
+                LLUUID new_id;
+                LLLocalTextureObject *lto = self->getWearable()->getLocalTextureObject(entry->mTextureIndex);
+                if( lto && (lto->getID() != IMG_DEFAULT_AVATAR) )
+                {
+                        new_id = lto->getID();
+                }
+                else
+                {
+                        new_id = LLUUID::null;
+                }
+                LLUUID old_id = texture_ctrl->getImageAssetID();
+                if (old_id != new_id)
+                {
+                        // texture has changed, close the floater to avoid DEV-22461
+                        texture_ctrl->closeDependentFloater();
+                }
+                texture_ctrl->setImageAssetID(new_id);
+        }
 }
 
 static void set_enabled_color_swatch_ctrl(bool enabled, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
 {
-	LLColorSwatchCtrl* color_swatch_ctrl = panel->getChild<LLColorSwatchCtrl>(entry->mControlName);
-	if (color_swatch_ctrl)
-	{
-		color_swatch_ctrl->setEnabled(enabled);
-	}
+        LLColorSwatchCtrl* color_swatch_ctrl = panel->getChild<LLColorSwatchCtrl>(entry->mControlName);
+        if (color_swatch_ctrl)
+        {
+                color_swatch_ctrl->setEnabled(enabled);
+        }
 }
 
 static void set_enabled_texture_ctrl(bool enabled, LLPanel* panel, const LLEditWearableDictionary::PickerControlEntry* entry)
 {
-	LLTextureCtrl* texture_ctrl = panel->getChild<LLTextureCtrl>(entry->mControlName);
-	if (texture_ctrl)
-	{
-		texture_ctrl->setEnabled(enabled);
-	}
+        LLTextureCtrl* texture_ctrl = panel->getChild<LLTextureCtrl>(entry->mControlName);
+        if (texture_ctrl)
+        {
+                texture_ctrl->setEnabled(enabled);
+        }
 }
 
 // LLPanelEditWearable
 
 LLPanelEditWearable::LLPanelEditWearable()
-	: LLPanel()
-	, mWearablePtr(NULL)
-	, mWearableItem(NULL)
+        : LLPanel()
+        , mWearablePtr(NULL)
+        , mWearableItem(NULL)
 {
-	mCommitCallbackRegistrar.add("ColorSwatch.Commit", boost::bind(&LLPanelEditWearable::onColorSwatchCommit, this, _1));
-	mCommitCallbackRegistrar.add("TexturePicker.Commit", boost::bind(&LLPanelEditWearable::onTexturePickerCommit, this, _1));
+        mCommitCallbackRegistrar.add("ColorSwatch.Commit", boost::bind(&LLPanelEditWearable::onColorSwatchCommit, this, _1));
+        mCommitCallbackRegistrar.add("TexturePicker.Commit", boost::bind(&LLPanelEditWearable::onTexturePickerCommit, this, _1));
 }
 
 //virtual
@@ -648,935 +650,935 @@ LLPanelEditWearable::~LLPanelEditWearable()
 
 bool LLPanelEditWearable::changeHeightUnits(const LLSD& new_value)
 {
-	updateMetricLayout( new_value.asBoolean() );
-	updateTypeSpecificControls(LLWearableType::WT_SHAPE);
-	return true;
+        updateMetricLayout( new_value.asBoolean() );
+        updateTypeSpecificControls(LLWearableType::WT_SHAPE);
+        return true;
 }
 
 void LLPanelEditWearable::updateMetricLayout(BOOL new_value)
 {
-	LLUIString current_metric, replacment_metric;
-	current_metric = new_value ? mMeters : mFeet;
-	replacment_metric = new_value ? mFeet : mMeters;
-	mHeigthValue.setArg( "[METRIC1]", current_metric.getString() );
-	mReplacementMetricUrl.setArg( "[URL_METRIC2]", std::string("[secondlife:///app/metricsystem ") + replacment_metric.getString() + std::string("]"));
+        LLUIString current_metric, replacment_metric;
+        current_metric = new_value ? mMeters : mFeet;
+        replacment_metric = new_value ? mFeet : mMeters;
+        mHeigthValue.setArg( "[METRIC1]", current_metric.getString() );
+        mReplacementMetricUrl.setArg( "[URL_METRIC2]", std::string("[secondlife:///app/metricsystem ") + replacment_metric.getString() + std::string("]"));
 }
 
 void LLPanelEditWearable::updateAvatarHeightLabel()
 {
-	mTxtAvatarHeight->setText(LLStringUtil::null);
-	LLStyle::Params param;
-	param.color = mAvatarHeigthLabelColor;
-	mTxtAvatarHeight->appendText(mHeigth, false, param);
-	param.color = mAvatarHeigthValueLabelColor;
-	mTxtAvatarHeight->appendText(mHeigthValue, false, param);
-	param.color = mAvatarHeigthLabelColor; // using mAvatarHeigthLabelColor for '/' separator
-	mTxtAvatarHeight->appendText(" / ", false, param);
-	mTxtAvatarHeight->appendText(this->mReplacementMetricUrl, false, param);
+        mTxtAvatarHeight->setText(LLStringUtil::null);
+        LLStyle::Params param;
+        param.color = mAvatarHeigthLabelColor;
+        mTxtAvatarHeight->appendText(mHeigth, false, param);
+        param.color = mAvatarHeigthValueLabelColor;
+        mTxtAvatarHeight->appendText(mHeigthValue, false, param);
+        param.color = mAvatarHeigthLabelColor; // using mAvatarHeigthLabelColor for '/' separator
+        mTxtAvatarHeight->appendText(" / ", false, param);
+        mTxtAvatarHeight->appendText(this->mReplacementMetricUrl, false, param);
 }
 
 void LLPanelEditWearable::onWearablePanelVisibilityChange(const LLSD &in_visible_chain, LLAccordionCtrl* accordion_ctrl)
 {
-	if (in_visible_chain.asBoolean() && accordion_ctrl != NULL)
-	{
-		accordion_ctrl->expandDefaultTab();
-	}
+        if (in_visible_chain.asBoolean() && accordion_ctrl != NULL)
+        {
+                accordion_ctrl->expandDefaultTab();
+        }
 }
 
 void LLPanelEditWearable::setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel)
 {
-	if (bodypart_panel != NULL)
-	{
-		LLAccordionCtrl* accordion_ctrl = bodypart_panel->getChild<LLAccordionCtrl>("wearable_accordion");
-
-		if (accordion_ctrl != NULL)
-		{
-			bodypart_panel->setVisibleCallback(
-					boost::bind(&LLPanelEditWearable::onWearablePanelVisibilityChange, this, _2, accordion_ctrl));
-		}
-		else
-		{
-			llwarns << "accordion_ctrl is NULL" << llendl;
-		}
-	}
-	else
-	{
-		llwarns << "bodypart_panel is NULL" << llendl;
-	}
+        if (bodypart_panel != NULL)
+        {
+                LLAccordionCtrl* accordion_ctrl = bodypart_panel->getChild<LLAccordionCtrl>("wearable_accordion");
+
+                if (accordion_ctrl != NULL)
+                {
+                        bodypart_panel->setVisibleCallback(
+                                        boost::bind(&LLPanelEditWearable::onWearablePanelVisibilityChange, this, _2, accordion_ctrl));
+                }
+                else
+                {
+                        llwarns << "accordion_ctrl is NULL" << llendl;
+                }
+        }
+        else
+        {
+                llwarns << "bodypart_panel is NULL" << llendl;
+        }
 }
 
 // virtual 
 BOOL LLPanelEditWearable::postBuild()
 {
-	// buttons
-	mBtnRevert = getChild<LLButton>("revert_button");
-	mBtnRevert->setClickedCallback(boost::bind(&LLPanelEditWearable::onRevertButtonClicked, this));
-
-	mBtnBack = getChild<LLButton>("back_btn");
-	mBackBtnLabel = mBtnBack->getLabelUnselected();
-	mBtnBack->setLabel(LLStringUtil::null);
-	// handled at appearance panel level?
-	//mBtnBack->setClickedCallback(boost::bind(&LLPanelEditWearable::onBackButtonClicked, this));
-
-	mNameEditor = getChild<LLLineEditor>("description");
-
-	mPanelTitle = getChild<LLTextBox>("edit_wearable_title");
-	mDescTitle = getChild<LLTextBox>("description_text");
-
-	getChild<LLRadioGroup>("sex_radio")->setCommitCallback(boost::bind(&LLPanelEditWearable::onCommitSexChange, this));
-	getChild<LLButton>("save_as_button")->setCommitCallback(boost::bind(&LLPanelEditWearable::onSaveAsButtonClicked, this));
-
-	// The following panels will be shown/hidden based on what wearable we're editing
-	// body parts
-	mPanelShape = getChild<LLPanel>("edit_shape_panel");
-	mPanelSkin = getChild<LLPanel>("edit_skin_panel");
-	mPanelEyes = getChild<LLPanel>("edit_eyes_panel");
-	mPanelHair = getChild<LLPanel>("edit_hair_panel");
-
-	// Setting the visibility callback is applied only to the bodyparts panel
-	// because currently they are the only ones whose 'wearable_accordion' has
-	// multiple accordion tabs (see EXT-8164 for details).
-	setWearablePanelVisibilityChangeCallback(mPanelShape);
-	setWearablePanelVisibilityChangeCallback(mPanelSkin);
-	setWearablePanelVisibilityChangeCallback(mPanelEyes);
-	setWearablePanelVisibilityChangeCallback(mPanelHair);
-
-	//clothes
-	mPanelShirt = getChild<LLPanel>("edit_shirt_panel");
-	mPanelPants = getChild<LLPanel>("edit_pants_panel");
-	mPanelShoes = getChild<LLPanel>("edit_shoes_panel");
-	mPanelSocks = getChild<LLPanel>("edit_socks_panel");
-	mPanelJacket = getChild<LLPanel>("edit_jacket_panel");
-	mPanelGloves = getChild<LLPanel>("edit_gloves_panel");
-	mPanelUndershirt = getChild<LLPanel>("edit_undershirt_panel");
-	mPanelUnderpants = getChild<LLPanel>("edit_underpants_panel");
-	mPanelSkirt = getChild<LLPanel>("edit_skirt_panel");
-	mPanelAlpha = getChild<LLPanel>("edit_alpha_panel");
-	mPanelTattoo = getChild<LLPanel>("edit_tattoo_panel");
-	mPanelPhysics = getChild<LLPanel>("edit_physics_panel");
-
-	mTxtAvatarHeight = mPanelShape->getChild<LLTextBox>("avatar_height");
-
-	mWearablePtr = NULL;
-
-	configureAlphaCheckbox(LLVOAvatarDefines::TEX_LOWER_ALPHA, "lower alpha texture invisible");
-	configureAlphaCheckbox(LLVOAvatarDefines::TEX_UPPER_ALPHA, "upper alpha texture invisible");
-	configureAlphaCheckbox(LLVOAvatarDefines::TEX_HEAD_ALPHA, "head alpha texture invisible");
-	configureAlphaCheckbox(LLVOAvatarDefines::TEX_EYES_ALPHA, "eye alpha texture invisible");
-	configureAlphaCheckbox(LLVOAvatarDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible");
-
-	// configure tab expanded callbacks
-	for (U32 type_index = 0; type_index < (U32)LLWearableType::WT_COUNT; ++type_index)
-	{
-		LLWearableType::EType type = (LLWearableType::EType) type_index;
-		const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
-		if (!wearable_entry)
-		{
-			llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl;
-			continue;
-		}
-		U8 num_subparts = wearable_entry->mSubparts.size();
-	
-		for (U8 index = 0; index < num_subparts; ++index)
-		{
-			// dive into data structures to get the panel we need
-			ESubpart subpart_e = wearable_entry->mSubparts[index];
-			const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
-	
-			if (!subpart_entry)
-			{
-				llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
-				continue;
-			}
-	
-			const std::string accordion_tab = subpart_entry->mAccordionTab;
-	
-			LLAccordionCtrlTab *tab = getChild<LLAccordionCtrlTab>(accordion_tab);
-	
-			if (!tab)
-			{
-				llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl;
-				continue;
-			}
-	
-			// initialize callback to ensure camera view changes appropriately.
-			tab->setDropDownStateChangedCallback(boost::bind(&LLPanelEditWearable::onTabExpandedCollapsed,this,_2,index));
-		}
-
-		// initialize texture and color picker controls
-		for_each_picker_ctrl_entry <LLColorSwatchCtrl> (getPanel(type), type, boost::bind(init_color_swatch_ctrl, this, _1, _2));
-		for_each_picker_ctrl_entry <LLTextureCtrl>     (getPanel(type), type, boost::bind(init_texture_ctrl, this, _1, _2));
-	}
-
-	// init all strings
-	mMeters		= mPanelShape->getString("meters");
-	mFeet		= mPanelShape->getString("feet");
-	mHeigth		= mPanelShape->getString("height") + " ";
-	mHeigthValue	= "[HEIGHT] [METRIC1]";
-	mReplacementMetricUrl	= "[URL_METRIC2]";
-
-	std::string color = mPanelShape->getString("heigth_label_color");
-	mAvatarHeigthLabelColor = LLUIColorTable::instance().getColor(color, LLColor4::green);
-	color = mPanelShape->getString("heigth_value_label_color");
-	mAvatarHeigthValueLabelColor = LLUIColorTable::instance().getColor(color, LLColor4::green);
-	gSavedSettings.getControl("HeightUnits")->getSignal()->connect(boost::bind(&LLPanelEditWearable::changeHeightUnits, this, _2));
-	updateMetricLayout(gSavedSettings.getBOOL("HeightUnits"));
-
-	return TRUE;
+        // buttons
+        mBtnRevert = getChild<LLButton>("revert_button");
+        mBtnRevert->setClickedCallback(boost::bind(&LLPanelEditWearable::onRevertButtonClicked, this));
+
+        mBtnBack = getChild<LLButton>("back_btn");
+        mBackBtnLabel = mBtnBack->getLabelUnselected();
+        mBtnBack->setLabel(LLStringUtil::null);
+        // handled at appearance panel level?
+        //mBtnBack->setClickedCallback(boost::bind(&LLPanelEditWearable::onBackButtonClicked, this));
+
+        mNameEditor = getChild<LLLineEditor>("description");
+
+        mPanelTitle = getChild<LLTextBox>("edit_wearable_title");
+        mDescTitle = getChild<LLTextBox>("description_text");
+
+        getChild<LLRadioGroup>("sex_radio")->setCommitCallback(boost::bind(&LLPanelEditWearable::onCommitSexChange, this));
+        getChild<LLButton>("save_as_button")->setCommitCallback(boost::bind(&LLPanelEditWearable::onSaveAsButtonClicked, this));
+
+        // The following panels will be shown/hidden based on what wearable we're editing
+        // body parts
+        mPanelShape = getChild<LLPanel>("edit_shape_panel");
+        mPanelSkin = getChild<LLPanel>("edit_skin_panel");
+        mPanelEyes = getChild<LLPanel>("edit_eyes_panel");
+        mPanelHair = getChild<LLPanel>("edit_hair_panel");
+
+        // Setting the visibility callback is applied only to the bodyparts panel
+        // because currently they are the only ones whose 'wearable_accordion' has
+        // multiple accordion tabs (see EXT-8164 for details).
+        setWearablePanelVisibilityChangeCallback(mPanelShape);
+        setWearablePanelVisibilityChangeCallback(mPanelSkin);
+        setWearablePanelVisibilityChangeCallback(mPanelEyes);
+        setWearablePanelVisibilityChangeCallback(mPanelHair);
+
+        //clothes
+        mPanelShirt = getChild<LLPanel>("edit_shirt_panel");
+        mPanelPants = getChild<LLPanel>("edit_pants_panel");
+        mPanelShoes = getChild<LLPanel>("edit_shoes_panel");
+        mPanelSocks = getChild<LLPanel>("edit_socks_panel");
+        mPanelJacket = getChild<LLPanel>("edit_jacket_panel");
+        mPanelGloves = getChild<LLPanel>("edit_gloves_panel");
+        mPanelUndershirt = getChild<LLPanel>("edit_undershirt_panel");
+        mPanelUnderpants = getChild<LLPanel>("edit_underpants_panel");
+        mPanelSkirt = getChild<LLPanel>("edit_skirt_panel");
+        mPanelAlpha = getChild<LLPanel>("edit_alpha_panel");
+        mPanelTattoo = getChild<LLPanel>("edit_tattoo_panel");
+        mPanelPhysics = getChild<LLPanel>("edit_physics_panel");
+
+        mTxtAvatarHeight = mPanelShape->getChild<LLTextBox>("avatar_height");
+
+        mWearablePtr = NULL;
+
+        configureAlphaCheckbox(LLVOAvatarDefines::TEX_LOWER_ALPHA, "lower alpha texture invisible");
+        configureAlphaCheckbox(LLVOAvatarDefines::TEX_UPPER_ALPHA, "upper alpha texture invisible");
+        configureAlphaCheckbox(LLVOAvatarDefines::TEX_HEAD_ALPHA, "head alpha texture invisible");
+        configureAlphaCheckbox(LLVOAvatarDefines::TEX_EYES_ALPHA, "eye alpha texture invisible");
+        configureAlphaCheckbox(LLVOAvatarDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible");
+
+        // configure tab expanded callbacks
+        for (U32 type_index = 0; type_index < (U32)LLWearableType::WT_COUNT; ++type_index)
+        {
+                LLWearableType::EType type = (LLWearableType::EType) type_index;
+                const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
+                if (!wearable_entry)
+                {
+                        llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl;
+                        continue;
+                }
+                U8 num_subparts = wearable_entry->mSubparts.size();
+        
+                for (U8 index = 0; index < num_subparts; ++index)
+                {
+                        // dive into data structures to get the panel we need
+                        ESubpart subpart_e = wearable_entry->mSubparts[index];
+                        const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
+        
+                        if (!subpart_entry)
+                        {
+                                llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
+                                continue;
+                        }
+        
+                        const std::string accordion_tab = subpart_entry->mAccordionTab;
+        
+                        LLAccordionCtrlTab *tab = getChild<LLAccordionCtrlTab>(accordion_tab);
+        
+                        if (!tab)
+                        {
+                                llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl;
+                                continue;
+                        }
+        
+                        // initialize callback to ensure camera view changes appropriately.
+                        tab->setDropDownStateChangedCallback(boost::bind(&LLPanelEditWearable::onTabExpandedCollapsed,this,_2,index));
+                }
+
+                // initialize texture and color picker controls
+                for_each_picker_ctrl_entry <LLColorSwatchCtrl> (getPanel(type), type, boost::bind(init_color_swatch_ctrl, this, _1, _2));
+                for_each_picker_ctrl_entry <LLTextureCtrl>     (getPanel(type), type, boost::bind(init_texture_ctrl, this, _1, _2));
+        }
+
+        // init all strings
+        mMeters         = mPanelShape->getString("meters");
+        mFeet           = mPanelShape->getString("feet");
+        mHeigth         = mPanelShape->getString("height") + " ";
+        mHeigthValue    = "[HEIGHT] [METRIC1]";
+        mReplacementMetricUrl   = "[URL_METRIC2]";
+
+        std::string color = mPanelShape->getString("heigth_label_color");
+        mAvatarHeigthLabelColor = LLUIColorTable::instance().getColor(color, LLColor4::green);
+        color = mPanelShape->getString("heigth_value_label_color");
+        mAvatarHeigthValueLabelColor = LLUIColorTable::instance().getColor(color, LLColor4::green);
+        gSavedSettings.getControl("HeightUnits")->getSignal()->connect(boost::bind(&LLPanelEditWearable::changeHeightUnits, this, _2));
+        updateMetricLayout(gSavedSettings.getBOOL("HeightUnits"));
+
+        return TRUE;
 }
 
 // virtual 
 // LLUICtrl
 BOOL LLPanelEditWearable::isDirty() const
 {
-	BOOL isDirty = FALSE;
-	if (mWearablePtr)
-	{
-		if (mWearablePtr->isDirty() ||
-			mWearableItem->getName().compare(mNameEditor->getText()) != 0)
-		{
-			isDirty = TRUE;
-		}
-	}
-	return isDirty;
+        BOOL isDirty = FALSE;
+        if (mWearablePtr)
+        {
+                if (mWearablePtr->isDirty() ||
+                        mWearableItem->getName().compare(mNameEditor->getText()) != 0)
+                {
+                        isDirty = TRUE;
+                }
+        }
+        return isDirty;
 }
 //virtual
 void LLPanelEditWearable::draw()
 {
-	updateVerbs();
-	if (getWearable() && getWearable()->getType() == LLWearableType::WT_SHAPE)
-	{
-		//updating avatar height
-		updateTypeSpecificControls(LLWearableType::WT_SHAPE);
-	}
+        updateVerbs();
+        if (getWearable() && getWearable()->getType() == LLWearableType::WT_SHAPE)
+        {
+                //updating avatar height
+                updateTypeSpecificControls(LLWearableType::WT_SHAPE);
+        }
 
-	LLPanel::draw();
+        LLPanel::draw();
 }
 
 void LLPanelEditWearable::setVisible(BOOL visible)
 {
-	if (!visible)
-	{
-		showWearable(mWearablePtr, FALSE);
-	}
-	LLPanel::setVisible(visible);
+        if (!visible)
+        {
+                showWearable(mWearablePtr, FALSE);
+        }
+        LLPanel::setVisible(visible);
 }
 
 void LLPanelEditWearable::setWearable(LLWearable *wearable, BOOL disable_camera_switch)
 {
-	showWearable(mWearablePtr, FALSE, disable_camera_switch);
-	mWearablePtr = wearable;
-	showWearable(mWearablePtr, TRUE, disable_camera_switch);
+        showWearable(mWearablePtr, FALSE, disable_camera_switch);
+        mWearablePtr = wearable;
+        showWearable(mWearablePtr, TRUE, disable_camera_switch);
 }
 
 
 //static 
 void LLPanelEditWearable::onRevertButtonClicked(void* userdata)
 {
-	LLPanelEditWearable *panel = (LLPanelEditWearable*) userdata;
-	panel->revertChanges();
+        LLPanelEditWearable *panel = (LLPanelEditWearable*) userdata;
+        panel->revertChanges();
 }
 
 void LLPanelEditWearable::onSaveAsButtonClicked()
 {
-	LLSD args;
-	args["DESC"] = mNameEditor->getText();
+        LLSD args;
+        args["DESC"] = mNameEditor->getText();
 
-	LLNotificationsUtil::add("SaveWearableAs", args, LLSD(), boost::bind(&LLPanelEditWearable::saveAsCallback, this, _1, _2));
+        LLNotificationsUtil::add("SaveWearableAs", args, LLSD(), boost::bind(&LLPanelEditWearable::saveAsCallback, this, _1, _2));
 }
 
 void LLPanelEditWearable::saveAsCallback(const LLSD& notification, const LLSD& response)
 {
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if (0 == option)
-	{
-		std::string wearable_name = response["message"].asString();
-		LLStringUtil::trim(wearable_name);
-		if( !wearable_name.empty() )
-		{
-			mNameEditor->setText(wearable_name);
-			saveChanges(true);
-		}
-	}
+        S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+        if (0 == option)
+        {
+                std::string wearable_name = response["message"].asString();
+                LLStringUtil::trim(wearable_name);
+                if( !wearable_name.empty() )
+                {
+                        mNameEditor->setText(wearable_name);
+                        saveChanges(true);
+                }
+        }
 }
 
 void LLPanelEditWearable::onCommitSexChange()
 {
-	if (!isAgentAvatarValid()) return;
+        if (!isAgentAvatarValid()) return;
 
-	LLWearableType::EType type = mWearablePtr->getType();
-	U32 index = gAgentWearables.getWearableIndex(mWearablePtr);
+        LLWearableType::EType type = mWearablePtr->getType();
+        U32 index = gAgentWearables.getWearableIndex(mWearablePtr);
 
-	if( !gAgentWearables.isWearableModifiable(type, index))
-	{
-		return;
-	}
+        if( !gAgentWearables.isWearableModifiable(type, index))
+        {
+                return;
+        }
 
-	LLViewerVisualParam* param = static_cast<LLViewerVisualParam*>(gAgentAvatarp->getVisualParam( "male" ));
-	if( !param )
-	{
-		return;
-	}
+        LLViewerVisualParam* param = static_cast<LLViewerVisualParam*>(gAgentAvatarp->getVisualParam( "male" ));
+        if( !param )
+        {
+                return;
+        }
 
-	bool is_new_sex_male = (gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE) == SEX_MALE;
-	LLWearable*	wearable = gAgentWearables.getWearable(type, index);
-	if (wearable)
-	{
-		wearable->setVisualParamWeight(param->getID(), is_new_sex_male, FALSE);
-	}
-	param->setWeight( is_new_sex_male, FALSE );
+        bool is_new_sex_male = (gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE) == SEX_MALE;
+        LLWearable*     wearable = gAgentWearables.getWearable(type, index);
+        if (wearable)
+        {
+                wearable->setVisualParamWeight(param->getID(), is_new_sex_male, FALSE);
+        }
+        param->setWeight( is_new_sex_male, FALSE );
 
-	gAgentAvatarp->updateSexDependentLayerSets( FALSE );
+        gAgentAvatarp->updateSexDependentLayerSets( FALSE );
 
-	gAgentAvatarp->updateVisualParams();
+        gAgentAvatarp->updateVisualParams();
 
-	updateScrollingPanelUI();
+        updateScrollingPanelUI();
 }
 
 void LLPanelEditWearable::onTexturePickerCommit(const LLUICtrl* ctrl)
 {
-	const LLTextureCtrl* texture_ctrl = dynamic_cast<const LLTextureCtrl*>(ctrl);
-	if (!texture_ctrl)
-	{
-		llwarns << "got commit signal from not LLTextureCtrl." << llendl;
-		return;
-	}
-
-	if (getWearable())
-	{
-		LLWearableType::EType type = getWearable()->getType();
-		const PickerControlEntryNamePredicate name_pred(texture_ctrl->getName());
-		const LLEditWearableDictionary::PickerControlEntry* entry
-			= find_picker_ctrl_entry_if<LLTextureCtrl, PickerControlEntryNamePredicate>(type, name_pred);
-		if (entry)
-		{
-			// Set the new version
-			LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(texture_ctrl->getImageAssetID());
-			if( image->getID() == IMG_DEFAULT )
-			{
-				image = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
-			}
-			if (getWearable())
-			{
-				U32 index = gAgentWearables.getWearableIndex(getWearable());
-				gAgentAvatarp->setLocalTexture(entry->mTextureIndex, image, FALSE, index);
-				LLVisualParamHint::requestHintUpdates();
-				gAgentAvatarp->wearableUpdated(type, FALSE);
-			}
-		}
-		else
-		{
-			llwarns << "could not get texture picker dictionary entry for wearable of type: " << type << llendl;
-		}
-	}
+        const LLTextureCtrl* texture_ctrl = dynamic_cast<const LLTextureCtrl*>(ctrl);
+        if (!texture_ctrl)
+        {
+                llwarns << "got commit signal from not LLTextureCtrl." << llendl;
+                return;
+        }
+
+        if (getWearable())
+        {
+                LLWearableType::EType type = getWearable()->getType();
+                const PickerControlEntryNamePredicate name_pred(texture_ctrl->getName());
+                const LLEditWearableDictionary::PickerControlEntry* entry
+                        = find_picker_ctrl_entry_if<LLTextureCtrl, PickerControlEntryNamePredicate>(type, name_pred);
+                if (entry)
+                {
+                        // Set the new version
+                        LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(texture_ctrl->getImageAssetID());
+                        if( image->getID() == IMG_DEFAULT )
+                        {
+                                image = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
+                        }
+                        if (getWearable())
+                        {
+                                U32 index = gAgentWearables.getWearableIndex(getWearable());
+                                gAgentAvatarp->setLocalTexture(entry->mTextureIndex, image, FALSE, index);
+                                LLVisualParamHint::requestHintUpdates();
+                                gAgentAvatarp->wearableUpdated(type, FALSE);
+                        }
+                }
+                else
+                {
+                        llwarns << "could not get texture picker dictionary entry for wearable of type: " << type << llendl;
+                }
+        }
 }
 
 void LLPanelEditWearable::onColorSwatchCommit(const LLUICtrl* ctrl)
 {
-	if (getWearable())
-	{
-		LLWearableType::EType type = getWearable()->getType();
-		const PickerControlEntryNamePredicate name_pred(ctrl->getName());
-		const LLEditWearableDictionary::PickerControlEntry* entry
-			= find_picker_ctrl_entry_if<LLColorSwatchCtrl, PickerControlEntryNamePredicate>(type, name_pred);
-		if (entry)
-		{
-			const LLColor4& old_color = getWearable()->getClothesColor(entry->mTextureIndex);
-			const LLColor4& new_color = LLColor4(ctrl->getValue());
-			if( old_color != new_color )
-			{
-				getWearable()->setClothesColor(entry->mTextureIndex, new_color, TRUE);
-				LLVisualParamHint::requestHintUpdates();
-				gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
-			}
-		}
-		else
-		{
-			llwarns << "could not get color swatch dictionary entry for wearable of type: " << type << llendl;
-		}
-	}
+        if (getWearable())
+        {
+                LLWearableType::EType type = getWearable()->getType();
+                const PickerControlEntryNamePredicate name_pred(ctrl->getName());
+                const LLEditWearableDictionary::PickerControlEntry* entry
+                        = find_picker_ctrl_entry_if<LLColorSwatchCtrl, PickerControlEntryNamePredicate>(type, name_pred);
+                if (entry)
+                {
+                        const LLColor4& old_color = getWearable()->getClothesColor(entry->mTextureIndex);
+                        const LLColor4& new_color = LLColor4(ctrl->getValue());
+                        if( old_color != new_color )
+                        {
+                                getWearable()->setClothesColor(entry->mTextureIndex, new_color, TRUE);
+                                LLVisualParamHint::requestHintUpdates();
+                                gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
+                        }
+                }
+                else
+                {
+                        llwarns << "could not get color swatch dictionary entry for wearable of type: " << type << llendl;
+                }
+        }
 }
 
 void LLPanelEditWearable::updatePanelPickerControls(LLWearableType::EType type)
 {
-	LLPanel* panel = getPanel(type);
-	if (!panel)
-		return;
-
-	bool is_modifiable = false;
-	bool is_copyable   = false;
-
-	if(mWearableItem)
-	{
-		const LLPermissions& perm = mWearableItem->getPermissions();
-		is_modifiable = perm.allowModifyBy(gAgent.getID(), gAgent.getGroupID());
-		is_copyable = perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID());
-	}
-
-	if (is_modifiable)
-	{
-		// Update picker controls
-		for_each_picker_ctrl_entry <LLColorSwatchCtrl> (panel, type, boost::bind(update_color_swatch_ctrl, this, _1, _2));
-		for_each_picker_ctrl_entry <LLTextureCtrl>     (panel, type, boost::bind(update_texture_ctrl, this, _1, _2));
-	}
-	else
-	{
-		// Disable controls
-		for_each_picker_ctrl_entry <LLColorSwatchCtrl> (panel, type, boost::bind(set_enabled_color_swatch_ctrl, false, _1, _2));
-		for_each_picker_ctrl_entry <LLTextureCtrl>     (panel, type, boost::bind(set_enabled_texture_ctrl, false, _1, _2));
-	}
+        LLPanel* panel = getPanel(type);
+        if (!panel)
+                return;
+
+        bool is_modifiable = false;
+        bool is_copyable   = false;
+
+        if(mWearableItem)
+        {
+                const LLPermissions& perm = mWearableItem->getPermissions();
+                is_modifiable = perm.allowModifyBy(gAgent.getID(), gAgent.getGroupID());
+                is_copyable = perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID());
+        }
+
+        if (is_modifiable)
+        {
+                // Update picker controls
+                for_each_picker_ctrl_entry <LLColorSwatchCtrl> (panel, type, boost::bind(update_color_swatch_ctrl, this, _1, _2));
+                for_each_picker_ctrl_entry <LLTextureCtrl>     (panel, type, boost::bind(update_texture_ctrl, this, _1, _2));
+        }
+        else
+        {
+                // Disable controls
+                for_each_picker_ctrl_entry <LLColorSwatchCtrl> (panel, type, boost::bind(set_enabled_color_swatch_ctrl, false, _1, _2));
+                for_each_picker_ctrl_entry <LLTextureCtrl>     (panel, type, boost::bind(set_enabled_texture_ctrl, false, _1, _2));
+        }
 }
 
 void LLPanelEditWearable::saveChanges(bool force_save_as)
 {
-	if (!mWearablePtr || !isDirty())
-	{
-		// do nothing if no unsaved changes
-		return;
-	}
-
-	U32 index = gAgentWearables.getWearableIndex(mWearablePtr);
-
-	std::string new_name = mNameEditor->getText();
-	if (force_save_as)
-	{
-		// the name of the wearable has changed, re-save wearable with new name
-		LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID(),false);
-		gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE);
-		mNameEditor->setText(mWearableItem->getName());
-	}
-	else
-	{
-		gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name);
-	}
+        if (!mWearablePtr || !isDirty())
+        {
+                // do nothing if no unsaved changes
+                return;
+        }
+
+        U32 index = gAgentWearables.getWearableIndex(mWearablePtr);
+
+        std::string new_name = mNameEditor->getText();
+        if (force_save_as)
+        {
+                // the name of the wearable has changed, re-save wearable with new name
+                LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID(),false);
+                gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE);
+                mNameEditor->setText(mWearableItem->getName());
+        }
+        else
+        {
+                gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name);
+        }
 }
 
 void LLPanelEditWearable::revertChanges()
 {
-	if (!mWearablePtr || !isDirty())
-	{
-		// no unsaved changes to revert
-		return;
-	}
-
-	mWearablePtr->revertValues();
-	mNameEditor->setText(mWearableItem->getName());
-	updatePanelPickerControls(mWearablePtr->getType());
-	updateTypeSpecificControls(mWearablePtr->getType());
-	gAgentAvatarp->wearableUpdated(mWearablePtr->getType(), FALSE);
+        if (!mWearablePtr || !isDirty())
+        {
+                // no unsaved changes to revert
+                return;
+        }
+
+        mWearablePtr->revertValues();
+        mNameEditor->setText(mWearableItem->getName());
+        updatePanelPickerControls(mWearablePtr->getType());
+        updateTypeSpecificControls(mWearablePtr->getType());
+        gAgentAvatarp->wearableUpdated(mWearablePtr->getType(), FALSE);
 }
 
 void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show, BOOL disable_camera_switch)
 {
-	if (!wearable)
-	{
-		return;
-	}
-
-	mWearableItem = gInventory.getItem(mWearablePtr->getItemID());
-	llassert(mWearableItem);
-
-	LLWearableType::EType type = wearable->getType();
-	LLPanel *targetPanel = NULL;
-	std::string title;
-	std::string description_title;
-
-	const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
-	if (!wearable_entry)
-	{
-		llwarns << "called LLPanelEditWearable::showWearable with an invalid wearable type! (" << type << ")" << llendl;
-		return;
-	}
-
-	targetPanel = getPanel(type);
-	title = getString(wearable_entry->mTitle);
-	description_title = getString(wearable_entry->mDescTitle);
-
-	// Update picker controls state
-	for_each_picker_ctrl_entry <LLColorSwatchCtrl> (targetPanel, type, boost::bind(set_enabled_color_swatch_ctrl, show, _1, _2));
-	for_each_picker_ctrl_entry <LLTextureCtrl>     (targetPanel, type, boost::bind(set_enabled_texture_ctrl, show, _1, _2));
-
-	targetPanel->setVisible(show);
-	toggleTypeSpecificControls(type);
-
-	if (show)
-	{
-		mPanelTitle->setText(title);
-		mPanelTitle->setToolTip(title);
-		mDescTitle->setText(description_title);
-		
-		// set name
-		mNameEditor->setText(mWearableItem->getName());
-
-		updatePanelPickerControls(type);
-		updateTypeSpecificControls(type);
-
-		// clear and rebuild visual param list
-		U8 num_subparts = wearable_entry->mSubparts.size();
-	
-		for (U8 index = 0; index < num_subparts; ++index)
-		{
-			// dive into data structures to get the panel we need
-			ESubpart subpart_e = wearable_entry->mSubparts[index];
-			const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
-	
-			if (!subpart_entry)
-			{
-				llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
-				continue;
-			}
-	
-			const std::string scrolling_panel = subpart_entry->mParamList;
-			const std::string accordion_tab = subpart_entry->mAccordionTab;
-	
-			LLScrollingPanelList *panel_list = getChild<LLScrollingPanelList>(scrolling_panel);
-			LLAccordionCtrlTab *tab = getChild<LLAccordionCtrlTab>(accordion_tab);
-	
-			if (!panel_list)
-			{
-				llwarns << "could not get scrolling panel list: " << scrolling_panel << llendl;
-				continue;
-			}
-	
-			if (!tab)
-			{
-				llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl;
-				continue;
-			}
-	
-			// what edit group do we want to extract params for?
-			const std::string edit_group = subpart_entry->mEditGroup;
-	
-			// storage for ordered list of visual params
-			value_map_t sorted_params;
-			getSortedParams(sorted_params, edit_group);
-
-			LLJoint* jointp = gAgentAvatarp->getJoint( subpart_entry->mTargetJoint );
-			if (!jointp)
-			{
-				jointp = gAgentAvatarp->getJoint("mHead");
-			}
-
-			buildParamList(panel_list, sorted_params, tab, jointp);
-	
-			updateScrollingPanelUI();
-		}
-		if (!disable_camera_switch)
-		{
-			showDefaultSubpart();
-		}
-
-		updateVerbs();
-	}
+        if (!wearable)
+        {
+                return;
+        }
+
+        mWearableItem = gInventory.getItem(mWearablePtr->getItemID());
+        llassert(mWearableItem);
+
+        LLWearableType::EType type = wearable->getType();
+        LLPanel *targetPanel = NULL;
+        std::string title;
+        std::string description_title;
+
+        const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
+        if (!wearable_entry)
+        {
+                llwarns << "called LLPanelEditWearable::showWearable with an invalid wearable type! (" << type << ")" << llendl;
+                return;
+        }
+
+        targetPanel = getPanel(type);
+        title = getString(wearable_entry->mTitle);
+        description_title = getString(wearable_entry->mDescTitle);
+
+        // Update picker controls state
+        for_each_picker_ctrl_entry <LLColorSwatchCtrl> (targetPanel, type, boost::bind(set_enabled_color_swatch_ctrl, show, _1, _2));
+        for_each_picker_ctrl_entry <LLTextureCtrl>     (targetPanel, type, boost::bind(set_enabled_texture_ctrl, show, _1, _2));
+
+        targetPanel->setVisible(show);
+        toggleTypeSpecificControls(type);
+
+        if (show)
+        {
+                mPanelTitle->setText(title);
+                mPanelTitle->setToolTip(title);
+                mDescTitle->setText(description_title);
+                
+                // set name
+                mNameEditor->setText(mWearableItem->getName());
+
+                updatePanelPickerControls(type);
+                updateTypeSpecificControls(type);
+
+                // clear and rebuild visual param list
+                U8 num_subparts = wearable_entry->mSubparts.size();
+        
+                for (U8 index = 0; index < num_subparts; ++index)
+                {
+                        // dive into data structures to get the panel we need
+                        ESubpart subpart_e = wearable_entry->mSubparts[index];
+                        const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
+        
+                        if (!subpart_entry)
+                        {
+                                llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
+                                continue;
+                        }
+        
+                        const std::string scrolling_panel = subpart_entry->mParamList;
+                        const std::string accordion_tab = subpart_entry->mAccordionTab;
+        
+                        LLScrollingPanelList *panel_list = getChild<LLScrollingPanelList>(scrolling_panel);
+                        LLAccordionCtrlTab *tab = getChild<LLAccordionCtrlTab>(accordion_tab);
+        
+                        if (!panel_list)
+                        {
+                                llwarns << "could not get scrolling panel list: " << scrolling_panel << llendl;
+                                continue;
+                        }
+        
+                        if (!tab)
+                        {
+                                llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl;
+                                continue;
+                        }
+        
+                        // what edit group do we want to extract params for?
+                        const std::string edit_group = subpart_entry->mEditGroup;
+        
+                        // storage for ordered list of visual params
+                        value_map_t sorted_params;
+                        getSortedParams(sorted_params, edit_group);
+
+                        LLJoint* jointp = gAgentAvatarp->getJoint( subpart_entry->mTargetJoint );
+                        if (!jointp)
+                        {
+                                jointp = gAgentAvatarp->getJoint("mHead");
+                        }
+
+                        buildParamList(panel_list, sorted_params, tab, jointp);
+        
+                        updateScrollingPanelUI();
+                }
+                if (!disable_camera_switch)
+                {
+                        showDefaultSubpart();
+                }
+
+                updateVerbs();
+        }
 }
 
 void LLPanelEditWearable::showDefaultSubpart()
 {
-	changeCamera(3);
+        changeCamera(3);
 }
 
 void LLPanelEditWearable::onTabExpandedCollapsed(const LLSD& param, U8 index)
 {
-	bool expanded = param.asBoolean();
+        bool expanded = param.asBoolean();
 
-	if (!mWearablePtr || !gAgentCamera.cameraCustomizeAvatar())
-	{
-		// we don't have a valid wearable we're editing, or we've left the wearable editor
-		return;
-	}
+        if (!mWearablePtr || !gAgentCamera.cameraCustomizeAvatar())
+        {
+                // we don't have a valid wearable we're editing, or we've left the wearable editor
+                return;
+        }
 
-	if (expanded)
-	{
-		changeCamera(index);
-	}
+        if (expanded)
+        {
+                changeCamera(index);
+        }
 
 }
 
 void LLPanelEditWearable::changeCamera(U8 subpart)
 {
-	const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mWearablePtr->getType());
-	if (!wearable_entry)
-	{
-		llinfos << "could not get wearable dictionary entry for wearable type: " << mWearablePtr->getType() << llendl;
-		return;
-	}
-
-	if (subpart >= wearable_entry->mSubparts.size())
-	{
-		llinfos << "accordion tab expanded for invalid subpart. Wearable type: " << mWearablePtr->getType() << " subpart num: " << subpart << llendl;
-		return;
-	}
-
-	ESubpart subpart_e = wearable_entry->mSubparts[subpart];
-	const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
-
-	if (!subpart_entry)
-	{
-		llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
-		return;
-	}
-
-	// Update the camera
-	gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( subpart_entry->mTargetJoint ) );
-	gMorphView->setCameraTargetOffset( subpart_entry->mTargetOffset );
-	gMorphView->setCameraOffset( subpart_entry->mCameraOffset );
-	if (gSavedSettings.getBOOL("AppearanceCameraMovement"))
-	{
-		gMorphView->updateCamera();
-	}
+        const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mWearablePtr->getType());
+        if (!wearable_entry)
+        {
+                llinfos << "could not get wearable dictionary entry for wearable type: " << mWearablePtr->getType() << llendl;
+                return;
+        }
+
+        if (subpart >= wearable_entry->mSubparts.size())
+        {
+                llinfos << "accordion tab expanded for invalid subpart. Wearable type: " << mWearablePtr->getType() << " subpart num: " << subpart << llendl;
+                return;
+        }
+
+        ESubpart subpart_e = wearable_entry->mSubparts[subpart];
+        const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
+
+        if (!subpart_entry)
+        {
+                llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
+                return;
+        }
+
+        // Update the camera
+        gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( subpart_entry->mTargetJoint ) );
+        gMorphView->setCameraTargetOffset( subpart_entry->mTargetOffset );
+        gMorphView->setCameraOffset( subpart_entry->mCameraOffset );
+        if (gSavedSettings.getBOOL("AppearanceCameraMovement"))
+        {
+                gMorphView->updateCamera();
+        }
 }
 
 void LLPanelEditWearable::updateScrollingPanelList()
 {
-	updateScrollingPanelUI();
+        updateScrollingPanelUI();
 }
 
 void LLPanelEditWearable::toggleTypeSpecificControls(LLWearableType::EType type)
 {
-	// Toggle controls specific to shape editing panel.
-	{
-		bool is_shape = (type == LLWearableType::WT_SHAPE);
-		getChildView("sex_radio")->setVisible( is_shape);
-		getChildView("female_icon")->setVisible( is_shape);
-		getChildView("male_icon")->setVisible( is_shape);
-	}
+        // Toggle controls specific to shape editing panel.
+        {
+                bool is_shape = (type == LLWearableType::WT_SHAPE);
+                getChildView("sex_radio")->setVisible( is_shape);
+                getChildView("female_icon")->setVisible( is_shape);
+                getChildView("male_icon")->setVisible( is_shape);
+        }
 }
 
 void LLPanelEditWearable::updateTypeSpecificControls(LLWearableType::EType type)
 {
-	const F32 ONE_METER = 1.0;
-	const F32 ONE_FOOT = 0.3048 * ONE_METER; // in meters
-	// Update controls specific to shape editing panel.
-	if (type == LLWearableType::WT_SHAPE)
-	{
-		// Update avatar height
-		F32 new_size = gAgentAvatarp->mBodySize.mV[VZ];
-		if (gSavedSettings.getBOOL("HeightUnits") == FALSE)
-		{
-			// convert meters to feet
-			new_size = new_size / ONE_FOOT;
-		}
-
-		std::string avatar_height_str = llformat("%.2f", new_size);
-		mHeigthValue.setArg("[HEIGHT]", avatar_height_str);
-		updateAvatarHeightLabel();
-	}
-
-	if (LLWearableType::WT_ALPHA == type)
-	{
-		updateAlphaCheckboxes();
-
-		initPreviousAlphaTextures();
-	}
+        const F32 ONE_METER = 1.0;
+        const F32 ONE_FOOT = 0.3048 * ONE_METER; // in meters
+        // Update controls specific to shape editing panel.
+        if (type == LLWearableType::WT_SHAPE)
+        {
+                // Update avatar height
+                F32 new_size = gAgentAvatarp->mBodySize.mV[VZ];
+                if (gSavedSettings.getBOOL("HeightUnits") == FALSE)
+                {
+                        // convert meters to feet
+                        new_size = new_size / ONE_FOOT;
+                }
+
+                std::string avatar_height_str = llformat("%.2f", new_size);
+                mHeigthValue.setArg("[HEIGHT]", avatar_height_str);
+                updateAvatarHeightLabel();
+        }
+
+        if (LLWearableType::WT_ALPHA == type)
+        {
+                updateAlphaCheckboxes();
+
+                initPreviousAlphaTextures();
+        }
 }
 
 void LLPanelEditWearable::updateScrollingPanelUI()
 {
-	// do nothing if we don't have a valid wearable we're editing
-	if (mWearablePtr == NULL)
-	{
-		return;
-	}
-
-	LLWearableType::EType type = mWearablePtr->getType();
-	LLPanel *panel = getPanel(type);
-
-	if(panel && (mWearablePtr->getItemID().notNull()))
-	{
-		const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
-		llassert(wearable_entry);
-		if (!wearable_entry) return;
-		U8 num_subparts = wearable_entry->mSubparts.size();
-
-		LLScrollingPanelParam::sUpdateDelayFrames = 0;
-		for (U8 index = 0; index < num_subparts; ++index)
-		{
-			// dive into data structures to get the panel we need
-			ESubpart subpart_e = wearable_entry->mSubparts[index];
-			const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
-
-			const std::string scrolling_panel = subpart_entry->mParamList;
-
-			LLScrollingPanelList *panel_list = getChild<LLScrollingPanelList>(scrolling_panel);
-	
-			if (!panel_list)
-			{
-				llwarns << "could not get scrolling panel list: " << scrolling_panel << llendl;
-				continue;
-			}
-			
-			panel_list->updatePanels(TRUE);
-		}
-	}
+        // do nothing if we don't have a valid wearable we're editing
+        if (mWearablePtr == NULL)
+        {
+                return;
+        }
+
+        LLWearableType::EType type = mWearablePtr->getType();
+        LLPanel *panel = getPanel(type);
+
+        if(panel && (mWearablePtr->getItemID().notNull()))
+        {
+                const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type);
+                llassert(wearable_entry);
+                if (!wearable_entry) return;
+                U8 num_subparts = wearable_entry->mSubparts.size();
+
+                LLScrollingPanelParam::sUpdateDelayFrames = 0;
+                for (U8 index = 0; index < num_subparts; ++index)
+                {
+                        // dive into data structures to get the panel we need
+                        ESubpart subpart_e = wearable_entry->mSubparts[index];
+                        const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
+
+                        const std::string scrolling_panel = subpart_entry->mParamList;
+
+                        LLScrollingPanelList *panel_list = getChild<LLScrollingPanelList>(scrolling_panel);
+        
+                        if (!panel_list)
+                        {
+                                llwarns << "could not get scrolling panel list: " << scrolling_panel << llendl;
+                                continue;
+                        }
+                        
+                        panel_list->updatePanels(TRUE);
+                }
+        }
 }
 
 LLPanel* LLPanelEditWearable::getPanel(LLWearableType::EType type)
 {
-	switch (type)
-	{
-		case LLWearableType::WT_SHAPE:
-			return mPanelShape;
-			break;
+        switch (type)
+        {
+                case LLWearableType::WT_SHAPE:
+                        return mPanelShape;
+                        break;
 
-		case LLWearableType::WT_SKIN:
-			return mPanelSkin;
-			break;
+                case LLWearableType::WT_SKIN:
+                        return mPanelSkin;
+                        break;
 
-		case LLWearableType::WT_HAIR:
-			return mPanelHair;
-			break;
+                case LLWearableType::WT_HAIR:
+                        return mPanelHair;
+                        break;
 
-		case LLWearableType::WT_EYES:
-			return mPanelEyes;
-			break;
+                case LLWearableType::WT_EYES:
+                        return mPanelEyes;
+                        break;
 
-		case LLWearableType::WT_SHIRT:
-			return mPanelShirt;
-			break;
+                case LLWearableType::WT_SHIRT:
+                        return mPanelShirt;
+                        break;
 
-		case LLWearableType::WT_PANTS:
-			return mPanelPants;
-			break;
+                case LLWearableType::WT_PANTS:
+                        return mPanelPants;
+                        break;
 
-		case LLWearableType::WT_SHOES:
-			return mPanelShoes;
-			break;
+                case LLWearableType::WT_SHOES:
+                        return mPanelShoes;
+                        break;
 
-		case LLWearableType::WT_SOCKS:
-			return mPanelSocks;
-			break;
+                case LLWearableType::WT_SOCKS:
+                        return mPanelSocks;
+                        break;
 
-		case LLWearableType::WT_JACKET:
-			return mPanelJacket;
-			break;
+                case LLWearableType::WT_JACKET:
+                        return mPanelJacket;
+                        break;
 
-		case LLWearableType::WT_GLOVES:
-			return mPanelGloves;
-			break;
+                case LLWearableType::WT_GLOVES:
+                        return mPanelGloves;
+                        break;
 
-		case LLWearableType::WT_UNDERSHIRT:
-			return mPanelUndershirt;
-			break;
+                case LLWearableType::WT_UNDERSHIRT:
+                        return mPanelUndershirt;
+                        break;
 
-		case LLWearableType::WT_UNDERPANTS:
-			return mPanelUnderpants;
-			break;
+                case LLWearableType::WT_UNDERPANTS:
+                        return mPanelUnderpants;
+                        break;
 
-		case LLWearableType::WT_SKIRT:
-			return mPanelSkirt;
-			break;
+                case LLWearableType::WT_SKIRT:
+                        return mPanelSkirt;
+                        break;
 
-		case LLWearableType::WT_ALPHA:
-			return mPanelAlpha;
-			break;
+                case LLWearableType::WT_ALPHA:
+                        return mPanelAlpha;
+                        break;
 
-		case LLWearableType::WT_TATTOO:
-			return mPanelTattoo;
-			break;
+                case LLWearableType::WT_TATTOO:
+                        return mPanelTattoo;
+                        break;
 
-		case LLWearableType::WT_PHYSICS:
-			return mPanelPhysics;
-			break;
+                case LLWearableType::WT_PHYSICS:
+                        return mPanelPhysics;
+                        break;
 
-		default:
-			break;
-	}
-	return NULL;
+                default:
+                        break;
+        }
+        return NULL;
 }
 
 void LLPanelEditWearable::getSortedParams(value_map_t &sorted_params, const std::string &edit_group)
 {
-	LLWearable::visual_param_vec_t param_list;
-	ESex avatar_sex = gAgentAvatarp->getSex();
-
-	mWearablePtr->getVisualParams(param_list);
-
-	for (LLWearable::visual_param_vec_t::iterator iter = param_list.begin();
-		iter != param_list.end();
-		++iter)
-	{
-		LLViewerVisualParam *param = (LLViewerVisualParam*) *iter;
-
-		if (param->getID() == -1 
-			|| !param->isTweakable()
-			|| param->getEditGroup() != edit_group 
-			|| !(param->getSex() & avatar_sex))
-		{
-			continue;
-		}
-
-		value_map_t::value_type vt(-param->getDisplayOrder(), param);
-		llassert( sorted_params.find(-param->getDisplayOrder()) == sorted_params.end() ); //check for duplicates
-		sorted_params.insert(vt);
-	}
+        LLWearable::visual_param_vec_t param_list;
+        ESex avatar_sex = gAgentAvatarp->getSex();
+
+        mWearablePtr->getVisualParams(param_list);
+
+        for (LLWearable::visual_param_vec_t::iterator iter = param_list.begin();
+                iter != param_list.end();
+                ++iter)
+        {
+                LLViewerVisualParam *param = (LLViewerVisualParam*) *iter;
+
+                if (param->getID() == -1 
+                        || !param->isTweakable()
+                        || param->getEditGroup() != edit_group 
+                        || !(param->getSex() & avatar_sex))
+                {
+                        continue;
+                }
+
+                value_map_t::value_type vt(-param->getDisplayOrder(), param);
+                llassert( sorted_params.find(-param->getDisplayOrder()) == sorted_params.end() ); //check for duplicates
+                sorted_params.insert(vt);
+        }
 }
 
 void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab, LLJoint* jointp)
 {
-	// sorted_params is sorted according to magnitude of effect from
-	// least to greatest.  Adding to the front of the child list
-	// reverses that order.
-	if( panel_list )
-	{
-		panel_list->clearPanels();
-		value_map_t::iterator end = sorted_params.end();
-		S32 height = 0;
-		for(value_map_t::iterator it = sorted_params.begin(); it != end; ++it)
-		{
-			LLPanel::Params p;
-			p.name("LLScrollingPanelParam");
-			LLWearable *wearable = this->getWearable();
-			LLScrollingPanelParamBase *panel_param = NULL;
-			if (wearable && wearable->getType() == LLWearableType::WT_PHYSICS) // Hack to show a different panel for physics.  Should generalize this later.
-			{
-				panel_param = new LLScrollingPanelParamBase( p, NULL, (*it).second, TRUE, this->getWearable(), jointp);
-			}
-			else
-			{
-				panel_param = new LLScrollingPanelParam( p, NULL, (*it).second, TRUE, this->getWearable(), jointp);
-			}
-			height = panel_list->addPanel( panel_param );
-		}
-	}
+        // sorted_params is sorted according to magnitude of effect from
+        // least to greatest.  Adding to the front of the child list
+        // reverses that order.
+        if( panel_list )
+        {
+                panel_list->clearPanels();
+                value_map_t::iterator end = sorted_params.end();
+                S32 height = 0;
+                for(value_map_t::iterator it = sorted_params.begin(); it != end; ++it)
+                {
+                        LLPanel::Params p;
+                        p.name("LLScrollingPanelParam");
+                        LLWearable *wearable = this->getWearable();
+                        LLScrollingPanelParamBase *panel_param = NULL;
+                        if (wearable && wearable->getType() == LLWearableType::WT_PHYSICS) // Hack to show a different panel for physics.  Should generalize this later.
+                        {
+                                panel_param = new LLScrollingPanelParamBase( p, NULL, (*it).second, TRUE, this->getWearable(), jointp);
+                        }
+                        else
+                        {
+                                panel_param = new LLScrollingPanelParam( p, NULL, (*it).second, TRUE, this->getWearable(), jointp);
+                        }
+                        height = panel_list->addPanel( panel_param );
+                }
+        }
 }
 
 void LLPanelEditWearable::updateVerbs()
 {
-	bool can_copy = false;
+        bool can_copy = false;
 
-	if(mWearableItem)
-	{
-		can_copy = mWearableItem->getPermissions().allowCopyBy(gAgentID);
-	}
+        if(mWearableItem)
+        {
+                can_copy = mWearableItem->getPermissions().allowCopyBy(gAgentID);
+        }
 
-	BOOL is_dirty = isDirty();
+        BOOL is_dirty = isDirty();
 
-	mBtnRevert->setEnabled(is_dirty);
-	getChildView("save_as_button")->setEnabled(is_dirty && can_copy);
+        mBtnRevert->setEnabled(is_dirty);
+        getChildView("save_as_button")->setEnabled(is_dirty && can_copy);
 
-	if(isAgentAvatarValid())
-	{
-		// Update viewer's radio buttons (of RadioGroup with control_name="AvatarSex") of Avatar's gender
-		// with value from "AvatarSex" setting
-		gSavedSettings.setU32("AvatarSex", (gAgentAvatarp->getSex() == SEX_MALE) );
-	}
+        if(isAgentAvatarValid())
+        {
+                // Update viewer's radio buttons (of RadioGroup with control_name="AvatarSex") of Avatar's gender
+                // with value from "AvatarSex" setting
+                gSavedSettings.setU32("AvatarSex", (gAgentAvatarp->getSex() == SEX_MALE) );
+        }
 
-	// update back button and title according to dirty state.
-	static BOOL was_dirty = FALSE;
-	if (was_dirty != is_dirty) // to avoid redundant changes because this method is called from draw
-	{
-		static S32 label_width = mBtnBack->getFont()->getWidth(mBackBtnLabel);
-		const std::string& label = is_dirty ? mBackBtnLabel : LLStringUtil::null;
-		const S32 delta_width = is_dirty ? label_width : -label_width;
+        // update back button and title according to dirty state.
+        static BOOL was_dirty = FALSE;
+        if (was_dirty != is_dirty) // to avoid redundant changes because this method is called from draw
+        {
+                static S32 label_width = mBtnBack->getFont()->getWidth(mBackBtnLabel);
+                const std::string& label = is_dirty ? mBackBtnLabel : LLStringUtil::null;
+                const S32 delta_width = is_dirty ? label_width : -label_width;
 
-		mBtnBack->setLabel(label);
+                mBtnBack->setLabel(label);
 
-		// update rect according to label width
-		LLRect rect = mBtnBack->getRect();
-		rect.mRight += delta_width;
-		mBtnBack->setShape(rect);
+                // update rect according to label width
+                LLRect rect = mBtnBack->getRect();
+                rect.mRight += delta_width;
+                mBtnBack->setShape(rect);
 
-		// update title rect according to back button width
-		rect = mPanelTitle->getRect();
-		rect.mLeft += delta_width;
-		mPanelTitle->setShape(rect);
+                // update title rect according to back button width
+                rect = mPanelTitle->getRect();
+                rect.mLeft += delta_width;
+                mPanelTitle->setShape(rect);
 
-		was_dirty = is_dirty;
-	}
+                was_dirty = is_dirty;
+        }
 }
 
 void LLPanelEditWearable::configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name)
 {
-	LLCheckBoxCtrl* checkbox = mPanelAlpha->getChild<LLCheckBoxCtrl>(name);
-	checkbox->setCommitCallback(boost::bind(&LLPanelEditWearable::onInvisibilityCommit, this, checkbox, te));
+        LLCheckBoxCtrl* checkbox = mPanelAlpha->getChild<LLCheckBoxCtrl>(name);
+        checkbox->setCommitCallback(boost::bind(&LLPanelEditWearable::onInvisibilityCommit, this, checkbox, te));
 
-	mAlphaCheckbox2Index[name] = te;
+        mAlphaCheckbox2Index[name] = te;
 }
 
 void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te)
 {
-	if (!checkbox_ctrl) return;
-	if (!getWearable()) return;
-
-	llinfos << "onInvisibilityCommit, self " << this << " checkbox_ctrl " << checkbox_ctrl << llendl;
-
-	bool new_invis_state = checkbox_ctrl->get();
-	if (new_invis_state)
-	{
-		LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te);
-		mPreviousAlphaTexture[te] = lto->getID();
-		
-		LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( IMG_INVISIBLE );
-		U32 index = gAgentWearables.getWearableIndex(getWearable());
-		gAgentAvatarp->setLocalTexture(te, image, FALSE, index);
-		gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
-	}
-	else
-	{
-		// Try to restore previous texture, if any.
-		LLUUID prev_id = mPreviousAlphaTexture[te];
-		if (prev_id.isNull() || (prev_id == IMG_INVISIBLE))
-		{
-			prev_id = LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) );
-		}
-		if (prev_id.isNull()) return;
-		
-		LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(prev_id);
-		if (!image) return;
-
-		U32 index = gAgentWearables.getWearableIndex(getWearable());
-		gAgentAvatarp->setLocalTexture(te, image, FALSE, index);
-		gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
-	}
-
-	updatePanelPickerControls(getWearable()->getType());
+        if (!checkbox_ctrl) return;
+        if (!getWearable()) return;
+
+        llinfos << "onInvisibilityCommit, self " << this << " checkbox_ctrl " << checkbox_ctrl << llendl;
+
+        bool new_invis_state = checkbox_ctrl->get();
+        if (new_invis_state)
+        {
+                LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te);
+                mPreviousAlphaTexture[te] = lto->getID();
+                
+                LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( IMG_INVISIBLE );
+                U32 index = gAgentWearables.getWearableIndex(getWearable());
+                gAgentAvatarp->setLocalTexture(te, image, FALSE, index);
+                gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
+        }
+        else
+        {
+                // Try to restore previous texture, if any.
+                LLUUID prev_id = mPreviousAlphaTexture[te];
+                if (prev_id.isNull() || (prev_id == IMG_INVISIBLE))
+                {
+                        prev_id = LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) );
+                }
+                if (prev_id.isNull()) return;
+                
+                LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(prev_id);
+                if (!image) return;
+
+                U32 index = gAgentWearables.getWearableIndex(getWearable());
+                gAgentAvatarp->setLocalTexture(te, image, FALSE, index);
+                gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
+        }
+
+        updatePanelPickerControls(getWearable()->getType());
 }
 
 void LLPanelEditWearable::updateAlphaCheckboxes()
 {
-	for(string_texture_index_map_t::iterator iter = mAlphaCheckbox2Index.begin();
-		iter != mAlphaCheckbox2Index.end(); ++iter )
-	{
-		LLVOAvatarDefines::ETextureIndex te = (LLVOAvatarDefines::ETextureIndex)iter->second;
-		LLCheckBoxCtrl* ctrl = mPanelAlpha->getChild<LLCheckBoxCtrl>(iter->first);
-		if (ctrl)
-		{
-			ctrl->set(!gAgentAvatarp->isTextureVisible(te, mWearablePtr));
-		}
-	}
+        for(string_texture_index_map_t::iterator iter = mAlphaCheckbox2Index.begin();
+                iter != mAlphaCheckbox2Index.end(); ++iter )
+        {
+                LLVOAvatarDefines::ETextureIndex te = (LLVOAvatarDefines::ETextureIndex)iter->second;
+                LLCheckBoxCtrl* ctrl = mPanelAlpha->getChild<LLCheckBoxCtrl>(iter->first);
+                if (ctrl)
+                {
+                        ctrl->set(!gAgentAvatarp->isTextureVisible(te, mWearablePtr));
+                }
+        }
 }
 
 void LLPanelEditWearable::initPreviousAlphaTextures()
 {
-	initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
-	initPreviousAlphaTextureEntry(TEX_UPPER_ALPHA);
-	initPreviousAlphaTextureEntry(TEX_HEAD_ALPHA);
-	initPreviousAlphaTextureEntry(TEX_EYES_ALPHA);
-	initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
+        initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
+        initPreviousAlphaTextureEntry(TEX_UPPER_ALPHA);
+        initPreviousAlphaTextureEntry(TEX_HEAD_ALPHA);
+        initPreviousAlphaTextureEntry(TEX_EYES_ALPHA);
+        initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
 }
 
 void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te)
 {
-	LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te);
-	if (lto)
-	{
-		mPreviousAlphaTexture[te] = lto->getID();
-	}
+        LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te);
+        if (lto)
+        {
+                mPreviousAlphaTexture[te] = lto->getID();
+        }
 }
 
 // handle secondlife:///app/metricsystem
 class LLMetricSystemHandler : public LLCommandHandler
 {
 public:
-	LLMetricSystemHandler() : LLCommandHandler("metricsystem", UNTRUSTED_THROTTLE) { }
-
-	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
-	{
-		// change height units TRUE for meters and FALSE for feet
-		BOOL new_value = (gSavedSettings.getBOOL("HeightUnits") == FALSE) ? TRUE : FALSE;
-		gSavedSettings.setBOOL("HeightUnits", new_value);
-		return true;
-	}
+        LLMetricSystemHandler() : LLCommandHandler("metricsystem", UNTRUSTED_THROTTLE) { }
+
+        bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
+        {
+                // change height units TRUE for meters and FALSE for feet
+                BOOL new_value = (gSavedSettings.getBOOL("HeightUnits") == FALSE) ? TRUE : FALSE;
+                gSavedSettings.setBOOL("HeightUnits", new_value);
+                return true;
+        }
 };
 
 LLMetricSystemHandler gMetricSystemHandler;
diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp
index 73de1cef3f432c9397e84d60d09c64ebd7eb457f..acf8973f03f76f65a9e2eda6e935f8251fb3534e 100644
--- a/indra/newview/llphysicsmotion.cpp
+++ b/indra/newview/llphysicsmotion.cpp
@@ -52,9 +52,9 @@ typedef std::map<std::string, F32> default_controller_map_t;
 
 inline F64 llsgn(const F64 a)
 {
-	if (a >= 0)
-		return 1;
-	return -1;
+        if (a >= 0)
+                return 1;
+        return -1;
 }
 
 /* 
@@ -71,161 +71,143 @@ inline F64 llsgn(const F64 a)
 class LLPhysicsMotion
 {
 public:
-	/*
-	  param_user_name: The param (if any) that the user sees and controls.  This is what
-	  the particular property would look like without physics.  For example, it may be
-	  the breast gravity.  This param's value should will not be altered, and is only
-	  used as a reference point for the rest position of the body party.  This is usually
-	  a driver param and the param(s) that physics is altering are the driven params.
-
-	  param_driven_name: The param whose value is actually set by the physics.  If you
-	  leave this blank (which should suffice normally), the physics will assume that
-	  param_user_name is a driver param and will set the params that the driver is
-	  in charge of (i.e. the "driven" params).
-
-	  joint_name: The joint that the body part is attached to.  The joint is
-	  used to determine the orientation (rotation) of the body part.
-
-	  character: The avatar that this physics affects.
-
-	  motion_direction_vec: The direction (in world coordinates) that determines the
-	  motion.  For example, (0,0,1) is up-down, and means that up-down motion is what
-	  determines how this joint moves.
-
-	  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,
-			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),
-		mJointName(joint_name),
-		mMotionDirectionVec(motion_direction_vec),
-		mParamUser(NULL),
-		mParamDriven(NULL),
-
-		mParamControllers(controllers),
-		mCharacter(character),
-		mLastTime(0),
-		mPosition_local(0),
-		mVelocityJoint_local(0),
-		mPositionLastUpdate_local(0)
-	{
-		mJointState = new LLJointState;
-	}
-
-	BOOL initialize();
-
-	~LLPhysicsMotion() {}
-
-	BOOL onUpdate(F32 time);
-
-	LLPointer<LLJointState> getJointState() 
-	{
-		return mJointState;
-	}
+        /*
+          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.
+
+          character: The avatar that this physics affects.
+
+          motion_direction_vec: The direction (in world coordinates) that determines the
+          motion.  For example, (0,0,1) is up-down, and means that up-down motion is what
+          determines how this joint moves.
+
+          controllers: The various settings (e.g. spring force, mass) that determine how
+          the body part behaves.
+        */
+        LLPhysicsMotion(const std::string &param_driver_name, 
+                        const std::string &joint_name,
+                        LLCharacter *character,
+                        const LLVector3 &motion_direction_vec,
+                        const controller_map_t &controllers) :
+                mParamDriverName(param_driver_name),
+                mJointName(joint_name),
+                mMotionDirectionVec(motion_direction_vec),
+                mParamDriver(NULL),
+                mParamControllers(controllers),
+                mCharacter(character),
+                mLastTime(0),
+                mPosition_local(0),
+                mVelocityJoint_local(0),
+                mPositionLastUpdate_local(0)
+        {
+                mJointState = new LLJointState;
+        }
+
+        BOOL initialize();
+
+        ~LLPhysicsMotion() {}
+
+        BOOL onUpdate(F32 time);
+
+        LLPointer<LLJointState> getJointState() 
+        {
+                return mJointState;
+        }
 protected:
-	F32 getParamValue(const std::string& controller_key)
-	{
-		const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key);
-		if (entry == mParamControllers.end())
-		{
-			return sDefaultController[controller_key];
-		}
-		const std::string& param_name = (*entry).second.c_str();
-		return mCharacter->getVisualParamWeight(param_name.c_str());
-	}
-	void setParamValue(LLViewerVisualParam *param,
-			   const F32 new_value_local);
-
-	F32 toLocal(const LLVector3 &world);
-	F32 calculateVelocity_local(const F32 time_delta);
-	F32 calculateAcceleration_local(F32 velocity_local,
-					const F32 time_delta);
+        F32 getParamValue(const std::string& controller_key)
+        {
+                const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key);
+                if (entry == mParamControllers.end())
+                {
+                        return sDefaultController[controller_key];
+                }
+                const std::string& param_name = (*entry).second.c_str();
+                return mCharacter->getVisualParamWeight(param_name.c_str());
+        }
+        void setParamValue(LLViewerVisualParam *param,
+                           const F32 new_value_local);
+
+        F32 toLocal(const LLVector3 &world);
+        F32 calculateVelocity_local(const F32 time_delta);
+        F32 calculateAcceleration_local(F32 velocity_local,
+                                        const F32 time_delta);
 private:
-	const std::string mParamDrivenName;
-	const std::string mParamUserName;
-	const LLVector3 mMotionDirectionVec;
-	const std::string mJointName;
-
-	F32 mPosition_local;
-	F32 mVelocityJoint_local; // How fast the joint is moving
-	F32 mAccelerationJoint_local; // Acceleration on the joint
-
-	F32 mVelocity_local; // How fast the param is moving
-	F32 mPositionLastUpdate_local;
-	LLVector3 mPosition_world;
-
-	LLViewerVisualParam *mParamUser;
-	LLViewerVisualParam *mParamDriven;
-	const controller_map_t mParamControllers;
-	
-	LLPointer<LLJointState> mJointState;
-	LLCharacter *mCharacter;
-
-	F32 mLastTime;
-	
-	static default_controller_map_t sDefaultController;
+        const std::string mParamDriverName;
+        const std::string mParamControllerName;
+        const LLVector3 mMotionDirectionVec;
+        const std::string mJointName;
+
+        F32 mPosition_local;
+        F32 mVelocityJoint_local; // How fast the joint is moving
+        F32 mAccelerationJoint_local; // Acceleration on the joint
+
+        F32 mVelocity_local; // How fast the param is moving
+        F32 mPositionLastUpdate_local;
+        LLVector3 mPosition_world;
+
+        LLViewerVisualParam *mParamDriver;
+        const controller_map_t mParamControllers;
+        
+        LLPointer<LLJointState> mJointState;
+        LLCharacter *mCharacter;
+
+        F32 mLastTime;
+        
+        static default_controller_map_t sDefaultController;
 };
 
 default_controller_map_t initDefaultController()
 {
-	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["Spring"] = 0.1f;
-	controller["Gain"] = 10.0f;
-	return controller;
+        default_controller_map_t controller;
+        controller["Mass"] = 0.2f;
+        controller["Gravity"] = 0.0f;
+        controller["Damping"] = .05f;
+        controller["Drag"] = 0.15f;
+        controller["MaxEffect"] = 0.1f;
+        controller["Spring"] = 0.1f;
+        controller["Gain"] = 10.0f;
+        return controller;
 }
 
 default_controller_map_t LLPhysicsMotion::sDefaultController = initDefaultController();
 
 BOOL LLPhysicsMotion::initialize()
 {
-	if (!mJointState->setJoint(mCharacter->getJoint(mJointName.c_str())))
-		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)
-	{
-		llinfos << "Failure reading in  [ " << mParamUserName << " ]" << llendl;
-		return FALSE;
-	}
-
-	return TRUE;
+        if (!mJointState->setJoint(mCharacter->getJoint(mJointName.c_str())))
+                return FALSE;
+        mJointState->setUsage(LLJointState::ROT);
+
+        mParamDriver = (LLViewerVisualParam*)mCharacter->getVisualParam(mParamDriverName.c_str());
+        if (mParamDriver == NULL)
+        {
+                llinfos << "Failure reading in  [ " << mParamDriverName << " ]" << llendl;
+                return FALSE;
+        }
+
+        return TRUE;
 }
 
 LLPhysicsMotionController::LLPhysicsMotionController(const LLUUID &id) : 
-	LLMotion(id),
-	mCharacter(NULL)
+        LLMotion(id),
+        mCharacter(NULL)
 {
-	mName = "breast_motion";
+        mName = "breast_motion";
 }
 
 LLPhysicsMotionController::~LLPhysicsMotionController()
 {
-	for (motion_vec_t::iterator iter = mMotions.begin();
-	     iter != mMotions.end();
-	     ++iter)
-	{
-		delete (*iter);
-	}
+        for (motion_vec_t::iterator iter = mMotions.begin();
+             iter != mMotions.end();
+             ++iter)
+        {
+                delete (*iter);
+        }
 }
 
 BOOL LLPhysicsMotionController::onActivate() 
 { 
-	return TRUE; 
+        return TRUE; 
 }
 
 void LLPhysicsMotionController::onDeactivate() 
@@ -234,465 +216,486 @@ void LLPhysicsMotionController::onDeactivate()
 
 LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter *character)
 {
-	mCharacter = character;
-
-	mMotions.clear();
-
-	// Breast Cleavage
-	{
-		controller_map_t controller;
-		controller["Mass"] = "Breast_Physics_Mass";
-		controller["Smoothing"] = "Breast_Physics_Smoothing";
-		controller["Gravity"] = "Breast_Physics_Gravity";
-		controller["Damping"] = "Breast_Physics_InOut_Damping";
-		controller["Drag"] = "Breast_Physics_InOut_Drag";
-		controller["MaxSpeed"] = "Breast_Physics_InOut_Max_Velocity";
-		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);
-		if (!motion->initialize())
-		{
-			llassert_always(FALSE);
-			return STATUS_FAILURE;
-		}
-		addMotion(motion);
-	}
-
-	// Breast Bounce
-	{
-		controller_map_t controller;
-		controller["Mass"] = "Breast_Physics_Mass";
-		controller["Smoothing"] = "Breast_Physics_Smoothing";
-		controller["Gravity"] = "Breast_Physics_Gravity";
-		controller["Damping"] = "Breast_Physics_UpDown_Damping";
-		controller["Drag"] = "Breast_Physics_UpDown_Drag";
-		controller["MaxSpeed"] = "Breast_Physics_UpDown_Max_Velocity";
-		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);
-		if (!motion->initialize())
-		{
-			llassert_always(FALSE);
-			return STATUS_FAILURE;
-		}
-		addMotion(motion);
-	}
-	
-	// Butt Bounce
-	{
-		controller_map_t controller;
-		controller["Mass"] = "Butt_Physics_Mass";
-		controller["Smoothing"] = "Butt_Physics_Smoothing";
-		controller["Gravity"] = "Butt_Physics_Gravity";
-		controller["Damping"] = "Butt_Physics_UpDown_Damping";
-		controller["Drag"] = "Butt_Physics_UpDown_Drag";
-		controller["MaxSpeed"] = "Butt_Physics_UpDown_Max_Velocity";
-		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);
-		if (!motion->initialize())
-		{
-			llassert_always(FALSE);
-			return STATUS_FAILURE;
-		}
-		addMotion(motion);
-	}
-
-	// Butt LeftRight
-	{
-		controller_map_t controller;
-		controller["Mass"] = "Butt_Physics_Mass";
-		controller["Smoothing"] = "Butt_Physics_Smoothing";
-		controller["Gravity"] = "Butt_Physics_Gravity";
-		controller["Damping"] = "Butt_Physics_LeftRight_Damping";
-		controller["Drag"] = "Butt_Physics_LeftRight_Drag";
-		controller["MaxSpeed"] = "Butt_Physics_LeftRight_Max_Velocity";
-		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);
-		if (!motion->initialize())
-		{
-			llassert_always(FALSE);
-			return STATUS_FAILURE;
-		}
-		addMotion(motion);
-	}
-
-	// Belly Bounce
-	{
-		controller_map_t controller;
-		controller["Mass"] = "Belly_Physics_Mass";
-		controller["Smoothing"] = "Belly_Physics_Smoothing";
-		controller["Gravity"] = "Belly_Physics_Gravity";
-		controller["Damping"] = "Belly_Physics_UpDown_Damping";
-		controller["Drag"] = "Belly_Physics_UpDown_Drag";
-		controller["MaxSpeed"] = "Belly_Physics_UpDown_Max_Velocity";
-		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),
-													  controller);
-		if (!motion->initialize())
-		{
-			llassert_always(FALSE);
-			return STATUS_FAILURE;
-		}
-		addMotion(motion);
-	}
-	
-	return STATUS_SUCCESS;
+        mCharacter = character;
+
+        mMotions.clear();
+
+        // Breast Cleavage
+        {
+                controller_map_t controller;
+                controller["Mass"] = "Breast_Physics_Mass";
+                controller["Gravity"] = "Breast_Physics_Gravity";
+                controller["Drag"] = "Breast_Physics_Drag";
+                controller["Damping"] = "Breast_Physics_InOut_Damping";
+                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",
+                                                                                                          "mChest",
+                                                                                                          character,
+                                                                                                          LLVector3(-1,0,0),
+                                                                                                          controller);
+                if (!motion->initialize())
+                {
+                        llassert_always(FALSE);
+                        return STATUS_FAILURE;
+                }
+                addMotion(motion);
+        }
+
+        // Breast Bounce
+        {
+                controller_map_t controller;
+                controller["Mass"] = "Breast_Physics_Mass";
+                controller["Gravity"] = "Breast_Physics_Gravity";
+                controller["Drag"] = "Breast_Physics_Drag";
+                controller["Damping"] = "Breast_Physics_UpDown_Damping";
+                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",
+                                                                                                          "mChest",
+                                                                                                          character,
+                                                                                                          LLVector3(0,0,1),
+                                                                                                          controller);
+                if (!motion->initialize())
+                {
+                        llassert_always(FALSE);
+                        return STATUS_FAILURE;
+                }
+                addMotion(motion);
+        }
+
+        // Breast Sway
+        {
+                controller_map_t controller;
+                controller["Mass"] = "Breast_Physics_Mass";
+                controller["Gravity"] = "Breast_Physics_Gravity";
+                controller["Drag"] = "Breast_Physics_Drag";
+                controller["Damping"] = "Breast_Physics_LeftRight_Damping";
+                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",
+                                                                                                          "mChest",
+                                                                                                          character,
+                                                                                                          LLVector3(0,-1,0),
+                                                                                                          controller);
+                if (!motion->initialize())
+                {
+                        llassert_always(FALSE);
+                        return STATUS_FAILURE;
+                }
+                addMotion(motion);
+        }
+        // Butt Bounce
+        {
+                controller_map_t controller;
+                controller["Mass"] = "Butt_Physics_Mass";
+                controller["Gravity"] = "Butt_Physics_Gravity";
+                controller["Drag"] = "Butt_Physics_Drag";
+                controller["Damping"] = "Butt_Physics_UpDown_Damping";
+                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),
+                                                                                                          controller);
+                if (!motion->initialize())
+                {
+                        llassert_always(FALSE);
+                        return STATUS_FAILURE;
+                }
+                addMotion(motion);
+        }
+
+        // Butt LeftRight
+        {
+                controller_map_t controller;
+                controller["Mass"] = "Butt_Physics_Mass";
+                controller["Gravity"] = "Butt_Physics_Gravity";
+                controller["Drag"] = "Butt_Physics_Drag";
+                controller["Damping"] = "Butt_Physics_LeftRight_Damping";
+                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",
+                                                                                                          "mPelvis",
+                                                                                                          character,
+                                                                                                          LLVector3(0,-1,0),
+                                                                                                          controller);
+                if (!motion->initialize())
+                {
+                        llassert_always(FALSE);
+                        return STATUS_FAILURE;
+                }
+                addMotion(motion);
+        }
+
+        // Belly Bounce
+        {
+                controller_map_t controller;
+                controller["Mass"] = "Belly_Physics_Mass";
+                controller["Gravity"] = "Belly_Physics_Gravity";
+                controller["Drag"] = "Belly_Physics_Drag";
+                controller["Damping"] = "Belly_Physics_UpDown_Damping";
+                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",
+                                                                                                          "mPelvis",
+                                                                                                          character,
+                                                                                                          LLVector3(0,0,-1),
+                                                                                                          controller);
+                if (!motion->initialize())
+                {
+                        llassert_always(FALSE);
+                        return STATUS_FAILURE;
+                }
+                addMotion(motion);
+        }
+        
+        return STATUS_SUCCESS;
 }
 
 void LLPhysicsMotionController::addMotion(LLPhysicsMotion *motion)
 {
-	addJointState(motion->getJointState());
-	mMotions.push_back(motion);
+        addJointState(motion->getJointState());
+        mMotions.push_back(motion);
 }
 
 F32 LLPhysicsMotionController::getMinPixelArea() 
 {
-	return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION;
+        return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION;
 }
 
 // Local space means "parameter space".
 F32 LLPhysicsMotion::toLocal(const LLVector3 &world)
 {
-	LLJoint *joint = mJointState->getJoint();
-	const LLQuaternion rotation_world = joint->getWorldRotation();
-	
-	LLVector3 dir_world = mMotionDirectionVec * rotation_world;
-	dir_world.normalize();
-	return world * dir_world;
+        LLJoint *joint = mJointState->getJoint();
+        const LLQuaternion rotation_world = joint->getWorldRotation();
+        
+        LLVector3 dir_world = mMotionDirectionVec * rotation_world;
+        dir_world.normalize();
+        return world * dir_world;
 }
 
 F32 LLPhysicsMotion::calculateVelocity_local(const F32 time_delta)
 {
-	LLJoint *joint = mJointState->getJoint();
-	const LLVector3 position_world = joint->getWorldPosition();
-	const LLQuaternion rotation_world = joint->getWorldRotation();
-	const LLVector3 last_position_world = mPosition_world;
-	const LLVector3 velocity_world = (position_world-last_position_world) / time_delta;
-	const F32 velocity_local = toLocal(velocity_world);
-	return velocity_local;
+        LLJoint *joint = mJointState->getJoint();
+        const LLVector3 position_world = joint->getWorldPosition();
+        const LLQuaternion rotation_world = joint->getWorldRotation();
+        const LLVector3 last_position_world = mPosition_world;
+        const LLVector3 velocity_world = (position_world-last_position_world) / time_delta;
+        const F32 velocity_local = toLocal(velocity_world);
+        return velocity_local;
 }
 
 F32 LLPhysicsMotion::calculateAcceleration_local(const F32 velocity_local,
-						 const F32 time_delta)
+                                                 const F32 time_delta)
 {
-	const F32 smoothing = getParamValue("Smoothing");
-	const F32 acceleration_local = velocity_local - mVelocityJoint_local;
-	
-	const F32 smoothed_acceleration_local = 
-		acceleration_local * 1.0/smoothing + 
-		mAccelerationJoint_local * (smoothing-1.0)/smoothing;
-	
-	return smoothed_acceleration_local;
+//        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 = 
+                acceleration_local * 1.0/smoothing + 
+                mAccelerationJoint_local * (smoothing-1.0)/smoothing;
+        
+        return smoothed_acceleration_local;
 }
 
 BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
 {
-	// Skip if disabled globally.
-	if (!gSavedSettings.getBOOL("AvatarPhysics"))
-	{
-		return TRUE;
-	}
-	
-	BOOL update_visuals = FALSE;
-	for (motion_vec_t::iterator iter = mMotions.begin();
-	     iter != mMotions.end();
-	     ++iter)
-	{
-		LLPhysicsMotion *motion = (*iter);
-		update_visuals |= motion->onUpdate(time);
-	}
-		
-	if (update_visuals)
-		mCharacter->updateVisualParams();
-	
-	return TRUE;
+        // Skip if disabled globally.
+        if (!gSavedSettings.getBOOL("AvatarPhysics"))
+        {
+                return TRUE;
+        }
+        
+        BOOL update_visuals = FALSE;
+        for (motion_vec_t::iterator iter = mMotions.begin();
+             iter != mMotions.end();
+             ++iter)
+        {
+                LLPhysicsMotion *motion = (*iter);
+                update_visuals |= motion->onUpdate(time);
+        }
+                
+        if (update_visuals)
+                mCharacter->updateVisualParams();
+        
+        return TRUE;
 }
 
 
 // Return TRUE if character has to update visual params.
 BOOL LLPhysicsMotion::onUpdate(F32 time)
 {
-	// static FILE *mFileWrite = fopen("c:\\temp\\avatar_data.txt","w");
-	
-	if (!mParamUser)
-		return FALSE;
-
-	if (!mLastTime)
-	{
-		mLastTime = time;
-		return FALSE;
-	}
-
-	////////////////////////////////////////////////////////////////////////////////
-	// Get all parameters and settings
-	//
-
-	const F32 time_delta = time - mLastTime;
-	if (time_delta > 3.0 || time_delta <= 0.01)
-	{
-		mLastTime = time;
-		return FALSE;
-	}
-
-	// Higher LOD is better.  This controls the granularity
-	// and frequency of updates for the motions.
-	const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor;
-	if (lod_factor == 0)
-	{
-		return TRUE;
-	}
-
-	LLJoint *joint = mJointState->getJoint();
-
-	const F32 behavior_mass = getParamValue("Mass");
-	const F32 behavior_gravity = getParamValue("Gravity");
-	const F32 behavior_spring = getParamValue("Spring");
-	const F32 behavior_gain = getParamValue("Gain");
-	const F32 behavior_damping = getParamValue("Damping");
-	const F32 behavior_drag = getParamValue("Drag");
-	const BOOL physics_test = gSavedSettings.getBOOL("AvatarPhysicsTest");
-	
-	F32 behavior_maxspeed = getParamValue("MaxSpeed");
-	if (physics_test)
-		behavior_maxspeed = 100.0f;
-
-	if (behavior_maxspeed == 0)
-		return FALSE;
-
-	F32 position_current_local = llclamp(mPosition_local,
-					     0.0f,
-					     1.0f); // Normalized [0,1] range
-
-	// Normalize the param position to be from [0,1].
-	// 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());
-
-	//
-	// End parameters and settings
-	////////////////////////////////////////////////////////////////////////////////
-
-
-	////////////////////////////////////////////////////////////////////////////////
-	// Calculate velocity and acceleration in parameter space.
-	//
-	
-	const F32 velocity_joint_local = calculateVelocity_local(time_delta);
-	const F32 acceleration_joint_local = calculateAcceleration_local(velocity_joint_local, time_delta);
-
-	//
-	// End velocity and acceleration
-	////////////////////////////////////////////////////////////////////////////////
-
-
-	////////////////////////////////////////////////////////////////////////////////
-	// Calculate the total force 
-	//
-
-	// Spring force is a restoring force towards the original user-set breast position.
-	// F = kx
-	const F32 spring_length = position_current_local - position_user_local;
-	const F32 force_spring = -spring_length * behavior_spring;
-
-	// Acceleration is the force that comes from the change in velocity of the torso.
-	// F = ma
-	const F32 force_accel = behavior_gain * (acceleration_joint_local * behavior_mass);
-
-	// Gravity always points downward in world space.
-	// F = mg
-	const LLVector3 gravity_world(0,0,1);
-	const F32 force_gravity = behavior_gain * (toLocal(gravity_world) * behavior_gravity * behavior_mass);
-		
-	// Damping is a restoring force that opposes the current velocity.
-	// F = -kv
-	const F32 force_damping = -behavior_damping * mVelocity_local;
-		
-	// Drag is a force imparted by velocity (intuitively it is similar to wind resistance)
-	// F = .5kv^2
-	const F32 force_drag = .5*behavior_drag*velocity_joint_local*velocity_joint_local*llsgn(velocity_joint_local);
-
-	const F32 force_net = (force_accel + 
-			       force_gravity +
-			       force_spring + 
-			       force_damping + 
-			       force_drag);
-
-	//
-	// End total force
-	////////////////////////////////////////////////////////////////////////////////
-
-	
-	////////////////////////////////////////////////////////////////////////////////
-	// Calculate new params
-	//
-
-	// Calculate the new acceleration based on the net force.
-	// a = F/m
-	const F32 acceleration_new_local = force_net / behavior_mass;
-	F32 velocity_new_local = mVelocity_local + acceleration_new_local;
-	velocity_new_local = llclamp(velocity_new_local, 
-				     -behavior_maxspeed, behavior_maxspeed);
-	
-	// 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;
-
-	// Zero out the velocity if the param is being pushed beyond its limits.
-	if (position_new_local < 0 || position_new_local > 1)
-	{
-		velocity_new_local = 0;
-	}
-
-	const F32 position_new_local_clamped = llclamp(position_new_local,
-						       0.0f,
-						       1.0f);
-
-	// 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)
-	{
-		setParamValue(mParamDriven,position_new_local_clamped);
-	}
-	else
-	{
-		LLDriverParam *driver_param = dynamic_cast<LLDriverParam *>(mParamUser);
-		llassert_always(driver_param);
-		if (driver_param)
-		{
-			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);
-			}
-		}
-	}
-	
-	//
-	// End calculate new params
-	////////////////////////////////////////////////////////////////////////////////
-	
-	////////////////////////////////////////////////////////////////////////////////
-	// Conditionally update the visual params
-	//
-	
-	// Updating the visual params (i.e. what the user sees) is fairly expensive.
-	// So only update if the params have changed enough, and also take into account
-	// the graphics LOD settings.
-	
-	BOOL update_visuals = FALSE;
-
-	// For non-self, if the avatar is small enough visually, then don't update.
-	const F32 area_for_max_settings = 0.0;
-	const F32 area_for_min_settings = 1400.0;
-	const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor);
-	const F32 pixel_area = fsqrtf(mCharacter->getPixelArea());
-	
-	const BOOL is_self = (dynamic_cast<LLVOAvatarSelf *>(mCharacter) != NULL);
-	if ((pixel_area > area_for_this_setting) || is_self)
-	{
-		const F32 position_diff_local = llabs(mPositionLastUpdate_local-position_new_local_clamped);
-		const F32 min_delta = (1.01f-lod_factor)*0.4f;
-		if (llabs(position_diff_local) > min_delta)
-		{
-			update_visuals = TRUE;
-			mPositionLastUpdate_local = position_new_local;
-		}
-	}
-
-	//
-	// End update visual params
-	////////////////////////////////////////////////////////////////////////////////
-
-	mVelocityJoint_local = velocity_joint_local;
-
-	mVelocity_local = velocity_new_local;
-	mAccelerationJoint_local = acceleration_joint_local;
-	mPosition_local = position_new_local;
-
-	mPosition_world = joint->getWorldPosition();
-	mLastTime = time;
-
-	/*
-	  // Write out debugging info into a spreadsheet.
-	  if (mFileWrite != NULL && is_self)
-	  {
-	  fprintf(mFileWrite,"%f\t%f\t%f \t\t%f \t\t%f\t%f\t%f\t \t\t%f\t%f\t%f\t%f\t%f \t\t%f\t%f\t%f\n",
-	  position_new_local,
-	  velocity_new_local,
-	  acceleration_new_local,
-
-	  time_delta,
-
-	  mPosition_world[0],
-	  mPosition_world[1],
-	  mPosition_world[2],
-
-	  force_net,
-	  force_spring,
-	  force_accel,
-	  force_damping,
-	  force_drag,
-
-	  spring_length,
-	  velocity_joint_local,
-	  acceleration_joint_local
-	  );
-	  }
-	*/
-
-	return update_visuals;
+        // static FILE *mFileWrite = fopen("c:\\temp\\avatar_data.txt","w");
+        
+        if (!mParamDriver)
+                return FALSE;
+
+        if (!mLastTime)
+        {
+                mLastTime = time;
+                return FALSE;
+        }
+
+        ////////////////////////////////////////////////////////////////////////////////
+        // Get all parameters and settings
+        //
+
+        const F32 time_delta = time - mLastTime;
+        if (time_delta > 3.0 || time_delta <= 0.01)
+        {
+                mLastTime = time;
+                return FALSE;
+        }
+
+        // Higher LOD is better.  This controls the granularity
+        // and frequency of updates for the motions.
+        const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor;
+        if (lod_factor == 0)
+        {
+                return TRUE;
+        }
+
+        LLJoint *joint = mJointState->getJoint();
+
+        const F32 behavior_mass = getParamValue("Mass");
+        const F32 behavior_gravity = getParamValue("Gravity");
+        const F32 behavior_spring = getParamValue("Spring");
+        const F32 behavior_gain = getParamValue("Gain");
+        const F32 behavior_damping = getParamValue("Damping");
+        const F32 behavior_drag = getParamValue("Drag");
+        const BOOL physics_test = gSavedSettings.getBOOL("AvatarPhysicsTest");
+        
+        F32 behavior_maxeffect = getParamValue("MaxEffect");
+        if (physics_test)
+                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;
+
+        // mPositon_local should be in normalized 0,1 range already.  Just making sure...
+        F32 position_current_local = llclamp(mPosition_local,
+                                             0.0f,
+                                             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,
+        // 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 = 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.
+        if ((behavior_maxeffect == 0) && (position_current_local == position_user_local))
+        {
+            return FALSE;
+        }
+
+        //
+        // End parameters and settings
+        ////////////////////////////////////////////////////////////////////////////////
+
+
+        ////////////////////////////////////////////////////////////////////////////////
+        // Calculate velocity and acceleration in parameter space.
+        //
+        
+        const F32 velocity_joint_local = calculateVelocity_local(time_delta);
+        const F32 acceleration_joint_local = calculateAcceleration_local(velocity_joint_local, time_delta);
+
+        //
+        // End velocity and acceleration
+        ////////////////////////////////////////////////////////////////////////////////
+
+
+        ////////////////////////////////////////////////////////////////////////////////
+        // Calculate the total force 
+        //
+
+        // Spring force is a restoring force towards the original user-set breast position.
+        // F = kx
+        const F32 spring_length = position_current_local - position_user_local;
+        const F32 force_spring = -spring_length * behavior_spring;
+
+        // Acceleration is the force that comes from the change in velocity of the torso.
+        // F = ma
+        const F32 force_accel = behavior_gain * (acceleration_joint_local * behavior_mass);
+
+        // Gravity always points downward in world space.
+        // F = mg
+        const LLVector3 gravity_world(0,0,1);
+        const F32 force_gravity = behavior_gain * (toLocal(gravity_world) * behavior_gravity * behavior_mass);
+                
+        // Damping is a restoring force that opposes the current velocity.
+        // F = -kv
+        const F32 force_damping = -behavior_damping * mVelocity_local;
+                
+        // Drag is a force imparted by velocity (intuitively it is similar to wind resistance)
+        // F = .5kv^2
+        const F32 force_drag = .5*behavior_drag*velocity_joint_local*velocity_joint_local*llsgn(velocity_joint_local);
+
+        const F32 force_net = (force_accel + 
+                               force_gravity +
+                               force_spring + 
+                               force_damping + 
+                               force_drag);
+
+        //
+        // End total force
+        ////////////////////////////////////////////////////////////////////////////////
+
+        
+        ////////////////////////////////////////////////////////////////////////////////
+        // Calculate new params
+        //
+
+        // Calculate the new acceleration based on the net force.
+        // a = F/m
+        const F32 acceleration_new_local = force_net / behavior_mass;
+        static 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, 
+                                     -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.
+        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 < 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,
+                                                       min_val,
+                                                       max_val);
+
+        LLDriverParam *driver_param = dynamic_cast<LLDriverParam *>(mParamDriver);
+        llassert_always(driver_param);
+        if (driver_param)
+        {
+                // If this is one of our "hidden" driver params, then make sure it's
+                // the default value.
+                if ((driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) &&
+                    (driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT))
+                {
+                        mCharacter->setVisualParamWeight(driver_param,
+                                                         0,
+                                                         FALSE);
+                }
+                for (LLDriverParam::entry_list_t::iterator iter = driver_param->mDriven.begin();
+                     iter != driver_param->mDriven.end();
+                     ++iter)
+                {
+                        LLDrivenEntry &entry = (*iter);
+                        LLViewerVisualParam *driven_param = entry.mParam;
+                        setParamValue(driven_param,position_new_local_clamped);
+                }
+        }
+        
+        //
+        // End calculate new params
+        ////////////////////////////////////////////////////////////////////////////////
+        
+        ////////////////////////////////////////////////////////////////////////////////
+        // Conditionally update the visual params
+        //
+        
+        // Updating the visual params (i.e. what the user sees) is fairly expensive.
+        // So only update if the params have changed enough, and also take into account
+        // the graphics LOD settings.
+        
+        BOOL update_visuals = FALSE;
+
+        // For non-self, if the avatar is small enough visually, then don't update.
+        const F32 area_for_max_settings = 0.0;
+        const F32 area_for_min_settings = 1400.0;
+        const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor);
+        const F32 pixel_area = fsqrtf(mCharacter->getPixelArea());
+        
+        const BOOL is_self = (dynamic_cast<LLVOAvatarSelf *>(mCharacter) != NULL);
+        if ((pixel_area > area_for_this_setting) || is_self)
+        {
+                const F32 position_diff_local = llabs(mPositionLastUpdate_local-position_new_local_clamped);
+                const F32 min_delta = (1.01f-lod_factor)*0.4f;
+                if (llabs(position_diff_local) > min_delta)
+                {
+                        update_visuals = TRUE;
+                        mPositionLastUpdate_local = position_new_local;
+                }
+        }
+
+        //
+        // End update visual params
+        ////////////////////////////////////////////////////////////////////////////////
+
+        mVelocityJoint_local = velocity_joint_local;
+
+        mVelocity_local = velocity_new_local;
+        mAccelerationJoint_local = acceleration_joint_local;
+        mPosition_local = position_new_local;
+
+        mPosition_world = joint->getWorldPosition();
+        mLastTime = time;
+
+        /*
+          // Write out debugging info into a spreadsheet.
+          if (mFileWrite != NULL && is_self)
+          {
+          fprintf(mFileWrite,"%f\t%f\t%f \t\t%f \t\t%f\t%f\t%f\t \t\t%f\t%f\t%f\t%f\t%f \t\t%f\t%f\t%f\n",
+          position_new_local,
+          velocity_new_local,
+          acceleration_new_local,
+
+          time_delta,
+
+          mPosition_world[0],
+          mPosition_world[1],
+          mPosition_world[2],
+
+          force_net,
+          force_spring,
+          force_accel,
+          force_damping,
+          force_drag,
+
+          spring_length,
+          velocity_joint_local,
+          acceleration_joint_local
+          );
+          }
+        */
+
+        return update_visuals;
 }
 
 // Range of new_value_local is assumed to be [0 , 1] normalized.
 void LLPhysicsMotion::setParamValue(LLViewerVisualParam *param,
-				    F32 new_value_normalized)
+                                    F32 new_value_normalized)
 {
-	const F32 value_min_local = param->getMinWeight();
-	const F32 value_max_local = param->getMaxWeight();
+        const F32 value_min_local = param->getMinWeight();
+        const F32 value_max_local = param->getMaxWeight();
 
-	const F32 new_value_local = value_min_local + (value_max_local-value_min_local) * new_value_normalized;
+        const F32 new_value_local = value_min_local + (value_max_local-value_min_local) * new_value_normalized;
 
-	mCharacter->setVisualParamWeight(param,
-					 new_value_local,
-					 FALSE);
+        mCharacter->setVisualParamWeight(param,
+                                         new_value_local,
+                                         FALSE);
 }
diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp
index 6d6fb2fa0ef8cfff3d5a1a35b8767c5e085df97b..bacaa0cd761e9bea5f48294807a637c33d12b4a6 100644
--- a/indra/newview/llpolymesh.cpp
+++ b/indra/newview/llpolymesh.cpp
@@ -44,11 +44,16 @@
 #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);
+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);
 
 //-----------------------------------------------------------------------------
 // Global table of loaded LLPolyMeshes
@@ -60,28 +65,28 @@ LLPolyMesh::LLPolyMeshSharedDataTable LLPolyMesh::sGlobalSharedMeshList;
 //-----------------------------------------------------------------------------
 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;
 }
 
 //-----------------------------------------------------------------------------
@@ -89,9 +94,9 @@ LLPolyMeshSharedData::LLPolyMeshSharedData()
 //-----------------------------------------------------------------------------
 LLPolyMeshSharedData::~LLPolyMeshSharedData()
 {
-	freeMeshData();
-	for_each(mMorphData.begin(), mMorphData.end(), DeletePointer());
-	mMorphData.clear();
+        freeMeshData();
+        for_each(mMorphData.begin(), mMorphData.end(), DeletePointer());
+        mMorphData.clear();
 }
 
 //-----------------------------------------------------------------------------
@@ -99,19 +104,19 @@ LLPolyMeshSharedData::~LLPolyMeshSharedData()
 //-----------------------------------------------------------------------------
 void LLPolyMeshSharedData::setupLOD(LLPolyMeshSharedData* 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;
-	}
+        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;
+        }
 }
 
 //-----------------------------------------------------------------------------
@@ -119,41 +124,41 @@ void LLPolyMeshSharedData::setupLOD(LLPolyMeshSharedData* reference_data)
 //-----------------------------------------------------------------------------
 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
@@ -164,26 +169,26 @@ int compare_int(const void *a, const void *b);
 //-----------------------------------------------------------------------------
 void LLPolyMeshSharedData::genIndices(S32 index_offset)
 {
-	if (index_offset == mLastIndexOffset)
-	{
-		return;
-	}
-
-	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++;
-	}
-
-	mLastIndexOffset = index_offset;
+        if (index_offset == mLastIndexOffset)
+        {
+                return;
+        }
+
+        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++;
+        }
+
+        mLastIndexOffset = index_offset;
 }
 
 //--------------------------------------------------------------------
@@ -191,30 +196,30 @@ void LLPolyMeshSharedData::genIndices(S32 index_offset)
 //--------------------------------------------------------------------
 U32 LLPolyMeshSharedData::getNumKB()
 {
-	U32 num_kb = sizeof(LLPolyMesh);
-
-	if (!isLOD())
-	{
-		num_kb += mNumVertices *
-					( sizeof(LLVector3) +	// coords
-					sizeof(LLVector3) +		// normals
-					sizeof(LLVector2) );	// texCoords
-	}
-
-	if (mHasDetailTexCoords && !isLOD())
-	{
-		num_kb += mNumVertices * sizeof(LLVector2);	// detailTexCoords
-	}
-
-	if (mHasWeights && !isLOD())
-	{
-		num_kb += mNumVertices * sizeof(float);		// weights
-	}
-
-	num_kb += mNumFaces * sizeof(LLPolyFace);	// faces
-
-	num_kb /= 1024;
-	return num_kb;
+        U32 num_kb = sizeof(LLPolyMesh);
+
+        if (!isLOD())
+        {
+                num_kb += mNumVertices *
+                        ( sizeof(LLVector3) +   // coords
+                          sizeof(LLVector3) +             // normals
+                          sizeof(LLVector2) );    // texCoords
+        }
+
+        if (mHasDetailTexCoords && !isLOD())
+        {
+                num_kb += mNumVertices * sizeof(LLVector2);     // detailTexCoords
+        }
+
+        if (mHasWeights && !isLOD())
+        {
+                num_kb += mNumVertices * sizeof(float);         // weights
+        }
+
+        num_kb += mNumFaces * sizeof(LLPolyFace);       // faces
+
+        num_kb /= 1024;
+        return num_kb;
 }
 
 //-----------------------------------------------------------------------------
@@ -222,19 +227,19 @@ U32 LLPolyMeshSharedData::getNumKB()
 //-----------------------------------------------------------------------------
 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;
 }
 
 //-----------------------------------------------------------------------------
@@ -242,10 +247,10 @@ BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices )
 //-----------------------------------------------------------------------------
 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;
 }
 
 //-----------------------------------------------------------------------------
@@ -253,9 +258,9 @@ BOOL LLPolyMeshSharedData::allocateFaceData( U32 numFaces )
 //-----------------------------------------------------------------------------
 BOOL LLPolyMeshSharedData::allocateJointNames( U32 numJointNames )
 {
-	mJointNames = new std::string[ numJointNames ];
-	mNumJointNames = numJointNames;
-	return TRUE;
+        mJointNames = new std::string[ numJointNames ];
+        mNumJointNames = numJointNames;
+        return TRUE;
 }
 
 //--------------------------------------------------------------------
@@ -263,427 +268,445 @@ BOOL LLPolyMeshSharedData::allocateJointNames( U32 numJointNames )
 //--------------------------------------------------------------------
 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;
-	}
-
-	//-------------------------------------------------------------------------
-	// 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;
-
-		//----------------------------------------------------------------
-		// 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;
-		}
-
-		//----------------------------------------------------------------
-		// 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 );
-
-		//----------------------------------------------------------------
-		// 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);
-
-		if (numRead != 1)
-		{
-			llerrs << "can't read RotationOrder from " << fileName << llendl;
-			return FALSE;
-		}
-
-		rotationOrder = 0;
-
-		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 );
-
-		//-------------------------------------------------------------------------
-		// Release any existing mesh geometry
-		//-------------------------------------------------------------------------
-		freeMeshData();
-
-		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;
-			}
-
-			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;
-			}
-
-			//----------------------------------------------------------------
-			// 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;
-			}
-
-
-			//----------------------------------------------------------------
-			// 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;
-				}
-			}
-
-			//----------------------------------------------------------------
-			// 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 );
-
-
-		//----------------------------------------------------------------
-		// 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);
-//			}
-
-			numTris++;
-		}
-
-		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 );
-			}
-
-			//----------------------------------------------------------------
-			// 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;
-			}
-
-			//-------------------------------------------------------------------------
-			// 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);
-
-				if (!result)
-				{
-					delete morph_data;
-					continue;
-				}
-
-				mMorphData.insert(morph_data);
-
-				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_Legs"))
-				{
-					mMorphData.insert(clone_morph_param(morph_data,
-									    LLVector3(0,0,0.03f),
-									    "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, "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"));
-				}
-			}
-
-			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;
-				}
-			}
-		}
-
-		status = TRUE;
-	}
-	else
-	{
-		llerrs << "invalid mesh file header: " << fileName << llendl;
-		status = FALSE;
-	}
-
-	if (0 == mNumJointNames)
-	{
-		allocateJointNames(1);
-	}
-
-	fclose( fp );
-
-	return status;
+        //-------------------------------------------------------------------------
+        // 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;
+        }
+
+        //-------------------------------------------------------------------------
+        // 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);
+
+                //----------------------------------------------------------------
+                // 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;
+                }
+
+                //----------------------------------------------------------------
+                // 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;
+                }
+
+                U8 rotationOrder;
+                numRead = fread(&rotationOrder, sizeof(U8), 1, fp);
+
+                if (numRead != 1)
+                {
+                        llerrs << "can't read RotationOrder from " << fileName << llendl;
+                        return FALSE;
+                }
+
+                rotationOrder = 0;
+
+                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 );
+
+                //-------------------------------------------------------------------------
+                // Release any existing mesh geometry
+                //-------------------------------------------------------------------------
+                freeMeshData();
+
+                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;
+                        }
+
+                        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;
+                        }
+
+                        //----------------------------------------------------------------
+                        // 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;
+                        }
+
+
+                        //----------------------------------------------------------------
+                        // 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;
+                                }
+                        }
+
+                        //----------------------------------------------------------------
+                        // 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 );
+
+
+                //----------------------------------------------------------------
+                // 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);
+//                      }
+
+                        numTris++;
+                }
+
+                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 );
+                        }
+
+                        //----------------------------------------------------------------
+                        // 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;
+                        }
+
+                        //-------------------------------------------------------------------------
+                        // 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);
+
+                                if (!result)
+                                {
+                                        delete morph_data;
+                                        continue;
+                                }
+
+                                mMorphData.insert(morph_data);
+
+                                if (!strcmp(morphName, "Breast_Female_Cleavage"))
+                                {
+                                        mMorphData.insert(clone_morph_param_cleavage(morph_data,
+                                                                                     .75f,
+                                                                                     "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_direction(morph_data,
+										      LLVector3(0,0,0.05f),
+										      "Belly_Physics_Torso_UpDown_Driven"));
+                                }
+
+                                if (!strcmp(morphName, "Big_Belly_Legs"))
+                                {
+                                        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_direction(morph_data,
+										      LLVector3(0,0,0.05f),
+										      "Belly_Physics_Skirt_UpDown_Driven"));
+                                }
+
+                                if (!strcmp(morphName, "Small_Butt"))
+                                {
+                                        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_direction(morph_data,
+										      LLVector3(0,0.03f,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);
+
+                                        mSharedVerts[remapSrc] = remapDst;
+                                }
+                        }
+                }
+
+                status = TRUE;
+        }
+        else
+        {
+                llerrs << "invalid mesh file header: " << fileName << llendl;
+                status = FALSE;
+        }
+
+        if (0 == mNumJointNames)
+        {
+                allocateJointNames(1);
+        }
+
+        fclose( fp );
+
+        return status;
 }
 
 //-----------------------------------------------------------------------------
@@ -691,11 +714,11 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
 //-----------------------------------------------------------------------------
 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;
 }
 
 //-----------------------------------------------------------------------------
@@ -703,69 +726,69 @@ const S32 *LLPolyMeshSharedData::getSharedVert(S32 vert)
 //-----------------------------------------------------------------------------
 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);
-
-	llassert(shared_data);
-
-	mSharedData = shared_data;
-	mReferenceMesh = reference_mesh;
-	mAvatarp = NULL;
-	mVertexData = NULL;
-
-	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;
+{       
+        LLMemType mt(LLMemType::MTYPE_AVATAR_MESH);
+
+        llassert(shared_data);
+
+        mSharedData = shared_data;
+        mReferenceMesh = reference_mesh;
+        mAvatarp = NULL;
+        mVertexData = NULL;
+
+        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;
 #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();
+        }
 }
 
 
@@ -774,22 +797,22 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_
 //-----------------------------------------------------------------------------
 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
 }
 
@@ -799,40 +822,40 @@ LLPolyMesh::~LLPolyMesh()
 //-----------------------------------------------------------------------------
 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;
-	}
-
-	//-------------------------------------------------------------------------
-	// 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;
-	}
-
-	LLPolyMesh *poly_mesh = new LLPolyMesh(mesh_data, reference_mesh);
-
-//	llinfos << "Polymesh " << name << " added to global mesh table." << llendl;
-	sGlobalSharedMeshList[name] = poly_mesh->mSharedData;
-
-	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);
+
+        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);
+
+//      llinfos << "Polymesh " << name << " added to global mesh table." << llendl;
+        sGlobalSharedMeshList[name] = poly_mesh->mSharedData;
+
+        return poly_mesh;
 }
 
 //-----------------------------------------------------------------------------
@@ -840,14 +863,14 @@ LLPolyMesh *LLPolyMesh::getMesh(const std::string &name, LLPolyMesh* reference_m
 //-----------------------------------------------------------------------------
 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;
 }
 
 
@@ -856,41 +879,41 @@ LLPolyMeshSharedData *LLPolyMesh::getSharedData() const
 //--------------------------------------------------------------------
 void LLPolyMesh::dumpDiagInfo()
 {
-	// keep track of totals
-	U32 total_verts = 0;
-	U32 total_faces = 0;
-	U32 total_kb = 0;
-
-	std::string buf;
-
-	llinfos << "-----------------------------------------------------" << llendl;
-	llinfos << "       Global PolyMesh Table (DEBUG only)" << llendl;
-	llinfos << "   Verts    Faces  Mem(KB) Name" << llendl;
-	llinfos << "-----------------------------------------------------" << llendl;
-
-	// print each loaded mesh, and it's memory usage
-	for(LLPolyMeshSharedDataTable::iterator iter = sGlobalSharedMeshList.begin();
-		iter != sGlobalSharedMeshList.end(); ++iter)
-	{
-		const std::string& mesh_name = iter->first;
-		LLPolyMeshSharedData* mesh = iter->second;
-
-		S32 num_verts = mesh->mNumVertices;
-		S32 num_faces = mesh->mNumFaces;
-		U32 num_kb = mesh->getNumKB();
-
-		buf = llformat("%8d %8d %8d %s", num_verts, num_faces, num_kb, mesh_name.c_str());
-		llinfos << buf << llendl;
-
-		total_verts += num_verts;
-		total_faces += num_faces;
-		total_kb += num_kb;
-	}
-
-	llinfos << "-----------------------------------------------------" << llendl;
-	buf = llformat("%8d %8d %8d TOTAL", total_verts, total_faces, total_kb );
-	llinfos << buf << llendl;
-	llinfos << "-----------------------------------------------------" << llendl;
+        // keep track of totals
+        U32 total_verts = 0;
+        U32 total_faces = 0;
+        U32 total_kb = 0;
+
+        std::string buf;
+
+        llinfos << "-----------------------------------------------------" << llendl;
+        llinfos << "       Global PolyMesh Table (DEBUG only)" << llendl;
+        llinfos << "   Verts    Faces  Mem(KB) Name" << llendl;
+        llinfos << "-----------------------------------------------------" << llendl;
+
+        // print each loaded mesh, and it's memory usage
+        for(LLPolyMeshSharedDataTable::iterator iter = sGlobalSharedMeshList.begin();
+            iter != sGlobalSharedMeshList.end(); ++iter)
+        {
+                const std::string& mesh_name = iter->first;
+                LLPolyMeshSharedData* mesh = iter->second;
+
+                S32 num_verts = mesh->mNumVertices;
+                S32 num_faces = mesh->mNumFaces;
+                U32 num_kb = mesh->getNumKB();
+
+                buf = llformat("%8d %8d %8d %s", num_verts, num_faces, num_kb, mesh_name.c_str());
+                llinfos << buf << llendl;
+
+                total_verts += num_verts;
+                total_faces += num_faces;
+                total_kb += num_kb;
+        }
+
+        llinfos << "-----------------------------------------------------" << llendl;
+        buf = llformat("%8d %8d %8d TOTAL", total_verts, total_faces, total_kb );
+        llinfos << buf << llendl;
+        llinfos << "-----------------------------------------------------" << llendl;
 }
 
 //-----------------------------------------------------------------------------
@@ -898,7 +921,7 @@ void LLPolyMesh::dumpDiagInfo()
 //-----------------------------------------------------------------------------
 LLVector3 *LLPolyMesh::getWritableCoords()
 {
-	return mCoords;
+        return mCoords;
 }
 
 //-----------------------------------------------------------------------------
@@ -906,7 +929,7 @@ LLVector3 *LLPolyMesh::getWritableCoords()
 //-----------------------------------------------------------------------------
 LLVector3 *LLPolyMesh::getWritableNormals()
 {
-	return mNormals;
+        return mNormals;
 }
 
 //-----------------------------------------------------------------------------
@@ -914,24 +937,24 @@ LLVector3 *LLPolyMesh::getWritableNormals()
 //-----------------------------------------------------------------------------
 LLVector3 *LLPolyMesh::getWritableBinormals()
 {
-	return mBinormals;
+        return mBinormals;
 }
 
 
 //-----------------------------------------------------------------------------
 // getWritableClothingWeights()
 //-----------------------------------------------------------------------------
-LLVector4	*LLPolyMesh::getWritableClothingWeights()
+LLVector4       *LLPolyMesh::getWritableClothingWeights()
 {
-	return mClothingWeights;
+        return mClothingWeights;
 }
 
 //-----------------------------------------------------------------------------
 // getWritableTexCoords()
 //-----------------------------------------------------------------------------
-LLVector2	*LLPolyMesh::getWritableTexCoords()
+LLVector2       *LLPolyMesh::getWritableTexCoords()
 {
-	return mTexCoords;
+        return mTexCoords;
 }
 
 //-----------------------------------------------------------------------------
@@ -939,7 +962,7 @@ LLVector2	*LLPolyMesh::getWritableTexCoords()
 //-----------------------------------------------------------------------------
 LLVector3 *LLPolyMesh::getScaledNormals()
 {
-	return mScaledNormals;
+        return mScaledNormals;
 }
 
 //-----------------------------------------------------------------------------
@@ -947,7 +970,7 @@ LLVector3 *LLPolyMesh::getScaledNormals()
 //-----------------------------------------------------------------------------
 LLVector3 *LLPolyMesh::getScaledBinormals()
 {
-	return mScaledBinormals;
+        return mScaledBinormals;
 }
 
 
@@ -956,66 +979,66 @@ LLVector3 *LLPolyMesh::getScaledBinormals()
 //-----------------------------------------------------------------------------
 void LLPolyMesh::initializeForMorph()
 {
-	if (!mSharedData)
-		return;
-
-	memcpy(mCoords, mSharedData->mBaseCoords, sizeof(LLVector3) * mSharedData->mNumVertices);	/*Flawfinder: ignore*/
-	memcpy(mNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices);	/*Flawfinder: ignore*/
-	memcpy(mScaledNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices);	/*Flawfinder: ignore*/
-	memcpy(mBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices);	/*Flawfinder: ignore*/
-	memcpy(mScaledBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices);		/*Flawfinder: ignore*/
-	memcpy(mTexCoords, mSharedData->mTexCoords, sizeof(LLVector2) * mSharedData->mNumVertices);		/*Flawfinder: ignore*/
-	memset(mClothingWeights, 0, sizeof(LLVector4) * mSharedData->mNumVertices);
+        if (!mSharedData)
+                return;
+
+        memcpy(mCoords, mSharedData->mBaseCoords, sizeof(LLVector3) * mSharedData->mNumVertices);       /*Flawfinder: ignore*/
+        memcpy(mNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices);     /*Flawfinder: ignore*/
+        memcpy(mScaledNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices);       /*Flawfinder: ignore*/
+        memcpy(mBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices); /*Flawfinder: ignore*/
+        memcpy(mScaledBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices);           /*Flawfinder: ignore*/
+        memcpy(mTexCoords, mSharedData->mTexCoords, sizeof(LLVector2) * mSharedData->mNumVertices);             /*Flawfinder: ignore*/
+        memset(mClothingWeights, 0, sizeof(LLVector4) * mSharedData->mNumVertices);
 }
 
 //-----------------------------------------------------------------------------
 // getMorphData()
 //-----------------------------------------------------------------------------
-LLPolyMorphData*	LLPolyMesh::getMorphData(const std::string& morph_name)
+LLPolyMorphData*        LLPolyMesh::getMorphData(const std::string& morph_name)
 {
-	if (!mSharedData)
-		return NULL;
-	for (LLPolyMeshSharedData::morphdata_list_t::iterator iter = mSharedData->mMorphData.begin();
-		 iter != mSharedData->mMorphData.end(); ++iter)
-	{
-		LLPolyMorphData *morph_data = *iter;
-		if (morph_data->getName() == morph_name)
-		{
-			return morph_data;
-		}
-	}
-	return NULL;
+        if (!mSharedData)
+                return NULL;
+        for (LLPolyMeshSharedData::morphdata_list_t::iterator iter = mSharedData->mMorphData.begin();
+             iter != mSharedData->mMorphData.end(); ++iter)
+        {
+                LLPolyMorphData *morph_data = *iter;
+                if (morph_data->getName() == morph_name)
+                {
+                        return morph_data;
+                }
+        }
+        return NULL;
 }
 
 //-----------------------------------------------------------------------------
 // removeMorphData()
 //-----------------------------------------------------------------------------
 // // erasing but not deleting seems bad, but fortunately we don't actually use this...
-// void	LLPolyMesh::removeMorphData(LLPolyMorphData *morph_target)
+// void LLPolyMesh::removeMorphData(LLPolyMorphData *morph_target)
 // {
-// 	if (!mSharedData)
-// 		return;
-// 	mSharedData->mMorphData.erase(morph_target);
+//      if (!mSharedData)
+//              return;
+//      mSharedData->mMorphData.erase(morph_target);
 // }
 
 //-----------------------------------------------------------------------------
 // deleteAllMorphData()
 //-----------------------------------------------------------------------------
-// void	LLPolyMesh::deleteAllMorphData()
+// void LLPolyMesh::deleteAllMorphData()
 // {
-// 	if (!mSharedData)
-// 		return;
+//      if (!mSharedData)
+//              return;
 
-// 	for_each(mSharedData->mMorphData.begin(), mSharedData->mMorphData.end(), DeletePointer());
-// 	mSharedData->mMorphData.clear();
+//      for_each(mSharedData->mMorphData.begin(), mSharedData->mMorphData.end(), DeletePointer());
+//      mSharedData->mMorphData.clear();
 // }
 
 //-----------------------------------------------------------------------------
 // getWritableWeights()
 //-----------------------------------------------------------------------------
-F32*	LLPolyMesh::getWritableWeights() const
+F32*    LLPolyMesh::getWritableWeights() const
 {
-	return mSharedData->mWeights;
+        return mSharedData->mWeights;
 }
 
 //-----------------------------------------------------------------------------
@@ -1027,58 +1050,58 @@ LLPolySkeletalDistortionInfo::LLPolySkeletalDistortionInfo()
 
 BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
 {
-	llassert( node->hasName( "param" ) && node->getChildByName( "param_skeleton" ) );
-	
-	if (!LLViewerVisualParamInfo::parseXml(node))
-		return FALSE;
-
-	LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton");
-
-	if (NULL == skeletalParam)
-	{
-		llwarns << "Failed to getChildByName(\"param_skeleton\")"
-			<< llendl;
-		return FALSE;
-	}
-
-	for( LLXmlTreeNode* bone = skeletalParam->getFirstChild(); bone; bone = skeletalParam->getNextChild() )
-	{
-		if (bone->hasName("bone"))
-		{
-			std::string name;
-			LLVector3 scale;
-			LLVector3 pos;
-			BOOL haspos = FALSE;
-			
-			static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
-			if (!bone->getFastAttributeString(name_string, name))
-			{
-				llwarns << "No bone name specified for skeletal param." << llendl;
-				continue;
-			}
-
-			static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
-			if (!bone->getFastAttributeVector3(scale_string, scale))
-			{
-				llwarns << "No scale specified for bone " << name << "." << llendl;
-				continue;
-			}
-
-			// optional offset deformation (translation)
-			static LLStdStringHandle offset_string = LLXmlTree::addAttributeString("offset");
-			if (bone->getFastAttributeVector3(offset_string, pos))
-			{
-				haspos = TRUE;
-			}
-			mBoneInfoList.push_back(LLPolySkeletalBoneInfo(name, scale, pos, haspos));
-		}
-		else
-		{
-			llwarns << "Unrecognized element " << bone->getName() << " in skeletal distortion" << llendl;
-			continue;
-		}
-	}
-	return TRUE;
+        llassert( node->hasName( "param" ) && node->getChildByName( "param_skeleton" ) );
+        
+        if (!LLViewerVisualParamInfo::parseXml(node))
+                return FALSE;
+
+        LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton");
+
+        if (NULL == skeletalParam)
+        {
+                llwarns << "Failed to getChildByName(\"param_skeleton\")"
+                        << llendl;
+                return FALSE;
+        }
+
+        for( LLXmlTreeNode* bone = skeletalParam->getFirstChild(); bone; bone = skeletalParam->getNextChild() )
+        {
+                if (bone->hasName("bone"))
+                {
+                        std::string name;
+                        LLVector3 scale;
+                        LLVector3 pos;
+                        BOOL haspos = FALSE;
+                        
+                        static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
+                        if (!bone->getFastAttributeString(name_string, name))
+                        {
+                                llwarns << "No bone name specified for skeletal param." << llendl;
+                                continue;
+                        }
+
+                        static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
+                        if (!bone->getFastAttributeVector3(scale_string, scale))
+                        {
+                                llwarns << "No scale specified for bone " << name << "." << llendl;
+                                continue;
+                        }
+
+                        // optional offset deformation (translation)
+                        static LLStdStringHandle offset_string = LLXmlTree::addAttributeString("offset");
+                        if (bone->getFastAttributeVector3(offset_string, pos))
+                        {
+                                haspos = TRUE;
+                        }
+                        mBoneInfoList.push_back(LLPolySkeletalBoneInfo(name, scale, pos, haspos));
+                }
+                else
+                {
+                        llwarns << "Unrecognized element " << bone->getName() << " in skeletal distortion" << llendl;
+                        continue;
+                }
+        }
+        return TRUE;
 }
 
 //-----------------------------------------------------------------------------
@@ -1086,8 +1109,8 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
 //-----------------------------------------------------------------------------
 LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLVOAvatar *avatarp)
 {
-	mAvatar = avatarp;
-	mDefaultVec.setVec(0.001f, 0.001f, 0.001f);
+        mAvatar = avatarp;
+        mDefaultVec.setVec(0.001f, 0.001f, 0.001f);
 }
 
 //-----------------------------------------------------------------------------
@@ -1099,62 +1122,62 @@ LLPolySkeletalDistortion::~LLPolySkeletalDistortion()
 
 BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
 {
-	llassert(mInfo == NULL);
-	if (info->mID < 0)
-		return FALSE;
-	mInfo = info;
-	mID = info->mID;
-	setWeight(getDefaultWeight(), FALSE );
-
-	LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
-	for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
-	{
-		LLPolySkeletalBoneInfo *bone_info = &(*iter);
-		LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
-		if (!joint)
-		{
-			llwarns << "Joint " << bone_info->mBoneName << " not found." << llendl;
-			continue;
-		}
-
-		if (mJointScales.find(joint) != mJointScales.end())
-		{
-			llwarns << "Scale deformation already supplied for joint " << joint->getName() << "." << llendl;
-		}
-
-		// store it
-		mJointScales[joint] = bone_info->mScaleDeformation;
-
-		// apply to children that need to inherit it
-		for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
-			 iter != joint->mChildren.end(); ++iter)
-		{
-			LLViewerJoint* child_joint = (LLViewerJoint*)(*iter);
-			if (child_joint->inheritScale())
-			{
-				LLVector3 childDeformation = LLVector3(child_joint->getScale());
-				childDeformation.scaleVec(bone_info->mScaleDeformation);
-				mJointScales[child_joint] = childDeformation;
-			}
-		}
-
-		if (bone_info->mHasPositionDeformation)
-		{
-			if (mJointOffsets.find(joint) != mJointOffsets.end())
-			{
-				llwarns << "Offset deformation already supplied for joint " << joint->getName() << "." << llendl;
-			}
-			mJointOffsets[joint] = bone_info->mPositionDeformation;
-		}
-	}
-	return TRUE;
+        llassert(mInfo == NULL);
+        if (info->mID < 0)
+                return FALSE;
+        mInfo = info;
+        mID = info->mID;
+        setWeight(getDefaultWeight(), FALSE );
+
+        LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
+        for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
+        {
+                LLPolySkeletalBoneInfo *bone_info = &(*iter);
+                LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
+                if (!joint)
+                {
+                        llwarns << "Joint " << bone_info->mBoneName << " not found." << llendl;
+                        continue;
+                }
+
+                if (mJointScales.find(joint) != mJointScales.end())
+                {
+                        llwarns << "Scale deformation already supplied for joint " << joint->getName() << "." << llendl;
+                }
+
+                // store it
+                mJointScales[joint] = bone_info->mScaleDeformation;
+
+                // apply to children that need to inherit it
+                for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
+                     iter != joint->mChildren.end(); ++iter)
+                {
+                        LLViewerJoint* child_joint = (LLViewerJoint*)(*iter);
+                        if (child_joint->inheritScale())
+                        {
+                                LLVector3 childDeformation = LLVector3(child_joint->getScale());
+                                childDeformation.scaleVec(bone_info->mScaleDeformation);
+                                mJointScales[child_joint] = childDeformation;
+                        }
+                }
+
+                if (bone_info->mHasPositionDeformation)
+                {
+                        if (mJointOffsets.find(joint) != mJointOffsets.end())
+                        {
+                                llwarns << "Offset deformation already supplied for joint " << joint->getName() << "." << llendl;
+                        }
+                        mJointOffsets[joint] = bone_info->mPositionDeformation;
+                }
+        }
+        return TRUE;
 }
 
 /*virtual*/ LLViewerVisualParam* LLPolySkeletalDistortion::cloneParam(LLWearable* wearable) const
 {
-	LLPolySkeletalDistortion *new_param = new LLPolySkeletalDistortion(mAvatar);
-	*new_param = *this;
-	return new_param;
+        LLPolySkeletalDistortion *new_param = new LLPolySkeletalDistortion(mAvatar);
+        *new_param = *this;
+        return new_param;
 }
 
 //-----------------------------------------------------------------------------
@@ -1162,54 +1185,89 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
 //-----------------------------------------------------------------------------
 void LLPolySkeletalDistortion::apply( ESex avatar_sex )
 {
-	F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
-
-	LLJoint* joint;
-	joint_vec_map_t::iterator iter;
-
-	for (iter = mJointScales.begin();
-		 iter != mJointScales.end();
-		 iter++)
-	{
-		joint = iter->first;
-		LLVector3 newScale = joint->getScale();
-		LLVector3 scaleDelta = iter->second;
-		newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta);
-		joint->setScale(newScale);
-	}
-
-	for (iter = mJointOffsets.begin();
-		 iter != mJointOffsets.end();
-		 iter++)
-	{
-		joint = iter->first;
-		LLVector3 newPosition = joint->getPosition();
-		LLVector3 positionDelta = iter->second;
-		newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
-		joint->setPosition(newPosition);
-	}
-
-	if (mLastWeight != mCurWeight && !mIsAnimating)
-	{
-		mAvatar->setSkeletonSerialNum(mAvatar->getSkeletonSerialNum() + 1);
-	}
-	mLastWeight = mCurWeight;
+        F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
+
+        LLJoint* joint;
+        joint_vec_map_t::iterator iter;
+
+        for (iter = mJointScales.begin();
+             iter != mJointScales.end();
+             iter++)
+        {
+                joint = iter->first;
+                LLVector3 newScale = joint->getScale();
+                LLVector3 scaleDelta = iter->second;
+                newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta);
+                joint->setScale(newScale);
+        }
+
+        for (iter = mJointOffsets.begin();
+             iter != mJointOffsets.end();
+             iter++)
+        {
+                joint = iter->first;
+                LLVector3 newPosition = joint->getPosition();
+                LLVector3 positionDelta = iter->second;
+                newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
+                joint->setPosition(newPosition);
+        }
+
+        if (mLastWeight != mCurWeight && !mIsAnimating)
+        {
+                mAvatar->setSkeletonSerialNum(mAvatar->getSkeletonSerialNum() + 1);
+        }
+        mLastWeight = mCurWeight;
 }
 
 
-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] = direction;
-		cloned_morph_data->mNormals[v] = LLVector3(0,0,0);
-		cloned_morph_data->mBinormals[v] = LLVector3(0,0,0);
-	}
-	return cloned_morph_data;
+        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;
+        for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
+        {
+                cloned_morph_data->mCoords[v] = direction;
+                cloned_morph_data->mNormals[v] = LLVector3(0,0,0);
+                cloned_morph_data->mBinormals[v] = LLVector3(0,0,0);
+        }
+        return cloned_morph_data;
+}
+
+LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data,
+                                            F32 scale,
+                                            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]*scale;
+                cloned_morph_data->mNormals[v] = src_data->mNormals[v]*scale;
+                cloned_morph_data->mBinormals[v] = src_data->mBinormals[v]*scale;
+                if (cloned_morph_data->mCoords[v][1] < 0)
+                {
+                        cloned_morph_data->mCoords[v][1] *= -1;
+                        cloned_morph_data->mNormals[v][1] *= -1;
+                        cloned_morph_data->mBinormals[v][1] *= -1;
+                }
+        }
+        return cloned_morph_data;
 }
 
 // End
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 5f9e34390702fb4d874706603d0fcfb29c9161cc..799ed433d76f52acdd6318fde1104e1b705d39be 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1017,6 +1017,13 @@ void LLVOAvatarSelf::wearableUpdated( LLWearableType::EType type, BOOL upload_re
 			}
 		}
 	}
+	
+	// Physics type has no associated baked textures, but change of params needs to be sent to
+	// other avatars.
+	if (type == LLWearableType::WT_PHYSICS)
+	  {
+	    gAgent.sendAgentSetAppearance();
+	  }
 }
 
 //-----------------------------------------------------------------------------
diff --git a/indra/newview/skins/default/textures/icons/Inv_Physics.png b/indra/newview/skins/default/textures/icons/Inv_Physics.png
index ddd36b446b1e72d9faec4952b3b7b202646a049c..360baec46d291923ec07f574df9022178f7c640a 100644
Binary files a/indra/newview/skins/default/textures/icons/Inv_Physics.png and b/indra/newview/skins/default/textures/icons/Inv_Physics.png differ
diff --git a/indra/newview/skins/default/xui/en/panel_edit_physics.xml b/indra/newview/skins/default/xui/en/panel_edit_physics.xml
index c6f974f4f1d30dbad1f34cb801a5833506052cd6..0092ceb0ddcf8fc7b421e99456b1d5a3767a6d71 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_physics.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_physics.xml
@@ -60,6 +60,20 @@
 				top_pad="50"
 				width="303" />
 		</accordion_tab>
+		<accordion_tab
+			layout="topleft"
+			fit_panel="false"
+			min_height="50"
+			name="physics_breasts_leftright_tab"
+			title="Breasts Sway">
+			<scrolling_panel_list
+				follows="all"
+				layout="topleft"
+				left="0"
+				name="physics_breasts_leftright_param_list"
+				top_pad="50"
+				width="303" />
+		</accordion_tab>
 		<accordion_tab
 			layout="topleft"
 			fit_panel="false"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index ed7814e0f0932779b8c10b754677d42e8fecec59..27295150c593e9f2189b52c846e8bc3c77b39f2f 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2500,8 +2500,8 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 <string name="Body Thin">Body Thin</string>
 
 <string name="Bow Legged">Bow Legged</string>
-<string name="Breast Physics UpDown Controller">Breast Buoyancy</string>
-<string name="Breast Physics InOut Controller">Breast Cleavage</string>
+<string name="Breast Buoyancy">Breast Buoyancy</string>
+<string name="Breast Cleavage">Breast Cleavage</string>
 <string name="Breast Size">Breast Size</string>
 <string name="Bridge Width">Bridge Width</string>
 <string name="Broad">Broad</string>
@@ -2514,44 +2514,47 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 <string name="Breast Physics Mass">Breast Mass</string>
 <string name="Breast Physics Smoothing">Breast Smoothing</string>
 <string name="Breast Physics Gravity">Breast Gravity</string>
+<string name="Breast Physics Drag">Breast Drag</string>
 
-<string name="Breast Physics InOut Max Speed">Max Effect</string>
+<string name="Breast Physics InOut Max Effect">Max Effect</string>
 <string name="Breast Physics InOut Spring">Spring</string>
 <string name="Breast Physics InOut Gain">Gain</string>
 <string name="Breast Physics InOut Damping">Damping</string>
-<string name="Breast Physics InOut Drag">Breast Cleavage Drag</string>
 
-<string name="Breast Physics UpDown Max Speed">Max Effect</string>
+<string name="Breast Physics UpDown Max Effect">Max Effect</string>
 <string name="Breast Physics UpDown Spring">Spring</string>
 <string name="Breast Physics UpDown Gain">Gain</string>
 <string name="Breast Physics UpDown Damping">Damping</string>
-<string name="Breast Physics UpDown Drag">Breast Bounce Drag</string>
+
+<string name="Breast Physics LeftRight Max Effect">Max Effect</string>
+<string name="Breast Physics LeftRight Spring">Spring</string>
+<string name="Breast Physics LeftRight Gain">Gain</string>
+<string name="Breast Physics LeftRight Damping">Damping</string>
 
 <string name="Belly Physics Mass">Belly Mass</string>
 <string name="Belly Physics Smoothing">Belly Smoothing</string>
 <string name="Belly Physics Gravity">Belly Gravity</string>
+<string name="Belly Physics Drag">Belly Drag</string>
 
-<string name="Belly Physics UpDown Max Speed">Max Effect</string>
+<string name="Belly Physics UpDown Max Effect">Max Effect</string>
 <string name="Belly Physics UpDown Spring">Spring</string>
 <string name="Belly Physics UpDown Gain">Gain</string>
 <string name="Belly Physics UpDown Damping">Damping</string>
-<string name="Belly Physics UpDown Drag">Belly Bounce Drag</string>
 
 <string name="Butt Physics Mass">Butt Mass</string>
 <string name="Butt Physics Smoothing">Butt Smoothing</string>
 <string name="Butt Physics Gravity">Butt Gravity</string>
+<string name="Butt Physics Drag">Butt Drag</string>
 
-<string name="Butt Physics UpDown Max Speed">Max Effect</string>
+<string name="Butt Physics UpDown Max Effect">Max Effect</string>
 <string name="Butt Physics UpDown Spring">Spring</string>
 <string name="Butt Physics UpDown Gain">Gain</string>
 <string name="Butt Physics UpDown Damping">Damping</string>
-<string name="Butt Physics UpDown Drag">Butt Bounce Drag</string>
 
-<string name="Butt Physics LeftRight Max Speed">Max Effect</string>
+<string name="Butt Physics LeftRight Max Effect">Max Effect</string>
 <string name="Butt Physics LeftRight Spring">Spring</string>
 <string name="Butt Physics LeftRight Gain">Gain</string>
 <string name="Butt Physics LeftRight Damping">Damping</string>
-<string name="Butt Physics LeftRight Drag">Butt Sway Drag</string>
 
 <string name="Bushy Eyebrows">Bushy Eyebrows</string>
 <string name="Bushy Hair">Bushy Hair</string>