diff options
author | Merov Linden <merov@lindenlab.com> | 2014-09-28 21:40:32 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-09-28 21:40:32 -0700 |
commit | 4b80a5ed059d91bc37558db8ed664365e39d21d6 (patch) | |
tree | 55cfddc381448a72b54c03347deabada9687f629 /indra/newview/llinventorybridge.cpp | |
parent | 896f48229e577b1bcf94f2cb80d73a6bf1a9330c (diff) | |
parent | 499f5aa9a4b46d61ee94b26d5c86bc032766af70 (diff) |
Pull merge from lindenlab/viewer-release
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 114 |
1 files changed, 98 insertions, 16 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index e691ad34d1..e77326dbf4 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -100,6 +100,7 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response bool confirm_attachment_rez(const LLSD& notification, const LLSD& response); void teleport_via_landmark(const LLUUID& asset_id); static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit); +static BOOL can_move_to_landmarks(LLInventoryItem* inv_item); static bool check_category(LLInventoryModel* model, const LLUUID& cat_id, LLInventoryPanel* active_panel, @@ -2373,13 +2374,18 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, && (LLToolDragAndDrop::SOURCE_AGENT == source); BOOL accept = FALSE; + U64 filter_types = filter->getFilterTypes(); + BOOL use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0); + if (is_agent_inventory) { const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false); const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false); + const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS, false); const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id); - const BOOL move_is_into_outfit = getCategory() && (getCategory()->getPreferredType() == LLFolderType::FT_OUTFIT); + const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); + const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); //-------------------------------------------------------------------------------- @@ -2442,6 +2448,29 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } } } + U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit"); + if (is_movable + && move_is_into_current_outfit + && descendent_items.size() > max_items_to_wear) + { + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false); + gInventory.collectDescendentsIf(cat_id, + cats, + items, + LLInventoryModel::EXCLUDE_TRASH, + not_worn); + + if (items.size() > max_items_to_wear) + { + // Can't move 'large' folders into current outfit: MAINT-4086 + is_movable = FALSE; + LLStringUtil::format_map_t args; + args["AMOUNT"] = llformat("%d", max_items_to_wear); + tooltip_msg = LLTrans::getString("TooltipTooManyWearables",args); + } + } if (is_movable && move_is_into_trash) { for (S32 i=0; i < descendent_items.size(); ++i) @@ -2508,7 +2537,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, is_movable = active_folder_view != NULL; } - if (is_movable) + if (is_movable && use_filter) { // Check whether the folder being dragged from active inventory panel // passes the filter of the destination panel. @@ -2701,6 +2730,12 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, BOOL accept = FALSE; BOOL is_move = FALSE; + BOOL use_filter = FALSE; + if (filter) + { + U64 filter_types = filter->getFilterTypes(); + use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0); + } // coming from a task. Need to figure out if the person can // move/copy this item. @@ -2733,7 +2768,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, accept = TRUE; } - if (filter && accept) + if (accept && use_filter) { accept = filter->check(item); } @@ -2946,7 +2981,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) mContentsCount) { gInventory.removeObserver(this); - LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, FALSE); + LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, TRUE); delete this; } } @@ -2964,7 +2999,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLFolderViewFolder *f = dynamic_cast<LLFolderViewFolder *>(mInventoryPanel.get()->getItemByID(mUUID)); if (f) { - f->setOpen(TRUE); + f->toggleOpen(); } return; @@ -3360,13 +3395,17 @@ void LLFolderBridge::perform_pasteFromClipboard() const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - + const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false); + const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS, false); + const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); + const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); + const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - - std::vector<LLUUID> objects; + const BOOL move_is_into_favorites = (mUUID == favorites_id); + + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); if (move_is_into_outbox || move_is_into_marketplacelistings) @@ -3412,11 +3451,18 @@ void LLFolderBridge::perform_pasteFromClipboard() { if (move_is_into_current_outfit || move_is_into_outfit) { - if (can_move_to_outfit(item, move_is_into_current_outfit)) + if (item && can_move_to_outfit(item, move_is_into_current_outfit)) { dropToOutfit(item, move_is_into_current_outfit); } } + else if (move_is_into_favorites) + { + if (item && can_move_to_landmarks(item)) + { + dropToFavorites(item); + } + } else if (LLClipboard::instance().isCutMode()) { // Do a move to "paste" a "cut" @@ -3526,9 +3572,11 @@ void LLFolderBridge::pasteLinkFromClipboard() const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); + const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); + const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); @@ -4055,6 +4103,28 @@ void LLFolderBridge::modifyOutfit(BOOL append) LLViewerInventoryCategory* cat = getCategory(); if(!cat) return; + // checking amount of items to wear + U32 max_items = gSavedSettings.getU32("WearFolderLimit"); + if (cat->getDescendentCount() > max_items) + { + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false); + gInventory.collectDescendentsIf(cat->getUUID(), + cats, + items, + LLInventoryModel::EXCLUDE_TRASH, + not_worn); + + if (items.size() > max_items) + { + LLSD args; + args["AMOUNT"] = llformat("%d", max_items); + LLNotificationsUtil::add("TooManyWearables", args); + return; + } + } + LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, append ); } @@ -4109,6 +4179,12 @@ static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_curr return FALSE; } + U32 flags = inv_item->getFlags(); + if(flags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS) + { + return FALSE; + } + if (move_is_into_current_outfit && get_is_item_worn(inv_item->getUUID())) { return FALSE; @@ -4218,11 +4294,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS, false); const LLUUID from_folder_uuid = inv_item->getParentUUID(); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_favorites = (mUUID == favorites_id); - const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); + const BOOL move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); + const BOOL move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_from_outbox = model->isObjectDescendentOf(inv_item->getUUID(), outbox_id); @@ -4231,6 +4309,10 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); BOOL accept = FALSE; + U64 filter_types = filter->getFilterTypes(); + // We shouldn't allow to drop non recent items into recent tab (or some similar transactions) + // while we are allowing to interact with regular filtered inventory + BOOL use_filter = filter_types && (filter_types&LLInventoryFilter::FILTERTYPE_DATE || (filter_types&LLInventoryFilter::FILTERTYPE_OBJECT)==0); LLViewerObject* object = NULL; if(LLToolDragAndDrop::SOURCE_AGENT == source) { @@ -4308,7 +4390,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // Check whether the item being dragged from active inventory panel // passes the filter of the destination panel. - if (accept && active_panel) + if (accept && active_panel && use_filter) { LLFolderViewItem* fv_item = active_panel->getItemByID(inv_item->getUUID()); if (!fv_item) return false; @@ -4481,7 +4563,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // Check whether the item being dragged from in world // passes the filter of the destination panel. - if (accept) + if (accept && use_filter) { accept = filter->check(inv_item); } @@ -4525,7 +4607,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // Check whether the item being dragged from notecard // passes the filter of the destination panel. - if (accept) + if (accept && use_filter) { accept = filter->check(inv_item); } @@ -4565,7 +4647,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // Check whether the item being dragged from the library // passes the filter of the destination panel. - if (accept && active_panel) + if (accept && active_panel && use_filter) { LLFolderViewItem* fv_item = active_panel->getItemByID(inv_item->getUUID()); if (!fv_item) return false; |