Undo a bit of regression in llphysicsmotion
This commit is contained in:
@@ -109,7 +109,9 @@ public:
|
|||||||
mLastTime(0),
|
mLastTime(0),
|
||||||
mPosition_local(0),
|
mPosition_local(0),
|
||||||
mVelocityJoint_local(0),
|
mVelocityJoint_local(0),
|
||||||
mPositionLastUpdate_local(0)
|
mPositionLastUpdate_local(0),
|
||||||
|
mAccelerationJoint_local(0),
|
||||||
|
mVelocity_local(0)
|
||||||
{
|
{
|
||||||
mJointState = new LLJointState;
|
mJointState = new LLJointState;
|
||||||
|
|
||||||
@@ -121,6 +123,8 @@ public:
|
|||||||
|
|
||||||
BOOL initialize();
|
BOOL initialize();
|
||||||
|
|
||||||
|
void getString(std::ostringstream &oss);
|
||||||
|
|
||||||
~LLPhysicsMotion() {}
|
~LLPhysicsMotion() {}
|
||||||
|
|
||||||
BOOL onUpdate(F32 time);
|
BOOL onUpdate(F32 time);
|
||||||
@@ -129,6 +133,8 @@ public:
|
|||||||
{
|
{
|
||||||
return mJointState;
|
return mJointState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset();
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
F32 getParamValue(eParamName param)
|
F32 getParamValue(eParamName param)
|
||||||
@@ -233,9 +239,85 @@ BOOL LLPhysicsMotion::initialize()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string LLPhysicsMotionController::getString()
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << "{" << std::endl <<
|
||||||
|
"Active: " << mActive << std::endl <<
|
||||||
|
"IsDefault: " << mIsDefault << std::endl <<
|
||||||
|
"Stopped: " << isStopped() << std::endl <<
|
||||||
|
"Name: " << getName() << std::endl <<
|
||||||
|
"ID: " << getID().asString() << std::endl;
|
||||||
|
|
||||||
|
for (motion_vec_t::iterator iter = mMotions.begin();iter != mMotions.end();++iter)
|
||||||
|
{
|
||||||
|
(*iter)->getString(oss);
|
||||||
|
}
|
||||||
|
oss << "}" << std::endl;
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
void getParamString(U32 depth, LLViewerVisualParam *param, std::ostringstream &oss)
|
||||||
|
{
|
||||||
|
std::string indent;
|
||||||
|
indent.resize(depth,' ');
|
||||||
|
|
||||||
|
oss <<
|
||||||
|
indent << "getID: " << param->getID() << std::endl <<
|
||||||
|
indent << "getName: " << param->getName() << std::endl <<
|
||||||
|
indent << "getDisplayName: " << param->getDisplayName() << std::endl <<
|
||||||
|
indent << "getGroup: " << param->getGroup() << std::endl <<
|
||||||
|
indent << "getSex: " << param->getSex() << std::endl <<
|
||||||
|
indent << "getMinWeight: " << param->getMinWeight() << std::endl <<
|
||||||
|
indent << "getMaxWeight: " << param->getMaxWeight() << std::endl <<
|
||||||
|
indent << "getDefaultWeight: " << param->getDefaultWeight() << std::endl <<
|
||||||
|
indent << "getWeight: " << param->getWeight() << std::endl <<
|
||||||
|
indent << "getCurrentWeight: " << param->getCurrentWeight() << std::endl <<
|
||||||
|
indent << "getLastWeight: " << param->getLastWeight() << std::endl <<
|
||||||
|
indent << "isAnimating: " << param->isAnimating() << std::endl <<
|
||||||
|
indent << "isTweakable: " << param->isTweakable() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLPhysicsMotion::getString(std::ostringstream &oss)
|
||||||
|
{
|
||||||
|
oss <<
|
||||||
|
" mParamDriverName: " << mParamDriverName << std::endl <<
|
||||||
|
" mParamControllerName: " << mParamControllerName << std::endl <<
|
||||||
|
" mMotionDirectionVec: " << mMotionDirectionVec << std::endl <<
|
||||||
|
" mJointName: " << mJointName << std::endl <<
|
||||||
|
" mPosition_local: " << mPosition_local << std::endl <<
|
||||||
|
" mVelocityJoint_local: " << mVelocityJoint_local << std::endl <<
|
||||||
|
" mAccelerationJoint_local: " << mAccelerationJoint_local << std::endl <<
|
||||||
|
" mPositionLastUpdate_local: " << mPositionLastUpdate_local << std::endl <<
|
||||||
|
" mPosition_world: " << mPosition_world << std::endl <<
|
||||||
|
" mVelocity_local: " << mVelocity_local << std::endl;
|
||||||
|
if(mParamDriver)
|
||||||
|
{
|
||||||
|
oss << " <DRIVER>" << std::endl;
|
||||||
|
getParamString(2,mParamDriver,oss);
|
||||||
|
LLDriverParam *driver_param = dynamic_cast<LLDriverParam *>(mParamDriver);
|
||||||
|
if(driver_param)
|
||||||
|
{
|
||||||
|
for (LLDriverParam::entry_list_t::iterator iter = driver_param->mDriven.begin();
|
||||||
|
iter != driver_param->mDriven.end();++iter)
|
||||||
|
{
|
||||||
|
oss << " <DRIVEN>" << std::endl;
|
||||||
|
getParamString(3,iter->mParam,oss);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
oss << " mParamDriver: (NULL)" << std::endl;
|
||||||
|
oss << " Controllers:" << std::endl;
|
||||||
|
for(controller_map_t::const_iterator it = mParamControllers.begin(); it!= mParamControllers.end(); ++it)
|
||||||
|
{
|
||||||
|
oss << " mParamControllers[\"" << it->first << "\"] = \"" << it->second << "\" =" << mCharacter->getVisualParamWeight(it->first.c_str()) << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LLPhysicsMotionController::LLPhysicsMotionController(const LLUUID &id) :
|
LLPhysicsMotionController::LLPhysicsMotionController(const LLUUID &id) :
|
||||||
LLMotion(id),
|
LLMotion(id),
|
||||||
mCharacter(NULL)
|
mCharacter(NULL),
|
||||||
|
mIsDefault(true)
|
||||||
{
|
{
|
||||||
mName = "breast_motion";
|
mName = "breast_motion";
|
||||||
}
|
}
|
||||||
@@ -455,10 +537,24 @@ F32 LLPhysicsMotion::calculateAcceleration_local(const F32 velocity_local)
|
|||||||
BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
|
BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
|
||||||
{
|
{
|
||||||
// Skip if disabled globally.
|
// Skip if disabled globally.
|
||||||
if (!gSavedSettings.getBOOL("AvatarPhysics"))
|
static const LLCachedControl<bool> avatar_physics("AvatarPhysics",false);
|
||||||
{
|
bool skip_physics = !avatar_physics || (!((LLVOAvatar*)mCharacter)->isSelf() && !((LLVOAvatar*)mCharacter)->mHasPhysicsParameters);
|
||||||
return TRUE;
|
//Treat lod 0 as AvatarPhysics:FALSE. AvatarPhysics setting is superfluous unless we decide to hook it into param sending.
|
||||||
}
|
if (skip_physics || !LLVOAvatar::sPhysicsLODFactor)
|
||||||
|
{
|
||||||
|
if(!mIsDefault)
|
||||||
|
{
|
||||||
|
mIsDefault = true;
|
||||||
|
for (motion_vec_t::iterator iter = mMotions.begin();iter != mMotions.end();++iter)
|
||||||
|
{
|
||||||
|
(*iter)->reset();
|
||||||
|
}
|
||||||
|
mCharacter->updateVisualParams();
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
mIsDefault = false;
|
||||||
|
|
||||||
BOOL update_visuals = FALSE;
|
BOOL update_visuals = FALSE;
|
||||||
for (motion_vec_t::iterator iter = mMotions.begin();
|
for (motion_vec_t::iterator iter = mMotions.begin();
|
||||||
@@ -776,3 +872,21 @@ void LLPhysicsMotion::setParamValue(const LLViewerVisualParam *param,
|
|||||||
new_value_local,
|
new_value_local,
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLPhysicsMotion::reset()
|
||||||
|
{
|
||||||
|
LLDriverParam *driver_param = dynamic_cast<LLDriverParam *>(mParamDriver);
|
||||||
|
if (driver_param)
|
||||||
|
{
|
||||||
|
if ((driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) &&
|
||||||
|
(driver_param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT))
|
||||||
|
{
|
||||||
|
mCharacter->setVisualParamWeight(driver_param,driver_param->getDefaultWeight());
|
||||||
|
}
|
||||||
|
for (LLDriverParam::entry_list_t::iterator iter = driver_param->mDriven.begin();
|
||||||
|
iter != driver_param->mDriven.end();++iter)
|
||||||
|
{
|
||||||
|
mCharacter->setVisualParamWeight((*iter).mParam,(*iter).mParam->getDefaultWeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1001,6 +1001,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
|
|||||||
mUseLocalAppearance(FALSE),
|
mUseLocalAppearance(FALSE),
|
||||||
mUseServerBakes(FALSE), // FIXME DRANO consider using boost::optional, defaulting to unknown.
|
mUseServerBakes(FALSE), // FIXME DRANO consider using boost::optional, defaulting to unknown.
|
||||||
// <edit>
|
// <edit>
|
||||||
|
mHasPhysicsParameters( false ),
|
||||||
mIdleMinute(0),
|
mIdleMinute(0),
|
||||||
mCCSChatTextOverride(false)
|
mCCSChatTextOverride(false)
|
||||||
// </edit>
|
// </edit>
|
||||||
@@ -7997,6 +7998,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
|
|||||||
setCompositeUpdatesEnabled( FALSE );
|
setCompositeUpdatesEnabled( FALSE );
|
||||||
gPipeline.markGLRebuild(this);
|
gPipeline.markGLRebuild(this);
|
||||||
|
|
||||||
|
mHasPhysicsParameters = false;
|
||||||
|
|
||||||
// Apply visual params
|
// Apply visual params
|
||||||
if( num_params > 1)
|
if( num_params > 1)
|
||||||
{
|
{
|
||||||
@@ -8009,6 +8012,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
|
|||||||
LLVisualParam* param = contents.mParams[i];
|
LLVisualParam* param = contents.mParams[i];
|
||||||
F32 newWeight = contents.mParamWeights[i];
|
F32 newWeight = contents.mParamWeights[i];
|
||||||
|
|
||||||
|
if(param->getID() == 10000)
|
||||||
|
{
|
||||||
|
mHasPhysicsParameters = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_first_appearance_message || (param->getWeight() != newWeight))
|
if (is_first_appearance_message || (param->getWeight() != newWeight))
|
||||||
{
|
{
|
||||||
params_changed = TRUE;
|
params_changed = TRUE;
|
||||||
|
|||||||
@@ -870,6 +870,8 @@ private:
|
|||||||
U8 mStepMaterial;
|
U8 mStepMaterial;
|
||||||
LLVector3 mStepObjectVelocity;
|
LLVector3 mStepObjectVelocity;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool mHasPhysicsParameters; //If we receive no physics params from this av then reset and skip llphysicsmotion calculations.
|
||||||
/** Physics
|
/** Physics
|
||||||
** **
|
** **
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user