From 717d81daa7f42d18ca37eb738ceacfe2b9c1a09a Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 21 Mar 2011 12:04:31 -0400 Subject: Added left-right butt control. Did a bunch of code cleanup. --- indra/newview/character/avatar_lad.xml | 39 ++++++- indra/newview/llphysicsmotion.cpp | 136 ++++++++++++++----------- indra/newview/llpolymesh.cpp | 82 +++++++-------- indra/newview/skins/default/xui/en/strings.xml | 1 + 4 files changed, 154 insertions(+), 104 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index 58fe82da9e..69512cdf34 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -4456,6 +4456,22 @@ + + + + + + + + + + initialize()) + controller_map_t controller_breast_inout; + controller_breast_inout["Mass"] = "Breast_Physics_Mass"; + controller_breast_inout["Smoothing"] = "Breast_Physics_Smoothing"; + controller_breast_inout["Gravity"] = "Breast_Physics_Gravity"; + controller_breast_inout["Damping"] = "Breast_Physics_Side_Damping"; + controller_breast_inout["Drag"] = "Breast_Physics_Side_Drag"; + controller_breast_inout["MaxSpeed"] = "Breast_Physics_Side_Max_Velocity"; + controller_breast_inout["Spring"] = "Breast_Physics_Side_Spring"; + controller_breast_inout["Gain"] = "Breast_Physics_Side_Gain"; + + LLPhysicsMotion *motion_breast_inout = new LLPhysicsMotion("Breast_Physics_Side_Controller", + "", + "mChest", + character, + LLVector3(-1,0,0), + controller_breast_inout); + if (!motion_breast_inout->initialize()) return STATUS_FAILURE; - addMotion(cleavage_motion); - - controller_map_t controllers_bounce; - controllers_bounce["Mass"] = "Breast_Physics_Mass"; - controllers_bounce["Smoothing"] = "Breast_Physics_Smoothing"; - controllers_bounce["Gravity"] = "Breast_Physics_Gravity"; - controllers_bounce["Damping"] = "Breast_Physics_UpDown_Damping"; - controllers_bounce["Drag"] = "Breast_Physics_UpDown_Drag"; - controllers_bounce["MaxSpeed"] = "Breast_Physics_UpDown_Max_Velocity"; - controllers_bounce["Spring"] = "Breast_Physics_UpDown_Spring"; - controllers_bounce["Gain"] = "Breast_Physics_UpDown_Gain"; - - LLPhysicsMotion *bounce_motion = new LLPhysicsMotion("Breast_Physics_UpDown_Controller", - "", - "mChest", - character, - LLVector3(0,0,1), - controllers_bounce); - if (!bounce_motion->initialize()) + addMotion(motion_breast_inout); + + controller_map_t controller_breast_updown; + controller_breast_updown["Mass"] = "Breast_Physics_Mass"; + controller_breast_updown["Smoothing"] = "Breast_Physics_Smoothing"; + controller_breast_updown["Gravity"] = "Breast_Physics_Gravity"; + controller_breast_updown["Damping"] = "Breast_Physics_UpDown_Damping"; + controller_breast_updown["Drag"] = "Breast_Physics_UpDown_Drag"; + controller_breast_updown["MaxSpeed"] = "Breast_Physics_UpDown_Max_Velocity"; + controller_breast_updown["Spring"] = "Breast_Physics_UpDown_Spring"; + controller_breast_updown["Gain"] = "Breast_Physics_UpDown_Gain"; + + LLPhysicsMotion *motion_breast_updown = new LLPhysicsMotion("Breast_Physics_UpDown_Controller", + "", + "mChest", + character, + LLVector3(0,0,1), + controller_breast_updown); + if (!motion_breast_updown->initialize()) { llassert_always(FALSE); return STATUS_FAILURE; } - addMotion(bounce_motion); - - controller_map_t controllers_butt_bounce; - controllers_butt_bounce["Damping"] = "Butt_Physics_Updown_Damping"; - controllers_butt_bounce["MaxSpeed"] = "Butt_Physics_Updown_Max_Velocity"; - controllers_butt_bounce["Spring"] = "Butt_Physics_Updown_Spring"; - controllers_butt_bounce["Gain"] = "Butt_Physics_Updown_Gain"; - LLPhysicsMotion *butt_bounce_motion = new LLPhysicsMotion("Butt_Physics_UpDown_Controller", + addMotion(motion_breast_updown); + + controller_map_t controller_butt_updown; + controller_butt_updown["Damping"] = "Butt_Physics_Updown_Damping"; + controller_butt_updown["MaxSpeed"] = "Butt_Physics_Updown_Max_Velocity"; + controller_butt_updown["Spring"] = "Butt_Physics_Updown_Spring"; + controller_butt_updown["Gain"] = "Butt_Physics_Updown_Gain"; + LLPhysicsMotion *motion_butt_updown = new LLPhysicsMotion("Butt_Physics_UpDown_Controller", "", "mPelvis", character, - LLVector3(0,0,-1), - controllers_butt_bounce); - if (!butt_bounce_motion->initialize()) + LLVector3(0,0,1), + controller_butt_updown); + if (!motion_butt_updown->initialize()) { llassert_always(FALSE); return STATUS_FAILURE; } - addMotion(butt_bounce_motion); - - controller_map_t controllers_belly_bounce; - controllers_belly_bounce["Damping"] = "Belly_Physics_Updown_Damping"; - controllers_belly_bounce["MaxSpeed"] = "Belly_Physics_Updown_Max_Velocity"; - controllers_belly_bounce["Spring"] = "Belly_Physics_Updown_Spring"; - controllers_belly_bounce["Gain"] = "Belly_Physics_Updown_Gain"; - LLPhysicsMotion *belly_bounce_motion = new LLPhysicsMotion("Belly_Physics_UpDown_Controller", + addMotion(motion_butt_updown); + + controller_map_t controller_butt_leftright; + controller_butt_leftright["Damping"] = "Butt_Physics_Updown_Damping"; + controller_butt_leftright["MaxSpeed"] = "Butt_Physics_Updown_Max_Velocity"; + controller_butt_leftright["Spring"] = "Butt_Physics_Updown_Spring"; + controller_butt_leftright["Gain"] = "Butt_Physics_Updown_Gain"; + LLPhysicsMotion *motion_butt_leftright = new LLPhysicsMotion("Butt_Physics_LeftRight_Controller", + "", + "mPelvis", + character, + LLVector3(0,1,0), + controller_butt_leftright); + if (!motion_butt_leftright->initialize()) + { + llassert_always(FALSE); + return STATUS_FAILURE; + } + addMotion(motion_butt_leftright); + + controller_map_t controller_belly_updown; + controller_belly_updown["Damping"] = "Belly_Physics_Updown_Damping"; + controller_belly_updown["MaxSpeed"] = "Belly_Physics_Updown_Max_Velocity"; + controller_belly_updown["Spring"] = "Belly_Physics_Updown_Spring"; + controller_belly_updown["Gain"] = "Belly_Physics_Updown_Gain"; + LLPhysicsMotion *motion_belly_updown = new LLPhysicsMotion("Belly_Physics_UpDown_Controller", "", "mChest", character, LLVector3(0,0,-1), - controllers_belly_bounce); - if (!belly_bounce_motion->initialize()) + controller_belly_updown); + if (!motion_belly_updown->initialize()) { llassert_always(FALSE); return STATUS_FAILURE; } - addMotion(belly_bounce_motion); - + addMotion(motion_belly_updown); + return STATUS_SUCCESS; } diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp index 626b7ca1eb..a28357b4a9 100644 --- a/indra/newview/llpolymesh.cpp +++ b/indra/newview/llpolymesh.cpp @@ -46,6 +46,10 @@ extern LLControlGroup gSavedSettings; // read only +LLPolyMorphData *clone_morph_param(const LLPolyMorphData *src_data, + const LLVector3 &direction, + const std::string &name); + //----------------------------------------------------------------------------- // Global table of loaded LLPolyMeshes //----------------------------------------------------------------------------- @@ -605,62 +609,36 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (!strcmp(morphName, "Big_Belly_Torso")) { - LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*morph_data); - cloned_morph_data->mName = std::string("Belly_Torso_Physics_UpDown_Driven"); - for (U32 v=0; v < morph_data->mNumIndices; v++) - { - cloned_morph_data->mCoords[v][0] = 0; - cloned_morph_data->mCoords[v][1] = 0; - cloned_morph_data->mCoords[v][2] = 0.05F; - cloned_morph_data->mNormals[v] = LLVector3(0,0,0); - cloned_morph_data->mBinormals[v] = LLVector3(0,0,0); - } - mMorphData.insert(cloned_morph_data); + mMorphData.insert(clone_morph_param(morph_data, + LLVector3(0,0,0.05f), + "Belly_Torso_Physics_UpDown_Driven")); } if (!strcmp(morphName, "Big_Belly_Legs")) { - LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*morph_data); - cloned_morph_data->mName = std::string("Belly_Legs_Physics_UpDown_Driven"); - for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) - { - cloned_morph_data->mCoords[v][0] = 0; - cloned_morph_data->mCoords[v][1] = 0; - cloned_morph_data->mCoords[v][2] = 0.05F; - cloned_morph_data->mNormals[v] = LLVector3(0,0,0); - cloned_morph_data->mBinormals[v] = LLVector3(0,0,0); - } - mMorphData.insert(cloned_morph_data); + mMorphData.insert(clone_morph_param(morph_data, + LLVector3(0,0,0.05f), + "Belly_Legs_Physics_UpDown_Driven")); } if (!strcmp(morphName, "skirt_belly")) { - LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*morph_data); - cloned_morph_data->mName = std::string("Belly_Skirt_Physics_UpDown_Driven"); - for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) - { - cloned_morph_data->mCoords[v][0] = 0; - cloned_morph_data->mCoords[v][1] = 0; - cloned_morph_data->mCoords[v][2] = 0.05F; - cloned_morph_data->mNormals[v] = LLVector3(0,0,0); - cloned_morph_data->mBinormals[v] = LLVector3(0,0,0); - } - mMorphData.insert(cloned_morph_data); + mMorphData.insert(clone_morph_param(morph_data, + LLVector3(0,0,0.05f), + "Belly_Skirt_Physics_UpDown_Driven")); } if (!strcmp(morphName, "Small_Butt")) { - LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*morph_data); - cloned_morph_data->mName = std::string("Butt_Physics_UpDown_Driven"); - for (U32 v=0; v < cloned_morph_data->mNumIndices; v++) - { - cloned_morph_data->mCoords[v][0] = 0; - cloned_morph_data->mCoords[v][1] = 0; - cloned_morph_data->mCoords[v][2] = 0.01F; - cloned_morph_data->mNormals[v] = LLVector3(0,0,0); - cloned_morph_data->mBinormals[v] = LLVector3(0,0,0); - } - mMorphData.insert(cloned_morph_data); + mMorphData.insert(clone_morph_param(morph_data, + LLVector3(0,0,0.01f), + "Butt_Physics_UpDown_Driven")); + } + if (!strcmp(morphName, "Small_Butt")) + { + mMorphData.insert(clone_morph_param(morph_data, + LLVector3(0,0.01f,0), + "Butt_Physics_LeftRight_Driven")); } } @@ -1218,4 +1196,20 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex ) mLastWeight = mCurWeight; } + +LLPolyMorphData *clone_morph_param(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; +} + // End diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index e5d52b03e5..e183b0ba78 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2534,6 +2534,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. Belly Updown Max Speed Butt UpDown Bounce +Butt LeftRight Bounce Butt UpDown Spring Butt UpDown Gain Butt UpDown Damping -- cgit v1.2.3