Remove some very old code which seems to cause more problems (stuck attachments) than it actually helps

master
Ansariel 2024-05-02 16:57:43 +02:00
parent 5f72d9b249
commit 4984270daa
8 changed files with 188 additions and 466 deletions

View File

@ -957,122 +957,68 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
if (callback && !callback.empty())
{
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-3.7
uuid_list_t ids;
bool needs_callback = true;
LLUUID id(LLUUID::null);
switch (type)
{
case COPYLIBRARYCATEGORY:
case FETCHCATEGORYCATEGORIES:
case FETCHCATEGORYCHILDREN:
case FETCHCATEGORYSUBSET:
case FETCHCATEGORYLINKS:
case FETCHCOF:
if (result.has("category_id"))
case COPYLIBRARYCATEGORY:
case FETCHCATEGORYCATEGORIES:
case FETCHCATEGORYCHILDREN:
case FETCHCATEGORYSUBSET:
case FETCHCATEGORYLINKS:
case FETCHCOF:
if (result.has("category_id"))
{
id = result["category_id"];
}
break;
case FETCHITEM:
if (result.has("item_id"))
{
// Error message might contain an item_id!!!
id = result["item_id"];
}
if (result.has("linked_id"))
{
id = result["linked_id"];
}
break;
case CREATEINVENTORY:
// CREATEINVENTORY can have multiple callbacks
if (result.has("_created_categories"))
{
LLSD& cats = result["_created_categories"];
LLSD::array_const_iterator cat_iter;
for (cat_iter = cats.beginArray(); cat_iter != cats.endArray(); ++cat_iter)
{
ids.emplace(result["category_id"]);
LLUUID cat_id = *cat_iter;
callback(cat_id);
needs_callback = false;
}
break;
case FETCHITEM:
if (result.has("linked_id"))
}
if (result.has("_created_items"))
{
LLSD& items = result["_created_items"];
LLSD::array_const_iterator item_iter;
for (item_iter = items.beginArray(); item_iter != items.endArray(); ++item_iter)
{
ids.emplace(result["linked_id"]);
LLUUID item_id = *item_iter;
callback(item_id);
needs_callback = false;
}
else if (result.has("item_id"))
{
// Error message might contain an item_id!!!
ids.emplace(result["item_id"]);
}
break;
case COPYINVENTORY:
case CREATEINVENTORY:
{
AISUpdate::parseUUIDArray(result, "_created_categories", ids);
AISUpdate::parseUUIDArray(result, "_created_items", ids);
}
break;
case UPDATECATEGORY:
{
AISUpdate::parseUUIDArray(result, "_updated_categories", ids);
}
break;
default:
break;
}
break;
default:
break;
}
// Call callback at least once regardless of failure.
if (ids.empty())
{
ids.emplace(LLUUID::null);
}
for (const auto& id : ids)
if (needs_callback)
{
// Call callback at least once regardless of failure.
// UPDATEITEM doesn't expect an id
callback(id);
}
// [/SL:KB]
//bool needs_callback = true;
//LLUUID id(LLUUID::null);
//switch (type)
//{
//case COPYLIBRARYCATEGORY:
//case FETCHCATEGORYCATEGORIES:
//case FETCHCATEGORYCHILDREN:
//case FETCHCATEGORYSUBSET:
//case FETCHCATEGORYLINKS:
//case FETCHCOF:
// if (result.has("category_id"))
// {
// id = result["category_id"];
// }
// break;
//case FETCHITEM:
// if (result.has("item_id"))
// {
// // Error message might contain an item_id!!!
// id = result["item_id"];
// }
// if (result.has("linked_id"))
// {
// id = result["linked_id"];
// }
// break;
//case CREATEINVENTORY:
// // CREATEINVENTORY can have multiple callbacks
// if (result.has("_created_categories"))
// {
// LLSD& cats = result["_created_categories"];
// LLSD::array_const_iterator cat_iter;
// for (cat_iter = cats.beginArray(); cat_iter != cats.endArray(); ++cat_iter)
// {
// LLUUID cat_id = *cat_iter;
// callback(cat_id);
// needs_callback = false;
// }
// }
// if (result.has("_created_items"))
// {
// LLSD& items = result["_created_items"];
// LLSD::array_const_iterator item_iter;
// for (item_iter = items.beginArray(); item_iter != items.endArray(); ++item_iter)
// {
// LLUUID item_id = *item_iter;
// callback(item_id);
// needs_callback = false;
// }
// }
// break;
//default:
// break;
//}
//if (needs_callback)
//{
// // Call callback at least once regardless of failure.
// // UPDATEITEM doesn't expect an id
// callback(id);
//}
}
}

View File

@ -114,10 +114,7 @@ public:
void parseUpdate(const LLSD& update);
void parseMeta(const LLSD& update);
void parseContent(const LLSD& update);
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-3.7
static void parseUUIDArray(const LLSD& content, const std::string& name, uuid_list_t& ids);
// [/SL:KB]
// void parseUUIDArray(const LLSD& content, const std::string& name, uuid_list_t& ids);
void parseUUIDArray(const LLSD& content, const std::string& name, uuid_list_t& ids);
void parseLink(const LLSD& link_map, S32 depth);
void parseItem(const LLSD& link_map);
void parseCategory(const LLSD& link_map, S32 depth);

View File

@ -714,20 +714,16 @@ public:
bool pollMissingWearables();
bool isMissingCompleted();
void recoverMissingWearable(LLWearableType::EType type);
// void clearCOFLinksForMissingWearables();
void clearCOFLinksForMissingWearables();
void onWearableAssetFetch(LLViewerWearable *wearable);
void onAllComplete();
// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-2.0)
bool pollStopped();
// [/SL:KB]
typedef std::list<LLFoundData> found_list_t;
found_list_t& getFoundList();
void eraseTypeToLink(LLWearableType::EType type);
void eraseTypeToRecover(LLWearableType::EType type);
// void setObjItems(const LLInventoryModel::item_array_t& items);
void setObjItems(const LLInventoryModel::item_array_t& items);
void setGestItems(const LLInventoryModel::item_array_t& items);
bool isMostRecent();
void handleLateArrivals();
@ -737,7 +733,7 @@ public:
private:
found_list_t mFoundList;
// LLInventoryModel::item_array_t mObjItems;
LLInventoryModel::item_array_t mObjItems;
LLInventoryModel::item_array_t mGestItems;
typedef std::set<S32> type_set_t;
type_set_t mTypesToRecover;
@ -814,11 +810,10 @@ void LLWearableHoldingPattern::eraseTypeToRecover(LLWearableType::EType type)
mTypesToRecover.erase(type);
}
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-2.1
//void LLWearableHoldingPattern::setObjItems(const LLInventoryModel::item_array_t& items)
//{
// mObjItems = items;
//}
void LLWearableHoldingPattern::setObjItems(const LLInventoryModel::item_array_t& items)
{
mObjItems = items;
}
void LLWearableHoldingPattern::setGestItems(const LLInventoryModel::item_array_t& items)
{
@ -925,56 +920,55 @@ void LLWearableHoldingPattern::onAllComplete()
if (isAgentAvatarValid())
{
// LL_DEBUGS("Avatar") << self_av_string() << "Updating " << mObjItems.size() << " attachments" << LL_ENDL;
// LLAgentWearables::llvo_vec_t objects_to_remove;
// LLAgentWearables::llvo_vec_t objects_to_retain;
// LLInventoryModel::item_array_t items_to_add;
//
// LLAgentWearables::findAttachmentsAddRemoveInfo(mObjItems,
// objects_to_remove,
// objects_to_retain,
// items_to_add);
//
// LL_DEBUGS("Avatar") << self_av_string() << "Removing " << objects_to_remove.size()
// << " attachments" << LL_ENDL;
//
// // Here we remove the attachment pos overrides for *all*
// // attachments, even those that are not being removed. This is
// // needed to get joint positions all slammed down to their
// // pre-attachment states.
// gAgentAvatarp->clearAttachmentOverrides();
//
// if (objects_to_remove.size() || items_to_add.size())
// {
// LL_DEBUGS("Avatar") << "ATT will remove " << objects_to_remove.size()
// << " and add " << items_to_add.size() << " items" << LL_ENDL;
// }
//
// // Take off the attachments that will no longer be in the outfit.
// LLAgentWearables::userRemoveMultipleAttachments(objects_to_remove);
LL_DEBUGS("Avatar") << self_av_string() << "Updating " << mObjItems.size() << " attachments" << LL_ENDL;
LLAgentWearables::llvo_vec_t objects_to_remove;
LLAgentWearables::llvo_vec_t objects_to_retain;
LLInventoryModel::item_array_t items_to_add;
LLAgentWearables::findAttachmentsAddRemoveInfo(mObjItems,
objects_to_remove,
objects_to_retain,
items_to_add);
LL_DEBUGS("Avatar") << self_av_string() << "Removing " << objects_to_remove.size()
<< " attachments" << LL_ENDL;
// Here we remove the attachment pos overrides for *all*
// attachments, even those that are not being removed. This is
// needed to get joint positions all slammed down to their
// pre-attachment states.
gAgentAvatarp->clearAttachmentOverrides();
if (objects_to_remove.size() || items_to_add.size())
{
LL_DEBUGS("Avatar") << "ATT will remove " << objects_to_remove.size()
<< " and add " << items_to_add.size() << " items" << LL_ENDL;
}
// Take off the attachments that will no longer be in the outfit.
LLAgentWearables::userRemoveMultipleAttachments(objects_to_remove);
// Update wearables.
LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " updating agent wearables with "
<< mResolved << " wearable items " << LL_ENDL;
LLAppearanceMgr::instance().updateAgentWearables(this);
// <FS:ND/> Merge; Changed in FS but not tagged with any FS: comment explaining by whom and the purpose
// // Restore attachment pos overrides for the attachments that
// // are remaining in the outfit.
// for (LLAgentWearables::llvo_vec_t::iterator it = objects_to_retain.begin();
// it != objects_to_retain.end();
// ++it)
// {
// LLViewerObject *objectp = *it;
// if (!objectp->isAnimatedObject())
// {
// gAgentAvatarp->addAttachmentOverridesForObject(objectp);
// }
// }
//
// // Add new attachments to match those requested.
// LL_DEBUGS("Avatar") << self_av_string() << "Adding " << items_to_add.size() << " attachments" << LL_ENDL;
// LLAgentWearables::userAttachMultipleAttachments(items_to_add);
// Restore attachment pos overrides for the attachments that
// are remaining in the outfit.
for (LLAgentWearables::llvo_vec_t::iterator it = objects_to_retain.begin();
it != objects_to_retain.end();
++it)
{
LLViewerObject *objectp = *it;
if (!objectp->isAnimatedObject())
{
gAgentAvatarp->addAttachmentOverridesForObject(objectp);
}
}
// Add new attachments to match those requested.
LL_DEBUGS("Avatar") << self_av_string() << "Adding " << items_to_add.size() << " attachments" << LL_ENDL;
LLAgentWearables::userAttachMultipleAttachments(items_to_add);
}
if (isFetchCompleted() && isMissingCompleted())
@ -1012,12 +1006,6 @@ bool LLWearableHoldingPattern::pollFetchCompletion()
{
// runway skip here?
LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-2.0)
// If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves
doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollStopped, this));
return true;
// [/SL:KB]
}
bool completed = isFetchCompleted();
@ -1088,11 +1076,6 @@ void recovered_item_cb(const LLUUID& item_id, LLWearableType::EType type, LLView
{
// runway skip here?
LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-2.0)
// If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves
return;
// [/SL:KB]
}
LL_DEBUGS("Avatar") << self_av_string() << "Recovered item for type " << type << LL_ENDL;
@ -1143,32 +1126,19 @@ bool LLWearableHoldingPattern::isMissingCompleted()
return mTypesToLink.size()==0 && mTypesToRecover.size()==0;
}
//void LLWearableHoldingPattern::clearCOFLinksForMissingWearables()
//{
// for (found_list_t::iterator it = getFoundList().begin(); it != getFoundList().end(); ++it)
// {
// LLFoundData &data = *it;
// if ((data.mWearableType < LLWearableType::WT_COUNT) && (!data.mWearable))
// {
// // Wearable link that was never resolved; remove links to it from COF
// LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " removing link for unresolved item " << data.mItemID.asString() << LL_ENDL;
// LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID);
// }
// }
//}
// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-2.0)
bool LLWearableHoldingPattern::pollStopped()
void LLWearableHoldingPattern::clearCOFLinksForMissingWearables()
{
// We have to keep on polling until we're sure that all callbacks have completed or they'll cause a crash
if ( (isFetchCompleted()) && (isMissingCompleted()) )
for (found_list_t::iterator it = getFoundList().begin(); it != getFoundList().end(); ++it)
{
delete this;
return true;
LLFoundData &data = *it;
if ((data.mWearableType < LLWearableType::WT_COUNT) && (!data.mWearable))
{
// Wearable link that was never resolved; remove links to it from COF
LL_INFOS("Avatar") << self_av_string() << "HP " << index() << " removing link for unresolved item " << data.mItemID.asString() << LL_ENDL;
LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID);
}
}
return false;
}
// [/SL:KB]
bool LLWearableHoldingPattern::pollMissingWearables()
{
@ -1176,12 +1146,6 @@ bool LLWearableHoldingPattern::pollMissingWearables()
{
// runway skip here?
LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-2.0)
// If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves
doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollStopped, this));
return true;
// [/SL:KB]
}
bool timed_out = isTimedOut();
@ -2889,72 +2853,6 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
<< " descendent_count " << cof->getDescendentCount()
<< " viewer desc count " << cof->getViewerDescendentCount() << LL_ENDL;
}
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-2.2
// Update attachments to match those requested.
if (isAgentAvatarValid())
{
// Include attachments which should be in COF but don't have their link created yet
std::set<LLUUID> pendingAttachments;
if (LLAttachmentsMgr::instance().getPendingAttachments(pendingAttachments))
{
for (const LLUUID& idAttachItem : pendingAttachments)
{
if ( (!gAgentAvatarp->isWearingAttachment(idAttachItem)) || (isLinkedInCOF(idAttachItem)) )
{
LLAttachmentsMgr::instance().clearPendingAttachmentLink(idAttachItem);
continue;
}
LLViewerInventoryItem* pAttachItem = gInventory.getItem(idAttachItem);
if (pAttachItem)
{
obj_items.push_back(pAttachItem);
}
}
}
// (Start of LL code from LLWearableHoldingPattern::onAllComplete())
LL_DEBUGS("Avatar") << self_av_string() << "Updating " << obj_items.size() << " attachments" << LL_ENDL;
LLAgentWearables::llvo_vec_t objects_to_remove;
LLAgentWearables::llvo_vec_t objects_to_retain;
LLInventoryModel::item_array_t items_to_add;
LLAgentWearables::findAttachmentsAddRemoveInfo(obj_items, objects_to_remove, objects_to_retain, items_to_add);
// Here we remove the attachment pos overrides for *all*
// attachments, even those that are not being removed. This is
// needed to get joint positions all slammed down to their
// pre-attachment states.
gAgentAvatarp->clearAttachmentOverrides();
// (End of LL code)
// Take off the attachments that will no longer be in the outfit.
// (but don't remove attachments until avatar is fully loaded - should reduce random attaching/detaching/reattaching at log-on)
if (gAgentAvatarp->isFullyLoaded())
{
LL_DEBUGS("Avatar") << self_av_string() << "Removing " << objects_to_remove.size() << " attachments" << LL_ENDL;
LLAgentWearables::userRemoveMultipleAttachments(objects_to_remove);
}
// (Start of LL code from LLWearableHoldingPattern::onAllComplete())
// Restore attachment pos overrides for the attachments that are remaining in the outfit.
for (LLAgentWearables::llvo_vec_t::iterator it = objects_to_retain.begin(); it != objects_to_retain.end(); ++it)
{
LLViewerObject *objectp = *it;
if (!objectp->isAnimatedObject())
{
gAgentAvatarp->addAttachmentOverridesForObject(objectp);
}
}
// Add new attachments to match those requested.
LL_DEBUGS("Avatar") << self_av_string() << "Adding " << items_to_add.size() << " attachments" << LL_ENDL;
LLAgentWearables::userAttachMultipleAttachments(items_to_add);
// (End of LL code)
}
// [/SL:KB]
if(!wear_items.size())
{
LLNotificationsUtil::add("CouldNotPutOnOutfit");
@ -2969,7 +2867,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
LLTimer hp_block_timer;
LLWearableHoldingPattern* holder = new LLWearableHoldingPattern;
// holder->setObjItems(obj_items);
holder->setObjItems(obj_items);
holder->setGestItems(gest_items);
// Note: can't do normal iteration, because if all the
@ -4692,9 +4590,6 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove, LLP
if (!cb)
cb = new LLUpdateAppearanceOnDestroy();
removeCOFItemLinks(linked_item_id, cb, immediate_delete);
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-3.7
LLAttachmentsMgr::instance().clearPendingAttachmentLink(linked_item_id);
// [/SL:KB]
addDoomedTempAttachment(linked_item_id);
}
// [/RLVa:KB]

View File

@ -153,9 +153,6 @@ public:
// Attachment link management
void unregisterAttachment(const LLUUID& item_id);
void registerAttachment(const LLUUID& item_id);
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-3.7
bool getAttachmentInvLinkEnable() { return mAttachmentInvLinkEnabled; }
// [/SL:KB]
void setAttachmentInvLinkEnable(bool val);
// Add COF link to individual item.

View File

@ -46,31 +46,10 @@ const F32 MAX_ATTACHMENT_REQUEST_LIFETIME = 30.0F;
const F32 MIN_RETRY_REQUEST_TIME = 5.0F;
const F32 MAX_BAD_COF_TIME = 30.0F;
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-3.7
class LLRegisterAttachmentCallback : public LLRequestServerAppearanceUpdateOnDestroy
{
public:
LLRegisterAttachmentCallback()
: LLRequestServerAppearanceUpdateOnDestroy()
{
}
~LLRegisterAttachmentCallback() override
{
}
void fire(const LLUUID& idItem) override
{
LLAttachmentsMgr::instance().onRegisterAttachmentComplete(idItem);
LLRequestServerAppearanceUpdateOnDestroy::fire(idItem);
}
};
// [/SL:KB]
LLAttachmentsMgr::LLAttachmentsMgr():
mAttachmentRequests("attach",MIN_RETRY_REQUEST_TIME),
mDetachRequests("detach",MIN_RETRY_REQUEST_TIME)
// , mQuestionableCOFLinks("badcof",MAX_BAD_COF_TIME)
mDetachRequests("detach",MIN_RETRY_REQUEST_TIME),
mQuestionableCOFLinks("badcof",MAX_BAD_COF_TIME)
{
}
@ -130,11 +109,6 @@ void LLAttachmentsMgr::addAttachmentRequest(const LLUUID& item_id,
void LLAttachmentsMgr::onAttachmentRequested(const LLUUID& item_id)
{
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-3.7
if (item_id.isNull())
return;
// [/SL:KB]
LLViewerInventoryItem *item = gInventory.getItem(item_id);
LL_DEBUGS("Avatar") << "ATT attachment was requested "
<< (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
@ -168,7 +142,7 @@ void LLAttachmentsMgr::onIdle()
expireOldDetachRequests();
//checkInvalidCOFLinks();
checkInvalidCOFLinks();
spamStatusInfo();
}
@ -280,13 +254,6 @@ void LLAttachmentsMgr::linkRecentlyArrivedAttachments()
{
if (mRecentlyArrivedAttachments.size())
{
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-3.7
if (!LLAppearanceMgr::instance().getAttachmentInvLinkEnable())
{
return;
}
// [/SL:KB]
// One or more attachments have arrived but have not yet been
// processed for COF links
if (mAttachmentRequests.empty())
@ -333,68 +300,17 @@ void LLAttachmentsMgr::linkRecentlyArrivedAttachments()
}
if (ids_to_link.size())
{
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-3.7
LLPointer<LLInventoryCallback> cb = NULL;
for (uuid_vec_t::const_iterator itAttach = ids_to_link.begin(); itAttach != ids_to_link.end(); ++itAttach)
{
const LLUUID& idAttach = *itAttach;
if (std::find(mPendingAttachLinks.begin(), mPendingAttachLinks.end(), idAttach) == mPendingAttachLinks.end())
{
if (cb.isNull())
{
cb = new LLRegisterAttachmentCallback();
}
LLAppearanceMgr::instance().addCOFItemLink(idAttach, cb);
mPendingAttachLinks.insert(idAttach);
}
}
// [/SL:KB]
// LLPointer<LLInventoryCallback> cb = new LLRequestServerAppearanceUpdateOnDestroy();
// for (uuid_vec_t::const_iterator uuid_it = ids_to_link.begin();
// uuid_it != ids_to_link.end(); ++uuid_it)
// {
// LLAppearanceMgr::instance().addCOFItemLink(*uuid_it, cb);
// }
LLPointer<LLInventoryCallback> cb = new LLRequestServerAppearanceUpdateOnDestroy();
for (uuid_vec_t::const_iterator uuid_it = ids_to_link.begin();
uuid_it != ids_to_link.end(); ++uuid_it)
{
LLAppearanceMgr::instance().addCOFItemLink(*uuid_it, cb);
}
}
mRecentlyArrivedAttachments.clear();
}
}
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-2.2
bool LLAttachmentsMgr::getPendingAttachments(std::set<LLUUID>& ids) const
{
ids.clear();
// Returns the union of the LL maintained list of attachments that are waiting for link creation and our maintained list of attachments that are pending link creation
set_union(mRecentlyArrivedAttachments.begin(), mRecentlyArrivedAttachments.end(), mPendingAttachLinks.begin(), mPendingAttachLinks.end(), std::inserter(ids, ids.begin()));
return !ids.empty();
}
void LLAttachmentsMgr::clearPendingAttachmentLink(const LLUUID& idItem)
{
mPendingAttachLinks.erase(idItem);
}
void LLAttachmentsMgr::onRegisterAttachmentComplete(const LLUUID& idAttachLink)
{
const LLViewerInventoryItem* pAttachLink = gInventory.getItem(idAttachLink);
if (!pAttachLink)
return;
const LLUUID& idAttachBase = pAttachLink->getLinkedUUID();
// Remove the attachment from the pending list
clearPendingAttachmentLink(idAttachBase);
// It may have been detached already in which case we should remove the COF link
if ( (isAgentAvatarValid()) && (!gAgentAvatarp->isWearingAttachment(idAttachBase)) )
{
LLAppearanceMgr::instance().removeCOFItemLinks(idAttachBase, NULL, true);
}
}
// [/SL:KB]
LLAttachmentsMgr::LLItemRequestTimes::LLItemRequestTimes(const std::string& op_name, F32 timeout):
mOpName(op_name),
mTimeout(timeout)
@ -523,11 +439,6 @@ void LLAttachmentsMgr::onDetachRequested(const LLUUID& inv_item_id)
void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id)
{
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-2.2
// (mRecentlyArrivedAttachments doesn't need pruning since it'll check the attachment is actually worn before linking)
clearPendingAttachmentLink(inv_item_id);
// [/SL:KB]
LLTimer timer;
LLInventoryItem *item = gInventory.getItem(inv_item_id);
if (mDetachRequests.getTime(inv_item_id, timer))
@ -550,25 +461,18 @@ void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id)
LL_DEBUGS("Avatar") << "ATT detach on shutdown for " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL;
}
// LL_DEBUGS("Avatar") << "ATT detached item flagging as questionable for COF link checking "
// << (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL;
// mQuestionableCOFLinks.addTime(inv_item_id);
LL_DEBUGS("Avatar") << "ATT detached item flagging as questionable for COF link checking "
<< (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL;
mQuestionableCOFLinks.addTime(inv_item_id);
}
bool LLAttachmentsMgr::isAttachmentStateComplete() const
{
// [SL:KB] - Patch: Appearance-Misc | Checked: Catznip-4.3
return mPendingAttachments.empty()
&& mAttachmentRequests.empty()
&& mDetachRequests.empty()
&& mRecentlyArrivedAttachments.empty()
&& mPendingAttachLinks.empty();
// [/SL:KB]
// return mPendingAttachments.empty()
// && mAttachmentRequests.empty()
// && mDetachRequests.empty()
// && mRecentlyArrivedAttachments.empty()
// && mQuestionableCOFLinks.empty();
return mPendingAttachments.empty()
&& mAttachmentRequests.empty()
&& mDetachRequests.empty()
&& mRecentlyArrivedAttachments.empty()
&& mQuestionableCOFLinks.empty();
}
// Check for attachments that are (a) linked in COF and (b) not
@ -591,58 +495,58 @@ bool LLAttachmentsMgr::isAttachmentStateComplete() const
//
// See related: MAINT-5070, MAINT-4409
//
//void LLAttachmentsMgr::checkInvalidCOFLinks()
//{
// if (!gInventory.isInventoryUsable())
// {
// return;
// }
// LLInventoryModel::cat_array_t cat_array;
// LLInventoryModel::item_array_t item_array;
// gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(),
// cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH);
// for (S32 i=0; i<item_array.size(); i++)
// {
// const LLViewerInventoryItem* inv_item = item_array.at(i).get();
// const LLUUID& item_id = inv_item->getLinkedUUID();
// if (inv_item->getType() == LLAssetType::AT_OBJECT)
// {
// LLTimer timer;
// bool is_flagged_questionable = mQuestionableCOFLinks.getTime(item_id,timer);
// bool is_wearing_attachment = isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item_id);
// if (is_wearing_attachment && is_flagged_questionable)
// {
// LL_DEBUGS("Avatar") << "ATT was flagged questionable but is now "
// << (is_wearing_attachment ? "attached " : "")
// <<"removing flag after "
// << timer.getElapsedTimeF32() << " item "
// << inv_item->getName() << " id " << item_id << LL_ENDL;
// mQuestionableCOFLinks.removeTime(item_id);
// }
// }
// }
void LLAttachmentsMgr::checkInvalidCOFLinks()
{
if (!gInventory.isInventoryUsable())
{
return;
}
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t item_array;
gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(),
cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH);
for (S32 i=0; i<item_array.size(); i++)
{
const LLViewerInventoryItem* inv_item = item_array.at(i).get();
const LLUUID& item_id = inv_item->getLinkedUUID();
if (inv_item->getType() == LLAssetType::AT_OBJECT)
{
LLTimer timer;
bool is_flagged_questionable = mQuestionableCOFLinks.getTime(item_id,timer);
bool is_wearing_attachment = isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item_id);
if (is_wearing_attachment && is_flagged_questionable)
{
LL_DEBUGS("Avatar") << "ATT was flagged questionable but is now "
<< (is_wearing_attachment ? "attached " : "")
<<"removing flag after "
<< timer.getElapsedTimeF32() << " item "
<< inv_item->getName() << " id " << item_id << LL_ENDL;
mQuestionableCOFLinks.removeTime(item_id);
}
}
}
// for(LLItemRequestTimes::iterator it = mQuestionableCOFLinks.begin();
// it != mQuestionableCOFLinks.end(); )
// {
// LLItemRequestTimes::iterator curr_it = it;
// ++it;
// const LLUUID& item_id = curr_it->first;
// LLViewerInventoryItem *inv_item = gInventory.getItem(item_id);
// if (curr_it->second.getElapsedTimeF32() > MAX_BAD_COF_TIME)
// {
// if (LLAppearanceMgr::instance().isLinkedInCOF(item_id))
// {
// LL_DEBUGS("Avatar") << "ATT Linked in COF but not attached or requested, deleting link after "
// << curr_it->second.getElapsedTimeF32() << " seconds for "
// << (inv_item ? inv_item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
// LLAppearanceMgr::instance().removeCOFItemLinks(item_id);
// }
// mQuestionableCOFLinks.erase(curr_it);
// continue;
// }
// }
//}
for(LLItemRequestTimes::iterator it = mQuestionableCOFLinks.begin();
it != mQuestionableCOFLinks.end(); )
{
LLItemRequestTimes::iterator curr_it = it;
++it;
const LLUUID& item_id = curr_it->first;
LLViewerInventoryItem *inv_item = gInventory.getItem(item_id);
if (curr_it->second.getElapsedTimeF32() > MAX_BAD_COF_TIME)
{
if (LLAppearanceMgr::instance().isLinkedInCOF(item_id))
{
LL_DEBUGS("Avatar") << "ATT Linked in COF but not attached or requested, deleting link after "
<< curr_it->second.getElapsedTimeF32() << " seconds for "
<< (inv_item ? inv_item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
LLAppearanceMgr::instance().removeCOFItemLinks(item_id);
}
mQuestionableCOFLinks.erase(curr_it);
continue;
}
}
}
void LLAttachmentsMgr::spamStatusInfo()
{

View File

@ -92,15 +92,8 @@ public:
bool isAttachmentStateComplete() const;
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-2.1
public:
void clearPendingAttachmentLink(const LLUUID& idItem);
bool getPendingAttachments(std::set<LLUUID>& ids) const;
void refreshAttachments();
protected:
void onRegisterAttachmentComplete(const LLUUID& idAttachLink);
friend class LLRegisterAttachmentCallback;
// [/SL:KB]
// [SL:KB] - Patch: Appearance-PhantomAttach | Checked: Catznip-5.0
void refreshAttachments();
private:
@ -124,7 +117,7 @@ private:
void linkRecentlyArrivedAttachments();
void expireOldAttachmentRequests();
void expireOldDetachRequests();
// void checkInvalidCOFLinks();
void checkInvalidCOFLinks();
void spamStatusInfo();
// Attachments that we are planning to rez but haven't requested from the server yet.
@ -140,13 +133,8 @@ private:
std::set<LLUUID> mRecentlyArrivedAttachments;
LLTimer mCOFLinkBatchTimer;
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-2.1
// Attachments that have pending link creation
std::set<LLUUID> mPendingAttachLinks;
// [/SL:KB]
// // Attachments that are linked in the COF but may be invalid.
// LLItemRequestTimes mQuestionableCOFLinks;
// Attachments that are linked in the COF but may be invalid.
LLItemRequestTimes mQuestionableCOFLinks;
};
#endif

View File

@ -3102,8 +3102,7 @@ void LLSelectMgr::logNoOp(LLSelectNode* node, void *)
// static
void LLSelectMgr::logAttachmentRequest(LLSelectNode* node, void *)
{
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-3.7
// LLAttachmentsMgr::instance().onAttachmentRequested(node->mItemID);
LLAttachmentsMgr::instance().onAttachmentRequested(node->mItemID);
}
// static

View File

@ -9286,11 +9286,7 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading)
BOOL LLVOAvatar::isFullyLoaded() const
{
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: Catznip-2.2
// Changes to LLAppearanceMgr::updateAppearanceFromCOF() expect this function to actually return mFullyLoaded for gAgentAvatarp
return (mRenderUnloadedAvatar && !isSelf()) ||(mFullyLoaded);
// [/SL:KB]
// return (mRenderUnloadedAvatar || mFullyLoaded);
return (mRenderUnloadedAvatar || mFullyLoaded);
}
bool LLVOAvatar::isTooComplex() const