From 3bd6c1919cc3a142a112278a6dc83bd8292bcb5a Mon Sep 17 00:00:00 2001 From: Bradley Payne Date: Mon, 12 Oct 2009 18:40:11 +0000 Subject: Merging avatar-pipeline/currently-worn-folder-10 down to viewer-2. svn merge -r 134766:135946 svn+ssh://svn.lindenlab.com/svn/linden/branches/avatar-pipeline/currently-worn-folder-10 . --- indra/newview/llagentwearables.cpp | 75 ++++++++++++++++++++++--------------- indra/newview/llagentwearables.h | 21 ++++++----- indra/newview/llappearancemgr.cpp | 53 +++++++++++++++++++++++--- indra/newview/llappearancemgr.h | 3 ++ indra/newview/llfolderviewitem.cpp | 11 ++++++ indra/newview/llinventorybridge.cpp | 2 +- indra/newview/llvoavatar.cpp | 2 + indra/newview/llvoavatarself.cpp | 2 + indra/newview/llwearable.h | 4 +- 9 files changed, 125 insertions(+), 48 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 50d378335e..2cfa8d2a54 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -563,16 +563,32 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type, return item; } -const LLWearable* LLAgentWearables::getWearableFromWearableItem(const LLUUID& item_id) const +const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const { for (S32 i=0; i < WT_COUNT; i++) { for (U32 j=0; j < getWearableCount((EWearableType)i); j++) { - LLUUID curr_item_id = getWearableItemID((EWearableType)i, j); - if (curr_item_id == item_id) + const LLWearable * curr_wearable = getWearable((EWearableType)i, j); + if (curr_wearable && (curr_wearable->getItemID() == item_id)) { - return getWearable((EWearableType)i, j); + return curr_wearable; + } + } + } + return NULL; +} + +const LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id) const +{ + for (S32 i=0; i < WT_COUNT; i++) + { + for (U32 j=0; j < getWearableCount((EWearableType)i); j++) + { + const LLWearable * curr_wearable = getWearable((EWearableType)i, j); + if (curr_wearable && (curr_wearable->getAssetID() == asset_id)) + { + return curr_wearable; } } } @@ -683,10 +699,19 @@ const LLUUID LLAgentWearables::getWearableItemID(EWearableType type, U32 index) return LLUUID(); } +const LLUUID LLAgentWearables::getWearableAssetID(EWearableType type, U32 index) const +{ + const LLWearable *wearable = getWearable(type,index); + if (wearable) + return wearable->getAssetID(); + else + return LLUUID(); +} + // Warning: include_linked_items = TRUE makes this operation expensive. BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id, BOOL include_linked_items) const { - if (getWearableFromWearableItem(item_id) != NULL) return TRUE; + if (getWearableFromItemID(item_id) != NULL) return TRUE; if (include_linked_items) { LLInventoryModel::item_array_t item_array; @@ -696,8 +721,8 @@ BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id, BOOL include_linked_ iter++) { LLViewerInventoryItem *linked_item = (*iter); - const LLUUID &item_id = linked_item->getUUID(); - if (getWearableFromWearableItem(item_id) != NULL) return TRUE; + const LLUUID &linked_item_id = linked_item->getUUID(); + if (getWearableFromItemID(linked_item_id) != NULL) return TRUE; } } return FALSE; @@ -1152,26 +1177,6 @@ LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name) return LLUUID::null; } - LLDynamicArray wearables_to_include; - getAllWearablesArray(wearables_to_include); - - LLDynamicArray attachments_to_include; - mAvatarObject->getAllAttachmentsArray(attachments_to_include); - - return makeNewOutfitLinks(new_folder_name, wearables_to_include, attachments_to_include); -} - -// Note: wearables_to_include should be a list of EWearableType types -// attachments_to_include should be a list of attachment points -LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name, - const LLDynamicArray& wearables_to_include, - const LLDynamicArray& attachments_to_include) -{ - if (mAvatarObject.isNull()) - { - return LLUUID::null; - } - // First, make a folder in the My Outfits directory. LLUUID parent_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_MY_OUTFITS); LLUUID folder_id = gInventory.createNewCategory( @@ -1180,8 +1185,8 @@ LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name, new_folder_name); LLAppearanceManager::shallowCopyCategory(LLAppearanceManager::getCOF(),folder_id, NULL); - -#if 0 + +#if 0 // BAP - fix to go into rename state automatically after outfit is created. LLViewerInventoryCategory *parent_category = gInventory.getCategory(parent_id); if (parent_category) { @@ -1839,7 +1844,7 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra msg->nextBlockFast(_PREHASH_HeaderData); msg->addUUIDFast(_PREHASH_CompoundMsgID, compound_msg_id ); msg->addU8Fast(_PREHASH_TotalObjects, obj_count ); - msg->addBOOLFast(_PREHASH_FirstDetachAll, true ); // BAP changing this doesn't seem to matter? + msg->addBOOLFast(_PREHASH_FirstDetachAll, false ); } const LLInventoryItem* item = obj_item_array.get(i).get(); @@ -1882,6 +1887,16 @@ void LLAgentWearables::updateWearablesLoaded() mWearablesLoaded = (itemUpdatePendingCount()==0); } +bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const +{ + if (!wearable) return false; + + EWearableType type = wearable->getType(); + // Make sure the user always has at least one shape, skin, eyes, and hair type currently worn. + return !(((type == WT_SHAPE) || (type == WT_SKIN) || (type == WT_HAIR) || (type == WT_EYES)) + && (getWearableCount(type) <= 1) ); +} + void LLAgentWearables::updateServer() { sendAgentWearablesUpdate(); diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 701ce7f05a..8b9d29342a 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -75,20 +75,25 @@ public: BOOL areWearablesLoaded() const; void updateWearablesLoaded(); void checkWearablesLoaded() const; + + // Note: False for shape, skin, eyes, and hair, unless you have MORE than 1. + bool canWearableBeRemoved(const LLWearable* wearable) const; //-------------------------------------------------------------------- // Accessors //-------------------------------------------------------------------- public: - const LLUUID getWearableItemID(EWearableType type, U32 index /*= 0*/) const; - const LLWearable* getWearableFromWearableItem(const LLUUID& item_id) const; - LLInventoryItem* getWearableInventoryItem(EWearableType type, U32 index /*= 0*/); + const LLUUID getWearableItemID(EWearableType type, U32 index /*= 0*/) const; + const LLUUID getWearableAssetID(EWearableType type, U32 index /*= 0*/) const; + const LLWearable* getWearableFromItemID(const LLUUID& item_id) const; + const LLWearable* getWearableFromAssetID(const LLUUID& asset_id) const; + LLInventoryItem* getWearableInventoryItem(EWearableType type, U32 index /*= 0*/); // MULTI-WEARABLE: assuming one per type. - static BOOL selfHasWearable(EWearableType type); - LLWearable* getWearable(const EWearableType type, U32 index /*= 0*/); + static BOOL selfHasWearable(EWearableType type); + LLWearable* getWearable(const EWearableType type, U32 index /*= 0*/); const LLWearable* getWearable(const EWearableType type, U32 index /*= 0*/) const; - U32 getWearableCount(const EWearableType type) const; + U32 getWearableCount(const EWearableType type) const; //-------------------------------------------------------------------- @@ -159,9 +164,7 @@ public: // Note: wearables_to_include should be a list of EWearableType types // attachments_to_include should be a list of attachment points LLUUID makeNewOutfitLinks(const std::string& new_folder_name); - LLUUID makeNewOutfitLinks(const std::string& new_folder_name, - const LLDynamicArray& wearables_to_include, - const LLDynamicArray& attachments_to_include); + private: void makeNewOutfitDone(S32 type, U32 index); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 3831846e2e..cf8d852dfe 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -165,6 +165,8 @@ void LLOutfitObserver::done() cb); } } + // BAP fixes a lag in display of created dir. + gInventory.notifyObservers(); } else { @@ -495,11 +497,16 @@ void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventory } else if (item->getActualType() == LLAssetType::AT_LINK_FOLDER) { - link_inventory_item(gAgent.getID(), - item->getLinkedUUID(), - dst_id, - item->getName(), - LLAssetType::AT_LINK_FOLDER, cb); + LLViewerInventoryCategory *catp = item->getLinkedCategory(); + // Skip copying outfit links. + if (catp && catp->getPreferredType() != LLAssetType::AT_OUTFIT) + { + link_inventory_item(gAgent.getID(), + item->getLinkedUUID(), + dst_id, + item->getName(), + LLAssetType::AT_LINK_FOLDER, cb); + } } else { @@ -519,6 +526,9 @@ void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventory { 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); @@ -538,6 +548,8 @@ void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventory gInventory.collectDescendents(current_outfit_id, cof_cats, cof_items, LLInventoryModel::EXCLUDE_TRASH); + //dumpCat(current_outfit_id,"COF before remove:"); + if (items.count() > 0) { for (S32 i = 0; i < cof_items.count(); ++i) @@ -547,15 +559,19 @@ void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventory gInventory.notifyObservers(); } + //dumpCat(current_outfit_id,"COF after remove:"); + LLPointer link_waiter = new LLUpdateAppearanceOnDestroy; 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() == LLAssetType::AT_OUTFIT) { link_inventory_item(gAgent.getID(), category, current_outfit_id, catp->getName(), - LLAssetType::AT_LINK_FOLDER, LLPointer(NULL)); + LLAssetType::AT_LINK_FOLDER, link_waiter); } } @@ -628,6 +644,8 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, /* static */ void LLAppearanceManager::updateAppearanceFromCOF() { + dumpCat(getCOF(),"COF, start"); + bool follow_folder_links = true; LLUUID current_outfit_id = getCOF(); @@ -921,3 +939,26 @@ void LLAppearanceManager::removeItemLinks(LLUUID& item_id, bool do_update) LLAppearanceManager::updateAppearanceFromCOF(); } } + +/* static */ +void LLAppearanceManager::dumpCat(const LLUUID& cat_id, std::string str) +{ + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + gInventory.collectDescendents(cat_id, cats, items, LLInventoryModel::EXCLUDE_TRASH); + +#if 0 + llinfos << llendl; + llinfos << str << llendl; + S32 hitcount = 0; + for(S32 i=0; igetName() <getItemID()); if (item) { + LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Adding attachment link:"); LLAppearanceManager::wearItem(item,false); // Add COF link for item. + } gInventory.addChangedMask(LLInventoryObserver::LABEL, attachment->getItemID()); gInventory.notifyObservers(); diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h index 5f0b235c7f..d7b4d3f91e 100644 --- a/indra/newview/llwearable.h +++ b/indra/newview/llwearable.h @@ -62,6 +62,7 @@ public: // Accessors //-------------------------------------------------------------------- public: + const LLUUID& getItemID() const; const LLAssetID& getAssetID() const { return mAssetID; } const LLTransactionID& getTransactionID() const { return mTransactionID; } EWearableType getType() const { return mType; } @@ -77,6 +78,7 @@ public: const std::string& getTypeLabel() const; const std::string& getTypeName() const; LLAssetType::EType getAssetType() const; + LLLocalTextureObject* getLocalTextureObject(S32 index) const; public: BOOL isDirty() const; @@ -102,8 +104,6 @@ public: friend std::ostream& operator<<(std::ostream &s, const LLWearable &w); void setItemID(const LLUUID& item_id); - const LLUUID& getItemID() const; - LLLocalTextureObject* getLocalTextureObject(S32 index) const; void setLocalTextureObject(S32 index, LLLocalTextureObject *lto); private: -- cgit v1.2.3