summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2026-07-16 10:21:55 +0800
committerErik Kundiman <erik@megapahit.org>2026-07-16 10:21:55 +0800
commitc3a231b4b0eb48d9a8ca67b2ecffe293c701fd27 (patch)
tree27ae1aab80731ed8402cf776171548ca508a763d
parentca864099fa4a90a43bdb1c639163b81bf2b065bc (diff)
parent1577ca1724787fdc0f0317ade3dab8ea3c5df7e7 (diff)
Merge tag 'Second_Life_Release#1577ca17-26.3' into 26.3
-rw-r--r--indra/newview/llagentlistener.cpp42
-rw-r--r--indra/newview/llagentlistener.h1
2 files changed, 43 insertions, 0 deletions
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index 5ddb87558a..73368c1bcc 100644
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -43,6 +43,7 @@
#include "llviewernetwork.h"
#include "llviewerobject.h"
#include "llviewerobjectlist.h"
+#include "llviewerjointattachment.h"
#include "llviewerregion.h"
#include "llvoavatarself.h"
#include "llsdutil.h"
@@ -195,6 +196,12 @@ LLAgentListener::LLAgentListener(LLAgent &agent)
&LLAgentListener::getNearbyObjectsList,
llsd::map("reply", LLSD()));
+ add("getAttachedObjectsList",
+ "Return attached objects list with information about each object\n"
+ "reply contains \"attachments\" result key",
+ &LLAgentListener::getAttachedObjectsList,
+ llsd::map("reply", LLSD()));
+
add("getAgentScreenPos",
"Return screen position of the [\"avatar_id\"] avatar or own avatar if not specified\n"
"reply contains \"x\", \"y\" coordinates and \"onscreen\" flag to indicate if it's actually in within the current window\n"
@@ -772,6 +779,41 @@ void LLAgentListener::getNearbyObjectsList(LLSD const& event_data)
}
}
+void LLAgentListener::getAttachedObjectsList(LLSD const& event_data)
+{
+ Response response(LLSD(), event_data);
+ response["attachments"] = LLSD::emptyArray();
+
+ if (!isAgentAvatarValid())
+ {
+ return;
+ }
+
+ for (const auto& [attachment_point_index, attachment_point] : gAgentAvatarp->mAttachmentPoints)
+ {
+ if (!attachment_point)
+ {
+ continue;
+ }
+
+ for (const auto& attachment_object_ptr : attachment_point->mAttachedObjects)
+ {
+ if (LLViewerObject* attachment_object = attachment_object_ptr.get())
+ {
+ response["attachments"].append(llsd::map(
+ "object_id", attachment_object->getID(),
+ "inventory_item_id", attachment_object->getAttachmentItemID(),
+ "name", attachment_object->getAttachmentItemName(),
+ "attachment_point", attachment_point->getName(),
+ "attachment_point_index", attachment_point_index,
+ "position", ll_sd_from_vector3(attachment_object->getPosition()),
+ "rotation", ll_sd_from_quaternion(attachment_object->getRotation()),
+ "is_temporary", attachment_object->isTempAttachment()));
+ }
+ }
+ }
+}
+
void LLAgentListener::getAgentScreenPos(LLSD const& event_data)
{
Response response(LLSD(), event_data);
diff --git a/indra/newview/llagentlistener.h b/indra/newview/llagentlistener.h
index b5bea8c0bd..031fc75e46 100644
--- a/indra/newview/llagentlistener.h
+++ b/indra/newview/llagentlistener.h
@@ -68,6 +68,7 @@ private:
void getID(LLSD const& event_data);
void getNearbyAvatarsList(LLSD const& event_data);
void getNearbyObjectsList(LLSD const& event_data);
+ void getAttachedObjectsList(LLSD const& event_data);
void getAgentScreenPos(LLSD const& event_data);
LLViewerObject * findObjectClosestTo( const LLVector3 & position, bool sit_target = false ) const;