summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2021-04-02 19:55:34 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2021-04-06 23:24:38 +0300
commit8215fff0c2a1c895ef916837847cf7526ae61ef9 (patch)
tree7c3346132eab0481532e7e2fd6896df86f936c92 /indra/newview
parent77147012fff0673fc5c8ab9ffe654bd32305ad1a (diff)
SL-14717 Ability to trigger left clicks (and more) on animesh objects
Contribution by Rohacan Hirons SL-14717 Follow ups SL-14717 Using the cached setting in LLToolPie::handleHover()
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llagentcamera.cpp8
-rw-r--r--indra/newview/lltoolface.cpp2
-rw-r--r--indra/newview/lltoolfocus.cpp2
-rw-r--r--indra/newview/lltoolpie.cpp31
-rw-r--r--indra/newview/pipeline.cpp1
5 files changed, 39 insertions, 5 deletions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index ed6c3c307f..e10244aad6 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -2501,8 +2501,16 @@ void LLAgentCamera::setFocusGlobal(const LLPickInfo& pick)
{
// focus on object plus designated offset
// which may or may not be same as pick.mPosGlobal
+ // except for rigged items to prevent wrong focus position
+ if (objectp->isRiggedMesh())
+ {
+ setFocusGlobal(pick.mPosGlobal, pick.mObjectID);
+ }
+ else
+ {
setFocusGlobal(objectp->getPositionGlobal() + LLVector3d(pick.mObjectOffset), pick.mObjectID);
}
+ }
else
{
// focus directly on point where user clicked
diff --git a/indra/newview/lltoolface.cpp b/indra/newview/lltoolface.cpp
index a00ac10698..71986d21f9 100644
--- a/indra/newview/lltoolface.cpp
+++ b/indra/newview/lltoolface.cpp
@@ -73,7 +73,7 @@ BOOL LLToolFace::handleDoubleClick(S32 x, S32 y, MASK mask)
BOOL LLToolFace::handleMouseDown(S32 x, S32 y, MASK mask)
{
- gViewerWindow->pickAsync(x, y, mask, pickCallback);
+ gViewerWindow->pickAsync(x, y, mask, pickCallback, false, gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick"));
return TRUE;
}
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index 07f46c5fbe..d8cb70dd3c 100644
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -135,7 +135,7 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask)
gViewerWindow->hideCursor();
- gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ FALSE, /*BOOL pick_rigged*/ FALSE, /*BOOL pick_unselectable*/ TRUE);
+ gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ FALSE, /*BOOL pick_rigged*/ gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick"), /*BOOL pick_unselectable*/ TRUE);
return TRUE;
}
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 322d0bc727..c3f85c0008 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -78,6 +78,10 @@ static void handle_click_action_play();
static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp);
static ECursorType cursor_from_parcel_media(U8 click_action);
+BOOL rigged_hovering_keep_hand = false;
+U64 last_rigged_hovering_check_clock_count = 0;
+U64 last_rigged_pick_clock_count = 0;
+
LLToolPie::LLToolPie()
: LLTool(std::string("Pie")),
mMouseButtonDown( false ),
@@ -112,7 +116,7 @@ BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask)
mMouseDownX = x;
mMouseDownY = y;
LLTimer pick_timer;
- BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick");
+ BOOL pick_rigged = gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick");
LLPickInfo transparent_pick = gViewerWindow->pickImmediate(x, y, TRUE /*includes transparent*/, pick_rigged);
LLPickInfo visible_pick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged);
LLViewerObject *transp_object = transparent_pick.getObject();
@@ -173,7 +177,9 @@ BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask)
mMouseButtonDown = true;
- return handleLeftClickPick();
+ handleLeftClickPick();
+
+ return TRUE;
}
// Spawn context menus on right mouse down so you can drag over and select
@@ -722,7 +728,21 @@ void LLToolPie::selectionPropertiesReceived()
BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
{
- BOOL pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick");
+ // prevent rigged item hovering causing FPS to drop by faking we're still hovering it for 0.25 seconds
+ U64 current_clock_count = LLTimer::getCurrentClockCount();
+ if (current_clock_count - last_rigged_pick_clock_count < 2500000) {
+ if(rigged_hovering_keep_hand) gViewerWindow->setCursor(UI_CURSOR_HAND);
+ return TRUE;
+ }
+ rigged_hovering_keep_hand = 0;
+
+ static LLCachedControl<bool> pick_rigged_setting(gSavedSettings, "AnimatedObjectsAllowLeftClick");
+ BOOL pick_rigged = pick_rigged_setting;
+ if (pick_rigged) {
+ pick_rigged = (current_clock_count - last_rigged_hovering_check_clock_count > 1000000); // only 10 per seconds
+ if (pick_rigged) last_rigged_hovering_check_clock_count = current_clock_count;
+ }
+
mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE, pick_rigged);
LLViewerObject *parent = NULL;
LLViewerObject *object = mHoverPick.getObject();
@@ -730,6 +750,10 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
if (object)
{
parent = object->getRootEdit();
+ // Update gLastRiggedPickClockCount if we're hovering a rigged item
+ if (object->isRiggedMesh()) {
+ last_rigged_pick_clock_count = current_clock_count;
+ }
}
// Show screen-space highlight glow effect
@@ -794,6 +818,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
{
show_highlight = true;
gViewerWindow->setCursor(UI_CURSOR_HAND);
+ rigged_hovering_keep_hand = true;
LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL;
}
else
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 7ba7e545f4..ffca8896a6 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -7184,6 +7184,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,
if (!sPickAvatar)
{
+ pick_rigged = false;
//save hit info in case we need to restore
//due to attachment override
LLVector4a local_normal;