From 3731520cdfbfdc48db6ff4752a5cbcfc2b5d9ccf Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Thu, 20 May 2010 16:51:56 -0700 Subject: Support 'tiny prims' (resizing down to 0.001m) on OpenSim, made sure the tools floater uses the correct limits in the spinners --- linden/indra/llmath/xform.h | 2 +- linden/indra/newview/hippoLimits.cpp | 2 ++ linden/indra/newview/hippoLimits.h | 2 ++ linden/indra/newview/llfloatertools.cpp | 8 ++++++++ linden/indra/newview/llmanipscale.cpp | 12 ++++++------ .../indra/newview/skins/default/xui/en-us/floater_tools.xml | 6 +++--- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/linden/indra/llmath/xform.h b/linden/indra/llmath/xform.h index 9b4d2fc..1e1df46 100644 --- a/linden/indra/llmath/xform.h +++ b/linden/indra/llmath/xform.h @@ -39,7 +39,7 @@ const F32 MAX_OBJECT_Z = 4096.f; // should match REGION_HEIGHT_METERS, Pre-havok4: 768.f const F32 MIN_OBJECT_Z = -256.f; //const F32 DEFAULT_MAX_PRIM_SCALE = 10.f; set via the Hippo Grid manager now -const F32 MIN_PRIM_SCALE = 0.01f; +//const F32 MIN_PRIM_SCALE = 0.01f; set via the Hippo Grid manager now const F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX diff --git a/linden/indra/newview/hippoLimits.cpp b/linden/indra/newview/hippoLimits.cpp index 96b3bee..35afcf9 100644 --- a/linden/indra/newview/hippoLimits.cpp +++ b/linden/indra/newview/hippoLimits.cpp @@ -32,6 +32,7 @@ void HippoLimits::setOpenSimLimits() { mMaxAgentGroups = 100; mMaxPrimScale = 256.0f; + mMinPrimScale = 0.001f; mMaxHeight = 10000.0f; mMaxLinkedPrims = -1; @@ -51,6 +52,7 @@ void HippoLimits::setSecondLifeLimits() llinfos << "Using Second Life limits." << llendl; mMaxAgentGroups = 25; mMaxPrimScale = 10.0f; + mMinPrimScale = 0.01f; mMaxHeight = 4096.0f; mMinHoleSize = 0.05f; mMaxHollow = 0.95f; diff --git a/linden/indra/newview/hippoLimits.h b/linden/indra/newview/hippoLimits.h index 7152bcc..450a112 100644 --- a/linden/indra/newview/hippoLimits.h +++ b/linden/indra/newview/hippoLimits.h @@ -12,6 +12,7 @@ public: float getMinHoleSize() const { return mMinHoleSize; } float getMaxHollow() const { return mMaxHollow; } float getMaxPrimScale() const { return mMaxPrimScale; } + float getMinPrimScale() const { return mMinPrimScale; } S32 getMaxLinkedPrims() const { return mMaxLinkedPrims; } void setLimits(); @@ -23,6 +24,7 @@ private: float mMinHoleSize; float mMaxHollow; float mMaxPrimScale; + float mMinPrimScale; S32 mMaxLinkedPrims; void setOpenSimLimits(); diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp index c145791..efd81a6 100644 --- a/linden/indra/newview/llfloatertools.cpp +++ b/linden/indra/newview/llfloatertools.cpp @@ -268,6 +268,14 @@ BOOL LLFloaterTools::postBuild() mBtnUnlink = getChild("unlink_btn"); childSetAction("unlink_btn",onClickUnlink, this); + getChild("Scale X")->setMaxValue(gHippoLimits->getMaxPrimScale()); + getChild("Scale Y")->setMaxValue(gHippoLimits->getMaxPrimScale()); + getChild("Scale Z")->setMaxValue(gHippoLimits->getMaxPrimScale()); + + getChild("Scale X")->setMinValue(gHippoLimits->getMinPrimScale()); + getChild("Scale Y")->setMinValue(gHippoLimits->getMinPrimScale()); + getChild("Scale Z")->setMinValue(gHippoLimits->getMinPrimScale()); + toolsPrecision(); // diff --git a/linden/indra/newview/llmanipscale.cpp b/linden/indra/newview/llmanipscale.cpp index 969ee43..fa7e85f 100644 --- a/linden/indra/newview/llmanipscale.cpp +++ b/linden/indra/newview/llmanipscale.cpp @@ -956,8 +956,9 @@ void LLManipScale::dragCorner( S32 x, S32 y ) } F32 maxScale = gHippoLimits->getMaxPrimScale(); - F32 max_scale_factor = maxScale / MIN_PRIM_SCALE; - F32 min_scale_factor = MIN_PRIM_SCALE / maxScale; + F32 minScale = gHippoLimits->getMinPrimScale(); + F32 max_scale_factor = maxScale / minScale; + F32 min_scale_factor = minScale / maxScale; // find max and min scale factors that will make biggest object hit max absolute scale and smallest object hit min absolute scale for (LLObjectSelection::iterator iter = mObjectSelection->begin(); @@ -972,7 +973,7 @@ void LLManipScale::dragCorner( S32 x, S32 y ) F32 cur_max_scale_factor = llmin( maxScale / scale.mV[VX], maxScale / scale.mV[VY], maxScale / scale.mV[VZ] ); max_scale_factor = llmin( max_scale_factor, cur_max_scale_factor ); - F32 cur_min_scale_factor = llmax( MIN_PRIM_SCALE / scale.mV[VX], MIN_PRIM_SCALE / scale.mV[VY], MIN_PRIM_SCALE / scale.mV[VZ] ); + F32 cur_min_scale_factor = llmax( minScale / scale.mV[VX], minScale / scale.mV[VY], minScale / scale.mV[VZ] ); min_scale_factor = llmax( min_scale_factor, cur_min_scale_factor ); } } @@ -1266,8 +1267,7 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto F32 denom = axis * dir_local; F32 desired_delta_size = is_approx_zero(denom) ? 0.f : (delta_local_mag / denom); // in meters - F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, MIN_PRIM_SCALE, - gHippoLimits->getMaxPrimScale()); + F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale()); // propagate scale constraint back to position offset desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position @@ -1990,7 +1990,7 @@ F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const min_extent = bbox_extents.mV[i]; } } - F32 min_scale_factor = bbox_extents.magVec() * MIN_PRIM_SCALE / min_extent; + F32 min_scale_factor = bbox_extents.magVec() * gHippoLimits->getMinPrimScale() / min_extent; if (getUniform()) { diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml index 28ec16c..ed54c58 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml @@ -655,15 +655,15 @@