From 5dea0791f7087f2ce2bbe2bdce49d62f1a6f1f92 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 18 Nov 2009 14:51:14 -0500 Subject: EXT-2581 : Old items still display as "(worn)" even after I change outfits Added gInventory.notifyObservers to idle callbacks so it gets triggered without explicit notifyObservers synchronization. Added more state tracking for attachments, wearables, and links of those types, so that they're marked as changed properly. --- indra/newview/llappearancemgr.cpp | 51 ++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 60c6061e96..d6265a85f6 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -579,7 +579,6 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, if(wearables.count() > 0) { gAgentWearables.setWearableOutfit(items, wearables, !append); - gInventory.notifyObservers(); } delete holder; @@ -819,15 +818,23 @@ bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventor (a->getWearableType() == b->getWearableType())); } -void LLAppearanceManager::addItemLink( LLInventoryItem* item, bool do_update ) +void LLAppearanceManager::addCOFItemLink(const LLUUID &item_id, bool do_update ) { - LLViewerInventoryItem *vitem = dynamic_cast(item); + const LLInventoryItem *item = gInventory.getItem(item_id); + addCOFItemLink(item); +} + +void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_update ) +{ + const LLViewerInventoryItem *vitem = dynamic_cast(item); if (!vitem) { llwarns << "not an llviewerinventoryitem, failed" << llendl; return; } - + + gInventory.addChangedMask(LLInventoryObserver::LABEL, vitem->getLinkedUUID()); + LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(LLAppearanceManager::getCOF(), @@ -839,7 +846,7 @@ void LLAppearanceManager::addItemLink( LLInventoryItem* item, bool do_update ) { // Are these links to the same object? const LLViewerInventoryItem* inv_item = item_array.get(i).get(); - if (inv_item->getLinkedUUID() == item->getLinkedUUID()) + if (inv_item->getLinkedUUID() == vitem->getLinkedUUID()) { linked_already = true; } @@ -850,7 +857,6 @@ void LLAppearanceManager::addItemLink( LLInventoryItem* item, bool do_update ) { gAgentWearables.removeWearable(inv_item->getWearableType(),true,0); gInventory.purgeObject(inv_item->getUUID()); - gInventory.notifyObservers(); } } if (linked_already) @@ -886,8 +892,10 @@ void LLAppearanceManager::addEnsembleLink( LLInventoryCategory* cat, bool do_upd #endif } -void LLAppearanceManager::removeItemLinks(const LLUUID& item_id, bool do_update) +void LLAppearanceManager::removeCOFItemLinks(const LLUUID& item_id, bool do_update) { + gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); + LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(LLAppearanceManager::getCOF(), @@ -899,7 +907,8 @@ void LLAppearanceManager::removeItemLinks(const LLUUID& item_id, bool do_update) const LLInventoryItem* item = item_array.get(i).get(); if (item->getLinkedUUID() == item_id) { - gInventory.purgeObject(item_array.get(i)->getUUID()); + const LLUUID& item_id = item_array.get(i)->getUUID(); + gInventory.purgeObject(item_id); } } if (do_update) @@ -978,18 +987,13 @@ void dumpAttachmentSet(const std::set& atts, const std::string& msg) void LLAppearanceManager::registerAttachment(const LLUUID& item_id) { mRegisteredAttachments.insert(item_id); + gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); //dumpAttachmentSet(mRegisteredAttachments,"after register:"); if (mAttachmentInvLinkEnabled) { - LLViewerInventoryItem *item = gInventory.getItem(item_id); - if (item) - { - //LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Adding attachment link:"); - LLAppearanceManager::addItemLink(item,false); // Add COF link for item. - gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); - gInventory.notifyObservers(); - } + //LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Adding attachment link:"); + LLAppearanceManager::addCOFItemLink(item_id, false); // Add COF link for item. } else { @@ -1000,15 +1004,14 @@ void LLAppearanceManager::registerAttachment(const LLUUID& item_id) void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id) { mRegisteredAttachments.erase(item_id); + gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); + //dumpAttachmentSet(mRegisteredAttachments,"after unregister:"); if (mAttachmentInvLinkEnabled) { //LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Removing attachment link:"); - LLAppearanceManager::removeItemLinks(item_id, false); - // BAP - needs to change for label to track link. - gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); - gInventory.notifyObservers(); + LLAppearanceManager::removeCOFItemLinks(item_id, false); } else { @@ -1023,13 +1026,7 @@ void LLAppearanceManager::linkRegisteredAttachments() ++it) { LLUUID item_id = *it; - LLViewerInventoryItem *item = gInventory.getItem(item_id); - if (item) - { - addItemLink(item, false); - gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); - gInventory.notifyObservers(); - } + addCOFItemLink(item_id, false); } mRegisteredAttachments.clear(); } -- cgit v1.2.3