From d186daa361567fe499b80efe8481e192ffe8199b Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 23 Sep 2026 11:51:39 -0700 Subject: Issue #6205: There was an issue with permissions not being sent in the update message. --- indra/newview/llscripteditorws.cpp | 62 ++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 30 deletions(-) (limited to 'indra/newview/llscripteditorws.cpp') diff --git a/indra/newview/llscripteditorws.cpp b/indra/newview/llscripteditorws.cpp index 017d9a5540..8413547935 100644 --- a/indra/newview/llscripteditorws.cpp +++ b/indra/newview/llscripteditorws.cpp @@ -2395,7 +2395,7 @@ void LLScriptEditorWSServer::notifyAll(const std::string& method, const LLSD& pa // static -std::string LLScriptEditorWSServer::getPrimName(LLViewerObject* obj) +std::string LLScriptEditorWSServer::getPrimName(LLViewerObject* obj, S32 link_number) { std::string name = nv_string(obj, "Name"); if (!name.empty()) @@ -2414,8 +2414,8 @@ std::string LLScriptEditorWSServer::getPrimName(LLViewerObject* obj) return node->mName; } - // Never emit an empty prim/object name to downstream tooling. - return obj->getID().asString(); + // Real prim names need a full ObjectProperties reply, which requires selection. + return (link_number > 1) ? llformat("Link #%d", link_number) : std::string("Object"); } bool LLScriptEditorWSServer::publishObject(const LLUUID& object_id) @@ -2443,12 +2443,8 @@ bool LLScriptEditorWSServer::publishObject(const LLUUID& object_id) // Collect root + all children std::vector prims = collect_linkset(root); - // Request object properties for each prim in the linkset (root + children), - // matching the hover path so name/description metadata is refreshed. - for (LLViewerObject* prim : prims) - { - LLSelectMgr::instance().requestObjectPropertiesFamily(prim); - } + // The sim coalesces properties-family requests to the root, so one request covers the linkset. + LLSelectMgr::instance().requestObjectPropertiesFamily(root); // Set up a PendingPublish to coordinate inventory loading across all prims. // We register a listener and call requestInventory() on every prim. @@ -2513,24 +2509,14 @@ void LLScriptEditorWSServer::buildAndSendPublish(const LLUUID& object_id) info.mOwnerID = root->mOwnerID; info.mObjectName = pub["object_name"].asString(); info.mObjectDescription = pub["object_description"].asString(); + info.mPermissions = LLPublishedObjectMgr::getObjectPermissionsLLSD(root); if (root->getRegion()) { info.mRegionName = root->getRegion()->getName(); } - LLSelectNode* root_select_node = LLSelectMgr::instance().getSelection()->findNode(root); - if (root_select_node - && root_select_node->mValid - && !root_select_node->mFromTaskID.isNull() - && !root->isAttachment()) - { - info.mCanSaveBackToContents = true; - info.mSourceTaskID = root_select_node->mFromTaskID; - } - else - { - info.mCanSaveBackToContents = false; - info.mSourceTaskID.setNull(); - } + LLUUID source_task_id; + info.mCanSaveBackToContents = LLPublishedObjectMgr::computeCanSaveBack(root, source_task_id); + info.mSourceTaskID = source_task_id; S32 link_num = 1; std::vector prims = collect_linkset(root); @@ -2538,9 +2524,10 @@ void LLScriptEditorWSServer::buildAndSendPublish(const LLUUID& object_id) { LLPublishedObjectMgr::PublishedPrimInfo prim_info; prim_info.mPrimID = prim->getID(); - prim_info.mPrimName = getPrimName(prim); // Use helper with selection fallback prim_info.mLinkNumber = link_num++; + prim_info.mPrimName = getPrimName(prim, prim_info.mLinkNumber); prim_info.mInventorySerial = static_cast(prim->getInventorySerial()); + prim_info.mPermissions = LLPublishedObjectMgr::getObjectPermissionsLLSD(prim); info.mPrims.push_back(prim_info); } @@ -2581,12 +2568,9 @@ void LLScriptEditorWSServer::buildAndSendPublish(const LLUUID& object_id) << " (" << pub["object_name"].asString() << ") with " << (prims.size() - 1) << " linked prim(s)" << LL_ENDL; - // Re-request object properties now that the object is published so - // onObjectPropertyChanged can emit object.update for root and linked prims. - for (LLViewerObject* prim : prims) - { - LLSelectMgr::instance().requestObjectPropertiesFamily(prim); - } + // Re-request now that the object is published so onObjectPropertyChanged can emit + // object.update. The sim answers per linkset, so only the root needs asking. + LLSelectMgr::instance().requestObjectPropertiesFamily(root); } void LLScriptEditorWSServer::onLinksetChildAdded(const LLUUID& root_id, LLViewerObject* child) @@ -2748,6 +2732,24 @@ void LLScriptEditorWSServer::onObjectPropertyChanged( } } +void LLScriptEditorWSServer::onObjectPermissionsReceived( + const LLUUID& prim_id, const LLUUID& owner_id, U32 owner_mask, U32 next_owner_mask) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_SCRIPTDEV; + LLViewerObject* prim = gObjectList.findObject(prim_id); + if (!prim) + { + return; + } + + LLSD update; + if (mPublishedObjectManager.applyPermissionsChange( + prim->getRootEdit()->getID(), prim_id, owner_id, owner_mask, next_owner_mask, update)) + { + notifyAll("object.update", update); + } +} + void LLScriptEditorWSServer::unpublishObject(const LLUUID& object_id, const std::string& reason) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SCRIPTDEV; -- cgit v1.3