summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-09-21 21:54:37 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-09-21 21:54:37 +0300
commit664ce046eedc65963c1cbcbadfe72df8970ee2c6 (patch)
tree80af37a093eff3f61449e8a812cd9fecdd36bdc5
parent1ad175a0dfad885103326fca9260b66e3f9c6c73 (diff)
SL-17628 Add viewer sided max attachment distance to position fields
-rw-r--r--indra/newview/llpanelobject.cpp16
-rw-r--r--indra/newview/llviewerjointattachment.cpp2
2 files changed, 17 insertions, 1 deletions
diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp
index 0bfc1297d3..bc7933d84b 100644
--- a/indra/newview/llpanelobject.cpp
+++ b/indra/newview/llpanelobject.cpp
@@ -93,6 +93,8 @@ enum {
MI_HOLE_COUNT
};
+const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters
+
//static const std::string LEGACY_FULLBRIGHT_DESC =LLTrans::getString("Fullbright");
BOOL LLPanelObject::postBuild()
@@ -1685,6 +1687,16 @@ void LLPanelObject::sendPosition(BOOL btn_down)
mCtrlPosZ->set(LLWorld::getInstance()->resolveLandHeightAgent(newpos) + 1.f);
}
}
+ else
+ {
+ if (newpos.length() > MAX_ATTACHMENT_DIST)
+ {
+ newpos.clampLength(MAX_ATTACHMENT_DIST);
+ mCtrlPosX->set(newpos.mV[VX]);
+ mCtrlPosY->set(newpos.mV[VY]);
+ mCtrlPosZ->set(newpos.mV[VZ]);
+ }
+ }
// Make sure new position is in a valid region, so the object
// won't get dumped by the simulator.
@@ -2191,6 +2203,10 @@ void LLPanelObject::onPastePos()
mClipboardPos.mV[VY] = llclamp(mClipboardPos.mV[VY], 0.f, max_width);
//height will get properly clamped by sendPosition
}
+ else
+ {
+ mClipboardPos.clampLength(MAX_ATTACHMENT_DIST);
+ }
mCtrlPosX->set( mClipboardPos.mV[VX] );
mCtrlPosY->set( mClipboardPos.mV[VY] );
diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp
index fd314ed3dc..b3bfb86b99 100644
--- a/indra/newview/llviewerjointattachment.cpp
+++ b/indra/newview/llviewerjointattachment.cpp
@@ -45,7 +45,7 @@
#include "llglheaders.h"
extern LLPipeline gPipeline;
-const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters?
+const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters
//-----------------------------------------------------------------------------
// LLViewerJointAttachment()