Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced hovertips. #89

Merged
merged 5 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion indra/newview/app_settings/settings_alchemy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2490,5 +2490,19 @@
<key>Value</key>
<string>All</string>
</map>
<key>ShowAdvancedHoverTips</key>
<map>
<key>Comment</key>
<string>
Toggles more hover tips details.
</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
</map>
</llsd>
</llsd>

45 changes: 45 additions & 0 deletions indra/newview/lltoolpie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
#include "rlvhandler.h"
// [/RLVa:KB]
#include "alcinematicmode.h"
#include "llviewerregion.h"
#include "llmeshrepository.h"

extern BOOL gDebugClicks;

Expand Down Expand Up @@ -1311,7 +1313,50 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l
}
}

if (gSavedSettings.getBool("ShowAdvancedHoverTips"))
{
LLStringUtil::format_map_t args;
// Get Position
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
LLVector3 objectPosition = region->getPosRegionFromGlobal(hover_object->getPositionGlobal());
if (!RlvActions::isRlvEnabled() || RlvActions::canShowLocation())
{
//Check if we are in the same region, otherwise it shows large negitive position numbers.
if (hover_object->getRegion() && gAgent.getRegion() && hover_object->getRegion()->getRegionID() == gAgent.getRegion()->getRegionID())
{
args["OBJECT_POSITION"] =
llformat("<%.02f, %.02f, %.02f>", objectPosition.mV[VX], objectPosition.mV[VY], objectPosition.mV[VZ]);
tooltip_msg.append("\n" + LLTrans::getString("TooltipPosition", args));
}
}

// Get Distance
F32 distance = (objectPosition - region->getPosRegionFromGlobal(gAgent.getPositionGlobal())).magVec();
args["OBJECT_DISTANCE"] = llformat("%.02f", distance);
tooltip_msg.append("\n" + LLTrans::getString("TooltipDistance", args));
}

// Get Prim Count
args["PRIM_COUNT"] = llformat("%d", LLSelectMgr::getInstance()->getHoverObjects()->getObjectCount());
tooltip_msg.append("\n" + LLTrans::getString("TooltipPrimCount", args));

// Get Prim Land Impact
if (gMeshRepo.meshRezEnabled())
{
S32 cost = LLSelectMgr::getInstance()->getHoverObjects()->getSelectedLinksetCost();
if (cost > 0)
{
args["PRIM_COST"] = llformat("%d", cost);
tooltip_msg.append("\n" + LLTrans::getString("TooltipPrimCost", args));
}
else
{
tooltip_msg.append("\n" + LLTrans::getString("TooltipPrimCostLoading"));
}
}
}
// Avoid showing tip over media that's displaying unless it's for sale
// also check the primary node since sometimes it can have an action even though
// the root node doesn't
Expand Down
15 changes: 15 additions & 0 deletions indra/newview/skins/default/xui/en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4560,4 +4560,19 @@ and report the problem.
name="Permanent">
Permanent
</string>
<string name="TooltipPrimCount">
Prims: [PRIM_COUNT]
</string>
<string name="TooltipPrimCost">
Land Impact: [PRIM_COST]
</string>
<string name="TooltipPrimCostLoading">
Loading Land Impact...
</string>
<string name="TooltipPosition">
Position: [OBJECT_POSITION]
</string>
<string name="TooltipDistance">
Distance: [OBJECT_DISTANCE]
</string>
</strings>