summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llagentwearables.cpp75
-rw-r--r--indra/newview/llagentwearables.h21
-rw-r--r--indra/newview/llappearancemgr.cpp53
-rw-r--r--indra/newview/llappearancemgr.h3
-rw-r--r--indra/newview/llfolderviewitem.cpp11
-rw-r--r--indra/newview/llinventorybridge.cpp2
-rw-r--r--indra/newview/llvoavatar.cpp2
-rw-r--r--indra/newview/llvoavatarself.cpp2
-rw-r--r--indra/newview/llwearable.h4
9 files changed, 125 insertions, 48 deletions
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<S32> wearables_to_include;
- getAllWearablesArray(wearables_to_include);
-
- LLDynamicArray<S32> 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<S32>& wearables_to_include,
- const LLDynamicArray<S32>& 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<S32>& wearables_to_include,
- const LLDynamicArray<S32>& 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<LLInventoryCallback> 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<LLInventoryCallback>(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; i<items.count(); i++)
+ {
+ LLViewerInventoryItem *item = items.get(i);
+ if (item)
+ hitcount++;
+ llinfos << i <<" "<< item->getName() <<llendl;
+ }
+#endif
+ llinfos << str << " count " << items.count() << llendl;
+}
+
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 2aa10e0bea..fe24696182 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -64,6 +64,9 @@ public:
// Remove COF entries
static void removeItemLinks(LLUUID& item_id, bool do_update = true);
+ // For debugging - could be moved elsewhere.
+ static void dumpCat(const LLUUID& cat_id, std::string str);
+
private:
static void getCOFValidDescendents(const LLUUID& category,
LLInventoryModel::item_array_t& items);
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 0d432bd398..66881be309 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -600,6 +600,11 @@ BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask )
BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask )
{
+ if (LLView::childrenHandleMouseDown(x, y, mask))
+ {
+ return TRUE;
+ }
+
// No handler needed for focus lost since this class has no
// state that depends on it.
gFocusMgr.setMouseCapture( this );
@@ -719,6 +724,11 @@ BOOL LLFolderViewItem::handleScrollWheel(S32 x, S32 y, S32 clicks)
BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask )
{
+ if (LLView::childrenHandleMouseUp(x, y, mask))
+ {
+ return TRUE;
+ }
+
// if mouse hasn't moved since mouse down...
if ( pointInView(x, y) && mSelectPending )
{
@@ -968,6 +978,7 @@ void LLFolderViewItem::draw()
}
}
}
+ LLView::draw();
}
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index f2329c2ef5..d4a9324208 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4421,7 +4421,7 @@ void LLWearableBridge::onEditOnAvatar(void* user_data)
void LLWearableBridge::editOnAvatar()
{
- const LLWearable* wearable = gAgentWearables.getWearableFromWearableItem(mUUID);
+ const LLWearable* wearable = gAgentWearables.getWearableFromItemID(mUUID);
if( wearable )
{
// Set the tab to the right wearable.
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 60d64d50b9..9437d8797e 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5501,7 +5501,9 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
}
else
{
+ LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Removing attachment link:");
LLAppearanceManager::removeItemLinks(item_id, false);
+
}
// BAP - needs to change for label to track link.
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 20b8750fbf..76a4bfbf0c 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -987,7 +987,9 @@ LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *viewer_obj
LLViewerInventoryItem *item = gInventory.getItem(attachment->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: