diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/character/avatar_lad.xml | 20 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpaneleditwearable.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llphysicsmotion.cpp | 48 | ||||
-rw-r--r-- | indra/newview/llpolymorph.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llwearabletype.cpp | 2 |
6 files changed, 64 insertions, 24 deletions
diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index 85899603ee..ec162e3608 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -4339,8 +4339,8 @@ wearable="shape" edit_group="driven" value_default="0" - value_min="-2" - value_max="2"> + value_min="-3" + value_max="3"> <param_morph /> </param> @@ -4352,8 +4352,8 @@ wearable="shape" edit_group="driven" value_default="0" - value_min="-1" - value_max="1"> + value_min="-1.5" + value_max="1.5"> <param_morph /> </param> @@ -11916,7 +11916,7 @@ render_pass="bump"> edit_group="physics_breasts_updown" value_default=".1" value_min="0" - value_max="1"> + value_max="3"> <param_driver /> </param> <param @@ -11971,7 +11971,7 @@ render_pass="bump"> edit_group="physics_breasts_inout" value_default=".1" value_min="0" - value_max="1"> + value_max="3"> <param_driver /> </param> <param @@ -12058,7 +12058,7 @@ render_pass="bump"> edit_group="physics_belly_updown" value_default=".1" value_min="0" - value_max="1"> + value_max="3"> <param_driver /> </param> <param @@ -12144,7 +12144,7 @@ render_pass="bump"> edit_group="physics_butt_updown" value_default=".1" value_min="0" - value_max="1"> + value_max="3"> <param_driver /> </param> <param @@ -12193,7 +12193,7 @@ render_pass="bump"> edit_group="physics_butt_leftright" value_default=".1" value_min="0" - value_max="1"> + value_max="3"> <param_driver /> </param> <param @@ -12244,7 +12244,7 @@ render_pass="bump"> edit_group="physics_breasts_leftright" value_default=".1" value_min="0" - value_max="1"> + value_max="3"> <param_driver /> </param> <param diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 622a5607df..bdb9f6167a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4681,7 +4681,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) if (LLWearableType::getAllowMultiwear(mWearableType)) { items.push_back(std::string("Wearable Add")); - if (gAgentWearables.getWearableCount(mWearableType) > 0) + if (gAgentWearables.getWearableCount(mWearableType) >= LLAgentWearables::MAX_CLOTHING_PER_TYPE) { disabled_items.push_back(std::string("Wearable Add")); } diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 8bd2d5ad6a..cb8fbd66b5 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1196,6 +1196,12 @@ void LLPanelEditWearable::onTabExpandedCollapsed(const LLSD& param, U8 index) void LLPanelEditWearable::changeCamera(U8 subpart) { + // Don't change the camera if this type doesn't have a camera switch. + // Useful for wearables like physics that don't have an associated physical body part. + if (LLWearableType::getDisableCameraSwitch(mWearablePtr->getType())) + { + return; + } const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mWearablePtr->getType()); if (!wearable_entry) { diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index acf8973f03..1d3c2b72f2 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -40,6 +40,7 @@ #include "v3dmath.h"
#include "llphysicsmotion.h"
+#include "llagent.h"
#include "llcharacter.h"
#include "llviewercontrol.h"
#include "llviewervisualparam.h"
@@ -126,7 +127,8 @@ protected: return mCharacter->getVisualParamWeight(param_name.c_str());
}
void setParamValue(LLViewerVisualParam *param,
- const F32 new_value_local);
+ const F32 new_value_local,
+ F32 behavior_maxeffect);
F32 toLocal(const LLVector3 &world);
F32 calculateVelocity_local(const F32 time_delta);
@@ -472,14 +474,11 @@ 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)
behavior_maxeffect = 1.0f;
- // Maximum effect is [0,1] range.
- const F32 min_val = 0.5f-behavior_maxeffect/2.0;
- const F32 max_val = 0.5f+behavior_maxeffect/2.0;
// mPositon_local should be in normalized 0,1 range already. Just making sure...
F32 position_current_local = llclamp(mPosition_local,
@@ -577,15 +576,31 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) position_new_local = position_user_local;
// Zero out the velocity if the param is being pushed beyond its limits.
- if ((position_new_local < min_val && velocity_new_local < 0) ||
- (position_new_local > max_val && velocity_new_local > 0))
+ if ((position_new_local < 0 && velocity_new_local < 0) ||
+ (position_new_local > 1 && velocity_new_local > 0))
{
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);
+ 0.0f,
+ 1.0f);
LLDriverParam *driver_param = dynamic_cast<LLDriverParam *>(mParamDriver);
llassert_always(driver_param);
@@ -606,14 +621,14 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) {
LLDrivenEntry &entry = (*iter);
LLViewerVisualParam *driven_param = entry.mParam;
- setParamValue(driven_param,position_new_local_clamped);
+ setParamValue(driven_param,position_new_local_clamped, behavior_maxeffect);
}
}
//
// End calculate new params
////////////////////////////////////////////////////////////////////////////////
-
+
////////////////////////////////////////////////////////////////////////////////
// Conditionally update the visual params
//
@@ -688,12 +703,19 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) // Range of new_value_local is assumed to be [0 , 1] normalized.
void LLPhysicsMotion::setParamValue(LLViewerVisualParam *param,
- F32 new_value_normalized)
+ F32 new_value_normalized,
+ F32 behavior_maxeffect)
{
const F32 value_min_local = param->getMinWeight();
const F32 value_max_local = param->getMaxWeight();
+ const F32 min_val = 0.5f-behavior_maxeffect/2.0;
+ const F32 max_val = 0.5f+behavior_maxeffect/2.0;
- const F32 new_value_local = value_min_local + (value_max_local-value_min_local) * new_value_normalized;
+ // Scale from [0,1] to [min_val,max_val]
+ const F32 new_value_rescaled = min_val + (max_val-min_val) * new_value_normalized;
+
+ // Scale from [0,1] to [value_min_local,value_max_local]
+ const F32 new_value_local = value_min_local + (value_max_local-value_min_local) * new_value_rescaled;
mCharacter->setVisualParamWeight(param,
new_value_local,
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 diff --git a/indra/newview/llwearabletype.cpp b/indra/newview/llwearabletype.cpp index f933be4d8f..9e95604712 100644 --- a/indra/newview/llwearabletype.cpp +++ b/indra/newview/llwearabletype.cpp @@ -144,6 +144,7 @@ BOOL LLWearableType::getDisableCameraSwitch(LLWearableType::EType type) { const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); const WearableEntry *entry = dict->lookup(type); + if (!entry) return FALSE; return entry->mDisableCameraSwitch; } @@ -152,6 +153,7 @@ BOOL LLWearableType::getAllowMultiwear(LLWearableType::EType type) { const LLWearableDictionary *dict = LLWearableDictionary::getInstance(); const WearableEntry *entry = dict->lookup(type); + if (!entry) return FALSE; return entry->mAllowMultiwear; } |