summaryrefslogtreecommitdiff
path: root/indra/newview/llappearancemgr.cpp
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2015-07-15 14:59:32 +0300
committerandreykproductengine <akleshchev@productengine.com>2015-07-15 14:59:32 +0300
commite03c133750a09a2e83c49fafb4fb48307fca8a22 (patch)
treed9ae3c8d5fc31cd8a7887a2497be2b8556c5aaa0 /indra/newview/llappearancemgr.cpp
parentd43cef4ed5a012593ff31c4ef9c0356edbea5339 (diff)
parent02441157a0d22619ccf2a2ee735c8f5251b54fdb (diff)
Merge from viewer-relese and become version 3.8.2
Diffstat (limited to 'indra/newview/llappearancemgr.cpp')
-rwxr-xr-xindra/newview/llappearancemgr.cpp195
1 files changed, 130 insertions, 65 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 4016529092..142a3250c8 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -525,6 +525,15 @@ LLUpdateAppearanceAndEditWearableOnDestroy::LLUpdateAppearanceAndEditWearableOnD
{
}
+LLRequestServerAppearanceUpdateOnDestroy::~LLRequestServerAppearanceUpdateOnDestroy()
+{
+ LL_DEBUGS("Avatar") << "ATT requesting server appearance update" << LL_ENDL;
+ if (!LLApp::isExiting())
+ {
+ LLAppearanceMgr::instance().requestServerAppearanceUpdate();
+ }
+}
+
void edit_wearable_and_customize_avatar(LLUUID item_id)
{
// Start editing the item if previously requested.
@@ -828,6 +837,12 @@ void LLWearableHoldingPattern::onAllComplete()
// pre-attachment states.
gAgentAvatarp->clearAttachmentPosOverrides();
+ 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);
@@ -1356,28 +1371,46 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
const LLUUID& item_id_to_wear = *it;
- if (item_id_to_wear.isNull()) continue;
+ if (item_id_to_wear.isNull())
+ {
+ LL_DEBUGS("Avatar") << "null id " << item_id_to_wear << LL_ENDL;
+ continue;
+ }
LLViewerInventoryItem* item_to_wear = gInventory.getItem(item_id_to_wear);
- if (!item_to_wear) continue;
+ if (!item_to_wear)
+ {
+ LL_DEBUGS("Avatar") << "inventory item not found for id " << item_id_to_wear << LL_ENDL;
+ continue;
+ }
if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.getLibraryRootFolderID()))
{
+ LL_DEBUGS("Avatar") << "inventory item in library, will copy and wear "
+ << item_to_wear->getName() << " id " << item_id_to_wear << LL_ENDL;
LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(wear_on_avatar_cb,_1,replace));
- copy_inventory_item(gAgent.getID(), item_to_wear->getPermissions().getOwner(), item_to_wear->getUUID(), LLUUID::null, std::string(), cb);
+ copy_inventory_item(gAgent.getID(), item_to_wear->getPermissions().getOwner(),
+ item_to_wear->getUUID(), LLUUID::null, std::string(), cb);
continue;
}
else if (!gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.getRootFolderID()))
{
- continue; // not in library and not in agent's inventory
+ // not in library and not in agent's inventory
+ LL_DEBUGS("Avatar") << "inventory item not in user inventory or library, skipping "
+ << item_to_wear->getName() << " id " << item_id_to_wear << LL_ENDL;
+ continue;
}
else if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH)))
{
LLNotificationsUtil::add("CannotWearTrash");
+ LL_DEBUGS("Avatar") << "inventory item is in trash, skipping "
+ << item_to_wear->getName() << " id " << item_id_to_wear << LL_ENDL;
continue;
}
else if (isLinkedInCOF(item_to_wear->getUUID())) // EXT-84911
{
+ LL_DEBUGS("Avatar") << "inventory item is already in COF, skipping "
+ << item_to_wear->getName() << " id " << item_id_to_wear << LL_ENDL;
continue;
}
@@ -2721,28 +2754,23 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item,
LLInventoryModel::item_array_t LLAppearanceMgr::findCOFItemLinks(const LLUUID& item_id)
{
-
LLInventoryModel::item_array_t result;
- const LLViewerInventoryItem *vitem =
- dynamic_cast<const LLViewerInventoryItem*>(gInventory.getItem(item_id));
- if (vitem)
- {
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- gInventory.collectDescendents(LLAppearanceMgr::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();
- if (inv_item->getLinkedUUID() == vitem->getLinkedUUID())
- {
- result.push_back(item_array.at(i));
- }
- }
- }
+ LLUUID linked_id = gInventory.getLinkedItemID(item_id);
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ gInventory.collectDescendents(LLAppearanceMgr::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();
+ if (inv_item->getLinkedUUID() == linked_id)
+ {
+ result.push_back(item_array.at(i));
+ }
+ }
return result;
}
@@ -3319,7 +3347,7 @@ void RequestAgentUpdateAppearanceResponder::onRequestRequested()
}
// Actually send the request.
- LL_DEBUGS("Avatar") << "Will send request for cof_version " << cof_version << LL_ENDL;
+ LL_DEBUGS("Avatar") << "ATT sending bake request for cof_version " << cof_version << LL_ENDL;
mRetryPolicy->reset();
sendRequest();
}
@@ -3792,6 +3820,11 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove)
{
const LLUUID& id_to_remove = *it;
const LLUUID& linked_item_id = gInventory.getLinkedItemID(id_to_remove);
+ LLViewerInventoryItem *item = gInventory.getItem(linked_item_id);
+ if (item && item->getType() == LLAssetType::AT_OBJECT)
+ {
+ LL_DEBUGS("Avatar") << "ATT removing attachment " << item->getName() << " id " << item->getUUID() << LL_ENDL;
+ }
removeCOFItemLinks(linked_item_id, cb);
addDoomedTempAttachment(linked_item_id);
}
@@ -3799,10 +3832,9 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove)
void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove)
{
- LLUUID linked_item_id = gInventory.getLinkedItemID(id_to_remove);
- LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
- removeCOFItemLinks(linked_item_id, cb);
- addDoomedTempAttachment(linked_item_id);
+ uuid_vec_t ids_to_remove;
+ ids_to_remove.push_back(id_to_remove);
+ removeItemsFromAvatar(ids_to_remove);
}
@@ -3987,37 +4019,32 @@ void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg)
void LLAppearanceMgr::registerAttachment(const LLUUID& item_id)
{
- gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
-
- if (mAttachmentInvLinkEnabled)
- {
- // we have to pass do_update = true to call LLAppearanceMgr::updateAppearanceFromCOF.
- // it will trigger gAgentWariables.notifyLoadingFinished()
- // 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.
- }
- }
- else
- {
- //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL;
- }
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_DEBUGS("Avatar") << "ATT registering attachment "
+ << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
+
+ LLAttachmentsMgr::instance().onAttachmentArrived(item_id);
}
void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id)
{
- gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ LL_DEBUGS("Avatar") << "ATT unregistering attachment "
+ << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
- if (mAttachmentInvLinkEnabled)
- {
- LLAppearanceMgr::removeCOFItemLinks(item_id);
- }
- else
- {
- //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL;
- }
+ LLAttachmentsMgr::instance().onDetachCompleted(item_id);
+ if (mAttachmentInvLinkEnabled && isLinkedInCOF(item_id))
+ {
+ LL_DEBUGS("Avatar") << "ATT removing COF link for attachment "
+ << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL;
+ LLAppearanceMgr::removeCOFItemLinks(item_id);
+ }
+ else
+ {
+ //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL;
+ }
}
BOOL LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const
@@ -4031,14 +4058,6 @@ BOOL LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const
return FALSE;
}
-// static
-bool LLAppearanceMgr::isLinkInCOF(const LLUUID& obj_id)
-{
- const LLUUID& target_id = gInventory.getLinkedItemID(obj_id);
- LLLinkedItemIDMatches find_links(target_id);
- return gInventory.hasMatchingDirectDescendent(LLAppearanceMgr::instance().getCOF(), find_links);
-}
-
BOOL LLAppearanceMgr::getIsProtectedCOFItem(const LLUUID& obj_id) const
{
if (!getIsInCOF(obj_id)) return FALSE;
@@ -4157,10 +4176,56 @@ void callAfterCategoryFetch(const LLUUID& cat_id, nullary_func_t cb)
}
}
+void add_wearable_type_counts(const uuid_vec_t& ids,
+ S32& clothing_count,
+ S32& bodypart_count,
+ S32& object_count,
+ S32& other_count)
+{
+ for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ const LLUUID& item_id_to_wear = *it;
+ LLViewerInventoryItem* item_to_wear = gInventory.getItem(item_id_to_wear);
+ if (item_to_wear)
+ {
+ if (item_to_wear->getType() == LLAssetType::AT_CLOTHING)
+ {
+ clothing_count++;
+ }
+ else if (item_to_wear->getType() == LLAssetType::AT_BODYPART)
+ {
+ bodypart_count++;
+ }
+ else if (item_to_wear->getType() == LLAssetType::AT_OBJECT)
+ {
+ object_count++;
+ }
+ else
+ {
+ other_count++;
+ }
+ }
+ else
+ {
+ other_count++;
+ }
+ }
+}
+
void wear_multiple(const uuid_vec_t& ids, bool replace)
{
- LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy;
- LLAppearanceMgr::instance().wearItemsOnAvatar(ids, false, replace, cb);
+ S32 clothing_count = 0;
+ S32 bodypart_count = 0;
+ S32 object_count = 0;
+ S32 other_count = 0;
+ add_wearable_type_counts(ids, clothing_count, bodypart_count, object_count, other_count);
+
+ LLPointer<LLInventoryCallback> cb = NULL;
+ if (clothing_count > 0 || bodypart_count > 0)
+ {
+ cb = new LLUpdateAppearanceOnDestroy;
+ }
+ LLAppearanceMgr::instance().wearItemsOnAvatar(ids, true, replace, cb);
}
// SLapp for easy-wearing of a stock (library) avatar