Added physics saved settings.
Emerald physics demoted to legacy. Only enabled on av's that fail to send physics paramaters, or AvatarPhysics is completely disabled. Params reset when AvatarPhysics is toggled off. (Bugfix for LL's code)
This commit is contained in:
@@ -1739,6 +1739,17 @@
|
||||
<key>Value</key>
|
||||
<integer>2</integer>
|
||||
</map>
|
||||
<key>AvatarPhysics</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable avatar wearable physics.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>AvatarSex</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
@@ -8842,6 +8853,17 @@
|
||||
<key>Value</key>
|
||||
<integer>35</integer>
|
||||
</map>
|
||||
<key>RenderAvatarPhysicsLODFactor</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Controls level of detail of avatar physics (such as breast physics).</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<integer>1.0</integer>
|
||||
</map>
|
||||
<key>RenderAvatarInvisible</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
||||
@@ -429,6 +429,7 @@ static void settings_to_globals()
|
||||
LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor");
|
||||
LLVOTree::sTreeFactor = gSavedSettings.getF32("RenderTreeLODFactor");
|
||||
LLVOAvatar::sLODFactor = gSavedSettings.getF32("RenderAvatarLODFactor");
|
||||
LLVOAvatar::sPhysicsLODFactor = gSavedSettings.getF32("RenderAvatarPhysicsLODFactor");
|
||||
LLVOAvatar::sMaxVisible = gSavedSettings.getS32("RenderAvatarMaxVisible");
|
||||
LLVOAvatar::sVisibleInFirstPerson = gSavedSettings.getBOOL("FirstPersonAvatarVisible");
|
||||
// clamp auto-open time to some minimum usable value
|
||||
|
||||
@@ -111,12 +111,14 @@ public:
|
||||
|
||||
~LLPhysicsMotion() {}
|
||||
|
||||
BOOL onUpdate(F32 time, bool &bHandled);
|
||||
BOOL onUpdate(F32 time);
|
||||
|
||||
LLPointer<LLJointState> getJointState()
|
||||
{
|
||||
return mJointState;
|
||||
}
|
||||
|
||||
void reset();
|
||||
protected:
|
||||
F32 getParamValue(const std::string& controller_key)
|
||||
{
|
||||
@@ -135,6 +137,7 @@ protected:
|
||||
F32 toLocal(const LLVector3 &world);
|
||||
F32 calculateVelocity_local();
|
||||
F32 calculateAcceleration_local(F32 velocity_local);
|
||||
|
||||
private:
|
||||
const std::string mParamDriverName;
|
||||
const std::string mParamControllerName;
|
||||
@@ -193,7 +196,8 @@ BOOL LLPhysicsMotion::initialize()
|
||||
|
||||
LLPhysicsMotionController::LLPhysicsMotionController(const LLUUID &id) :
|
||||
LLMotion(id),
|
||||
mCharacter(NULL)
|
||||
mCharacter(NULL),
|
||||
mIsDefault(true)
|
||||
{
|
||||
mName = "breast_motion";
|
||||
}
|
||||
@@ -210,11 +214,13 @@ LLPhysicsMotionController::~LLPhysicsMotionController()
|
||||
|
||||
BOOL LLPhysicsMotionController::onActivate()
|
||||
{
|
||||
llinfos << "LLPhysicsMotionController activate" << llendl;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLPhysicsMotionController::onDeactivate()
|
||||
{
|
||||
llinfos << "LLPhysicsMotionController deactivate" << llendl;
|
||||
}
|
||||
|
||||
LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter *character)
|
||||
@@ -414,36 +420,42 @@ F32 LLPhysicsMotion::calculateAcceleration_local(const F32 velocity_local)
|
||||
BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
|
||||
{
|
||||
// Skip if disabled globally.
|
||||
/*if (!gSavedSettings.getBOOL("AvatarPhysics"))
|
||||
static const LLCachedControl<bool> avatar_physics("AvatarPhysics",false);
|
||||
if (!avatar_physics || (!((LLVOAvatar*)mCharacter)->isSelf() && !((LLVOAvatar*)mCharacter)->mSupportsPhysics))
|
||||
{
|
||||
return TRUE;
|
||||
}*/
|
||||
if(!mIsDefault)
|
||||
{
|
||||
mIsDefault = true;
|
||||
for (motion_vec_t::iterator iter = mMotions.begin();iter != mMotions.end();++iter)
|
||||
{
|
||||
(*iter)->reset();
|
||||
}
|
||||
mCharacter->updateVisualParams();
|
||||
}
|
||||
((LLVOAvatar*)mCharacter)->idleUpdateBoobEffect(); //Fall back to emerald physics
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
mIsDefault = false;
|
||||
|
||||
BOOL update_visuals = FALSE;
|
||||
bool physics_handled = false;
|
||||
for (motion_vec_t::iterator iter = mMotions.begin();
|
||||
iter != mMotions.end();
|
||||
++iter)
|
||||
{
|
||||
LLPhysicsMotion *motion = (*iter);
|
||||
bool bHandled;
|
||||
update_visuals |= motion->onUpdate(time,bHandled);
|
||||
physics_handled |= bHandled;
|
||||
update_visuals |= motion->onUpdate(time);
|
||||
}
|
||||
|
||||
if (update_visuals)
|
||||
mCharacter->updateVisualParams();
|
||||
|
||||
if(!physics_handled && mCharacter) //If absolutely nothing was done, and it wasn't due to timers/lod
|
||||
((LLVOAvatar*)mCharacter)->idleUpdateBoobEffect();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// Return TRUE if character has to update visual params.
|
||||
BOOL LLPhysicsMotion::onUpdate(F32 time, bool &bHandled)
|
||||
BOOL LLPhysicsMotion::onUpdate(F32 time)
|
||||
{
|
||||
bHandled = false;
|
||||
// static FILE *mFileWrite = fopen("c:\\temp\\avatar_data.txt","w");
|
||||
|
||||
if (!mParamDriver)
|
||||
@@ -461,7 +473,6 @@ BOOL LLPhysicsMotion::onUpdate(F32 time, bool &bHandled)
|
||||
|
||||
const F32 time_delta = time - mLastTime;
|
||||
|
||||
bHandled = true;
|
||||
// Don't update too frequently, to avoid precision errors from small time slices.
|
||||
if (time_delta <= .01)
|
||||
{
|
||||
@@ -540,7 +551,6 @@ BOOL LLPhysicsMotion::onUpdate(F32 time, bool &bHandled)
|
||||
// to set the position to the default (i.e. user) position.
|
||||
if ((behavior_maxeffect == 0) && (position_current_local == position_user_local))
|
||||
{
|
||||
bHandled = false; //Let emerald boob stuff do its thing, possibly.
|
||||
return update_visuals;
|
||||
}
|
||||
|
||||
@@ -745,3 +755,21 @@ void LLPhysicsMotion::setParamValue(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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,6 @@ public:
|
||||
virtual void onDeactivate();
|
||||
|
||||
LLCharacter* getCharacter() { return mCharacter; }
|
||||
|
||||
protected:
|
||||
void addMotion(LLPhysicsMotion *motion);
|
||||
private:
|
||||
@@ -118,6 +117,8 @@ private:
|
||||
|
||||
typedef std::vector<LLPhysicsMotion *> motion_vec_t;
|
||||
motion_vec_t mMotions;
|
||||
|
||||
bool mIsDefault;
|
||||
};
|
||||
|
||||
#endif // LL_LLPHYSICSMOTION_H
|
||||
|
||||
@@ -216,6 +216,12 @@ static bool handleAvatarLODChanged(const LLSD& newvalue)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool handleAvatarPhysicsLODChanged(const LLSD& newvalue)
|
||||
{
|
||||
LLVOAvatar::sLODFactor = (F32) newvalue.asReal();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool handleAvatarMaxVisibleChanged(const LLSD& newvalue)
|
||||
{
|
||||
LLVOAvatar::sMaxVisible = (U32) newvalue.asInteger();
|
||||
@@ -583,6 +589,7 @@ void settings_setup_listeners()
|
||||
gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _1));
|
||||
gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _1));
|
||||
gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _1));
|
||||
gSavedSettings.getControl("RenderAvatarPhysicsLODFactor")->getSignal()->connect(boost::bind(&handleAvatarPhysicsLODChanged, _1));
|
||||
gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _1));
|
||||
gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _1));
|
||||
gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _1));
|
||||
|
||||
@@ -795,7 +795,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
|
||||
mFullyLoadedInitialized(FALSE),
|
||||
mHasBakedHair( FALSE ),
|
||||
mSupportsAlphaLayers(FALSE),
|
||||
mFirstSetActualBoobGravRan( false )
|
||||
mFirstSetActualBoobGravRan( false ),
|
||||
mSupportsPhysics( false )
|
||||
//mFirstSetActualButtGravRan( false ),
|
||||
//mFirstSetActualFatGravRan( false )
|
||||
// <edit>
|
||||
@@ -9368,6 +9369,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
|
||||
|
||||
updateMeshTextures(); // enables updates for laysets without baked textures.
|
||||
|
||||
mSupportsPhysics = false;
|
||||
|
||||
// parse visual params
|
||||
S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam);
|
||||
if( num_blocks > 1 )
|
||||
@@ -9400,6 +9403,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
|
||||
mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i);
|
||||
F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight());
|
||||
|
||||
if(param->getID() == 10000)
|
||||
{
|
||||
mSupportsPhysics = true;
|
||||
}
|
||||
if(param->getID() == 507 && newWeight != getActualBoobGrav())
|
||||
{
|
||||
llwarns << "Boob Grav SET to " << newWeight << " for " << getFullname() << llendl;
|
||||
@@ -9444,6 +9451,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
|
||||
{
|
||||
if (param->getName() == "tattoo_red")
|
||||
llinfos << getFullname() << " does not have tattoo tinting." << llendl;
|
||||
else if(param->getName() == "breast_physics_leftright_spring")
|
||||
llinfos << getFullname() << " does not have avatar physics." << llendl;
|
||||
else
|
||||
llwarns << "Number of params in AvatarAppearance msg does not match number of params in avatar xml file for " << getFullname() << " (Prematurely reached end of list at " << param->getName() << ")." << llendl;
|
||||
//return; //ASC-TTRFE
|
||||
|
||||
@@ -99,6 +99,9 @@ public:
|
||||
void getClientInfo(std::string& clientTag, LLColor4& tagColor, BOOL useComment=FALSE);
|
||||
std::string extraMetadata;
|
||||
// </edit>
|
||||
|
||||
// EmeraldBoobUtils
|
||||
bool mSupportsPhysics; //Client supports v2 wearable physics. Disable emerald physics.
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// LLViewerObject interface
|
||||
|
||||
Reference in New Issue
Block a user