summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryfunctions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rw-r--r--indra/newview/llinventoryfunctions.cpp248
1 files changed, 22 insertions, 226 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index b577e302a8..d2ed7168c5 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -51,7 +51,6 @@
#include "lldirpicker.h"
#include "lldonotdisturbnotificationstorage.h"
#include "llfloatermarketplacelistings.h"
-#include "llfloatermodelpreview.h"
#include "llfloatersidepanelcontainer.h"
#include "llfocusmgr.h"
#include "llfolderview.h"
@@ -63,7 +62,6 @@
#include "llinventorymodel.h"
#include "llinventorypanel.h"
#include "lllineeditor.h"
-#include "llmaterialeditor.h"
#include "llmarketplacenotifications.h"
#include "llmarketplacefunctions.h"
#include "llmenugl.h"
@@ -88,7 +86,6 @@
#include "llviewermessage.h"
#include "llviewerfoldertype.h"
#include "llviewerobjectlist.h"
-#include "llviewermenufile.h"
#include "llviewerregion.h"
#include "llviewerwindow.h"
#include "llvoavatarself.h"
@@ -2175,10 +2172,21 @@ void validate_marketplacelistings(
void change_item_parent(const LLUUID& item_id, const LLUUID& new_parent_id)
{
- LLViewerInventoryItem* inv_item = gInventory.getItem(item_id);
+ LLInventoryItem* inv_item = gInventory.getItem(item_id);
if (inv_item)
{
- gInventory.changeItemParent(inv_item, new_parent_id, false);
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
+ new_item->setParent(new_parent_id);
+ new_item->updateParentOnServer(false);
+ gInventory.updateItem(new_item);
+ gInventory.notifyObservers();
}
}
@@ -2186,17 +2194,17 @@ void move_items_to_folder(const LLUUID& new_cat_uuid, const uuid_vec_t& selected
{
for (uuid_vec_t::const_iterator it = selected_uuids.begin(); it != selected_uuids.end(); ++it)
{
- LLViewerInventoryItem* inv_item = gInventory.getItem(*it);
+ LLInventoryItem* inv_item = gInventory.getItem(*it);
if (inv_item)
{
- gInventory.changeItemParent(inv_item, new_cat_uuid, false);
+ change_item_parent(*it, new_cat_uuid);
}
else
{
- LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
+ LLInventoryCategory* inv_cat = gInventory.getCategory(*it);
if (inv_cat && !LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()))
{
- gInventory.changeCategoryParent(inv_cat, new_cat_uuid, false);
+ gInventory.changeCategoryParent((LLViewerInventoryCategory*)inv_cat, new_cat_uuid, false);
}
}
}
@@ -2342,9 +2350,9 @@ bool can_move_to_my_outfits_as_outfit(LLInventoryModel* model, LLInventoryCatego
return false;
}
- if (items->size() == 0)
+ if (items->size() == 0 && inv_cat->getPreferredType() != LLFolderType::FT_OUTFIT)
{
- // Nothing to move(create)
+ // Nothing to create an outfit folder from
return false;
}
@@ -2480,143 +2488,6 @@ void ungroup_folder_items(const LLUUID& folder_id)
gInventory.notifyObservers();
}
-class LLUpdateFavorite : public LLInventoryCallback
-{
-public:
- LLUpdateFavorite(const LLUUID& inv_item_id)
- : mInvItemID(inv_item_id)
- {}
- /* virtual */ void fire(const LLUUID& inv_item_id) override
- {
- gInventory.addChangedMask(LLInventoryObserver::UPDATE_FAVORITE, mInvItemID);
-
- LLInventoryModel::item_array_t items;
- LLInventoryModel::cat_array_t cat_array;
- LLLinkedItemIDMatches matches(mInvItemID);
- gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
- cat_array,
- items,
- LLInventoryModel::INCLUDE_TRASH,
- matches);
-
- std::set<LLUUID> link_ids;
- for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
- {
- LLPointer<LLViewerInventoryItem> item = *it;
-
- gInventory.addChangedMask(LLInventoryObserver::UPDATE_FAVORITE, item->getUUID());
- }
-
- gInventory.notifyObservers();
- }
-private:
- LLUUID mInvItemID;
-};
-
-void favorite_send(LLInventoryObject* obj, const LLUUID& obj_id, bool favorite)
-{
- LLSD updates;
- if (favorite)
- {
- updates["favorite"] = LLSD().with("toggled", true);
- }
- else
- {
- updates["favorite"] = LLSD();
- }
-
- LLPointer<LLInventoryCallback> cb = new LLUpdateFavorite(obj_id);
-
- LLViewerInventoryCategory* view_folder = dynamic_cast<LLViewerInventoryCategory*>(obj);
- if (view_folder)
- {
- update_inventory_category(obj_id, updates, cb);
- }
- LLViewerInventoryItem* view_item = dynamic_cast<LLViewerInventoryItem*>(obj);
- if (view_item)
- {
- update_inventory_item(obj_id, updates, cb);
- }
-}
-
-bool get_is_favorite(const LLInventoryObject* object)
-{
- if (object->getIsLinkType())
- {
- LLInventoryObject* obj = gInventory.getObject(object->getLinkedUUID());
- return obj && obj->getIsFavorite();
- }
-
- return object->getIsFavorite();
-}
-
-bool get_is_favorite(const LLUUID& obj_id)
-{
- LLInventoryObject* object = gInventory.getObject(obj_id);
- if (object && object->getIsLinkType())
- {
- LLInventoryObject* obj = gInventory.getObject(object->getLinkedUUID());
- return obj && obj->getIsFavorite();
- }
-
- return object->getIsFavorite();
-}
-
-void set_favorite(const LLUUID& obj_id, bool favorite)
-{
- LLInventoryObject* obj = gInventory.getObject(obj_id);
-
- if (obj && obj->getIsLinkType())
- {
- if (!favorite && obj->getIsFavorite())
- {
- // Links currently aren't supposed to be favorites,
- // instead should show state of the original
- LL_INFOS("Inventory") << "Recovering proper 'favorites' state of a link " << obj_id << LL_ENDL;
- favorite_send(obj, obj_id, false);
- }
- obj = gInventory.getObject(obj->getLinkedUUID());
- }
-
- if (obj && obj->getIsFavorite() != favorite)
- {
- favorite_send(obj, obj->getUUID(), favorite);
- }
-}
-
-void toggle_favorite(const LLUUID& obj_id)
-{
- LLInventoryObject* obj = gInventory.getObject(obj_id);
- if (obj && obj->getIsLinkType())
- {
- obj = gInventory.getObject(obj->getLinkedUUID());
- }
-
- if (obj)
- {
- favorite_send(obj, obj->getUUID(), !obj->getIsFavorite());
- }
-}
-
-void toggle_favorites(const uuid_vec_t& ids)
-{
- if (ids.size() == 0)
- {
- return;
- }
- if (ids.size() == 1)
- {
- toggle_favorite(ids[0]);
- return;
- }
-
- bool new_val = !get_is_favorite(ids.front());
- for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
- {
- set_favorite(*it, new_val);
- }
-}
-
std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id)
{
if (model)
@@ -2951,20 +2822,6 @@ bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryIt
return false;
}
-bool LLFavoritesCollector::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
-{
- if (item && item->getIsFavorite())
- {
- return true;
- }
- if (cat && cat->getIsFavorite())
- {
- return true;
- }
- return false;
-}
-
bool LLBuddyCollector::operator()(LLInventoryCategory* cat,
LLInventoryItem* item)
{
@@ -3449,7 +3306,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
for (LLInventoryModel::item_array_t::value_type& item : items)
{
- if (!item->getIsLinkType() && get_is_item_worn(item))
+ if (get_is_item_worn(item))
{
has_worn = true;
LLWearableType::EType type = item->getWearableType();
@@ -3469,7 +3326,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
}
}
LLViewerInventoryItem* item = gInventory.getItem(obj_id);
- if (item && !item->getIsLinkType() && get_is_item_worn(item))
+ if (item && get_is_item_worn(item))
{
has_worn = true;
LLWearableType::EType type = item->getWearableType();
@@ -3675,6 +3532,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
}
else if ("new_folder_from_selected" == action)
{
+
LLInventoryObject* first_item = gInventory.getObject(*ids.begin());
if (!first_item)
{
@@ -3718,20 +3576,6 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
ungroup_folder_items(*ids.begin());
}
}
- else if ("add_to_favorites" == action)
- {
- for (const LLUUID& id : ids)
- {
- set_favorite(id, true);
- }
- }
- else if ("remove_from_favorites" == action)
- {
- for (const LLUUID& id : ids)
- {
- set_favorite(id, false);
- }
- }
else if ("thumbnail" == action)
{
if (selected_items.size() > 0)
@@ -3842,54 +3686,6 @@ void LLInventoryAction::removeItemFromDND(LLFolderView* root)
}
}
-void LLInventoryAction::fileUploadLocation(const LLUUID& dest_id, const std::string& action)
-{
- if (action == "def_model")
- {
- gSavedPerAccountSettings.setString("ModelUploadFolder", dest_id.asString());
- }
- else if (action == "def_texture")
- {
- gSavedPerAccountSettings.setString("TextureUploadFolder", dest_id.asString());
- }
- else if (action == "def_sound")
- {
- gSavedPerAccountSettings.setString("SoundUploadFolder", dest_id.asString());
- }
- else if (action == "def_animation")
- {
- gSavedPerAccountSettings.setString("AnimationUploadFolder", dest_id.asString());
- }
- else if (action == "def_pbr_material")
- {
- gSavedPerAccountSettings.setString("PBRUploadFolder", dest_id.asString());
- }
- else if (action == "upload_texture")
- {
- LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2, dest_id), LLFilePicker::FFLOAD_IMAGE, false);
- }
- else if (action == "upload_sound")
- {
- LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2, dest_id), LLFilePicker::FFLOAD_WAV, false);
- }
- else if (action == "upload_animation")
- {
- LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2, dest_id), LLFilePicker::FFLOAD_ANIM, false);
- }
- else if (action == "upload_model")
- {
- LLFloaterModelPreview::showModelPreview(dest_id);
- }
- else if (action == "upload_pbr_material")
- {
- LLMaterialEditor::importMaterial(dest_id);
- }
- else if (action == "upload_bulk")
- {
- LLFilePickerReplyThread::startPicker(boost::bind(&upload_bulk, _1, _2, true, dest_id), LLFilePicker::FFLOAD_ALL, true);
- }
-}
-
void LLInventoryAction::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFolderView> root)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);