Skip to content
Snippets Groups Projects
Commit 850c0f1e authored by Eric Tulla's avatar Eric Tulla
Browse files

Merge of latest avatar pipeline working branch into viewer2.0 branch.

parent adaae9e0
No related branches found
No related tags found
No related merge requests found
......@@ -112,12 +112,12 @@ LLAssetDictionary::LLAssetDictionary()
ensemble_num <= S32(LLAssetType::AT_FOLDER_ENSEMBLE_END);
ensemble_num++)
{
addEntry(LLAssetType::EType(ensemble_num), new AssetEntry("ENSEMBLE", "ensemble", "ensemble", "New Folder", DAD_CATEGORY, TRUE, FALSE));
addEntry(LLAssetType::EType(ensemble_num), new AssetEntry("ENSEMBLE", "ensemble", "ensemble", "New Folder", DAD_CATEGORY, FALSE, FALSE));
}
addEntry(LLAssetType::AT_CURRENT_OUTFIT, new AssetEntry("CURRENT", "current", "current outfit", "Current Outfit", DAD_CATEGORY, FALSE, TRUE));
addEntry(LLAssetType::AT_OUTFIT, new AssetEntry("OUTFIT", "outfit", "outfit", "New Outfit", DAD_CATEGORY, TRUE, FALSE));
addEntry(LLAssetType::AT_MY_OUTFITS, new AssetEntry("MY_OUTFITS", "my_otfts", "my outfits", "My Outfits", DAD_CATEGORY, FALSE, TRUE));
addEntry(LLAssetType::AT_CURRENT_OUTFIT, new AssetEntry("CURRENT", "current", "current outfit", "Current Look", DAD_CATEGORY, FALSE, TRUE));
addEntry(LLAssetType::AT_OUTFIT, new AssetEntry("OUTFIT", "outfit", "outfit", "New Look", DAD_CATEGORY, FALSE, FALSE));
addEntry(LLAssetType::AT_MY_OUTFITS, new AssetEntry("MY_OUTFITS", "my_otfts", "my outfits", "My Looks", DAD_CATEGORY, FALSE, TRUE));
addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, "New Folder", DAD_NONE, FALSE, FALSE));
};
......@@ -211,7 +211,7 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_
iter++)
{
const AssetEntry *entry = iter->second;
if (readable_name == entry->mHumanName)
if (entry->mHumanName && (readable_name == entry->mHumanName))
{
return iter->first;
}
......
......@@ -418,11 +418,7 @@ void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventory
if (!append && total_links > 0)
{
for (S32 i = 0; i < cof_items.count(); ++i)
{
gInventory.purgeObject(cof_items.get(i)->getUUID());
}
gInventory.notifyObservers();
purgeCOFBeforeRebuild(category);
}
LLPointer<LLUpdateAppearanceOnDestroy> link_waiter = new LLUpdateAppearanceOnDestroy;
......@@ -521,6 +517,68 @@ void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventory
}
}
/* 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)
{
......@@ -539,29 +597,17 @@ void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventory
return;
}
const LLUUID &current_outfit_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_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);
//dumpCat(current_outfit_id,"COF before remove:");
if (items.count() > 0)
{
for (S32 i = 0; i < cof_items.count(); ++i)
{
gInventory.purgeObject(cof_items.get(i)->getUUID());
}
gInventory.notifyObservers();
}
//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:");
......@@ -907,6 +953,7 @@ void LLAppearanceManager::wearItem( LLInventoryItem* item, bool do_update )
/* static */
void LLAppearanceManager::wearEnsemble( LLInventoryCategory* cat, bool do_update )
{
#if SUPPORT_ENSEMBLES
// BAP add check for already in COF.
LLPointer<LLInventoryCallback> cb = do_update ? new ModifiedCOFCallback : 0;
link_inventory_item( gAgent.getID(),
......@@ -915,6 +962,7 @@ void LLAppearanceManager::wearEnsemble( LLInventoryCategory* cat, bool do_update
cat->getName(),
LLAssetType::AT_LINK_FOLDER,
cb);
#endif
}
/* static */
......
......@@ -78,6 +78,11 @@ class LLAppearanceManager: public LLSingleton<LLAppearanceManager>
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);
};
#define SUPPORT_ENSEMBLES 0
#endif
......@@ -1170,7 +1170,8 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p)
mSortOrderSetting(p.sort_order_setting),
mInventory(p.inventory),
mAllowMultiSelect(p.allow_multi_select),
mHasInventoryConnection(false)
mHasInventoryConnection(false),
mStartFolderString(p.start_folder)
{
// contex menu callbacks
mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLInventoryPanel::doToSelected, this, _2));
......@@ -1230,15 +1231,21 @@ BOOL LLInventoryPanel::postBuild()
// build everything.
mInventoryObserver = new LLInventoryPanelObserver(this);
mInventory->addObserver(mInventoryObserver);
// determine the root folder, if any, so inventory contents show just the children
// of that folder (i.e. not including the folder itself).
const LLAssetType::EType preferred_type = LLAssetType::lookupHumanReadable(mStartFolderString);
mStartFolderID = (preferred_type != LLAssetType::AT_NONE ? gInventory.findCategoryUUIDForType(preferred_type) : LLUUID::null);
// build view of inventory if inventory ready, otherwise wait for modelChanged() callback
if (mInventory->isInventoryUsable() && !mHasInventoryConnection)
{
rebuildViewsFor(LLUUID::null, LLInventoryObserver::ADD);
rebuildViewsFor(mStartFolderID);
mHasInventoryConnection = true;
}
// bit of a hack to make sure the inventory is open.
mFolders->openFolder(std::string("My Inventory"));
mFolders->openFolder(preferred_type != LLAssetType::AT_NONE ? LLAssetType::lookupCategoryName(preferred_type) : "My Inventory");
if (mSortOrderSetting != INHERIT_SORT_ORDER)
{
......@@ -1271,7 +1278,7 @@ LLInventoryPanel::~LLInventoryPanel()
mScroller = NULL;
}
LLMemType mt(LLMemType::MTYPE_INVENTORY_FROM_XML);
LLMemType mt(LLMemType::MTYPE_INVENTORY_FROM_XML); // ! BUG ! Should this be removed?
void LLInventoryPanel::draw()
{
// select the desired item (in case it wasn't loaded when the selection was requested)
......@@ -1336,7 +1343,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
// inventory just initialized, do complete build
if ((mask & LLInventoryObserver::ADD) && gInventory.getChangedIDs().empty() && !mHasInventoryConnection)
{
rebuildViewsFor(LLUUID::null, LLInventoryObserver::ADD);
rebuildViewsFor(mStartFolderID);
mHasInventoryConnection = true;
return;
}
......@@ -1449,7 +1456,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
}
}
void LLInventoryPanel::rebuildViewsFor(const LLUUID& id, U32 mask)
void LLInventoryPanel::rebuildViewsFor(const LLUUID& id)
{
LLFolderViewItem* old_view = NULL;
......@@ -1467,8 +1474,13 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
{
LLMemType mt(LLMemType::MTYPE_INVENTORY_BUILD_NEW_VIEWS);
LLFolderViewItem* itemp = NULL;
LLInventoryObject* objectp = gInventory.getObject(id);
LLInventoryObject* objectp = NULL;
// Don't add the start folder (the inventory panel will show contents
// beginning with the children of the starting folder, excluding the starting folder itself).
if (id != mStartFolderID)
{
objectp = gInventory.getObject(id);
if (objectp)
{
if (objectp->getType() <= LLAssetType::AT_NONE ||
......@@ -1491,8 +1503,7 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
{
LLFolderViewFolder::Params p;
p.name = new_listener->getDisplayName();
p.icon = LLUI::getUIImage("Inv_FolderClosed");
p.icon_open = LLUI::getUIImage("Inv_FolderOpen");
p.icon = new_listener->getIcon();
p.root = mFolders;
p.listener = new_listener;
LLFolderViewFolder* folderp = LLUICtrlFactory::create<LLFolderViewFolder>(p);
......@@ -1525,10 +1536,20 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
}
}
LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolders->getItemByID(objectp->getParentUUID());
if (itemp)
{
const LLUUID &parent_id = objectp->getParentUUID();
LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolders->getItemByID(parent_id);
// If this item's parent is the starting folder, then just add it to the top level (recall that
// the starting folder isn't actually represented in the view, parent_folder would be NULL in
// this case otherwise).
if (parent_id == mStartFolderID)
{
parent_folder = mFolders;
}
if (parent_folder)
{
itemp->addToFolder(parent_folder, mFolders);
......@@ -1540,8 +1561,12 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
}
}
}
if ((id.isNull() ||
(objectp && objectp->getType() == LLAssetType::AT_CATEGORY)))
}
// If this is a folder, add the children of the folder and recursively add any
// child folders.
if ((id == mStartFolderID) ||
(objectp && objectp->getType() == LLAssetType::AT_CATEGORY))
{
LLViewerInventoryCategory::cat_array_t* categories;
LLViewerInventoryItem::item_array_t* items;
......
......@@ -94,12 +94,14 @@ class LLInventoryPanel : public LLPanel
Optional<LLInventoryModel*> inventory;
Optional<bool> allow_multi_select;
Optional<Filter> filter;
Optional<std::string> start_folder;
Params()
: sort_order_setting("sort_order_setting"),
inventory("", &gInventory),
allow_multi_select("allow_multi_select", true),
filter("filter")
filter("filter"),
start_folder("start_folder")
{}
};
......@@ -169,16 +171,20 @@ class LLInventoryPanel : public LLPanel
protected:
// Given the id and the parent, build all of the folder views.
void rebuildViewsFor(const LLUUID& id, U32 mask);
void rebuildViewsFor(const LLUUID& id);
void buildNewViews(const LLUUID& id);
protected:
LLInventoryModel* mInventory;
LLInventoryObserver* mInventoryObserver;
LLFolderView* mFolders;
LLScrollContainer* mScroller;
BOOL mAllowMultiSelect;
std::string mSortOrderSetting;
private:
LLFolderView* mFolders;
std::string mStartFolderString;
LLUUID mStartFolderID;
LLScrollContainer* mScroller;
bool mHasInventoryConnection;
};
......
......@@ -104,8 +104,6 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
Mandatory<LLPanel*> parent_panel;
Optional<LLUUID> task_id;
};
LLFolderView( const std::string& name, LLUIImagePtr root_folder_icon, const LLRect& rect,
const LLUUID& source_id, LLPanel *parent_view );
LLFolderView(const Params&);
virtual ~LLFolderView( void );
......
......@@ -487,6 +487,11 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
return FALSE;
}
}
const LLViewerInventoryCategory *cat = model->getCategory(objects.get(i));
if (cat && !LLAssetType::lookupCanLink(cat->getPreferredType()))
{
return FALSE;
}
}
return TRUE;
}
......@@ -1581,6 +1586,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
// if target is an outfit or current outfit folder we use link
if (move_is_into_current_outfit || move_is_into_outfit)
{
#if SUPPORT_ENSEMBLES
// BAP - should skip if dup.
if (move_is_into_current_outfit)
{
......@@ -1597,6 +1603,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
LLAssetType::AT_LINK_FOLDER,
cb);
}
#endif
}
else
{
......@@ -1978,6 +1985,7 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model
modifyOutfit(FALSE);
return;
}
#if SUPPORT_ENSEMBLES
else if ("wearasensemble" == action)
{
LLInventoryModel* model = getInventoryModel();
......@@ -1987,6 +1995,7 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model
LLAppearanceManager::wearEnsemble(cat,true);
return;
}
#endif
else if ("addtooutfit" == action)
{
modifyOutfit(TRUE);
......@@ -2205,6 +2214,7 @@ void LLFolderBridge::pasteLinkFromClipboard()
for(S32 i = 0; i < count; i++)
{
const LLUUID &object_id = objects.get(i);
#if SUPPORT_ENSEMBLES
if (LLInventoryCategory *cat = model->getCategory(object_id))
{
link_inventory_item(
......@@ -2215,7 +2225,9 @@ void LLFolderBridge::pasteLinkFromClipboard()
LLAssetType::AT_LINK_FOLDER,
LLPointer<LLInventoryCallback>(NULL));
}
else if (LLInventoryItem *item = model->getItem(object_id))
else
#endif
if (LLInventoryItem *item = model->getItem(object_id))
{
link_inventory_item(
gAgent.getID(),
......
......@@ -612,9 +612,9 @@ void LLViewerInventoryCategory::determineFolderType()
const LLViewerInventoryItem *item = (*item_iter);
if (item->getIsLinkType())
return;
if (item->getInventoryType() == LLInventoryType::IT_WEARABLE)
if (item->isWearableType())
{
const EWearableType wearable_type = EWearableType(item->getFlags() & LLInventoryItem::II_FLAGS_WEARABLES_MASK);
const EWearableType wearable_type = item->getWearableType();
const std::string& wearable_name = LLWearableDictionary::getTypeName(wearable_type);
U64 valid_folder_types = LLFolderType::lookupValidFolderTypes(wearable_name);
folder_valid |= valid_folder_types;
......@@ -1278,6 +1278,22 @@ U32 LLViewerInventoryItem::getFlags() const
return LLInventoryItem::getFlags();
}
bool LLViewerInventoryItem::isWearableType() const
{
return (getInventoryType() == LLInventoryType::IT_WEARABLE);
}
EWearableType LLViewerInventoryItem::getWearableType() const
{
if (!isWearableType())
{
llwarns << "item is not a wearable" << llendl;
return WT_INVALID;
}
return EWearableType(getFlags() & LLInventoryItem::II_FLAGS_WEARABLES_MASK);
}
time_t LLViewerInventoryItem::getCreationDate() const
{
return LLInventoryItem::getCreationDate();
......
......@@ -74,6 +74,8 @@ class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::tr
virtual const std::string& getDescription() const;
virtual const LLSaleInfo& getSaleInfo() const;
virtual LLInventoryType::EType getInventoryType() const;
virtual bool isWearableType() const;
virtual EWearableType getWearableType() const;
virtual U32 getFlags() const;
virtual time_t getCreationDate() const;
virtual U32 getCRC32() const; // really more of a checksum.
......
......@@ -457,14 +457,6 @@
function="Inventory.DoToSelected"
parameter="replaceoutfit" />
</menu_item_call>
<menu_item_call
label="Wear As Ensemble"
layout="topleft"
name="Wear As Ensemble">
<menu_item_call.on_click
function="Inventory.DoToSelected"
parameter="wearasensemble" />
</menu_item_call>
<menu_item_separator
layout="topleft" />
<menu_item_call
......
......@@ -18,6 +18,7 @@
left="0"
mouse_opaque="true"
name="landmarks_list"
start_folder="landmark"
width="380"/>
<button
bottom="0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment