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>
|
<key>Value</key>
|
||||||
<integer>2</integer>
|
<integer>2</integer>
|
||||||
</map>
|
</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>
|
<key>AvatarSex</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -8842,6 +8853,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>35</integer>
|
<integer>35</integer>
|
||||||
</map>
|
</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>
|
<key>RenderAvatarInvisible</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
|
|||||||
@@ -429,6 +429,7 @@ static void settings_to_globals()
|
|||||||
LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor");
|
LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor");
|
||||||
LLVOTree::sTreeFactor = gSavedSettings.getF32("RenderTreeLODFactor");
|
LLVOTree::sTreeFactor = gSavedSettings.getF32("RenderTreeLODFactor");
|
||||||
LLVOAvatar::sLODFactor = gSavedSettings.getF32("RenderAvatarLODFactor");
|
LLVOAvatar::sLODFactor = gSavedSettings.getF32("RenderAvatarLODFactor");
|
||||||
|
LLVOAvatar::sPhysicsLODFactor = gSavedSettings.getF32("RenderAvatarPhysicsLODFactor");
|
||||||
LLVOAvatar::sMaxVisible = gSavedSettings.getS32("RenderAvatarMaxVisible");
|
LLVOAvatar::sMaxVisible = gSavedSettings.getS32("RenderAvatarMaxVisible");
|
||||||
LLVOAvatar::sVisibleInFirstPerson = gSavedSettings.getBOOL("FirstPersonAvatarVisible");
|
LLVOAvatar::sVisibleInFirstPerson = gSavedSettings.getBOOL("FirstPersonAvatarVisible");
|
||||||
// clamp auto-open time to some minimum usable value
|
// clamp auto-open time to some minimum usable value
|
||||||
|
|||||||
@@ -111,12 +111,14 @@ public:
|
|||||||
|
|
||||||
~LLPhysicsMotion() {}
|
~LLPhysicsMotion() {}
|
||||||
|
|
||||||
BOOL onUpdate(F32 time, bool &bHandled);
|
BOOL onUpdate(F32 time);
|
||||||
|
|
||||||
LLPointer<LLJointState> getJointState()
|
LLPointer<LLJointState> getJointState()
|
||||||
{
|
{
|
||||||
return mJointState;
|
return mJointState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset();
|
||||||
protected:
|
protected:
|
||||||
F32 getParamValue(const std::string& controller_key)
|
F32 getParamValue(const std::string& controller_key)
|
||||||
{
|
{
|
||||||
@@ -135,6 +137,7 @@ protected:
|
|||||||
F32 toLocal(const LLVector3 &world);
|
F32 toLocal(const LLVector3 &world);
|
||||||
F32 calculateVelocity_local();
|
F32 calculateVelocity_local();
|
||||||
F32 calculateAcceleration_local(F32 velocity_local);
|
F32 calculateAcceleration_local(F32 velocity_local);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string mParamDriverName;
|
const std::string mParamDriverName;
|
||||||
const std::string mParamControllerName;
|
const std::string mParamControllerName;
|
||||||
@@ -193,7 +196,8 @@ BOOL LLPhysicsMotion::initialize()
|
|||||||
|
|
||||||
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";
|
||||||
}
|
}
|
||||||
@@ -210,11 +214,13 @@ LLPhysicsMotionController::~LLPhysicsMotionController()
|
|||||||
|
|
||||||
BOOL LLPhysicsMotionController::onActivate()
|
BOOL LLPhysicsMotionController::onActivate()
|
||||||
{
|
{
|
||||||
|
llinfos << "LLPhysicsMotionController activate" << llendl;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPhysicsMotionController::onDeactivate()
|
void LLPhysicsMotionController::onDeactivate()
|
||||||
{
|
{
|
||||||
|
llinfos << "LLPhysicsMotionController deactivate" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter *character)
|
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)
|
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);
|
||||||
|
if (!avatar_physics || (!((LLVOAvatar*)mCharacter)->isSelf() && !((LLVOAvatar*)mCharacter)->mSupportsPhysics))
|
||||||
{
|
{
|
||||||
|
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;
|
return TRUE;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
mIsDefault = false;
|
||||||
|
|
||||||
BOOL update_visuals = FALSE;
|
BOOL update_visuals = FALSE;
|
||||||
bool physics_handled = false;
|
|
||||||
for (motion_vec_t::iterator iter = mMotions.begin();
|
for (motion_vec_t::iterator iter = mMotions.begin();
|
||||||
iter != mMotions.end();
|
iter != mMotions.end();
|
||||||
++iter)
|
++iter)
|
||||||
{
|
{
|
||||||
LLPhysicsMotion *motion = (*iter);
|
LLPhysicsMotion *motion = (*iter);
|
||||||
bool bHandled;
|
update_visuals |= motion->onUpdate(time);
|
||||||
update_visuals |= motion->onUpdate(time,bHandled);
|
|
||||||
physics_handled |= bHandled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_visuals)
|
if (update_visuals)
|
||||||
mCharacter->updateVisualParams();
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Return TRUE if character has to update visual params.
|
// 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");
|
// static FILE *mFileWrite = fopen("c:\\temp\\avatar_data.txt","w");
|
||||||
|
|
||||||
if (!mParamDriver)
|
if (!mParamDriver)
|
||||||
@@ -461,7 +473,6 @@ BOOL LLPhysicsMotion::onUpdate(F32 time, bool &bHandled)
|
|||||||
|
|
||||||
const F32 time_delta = time - mLastTime;
|
const F32 time_delta = time - mLastTime;
|
||||||
|
|
||||||
bHandled = true;
|
|
||||||
// Don't update too frequently, to avoid precision errors from small time slices.
|
// Don't update too frequently, to avoid precision errors from small time slices.
|
||||||
if (time_delta <= .01)
|
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.
|
// to set the position to the default (i.e. user) position.
|
||||||
if ((behavior_maxeffect == 0) && (position_current_local == position_user_local))
|
if ((behavior_maxeffect == 0) && (position_current_local == position_user_local))
|
||||||
{
|
{
|
||||||
bHandled = false; //Let emerald boob stuff do its thing, possibly.
|
|
||||||
return update_visuals;
|
return update_visuals;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -745,3 +755,21 @@ void LLPhysicsMotion::setParamValue(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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -110,7 +110,6 @@ public:
|
|||||||
virtual void onDeactivate();
|
virtual void onDeactivate();
|
||||||
|
|
||||||
LLCharacter* getCharacter() { return mCharacter; }
|
LLCharacter* getCharacter() { return mCharacter; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void addMotion(LLPhysicsMotion *motion);
|
void addMotion(LLPhysicsMotion *motion);
|
||||||
private:
|
private:
|
||||||
@@ -118,6 +117,8 @@ private:
|
|||||||
|
|
||||||
typedef std::vector<LLPhysicsMotion *> motion_vec_t;
|
typedef std::vector<LLPhysicsMotion *> motion_vec_t;
|
||||||
motion_vec_t mMotions;
|
motion_vec_t mMotions;
|
||||||
|
|
||||||
|
bool mIsDefault;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLPHYSICSMOTION_H
|
#endif // LL_LLPHYSICSMOTION_H
|
||||||
|
|||||||
@@ -216,6 +216,12 @@ static bool handleAvatarLODChanged(const LLSD& newvalue)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool handleAvatarPhysicsLODChanged(const LLSD& newvalue)
|
||||||
|
{
|
||||||
|
LLVOAvatar::sLODFactor = (F32) newvalue.asReal();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool handleAvatarMaxVisibleChanged(const LLSD& newvalue)
|
static bool handleAvatarMaxVisibleChanged(const LLSD& newvalue)
|
||||||
{
|
{
|
||||||
LLVOAvatar::sMaxVisible = (U32) newvalue.asInteger();
|
LLVOAvatar::sMaxVisible = (U32) newvalue.asInteger();
|
||||||
@@ -583,6 +589,7 @@ void settings_setup_listeners()
|
|||||||
gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _1));
|
gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _1));
|
||||||
gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _1));
|
gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _1));
|
||||||
gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _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("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _1));
|
||||||
gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _1));
|
gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _1));
|
||||||
gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _1));
|
gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _1));
|
||||||
|
|||||||
@@ -795,7 +795,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
|
|||||||
mFullyLoadedInitialized(FALSE),
|
mFullyLoadedInitialized(FALSE),
|
||||||
mHasBakedHair( FALSE ),
|
mHasBakedHair( FALSE ),
|
||||||
mSupportsAlphaLayers(FALSE),
|
mSupportsAlphaLayers(FALSE),
|
||||||
mFirstSetActualBoobGravRan( false )
|
mFirstSetActualBoobGravRan( false ),
|
||||||
|
mSupportsPhysics( false )
|
||||||
//mFirstSetActualButtGravRan( false ),
|
//mFirstSetActualButtGravRan( false ),
|
||||||
//mFirstSetActualFatGravRan( false )
|
//mFirstSetActualFatGravRan( false )
|
||||||
// <edit>
|
// <edit>
|
||||||
@@ -9368,6 +9369,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
|
|||||||
|
|
||||||
updateMeshTextures(); // enables updates for laysets without baked textures.
|
updateMeshTextures(); // enables updates for laysets without baked textures.
|
||||||
|
|
||||||
|
mSupportsPhysics = false;
|
||||||
|
|
||||||
// parse visual params
|
// parse visual params
|
||||||
S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam);
|
S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam);
|
||||||
if( num_blocks > 1 )
|
if( num_blocks > 1 )
|
||||||
@@ -9400,6 +9403,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
|
|||||||
mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i);
|
mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i);
|
||||||
F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight());
|
F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight());
|
||||||
|
|
||||||
|
if(param->getID() == 10000)
|
||||||
|
{
|
||||||
|
mSupportsPhysics = true;
|
||||||
|
}
|
||||||
if(param->getID() == 507 && newWeight != getActualBoobGrav())
|
if(param->getID() == 507 && newWeight != getActualBoobGrav())
|
||||||
{
|
{
|
||||||
llwarns << "Boob Grav SET to " << newWeight << " for " << getFullname() << llendl;
|
llwarns << "Boob Grav SET to " << newWeight << " for " << getFullname() << llendl;
|
||||||
@@ -9444,6 +9451,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
|
|||||||
{
|
{
|
||||||
if (param->getName() == "tattoo_red")
|
if (param->getName() == "tattoo_red")
|
||||||
llinfos << getFullname() << " does not have tattoo tinting." << llendl;
|
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
|
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;
|
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
|
//return; //ASC-TTRFE
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ public:
|
|||||||
std::string extraMetadata;
|
std::string extraMetadata;
|
||||||
// </edit>
|
// </edit>
|
||||||
|
|
||||||
|
// EmeraldBoobUtils
|
||||||
|
bool mSupportsPhysics; //Client supports v2 wearable physics. Disable emerald physics.
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// LLViewerObject interface
|
// LLViewerObject interface
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user