Merge in select parts of https://bitbucket.org/Kitty_Barnett/rlva-development @ 1adfc2cd210c4cf3a8800b31915d363bfe47d045

This commit is contained in:
Shyotl
2015-06-26 20:59:31 -05:00
parent 4d61305095
commit a380161283
27 changed files with 714 additions and 334 deletions

View File

@@ -700,10 +700,11 @@ void LLWearableHoldingPattern::eraseTypeToRecover(LLWearableType::EType type)
mTypesToRecover.erase(type);
}
void LLWearableHoldingPattern::setObjItems(const LLInventoryModel::item_array_t& items)
{
mObjItems = items;
}
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-06-19 (Catznip-2.1)
//void LLWearableHoldingPattern::setObjItems(const LLInventoryModel::item_array_t& items)
//{
// mObjItems = items;
//}
void LLWearableHoldingPattern::setGestItems(const LLInventoryModel::item_array_t& items)
{
@@ -810,46 +811,46 @@ 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->clearAttachmentPosOverrides();
// 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->clearAttachmentPosOverrides();
//
// // 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);
// 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;
//gAgentAvatarp->addAttachmentPosOverridesForObject(objectp);
}
// // 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;
// gAgentAvatarp->addAttachmentPosOverridesForObject(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);
// // 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())
@@ -1484,7 +1485,10 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
{
LLUUID item_id = gAgentWearables.getWearableItemID(item_to_wear->getWearableType(),
wearable_count-1);
removeCOFItemLinks(item_id, cb);
// [SL:KB] - Patch: Appearance-AISFilter | Checked: 2015-05-02 (Catznip-3.7)
removeCOFItemLinks(item_id, NULL, true);
// [/SL:KB]
// removeCOFItemLinks(item_id, cb);
}
items_to_link.push_back(item_to_wear);
@@ -1991,35 +1995,6 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin
}
}
// [SL:KB] - Checked: 2010-04-24 (RLVa-1.2.0f) | Added: RLVa-1.2.0f
void LLAppearanceMgr::purgeItems(const LLInventoryModel::item_array_t& items)
{
for (LLInventoryModel::item_array_t::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem)
{
const LLViewerInventoryItem* pItem = *itItem;
if (pItem->getIsLinkType())
{
remove_inventory_object(pItem->getUUID(), NULL);
}
}
}
void LLAppearanceMgr::purgeItemsOfType(LLAssetType::EType asset_type)
{
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
gInventory.collectDescendents(getCOF(), cats, items, LLInventoryModel::EXCLUDE_TRASH);
for (LLInventoryModel::item_array_t::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem)
{
const LLInventoryItem* pItem = *itItem;
if ( (pItem->getIsLinkType()) && (asset_type == pItem->getType()) )
{
remove_inventory_object(pItem->getUUID(), NULL);
}
}
}
// [/SL:KB]
// Keep the last N wearables of each type. For viewer 2.0, N is 1 for
// both body parts and clothing items.
void LLAppearanceMgr::filterWearableItems(
@@ -2051,7 +2026,7 @@ void LLAppearanceMgr::filterWearableItems(
continue;
// S32 start_index = llmax(0,size-max_per_type);
// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-05-11 (Catznip-2.0)
S32 start_index = llmax(0, size - ((LLAssetType::AT_BODYPART == LLWearableType::getAssetType((LLWearableType::EType)i)) ? 1 : max_per_type));
S32 start_index = llmax(0, size - ((LLWearableType::getAllowMultiwear((LLWearableType::EType)i)) ? max_per_type : 1));
// [/SL:KB[
for (S32 j = start_index; j<size; j++)
{
@@ -2062,15 +2037,22 @@ void LLAppearanceMgr::filterWearableItems(
}
//void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
// [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0b) | Added: RLVa-1.2.0b
// [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0)
void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
{
LLInventoryModel::item_array_t body_items_new, wear_items_new, obj_items_new, gest_items_new;
getDescendentsOfAssetType(category, body_items_new, LLAssetType::AT_BODYPART, true);
getDescendentsOfAssetType(category, wear_items_new, LLAssetType::AT_CLOTHING, true);
getDescendentsOfAssetType(category, obj_items_new, LLAssetType::AT_OBJECT, true);
getDescendentsOfAssetType(category, gest_items_new, LLAssetType::AT_GESTURE, true);
LLViewerInventoryCategory *pcat = gInventory.getCategory(category);
if (!pcat)
{
LL_WARNS() << "no category found for id " << category << LL_ENDL;
return;
}
LL_INFOS("Avatar") << self_av_string() << "starting, cat '" << (pcat ? pcat->getName() : "[UNKNOWN]") << "'" << LL_ENDL;
LLInventoryModel::item_array_t body_items_new, wear_items_new, obj_items_new, gest_items_new;
getDescendentsOfAssetType(category, body_items_new, LLAssetType::AT_BODYPART);
getDescendentsOfAssetType(category, wear_items_new, LLAssetType::AT_CLOTHING);
getDescendentsOfAssetType(category, obj_items_new, LLAssetType::AT_OBJECT);
getDescendentsOfAssetType(category, gest_items_new, LLAssetType::AT_GESTURE);
updateCOF(body_items_new, wear_items_new, obj_items_new, gest_items_new, append, category);
}
@@ -2078,14 +2060,18 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
LLInventoryModel::item_array_t& wear_items_new,
LLInventoryModel::item_array_t& obj_items_new,
LLInventoryModel::item_array_t& gest_items_new,
bool append /*=false*/, const LLUUID& category /*=LLUUID::null*/)
bool append /*=false*/, const LLUUID& idOutfit /*=LLUUID::null*/, LLPointer<LLInventoryCallback> link_waiter /*= NULL*/)
// [/RLVa:KB]
{
// LLViewerInventoryCategory *pcat = gInventory.getCategory(category);
// if (!pcat)
// {
// LL_WARNS() << "no category found for id " << category << LL_ENDL;
// return;
// }
// LL_INFOS("Avatar") << self_av_string() << "starting, cat '" << (pcat ? pcat->getName() : "[UNKNOWN]") << "'" << LL_ENDL;
// [RLVa:KB] - Checked: 2010-03-26 (RLVa-1.2.0b) | Added: RLVa-1.2.0b
// RELEASE-RLVa: [SL-2.0.0] If pcat ever gets used for anything further down the beta we'll know about it
LL_INFOS() << "starting" << LL_ENDL;
// [RLVa:KB] - Checked: 2010-03-26 (RLVa-1.2.0)
LL_INFOS("Avatar") << "starting" << LL_ENDL;
// [/RLVa:KB]
const LLUUID cof = getCOF();
@@ -2113,7 +2099,7 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
LLInventoryModel::item_array_t body_items;
getDescendentsOfAssetType(cof, body_items, LLAssetType::AT_BODYPART);
// getDescendentsOfAssetType(category, body_items, LLAssetType::AT_BODYPART);
// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0b
// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0)
// Filter out any new body parts that can't be worn before adding them
if ( (rlv_handler_t::isEnabled()) && (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) )
body_items_new.erase(std::remove_if(body_items_new.begin(), body_items_new.end(), RlvPredCanNotWearItem(RLV_WEAR_REPLACE)), body_items_new.end());
@@ -2130,16 +2116,16 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
LLInventoryModel::item_array_t wear_items;
if (append)
getDescendentsOfAssetType(cof, wear_items, LLAssetType::AT_CLOTHING);
// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0b
// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0)
else if ( (rlv_handler_t::isEnabled()) && (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) )
{
// Make sure that all currently locked clothing layers remain in COF when replacing
getDescendentsOfAssetType(cof, wear_items, LLAssetType::AT_CLOTHING);
wear_items.erase(std::remove_if(wear_items.begin(), wear_items.end(), rlvPredCanRemoveItem), wear_items.end());
wear_items.erase(std::remove_if(wear_items.begin(), wear_items.end(), RlvPredCanRemoveItem()), wear_items.end());
}
// [/RLVa:KB]
// getDescendentsOfAssetType(category, wear_items, LLAssetType::AT_CLOTHING);
// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0b
// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0)
// Filter out any new wearables that can't be worn before adding them
if ( (rlv_handler_t::isEnabled()) && (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) )
wear_items_new.erase(std::remove_if(wear_items_new.begin(), wear_items_new.end(), RlvPredCanNotWearItem(RLV_WEAR)), wear_items_new.end());
@@ -2152,7 +2138,9 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
// [/SL:KB]
filterWearableItems(wear_items, 0, LLAgentWearables::MAX_CLOTHING_LAYERS);
//
// - Attachments: include COF contents only if appending.
//
LLInventoryModel::item_array_t obj_items;
if (append)
getDescendentsOfAssetType(cof, obj_items, LLAssetType::AT_OBJECT);
@@ -2161,11 +2149,11 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
{
// Make sure that all currently locked attachments remain in COF when replacing
getDescendentsOfAssetType(cof, obj_items, LLAssetType::AT_OBJECT);
obj_items.erase(std::remove_if(obj_items.begin(), obj_items.end(), rlvPredCanRemoveItem), obj_items.end());
obj_items.erase(std::remove_if(obj_items.begin(), obj_items.end(), RlvPredCanRemoveItem()), obj_items.end());
}
// [/RLVa:KB]
// getDescendentsOfAssetType(category, obj_items, LLAssetType::AT_OBJECT);
// [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0z) | Modified: RLVa-1.2.0b
// [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0)
// Filter out any new attachments that can't be worn before adding them
if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) )
obj_items_new.erase(std::remove_if(obj_items_new.begin(), obj_items_new.end(), RlvPredCanNotWearItem(RLV_WEAR)), obj_items_new.end());
@@ -2180,7 +2168,7 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
if (append)
getDescendentsOfAssetType(cof, gest_items, LLAssetType::AT_GESTURE);
// getDescendentsOfAssetType(category, gest_items, LLAssetType::AT_GESTURE);
// [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0z) | Added: RLVa-1.2.0b
// [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0)
gest_items.insert(gest_items.end(), gest_items_new.begin(), gest_items_new.end());
// [/RLVa:KB]
removeDuplicateItems(gest_items);
@@ -2198,7 +2186,11 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
// Will link all the above items.
// link_waiter enforce flags are false because we've already fixed everything up in updateCOF().
LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy(false,false);
// LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy(false,false);
// [RLVa:KB] Checked: 2015-05-05 (RLVa-1.4.12)
if (!link_waiter)
link_waiter = new LLUpdateAppearanceOnDestroy(false, false);
// [/RLVa:KB]
LLSD contents = LLSD::emptyArray();
for (LLInventoryModel::item_array_t::const_iterator it = all_items.begin();
@@ -2226,8 +2218,12 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
item_contents["type"] = LLAssetType::AT_LINK;
contents.append(item_contents);
}
const LLUUID& base_id = append ? getBaseOutfitUUID() : category;
LLViewerInventoryCategory *base_cat = gInventory.getCategory(base_id);
// const LLUUID& base_id = append ? getBaseOutfitUUID() : category;
// LLViewerInventoryCategory *base_cat = gInventory.getCategory(base_id);
// [RLVa:KB] - Checked: 2014-11-02 (RLVa-1.4.11)
const LLUUID& base_id = (append) ? getBaseOutfitUUID() : idOutfit;
LLViewerInventoryCategory* base_cat = (base_id.notNull()) ? gInventory.getCategory(base_id) : NULL;
// [/RLVa:KB]
if (base_cat)
{
LLSD base_contents;
@@ -2278,7 +2274,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder)
LLInventoryItem::item_array_t items;
std::vector< LLViewerWearable* > wearables;
wearables.reserve(32);
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0)
uuid_vec_t idsCurrent; LLInventoryModel::item_array_t itemsNew;
if (rlv_handler_t::isEnabled())
{
@@ -2300,7 +2296,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder)
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
if( item && (item->getAssetUUID() == wearable->getAssetID()) )
{
// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0g) | Modified: RLVa-1.2.0g
// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0)
// TODO-RLVa: [RLVa-1.2.1] This is fall-back code so if we don't ever trigger this code it can just be removed
// -> one way to trigger the assertion:
// 1) "Replace Outfit" on a folder with clothing and an attachment that goes @addoutfit=n
@@ -2321,7 +2317,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder)
// [/RLVa:KB]
items.push_back(item);
wearables.push_back(wearable);
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0)
if ( (rlv_handler_t::isEnabled()) && (gAgentWearables.areInitalWearablesLoaded()) )
{
// Remove the wearable from current item UUIDs if currently worn and requested, otherwise mark it as a new item
@@ -2337,7 +2333,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder)
}
}
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0)
if ( (rlv_handler_t::isEnabled()) && (gAgentWearables.areInitalWearablesLoaded()) )
{
// We need to report removals before additions or scripts will get confused
@@ -2491,14 +2487,18 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
{
//checking integrity of the COF in terms of ordering of wearables,
//checking and updating links' descriptions of wearables in the COF (before analyzed for "dirty" state)
// [SL:KB] - Patch: Appearance-AISFilter | Checked: 2015-03-01 (Catznip-3.7)
// Ordering information is pre-applied locally so no reason to reason to wait on the inventory backend
updateClothingOrderingInfo(LLUUID::null);
// [/SL:KB]
// As with enforce_item_restrictions handling above, we want
// to wait for the update callbacks, then (finally!) call
// updateAppearanceFromCOF() with no additional COF munging needed.
LLPointer<LLInventoryCallback> cb(
new LLUpdateAppearanceOnDestroy(false, false, post_update_func));
updateClothingOrderingInfo(LLUUID::null, cb);
return;
// // As with enforce_item_restrictions handling above, we want
// // to wait for the update callbacks, then (finally!) call
// // updateAppearanceFromCOF() with no additional COF munging needed.
// LLPointer<LLInventoryCallback> cb(
// new LLUpdateAppearanceOnDestroy(false, false, post_update_func));
// updateClothingOrderingInfo(LLUUID::null, cb);
// return;
}
if (!validateClothingOrderingInfo())
@@ -2536,7 +2536,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
removeDuplicateItems(wear_items);
removeDuplicateItems(obj_items);
removeDuplicateItems(gest_items);
filterWearableItems(wear_items, 0, LLAgentWearables::MAX_CLOTHING_LAYERS);
filterWearableItems(wear_items, LLAgentWearables::MAX_CLOTHING_LAYERS, LLAgentWearables::MAX_CLOTHING_LAYERS);
// [/SL:KB]
// [SL:KB] - Patch: Appearance-WearableDuplicateAssets | Checked: 2011-07-24 (Catznip-2.6.0e) | Added: Catznip-2.6.0e
// Wearing two wearables that share the same asset causes some issues
@@ -2553,6 +2553,65 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
<< " descendent_count " << cof->getDescendentCount()
<< " viewer desc count " << cof->getViewerDescendentCount() << LL_ENDL;
}
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (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
uuid_vec_t::iterator itPendingAttachLink = mPendingAttachLinks.begin();
while (itPendingAttachLink != mPendingAttachLinks.end())
{
const LLUUID& idItem = *itPendingAttachLink;
if ( (!gAgentAvatarp->isWearingAttachment(idItem)) || (isLinkInCOF(idItem)) )
{
itPendingAttachLink = mPendingAttachLinks.erase(itPendingAttachLink);
continue;
}
LLViewerInventoryItem* pItem = gInventory.getItem(idItem);
if (pItem)
{
obj_items.push_back(pItem);
}
++itPendingAttachLink;
}
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->clearAttachmentPosOverrides();
// 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);
}
// 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;
gAgentAvatarp->addAttachmentPosOverridesForObject(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);
}
// [/SL:KB]
if(!wear_items.size())
{
LLNotificationsUtil::add("CouldNotPutOnOutfit");
@@ -2567,7 +2626,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
@@ -2584,7 +2643,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
// fetch failures (should be replaced by new defaults in
// lost&found).
U32 skip_type = gSavedSettings.getU32("ForceAssetFail");
// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c
// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2)
U32 missing_type = gSavedSettings.getU32("ForceMissingType");
// [/RLVa:KB]
@@ -2597,7 +2656,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
linked_item->isWearableType() ? linked_item->getWearableType() : LLWearableType::WT_INVALID
);
// [RLVa:KB] - Checked: 2010-12-15 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c
// [RLVa:KB] - Checked: 2010-12-15 (RLVa-1.2.2)
#ifdef LL_RELEASE_FOR_DOWNLOAD
// Don't allow forcing an invalid wearable if the initial wearables aren't set yet, or if any wearable type is currently locked
if ( (!rlv_handler_t::isEnabled()) ||
@@ -2609,11 +2668,11 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions,
continue;
}
// [/RLVa:KB]
if (skip_type != LLWearableType::WT_INVALID && skip_type == found.mWearableType)
{
found.mAssetID.generate(); // Replace with new UUID, guaranteed not to exist in DB
}
// [RLVa:KB] - Checked: 2010-12-15 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c
if (skip_type != LLWearableType::WT_INVALID && skip_type == found.mWearableType)
{
found.mAssetID.generate(); // Replace with new UUID, guaranteed not to exist in DB
}
// [RLVa:KB] - Checked: 2010-12-15 (RLVa-1.2.2)
}
// [/RLVa:KB]
//pushing back, not front, to preserve order of wearables for LLAgentWearables
@@ -2981,13 +3040,6 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item,
{
linked_already = true;
}
// [SL:KB] - Patch: Appearance-WearableDuplicateAssets | Checked: 2011-07-24 (Catznip-2.6.0e) | Added: Catznip-2.6.0e
else if (inv_item->getAssetUUID() == vitem->getAssetUUID())
{
// Only allow one wearable per unique asset
linked_already = true;
}
// [/SL:KB]
// Are these links to different items of the same body part
// type? If so, new item will replace old.
else if ((vitem->isWearableType()) && (vitem->getWearableType() == wearable_type))
@@ -2997,6 +3049,13 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item,
// MULTI-WEARABLES: make sure we don't go over clothing limits
remove_id = inv_item->getUUID();
}
// [SL:KB] - Patch: Appearance-WearableDuplicateAssets | Checked: 2011-07-24 (Catznip-2.6.0e) | Added: Catznip-2.6.0e
else if (inv_item->getAssetUUID() == vitem->getAssetUUID())
{
// Only allow one wearable per unique asset
linked_already = true;
}
// [/SL:KB]
}
}
@@ -3100,7 +3159,10 @@ void LLAppearanceMgr::removeAllAttachmentsFromAvatar()
removeItemsFromAvatar(ids_to_remove);
}
void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb)
//void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb)
// [SL:KB] - Patch: Appearance-AISFilter | Checked: 2015-05-02 (Catznip-3.7)
void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb, bool immediate_delete)
// [/SL:KB]
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
@@ -3112,14 +3174,20 @@ void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, LLPointer<LLInve
LLInventoryModel::EXCLUDE_TRASH);
for (U32 i=0; i<item_array.size(); i++)
{
const LLInventoryItem* item = item_array.at(i).get();
const LLViewerInventoryItem* item = item_array.at(i).get();
if (item->getIsLinkType() && item->getLinkedUUID() == item_id)
{
bool immediate_delete = false;
if (item->getType() == LLAssetType::AT_OBJECT)
// [RLVa:KB] - Checked: 2013-02-12 (RLVa-1.4.8)
if (rlv_handler_t::isEnabled())
{
immediate_delete = true;
RLV_ASSERT(rlvPredCanRemoveItem(item));
}
// [/RLVa:KB]
// bool immediate_delete = false;
// if (item->getType() == LLAssetType::AT_OBJECT)
// {
// immediate_delete = true;
// }
remove_inventory_item(item->getUUID(), cb, immediate_delete);
}
}
@@ -3138,6 +3206,12 @@ void LLAppearanceMgr::removeCOFLinksOfType(LLWearableType::EType type, LLPointer
const LLViewerInventoryItem* item = *it;
if (item->getIsLinkType()) // we must operate on links only
{
// [RLVa:KB] - Checked: 2013-02-12 (RLVa-1.4.8)
if (rlv_handler_t::isEnabled())
{
RLV_ASSERT(rlvPredCanRemoveItem(item));
}
// [/RLVa:KB]
remove_inventory_item(item->getUUID(), cb);
}
}
@@ -4393,41 +4467,82 @@ void LLAppearanceMgr::wearBaseOutfit()
updateCOF(base_outfit_id);
}
void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove)
//void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove)
// [SL:KB] - Patch: Appearance-Misc | Checked: 2015-05-05 (Catznip-3.7)
void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove, LLPointer<LLInventoryCallback> cb /*= NULL*/, bool immediate_delete /*= false*/)
// [/SL:KB]
{
if (ids_to_remove.empty())
{
LL_WARNS() << "called with empty list, nothing to do" << LL_ENDL;
return;
}
LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
// [RLVa:KB] - Checked: 2013-02-12 (RLVa-1.4.8)
// LLPointer<LLInventoryCallback> cb = NULL;
for (uuid_vec_t::const_iterator it = ids_to_remove.begin(); it != ids_to_remove.end(); ++it)
{
const LLUUID& id_to_remove = *it;
const LLUUID& linked_item_id = gInventory.getLinkedItemID(id_to_remove);
// [RLVa:KB] - Checked: 2013-02-12 (RLVa-1.4.8)
if ( (rlv_handler_t::isEnabled()) && (!rlvPredCanRemoveItem(gInventory.getItem(linked_item_id))) )
if ( (rlv_handler_t::isEnabled()) && (!rlvPredCanRemoveItem(linked_item_id)) )
{
continue;
}
// [/RLVa:KB]
removeCOFItemLinks(linked_item_id, cb);
if (!cb)
cb = new LLUpdateAppearanceOnDestroy();
removeCOFItemLinks(linked_item_id, cb, immediate_delete);
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2015-03-01 (Catznip-3.7)
clearPendingAttachment(linked_item_id);
// [/SL:KB]
addDoomedTempAttachment(linked_item_id);
}
// updateAppearanceFromCOF();
// [/RLVa:KB]
//// LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
//// [SL:KB] - Patch: Appearance-Misc | Checked: 2015-05-05 (Catznip-3.7)
// if (!cb)
// {
// cb = new LLUpdateAppearanceOnDestroy;
// }
//// [/SL:KB]
// for (uuid_vec_t::const_iterator it = ids_to_remove.begin(); it != ids_to_remove.end(); ++it)
// {
// const LLUUID& id_to_remove = *it;
// const LLUUID& linked_item_id = gInventory.getLinkedItemID(id_to_remove);
//// [SL:KB] - Patch: Appearance-Misc | Checked: 2015-05-05 (Catznip-3.7)
// removeCOFItemLinks(linked_item_id, cb, immediate_delete);
//// [/SL:KB]
//// removeCOFItemLinks(linked_item_id, cb);
// addDoomedTempAttachment(linked_item_id);
// }
}
void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove)
//void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove)
// [SL:KB] - Patch: Appearance-Misc | Checked: 2015-05-05 (Catznip-3.7)
void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove, LLPointer<LLInventoryCallback> cb /*= NULL*/, bool immediate_delete /*= false*/)
// [/SL:KB]
{
LLUUID linked_item_id = gInventory.getLinkedItemID(id_to_remove);
// [RLVa:KB] - Checked: 2013-02-12 (RLVa-1.4.8)
if ( (rlv_handler_t::isEnabled()) && (!rlvPredCanRemoveItem(gInventory.getItem(linked_item_id))) )
if ( (rlv_handler_t::isEnabled()) && (!rlvPredCanRemoveItem(linked_item_id)) )
{
return;
}
// [/RLVA:KB]
LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
removeCOFItemLinks(linked_item_id, cb);
// [SL:KB] - Patch: Appearance-Misc | Checked: 2015-05-05 (Catznip-3.7)
if (!cb)
{
cb = new LLUpdateAppearanceOnDestroy;
}
removeCOFItemLinks(linked_item_id, cb, immediate_delete);
// [/SL:KB]
// LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
// removeCOFItemLinks(linked_item_id, cb);
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2015-03-01 (Catznip-3.7)
clearPendingAttachment(linked_item_id);
// [/SL:KB]
addDoomedTempAttachment(linked_item_id);
}
@@ -4590,8 +4705,14 @@ LLAppearanceMgr::~LLAppearanceMgr()
void LLAppearanceMgr::setAttachmentInvLinkEnable(bool val)
{
LL_DEBUGS("Avatar") << "setAttachmentInvLinkEnable => " << (int)val << LL_ENDL;
LL_DEBUGS("Avatar") << "setAttachmentInvLinkEnable => " << (int) val << LL_ENDL;
mAttachmentInvLinkEnabled = val;
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-10-05 (Catznip-2.2)
if (mAttachmentInvLinkEnabled)
{
linkPendingAttachments();
}
// [/SL:KB]
}
void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg)
@@ -4614,6 +4735,13 @@ void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg)
void LLAppearanceMgr::registerAttachment(const LLUUID& item_id)
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-10-05 (Catznip-2.2)
if (isLinkInCOF(item_id))
{
return;
}
mPendingAttachLinks.push_back(item_id);
// [/SL:KB]
if (mAttachmentInvLinkEnabled)
{
@@ -4622,8 +4750,12 @@ void LLAppearanceMgr::registerAttachment(const LLUUID& item_id)
// But it is not acceptable solution. See EXT-7777
if (!isLinkedInCOF(item_id))
{
LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy();
LLAppearanceMgr::addCOFItemLink(item_id, cb); // Add COF link for item.
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-10-05 (Catznip-2.2)
LLPointer<LLInventoryCallback> cb = new LLRegisterAttachmentCallback(item_id);
LLAppearanceMgr::addCOFItemLink(item_id, cb); // Add COF link for item.
// [/SL:KB]
// LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy();
// LLAppearanceMgr::addCOFItemLink(item_id, cb); // Add COF link for item.
}
}
else
@@ -4635,6 +4767,9 @@ void LLAppearanceMgr::registerAttachment(const LLUUID& item_id)
void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id)
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-10-05 (Catznip-2.2)
clearPendingAttachment(item_id);
// [/SL:KB]
if (mAttachmentInvLinkEnabled)
{
@@ -4646,6 +4781,47 @@ void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id)
}
}
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-18 (Catznip-2.2)
void LLAppearanceMgr::linkPendingAttachments()
{
LLPointer<LLInventoryCallback> cb = NULL;
for (uuid_vec_t::const_iterator itPendingAttachLink = mPendingAttachLinks.begin(); itPendingAttachLink != mPendingAttachLinks.end(); ++itPendingAttachLink)
{
const LLUUID& idAttachItem = *itPendingAttachLink;
if ( (gAgentAvatarp->isWearingAttachment(idAttachItem)) && (!isLinkInCOF(idAttachItem)) )
{
// if (!cb)
// cb = new LLRegisterAttachmentCallback(idAttachItem);
// One LLInventoryCallback instance should handle multiple items but thanks to AIS we don't currently have access to the UUIDs of the new links
// so we need one instance per needed link - yay for progress
cb = new LLRegisterAttachmentCallback(idAttachItem);
LLAppearanceMgr::addCOFItemLink(idAttachItem, cb);
}
}
}
void LLAppearanceMgr::clearPendingAttachment(const LLUUID& idItem)
{
uuid_vec_t::iterator itPendingAttachLink = std::find(mPendingAttachLinks.begin(), mPendingAttachLinks.end(), idItem);
if (itPendingAttachLink != mPendingAttachLinks.end())
{
mPendingAttachLinks.erase(itPendingAttachLink);
}
}
void LLAppearanceMgr::onRegisterAttachmentComplete(const LLUUID& idAttachItem)
{
// Remove the attachment from the pending list
clearPendingAttachment(idAttachItem);
// It may have been detached already in which case we should remove the COF link
if ( (isAgentAvatarValid()) && (!gAgentAvatarp->isWearingAttachment(idAttachItem)) )
{
removeCOFItemLinks(idAttachItem);
}
}
// [/SL:KB]
BOOL LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const
{
const LLUUID& cof = getCOF();