summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-11-13 11:10:29 -0500
committerLoren Shih <seraph@lindenlab.com>2009-11-13 11:10:29 -0500
commit3b730cef7583a77b4b42506fffb677282ddadbec (patch)
tree9f55dc1e769c5e039939e969adfd43b6f4649a65
parentcf6e4c5059befb5cf7b90fa7b7670398936312e5 (diff)
parentf36c43abde7457747539f3687e02bd54a88bcd87 (diff)
merge
--HG-- branch : avatar-pipeline
-rw-r--r--indra/newview/llagentwearables.cpp10
-rw-r--r--indra/newview/llappearancemgr.cpp366
-rw-r--r--indra/newview/llappearancemgr.h77
-rw-r--r--indra/newview/llinventorybridge.cpp16
-rw-r--r--indra/newview/llinventorypanel.cpp2
-rw-r--r--indra/newview/llpanelimcontrolpanel.cpp4
-rw-r--r--indra/newview/llstartup.cpp6
-rw-r--r--indra/newview/lltooldraganddrop.cpp4
-rw-r--r--indra/newview/llviewermenu.cpp4
-rw-r--r--indra/newview/llvoavatarself.cpp15
-rw-r--r--indra/newview/skins/default/xui/en/menu_inventory.xml4
11 files changed, 129 insertions, 379 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 5bf1573a2c..5dbbcd727c 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1264,7 +1264,7 @@ LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name)
LLFolderType::FT_OUTFIT,
new_folder_name);
- LLAppearanceManager::shallowCopyCategory(LLAppearanceManager::getCOF(),folder_id, NULL);
+ LLAppearanceManager::instance().shallowCopyCategory(LLAppearanceManager::instance().getCOF(),folder_id, NULL);
#if 0 // BAP - fix to go into rename state automatically after outfit is created.
LLViewerInventoryCategory *parent_category = gInventory.getCategory(parent_id);
@@ -1394,7 +1394,7 @@ void LLAgentWearables::removeWearableFinal(const EWearableType type, bool do_rem
const LLUUID &item_id = getWearableItemID(type,i);
popWearable(type,i);
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
- LLAppearanceManager::removeItemLinks(item_id,false);
+ LLAppearanceManager::instance().removeItemLinks(item_id,false);
//queryWearableCache(); // moved below
if (old_wearable)
@@ -1411,7 +1411,7 @@ void LLAgentWearables::removeWearableFinal(const EWearableType type, bool do_rem
const LLUUID &item_id = getWearableItemID(type,index);
popWearable(type, index);
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
- LLAppearanceManager::removeItemLinks(item_id,false);
+ LLAppearanceManager::instance().removeItemLinks(item_id,false);
//queryWearableCache(); // moved below
@@ -2040,7 +2040,7 @@ void LLInitialWearablesFetch::processContents()
gInventory.collectDescendentsIf(mCompleteFolders.front(), cat_array, wearable_array,
LLInventoryModel::EXCLUDE_TRASH, is_wearable);
- LLAppearanceManager::setAttachmentInvLinkEnable(true);
+ LLAppearanceManager::instance().setAttachmentInvLinkEnable(true);
if (wearable_array.count() > 0)
{
LLAppearanceManager::instance().updateAppearanceFromCOF();
@@ -2049,7 +2049,7 @@ void LLInitialWearablesFetch::processContents()
{
processWearablesMessage();
// Create links for attachments that may have arrived before the COF existed.
- LLAppearanceManager::linkRegisteredAttachments();
+ LLAppearanceManager::instance().linkRegisteredAttachments();
}
delete this;
}
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 0901289dac..456eaa43c6 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<LLUUID> 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<LLUUID> mark_inventory;
@@ -361,137 +361,44 @@ void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventory
dst = new_dst;
}
-/* static */
-LLUUID LLAppearanceManager::getCOF()
+static void onWearableAssetFetch(LLWearable* wearable, void* data)
{
- 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);
-#else
- if (append)
- {
- updateCOFFromCategory(category, append); // append is true - add non-duplicates to COF.
- }
- else
+ LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data;
+ bool append = holder->append;
+
+ if(wearable)
{
- LLViewerInventoryCategory* catp = gInventory.getCategory(category);
- if (catp->getPreferredType() == LLFolderType::FT_NONE ||
- LLFolderType::lookupIsEnsembleType(catp->getPreferredType()))
- {
- updateCOFFromCategory(category, append); // append is false - rebuild COF.
- }
- else if (catp->getPreferredType() == LLFolderType::FT_OUTFIT)
+ for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->mFoundList.begin();
+ iter != holder->mFoundList.end(); ++iter)
{
- rebuildCOFFromOutfit(category);
+ LLFoundData* data = *iter;
+ if(wearable->getAssetID() == data->mAssetID)
+ {
+ data->mWearable = wearable;
+ break;
+ }
}
}
-#endif
+ holder->mResolved += 1;
+ if(holder->mResolved >= (S32)holder->mFoundList.size())
+ {
+ LLAppearanceManager::instance().updateAgentWearables(holder, append);
+ }
}
-// Append to current COF contents by recursively traversing a folder.
-/* static */
-void LLAppearanceManager::updateCOFFromCategory(const LLUUID& category, bool append)
+LLUUID LLAppearanceManager::getCOF()
{
- // 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);
+ return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+}
- // 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");
+// Update appearance from outfit folder.
+void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, bool append)
+{
+ if (!proceed)
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<LLUpdateAppearanceOnDestroy> 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);
- }
- }
- }
+ LLAppearanceManager::instance().updateCOF(category,append);
}
-/* static */
void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
LLPointer<LLInventoryCallback> cb)
{
@@ -535,7 +442,8 @@ 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 +460,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 +491,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<LLInventoryCallback> cb)
{
for (S32 i=0; i<items.count(); i++)
@@ -599,7 +507,7 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID
}
}
-/* static */ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
+void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
{
const LLUUID cof = getCOF();
@@ -660,141 +568,6 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID
}
-/* static */
-bool LLAppearanceManager::isMandatoryWearableType(EWearableType type)
-{
- return (type==WT_SHAPE) || (type==WT_SKIN) || (type== WT_HAIR) || (type==WT_EYES);
-}
-
-// For mandatory body parts.
-/* static */
-void LLAppearanceManager::checkMandatoryWearableTypes(const LLUUID& category, std::set<EWearableType>& 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<EWearableType> 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.
-/* static */
-void LLAppearanceManager::purgeCOFBeforeRebuild(const LLUUID& category)
-{
- // See which mandatory body types are present in the new category.
- std::set<EWearableType> 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.
-/* static */
-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<LLInventoryCallback> 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);
- }
-}
-
-/* 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::updateAgentWearables(holder, append);
- }
-}
-
-/* static */
void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append)
{
lldebugs << "updateAgentWearables()" << llendl;
@@ -835,7 +608,6 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder,
// dec_busy_count();
}
-/* static */
void LLAppearanceManager::updateAppearanceFromCOF()
{
dumpCat(getCOF(),"COF, start");
@@ -903,7 +675,7 @@ void LLAppearanceManager::updateAppearanceFromCOF()
LLWearableList::instance().getAsset(found->mAssetID,
found->mName,
found->mAssetType,
- LLAppearanceManager::onWearableAssetFetch,
+ onWearableAssetFetch,
(void*)holder);
}
}
@@ -916,22 +688,6 @@ void LLAppearanceManager::updateAppearanceFromCOF()
}
}
-/* static */
-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);
-}
-
-/* static */
void LLAppearanceManager::getDescendentsOfAssetType(const LLUUID& category,
LLInventoryModel::item_array_t& items,
LLAssetType::EType type,
@@ -947,7 +703,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 +766,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
@@ -1023,7 +777,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
{
@@ -1031,7 +787,6 @@ void LLAppearanceManager::wearInventoryCategoryOnAvatar( LLInventoryCategory* ca
}
}
-/* static */
void LLAppearanceManager::wearOutfitByName(const std::string& name)
{
llinfos << "Wearing category " << name << llendl;
@@ -1084,7 +839,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<LLViewerInventoryItem*>(item);
@@ -1138,7 +893,6 @@ void LLAppearanceManager::wearItem( LLInventoryItem* item, bool do_update )
return;
}
-/* static */
void LLAppearanceManager::wearEnsemble( LLInventoryCategory* cat, bool do_update )
{
#if SUPPORT_ENSEMBLES
@@ -1153,7 +907,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 +931,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 +952,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 +964,19 @@ void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& it
llinfos << llendl;
}
+LLAppearanceManager::LLAppearanceManager():
+ mAttachmentInvLinkEnabled(false)
+{
+}
-std::set<LLUUID> 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<LLUUID>& atts, const std::string& msg)
@@ -1241,13 +996,12 @@ void dumpAttachmentSet(const std::set<LLUUID>& 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 +1018,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 +1037,10 @@ void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id)
}
}
-/* static */
void LLAppearanceManager::linkRegisteredAttachments()
{
- for (std::set<LLUUID>::iterator it = sRegisteredAttachments.begin();
- it != sRegisteredAttachments.end();
+ for (std::set<LLUUID>::iterator it = mRegisteredAttachments.begin();
+ it != mRegisteredAttachments.end();
++it)
{
LLUUID item_id = *it;
@@ -1300,5 +1052,5 @@ void LLAppearanceManager::linkRegisteredAttachments()
gInventory.notifyObservers();
}
}
- sRegisteredAttachments.clear();
+ mRegisteredAttachments.clear();
}
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 7dea16b6cf..736dabea31 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -42,66 +42,71 @@ struct LLWearableHoldingPattern;
class LLAppearanceManager: public LLSingleton<LLAppearanceManager>
{
+ friend class LLSingleton<LLAppearanceManager>;
+
public:
- static void updateAppearanceFromCOF();
- static bool needToSaveCOF();
- static void changeOutfit(bool proceed, const LLUUID& category, bool append);
- static void updateCOF(const LLUUID& category, bool append = false);
- static void updateCOFFromCategory(const LLUUID& category, bool append);
- static void rebuildCOFFromOutfit(const LLUUID& category);
- static void wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append);
- static void wearInventoryCategoryOnAvatar(LLInventoryCategory* category, bool append);
- static void wearOutfitByName(const std::string& name);
- static void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
- LLPointer<LLInventoryCallback> cb);
+ void updateAppearanceFromCOF();
+ bool needToSaveCOF();
+ void updateCOF(const LLUUID& category, bool append = false);
+ void wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append);
+ void wearInventoryCategoryOnAvatar(LLInventoryCategory* category, bool append);
+ void wearOutfitByName(const std::string& name);
+ void changeOutfit(bool proceed, const LLUUID& category, bool append);
// Add COF link to individual item.
- static void wearItem(LLInventoryItem* item, bool do_update = true);
+ void wearItem(LLInventoryItem* item, bool do_update = true);
// Add COF link to ensemble folder.
- static void wearEnsemble(LLInventoryCategory* item, bool do_update = true);
- static LLUUID getCOF();
+ void wearEnsemble(LLInventoryCategory* item, bool do_update = true);
+
+ // Copy all items in a category.
+ void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
+ LLPointer<LLInventoryCallback> cb);
+
+ // Find the Current Outfit folder.
+ LLUUID getCOF();
// Remove COF entries
- static void removeItemLinks(const LLUUID& item_id, bool do_update = true);
+ void removeItemLinks(const LLUUID& item_id, bool do_update = true);
+
+ void updateAgentWearables(LLWearableHoldingPattern* holder, bool append);
// For debugging - could be moved elsewhere.
- static void dumpCat(const LLUUID& cat_id, const std::string& msg);
- static void dumpItemArray(const LLInventoryModel::item_array_t& items, const std::string& msg);
- static void unregisterAttachment(const LLUUID& item_id);
- static void registerAttachment(const LLUUID& item_id);
- static void setAttachmentInvLinkEnable(bool val);
- static void linkRegisteredAttachments();
+ void dumpCat(const LLUUID& cat_id, const std::string& msg);
+ void dumpItemArray(const LLInventoryModel::item_array_t& items, const std::string& msg);
+
+ // Attachment link management
+ void unregisterAttachment(const LLUUID& item_id);
+ void registerAttachment(const LLUUID& item_id);
+ void setAttachmentInvLinkEnable(bool val);
+ void linkRegisteredAttachments();
+
+protected:
+ LLAppearanceManager();
+ ~LLAppearanceManager();
private:
- static void filterWearableItems(LLInventoryModel::item_array_t& items, S32 max_per_type);
- static void linkAll(const LLUUID& category,
+
+ void filterWearableItems(LLInventoryModel::item_array_t& items, S32 max_per_type);
+ void linkAll(const LLUUID& category,
LLInventoryModel::item_array_t& items,
LLPointer<LLInventoryCallback> cb);
- static void getDescendentsOfAssetType(const LLUUID& category,
+ void getDescendentsOfAssetType(const LLUUID& category,
LLInventoryModel::item_array_t& items,
LLAssetType::EType type,
bool follow_folder_links);
- static void getCOFValidDescendents(const LLUUID& category,
- LLInventoryModel::item_array_t& items);
-
- static void getUserDescendents(const LLUUID& category,
+ void getUserDescendents(const LLUUID& category,
LLInventoryModel::item_array_t& wear_items,
LLInventoryModel::item_array_t& obj_items,
LLInventoryModel::item_array_t& gest_items,
bool follow_folder_links);
- static void onWearableAssetFetch(LLWearable* wearable, void* data);
- static void updateAgentWearables(LLWearableHoldingPattern* holder, bool append);
- static bool isMandatoryWearableType(EWearableType type);
- static void checkMandatoryWearableTypes(const LLUUID& category, std::set<EWearableType>& types_found);
- static void purgeCOFBeforeRebuild(const LLUUID& category);
- static void purgeCategory(const LLUUID& category, bool keep_outfit_links);
- static std::set<LLUUID> sRegisteredAttachments;
- static bool sAttachmentInvLinkEnabled;
+ void purgeCategory(const LLUUID& category, bool keep_outfit_links);
+ std::set<LLUUID> mRegisteredAttachments;
+ bool mAttachmentInvLinkEnabled;
};
#define SUPPORT_ENSEMBLES 0
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 68daf53241..6087df33b9 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1687,7 +1687,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
// BAP - should skip if dup.
if (move_is_into_current_outfit)
{
- LLAppearanceManager::wearEnsemble(inv_cat);
+ LLAppearanceManager::instance().wearEnsemble(inv_cat);
}
else
{
@@ -2044,7 +2044,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
mContentsCount)
{
gInventory.removeObserver(this);
- LLAppearanceManager::wearInventoryCategory(category, FALSE, TRUE);
+ LLAppearanceManager::instance().wearInventoryCategory(category, FALSE, TRUE);
delete this;
}
}
@@ -2089,7 +2089,7 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model
if(!model) return;
LLViewerInventoryCategory* cat = getCategory();
if(!cat) return;
- LLAppearanceManager::wearEnsemble(cat,true);
+ LLAppearanceManager::instance().wearEnsemble(cat,true);
return;
}
#endif
@@ -2404,7 +2404,7 @@ void LLFolderBridge::folderOptionsMenu()
{
mItems.push_back(std::string("Wear As Ensemble"));
}
- mItems.push_back(std::string("Take Off Items"));
+ mItems.push_back(std::string("Remove From Outfit"));
}
hide_context_entries(*mMenu, mItems, disabled_items);
}
@@ -2730,7 +2730,7 @@ void LLFolderBridge::modifyOutfit(BOOL append)
// BAP - was:
// wear_inventory_category_on_avatar( cat, append );
- LLAppearanceManager::wearInventoryCategory( cat, FALSE, append );
+ LLAppearanceManager::instance().wearInventoryCategory( cat, FALSE, append );
}
// helper stuff
@@ -2953,7 +2953,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
// BAP - should skip if dup.
if (move_is_into_current_outfit)
{
- LLAppearanceManager::wearItem(inv_item);
+ LLAppearanceManager::instance().wearItem(inv_item);
}
else
{
@@ -4201,7 +4201,7 @@ void wear_inventory_item_on_avatar( LLInventoryItem* item )
lldebugs << "wear_inventory_item_on_avatar( " << item->getName()
<< " )" << llendl;
- LLAppearanceManager::wearItem(item);
+ LLAppearanceManager::instance().wearItem(item);
}
}
@@ -4762,7 +4762,7 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
}
// Find and remove this item from the COF.
- LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(item_id, LLAppearanceManager::getCOF());
+ LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(item_id, LLAppearanceManager::instance().getCOF());
llassert(items.size() == 1); // Should always have one and only one item linked to this in the COF.
for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
iter != items.end();
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 7a7e1fae23..edb65511bc 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -682,7 +682,7 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc
{
// Don't select objects in COF (e.g. to prevent refocus when items are worn).
const LLInventoryObject *obj = gInventory.getObject(obj_id);
- if (obj && obj->getParentUUID() == LLAppearanceManager::getCOF())
+ if (obj && obj->getParentUUID() == LLAppearanceManager::instance().getCOF())
{
return;
}
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index 1770138b3e..b2e05ccead 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -43,6 +43,7 @@
#include "llparticipantlist.h"
#include "llimview.h"
#include "llvoicechannel.h"
+#include "llsidetray.h"
void LLPanelChatControlPanel::onCallButtonClicked()
{
@@ -158,7 +159,8 @@ void LLPanelIMControlPanel::onAddFriendButtonClicked()
void LLPanelIMControlPanel::onShareButtonClicked()
{
- // *TODO: Implement
+ LLSD key;
+ LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
}
void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id)
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 64dcd7b97f..84371b75cd 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2630,10 +2630,10 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
}
else
{
- LLAppearanceManager::wearOutfitByName(outfit_folder_name);
+ LLAppearanceManager::instance().wearOutfitByName(outfit_folder_name);
}
- LLAppearanceManager::wearOutfitByName(gestures);
- LLAppearanceManager::wearOutfitByName(COMMON_GESTURES_FOLDER);
+ LLAppearanceManager::instance().wearOutfitByName(gestures);
+ LLAppearanceManager::instance().wearOutfitByName(COMMON_GESTURES_FOLDER);
// This is really misnamed -- it means we have started loading
// an outfit/shape that will give the avatar a gender eventually. JC
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 959cb3f182..fbd86d0edf 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -2508,7 +2508,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
if(drop)
{
BOOL append = ( (mask & MASK_SHIFT) ? TRUE : FALSE );
- LLAppearanceManager::wearInventoryCategory(category, false, append);
+ LLAppearanceManager::instance().wearInventoryCategory(category, false, append);
}
return ACCEPT_YES_MULTI;
}
@@ -2516,7 +2516,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
{
if(drop)
{
- LLAppearanceManager::wearInventoryCategory(category, true, false);
+ LLAppearanceManager::instance().wearInventoryCategory(category, true, false);
}
return ACCEPT_YES_MULTI;
}
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 728fb7c616..4cc1d986bb 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -6424,13 +6424,13 @@ void handle_selected_texture_info(void*)
void handle_test_male(void*)
{
- LLAppearanceManager::wearOutfitByName("Male Shape & Outfit");
+ LLAppearanceManager::instance().wearOutfitByName("Male Shape & Outfit");
//gGestureList.requestResetFromServer( TRUE );
}
void handle_test_female(void*)
{
- LLAppearanceManager::wearOutfitByName("Female Shape & Outfit");
+ LLAppearanceManager::instance().wearOutfitByName("Female Shape & Outfit");
//gGestureList.requestResetFromServer( FALSE );
}
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 185274d40d..711e9f90fc 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -487,18 +487,10 @@ BOOL LLVOAvatarSelf::buildMenus()
}
// add in requested order to pie menu, inserting separators as necessary
- S32 cur_pie_slice = 0;
for (std::multimap<S32, S32>::iterator attach_it = attachment_pie_menu_map.begin();
attach_it != attachment_pie_menu_map.end(); ++attach_it)
{
- S32 requested_pie_slice = attach_it->first;
S32 attach_index = attach_it->second;
- while (cur_pie_slice < requested_pie_slice)
- {
- gAttachBodyPartPieMenus[group]->addSeparator();
- gDetachBodyPartPieMenus[group]->addSeparator();
- cur_pie_slice++;
- }
LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL);
if (attachment)
@@ -520,7 +512,6 @@ BOOL LLVOAvatarSelf::buildMenus()
item_params.on_enable.parameter = attach_index;
item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
gDetachBodyPartPieMenus[group]->addChild(item);
- cur_pie_slice++;
}
}
}
@@ -1039,7 +1030,7 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view
if (attachment->isObjectAttached(viewer_object))
{
const LLUUID& attachment_id = viewer_object->getItemID();
- LLAppearanceManager::registerAttachment(attachment_id);
+ LLAppearanceManager::instance().registerAttachment(attachment_id);
}
return attachment;
@@ -1078,7 +1069,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
}
else
{
- LLAppearanceManager::unregisterAttachment(attachment_id);
+ LLAppearanceManager::instance().unregisterAttachment(attachment_id);
}
return TRUE;
@@ -1587,7 +1578,7 @@ void LLVOAvatarSelf::dumpLocalTextures() const
llinfos << "LocTex " << name << ": Baked " << getTEImage(baked_equiv)->getID() << llendl;
#endif
}
- else if (local_tex_obj->getImage() != NULL)
+ else if (local_tex_obj && local_tex_obj->getImage() != NULL)
{
if (local_tex_obj->getImage()->getID() == IMG_DEFAULT_AVATAR)
{
diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml
index 8b6ab4e4d8..c86d32c8c4 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory.xml
@@ -434,9 +434,9 @@
<menu_item_separator
layout="topleft" />
<menu_item_call
- label="Take Off Items"
+ label="Remove From Outfit"
layout="topleft"
- name="Take Off Items">
+ name="Remove From Outfit">
<menu_item_call.on_click
function="Inventory.DoToSelected"
parameter="removefromoutfit" />