From 913923850051409047d7df83cb005e3d270b5e3a Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Fri, 25 Jun 2010 16:07:27 -0400 Subject: EXT-7914 FIXED Current outfit can be removed via My Inventory -> Trash button Now disabling remove if an outfit is linked in the COF. --- indra/newview/llinventoryfunctions.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 37088064c6..8940339265 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -282,7 +282,9 @@ BOOL get_is_item_removable(const LLInventoryModel* model, const LLUUID& id) BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) { - // This function doesn't check the folder's children. + // NOTE: This function doesn't check the folder's children. + // See LLFolderBridge::isItemRemovable for a function that does + // consider the children. if (!model) { @@ -296,17 +298,29 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) if (!isAgentAvatarValid()) return FALSE; - LLInventoryCategory* category = model->getCategory(id); + const LLInventoryCategory* category = model->getCategory(id); if (!category) { return FALSE; } - if (LLFolderType::lookupIsProtectedType(category->getPreferredType())) + const LLFolderType::EType folder_type = category->getPreferredType(); + + if (LLFolderType::lookupIsProtectedType(folder_type)) { return FALSE; } + // Can't delete the outfit that is currently being worn. + if (folder_type == LLFolderType::FT_OUTFIT) + { + const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink(); + if (base_outfit_link && (category == base_outfit_link->getLinkedCategory())) + { + return FALSE; + } + } + return TRUE; } -- cgit v1.2.3 From 8d18056e8296472d58a820fd77a6a66100e70661 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 25 Jun 2010 16:04:45 -0700 Subject: Fix for EXT-8025 ('+' button on My Appearance > Edit Outfit panel does nothing) Button now gets disabled in the early-exit case in LLPanelOutfitEdit::onInventorySelectionChange(). onInventorySelectionChange() also uses the new predicate get_can_item_be_worn(), which both checks whether the item is already being worn and whether it's of a type that could be worn. Reviewed by Nyx at http://codereview.lindenlab.com/2451030 . --- indra/newview/llinventoryfunctions.cpp | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 37088064c6..7e9a2cb716 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -245,6 +245,47 @@ BOOL get_is_item_worn(const LLUUID& id) return FALSE; } +BOOL get_can_item_be_worn(const LLUUID& id) +{ + const LLViewerInventoryItem* item = gInventory.getItem(id); + if (!item) + return FALSE; + + switch(item->getType()) + { + case LLAssetType::AT_OBJECT: + { + if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) + { + // Already being worn + return FALSE; + } + else + { + // Not being worn yet. + return TRUE; + } + break; + } + case LLAssetType::AT_BODYPART: + case LLAssetType::AT_CLOTHING: + if(gAgentWearables.isWearingItem(item->getLinkedUUID())) + { + // Already being worn + return FALSE; + } + else + { + // Not being worn yet. + return TRUE; + } + break; + default: + break; + } + return FALSE; +} + BOOL get_is_item_removable(const LLInventoryModel* model, const LLUUID& id) { if (!model) -- cgit v1.2.3