Merge remote-tracking branch 'shyotl/master'

This commit is contained in:
Latif Khalifa
2013-03-27 10:16:30 +01:00
10 changed files with 160 additions and 64 deletions

View File

@@ -465,10 +465,7 @@ void LLAvatarAppearance::computeBodySize()
LLVector3 old_offset = mAvatarOffset;
// [RLVa:KB] - Checked: 2013-03-03 (RLVa-1.4.8)
mAvatarOffset = getAvatarOffset();
// [/RLVa:KB]
// mAvatarOffset.mV[VZ] = getVisualParamWeight(11001);
mAvatarOffset.mV[VZ] = getVisualParamWeight(11001);
mPelvisToFoot = hip.mV[VZ] * pelvis_scale.mV[VZ] -
knee.mV[VZ] * hip_scale.mV[VZ] -
@@ -489,8 +486,8 @@ void LLAvatarAppearance::computeBodySize()
new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH;
new_body_size.mV[VY] = DEFAULT_AGENT_WIDTH;
//mAvatarOffset.mV[VX] = 0.0f;
//mAvatarOffset.mV[VY] = 0.0f;
mAvatarOffset.mV[VX] = 0.0f;
mAvatarOffset.mV[VY] = 0.0f;
if (new_body_size != mBodySize || old_offset != mAvatarOffset)
{
@@ -499,13 +496,6 @@ void LLAvatarAppearance::computeBodySize()
}
}
// [RLVa:KB] - Checked: 2013-03-03 (RLVa-1.4.8)
LLVector3 LLAvatarAppearance::getAvatarOffset() /*const*/
{
return LLVector3(0.f,0.f,getVisualParamWeight(11001));
}
// [/RLVa:KB]
//-----------------------------------------------------------------------------
// parseSkeletonFile()
//-----------------------------------------------------------------------------

View File

@@ -150,9 +150,6 @@ protected:
virtual void buildCharacter();
virtual BOOL loadAvatar();
virtual void bodySizeChanged() = 0;
// [RLVa:KB] - Checked: 2013-03-03 (RLVa-1.4.8)
virtual LLVector3 getAvatarOffset() /*const*/;
// [/RLVa:KB]
BOOL setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 &current_volume_num, S32 &current_joint_num);
BOOL allocateCharacterJoints(U32 num);

View File

@@ -116,10 +116,10 @@ void LLPrefsAscentVan::onCommitClientTag(LLUICtrl* ctrl, void* userdata)
//static
void LLPrefsAscentVan::onCommitUpdateAvatarOffsets(LLUICtrl* ctrl, void* userdata)
{
if (!gAgent.getID().isNull())
{
gAgent.sendAgentSetAppearance();
}
//if (!gAgent.getID().isNull())
//{
// gAgent.sendAgentSetAppearance();
//}
}
//static

View File

@@ -4527,23 +4527,7 @@ void LLAgent::sendAgentSetAppearance()
// NOTE -- when we start correcting all of the other Havok geometry
// to compensate for the COLLISION_TOLERANCE ugliness we will have
// to tweak this number again
LLVector3 body_size = gAgentAvatarp->mBodySize + gAgentAvatarp->mAvatarOffset;
static LLCachedControl<F32> x_off("AscentAvatarXModifier");
static LLCachedControl<F32> y_off("AscentAvatarYModifier");
static LLCachedControl<F32> z_off("AscentAvatarZModifier");
body_size.mV[VX] += x_off;
body_size.mV[VY] += y_off;
// [RLVa:KB] - Checked: 2010-10-11 (RLVa-1.2.0e) | Added: RLVa-1.2.0e
if (rlv_handler_t::isEnabled())
{
F32 rlvz_off = RlvSettings::getAvatarOffsetZ();
body_size.mV[VZ] += fabs(rlvz_off) ? rlvz_off : z_off;
}
else
// [/RLVa:KB]
body_size.mV[VZ] += z_off;
LLVector3 body_size = gAgentAvatarp->mBodySize + gAgentAvatarp->getLegacyAvatarOffset();
msg->addVector3Fast(_PREHASH_Size, body_size);

View File

@@ -109,7 +109,9 @@ public:
mLastTime(0),
mPosition_local(0),
mVelocityJoint_local(0),
mPositionLastUpdate_local(0)
mPositionLastUpdate_local(0),
mAccelerationJoint_local(0),
mVelocity_local(0)
{
mJointState = new LLJointState;
@@ -121,6 +123,8 @@ public:
BOOL initialize();
void getString(std::ostringstream &oss);
~LLPhysicsMotion() {}
BOOL onUpdate(F32 time);
@@ -129,6 +133,8 @@ public:
{
return mJointState;
}
void reset();
protected:
F32 getParamValue(eParamName param)
@@ -233,9 +239,85 @@ BOOL LLPhysicsMotion::initialize()
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) :
LLMotion(id),
mCharacter(NULL)
mCharacter(NULL),
mIsDefault(true)
{
mName = "breast_motion";
}
@@ -455,10 +537,24 @@ F32 LLPhysicsMotion::calculateAcceleration_local(const F32 velocity_local)
BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
{
// Skip if disabled globally.
if (!gSavedSettings.getBOOL("AvatarPhysics"))
{
return TRUE;
}
static const LLCachedControl<bool> avatar_physics("AvatarPhysics",false);
bool skip_physics = !avatar_physics || (!((LLVOAvatar*)mCharacter)->isSelf() && !((LLVOAvatar*)mCharacter)->mHasPhysicsParameters);
//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;
for (motion_vec_t::iterator iter = mMotions.begin();
@@ -776,3 +872,21 @@ void LLPhysicsMotion::setParamValue(const LLViewerVisualParam *param,
new_value_local,
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());
}
}
}

View File

@@ -454,15 +454,12 @@ bool on_pose_stand;
void set_current_pose(std::string anim)
{
if (!on_pose_stand)
{
on_pose_stand = true;
gSavedSettings.setF32("AscentAvatarZModifier", gSavedSettings.getF32("AscentAvatarZModifier") + 7.5);
}
on_pose_stand = true;
gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP);
current_pose.set(anim);
gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_START);
gAgent.sendAgentSetAppearance();
}
void handle_pose_stand(void*)
{
@@ -472,10 +469,10 @@ void handle_pose_stand_stop(void*)
{
if (on_pose_stand)
{
gSavedSettings.setF32("AscentAvatarZModifier", gSavedSettings.getF32("AscentAvatarZModifier") - 7.5);
on_pose_stand = false;
gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP);
current_pose = LLUUID::null;
gAgent.sendAgentSetAppearance();
}
}
void cleanup_pose_stand(void)

View File

@@ -1001,6 +1001,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mUseLocalAppearance(FALSE),
mUseServerBakes(FALSE), // FIXME DRANO consider using boost::optional, defaulting to unknown.
// <edit>
mHasPhysicsParameters( false ),
mIdleMinute(0),
mCCSChatTextOverride(false)
// </edit>
@@ -7997,6 +7998,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
setCompositeUpdatesEnabled( FALSE );
gPipeline.markGLRebuild(this);
mHasPhysicsParameters = false;
// Apply visual params
if( num_params > 1)
{
@@ -8009,6 +8012,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
LLVisualParam* param = contents.mParams[i];
F32 newWeight = contents.mParamWeights[i];
if(param->getID() == 10000)
{
mHasPhysicsParameters = true;
}
if (is_first_appearance_message || (param->getWeight() != newWeight))
{
params_changed = TRUE;

View File

@@ -870,6 +870,8 @@ private:
U8 mStepMaterial;
LLVector3 mStepObjectVelocity;
public:
bool mHasPhysicsParameters; //If we receive no physics params from this av then reset and skip llphysicsmotion calculations.
/** Physics
** **
*******************************************************************************/

View File

@@ -3220,21 +3220,27 @@ void LLVOAvatarSelf::dumpWearableInfo(LLAPRFile& outfile)
apr_file_printf( file, "\n</wearable_info>\n" );
}
// [RLVa:KB] - Checked: 2013-03-03 (RLVa-1.4.8)
LLVector3 LLVOAvatarSelf::getAvatarOffset() /*const*/
extern bool on_pose_stand;
LLVector3 LLVOAvatarSelf::getLegacyAvatarOffset() const
{
if(isUsingServerBakes())
return LLAvatarAppearance::getAvatarOffset();
else
static LLCachedControl<F32> x_off("AscentAvatarXModifier");
static LLCachedControl<F32> y_off("AscentAvatarYModifier");
static LLCachedControl<F32> z_off("AscentAvatarZModifier");
LLVector3 offset(x_off,y_off,z_off);
// [RLVa:KB] Custom blah blah
if(rlv_handler_t::isEnabled())
{
static LLCachedControl<F32> x_off("AscentAvatarXModifier");
static LLCachedControl<F32> y_off("AscentAvatarYModifier");
static LLCachedControl<F32> z_off("AscentAvatarZModifier");
return LLVector3(x_off,y_off,z_off+RlvSettings::getAvatarOffsetZ());
F32 rlva_z_offs = RlvSettings::getAvatarOffsetZ();
if(fabs(rlva_z_offs) > F_APPROXIMATELY_ZERO)
offset.mV[VZ] = rlva_z_offs;
}
}
// [/RLVa:KB]
if(on_pose_stand)
offset.mV[VZ] += 7.5f;
return offset;
}
// static
void LLVOAvatarSelf::onChangeSelfInvisible(bool invisible)

View File

@@ -355,10 +355,8 @@ public:
public:
bool sendAppearanceMessage(LLMessageSystem *mesgsys) const;
// [RLVa:KB] - Checked: 2013-03-03 (RLVa-1.4.8)
protected:
/*virtual*/ LLVector3 getAvatarOffset() /*const*/;
// [/RLVa:KB]
public:
LLVector3 getLegacyAvatarOffset() const;
/** Appearance
** **