From 4cdef469977e8907b06e1fafb4d7c54a6eff93f9 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 18 Sep 2009 08:52:24 -0700 Subject: Dynamically change max prim size depending upon LL/OpenSim grid (added setting for opensim detection: LoggedIntoOpenSim). OpenSim max is 128m --- linden/indra/llmath/xform.h | 2 +- linden/indra/newview/app_settings/settings.xml | 11 +++++++++ linden/indra/newview/llmanipscale.cpp | 26 +++++++++++++++++----- linden/indra/newview/llmanipscale.h | 3 +++ linden/indra/newview/llpanelobject.cpp | 4 ++++ linden/indra/newview/llviewermessage.cpp | 10 +++++++++ .../skins/default/xui/en-us/floater_tools.xml | 6 ++--- 7 files changed, 52 insertions(+), 10 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/llmath/xform.h b/linden/indra/llmath/xform.h index 6f880cb..b41219c 100644 --- a/linden/indra/llmath/xform.h +++ b/linden/indra/llmath/xform.h @@ -37,7 +37,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; +//const F32 DEFAULT_MAX_PRIM_SCALE = 10.f; set in llmanipscale.cpp now const F32 MIN_PRIM_SCALE = 0.01f; const F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index f92b47f..60abc1b 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -4720,6 +4720,17 @@ Value 0 + LoggedIntoOpenSim + + Comment + Check whether or not we're in an OpenSimulator (default 0) + Persist + 1 + Type + Boolean + Value + 0 + LoginAsGod Comment diff --git a/linden/indra/newview/llmanipscale.cpp b/linden/indra/newview/llmanipscale.cpp index 10cb0c3..5a67937 100644 --- a/linden/indra/newview/llmanipscale.cpp +++ b/linden/indra/newview/llmanipscale.cpp @@ -69,6 +69,8 @@ const F32 SNAP_GUIDE_SCREEN_LENGTH = 0.7f; const F32 SELECTED_MANIPULATOR_SCALE = 1.2f; const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f; const S32 NUM_MANIPULATORS = 14; +const F32 DEFAULT_LL_MAX_PRIM_SCALE = 10.f; +const F32 DEFAULT_OPENSIM_MAX_PRIM_SCALE = 128.f; const LLManip::EManipPart MANIPULATOR_IDS[NUM_MANIPULATORS] = { @@ -173,6 +175,7 @@ LLManipScale::LLManipScale( LLToolComposite* composite ) mScaledBoxHandleSize( 1.f ), mLastMouseX( -1 ), mLastMouseY( -1 ), + mMaxPrimSize(0.f), mSendUpdateOnMouseUp( FALSE ), mLastUpdateFlags( 0 ), mScaleSnapUnit1(1.f), @@ -201,6 +204,7 @@ void LLManipScale::render() LLGLDepthTest gls_depth(GL_TRUE); LLGLEnable gl_blend(GL_BLEND); LLGLEnable gls_alpha_test(GL_ALPHA_TEST); + mMaxPrimSize = gSavedSettings.getBOOL("LoggedIntoOpenSim") ? DEFAULT_OPENSIM_MAX_PRIM_SCALE : DEFAULT_LL_MAX_PRIM_SCALE; if( canAffectSelection() ) { @@ -952,8 +956,8 @@ void LLManipScale::dragCorner( S32 x, S32 y ) mInSnapRegime = FALSE; } - F32 max_scale_factor = DEFAULT_MAX_PRIM_SCALE / MIN_PRIM_SCALE; - F32 min_scale_factor = MIN_PRIM_SCALE / DEFAULT_MAX_PRIM_SCALE; + F32 max_scale_factor = mMaxPrimSize / MIN_PRIM_SCALE; + F32 min_scale_factor = MIN_PRIM_SCALE / mMaxPrimSize; // 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(); @@ -965,7 +969,7 @@ void LLManipScale::dragCorner( S32 x, S32 y ) { const LLVector3& scale = selectNode->mSavedScale; - F32 cur_max_scale_factor = llmin( DEFAULT_MAX_PRIM_SCALE / scale.mV[VX], DEFAULT_MAX_PRIM_SCALE / scale.mV[VY], DEFAULT_MAX_PRIM_SCALE / scale.mV[VZ] ); + F32 cur_max_scale_factor = llmin( mMaxPrimSize / scale.mV[VX], mMaxPrimSize / scale.mV[VY], mMaxPrimSize / 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] ); @@ -1262,7 +1266,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, DEFAULT_MAX_PRIM_SCALE); + F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, MIN_PRIM_SCALE, mMaxPrimSize); // propagate scale constraint back to position offset desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position @@ -1962,7 +1966,7 @@ F32 LLManipScale::partToMaxScale( S32 part, const LLBBox &bbox ) const max_extent = bbox_extents.mV[i]; } } - max_scale_factor = bbox_extents.magVec() * DEFAULT_MAX_PRIM_SCALE / max_extent; + max_scale_factor = bbox_extents.magVec() * mMaxPrimSize / max_extent; if (getUniform()) { @@ -1977,7 +1981,7 @@ F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const { LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox ); bbox_extents.abs(); - F32 min_extent = DEFAULT_MAX_PRIM_SCALE; + F32 min_extent = mMaxPrimSize; for (U32 i = VX; i <= VZ; i++) { if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent) @@ -2052,3 +2056,13 @@ BOOL LLManipScale::canAffectSelection() } return can_scale; } + +//static +F32 LLManipScale::getMaxPrimSize() +{ + if (gSavedSettings.getBOOL("LoggedIntoOpenSim")) + { + return DEFAULT_OPENSIM_MAX_PRIM_SCALE; + } + return DEFAULT_LL_MAX_PRIM_SCALE; +} diff --git a/linden/indra/newview/llmanipscale.h b/linden/indra/newview/llmanipscale.h index 98d8c63..c60cb69 100644 --- a/linden/indra/newview/llmanipscale.h +++ b/linden/indra/newview/llmanipscale.h @@ -88,6 +88,8 @@ public: static void setShowAxes( BOOL b ); static BOOL getShowAxes(); + static F32 getMaxPrimSize(); + private: void renderCorners( const LLBBox& local_bbox ); void renderFaces( const LLBBox& local_bbox ); @@ -165,6 +167,7 @@ private: F32 mScaleSnapValue; BOOL mInSnapRegime; F32* mManipulatorScales; + F32 mMaxPrimSize; }; #endif // LL_MANIPSCALE_H diff --git a/linden/indra/newview/llpanelobject.cpp b/linden/indra/newview/llpanelobject.cpp index dd71a0e..9dcf410 100644 --- a/linden/indra/newview/llpanelobject.cpp +++ b/linden/indra/newview/llpanelobject.cpp @@ -631,6 +631,10 @@ void LLPanelObject::getState( ) } else { + mCtrlScaleX->setMaxValue(LLManipScale::getMaxPrimSize()); + mCtrlScaleY->setMaxValue(LLManipScale::getMaxPrimSize()); + mCtrlScaleZ->setMaxValue(LLManipScale::getMaxPrimSize()); + // Only allowed to change these parameters for objects // that you have permissions on AND are not attachments. enabled = root_objectp->permModify(); diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index e326dac..c9a3cb7 100644 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp @@ -3152,6 +3152,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) // If the server version has changed, display an info box and offer // to display the release notes, unless this is the initial log in. + // Also verify we're on an OpenSimulator here. if (gLastVersionChannel == version_channel) { return; @@ -3163,6 +3164,15 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) "ServerVersionChanged", display_release_notes, NULL); } + if (version_channel.find("OpenSim") != std::string::npos) + { + gSavedSettings.setBOOL("LoggedIntoOpenSim", TRUE); + } + else + { + gSavedSettings.setBOOL("LoggedIntoOpenSim", FALSE); + } + gLastVersionChannel = version_channel; } 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 bc18f44..a57c568 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 @@ -660,15 +660,15 @@