diff --git a/indra/newview/fsfloaterposer.cpp b/indra/newview/fsfloaterposer.cpp index 23e34adf3b..2d4c4c9e9f 100644 --- a/indra/newview/fsfloaterposer.cpp +++ b/indra/newview/fsfloaterposer.cpp @@ -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()) diff --git a/indra/newview/fsfloaterposer.h b/indra/newview/fsfloaterposer.h index ab20071128..373885befa 100644 --- a/indra/newview/fsfloaterposer.h +++ b/indra/newview/fsfloaterposer.h @@ -333,6 +333,17 @@ class FSFloaterPoser : public LLFloater /// bool getWhetherToResetBaseRotationOnEdit(); + /// + /// Gets the name of an item from the supplied object ID. + /// + /// The control avatar to get the name for. + /// The name of the supplied object. + /// + /// 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. + /// + std::string getControlAvatarName(const LLControlAvatar* avatar); + /// /// The time when the last click of a button was made. /// Utilized for controls needing a 'double click do' function.