summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
authorGraham Madarasz <graham@lindenlab.com>2013-04-25 21:00:16 -0700
committerGraham Madarasz <graham@lindenlab.com>2013-04-25 21:00:16 -0700
commitfd447189c5e05df53cd8ec0a4168370c03c3bb16 (patch)
tree484b5075ff9c977dd29679c87f6eaa08144b292f /indra/newview/llinventorybridge.cpp
parentb1d608ee99824fde13f3f16e0947ec5b54299fca (diff)
parent2dc4f8f8e98da565c158ec9947fe96eccd4920e9 (diff)
Merge 3.5.1 into Materials
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/llinventorybridge.cpp221
1 files changed, 9 insertions, 212 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 0ee78d57bd..a5043a30ac 100644..100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -51,6 +51,7 @@
#include "llclipboard.h"
#include "llinventorydefines.h"
#include "llinventoryfunctions.h"
+#include "llinventoryicon.h"
#include "llinventorymodel.h"
#include "llinventorymodelbackgroundfetch.h"
#include "llinventorypanel.h"
@@ -96,8 +97,6 @@ struct LLMoveInv
using namespace LLOldEvents;
// Function declarations
-void remove_inventory_category_from_avatar(LLInventoryCategory* category);
-void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id);
bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*);
bool confirm_attachment_rez(const LLSD& notification, const LLSD& response);
void teleport_via_landmark(const LLUUID& asset_id);
@@ -1545,7 +1544,7 @@ LLUIImagePtr LLItemBridge::getIcon() const
mIsLink);
}
- return LLInventoryIcon::getIcon(LLInventoryIcon::ICONNAME_OBJECT);
+ return LLInventoryIcon::getIcon(LLInventoryType::ICONNAME_OBJECT);
}
LLUIImagePtr LLItemBridge::getIconOverlay() const
@@ -2649,7 +2648,6 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
if(drop && accept)
{
it = inventory_objects.begin();
- LLInventoryObject::object_list_t::iterator first_it = inventory_objects.begin();
LLMoveInv* move_inv = new LLMoveInv;
move_inv->mObjectID = object_id;
move_inv->mCategoryID = category_id;
@@ -2926,7 +2924,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
LLViewerInventoryCategory* cat = getCategory();
if(!cat) return;
- remove_inventory_category_from_avatar ( cat );
+ LLAppearanceMgr::instance().takeOffOutfit( cat->getLinkedUUID() );
return;
}
else if ("purge" == action)
@@ -5236,7 +5234,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action)
else if(item && item->isFinished())
{
// must be in library. copy it to our inventory and put it on.
- LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0);
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0));
copy_inventory_item(
gAgent.getID(),
item->getPermissions().getOwner(),
@@ -5253,11 +5251,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action)
}
else if (isRemoveAction(action))
{
- LLInventoryItem* item = gInventory.getItem(mUUID);
- if(item)
- {
- LLVOAvatarSelf::detachAttachmentIntoInventory(item->getLinkedUUID());
- }
+ LLAppearanceMgr::instance().removeItemFromAvatar(mUUID);
}
else LLItemBridge::performAction(model, action);
}
@@ -5549,120 +5543,6 @@ LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory,
mInvType = inv_type;
}
-void remove_inventory_category_from_avatar( LLInventoryCategory* category )
-{
- if(!category) return;
- lldebugs << "remove_inventory_category_from_avatar( " << category->getName()
- << " )" << llendl;
-
-
- if (gAgentCamera.cameraCustomizeAvatar())
- {
- // switching to outfit editor should automagically save any currently edited wearable
- LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit"));
- }
-
- remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() );
-}
-
-struct OnRemoveStruct
-{
- LLUUID mUUID;
- OnRemoveStruct(const LLUUID& uuid):
- mUUID(uuid)
- {
- }
-};
-
-void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id)
-{
-
- // Find all the wearables that are in the category's subtree.
- lldebugs << "remove_inventory_category_from_avatar_step2()" << llendl;
- if(proceed)
- {
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- LLFindWearables is_wearable;
- gInventory.collectDescendentsIf(category_id,
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- is_wearable);
- S32 i;
- S32 wearable_count = item_array.count();
-
- LLInventoryModel::cat_array_t obj_cat_array;
- LLInventoryModel::item_array_t obj_item_array;
- LLIsType is_object( LLAssetType::AT_OBJECT );
- gInventory.collectDescendentsIf(category_id,
- obj_cat_array,
- obj_item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- is_object);
- S32 obj_count = obj_item_array.count();
-
- // Find all gestures in this folder
- LLInventoryModel::cat_array_t gest_cat_array;
- LLInventoryModel::item_array_t gest_item_array;
- LLIsType is_gesture( LLAssetType::AT_GESTURE );
- gInventory.collectDescendentsIf(category_id,
- gest_cat_array,
- gest_item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- is_gesture);
- S32 gest_count = gest_item_array.count();
-
- if (wearable_count > 0) //Loop through wearables. If worn, remove.
- {
- for(i = 0; i < wearable_count; ++i)
- {
- LLViewerInventoryItem *item = item_array.get(i);
- if (item->getType() == LLAssetType::AT_BODYPART)
- continue;
- if (gAgent.isTeen() && item->isWearableType() &&
- (item->getWearableType() == LLWearableType::WT_UNDERPANTS || item->getWearableType() == LLWearableType::WT_UNDERSHIRT))
- continue;
- if (get_is_item_worn(item->getUUID()))
- {
- LLWearableList::instance().getAsset(item->getAssetUUID(),
- item->getName(),
- item->getType(),
- LLWearableBridge::onRemoveFromAvatarArrived,
- new OnRemoveStruct(item->getLinkedUUID()));
- }
- }
- }
-
- if (obj_count > 0)
- {
- for(i = 0; i < obj_count; ++i)
- {
- LLViewerInventoryItem *obj_item = obj_item_array.get(i);
- if (get_is_item_worn(obj_item->getUUID()))
- {
- LLVOAvatarSelf::detachAttachmentIntoInventory(obj_item->getLinkedUUID());
- }
- }
- }
-
- if (gest_count > 0)
- {
- for(i = 0; i < gest_count; ++i)
- {
- LLViewerInventoryItem *gest_item = gest_item_array.get(i);
- if (get_is_item_worn(gest_item->getUUID()))
- {
- LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() );
- gInventory.updateItem( gest_item );
- gInventory.notifyObservers();
- }
-
- }
- }
- }
-}
-
BOOL LLWearableBridge::renameItem(const std::string& new_name)
{
if (get_is_item_worn(mUUID))
@@ -5873,7 +5753,7 @@ void LLWearableBridge::wearAddOnAvatar()
}
// static
-void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata )
+void LLWearableBridge::onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata )
{
LLUUID* item_id = (LLUUID*) userdata;
if(wearable)
@@ -5899,7 +5779,7 @@ void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userda
// static
// BAP remove the "add" code path once everything is fully COF-ified.
-void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata )
+void LLWearableBridge::onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata )
{
LLUUID* item_id = (LLUUID*) userdata;
if(wearable)
@@ -5959,95 +5839,12 @@ BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data)
return FALSE;
}
-// static
-void LLWearableBridge::onRemoveFromAvatar(void* user_data)
-{
- LLWearableBridge* self = (LLWearableBridge*)user_data;
- if(!self) return;
- if(get_is_item_worn(self->mUUID))
- {
- LLViewerInventoryItem* item = self->getItem();
- if (item)
- {
- LLUUID parent_id = item->getParentUUID();
- LLWearableList::instance().getAsset(item->getAssetUUID(),
- item->getName(),
- item->getType(),
- onRemoveFromAvatarArrived,
- new OnRemoveStruct(LLUUID(self->mUUID)));
- }
- }
-}
-
-// static
-void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
- void* userdata)
-{
- OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata;
- const LLUUID &item_id = gInventory.getLinkedItemID(on_remove_struct->mUUID);
- if(wearable)
- {
- if( get_is_item_worn( item_id ) )
- {
- LLWearableType::EType type = wearable->getType();
-
- if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES ) ) //&&
- //!((!gAgent.isTeen()) && ( type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT )) )
- {
- bool do_remove_all = false;
- U32 index = gAgentWearables.getWearableIndex(wearable);
- gAgentWearables.removeWearable( type, do_remove_all, index );
- }
- }
- }
-
- // Find and remove this item from the COF.
- LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
- gInventory.notifyObservers();
-
- delete on_remove_struct;
-}
-
-// static
-void LLWearableBridge::removeAllClothesFromAvatar()
-{
- // Fetch worn clothes (i.e. the ones in COF).
- LLInventoryModel::item_array_t clothing_items;
- LLInventoryModel::cat_array_t dummy;
- LLIsType is_clothing(LLAssetType::AT_CLOTHING);
- gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(),
- dummy,
- clothing_items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_clothing,
- false);
-
- // Take them off by removing from COF.
- for (LLInventoryModel::item_array_t::const_iterator it = clothing_items.begin(); it != clothing_items.end(); ++it)
- {
- LLAppearanceMgr::instance().removeItemFromAvatar((*it)->getUUID());
- }
-}
-
-// static
-void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item)
-{
- if (item)
- {
- LLWearableList::instance().getAsset(item->getAssetUUID(),
- item->getName(),
- item->getType(),
- LLWearableBridge::onRemoveFromAvatarArrived,
- new OnRemoveStruct(item->getUUID()));
- }
-}
-
void LLWearableBridge::removeFromAvatar()
{
+ llwarns << "safe to remove?" << llendl;
if (get_is_item_worn(mUUID))
{
- LLViewerInventoryItem* item = getItem();
- removeItemFromAvatar(item);
+ LLAppearanceMgr::instance().removeItemFromAvatar(mUUID);
}
}