From ef8ce5bf5eb3325dec8a51d27ca01ddab47f183c Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 7 Apr 2011 12:55:12 -0400 Subject: SH-1319: Fix for disappearing torso sections on avatars --- indra/newview/llphysicsmotion.cpp | 24 ++++++++++++++++++++---- indra/newview/llpolymorph.cpp | 10 ++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index acf8973f03..254fa5c33f 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -472,7 +472,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) const F32 behavior_gain = getParamValue("Gain"); const F32 behavior_damping = getParamValue("Damping"); const F32 behavior_drag = getParamValue("Drag"); - const BOOL physics_test = gSavedSettings.getBOOL("AvatarPhysicsTest"); + const BOOL physics_test = gSavedSettings.getBOOL("AvatarPhysicsTest") && gAgent.isGodlike(); F32 behavior_maxeffect = getParamValue("MaxEffect"); if (physics_test) @@ -583,9 +583,25 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) velocity_new_local = 0; } + // Check for NaN values. A NaN value is detected if the variables doesn't equal itself. + // If NaN, then reset everything. + if ((mPosition_local != mPosition_local) || + (mVelocity_local != mVelocity_local) || + (position_new_local != position_new_local)) + { + position_new_local = 0; + position_current_local = 0; + position_user_local = 0; + mVelocity_local = 0; + mVelocityJoint_local = 0; + mAccelerationJoint_local = 0; + mPosition_local = 0; + mPosition_world = LLVector3(0,0,0); + } + const F32 position_new_local_clamped = llclamp(position_new_local, - min_val, - max_val); + min_val, + max_val); LLDriverParam *driver_param = dynamic_cast(mParamDriver); llassert_always(driver_param); @@ -613,7 +629,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) // // End calculate new params //////////////////////////////////////////////////////////////////////////////// - + //////////////////////////////////////////////////////////////////////////////// // Conditionally update the visual params // diff --git a/indra/newview/llpolymorph.cpp b/indra/newview/llpolymorph.cpp index 5a67fd482a..36f8c8d13e 100644 --- a/indra/newview/llpolymorph.cpp +++ b/indra/newview/llpolymorph.cpp @@ -490,6 +490,16 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) mLastSex = avatar_sex; + // Check for NaN condition (NaN is detected if a variable doesn't equal itself. + if (mCurWeight != mCurWeight) + { + mCurWeight = 0.0; + } + if (mLastWeight != mLastWeight) + { + mLastWeight = mCurWeight+.001; + } + // perform differential update of morph F32 delta_weight = ( getSex() & avatar_sex ) ? (mCurWeight - mLastWeight) : (getDefaultWeight() - mLastWeight); // store last weight -- cgit v1.2.3