summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp78
1 files changed, 33 insertions, 45 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index d876647692..bc1a3cd0af 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -238,8 +238,7 @@ void LLInvFVBridge::renameLinkedItems(const LLUUID &item_id, const std::string&
return;
}
- LLInventoryModel::item_array_t item_array;
- model->collectLinkedItems(item_id, item_array);
+ LLInventoryModel::item_array_t item_array = model->collectLinkedItems(item_id);
for (LLInventoryModel::item_array_t::iterator iter = item_array.begin();
iter != item_array.end();
iter++)
@@ -1242,7 +1241,6 @@ BOOL LLItemBridge::renameItem(const std::string& new_name)
buildDisplayName(new_item, mDisplayName);
new_item->updateServer(FALSE);
model->updateItem(new_item);
- model->updateLinkedObjects(item->getUUID());
model->notifyObservers();
}
@@ -1292,7 +1290,7 @@ BOOL LLItemBridge::isItemCopyable() const
return FALSE;
}
- if( avatarp->isWearingAttachment( mUUID, TRUE ) )
+ if(avatarp->isWearingAttachment(mUUID))
{
return FALSE;
}
@@ -1416,7 +1414,7 @@ BOOL LLFolderBridge::isItemRemovable()
if( (item->getType() == LLAssetType::AT_CLOTHING) ||
(item->getType() == LLAssetType::AT_BODYPART) )
{
- if( gAgentWearables.isWearingItem( item->getUUID(), TRUE ) )
+ if(gAgentWearables.isWearingItem(item->getUUID()))
{
return FALSE;
}
@@ -1424,7 +1422,7 @@ BOOL LLFolderBridge::isItemRemovable()
else
if( item->getType() == LLAssetType::AT_OBJECT )
{
- if( avatar->isWearingAttachment( item->getUUID(), TRUE ) )
+ if(avatar->isWearingAttachment(item->getUUID()))
{
return FALSE;
}
@@ -2207,7 +2205,6 @@ BOOL LLFolderBridge::renameItem(const std::string& new_name)
new_cat->rename(new_name);
new_cat->updateServer(FALSE);
model->updateCategory(new_cat);
- model->updateLinkedObjects(cat->getUUID());
model->notifyObservers();
}
@@ -2855,11 +2852,11 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
{
case LLAssetType::AT_CLOTHING:
case LLAssetType::AT_BODYPART:
- is_movable = !gAgentWearables.isWearingItem(inv_item->getUUID(), TRUE);
+ is_movable = !gAgentWearables.isWearingItem(inv_item->getUUID());
break;
case LLAssetType::AT_OBJECT:
- is_movable = !avatar->isWearingAttachment(inv_item->getUUID(), TRUE);
+ is_movable = !avatar->isWearingAttachment(inv_item->getUUID());
break;
default:
break;
@@ -3769,7 +3766,7 @@ BOOL LLObjectBridge::isItemRemovable()
{
LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
if(!avatar) return FALSE;
- if(avatar->isWearingAttachment(mUUID, TRUE)) return FALSE;
+ if(avatar->isWearingAttachment(mUUID)) return FALSE;
return LLInvFVBridge::isItemRemovable();
}
@@ -3818,16 +3815,13 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
else if ("detach" == action)
{
LLInventoryItem* item = gInventory.getItem(mUUID);
- // In case we clicked on a link, detach the base object instead of the link.
- LLInventoryItem* base_item = gInventory.getItem(item->getLinkedUUID());
- if(base_item)
+ if(item)
{
gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv);
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData );
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_ItemID, base_item->getUUID() );
-
- gMessageSystem->sendReliable( gAgent.getRegion()->getHost() );
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, item->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 =
@@ -4080,7 +4074,6 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
buildDisplayName(new_item, mDisplayName);
new_item->updateServer(FALSE);
model->updateItem(new_item);
- model->updateLinkedObjects(item->getUUID());
model->notifyObservers();
@@ -4180,10 +4173,8 @@ void remove_inventory_category_from_avatar( LLInventoryCategory* category )
struct OnRemoveStruct
{
LLUUID mUUID;
- LLFolderView *mFolderToDeleteSelected;
- OnRemoveStruct(const LLUUID& uuid, LLFolderView *fv = NULL):
- mUUID(uuid),
- mFolderToDeleteSelected(fv)
+ OnRemoveStruct(const LLUUID& uuid):
+ mUUID(uuid)
{
}
};
@@ -4295,7 +4286,7 @@ BOOL LLWearableBridge::renameItem(const std::string& new_name)
BOOL LLWearableBridge::isItemRemovable()
{
- if (gAgentWearables.isWearingItem(mUUID, TRUE)) return FALSE;
+ if (gAgentWearables.isWearingItem(mUUID)) return FALSE;
return LLInvFVBridge::isItemRemovable();
}
@@ -4339,24 +4330,11 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod
LLViewerInventoryItem* item = getItem();
if (item)
{
- if (item->getIsLinkType() &&
- model->isObjectDescendentOf(mUUID,LLAppearanceManager::getCOF()))
- {
- // Delete link after item has been taken off.
- LLWearableList::instance().getAsset(item->getAssetUUID(),
- item->getName(),
- item->getType(),
- LLWearableBridge::onRemoveFromAvatarArrived,
- new OnRemoveStruct(mUUID, folder));
- }
- else
- {
- LLWearableList::instance().getAsset(item->getAssetUUID(),
- item->getName(),
- item->getType(),
- LLWearableBridge::onRemoveFromAvatarArrived,
- new OnRemoveStruct(mUUID));
- }
+ LLWearableList::instance().getAsset(item->getAssetUUID(),
+ item->getName(),
+ item->getType(),
+ LLWearableBridge::onRemoveFromAvatarArrived,
+ new OnRemoveStruct(mUUID));
}
}
}
@@ -4684,7 +4662,7 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
void* userdata)
{
OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata;
- LLUUID item_id = on_remove_struct->mUUID;
+ const LLUUID &item_id = gInventory.getLinkedItemID(on_remove_struct->mUUID);
if(wearable)
{
if( gAgentWearables.isWearingItem( item_id ) )
@@ -4700,10 +4678,20 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
}
}
}
- if (on_remove_struct->mFolderToDeleteSelected)
+
+ // Find and remove this item from the COF.
+ LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(item_id, LLAppearanceManager::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();
+ ++iter)
{
- on_remove_struct->mFolderToDeleteSelected->removeSelectedItems();
+ const LLViewerInventoryItem *linked_item = (*iter);
+ const LLUUID &item_id = linked_item->getUUID();
+ gInventory.purgeObject(item_id);
}
+ gInventory.notifyObservers();
+
delete on_remove_struct;
}