summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/character/avatar_lad.xml8
-rw-r--r--indra/newview/llbreastmotion.cpp360
-rw-r--r--indra/newview/llbreastmotion.h161
-rw-r--r--indra/newview/llvoavatar.cpp382
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml4
6 files changed, 531 insertions, 386 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 630902c48f..fa65ca0aaa 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -91,6 +91,7 @@ set(viewer_SOURCE_FILES
llbottomtray.cpp
llbox.cpp
llbreadcrumbview.cpp
+ llbreastmotion.cpp
llbuycurrencyhtml.cpp
llcallbacklist.cpp
llcallfloater.cpp
@@ -613,6 +614,7 @@ set(viewer_HEADER_FILES
llbottomtray.h
llbox.h
llbreadcrumbview.h
+ llbreastmotion.h
llbuycurrencyhtml.h
llcallbacklist.h
llcallfloater.h
diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml
index 9609e58918..54794b849f 100644
--- a/indra/newview/character/avatar_lad.xml
+++ b/indra/newview/character/avatar_lad.xml
@@ -9139,7 +9139,7 @@ render_pass="bump">
label_max="More"
value_default="3"
value_min="0"
- value_max="5"
+ value_max="10"
camera_elevation=".3"
camera_distance=".8">
<param_driver />
@@ -9209,7 +9209,7 @@ render_pass="bump">
edit_group="physics"
label_min="Less"
label_max="More"
- value_default="0"
+ value_default="5"
value_min="0"
value_max="10"
camera_elevation=".3"
@@ -9230,7 +9230,7 @@ render_pass="bump">
label_max="More"
value_default="1.5"
value_min="0"
- value_max="5"
+ value_max="10"
camera_elevation=".3"
camera_distance=".8">
<param_driver />
@@ -9300,7 +9300,7 @@ render_pass="bump">
edit_group="physics"
label_min="Less"
label_max="More"
- value_default="0"
+ value_default="5"
value_min="0"
value_max="10"
camera_elevation=".3"
diff --git a/indra/newview/llbreastmotion.cpp b/indra/newview/llbreastmotion.cpp
new file mode 100644
index 0000000000..c773655f35
--- /dev/null
+++ b/indra/newview/llbreastmotion.cpp
@@ -0,0 +1,360 @@
+/**
+ * @file llbreastmotion.cpp
+ * @brief Implementation of LLBreastMotion class.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+//-----------------------------------------------------------------------------
+// Header Files
+//-----------------------------------------------------------------------------
+#include "llviewerprecompiledheaders.h"
+#include "linden_common.h"
+
+#include "m3math.h"
+#include "v3dmath.h"
+
+#include "llbreastmotion.h"
+#include "llcharacter.h"
+#include "llviewercontrol.h"
+#include "llviewervisualparam.H"
+
+// #define OUTPUT_BREAST_DATA
+
+//-----------------------------------------------------------------------------
+// LLBreastMotion()
+// Class Constructor
+//-----------------------------------------------------------------------------
+LLBreastMotion::LLBreastMotion(const LLUUID &id) :
+ LLMotion(id),
+ mCharacter(NULL),
+ mFileWrite(NULL)
+{
+ mName = "breast_motion";
+ mChestState = new LLJointState;
+
+ mBreastMassParam = (F32)1.0;
+ mBreastDragParam = LLVector3((F32)0.1, (F32)0.1, (F32)0.1);
+ mBreastSmoothingParam = (U32)2;
+ mBreastGravityParam = (F32)0.0;
+
+ mBreastSpringParam = LLVector3((F32)3.0, (F32)0.0, (F32)3.0);
+ mBreastGainParam = LLVector3((F32)50.0, (F32)0.0, (F32)50.0);
+ mBreastDampingParam = LLVector3((F32)0.3, (F32)0.0, (F32)0.3);
+ mBreastMaxVelocityParam = LLVector3((F32)10.0, (F32)0.0, (F32)10.0);
+
+ mBreastParamsUser[0] = mBreastParamsUser[1] = mBreastParamsUser[2] = NULL;
+ mBreastParamsDriven[0] = mBreastParamsDriven[1] = mBreastParamsDriven[2] = NULL;
+
+ mCharLastPosition_world_pt = LLVector3(0,0,0);
+ mCharLastVelocity_local_vec = LLVector3(0,0,0);
+ mCharLastAcceleration_local_vec = LLVector3(0,0,0);
+ mBreastLastPosition_local_pt = LLVector3(0,0,0);
+ mBreastVelocity_local_vec = LLVector3(0,0,0);
+}
+
+
+
+//-----------------------------------------------------------------------------
+// ~LLBreastMotion()
+// Class Destructor
+//-----------------------------------------------------------------------------
+LLBreastMotion::~LLBreastMotion()
+{
+}
+
+BOOL LLBreastMotion::onActivate()
+{
+ return TRUE;
+}
+
+void LLBreastMotion::onDeactivate()
+{
+}
+
+LLMotion::LLMotionInitStatus LLBreastMotion::onInitialize(LLCharacter *character)
+{
+ mCharacter = character;
+ BOOL success = true;
+
+ if ( !mChestState->setJoint( character->getJoint( "mChest" ) ) ) { success = false; }
+
+ if (!success)
+ {
+ return STATUS_FAILURE;
+ }
+
+ mChestState->setUsage(LLJointState::ROT);
+ addJointState( mChestState );
+
+ // User-set params
+ static const std::string breast_param_names_user[3] =
+ {
+ "Breast_Female_Cleavage_Driver",
+ "",
+ "Breast_Gravity_Driver"
+ };
+
+ // Params driven by this algorithm
+ static const std::string breast_param_names_driven[3] =
+ {
+ "Breast_Female_Cleavage",
+ "",
+ "Breast_Gravity"
+ };
+
+ for (U32 i=0; i < 3; i++)
+ {
+ mBreastParamsUser[i] = NULL;
+ mBreastParamsDriven[i] = NULL;
+ mBreastParamsMin[i] = 0;
+ mBreastParamsMax[i] = 0;
+ if (breast_param_names_user[i] != "" && breast_param_names_driven[i] != "")
+ {
+ mBreastParamsUser[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_user[i].c_str());
+ mBreastParamsDriven[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_driven[i].c_str());
+ if (mBreastParamsDriven[i])
+ {
+ mBreastParamsMin[i] = mBreastParamsDriven[i]->getMinWeight();
+ mBreastParamsMax[i] = mBreastParamsDriven[i]->getMaxWeight();
+ }
+ }
+ }
+
+#ifdef OUTPUT_BREAST_DATA
+ //if (mCharacter->getSex() == SEX_FEMALE)
+ if (dynamic_cast<LLVOAvatarSelf *>(mCharacter))
+ {
+ mFileWrite = fopen("c:\\temp\\data.txt","w");
+ if (mFileWrite != NULL)
+ {
+ fprintf(mFileWrite,"Pos\tParam\tNet\tVel\t\tAccel\tSpring\tDamp\n");
+ }
+ }
+#endif
+
+ mTimer.reset();
+ return STATUS_SUCCESS;
+}
+
+
+
+F32 LLBreastMotion::calculateTimeDelta()
+{
+ const F32 time = mTimer.getElapsedTimeF32();
+ const F32 time_delta = time - mLastTime;
+
+ mLastTime = time;
+
+ return time_delta;
+}
+
+LLVector3 LLBreastMotion::toLocal(const LLVector3 &world_vector)
+{
+ LLVector3 local_vec(0,0,0);
+
+ LLJoint *chest_joint = mChestState->getJoint();
+ const LLQuaternion world_rot = chest_joint->getWorldRotation();
+
+ // -1 because cleavage param changes opposite to direction.
+ LLVector3 breast_dir_world_vec = LLVector3(-1,0,0) * world_rot;
+ breast_dir_world_vec.normalize();
+ local_vec[0] = world_vector * breast_dir_world_vec;
+
+ LLVector3 breast_up_dir_world_vec = LLVector3(0,0,1) * world_rot;
+ breast_up_dir_world_vec.normalize();
+ local_vec[2] = world_vector * breast_up_dir_world_vec;
+
+ /*
+ {
+ llinfos << "Dir: " << breast_dir_world_vec << "V: " << world_vector << "DP: " << local_vec[0] << " time: " << llendl;
+ }
+ */
+
+ return local_vec;
+}
+
+LLVector3 LLBreastMotion::calculateVelocity_local(const F32 time_delta)
+{
+ LLJoint *chest_joint = mChestState->getJoint();
+ const LLVector3 world_pos_pt = chest_joint->getWorldPosition();
+ const LLQuaternion world_rot = chest_joint->getWorldRotation();
+ const LLVector3 last_world_pos_pt = mCharLastPosition_world_pt;
+ const LLVector3 char_velocity_world_vec = (world_pos_pt-last_world_pos_pt) / time_delta;
+ const LLVector3 char_velocity_local_vec = toLocal(char_velocity_world_vec);
+
+ return char_velocity_local_vec;
+}
+
+LLVector3 LLBreastMotion::calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
+ const F32 time_delta)
+{
+ LLVector3 char_acceleration_local_vec = new_char_velocity_local_vec - mCharLastVelocity_local_vec;
+
+ char_acceleration_local_vec =
+ char_acceleration_local_vec * 1.0/mBreastSmoothingParam +
+ mCharLastAcceleration_local_vec * (mBreastSmoothingParam-1.0)/mBreastSmoothingParam;
+
+ mCharLastAcceleration_local_vec = char_acceleration_local_vec;
+
+ return char_acceleration_local_vec;
+}
+
+// called per time step
+// must return TRUE while it is active, and
+// must return FALSE when the motion is completed.
+BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask)
+{
+ if (!gSavedSettings.getBOOL("AvatarPhysics"))
+ {
+ return TRUE;
+ }
+
+ /* TEST:
+ 1. Change outfits
+ 2. FPS effect
+ 3. Add disable
+ 4. Disappearing chests
+ 5. Overwrites breast params
+ 6. Threshold for not setting param
+ 7. Switch params or take off wearable makes breasts jump
+ */
+
+ mBreastMassParam = mCharacter->getVisualParamWeight("Breast_Physics_Mass");
+ mBreastSmoothingParam = mCharacter->getVisualParamWeight("Breast_Physics_Smoothing");
+ mBreastGravityParam = mCharacter->getVisualParamWeight("Breast_Physics_Gravity");
+
+ mBreastSpringParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Spring");
+ mBreastGainParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Gain");
+ mBreastDampingParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Damping");
+ mBreastMaxVelocityParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Max_Velocity");
+ mBreastDragParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Drag");
+
+ mBreastSpringParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Spring");
+ mBreastGainParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Gain");
+ mBreastDampingParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Damping");
+ mBreastMaxVelocityParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Max_Velocity");
+ mBreastDragParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Drag");
+
+ if (mCharacter->getSex() != SEX_FEMALE) return TRUE;
+ const F32 time_delta = calculateTimeDelta();
+ if (time_delta < .01 || time_delta > 10.0) return TRUE;
+
+
+ LLVector3 breast_user_local_pt(0,0,0);
+
+ for (U32 i=0; i < 3; i++)
+ {
+ if (mBreastParamsUser[i] != NULL)
+ {
+ breast_user_local_pt[i] = mBreastParamsUser[i]->getWeight();
+ }
+ }
+
+ LLVector3 breast_current_local_pt = mBreastLastPosition_local_pt;
+
+ const LLVector3 char_velocity_local_vec = calculateVelocity_local(time_delta);
+ const LLVector3 char_acceleration_local_vec = calculateAcceleration_local(char_velocity_local_vec, time_delta);
+ mCharLastVelocity_local_vec = char_velocity_local_vec;
+
+ LLJoint *chest_joint = mChestState->getJoint();
+ mCharLastPosition_world_pt = chest_joint->getWorldPosition();
+
+
+ const LLVector3 spring_length_local = breast_current_local_pt-breast_user_local_pt;
+ LLVector3 force_spring_local_vec = -spring_length_local; force_spring_local_vec *= mBreastSpringParam;
+
+ LLVector3 force_accel_local_vec = char_acceleration_local_vec * mBreastMassParam;
+ const LLVector3 force_gravity_local_vec = toLocal(LLVector3(0,0,1))* mBreastGravityParam * mBreastMassParam;
+ force_accel_local_vec += force_gravity_local_vec;
+ force_accel_local_vec[0] *= mBreastGainParam[0];
+ force_accel_local_vec[1] *= mBreastGainParam[1];
+ force_accel_local_vec[2] *= mBreastGainParam[2];
+
+ LLVector3 force_damping_local_vec = -mBreastDampingParam; force_damping_local_vec *= mBreastVelocity_local_vec;
+
+ LLVector3 force_drag_local_vec = .5*char_velocity_local_vec; // should square char_velocity_vec
+ force_drag_local_vec[0] *= mBreastDragParam[0];
+ force_drag_local_vec[1] *= mBreastDragParam[1];
+ force_drag_local_vec[2] *= mBreastDragParam[2];
+
+ LLVector3 force_net_local_vec =
+ force_accel_local_vec +
+ force_gravity_local_vec +
+ force_spring_local_vec +
+ force_damping_local_vec +
+ force_drag_local_vec;
+
+
+ LLVector3 acceleration_local_vec = force_net_local_vec / mBreastMassParam;
+ mBreastVelocity_local_vec += acceleration_local_vec;
+ mBreastVelocity_local_vec.clamp(-mBreastMaxVelocityParam, mBreastMaxVelocityParam);
+
+ LLVector3 new_local_pt = breast_current_local_pt + mBreastVelocity_local_vec*time_delta;
+ new_local_pt.clamp(mBreastParamsMin,mBreastParamsMax);
+
+
+ for (U32 i=0; i < 3; i++)
+ {
+ if (mBreastMaxVelocityParam[0] == 0)
+ {
+ new_local_pt[i] = breast_user_local_pt[i];
+ }
+ if (mBreastParamsDriven[i])
+ {
+ mCharacter->setVisualParamWeight(mBreastParamsDriven[i],
+ new_local_pt[i],
+ FALSE);
+ }
+ }
+
+ if (mFileWrite != NULL)
+ {
+ fprintf(mFileWrite,"%f\t%f\t%f\t%f\t\t%f\t%f\t%f\t \t%f\t%f\t%f\t%f\t%f\t%f\n",
+ mCharLastPosition_world_pt[2],
+ breast_current_local_pt[2],
+ acceleration_local_vec[2],
+ mBreastVelocity_local_vec[2],
+
+ force_accel_local_vec[2],
+ force_spring_local_vec[2],
+ force_damping_local_vec[2],
+
+ force_accel_local_vec[2],
+ force_damping_local_vec[2],
+ force_drag_local_vec[2],
+ force_net_local_vec[2],
+ time_delta,
+ mBreastMassParam
+ );
+ }
+
+ mBreastLastPosition_local_pt = new_local_pt;
+ mCharacter->updateVisualParams();
+ return TRUE;
+}
diff --git a/indra/newview/llbreastmotion.h b/indra/newview/llbreastmotion.h
new file mode 100644
index 0000000000..7dbe604a76
--- /dev/null
+++ b/indra/newview/llbreastmotion.h
@@ -0,0 +1,161 @@
+/**
+ * @file llbreastmotion.h
+ * @brief Implementation of LLBreastMotion class.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLBREASTMOTION_H
+#define LL_LLBREASTMOTION_H
+
+//-----------------------------------------------------------------------------
+// Header files
+//-----------------------------------------------------------------------------
+#include "llmotion.h"
+#include "llframetimer.h"
+
+#define MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION 500.f;
+#define BREAST_MOTION_FADEIN_TIME 1.0f
+#define BREAST_MOTION_FADEOUT_TIME 1.0f
+
+class LLViewerVisualParam;
+
+//-----------------------------------------------------------------------------
+// class LLBreastMotion
+//-----------------------------------------------------------------------------
+class LLBreastMotion :
+ public LLMotion
+{
+public:
+ // Constructor
+ LLBreastMotion(const LLUUID &id);
+
+ // Destructor
+ virtual ~LLBreastMotion();
+
+public:
+ //-------------------------------------------------------------------------
+ // functions to support MotionController and MotionRegistry
+ //-------------------------------------------------------------------------
+
+ // static constructor
+ // all subclasses must implement such a function and register it
+ static LLMotion *create(const LLUUID &id) { return new LLBreastMotion(id); }
+
+public:
+ //-------------------------------------------------------------------------
+ // animation callbacks to be implemented by subclasses
+ //-------------------------------------------------------------------------
+
+ // motions must specify whether or not they loop
+ virtual BOOL getLoop() { return TRUE; }
+
+ // motions must report their total duration
+ virtual F32 getDuration() { return 0.0; }
+
+ // motions must report their "ease in" duration
+ virtual F32 getEaseInDuration() { return BREAST_MOTION_FADEIN_TIME; }
+
+ // motions must report their "ease out" duration.
+ virtual F32 getEaseOutDuration() { return BREAST_MOTION_FADEOUT_TIME; }
+
+ // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
+ virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION; }
+
+ // motions must report their priority
+ virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
+
+ virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
+
+ // run-time (post constructor) initialization,
+ // called after parameters have been set
+ // must return true to indicate success and be available for activation
+ virtual LLMotionInitStatus onInitialize(LLCharacter *character);
+
+ // called when a motion is activated
+ // must return TRUE to indicate success, or else
+ // it will be deactivated
+ virtual BOOL onActivate();
+
+ // called per time step
+ // must return TRUE while it is active, and
+ // must return FALSE when the motion is completed.
+ virtual BOOL onUpdate(F32 time, U8* joint_mask);
+
+ // called when a motion is deactivated
+ virtual void onDeactivate();
+
+protected:
+ LLVector3 toLocal(const LLVector3 &world_vector);
+ LLVector3 calculateVelocity_local(const F32 time_delta);
+ LLVector3 calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
+ const F32 time_delta);
+ F32 calculateTimeDelta();
+private:
+ //-------------------------------------------------------------------------
+ // joint states to be animated
+ //-------------------------------------------------------------------------
+ LLPointer<LLJointState> mChestState;
+ LLCharacter* mCharacter;
+
+
+ //-------------------------------------------------------------------------
+ // miscellaneous parameters
+ //-------------------------------------------------------------------------
+ LLViewerVisualParam *mBreastParamsUser[3];
+ LLViewerVisualParam *mBreastParamsDriven[3];
+ LLVector3 mBreastParamsMin;
+ LLVector3 mBreastParamsMax;
+
+ LLVector3 mCharLastPosition_world_pt; // Last position of the avatar
+ LLVector3 mCharLastVelocity_local_vec; // How fast the character is moving
+ LLVector3 mCharLastAcceleration_local_vec; // Change in character velocity
+
+ LLVector3 mBreastLastPosition_local_pt; // Last parameters for breast
+ LLVector3 mBreastVelocity_local_vec; // How fast the breast params are moving
+
+
+ F32 mBreastMassParam;
+ F32 mBreastGravityParam;
+ U32 mBreastSmoothingParam;
+
+ LLVector3 mBreastSpringParam;
+ LLVector3 mBreastDampingParam;
+ LLVector3 mBreastGainParam;
+ LLVector3 mBreastMaxVelocityParam;
+ LLVector3 mBreastDragParam;
+
+ LLFrameTimer mTimer;
+ F32 mLastTime;
+
+ FILE *mFileWrite;
+ U32 mFileTicks;
+};
+
+#endif // LL_LLBREASTMOTION_H
+
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index c9e47d8996..b98c64310d 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -46,6 +46,7 @@
#include "llagentwearables.h"
#include "llanimationstates.h"
#include "llavatarpropertiesprocessor.h"
+#include "llbreastmotion.h"
#include "llviewercontrol.h"
#include "lldrawpoolavatar.h"
#include "lldriverparam.h"
@@ -120,7 +121,7 @@ const LLUUID ANIM_AGENT_HEAD_ROT = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d"
const LLUUID ANIM_AGENT_PELVIS_FIX = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b"); //"pelvis_fix"
const LLUUID ANIM_AGENT_TARGET = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55"); //"target"
const LLUUID ANIM_AGENT_WALK_ADJUST = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d"); //"walk_adjust"
-const LLUUID ANIM_AGENT_BREAST_MOTION = LLUUID("ce52c2b2-b62a-1e90-6152-7cd1efe2fd60"); //"breast_motion"
+const LLUUID ANIM_AGENT_BREAST_MOTION = LLUUID("7360e029-3cb8-ebc4-863e-212df440d987"); //"breast_motion"
//-----------------------------------------------------------------------------
@@ -576,385 +577,6 @@ private:
LLCharacter* mCharacter;
};
-//-----------------------------------------------------------------------------
-// class LLBreatheMotionRot
-//-----------------------------------------------------------------------------
-class LLBreastMotion :
- public LLMotion
-{
-public:
- // Constructor
- LLBreastMotion(const LLUUID &id) :
- LLMotion(id),
- mCharacter(NULL),
- mFileWrite(NULL)
- {
- mName = "breast_motion";
- mChestState = new LLJointState;
-
- mBreastMassParam = (F32)1.0;
- mBreastDragParam = LLVector3((F32)0.1, (F32)0.1, (F32)0.1);
- mBreastSmoothingParam = (U32)2;
- mBreastGravityParam = (F32)0.0;
-
- mBreastSpringParam = LLVector3((F32)3.0, (F32)0.0, (F32)3.0);
- mBreastGainParam = LLVector3((F32)50.0, (F32)0.0, (F32)50.0);
- mBreastDampingParam = LLVector3((F32)0.3, (F32)0.0, (F32)0.3);
- mBreastMaxVelocityParam = LLVector3((F32)10.0, (F32)0.0, (F32)10.0);
-
- mBreastParamsUser[0] = mBreastParamsUser[1] = mBreastParamsUser[2] = NULL;
- mBreastParamsDriven[0] = mBreastParamsDriven[1] = mBreastParamsDriven[2] = NULL;
-
- mCharLastPosition_world_pt = LLVector3(0,0,0);
- mCharLastVelocity_local_vec = LLVector3(0,0,0);
- mCharLastAcceleration_local_vec = LLVector3(0,0,0);
- mBreastLastPosition_local_pt = LLVector3(0,0,0);
- mBreastVelocity_local_vec = LLVector3(0,0,0);
- }
-
- // Destructor
- virtual ~LLBreastMotion() {}
-
-public:
- //-------------------------------------------------------------------------
- // functions to support MotionController and MotionRegistry
- //-------------------------------------------------------------------------
- // static constructor
- // all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLBreastMotion(id); }
-
-public:
- //-------------------------------------------------------------------------
- // animation callbacks to be implemented by subclasses
- //-------------------------------------------------------------------------
-
- // motions must specify whether or not they loop
- virtual BOOL getLoop() { return TRUE; }
-
- // motions must report their total duration
- virtual F32 getDuration() { return 0.0; }
-
- // motions must report their "ease in" duration
- virtual F32 getEaseInDuration() { return 0.0; }
-
- // motions must report their "ease out" duration.
- virtual F32 getEaseOutDuration() { return 0.0; }
-
- // motions must report their priority
- virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
-
- virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
-
- // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
- virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_BREATHE; }
-
- // run-time (post constructor) initialization,
- // called after parameters have been set
- // must return true to indicate success and be available for activation
- virtual LLMotionInitStatus onInitialize(LLCharacter *character)
- {
- mCharacter = character;
- BOOL success = true;
-
- if ( !mChestState->setJoint( character->getJoint( "mChest" ) ) ) { success = false; }
-
- if (!success)
- {
- return STATUS_FAILURE;
- }
-
- mChestState->setUsage(LLJointState::ROT);
- addJointState( mChestState );
-
- // User-set params
- static const std::string breast_param_names_user[3] =
- {
- "Breast_Female_Cleavage_Driver",
- "",
- "Breast_Gravity_Driver"
- };
-
- // Params driven by this algorithm
- static const std::string breast_param_names_driven[3] =
- {
- "Breast_Female_Cleavage",
- "",
- "Breast_Gravity"
- };
-
- for (U32 i=0; i < 3; i++)
- {
- mBreastParamsUser[i] = NULL;
- mBreastParamsDriven[i] = NULL;
- mBreastParamsMin[i] = 0;
- mBreastParamsMax[i] = 0;
- if (breast_param_names_user[i] != "" && breast_param_names_driven[i] != "")
- {
- mBreastParamsUser[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_user[i].c_str());
- mBreastParamsDriven[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_driven[i].c_str());
- if (mBreastParamsDriven[i])
- {
- mBreastParamsMin[i] = mBreastParamsDriven[i]->getMinWeight();
- mBreastParamsMax[i] = mBreastParamsDriven[i]->getMaxWeight();
- }
- }
- }
-
-#ifdef OUTPUT_BREAST_DATA
- //if (mCharacter->getSex() == SEX_FEMALE)
- if (dynamic_cast<LLVOAvatarSelf *>(mCharacter))
- {
- mFileWrite = fopen("c:\\temp\\data.txt","w");
- if (mFileWrite != NULL)
- {
- fprintf(mFileWrite,"Pos\tParam\tNet\tVel\t\tAccel\tSpring\tDamp\n");
- }
- }
-#endif
-
- mTimer.reset();
- return STATUS_SUCCESS;
- }
-
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate() { return TRUE; }
-
- F32 calculateTimeDelta()
- {
- const F32 time = mTimer.getElapsedTimeF32();
- const F32 time_delta = time - mLastTime;
-
- mLastTime = time;
-
- return time_delta;
- }
-
- LLVector3 toLocal(const LLVector3 &world_vector)
- {
- LLVector3 local_vec(0,0,0);
-
- LLJoint *chest_joint = mChestState->getJoint();
- const LLQuaternion world_rot = chest_joint->getWorldRotation();
-
- // -1 because cleavage param changes opposite to direction.
- LLVector3 breast_dir_world_vec = LLVector3(-1,0,0) * world_rot;
- breast_dir_world_vec.normalize();
- local_vec[0] = world_vector * breast_dir_world_vec;
-
- LLVector3 breast_up_dir_world_vec = LLVector3(0,0,1) * world_rot;
- breast_up_dir_world_vec.normalize();
- local_vec[2] = world_vector * breast_up_dir_world_vec;
-
- /*
- {
- llinfos << "Dir: " << breast_dir_world_vec << "V: " << world_vector << "DP: " << local_vec[0] << " time: " << llendl;
- }
- */
-
- return local_vec;
- }
-
- LLVector3 calculateVelocity_local(const F32 time_delta)
- {
- LLJoint *chest_joint = mChestState->getJoint();
- const LLVector3 world_pos_pt = chest_joint->getWorldPosition();
- const LLQuaternion world_rot = chest_joint->getWorldRotation();
- const LLVector3 last_world_pos_pt = mCharLastPosition_world_pt;
- const LLVector3 char_velocity_world_vec = (world_pos_pt-last_world_pos_pt) / time_delta;
- const LLVector3 char_velocity_local_vec = toLocal(char_velocity_world_vec);
-
- return char_velocity_local_vec;
- }
-
- LLVector3 calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
- const F32 time_delta)
- {
- LLVector3 char_acceleration_local_vec = new_char_velocity_local_vec - mCharLastVelocity_local_vec;
-
- char_acceleration_local_vec =
- char_acceleration_local_vec * 1.0/mBreastSmoothingParam +
- mCharLastAcceleration_local_vec * (mBreastSmoothingParam-1.0)/mBreastSmoothingParam;
-
- mCharLastAcceleration_local_vec = char_acceleration_local_vec;
-
- return char_acceleration_local_vec;
- }
-
- // called per time step
- // must return TRUE while it is active, and
- // must return FALSE when the motion is completed.
- virtual BOOL onUpdate(F32 time, U8* joint_mask)
- {
- if (!gSavedSettings.getBOOL("AvatarPhysics"))
- {
- return TRUE;
- }
-
- /* TEST:
- 1. Change outfits
- 2. FPS effect
- 3. Add disable
- 4. Disappearing chests
- 5. Overwrites breast params
- 6. Threshold for not setting param
- */
-
- mBreastMassParam = mCharacter->getVisualParamWeight("Breast_Physics_Mass");
- mBreastSmoothingParam = mCharacter->getVisualParamWeight("Breast_Physics_Smoothing");
- mBreastGravityParam = mCharacter->getVisualParamWeight("Breast_Physics_Gravity");
-
- mBreastSpringParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Spring");
- mBreastGainParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Gain");
- mBreastDampingParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Damping");
- mBreastMaxVelocityParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Max_Velocity");
- mBreastDragParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Drag");
-
- mBreastSpringParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Spring");
- mBreastGainParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Gain");
- mBreastDampingParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Damping");
- mBreastMaxVelocityParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Max_Velocity");
- mBreastDragParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Drag");
-
- if (mCharacter->getSex() != SEX_FEMALE) return TRUE;
- const F32 time_delta = calculateTimeDelta();
- if (time_delta < .01 || time_delta > 10.0) return TRUE;
-
-
- LLVector3 breast_user_local_pt(0,0,0);
-
- for (U32 i=0; i < 3; i++)
- {
- if (mBreastParamsUser[i] != NULL)
- {
- breast_user_local_pt[i] = mBreastParamsUser[i]->getWeight();
- }
- }
-
- LLVector3 breast_current_local_pt = mBreastLastPosition_local_pt;
-
- const LLVector3 char_velocity_local_vec = calculateVelocity_local(time_delta);
- const LLVector3 char_acceleration_local_vec = calculateAcceleration_local(char_velocity_local_vec, time_delta);
- mCharLastVelocity_local_vec = char_velocity_local_vec;
-
- LLJoint *chest_joint = mChestState->getJoint();
- mCharLastPosition_world_pt = chest_joint->getWorldPosition();
-
-
- const LLVector3 spring_length_local = breast_current_local_pt-breast_user_local_pt;
- LLVector3 force_spring_local_vec = -spring_length_local; force_spring_local_vec *= mBreastSpringParam;
-
- LLVector3 force_accel_local_vec = char_acceleration_local_vec * mBreastMassParam;
- const LLVector3 force_gravity_local_vec = toLocal(LLVector3(0,0,1))* mBreastGravityParam * mBreastMassParam;
- force_accel_local_vec += force_gravity_local_vec;
- force_accel_local_vec[0] *= mBreastGainParam[0];
- force_accel_local_vec[1] *= mBreastGainParam[1];
- force_accel_local_vec[2] *= mBreastGainParam[2];
-
- LLVector3 force_damping_local_vec = -mBreastDampingParam; force_damping_local_vec *= mBreastVelocity_local_vec;
-
- LLVector3 force_drag_local_vec = .5*char_velocity_local_vec; // should square char_velocity_vec
- force_drag_local_vec[0] *= mBreastDragParam[0];
- force_drag_local_vec[1] *= mBreastDragParam[1];
- force_drag_local_vec[2] *= mBreastDragParam[2];
-
- LLVector3 force_net_local_vec =
- force_accel_local_vec +
- force_gravity_local_vec +
- force_spring_local_vec +
- force_damping_local_vec +
- force_drag_local_vec;
-
-
- LLVector3 acceleration_local_vec = force_net_local_vec / mBreastMassParam;
- mBreastVelocity_local_vec += acceleration_local_vec;
- mBreastVelocity_local_vec.clamp(-mBreastMaxVelocityParam, mBreastMaxVelocityParam);
-
- LLVector3 new_local_pt = breast_current_local_pt + mBreastVelocity_local_vec*time_delta;
- new_local_pt.clamp(mBreastParamsMin,mBreastParamsMax);
-
-
- for (U32 i=0; i < 3; i++)
- {
- if (mBreastMaxVelocityParam[0] == 0)
- {
- new_local_pt[i] = breast_user_local_pt[i];
- }
- if (mBreastParamsDriven[i])
- {
- mCharacter->setVisualParamWeight(mBreastParamsDriven[i],
- new_local_pt[i],
- FALSE);
- }
- }
-
- if (mFileWrite != NULL)
- {
- fprintf(mFileWrite,"%f\t%f\t%f\t%f\t\t%f\t%f\t%f\t \t%f\t%f\t%f\t%f\t%f\t%f\n",
- mCharLastPosition_world_pt[2],
- breast_current_local_pt[2],
- acceleration_local_vec[2],
- mBreastVelocity_local_vec[2],
-
- force_accel_local_vec[2],
- force_spring_local_vec[2],
- force_damping_local_vec[2],
-
- force_accel_local_vec[2],
- force_damping_local_vec[2],
- force_drag_local_vec[2],
- force_net_local_vec[2],
- time_delta,
- mBreastMassParam
- );
- }
-
- mBreastLastPosition_local_pt = new_local_pt;
- mCharacter->updateVisualParams();
- return TRUE;
- }
-
- // called when a motion is deactivated
- virtual void onDeactivate() {}
-
-private:
- //-------------------------------------------------------------------------
- // joint states to be animated
- //-------------------------------------------------------------------------
- LLPointer<LLJointState> mChestState;
- LLCharacter* mCharacter;
-
- LLViewerVisualParam *mBreastParamsUser[3];
- LLViewerVisualParam *mBreastParamsDriven[3];
- LLVector3 mBreastParamsMin;
- LLVector3 mBreastParamsMax;
-
- LLVector3 mCharLastPosition_world_pt; // Last position of the avatar
- LLVector3 mCharLastVelocity_local_vec; // How fast the character is moving
- LLVector3 mCharLastAcceleration_local_vec; // Change in character velocity
-
- LLVector3 mBreastLastPosition_local_pt; // Last parameters for breast
- LLVector3 mBreastVelocity_local_vec; // How fast the breast params are moving
-
-
- F32 mBreastMassParam;
- F32 mBreastGravityParam;
- U32 mBreastSmoothingParam;
-
- LLVector3 mBreastSpringParam;
- LLVector3 mBreastDampingParam;
- LLVector3 mBreastGainParam;
- LLVector3 mBreastMaxVelocityParam;
- LLVector3 mBreastDragParam;
-
- LLFrameTimer mTimer;
- F32 mLastTime;
-
- FILE *mFileWrite;
- U32 mFileTicks;
-};
-
/**
**
** End LLVOAvatar Support classes
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 9fbb1ed045..8b5389fd90 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2482,13 +2482,13 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
<string name="Breast Physics Side Gain">Breast Side Gain</string>
<string name="Breast Physics Side Damping">Breast Side Damping</string>
<string name="Breast Physics Side Drag">Breast Side Drag</string>
-<string name="Breast Physics Side Max Velocity">Breast Side Max</string>
+<string name="Breast Physics Side Max Speed">Breast Side Max Speed</string>
<string name="Breast Physics UpDown Spring">Breast UpDown Spring</string>
<string name="Breast Physics UpDown Gain">Breast UpDown Gain</string>
<string name="Breast Physics UpDown Damping">Breast UpDown Damping</string>
<string name="Breast Physics UpDown Drag">Breast UpDown Drag</string>
-<string name="Breast Physics UpDown Max Velocity">Breast UpDown Range</string>
+<string name="Breast Physics UpDown Max Speed">Breast UpDown Max Speed</string>
<string name="Bushy Eyebrows">Bushy Eyebrows</string>
<string name="Bushy Hair">Bushy Hair</string>