diff options
| author | Rider Linden <rider@lindenlab.com> | 2026-08-10 15:45:03 -0700 |
|---|---|---|
| committer | Rider Linden <rider@lindenlab.com> | 2026-08-10 15:45:03 -0700 |
| commit | 5e2d671895b292726f923db5f8e7375097b6e159 (patch) | |
| tree | ef2c79039d435c94b36d3b8f2ddd35ab3e367f38 /indra | |
| parent | 309fc5b4c21151e3664f5bdab99f57bae24266a0 (diff) | |
Refresh the object's data when it is published. (link children seem to be an issue still)
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llpublishedobjectmgr.cpp | 107 | ||||
| -rw-r--r-- | indra/newview/llpublishedobjectmgr.h | 11 | ||||
| -rw-r--r-- | indra/newview/llscripteditorws.cpp | 49 |
3 files changed, 159 insertions, 8 deletions
diff --git a/indra/newview/llpublishedobjectmgr.cpp b/indra/newview/llpublishedobjectmgr.cpp index 2c2eff58a5..6f78ba82d9 100644 --- a/indra/newview/llpublishedobjectmgr.cpp +++ b/indra/newview/llpublishedobjectmgr.cpp @@ -72,7 +72,13 @@ namespace } LLSelectNode* node = LLSelectMgr::instance().getSelection()->findNode(obj); - return (node && !node->mName.empty()) ? node->mName : std::string(); + if (node && !node->mName.empty()) + { + return node->mName; + } + + // Never emit an empty prim/object name to downstream tooling. + return obj->getID().asString(); } } @@ -164,6 +170,37 @@ bool LLPublishedObjectMgr::markPendingPublishPrimReady(const LLUUID& object_id, return it->second.mPendingPrims.empty(); } +void LLPublishedObjectMgr::recordPendingPropertyChange( + const LLUUID& root_id, + const LLUUID& prim_id, + const std::string& name, + const std::string& desc) +{ + auto it = mPendingPublishes.find(root_id); + if (it == mPendingPublishes.end()) + { + return; + } + + PendingPublish& pending = it->second; + if (prim_id == root_id) + { + pending.mHasRootProperties = true; + pending.mObjectDescription = desc; + if (!name.empty()) + { + pending.mObjectName = name; + } + return; + } + + if (!name.empty()) + { + pending.mPrimNames[prim_id] = name; + } + pending.mPrimDescriptions[prim_id] = desc; +} + std::vector<std::unique_ptr<LLPublishedPrimListener>> LLPublishedObjectMgr::takePendingPublishListeners(const LLUUID& object_id) { auto it = mPendingPublishes.find(object_id); @@ -387,6 +424,7 @@ LLSD LLPublishedObjectMgr::buildObjectListLLSD() const link["link_id"] = prim_info.mPrimID; link["link_number"] = prim_info.mLinkNumber; link["link_name"] = prim_info.mPrimName; + link["link_description"] = prim_info.mPrimDescription; link["inventory"] = buildPrimInventoryLLSD(child); linked_objects.append(link); } @@ -428,7 +466,13 @@ bool LLPublishedObjectMgr::buildLinksetUpdateLLSD( { link_name = prim_info.mPrimName; } + std::string link_desc = prim ? nv_string(prim, "Desc") : std::string(); + if (link_desc.empty()) + { + link_desc = prim_info.mPrimDescription; + } entry["link_name"] = link_name; + entry["link_description"] = link_desc; entry["inventory"] = prim ? buildPrimInventoryLLSD(prim) : LLSD::emptyArray(); linked_objects.append(entry); @@ -463,6 +507,7 @@ bool LLPublishedObjectMgr::reconcileLinksetChildAdded( PublishedPrimInfo prim_info; prim_info.mPrimID = child_id; prim_info.mPrimName = get_prim_name(child); + prim_info.mPrimDescription = nv_string(child, "Desc"); prim_info.mLinkNumber = static_cast<S32>(info->mPrims.size()) + 1; prim_info.mInventorySerial = -1; info->mPrims.push_back(prim_info); @@ -584,6 +629,7 @@ LLPublishedObjectMgr::reconcileInventoryChanged( if (p.mPrimID == prim_id) { p.mPrimName = get_prim_name(prim); + p.mPrimDescription = nv_string(prim, "Desc"); p.mInventorySerial = 0; break; } @@ -633,7 +679,8 @@ bool LLPublishedObjectMgr::applyPropertyChange( if (prim_id == root_id) { - bool name_changed = (pub_info->mObjectName != name); + bool has_name = !name.empty(); + bool name_changed = has_name && (pub_info->mObjectName != name); bool desc_changed = (pub_info->mObjectDescription != desc); if (!name_changed && !desc_changed) { @@ -659,15 +706,25 @@ bool LLPublishedObjectMgr::applyPropertyChange( { return false; } - if (prim_it->mPrimName == name) + const bool name_changed = !name.empty() && prim_it->mPrimName != name; + const bool desc_changed = prim_it->mPrimDescription != desc; + if (!name_changed && !desc_changed) { return false; } - prim_it->mPrimName = name; LLSD modified_entry; - modified_entry["link_id"] = prim_id; - modified_entry["link_name"] = name; + modified_entry["link_id"] = prim_id; + if (name_changed) + { + prim_it->mPrimName = name; + modified_entry["link_name"] = name; + } + if (desc_changed) + { + prim_it->mPrimDescription = desc; + modified_entry["link_description"] = desc; + } LLSD modified_arr = LLSD::emptyArray(); modified_arr.append(modified_entry); update["changes"]["linked_objects"]["modified"] = modified_arr; @@ -792,8 +849,44 @@ LLPublishedObjectMgr::PublishedObjectInfo& LLPublishedObjectMgr::finalizePending const LLUUID& object_id, PublishedObjectInfo&& info) { PublishedObjectInfo& published_info = mPublishedObjects[object_id]; + auto pending_it = mPendingPublishes.find(object_id); published_info = std::move(info); - published_info.mListeners = takePendingPublishListeners(object_id); + + if (pending_it != mPendingPublishes.end()) + { + PendingPublish& pending = pending_it->second; + if (pending.mHasRootProperties) + { + if (!pending.mObjectName.empty()) + { + published_info.mObjectName = pending.mObjectName; + } + published_info.mObjectDescription = pending.mObjectDescription; + } + + for (PublishedPrimInfo& prim_info : published_info.mPrims) + { + auto name_it = pending.mPrimNames.find(prim_info.mPrimID); + if (name_it != pending.mPrimNames.end() && !name_it->second.empty()) + { + prim_info.mPrimName = name_it->second; + } + + auto desc_it = pending.mPrimDescriptions.find(prim_info.mPrimID); + if (desc_it != pending.mPrimDescriptions.end()) + { + prim_info.mPrimDescription = desc_it->second; + } + } + + published_info.mListeners = std::move(pending.mListeners); + mPendingPublishes.erase(pending_it); + } + else + { + published_info.mListeners = takePendingPublishListeners(object_id); + } + return published_info; } diff --git a/indra/newview/llpublishedobjectmgr.h b/indra/newview/llpublishedobjectmgr.h index 4d4bd55aff..d7eca09d80 100644 --- a/indra/newview/llpublishedobjectmgr.h +++ b/indra/newview/llpublishedobjectmgr.h @@ -49,6 +49,7 @@ public: LLUUID mPrimID; std::string mPrimName; S32 mLinkNumber; + std::string mPrimDescription; S16 mInventorySerial; }; @@ -82,6 +83,11 @@ public: LLUUID mObjectID; std::set<LLUUID> mPendingPrims; std::vector<std::unique_ptr<LLPublishedPrimListener>> mListeners; + bool mHasRootProperties{ false }; + std::string mObjectName; + std::string mObjectDescription; + std::map<LLUUID, std::string> mPrimNames; + std::map<LLUUID, std::string> mPrimDescriptions; }; enum class InventoryChangeKind @@ -153,6 +159,11 @@ public: bool hasPendingPublish(const LLUUID& object_id) const; bool markPendingPublishPrimReady(const LLUUID& object_id, const LLUUID& prim_id); std::vector<std::unique_ptr<LLPublishedPrimListener>> takePendingPublishListeners(const LLUUID& object_id); + void recordPendingPropertyChange( + const LLUUID& root_id, + const LLUUID& prim_id, + const std::string& name, + const std::string& desc); void cancelPendingPublish(const LLUUID& object_id); PublishedObjectInfo& finalizePendingPublish(const LLUUID& object_id, PublishedObjectInfo&& info); bool cleanupObjectStateForUnpublish(const LLUUID& object_id); diff --git a/indra/newview/llscripteditorws.cpp b/indra/newview/llscripteditorws.cpp index 3fbcd5c384..95e06583d3 100644 --- a/indra/newview/llscripteditorws.cpp +++ b/indra/newview/llscripteditorws.cpp @@ -2086,7 +2086,13 @@ std::string LLScriptEditorWSServer::getPrimName(LLViewerObject* obj) } LLSelectNode* node = LLSelectMgr::instance().getSelection()->findNode(obj); - return (node && !node->mName.empty()) ? node->mName : std::string(); + if (node && !node->mName.empty()) + { + return node->mName; + } + + // Never emit an empty prim/object name to downstream tooling. + return obj->getID().asString(); } bool LLScriptEditorWSServer::publishObject(const LLUUID& object_id) @@ -2114,6 +2120,13 @@ bool LLScriptEditorWSServer::publishObject(const LLUUID& object_id) // Collect root + all children std::vector<LLViewerObject*> 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); + } + // Set up a PendingPublish to coordinate inventory loading across all prims. // We register a listener and call requestInventory() on every prim. // If inventory is already loaded, requestInventory() fires the callback @@ -2196,6 +2209,31 @@ void LLScriptEditorWSServer::buildAndSendPublish(const LLUUID& object_id) LLPublishedObjectMgr::PublishedObjectInfo& published_info = mPublishedObjectManager.finalizePendingPublish(object_id, std::move(info)); + // Align outgoing publish payload with any property responses that arrived + // while inventory-gated publish was still pending. + pub["object_name"] = published_info.mObjectName; + pub["object_description"] = published_info.mObjectDescription; + if (pub.has("linked_objects")) + { + LLSD& linked_objects = pub["linked_objects"]; + for (S32 i = 0; i < linked_objects.size(); ++i) + { + const LLUUID link_id = linked_objects[i]["link_id"].asUUID(); + auto prim_it = std::find_if( + published_info.mPrims.begin(), + published_info.mPrims.end(), + [&](const LLPublishedObjectMgr::PublishedPrimInfo& p) + { + return p.mPrimID == link_id; + }); + if (prim_it != published_info.mPrims.end()) + { + linked_objects[i]["link_name"] = prim_it->mPrimName; + linked_objects[i]["link_description"] = prim_it->mPrimDescription; + } + } + } + // Send notification LLSD message; message["object"] = pub; @@ -2204,6 +2242,13 @@ void LLScriptEditorWSServer::buildAndSendPublish(const LLUUID& object_id) LL_INFOS("ScriptEditorWS") << "Published object " << 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); + } } void LLScriptEditorWSServer::onLinksetChildAdded(const LLUUID& root_id, LLViewerObject* child) @@ -2344,6 +2389,8 @@ void LLScriptEditorWSServer::onObjectPropertyChanged( LLUUID root_id = prim->getRootEdit()->getID(); + mPublishedObjectManager.recordPendingPropertyChange(root_id, prim_id, name, desc); + bool should_refresh_inventory = mPublishedObjectManager.markPrimInventorySerialAndDetectChange( root_id, prim_id, |
