Allow super thin objects on OpenSim
This commit is contained in:
@@ -40,7 +40,7 @@ const F32 MAX_OBJECT_Z = 4096.f; // should match REGION_HEIGHT_METERS, Pre-hav
|
|||||||
const F32 MIN_OBJECT_Z = -256.f;
|
const F32 MIN_OBJECT_Z = -256.f;
|
||||||
const F32 DEFAULT_MAX_PRIM_SCALE = 256.f;
|
const F32 DEFAULT_MAX_PRIM_SCALE = 256.f;
|
||||||
const F32 DEFAULT_MAX_PRIM_SCALE_NO_MESH = DEFAULT_MAX_PRIM_SCALE;
|
const F32 DEFAULT_MAX_PRIM_SCALE_NO_MESH = DEFAULT_MAX_PRIM_SCALE;
|
||||||
const F32 MIN_PRIM_SCALE = 0.01f;
|
//const F32 MIN_PRIM_SCALE = 0.01f;
|
||||||
const F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX
|
const F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX
|
||||||
|
|
||||||
class LLXform
|
class LLXform
|
||||||
|
|||||||
@@ -35,10 +35,12 @@ void HippoLimits::setOpenSimLimits()
|
|||||||
mMaxHeight = 10000.0f;
|
mMaxHeight = 10000.0f;
|
||||||
if (gHippoGridManager->getConnectedGrid()->isRenderCompat()) {
|
if (gHippoGridManager->getConnectedGrid()->isRenderCompat()) {
|
||||||
llinfos << "Using rendering compatible OpenSim limits." << llendl;
|
llinfos << "Using rendering compatible OpenSim limits." << llendl;
|
||||||
|
mMinPrimScale = 0.01f;
|
||||||
mMinHoleSize = 0.05f;
|
mMinHoleSize = 0.05f;
|
||||||
mMaxHollow = 0.95f;
|
mMaxHollow = 0.95f;
|
||||||
} else {
|
} else {
|
||||||
llinfos << "Using Hippo OpenSim limits." << llendl;
|
llinfos << "Using Hippo OpenSim limits." << llendl;
|
||||||
|
mMinPrimScale = 0.001f;
|
||||||
mMinHoleSize = 0.01f;
|
mMinHoleSize = 0.01f;
|
||||||
mMaxHollow = 0.99f;
|
mMaxHollow = 0.99f;
|
||||||
}
|
}
|
||||||
@@ -57,6 +59,7 @@ void HippoLimits::setSecondLifeLimits()
|
|||||||
mMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS;
|
mMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mMinPrimScale = 0.01f;
|
||||||
mMaxHeight = 4096.0f;
|
mMaxHeight = 4096.0f;
|
||||||
mMinHoleSize = 0.05f;
|
mMinHoleSize = 0.05f;
|
||||||
mMaxHollow = 0.95f;
|
mMaxHollow = 0.95f;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public:
|
|||||||
float getMinHoleSize() const { return mMinHoleSize; }
|
float getMinHoleSize() const { return mMinHoleSize; }
|
||||||
float getMaxHollow() const { return mMaxHollow; }
|
float getMaxHollow() const { return mMaxHollow; }
|
||||||
float getMaxPrimScale() const { return mMaxPrimScale; }
|
float getMaxPrimScale() const { return mMaxPrimScale; }
|
||||||
|
float getMinPrimScale() const { return mMinPrimScale; }
|
||||||
|
|
||||||
void setLimits();
|
void setLimits();
|
||||||
|
|
||||||
@@ -22,6 +23,7 @@ private:
|
|||||||
float mMinHoleSize;
|
float mMinHoleSize;
|
||||||
float mMaxHollow;
|
float mMaxHollow;
|
||||||
float mMaxPrimScale;
|
float mMaxPrimScale;
|
||||||
|
float mMinPrimScale;
|
||||||
|
|
||||||
void setOpenSimLimits();
|
void setOpenSimLimits();
|
||||||
void setSecondLifeLimits();
|
void setSecondLifeLimits();
|
||||||
|
|||||||
@@ -94,13 +94,6 @@ const LLManip::EManipPart MANIPULATOR_IDS[NUM_MANIPULATORS] =
|
|||||||
LLManip::LL_FACE_NEGZ
|
LLManip::LL_FACE_NEGZ
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
F32 get_default_max_prim_scale(bool is_flora)
|
|
||||||
{
|
|
||||||
//CF: both scales are 256, so what?, I now use gridmanagersetting
|
|
||||||
return gHippoLimits->getMaxPrimScale();
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLManipScale::setUniform(BOOL b)
|
void LLManipScale::setUniform(BOOL b)
|
||||||
{
|
{
|
||||||
@@ -966,8 +959,11 @@ void LLManipScale::dragCorner( S32 x, S32 y )
|
|||||||
mInSnapRegime = FALSE;
|
mInSnapRegime = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 max_scale_factor = get_default_max_prim_scale() / MIN_PRIM_SCALE;
|
F32 max_prim_scale = gHippoLimits->getMaxPrimScale();
|
||||||
F32 min_scale_factor = MIN_PRIM_SCALE / get_default_max_prim_scale();
|
F32 min_prim_scale = gHippoLimits->getMinPrimScale();
|
||||||
|
|
||||||
|
F32 max_scale_factor = max_prim_scale / min_prim_scale;
|
||||||
|
F32 min_scale_factor = min_prim_scale / 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
|
// 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();
|
for (LLObjectSelection::iterator iter = mObjectSelection->begin();
|
||||||
@@ -982,10 +978,10 @@ void LLManipScale::dragCorner( S32 x, S32 y )
|
|||||||
{
|
{
|
||||||
const LLVector3& scale = selectNode->mSavedScale;
|
const LLVector3& scale = selectNode->mSavedScale;
|
||||||
|
|
||||||
F32 cur_max_scale_factor = llmin( get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VX], get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VY], get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VZ] );
|
F32 cur_max_scale_factor = llmin( max_prim_scale / scale.mV[VX], max_prim_scale / scale.mV[VY], max_prim_scale / scale.mV[VZ] );
|
||||||
max_scale_factor = llmin( max_scale_factor, cur_max_scale_factor );
|
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( min_prim_scale / scale.mV[VX], min_prim_scale / scale.mV[VY], min_prim_scale / scale.mV[VZ] );
|
||||||
min_scale_factor = llmax( min_scale_factor, cur_min_scale_factor );
|
min_scale_factor = llmax( min_scale_factor, cur_min_scale_factor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1288,7 +1284,7 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto
|
|||||||
|
|
||||||
F32 denom = axis * dir_local;
|
F32 denom = axis * dir_local;
|
||||||
F32 desired_delta_size = is_approx_zero(denom) ? 0.f : (delta_local_mag / denom); // in meters
|
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, get_default_max_prim_scale(LLPickInfo::isFlora(cur)));
|
F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale());
|
||||||
// propagate scale constraint back to position offset
|
// propagate scale constraint back to position offset
|
||||||
desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position
|
desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position
|
||||||
|
|
||||||
@@ -1989,7 +1985,7 @@ F32 LLManipScale::partToMaxScale( S32 part, const LLBBox &bbox ) const
|
|||||||
max_extent = bbox_extents.mV[i];
|
max_extent = bbox_extents.mV[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
max_scale_factor = bbox_extents.magVec() * get_default_max_prim_scale() / max_extent;
|
max_scale_factor = bbox_extents.magVec() * gHippoLimits->getMaxPrimScale() / max_extent;
|
||||||
|
|
||||||
if (getUniform())
|
if (getUniform())
|
||||||
{
|
{
|
||||||
@@ -2004,7 +2000,7 @@ F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const
|
|||||||
{
|
{
|
||||||
LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox );
|
LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox );
|
||||||
bbox_extents.abs();
|
bbox_extents.abs();
|
||||||
F32 min_extent = get_default_max_prim_scale();
|
F32 min_extent = gHippoLimits->getMaxPrimScale();
|
||||||
for (U32 i = VX; i <= VZ; i++)
|
for (U32 i = VX; i <= VZ; i++)
|
||||||
{
|
{
|
||||||
if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent)
|
if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent)
|
||||||
@@ -2012,7 +2008,7 @@ F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const
|
|||||||
min_extent = bbox_extents.mV[i];
|
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())
|
if (getUniform())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,8 +46,6 @@
|
|||||||
#include "llbbox.h"
|
#include "llbbox.h"
|
||||||
|
|
||||||
|
|
||||||
F32 get_default_max_prim_scale(bool is_flora = false);
|
|
||||||
|
|
||||||
class LLToolComposite;
|
class LLToolComposite;
|
||||||
class LLColor4;
|
class LLColor4;
|
||||||
|
|
||||||
|
|||||||
@@ -550,6 +550,9 @@ void LLPanelObject::getState( )
|
|||||||
mCtrlScaleX->setMaxValue(gHippoLimits->getMaxPrimScale());
|
mCtrlScaleX->setMaxValue(gHippoLimits->getMaxPrimScale());
|
||||||
mCtrlScaleY->setMaxValue(gHippoLimits->getMaxPrimScale());
|
mCtrlScaleY->setMaxValue(gHippoLimits->getMaxPrimScale());
|
||||||
mCtrlScaleZ->setMaxValue(gHippoLimits->getMaxPrimScale());
|
mCtrlScaleZ->setMaxValue(gHippoLimits->getMaxPrimScale());
|
||||||
|
mCtrlScaleX->setMinValue(gHippoLimits->getMinPrimScale());
|
||||||
|
mCtrlScaleY->setMinValue(gHippoLimits->getMinPrimScale());
|
||||||
|
mCtrlScaleZ->setMinValue(gHippoLimits->getMinPrimScale());
|
||||||
|
|
||||||
LLQuaternion object_rot = objectp->getRotationEdit();
|
LLQuaternion object_rot = objectp->getRotationEdit();
|
||||||
object_rot.getEulerAngles(&(mCurEulerDegrees.mV[VX]), &(mCurEulerDegrees.mV[VY]), &(mCurEulerDegrees.mV[VZ]));
|
object_rot.getEulerAngles(&(mCurEulerDegrees.mV[VX]), &(mCurEulerDegrees.mV[VY]), &(mCurEulerDegrees.mV[VZ]));
|
||||||
@@ -2537,9 +2540,9 @@ void LLPanelObject::onPasteSize(void* user_data)
|
|||||||
|
|
||||||
LLPanelObject* self = (LLPanelObject*) user_data;
|
LLPanelObject* self = (LLPanelObject*) user_data;
|
||||||
LLCalc* calcp = LLCalc::getInstance();
|
LLCalc* calcp = LLCalc::getInstance();
|
||||||
mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], 0.01f, gHippoLimits->getMaxPrimScale());
|
mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale());
|
||||||
mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], 0.01f, gHippoLimits->getMaxPrimScale());
|
mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale());
|
||||||
mClipboardSize.mV[VZ] = llclamp(mClipboardSize.mV[VZ], 0.01f, gHippoLimits->getMaxPrimScale());
|
mClipboardSize.mV[VZ] = llclamp(mClipboardSize.mV[VZ], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale());
|
||||||
|
|
||||||
self->mCtrlScaleX->set( mClipboardSize.mV[VX] );
|
self->mCtrlScaleX->set( mClipboardSize.mV[VX] );
|
||||||
self->mCtrlScaleY->set( mClipboardSize.mV[VY] );
|
self->mCtrlScaleY->set( mClipboardSize.mV[VY] );
|
||||||
@@ -2620,9 +2623,9 @@ void LLPanelObject::onPasteSizeClip(void* user_data)
|
|||||||
std::string stringVec = wstring_to_utf8str(temp_string);
|
std::string stringVec = wstring_to_utf8str(temp_string);
|
||||||
if(!getvectorfromclip(stringVec, &mClipboardSize)) return;
|
if(!getvectorfromclip(stringVec, &mClipboardSize)) return;
|
||||||
|
|
||||||
mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], 0.01f, gHippoLimits->getMaxPrimScale());
|
mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale());
|
||||||
mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], 0.01f, gHippoLimits->getMaxPrimScale());
|
mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale());
|
||||||
mClipboardSize.mV[VZ] = llclamp(mClipboardSize.mV[VZ], 0.01f, gHippoLimits->getMaxPrimScale());
|
mClipboardSize.mV[VZ] = llclamp(mClipboardSize.mV[VZ], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale());
|
||||||
|
|
||||||
self->mCtrlScaleX->set( mClipboardSize.mV[VX] );
|
self->mCtrlScaleX->set( mClipboardSize.mV[VX] );
|
||||||
self->mCtrlScaleY->set( mClipboardSize.mV[VY] );
|
self->mCtrlScaleY->set( mClipboardSize.mV[VY] );
|
||||||
|
|||||||
Reference in New Issue
Block a user