SH-808 making sure the 10m vs. 64m scale limit switch happens for both the spinner and the manipulation tools etc.
parent
ad54a46ba2
commit
fefc37e92f
|
|
@ -33,10 +33,10 @@
|
|||
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 = 64.f;
|
||||
const F32 DEFAULT_MAX_PRIM_SCALE_NO_MESH = 10.f;
|
||||
const F32 MIN_PRIM_SCALE = 0.01f;
|
||||
const F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX
|
||||
|
||||
|
||||
class LLXform
|
||||
{
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -85,6 +85,17 @@ const LLManip::EManipPart MANIPULATOR_IDS[NUM_MANIPULATORS] =
|
|||
};
|
||||
|
||||
|
||||
F32 get_default_max_prim_scale()
|
||||
{
|
||||
if (gSavedSettings.getBOOL("MeshEnabled"))
|
||||
{
|
||||
return DEFAULT_MAX_PRIM_SCALE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DEFAULT_MAX_PRIM_SCALE_NO_MESH;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLManipScale::setUniform(BOOL b)
|
||||
|
|
@ -950,8 +961,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 = get_default_max_prim_scale() / MIN_PRIM_SCALE;
|
||||
F32 min_scale_factor = MIN_PRIM_SCALE / get_default_max_prim_scale();
|
||||
|
||||
// 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();
|
||||
|
|
@ -963,7 +974,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( get_default_max_prim_scale() / scale.mV[VX], get_default_max_prim_scale() / scale.mV[VY], get_default_max_prim_scale() / 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] );
|
||||
|
|
@ -1260,7 +1271,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, get_default_max_prim_scale());
|
||||
// propagate scale constraint back to position offset
|
||||
desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position
|
||||
|
||||
|
|
@ -1960,7 +1971,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() * get_default_max_prim_scale() / max_extent;
|
||||
|
||||
if (getUniform())
|
||||
{
|
||||
|
|
@ -1975,7 +1986,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 = get_default_max_prim_scale();
|
||||
for (U32 i = VX; i <= VZ; i++)
|
||||
{
|
||||
if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@
|
|||
#include "llviewerobject.h"
|
||||
#include "llbbox.h"
|
||||
|
||||
|
||||
F32 get_default_max_prim_scale();
|
||||
|
||||
class LLToolComposite;
|
||||
class LLColor4;
|
||||
|
||||
|
|
|
|||
|
|
@ -1934,10 +1934,10 @@ void LLPanelObject::refresh()
|
|||
getChildView("Physics Density")->setVisible(enable_mesh);
|
||||
getChildView("Physics Restitution")->setVisible(enable_mesh);
|
||||
|
||||
// if mesh isn't enabled we want to the scale max to be 10
|
||||
getChild<LLSpinCtrl>("Scale X")->setMaxValue(enable_mesh ? 64 : 10);
|
||||
getChild<LLSpinCtrl>("Scale Y")->setMaxValue(enable_mesh ? 64 : 10);
|
||||
getChild<LLSpinCtrl>("Scale Z")->setMaxValue(enable_mesh ? 64 : 10);
|
||||
F32 max_scale = get_default_max_prim_scale();
|
||||
getChild<LLSpinCtrl>("Scale X")->setMaxValue(max_scale);
|
||||
getChild<LLSpinCtrl>("Scale Y")->setMaxValue(max_scale);
|
||||
getChild<LLSpinCtrl>("Scale Z")->setMaxValue(max_scale);
|
||||
|
||||
LLComboBox* sculpt_combo = getChild<LLComboBox>("sculpt type control");
|
||||
BOOL found = sculpt_combo->itemExists("Mesh");
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@
|
|||
#include "llkeyframefallmotion.h"
|
||||
#include "llkeyframestandmotion.h"
|
||||
#include "llkeyframewalkmotion.h"
|
||||
#include "llmanipscale.h" // for get_default_max_prim_scale()
|
||||
#include "llmeshrepository.h"
|
||||
#include "llmutelist.h"
|
||||
#include "llmoveview.h"
|
||||
|
|
@ -1383,7 +1384,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
|
|||
newMin.setSub(pos, buffer);
|
||||
newMax.setAdd(pos, buffer);
|
||||
|
||||
float max_attachment_span = DEFAULT_MAX_PRIM_SCALE * 5.0f;
|
||||
float max_attachment_span = get_default_max_prim_scale() * 5.0f;
|
||||
|
||||
//stretch bounding box by joint positions
|
||||
for (polymesh_map_t::iterator i = mMeshes.begin(); i != mMeshes.end(); ++i)
|
||||
|
|
|
|||
Loading…
Reference in New Issue