From c3d9316dff568d5265d856a708e3909deae09f18 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 6 Apr 2010 17:30:23 -0400 Subject: EXT-6727 : Allow LLInventoryObservers to target a single item (instead of a vector of items) Added new constructors to LLInventoryFetch types to allow passing in a single item. --- 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 e0f1d5348d..7700d4de7f 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -49,7 +49,7 @@ #include "llviewerregion.h" #include "llwearablelist.h" -LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string& name) +LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string& name) { LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; -- cgit v1.2.3 From 9d93441b3117c59652fbb81abea2983f3cbca203 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 9 Apr 2010 12:30:33 +0300 Subject: done EXT-6687 Implement Save button functionality (Edit Outfit panel) Implemented "Save", "Save as new" functionality. If the base outfit doesn't exist "Save as new" functionality is employed Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/179 --HG-- branch : product-engine --- indra/newview/llappearancemgr.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index e0f1d5348d..40c1f89f3f 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -593,6 +593,23 @@ bool LLAppearanceMgr::getBaseOutfitName(std::string& name) return false; } +const LLUUID LLAppearanceMgr::getBaseOutfitUUID() +{ + const LLViewerInventoryItem* outfit_link = getBaseOutfitLink(); + if (!outfit_link || !outfit_link->getIsLinkType()) return LLUUID::null; + + const LLViewerInventoryCategory* outfit_cat = outfit_link->getLinkedCategory(); + if (!outfit_cat) return LLUUID::null; + + if (outfit_cat->getPreferredType() != LLFolderType::FT_OUTFIT) + { + llwarns << "Expected outfit type:" << LLFolderType::FT_OUTFIT << " but got type:" << outfit_cat->getType() << " for folder name:" << outfit_cat->getName() << llendl; + return LLUUID::null; + } + + return outfit_cat->getUUID(); +} + // Update appearance from outfit folder. void LLAppearanceMgr::changeOutfit(bool proceed, const LLUUID& category, bool append) { @@ -1516,6 +1533,20 @@ void LLAppearanceMgr::onFirstFullyVisible() autopopulateOutfits(); } +bool LLAppearanceMgr::updateBaseOutfit() +{ + const LLUUID base_outfit_id = getBaseOutfitUUID(); + if (base_outfit_id.isNull()) return false; + + // in a Base Outfit we do not remove items, only links + purgeCategory(base_outfit_id, false); + + //COF contains only links so we copy to the Base Outfit only links + shallowCopyCategoryContents(getCOF(), base_outfit_id, NULL); + + return true; +} + //#define DUMP_CAT_VERBOSE void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg) -- cgit v1.2.3 From 43c85b0dfb4e7e7c9fdfc02954bbb0115ec344c4 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 9 Apr 2010 15:07:42 +0300 Subject: done EXT-6716 Implement Add button functionality for adding a wearable to Current Outfit (Edit Outfit panel) Added temporary PLUS button on the button bar under the top list of Edit Outfit panel Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/203/ --HG-- branch : product-engine --- indra/newview/llappearancemgr.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 40c1f89f3f..0bd95987d7 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -610,6 +610,38 @@ const LLUUID LLAppearanceMgr::getBaseOutfitUUID() return outfit_cat->getUUID(); } +bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_update) +{ + if (item_id_to_wear.isNull()) return false; + + //only the item from a user's inventory is allowed + if (!gInventory.isObjectDescendentOf(item_id_to_wear, gInventory.getRootFolderID())) return false; + + LLViewerInventoryItem* item_to_wear = gInventory.getItem(item_id_to_wear); + if (!item_to_wear) return false; + + switch (item_to_wear->getType()) + { + case LLAssetType::AT_CLOTHING: + case LLAssetType::AT_BODYPART: + // Don't wear anything until initial wearables are loaded, can + // destroy clothing items. + if (!gAgentWearables.areWearablesLoaded()) + { + LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded"); + return false; + } + addCOFItemLink(item_to_wear, do_update); + break; + case LLAssetType::AT_OBJECT: + rez_attachment(item_to_wear, NULL); + break; + default: return false;; + } + + return true; +} + // Update appearance from outfit folder. void LLAppearanceMgr::changeOutfit(bool proceed, const LLUUID& category, bool append) { -- cgit v1.2.3 From cf31494b5053283b4d445b0c564b5e7d57af2a18 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 9 Apr 2010 15:19:11 +0300 Subject: done EXT-6688 Implement Revert button funtionality (Edit Outfit panel) On revert the base outfit is worn Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/205/ --HG-- branch : product-engine --- indra/newview/llappearancemgr.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 0bd95987d7..4a30ba3066 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1579,6 +1579,14 @@ bool LLAppearanceMgr::updateBaseOutfit() return true; } +void LLAppearanceMgr::wearBaseOutfit() +{ + const LLUUID& base_outfit_id = getBaseOutfitUUID(); + if (base_outfit_id.isNull()) return; + + updateCOF(base_outfit_id); +} + //#define DUMP_CAT_VERBOSE void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg) -- cgit v1.2.3 From 613b4e9361df55da3863a546c806493d48f848f3 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Tue, 13 Apr 2010 13:37:14 +0300 Subject: done EXT-6675 Fix TRASH btn on Edit Outfit panel to remove an item from avatar (from COF) Trash button removes from avatar a selected item only of "clothing" and "object" types Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/209/ --HG-- branch : product-engine --- indra/newview/llappearancemgr.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4a30ba3066..b6fc33e9a2 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -42,8 +42,10 @@ #include "llinventoryfunctions.h" #include "llinventoryobserver.h" #include "llnotificationsutil.h" +#include "llselectmgr.h" #include "llsidepanelappearance.h" #include "llsidetray.h" +#include "llviewerobjectlist.h" #include "llvoavatar.h" #include "llvoavatarself.h" #include "llviewerregion.h" @@ -1587,6 +1589,39 @@ void LLAppearanceMgr::wearBaseOutfit() updateCOF(base_outfit_id); } +void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove) +{ + LLViewerInventoryItem * item_to_remove = gInventory.getItem(id_to_remove); + if (!item_to_remove) return; + + switch (item_to_remove->getType()) + { + case LLAssetType::AT_CLOTHING: + if (get_is_item_worn(id_to_remove)) + { + //*TODO move here the exact removing code from LLWearableBridge::removeItemFromAvatar in the future + LLWearableBridge::removeItemFromAvatar(item_to_remove); + } + break; + case LLAssetType::AT_OBJECT: + gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv); + gMessageSystem->nextBlockFast(_PREHASH_ObjectData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_ItemID, item_to_remove->getLinkedUUID()); + gMessageSystem->sendReliable( gAgent.getRegion()->getHost()); + + { + // this object might have been selected, so let the selection manager know it's gone now + LLViewerObject *found_obj = gObjectList.findObject(item_to_remove->getLinkedUUID()); + if (found_obj) + { + LLSelectMgr::getInstance()->remove(found_obj); + }; + } + default: break; + } +} + //#define DUMP_CAT_VERBOSE void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg) -- cgit v1.2.3