diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-04-03 23:21:25 +0200 |
---|---|---|
committer | Guru <alexandrgproductengine@lindenlab.com> | 2023-04-12 21:03:07 +0200 |
commit | ebbc09551adbf9f03681740987a488a61593acc6 (patch) | |
tree | 6feab6399e6a0d6c0474daee303c5e42ea40ec8e | |
parent | db63f252a275beea884bba9177f8156321bde472 (diff) |
SL-19036: Extra folder is created after dragging the inventory folder
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llinventoryfunctions.h | 12 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 18 |
3 files changed, 58 insertions, 8 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 67240ac7e7..145814ab41 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -213,8 +213,7 @@ bool contains_nocopy_items(const LLUUID& id) return false; } -// Generates a string containing the path to the item specified by -// item_id. +// Generates a string containing the path to the item specified by id. void append_path(const LLUUID& id, std::string& path) { std::string temp; @@ -234,6 +233,36 @@ void append_path(const LLUUID& id, std::string& path) path.append(temp); } +// Generates a string containing the path name of the object. +std::string make_path(const LLInventoryObject* object) +{ + std::string path; + append_path(object->getUUID(), path); + return path + "/" + object->getName(); +} + +// Generates a string containing the path name of the object specified by id. +std::string make_inventory_path(const LLUUID& id) +{ + if (LLInventoryObject* object = gInventory.getObject(id)) + return make_path(object); + return ""; +} + +// Generates a string containing the path name and id of the object. +std::string make_info(const LLInventoryObject* object) +{ + return "'" + make_path(object) + "' (" + object->getUUID().asString() + ")"; +} + +// Generates a string containing the path name and id of the object specified by id. +std::string make_inventory_info(const LLUUID& id) +{ + if (LLInventoryObject* object = gInventory.getObject(id)) + return make_info(object); + return "<Inventory object not found!> (" + id.asString() + ")"; +} + void update_marketplace_folder_hierarchy(const LLUUID cat_id) { // When changing the marketplace status of a folder, the only thing that needs to happen is @@ -1415,6 +1444,7 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol if (copy) { // Copy the item + LL_INFOS("SLM") << "Copy item '" << make_info(viewer_inv_item) << "' to '" << make_inventory_path(dest_folder) << "'" << LL_ENDL; LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, dest_folder)); copy_inventory_item( gAgent.getID(), @@ -1426,6 +1456,7 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol } else { + LL_INFOS("SLM") << "Move item '" << make_info(viewer_inv_item) << "' to '" << make_inventory_path(dest_folder) << "'" << LL_ENDL; // Reparent the item gInventory.changeItemParent(viewer_inv_item, dest_folder, true); } @@ -1472,6 +1503,7 @@ bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU } else { + LL_INFOS("SLM") << "Move category " << make_info(viewer_inv_cat) << " to '" << make_inventory_path(dest_folder) << "'" << LL_ENDL; // Reparent the folder gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); // Check the destination folder recursively for no copy items and promote the including folders if any diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 56ad6f6496..8c8bd789c2 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -78,9 +78,19 @@ void copy_inventory_category(LLInventoryModel* model, LLViewerInventoryCategory* void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& root_copy_id, bool move_no_copy_items); -// Generates a string containing the path to the item specified by item_id. +// Generates a string containing the path to the object specified by id (not including the object name). void append_path(const LLUUID& id, std::string& path); +// Generates a string containing the path name of the object. +std::string make_path(const LLInventoryObject* object); +// Generates a string containing the path name of the object specified by id. +std::string make_inventory_path(const LLUUID& id); + +// Generates a string containing the path name and id of the object. +std::string make_info(const LLInventoryObject* object); +// Generates a string containing the path name and id of the object specified by id. +std::string make_inventory_info(const LLUUID& id); + typedef boost::function<void(std::string& validation_message, S32 depth, LLError::ELevel log_level)> validation_callback_t; bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryItem* inv_item, std::string& tooltip_msg, S32 bundle_size = 1, bool from_paste = false); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 46e76bc3f8..06050dc4a4 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -668,6 +668,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, const std::string& pname, inventory_func_type callback) { + LL_DEBUGS(LOG_INV) << "Create '" << pname << "' in '" << make_inventory_path(parent_id) << "'" << LL_ENDL; LLUUID id; if (!isInventoryUsable()) { @@ -759,6 +760,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, cat->packMessage(msg); gAgent.sendReliableMessage(); + LL_INFOS(LOG_INV) << "Created new category '" << make_inventory_path(id) << "'" << LL_ENDL; // return the folder id of the newly created folder return id; } @@ -1347,6 +1349,7 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) LLPointer<LLViewerInventoryCategory> cat = getCategory(object_id); if(cat && (cat->getParentUUID() != cat_id)) { + LL_DEBUGS(LOG_INV) << "Move category '" << make_path(cat) << "' to '" << make_inventory_path(cat_id) << "'" << LL_ENDL; cat_array_t* cat_array; cat_array = getUnlockedCatArray(cat->getParentUUID()); if(cat_array) vector_replace_with_last(*cat_array, cat); @@ -1359,6 +1362,7 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) LLPointer<LLViewerInventoryItem> item = getItem(object_id); if(item && (item->getParentUUID() != cat_id)) { + LL_DEBUGS(LOG_INV) << "Move item '" << make_path(item) << "' to '" << make_inventory_path(cat_id) << "'" << LL_ENDL; item_array_t* item_array; item_array = getUnlockedItemArray(item->getParentUUID()); if(item_array) vector_replace_with_last(*item_array, item); @@ -1377,14 +1381,14 @@ void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item, { if (item->getParentUUID() == new_parent_id) { - LL_DEBUGS(LOG_INV) << "'" << item->getName() << "' (" << item->getUUID() - << ") is already in folder " << new_parent_id << LL_ENDL; + LL_DEBUGS(LOG_INV) << make_info(item) << " is already in folder " << make_inventory_info(new_parent_id) << LL_ENDL; } else { - LL_INFOS(LOG_INV) << "Moving '" << item->getName() << "' (" << item->getUUID() - << ") from " << item->getParentUUID() << " to folder " - << new_parent_id << LL_ENDL; + LL_INFOS(LOG_INV) << "Move item " << make_info(item) + << " from " << make_inventory_info(item->getParentUUID()) + << " to " << make_inventory_info(new_parent_id) << LL_ENDL; + LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); update.push_back(old_folder); @@ -1416,6 +1420,10 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat, return; } + LL_INFOS(LOG_INV) << "Move category " << make_info(cat) + << " from " << make_inventory_info(cat->getParentUUID()) + << " to " << make_inventory_info(new_parent_id) << LL_ENDL; + LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1); update.push_back(old_folder); |