From 4f3d32f5c726f0ec301e1efefa32ef948faea03e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 11 Nov 2009 18:23:54 -0500 Subject: Believe this fixes the remaining issues with missing attachment links on first use of 2.0 - EXT-1593 and EXT-1591. --- indra/newview/llappearancemgr.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d14de1c301..0901289dac 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1123,6 +1123,7 @@ void LLAppearanceManager::wearItem( LLInventoryItem* item, bool do_update ) { if (do_update) LLAppearanceManager::updateAppearanceFromCOF(); + return; } else { @@ -1134,6 +1135,7 @@ void LLAppearanceManager::wearItem( LLInventoryItem* item, bool do_update ) LLAssetType::AT_LINK, cb); } + return; } /* static */ @@ -1281,3 +1283,22 @@ void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id) //llinfos << "no link changes, inv link not enabled" << llendl; } } + +/* static */ +void LLAppearanceManager::linkRegisteredAttachments() +{ + for (std::set::iterator it = sRegisteredAttachments.begin(); + it != sRegisteredAttachments.end(); + ++it) + { + LLUUID item_id = *it; + LLViewerInventoryItem *item = gInventory.getItem(item_id); + if (item) + { + wearItem(item, false); + gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); + gInventory.notifyObservers(); + } + } + sRegisteredAttachments.clear(); +} -- cgit v1.2.3 From 0b104e2a418dc794ce7230ab30f472d1787cd9c4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 12 Nov 2009 15:10:06 -0500 Subject: LLAppearanceManager cleanup - turning into proper singleton --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 84 +++++++++++++++------------------------ 1 file changed, 33 insertions(+), 51 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 0901289dac..5f2d22d78c 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -72,7 +72,7 @@ protected: // If the inventory callback manager goes away, we're shutting down, no longer want the callback. if( LLInventoryCallbackManager::is_instantiated() ) { - LLAppearanceManager::wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); + LLAppearanceManager::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); } else { @@ -171,7 +171,7 @@ void LLOutfitObserver::done() else { // Wear the inventory category. - LLAppearanceManager::wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); + LLAppearanceManager::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); } } @@ -251,7 +251,7 @@ public: virtual ~LLUpdateAppearanceOnDestroy() { - LLAppearanceManager::updateAppearanceFromCOF(); + LLAppearanceManager::instance().updateAppearanceFromCOF(); } /* virtual */ void fire(const LLUUID& inv_item) @@ -296,7 +296,7 @@ struct LLWearableHoldingPattern bool append; }; -/* static */ void removeDuplicateItems(LLInventoryModel::item_array_t& items) +static void removeDuplicateItems(LLInventoryModel::item_array_t& items) { LLInventoryModel::item_array_t new_items; std::set items_seen; @@ -323,7 +323,7 @@ struct LLWearableHoldingPattern items = new_items; } -void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventoryModel::item_array_t& src) +static void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventoryModel::item_array_t& src) { LLInventoryModel::item_array_t new_dst; std::set mark_inventory; @@ -361,25 +361,23 @@ void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventory dst = new_dst; } -/* static */ LLUUID LLAppearanceManager::getCOF() { return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); } // Update appearance from outfit folder. -/* static */ void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, bool append) { if (!proceed) return; #if 1 - updateCOF(category,append); + LLAppearanceManager::instance().updateCOF(category,append); #else if (append) { - updateCOFFromCategory(category, append); // append is true - add non-duplicates to COF. + LLAppearanceManager::instance().updateCOFFromCategory(category, append); // append is true - add non-duplicates to COF. } else { @@ -387,18 +385,17 @@ void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, boo if (catp->getPreferredType() == LLFolderType::FT_NONE || LLFolderType::lookupIsEnsembleType(catp->getPreferredType())) { - updateCOFFromCategory(category, append); // append is false - rebuild COF. + LLAppearanceManager::instance().updateCOFFromCategory(category, append); // append is false - rebuild COF. } else if (catp->getPreferredType() == LLFolderType::FT_OUTFIT) { - rebuildCOFFromOutfit(category); + LLAppearanceManager::instance().rebuildCOFFromOutfit(category); } } #endif } // Append to current COF contents by recursively traversing a folder. -/* static */ void LLAppearanceManager::updateCOFFromCategory(const LLUUID& category, bool append) { // BAP consolidate into one "get all 3 types of descendents" function, use both places. @@ -491,7 +488,6 @@ void LLAppearanceManager::updateCOFFromCategory(const LLUUID& category, bool app } } -/* static */ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id, LLPointer cb) { @@ -535,7 +531,7 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID } } } -/* static */ void LLAppearanceManager::purgeCategory(const LLUUID& category, bool keep_outfit_links) +void LLAppearanceManager::purgeCategory(const LLUUID& category, bool keep_outfit_links) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; @@ -552,7 +548,7 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID // Keep the last N wearables of each type. For viewer 2.0, N is 1 for // both body parts and clothing items. -/* static */ void LLAppearanceManager::filterWearableItems( +void LLAppearanceManager::filterWearableItems( LLInventoryModel::item_array_t& items, S32 max_per_type) { // Divvy items into arrays by wearable type. @@ -583,8 +579,8 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID } // Create links to all listed items. -/* static */ void LLAppearanceManager::linkAll(const LLUUID& category, - LLInventoryModel::item_array_t& items, +void LLAppearanceManager::linkAll(const LLUUID& category, + LLInventoryModel::item_array_t& items, LLPointer cb) { for (S32 i=0; i& types_found) { LLInventoryModel::cat_array_t new_cats; @@ -693,7 +687,6 @@ void LLAppearanceManager::checkMandatoryWearableTypes(const LLUUID& category, st // with contents of new category. This means preserving any mandatory // body parts that aren't present in the new category, and getting rid // of everything else. -/* static */ void LLAppearanceManager::purgeCOFBeforeRebuild(const LLUUID& category) { // See which mandatory body types are present in the new category. @@ -726,7 +719,6 @@ void LLAppearanceManager::purgeCOFBeforeRebuild(const LLUUID& category) } // Replace COF contents from a given outfit folder. -/* static */ void LLAppearanceManager::rebuildCOFFromOutfit(const LLUUID& category) { lldebugs << "rebuildCOFFromOutfit()" << llendl; @@ -790,11 +782,10 @@ void LLAppearanceManager::onWearableAssetFetch(LLWearable* wearable, void* data) holder->mResolved += 1; if(holder->mResolved >= (S32)holder->mFoundList.size()) { - LLAppearanceManager::updateAgentWearables(holder, append); + LLAppearanceManager::instance().updateAgentWearables(holder, append); } } -/* static */ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append) { lldebugs << "updateAgentWearables()" << llendl; @@ -835,7 +826,6 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, // dec_busy_count(); } -/* static */ void LLAppearanceManager::updateAppearanceFromCOF() { dumpCat(getCOF(),"COF, start"); @@ -916,7 +906,6 @@ void LLAppearanceManager::updateAppearanceFromCOF() } } -/* static */ void LLAppearanceManager::getCOFValidDescendents(const LLUUID& category, LLInventoryModel::item_array_t& items) { @@ -931,7 +920,6 @@ void LLAppearanceManager::getCOFValidDescendents(const LLUUID& category, follow_folder_links); } -/* static */ void LLAppearanceManager::getDescendentsOfAssetType(const LLUUID& category, LLInventoryModel::item_array_t& items, LLAssetType::EType type, @@ -947,7 +935,6 @@ void LLAppearanceManager::getDescendentsOfAssetType(const LLUUID& category, follow_folder_links); } -/* static */ void LLAppearanceManager::getUserDescendents(const LLUUID& category, LLInventoryModel::item_array_t& wear_items, LLInventoryModel::item_array_t& obj_items, @@ -1011,7 +998,6 @@ void LLAppearanceManager::wearInventoryCategory(LLInventoryCategory* category, b } // *NOTE: hack to get from avatar inventory to avatar -/* static */ void LLAppearanceManager::wearInventoryCategoryOnAvatar( LLInventoryCategory* category, bool append ) { // Avoid unintentionally overwriting old wearables. We have to do @@ -1031,7 +1017,6 @@ void LLAppearanceManager::wearInventoryCategoryOnAvatar( LLInventoryCategory* ca } } -/* static */ void LLAppearanceManager::wearOutfitByName(const std::string& name) { llinfos << "Wearing category " << name << llendl; @@ -1084,7 +1069,7 @@ bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventor return (a->isWearableType() && b->isWearableType() && (a->getWearableType() == b->getWearableType())); } -/* static */ + void LLAppearanceManager::wearItem( LLInventoryItem* item, bool do_update ) { LLViewerInventoryItem *vitem = dynamic_cast(item); @@ -1138,7 +1123,6 @@ void LLAppearanceManager::wearItem( LLInventoryItem* item, bool do_update ) return; } -/* static */ void LLAppearanceManager::wearEnsemble( LLInventoryCategory* cat, bool do_update ) { #if SUPPORT_ENSEMBLES @@ -1153,7 +1137,6 @@ void LLAppearanceManager::wearEnsemble( LLInventoryCategory* cat, bool do_update #endif } -/* static */ void LLAppearanceManager::removeItemLinks(const LLUUID& item_id, bool do_update) { LLInventoryModel::cat_array_t cat_array; @@ -1178,7 +1161,6 @@ void LLAppearanceManager::removeItemLinks(const LLUUID& item_id, bool do_update) //#define DUMP_CAT_VERBOSE -/* static */ void LLAppearanceManager::dumpCat(const LLUUID& cat_id, const std::string& msg) { LLInventoryModel::cat_array_t cats; @@ -1200,7 +1182,6 @@ void LLAppearanceManager::dumpCat(const LLUUID& cat_id, const std::string& msg) llinfos << msg << " count " << items.count() << llendl; } -/* static */ void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& items, const std::string& msg) { @@ -1213,15 +1194,19 @@ void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& it llinfos << llendl; } +LLAppearanceManager::LLAppearanceManager(): + mAttachmentInvLinkEnabled(false) +{ +} -std::set LLAppearanceManager::sRegisteredAttachments; -bool LLAppearanceManager::sAttachmentInvLinkEnabled(false); +LLAppearanceManager::~LLAppearanceManager() +{ +} -/* static */ void LLAppearanceManager::setAttachmentInvLinkEnable(bool val) { llinfos << "setAttachmentInvLinkEnable => " << (int) val << llendl; - sAttachmentInvLinkEnabled = val; + mAttachmentInvLinkEnabled = val; } void dumpAttachmentSet(const std::set& atts, const std::string& msg) @@ -1241,13 +1226,12 @@ void dumpAttachmentSet(const std::set& atts, const std::string& msg) llinfos << llendl; } -/* static */ void LLAppearanceManager::registerAttachment(const LLUUID& item_id) { - sRegisteredAttachments.insert(item_id); - //dumpAttachmentSet(sRegisteredAttachments,"after register:"); + mRegisteredAttachments.insert(item_id); + //dumpAttachmentSet(mRegisteredAttachments,"after register:"); - if (sAttachmentInvLinkEnabled) + if (mAttachmentInvLinkEnabled) { LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item) @@ -1264,13 +1248,12 @@ void LLAppearanceManager::registerAttachment(const LLUUID& item_id) } } -/* static */ void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id) { - sRegisteredAttachments.erase(item_id); - //dumpAttachmentSet(sRegisteredAttachments,"after unregister:"); + mRegisteredAttachments.erase(item_id); + //dumpAttachmentSet(mRegisteredAttachments,"after unregister:"); - if (sAttachmentInvLinkEnabled) + if (mAttachmentInvLinkEnabled) { //LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Removing attachment link:"); LLAppearanceManager::removeItemLinks(item_id, false); @@ -1284,11 +1267,10 @@ void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id) } } -/* static */ void LLAppearanceManager::linkRegisteredAttachments() { - for (std::set::iterator it = sRegisteredAttachments.begin(); - it != sRegisteredAttachments.end(); + for (std::set::iterator it = mRegisteredAttachments.begin(); + it != mRegisteredAttachments.end(); ++it) { LLUUID item_id = *it; @@ -1300,5 +1282,5 @@ void LLAppearanceManager::linkRegisteredAttachments() gInventory.notifyObservers(); } } - sRegisteredAttachments.clear(); + mRegisteredAttachments.clear(); } -- cgit v1.2.3 From 315af3fb82574698078dce00236e2778d6ce9730 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 12 Nov 2009 16:03:59 -0500 Subject: LLAppearanceManager cleanup - no static at all --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 57 ++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 28 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 5f2d22d78c..9301a47e6e 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -361,6 +361,31 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLIn dst = new_dst; } +static void onWearableAssetFetch(LLWearable* wearable, void* data) +{ + LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data; + bool append = holder->append; + + if(wearable) + { + for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->mFoundList.begin(); + iter != holder->mFoundList.end(); ++iter) + { + LLFoundData* data = *iter; + if(wearable->getAssetID() == data->mAssetID) + { + data->mWearable = wearable; + break; + } + } + } + holder->mResolved += 1; + if(holder->mResolved >= (S32)holder->mFoundList.size()) + { + LLAppearanceManager::instance().updateAgentWearables(holder, append); + } +} + LLUUID LLAppearanceManager::getCOF() { return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); @@ -760,32 +785,6 @@ void LLAppearanceManager::rebuildCOFFromOutfit(const LLUUID& category) } } -/* static */ -void LLAppearanceManager::onWearableAssetFetch(LLWearable* wearable, void* data) -{ - LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data; - bool append = holder->append; - - if(wearable) - { - for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->mFoundList.begin(); - iter != holder->mFoundList.end(); ++iter) - { - LLFoundData* data = *iter; - if(wearable->getAssetID() == data->mAssetID) - { - data->mWearable = wearable; - break; - } - } - } - holder->mResolved += 1; - if(holder->mResolved >= (S32)holder->mFoundList.size()) - { - LLAppearanceManager::instance().updateAgentWearables(holder, append); - } -} - void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append) { lldebugs << "updateAgentWearables()" << llendl; @@ -893,7 +892,7 @@ void LLAppearanceManager::updateAppearanceFromCOF() LLWearableList::instance().getAsset(found->mAssetID, found->mName, found->mAssetType, - LLAppearanceManager::onWearableAssetFetch, + onWearableAssetFetch, (void*)holder); } } @@ -1009,7 +1008,9 @@ void LLAppearanceManager::wearInventoryCategoryOnAvatar( LLInventoryCategory* ca if( gFloaterCustomize ) { - gFloaterCustomize->askToSaveIfDirty(boost::bind(LLAppearanceManager::changeOutfit, _1, category->getUUID(), append)); + gFloaterCustomize->askToSaveIfDirty(boost::bind(&LLAppearanceManager::changeOutfit, + &LLAppearanceManager::instance(), + _1, category->getUUID(), append)); } else { -- cgit v1.2.3 From 56df94412b230d6cec7d253cc431e3a97d008f67 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 12 Nov 2009 17:20:53 -0500 Subject: LLAppearanceManager cleanup - removed dead code --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 233 +------------------------------------- 1 file changed, 1 insertion(+), 232 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 9301a47e6e..456eaa43c6 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -396,121 +396,7 @@ void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, boo { if (!proceed) return; - -#if 1 LLAppearanceManager::instance().updateCOF(category,append); -#else - if (append) - { - LLAppearanceManager::instance().updateCOFFromCategory(category, append); // append is true - add non-duplicates to COF. - } - else - { - LLViewerInventoryCategory* catp = gInventory.getCategory(category); - if (catp->getPreferredType() == LLFolderType::FT_NONE || - LLFolderType::lookupIsEnsembleType(catp->getPreferredType())) - { - LLAppearanceManager::instance().updateCOFFromCategory(category, append); // append is false - rebuild COF. - } - else if (catp->getPreferredType() == LLFolderType::FT_OUTFIT) - { - LLAppearanceManager::instance().rebuildCOFFromOutfit(category); - } - } -#endif -} - -// Append to current COF contents by recursively traversing a folder. -void LLAppearanceManager::updateCOFFromCategory(const LLUUID& category, bool append) -{ - // BAP consolidate into one "get all 3 types of descendents" function, use both places. - LLInventoryModel::item_array_t wear_items; - LLInventoryModel::item_array_t obj_items; - LLInventoryModel::item_array_t gest_items; - bool follow_folder_links = false; - getUserDescendents(category, wear_items, obj_items, gest_items, follow_folder_links); - - // Find all the wearables that are in the category's subtree. - lldebugs << "appendCOFFromCategory()" << llendl; - if( !wear_items.count() && !obj_items.count() && !gest_items.count()) - { - LLNotifications::instance().add("CouldNotPutOnOutfit"); - return; - } - - const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); - // Processes that take time should show the busy cursor - //inc_busy_count(); - - LLInventoryModel::cat_array_t cof_cats; - LLInventoryModel::item_array_t cof_items; - gInventory.collectDescendents(current_outfit_id, cof_cats, cof_items, - LLInventoryModel::EXCLUDE_TRASH); - // Remove duplicates - if (append) - { - removeDuplicateItems(wear_items, cof_items); - removeDuplicateItems(obj_items, cof_items); - removeDuplicateItems(gest_items, cof_items); - } - - S32 total_links = gest_items.count() + wear_items.count() + obj_items.count(); - - if (!append && total_links > 0) - { - purgeCOFBeforeRebuild(category); - } - - LLPointer link_waiter = new LLUpdateAppearanceOnDestroy; - - // Link all gestures in this folder - if (gest_items.count() > 0) - { - llinfos << "Linking " << gest_items.count() << " gestures" << llendl; - for (S32 i = 0; i < gest_items.count(); ++i) - { - const LLInventoryItem* gest_item = gest_items.get(i).get(); - link_inventory_item(gAgent.getID(), gest_item->getLinkedUUID(), current_outfit_id, - gest_item->getName(), - LLAssetType::AT_LINK, link_waiter); - } - } - - // Link all wearables - if(wear_items.count() > 0) - { - llinfos << "Linking " << wear_items.count() << " wearables" << llendl; - for(S32 i = 0; i < wear_items.count(); ++i) - { - // Populate the current outfit folder with links to the newly added wearables - const LLInventoryItem* wear_item = wear_items.get(i).get(); - link_inventory_item(gAgent.getID(), - wear_item->getLinkedUUID(), // If this item is a link, then we'll use the linked item's UUID. - current_outfit_id, - wear_item->getName(), - LLAssetType::AT_LINK, - link_waiter); - } - } - - // Link all attachments. - if( obj_items.count() > 0 ) - { - llinfos << "Linking " << obj_items.count() << " attachments" << llendl; - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( avatar ) - { - for(S32 i = 0; i < obj_items.count(); ++i) - { - const LLInventoryItem* obj_item = obj_items.get(i).get(); - link_inventory_item(gAgent.getID(), - obj_item->getLinkedUUID(), // If this item is a link, then we'll use the linked item's UUID. - current_outfit_id, - obj_item->getName(), - LLAssetType::AT_LINK, link_waiter); - } - } - } } void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id, @@ -556,6 +442,7 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID } } } + void LLAppearanceManager::purgeCategory(const LLUUID& category, bool keep_outfit_links) { LLInventoryModel::cat_array_t cats; @@ -681,110 +568,6 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) } -bool LLAppearanceManager::isMandatoryWearableType(EWearableType type) -{ - return (type==WT_SHAPE) || (type==WT_SKIN) || (type== WT_HAIR) || (type==WT_EYES); -} - -// For mandatory body parts. -void LLAppearanceManager::checkMandatoryWearableTypes(const LLUUID& category, std::set& types_found) -{ - LLInventoryModel::cat_array_t new_cats; - LLInventoryModel::item_array_t new_items; - gInventory.collectDescendents(category, new_cats, new_items, - LLInventoryModel::EXCLUDE_TRASH); - std::set wt_types_found; - for (S32 i = 0; i < new_items.count(); ++i) - { - LLViewerInventoryItem *itemp = new_items.get(i); - if (itemp->isWearableType()) - { - EWearableType type = itemp->getWearableType(); - if (isMandatoryWearableType(type)) - { - types_found.insert(type); - } - } - } -} - -// Remove everything from the COF that we safely can before replacing -// with contents of new category. This means preserving any mandatory -// body parts that aren't present in the new category, and getting rid -// of everything else. -void LLAppearanceManager::purgeCOFBeforeRebuild(const LLUUID& category) -{ - // See which mandatory body types are present in the new category. - std::set wt_types_found; - checkMandatoryWearableTypes(category,wt_types_found); - - LLInventoryModel::cat_array_t cof_cats; - LLInventoryModel::item_array_t cof_items; - gInventory.collectDescendents(getCOF(), cof_cats, cof_items, - LLInventoryModel::EXCLUDE_TRASH); - for (S32 i = 0; i < cof_items.count(); ++i) - { - LLViewerInventoryItem *itemp = cof_items.get(i); - if (itemp->isWearableType()) - { - EWearableType type = itemp->getWearableType(); - if (!isMandatoryWearableType(type) || (wt_types_found.find(type) != wt_types_found.end())) - { - // Not mandatory or supplied by the new category - OK to delete - gInventory.purgeObject(cof_items.get(i)->getUUID()); - } - } - else - { - // Not a wearable - always purge - gInventory.purgeObject(cof_items.get(i)->getUUID()); - } - } - gInventory.notifyObservers(); -} - -// Replace COF contents from a given outfit folder. -void LLAppearanceManager::rebuildCOFFromOutfit(const LLUUID& category) -{ - lldebugs << "rebuildCOFFromOutfit()" << llendl; - - dumpCat(category,"start, source outfit"); - dumpCat(getCOF(),"start, COF"); - - // Find all the wearables that are in the category's subtree. - LLInventoryModel::item_array_t items; - getCOFValidDescendents(category, items); - - if( items.count() == 0) - { - LLNotifications::instance().add("CouldNotPutOnOutfit"); - return; - } - - // Processes that take time should show the busy cursor - //inc_busy_count(); - - //dumpCat(current_outfit_id,"COF before remove:"); - - //dumpCat(current_outfit_id,"COF after remove:"); - - purgeCOFBeforeRebuild(category); - - LLPointer link_waiter = new LLUpdateAppearanceOnDestroy; - LLUUID current_outfit_id = getCOF(); - LLAppearanceManager::shallowCopyCategory(category, current_outfit_id, link_waiter); - - //dumpCat(current_outfit_id,"COF after shallow copy:"); - - // Create a link to the outfit that we wore. - LLViewerInventoryCategory* catp = gInventory.getCategory(category); - if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT) - { - link_inventory_item(gAgent.getID(), category, current_outfit_id, catp->getName(), - LLAssetType::AT_LINK_FOLDER, link_waiter); - } -} - void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append) { lldebugs << "updateAgentWearables()" << llendl; @@ -905,20 +688,6 @@ void LLAppearanceManager::updateAppearanceFromCOF() } } -void LLAppearanceManager::getCOFValidDescendents(const LLUUID& category, - LLInventoryModel::item_array_t& items) -{ - LLInventoryModel::cat_array_t cats; - LLFindCOFValidItems is_cof_valid; - bool follow_folder_links = false; - gInventory.collectDescendentsIf(category, - cats, - items, - LLInventoryModel::EXCLUDE_TRASH, - is_cof_valid, - follow_folder_links); -} - void LLAppearanceManager::getDescendentsOfAssetType(const LLUUID& category, LLInventoryModel::item_array_t& items, LLAssetType::EType type, -- cgit v1.2.3 From 036b0b7d8d16bc37ccc618b616db864c67c940e4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 13 Nov 2009 11:43:32 -0500 Subject: removed dead code that was triggering a warning on some platforms --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 456eaa43c6..8d66cefa4f 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -323,44 +323,6 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items) items = new_items; } -static void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventoryModel::item_array_t& src) -{ - LLInventoryModel::item_array_t new_dst; - std::set mark_inventory; - - S32 inventory_dups = 0; - - for (LLInventoryModel::item_array_t::const_iterator src_pos = src.begin(); - src_pos != src.end(); - ++src_pos) - { - LLUUID src_item_id = (*src_pos)->getLinkedUUID(); - mark_inventory.insert(src_item_id); - } - - for (LLInventoryModel::item_array_t::const_iterator dst_pos = dst.begin(); - dst_pos != dst.end(); - ++dst_pos) - { - LLUUID dst_item_id = (*dst_pos)->getLinkedUUID(); - - if (mark_inventory.find(dst_item_id) == mark_inventory.end()) - { - // Item is not already present in COF. - new_dst.put(*dst_pos); - mark_inventory.insert(dst_item_id); - } - else - { - inventory_dups++; - } - } - llinfos << "removeDups, original " << dst.count() << " final " << new_dst.count() - << " inventory dups " << inventory_dups << llendl; - - dst = new_dst; -} - static void onWearableAssetFetch(LLWearable* wearable, void* data) { LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data; -- cgit v1.2.3 From 0fb0ce836d286063a21c540cadbdbd12160cb9e1 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Fri, 13 Nov 2009 14:42:28 -0500 Subject: EXT-2428 : Wearing a look should update the "Current Look" sidepanel string Both double-clicking on an outfit to wear, and wearing an outfit from side panel, will now update the current look string. --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 456eaa43c6..aac0fd6088 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -32,18 +32,20 @@ #include "llviewerprecompiledheaders.h" +#include "llagent.h" +#include "llagentwearables.h" #include "llappearancemgr.h" -#include "llinventorymodel.h" -#include "llnotifications.h" +#include "llfloatercustomize.h" #include "llgesturemgr.h" #include "llinventorybridge.h" -#include "llwearablelist.h" -#include "llagentwearables.h" -#include "llagent.h" +#include "llinventorymodel.h" +#include "llnotifications.h" +#include "llpanelappearance.h" +#include "llsidetray.h" #include "llvoavatar.h" #include "llvoavatarself.h" #include "llviewerregion.h" -#include "llfloatercustomize.h" +#include "llwearablelist.h" class LLWearInventoryCategoryCallback : public LLInventoryCallback { @@ -564,6 +566,13 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) { link_inventory_item(gAgent.getID(), category, cof, catp->getName(), LLAssetType::AT_LINK_FOLDER, link_waiter); + + // Update the current outfit name of the appearance sidepanel. + LLPanelAppearance* panel_appearance = dynamic_cast(LLSideTray::getInstance()->getPanel("panel_appearance")); + if (panel_appearance) + { + panel_appearance->refreshCurrentLookName(catp->getName()); + } } } -- cgit v1.2.3 From 4b05dc4890d82b5c13c74ad502f0123fb83072a9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 13 Nov 2009 15:20:54 -0500 Subject: LLAppearanceManager cleanup - 2 methods renamed --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 8d66cefa4f..f7d1396707 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -802,7 +802,7 @@ bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventor (a->getWearableType() == b->getWearableType())); } -void LLAppearanceManager::wearItem( LLInventoryItem* item, bool do_update ) +void LLAppearanceManager::addItemLink( LLInventoryItem* item, bool do_update ) { LLViewerInventoryItem *vitem = dynamic_cast(item); if (!vitem) @@ -855,7 +855,7 @@ void LLAppearanceManager::wearItem( LLInventoryItem* item, bool do_update ) return; } -void LLAppearanceManager::wearEnsemble( LLInventoryCategory* cat, bool do_update ) +void LLAppearanceManager::addEnsembleLink( LLInventoryCategory* cat, bool do_update ) { #if SUPPORT_ENSEMBLES // BAP add check for already in COF. @@ -969,7 +969,7 @@ void LLAppearanceManager::registerAttachment(const LLUUID& item_id) if (item) { //LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Adding attachment link:"); - LLAppearanceManager::wearItem(item,false); // Add COF link for item. + LLAppearanceManager::addItemLink(item,false); // Add COF link for item. gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); gInventory.notifyObservers(); } @@ -1009,7 +1009,7 @@ void LLAppearanceManager::linkRegisteredAttachments() LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item) { - wearItem(item, false); + addItemLink(item, false); gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); gInventory.notifyObservers(); } -- cgit v1.2.3 From acdce232994fce7edf9a67a360db2368c5ad6594 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Fri, 13 Nov 2009 17:47:00 -0500 Subject: Header file cleanup Removed unnecessary "#include llinventorymodel.h" now that llinventoryobserver was split from llinventorymodel. --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index e46cfe6af9..61c1081d22 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -38,7 +38,7 @@ #include "llfloatercustomize.h" #include "llgesturemgr.h" #include "llinventorybridge.h" -#include "llinventorymodel.h" +#include "llinventoryobserver.h" #include "llnotifications.h" #include "llpanelappearance.h" #include "llsidetray.h" -- cgit v1.2.3 From 9c823a1d40392dc00bdfb1f09220a5065d764f40 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 17 Nov 2009 10:33:47 -0500 Subject: Deferring work to idle time to avoid recursive notifyObservers calls - added wrapper class to defer an arbitrary boost::bind or other callable --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 80ac9e4085..a23d21f84b 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -95,8 +95,9 @@ public: mCopyItems(copy_items), mAppend(append) {} - ~LLOutfitObserver() {} - virtual void done(); //public + ~LLOutfitObserver(); + virtual void done(); + void doWearCategory(); protected: LLUUID mCatID; @@ -104,7 +105,19 @@ protected: bool mAppend; }; +LLOutfitObserver::~LLOutfitObserver() +{ + llinfos << "~LLOutfitObserver" << llendl; +} + +// BAP is LLOutfitObserver getting deleted here? void LLOutfitObserver::done() +{ + gInventory.removeObserver(this); + doOnIdle(boost::bind(&LLOutfitObserver::doWearCategory,this)); +} + +void LLOutfitObserver::doWearCategory() { // We now have an outfit ready to be copied to agent inventory. Do // it, and wear that outfit normally. @@ -175,6 +188,7 @@ void LLOutfitObserver::done() // Wear the inventory category. LLAppearanceManager::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend); } + delete this; } class LLOutfitFetch : public LLInventoryFetchDescendentsObserver -- cgit v1.2.3 From 32dccaf3d89b40b711d69088a3e390119c7efc7f Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 17 Nov 2009 10:36:11 -0500 Subject: Sidepanel Appearance refactoring. Work in progress. 1. Changed sidepanel names to have "sidepanel" (e.g. panel_appearance -> sidepanel_appearance) 2. Changed some "Looks" names to "Outfits" 3. Changed LLPanelLooks to LLPanelOutfitsInventory (to match other inventory panel naming) 4. Took out tab from sidepanel_appearance. --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 80ac9e4085..554f270c02 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -40,7 +40,7 @@ #include "llinventorybridge.h" #include "llinventoryobserver.h" #include "llnotifications.h" -#include "llpanelappearance.h" +#include "llsidepanelappearance.h" #include "llsidetray.h" #include "llvoavatar.h" #include "llvoavatarself.h" @@ -530,10 +530,10 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) LLAssetType::AT_LINK_FOLDER, link_waiter); // Update the current outfit name of the appearance sidepanel. - LLPanelAppearance* panel_appearance = dynamic_cast(LLSideTray::getInstance()->getPanel("panel_appearance")); + LLSidepanelAppearance* panel_appearance = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); if (panel_appearance) { - panel_appearance->refreshCurrentLookName(catp->getName()); + panel_appearance->refreshCurrentOutfitName(catp->getName()); } } -- cgit v1.2.3 From 72022279535dd0ff0938e2dbbf44b6dfd6560af3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 17 Nov 2009 13:43:12 -0500 Subject: Removed function that was only used for debugging. Defer object suicide until end of the method --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index a23d21f84b..09efda6aca 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -95,7 +95,7 @@ public: mCopyItems(copy_items), mAppend(append) {} - ~LLOutfitObserver(); + ~LLOutfitObserver() {} virtual void done(); void doWearCategory(); @@ -105,12 +105,6 @@ protected: bool mAppend; }; -LLOutfitObserver::~LLOutfitObserver() -{ - llinfos << "~LLOutfitObserver" << llendl; -} - -// BAP is LLOutfitObserver getting deleted here? void LLOutfitObserver::done() { gInventory.removeObserver(this); @@ -236,7 +230,6 @@ void LLOutfitFetch::done() // loop. //dec_busy_count(); gInventory.removeObserver(this); - delete this; // increment busy count and either tell the inventory to check & // call done, or add this object to the inventory for observation. @@ -255,6 +248,7 @@ void LLOutfitFetch::done() // will call done for us when everything is here. gInventory.addObserver(outfit_observer); } + delete this; } class LLUpdateAppearanceOnDestroy: public LLInventoryCallback -- cgit v1.2.3 From 6474dbd46920fe704625a44cc2b8c56bfdca4990 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 17 Nov 2009 16:07:29 -0500 Subject: For DEV-34652: OUTFITS (Operations) : Wear folders via drag and drop - handle untyped folder dragged to outfit --HG-- branch : avatar-pipeline --- indra/newview/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 09efda6aca..48f11a7cf5 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -465,7 +465,7 @@ void LLAppearanceManager::filterWearableItems( // Create links to all listed items. void LLAppearanceManager::linkAll(const LLUUID& category, LLInventoryModel::item_array_t& items, - LLPointer cb) + LLPointer cb) { for (S32 i=0; i 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 From d974ad39347e75241f8b6ccc9fce8caf835c453e Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Thu, 19 Nov 2009 12:06:26 -0500 Subject: EXT-2562 : Somehow show cnotents of what I'm wearing Added appearanceSP button to toggle folder closed/open state. Also fixed up some bugs with current outfit title placement in appearanceSP.xml Also added a generic call for getting the current outfit folder link --- indra/newview/llappearancemgr.cpp | 43 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d6265a85f6..1050deaa27 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -363,6 +363,35 @@ LLUUID LLAppearanceManager::getCOF() return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); } + +const LLViewerInventoryItem* LLAppearanceManager::getCurrentOutfitLink() +{ + const LLUUID& current_outfit_cat = getCOF(); + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + // Can't search on FT_OUTFIT since links to categories return FT_CATEGORY for type since they don't + // return preferred type. + LLIsType is_category( LLAssetType::AT_CATEGORY ); + gInventory.collectDescendentsIf(current_outfit_cat, + cat_array, + item_array, + false, + is_category, + false); + for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin(); + iter != item_array.end(); + iter++) + { + const LLViewerInventoryItem *item = (*iter); + const LLViewerInventoryCategory *cat = item->getLinkedCategory(); + if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT) + { + return item; + } + } + return NULL; +} + // Update appearance from outfit folder. void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, bool append) { @@ -531,20 +560,28 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) linkAll(cof, gest_items, link_waiter); // Add link to outfit if category is an outfit. - LLViewerInventoryCategory* catp = gInventory.getCategory(category); + const LLViewerInventoryCategory* catp = gInventory.getCategory(category); + LLSidepanelAppearance* panel_appearance = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + if (!append && catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT) { link_inventory_item(gAgent.getID(), category, cof, catp->getName(), LLAssetType::AT_LINK_FOLDER, link_waiter); // Update the current outfit name of the appearance sidepanel. - LLSidepanelAppearance* panel_appearance = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); if (panel_appearance) { panel_appearance->refreshCurrentOutfitName(catp->getName()); } } - + else + { + // Update the current outfit name of the appearance sidepanel. + if (panel_appearance) + { + panel_appearance->refreshCurrentOutfitName(); + } + } } void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append) -- cgit v1.2.3