FIRE-34884: Get control avatar name

for attached control avatars
master
Angeldark Raymaker 2024-11-26 19:02:39 +00:00
parent 6beb092b22
commit f710eac468
2 changed files with 37 additions and 1 deletions

View File

@ -41,6 +41,7 @@
#include "llviewerwindow.h"
#include "llwindow.h"
#include "llvoavatarself.h"
#include "llinventoryfunctions.h"
namespace
{
@ -2018,12 +2019,17 @@ void FSFloaterPoser::onAvatarsRefresh()
if (!couldAnimateAvatar(avatar))
continue;
LLAvatarName av_name;
std::string animeshName = getControlAvatarName(avatar);
if (animeshName.empty())
animeshName = avatar->getFullname();
LLSD row;
row["columns"][COL_ICON]["column"] = "icon";
row["columns"][COL_ICON]["type"] = "icon";
row["columns"][COL_ICON]["value"] = iconObjectName;
row["columns"][COL_NAME]["column"] = "name";
row["columns"][COL_NAME]["value"] = avatar->getFullname();
row["columns"][COL_NAME]["value"] = animeshName;
row["columns"][COL_UUID]["column"] = "uuid";
row["columns"][COL_UUID]["value"] = avatar->getID();
row["columns"][COL_SAVE]["column"] = "saveFileName";
@ -2035,6 +2041,25 @@ void FSFloaterPoser::onAvatarsRefresh()
refreshTextHighlightingOnAvatarScrollList();
}
std::string FSFloaterPoser::getControlAvatarName(const LLControlAvatar* avatar)
{
if (!avatar)
return "";
const LLVOVolume* rootVolume = avatar->mRootVolp;
const LLViewerObject* rootEditObject = (rootVolume) ? rootVolume->getRootEdit() : NULL;
if (!rootEditObject)
return "";
const LLViewerInventoryItem* attachedItem =
(rootEditObject->isAttachment()) ? gInventory.getItem(rootEditObject->getAttachmentItemID()) : NULL;
if (attachedItem)
return attachedItem->getName();
return "";
}
void FSFloaterPoser::refreshTextHighlightingOnAvatarScrollList()
{
for (auto listItem : mAvatarSelectionScrollList->getAllData())

View File

@ -333,6 +333,17 @@ class FSFloaterPoser : public LLFloater
/// </remarks>
bool getWhetherToResetBaseRotationOnEdit();
/// <summary>
/// Gets the name of an item from the supplied object ID.
/// </summary>
/// <param name="avatar">The control avatar to get the name for.</param>
/// <returns>The name of the supplied object.</returns>
/// <devnotes>
/// Getting the name for an arbitrary item appears to involve sending system message and creating a
/// callback, making for unwanted dependencies and conflict-risk; so not implemented.
/// </devnotes>
std::string getControlAvatarName(const LLControlAvatar* avatar);
/// <summary>
/// The time when the last click of a button was made.
/// Utilized for controls needing a 'double click do' function.