summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpavelkproductengine <pavelkproductengine@lindenlab.com>2016-03-30 20:33:52 +0300
committerpavelkproductengine <pavelkproductengine@lindenlab.com>2016-03-30 20:33:52 +0300
commit30569854448e52e085366390a078054e1aa53ed9 (patch)
tree727c6e3ebb316b83b05d74f8dfcc3c24e96f2b2a
parent5bbf263c293286395730d969e0b9beec9d830f48 (diff)
MAINT-6243 Photo upload for Visual Outfit Browser on the latest Mac build doesn't update
Fixed photo update on upload over existing photo
-rw-r--r--indra/newview/lloutfitgallery.cpp84
-rw-r--r--indra/newview/lloutfitgallery.h28
2 files changed, 46 insertions, 66 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index c301f5d570..8af05173e6 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -57,6 +57,7 @@ LLOutfitGallery::LLOutfitGallery(const LLOutfitGallery::Params& p)
mRowCount(0),
mItemsAddedCount(0),
mOutfitLinkPending(NULL),
+ mOutfitRenamePending(NULL),
mRowPanelHeight(p.row_panel_height),
mVerticalGap(p.vertical_gap),
mHorizontalGap(p.horizontal_gap),
@@ -621,11 +622,23 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id)
BOOST_FOREACH(LLViewerInventoryItem* outfit_item, outfit_item_array)
{
LLViewerInventoryItem* linked_item = outfit_item->getLinkedItem();
- if (linked_item->getActualType() == LLAssetType::AT_TEXTURE)
+ if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE)
{
LLUUID asset_id = linked_item->getAssetUUID();
mOutfitMap[category_id]->setImageAssetId(asset_id);
photo_loaded = true;
+ std::string linked_item_name = linked_item->getName();
+ if (!mOutfitRenamePending.isNull() && mOutfitRenamePending.asString() == linked_item_name)
+ {
+ LLViewerInventoryCategory *outfit_cat = gInventory.getCategory(mOutfitRenamePending);
+ LLStringUtil::format_map_t photo_string_args;
+ photo_string_args["OUTFIT_NAME"] = outfit_cat->getName();
+ std::string new_name = getString("outfit_photo_string", photo_string_args);
+ LLSD updates;
+ updates["name"] = new_name;
+ update_inventory_item(linked_item->getUUID(), updates, NULL);
+ mOutfitRenamePending.setNull();
+ }
break;
}
if (!photo_loaded)
@@ -650,7 +663,7 @@ void LLOutfitGallery::refreshTextures(const LLUUID& category_id)
LLInventoryModel::EXCLUDE_TRASH,
is_texture);
- //Find texture which contain outfit ID string in name
+ //Find texture which contain pending outfit ID string in name
LLViewerInventoryItem* photo_upload_item = NULL;
BOOST_FOREACH(LLViewerInventoryItem* item, item_array)
{
@@ -664,27 +677,18 @@ void LLOutfitGallery::refreshTextures(const LLUUID& category_id)
if (photo_upload_item != NULL)
{
- LLUUID upload_pending_id = photo_upload_item->getUUID();
- LLInventoryObject* upload_object = gInventory.getObject(upload_pending_id);
+ LLUUID photo_item_id = photo_upload_item->getUUID();
+ LLInventoryObject* upload_object = gInventory.getObject(photo_item_id);
if (!upload_object)
{
LL_WARNS() << "LLOutfitGallery::refreshTextures added_object is null!" << LL_ENDL;
}
else
{
- LLViewerInventoryCategory *outfit_cat = gInventory.getCategory(mOutfitLinkPending);
- linkPhotoToOutfit(upload_pending_id, mOutfitLinkPending);
-
- LLStringUtil::format_map_t photo_string_args;
- photo_string_args["OUTFIT_NAME"] = outfit_cat->getName();
- std::string new_name = getString("outfit_photo_string", photo_string_args);
-
- LLSD updates;
- updates["name"] = new_name;
- update_inventory_item(upload_pending_id, updates, NULL);
-
+ linkPhotoToOutfit(photo_item_id, mOutfitLinkPending);
+ mOutfitRenamePending = mOutfitLinkPending;
+ mOutfitLinkPending.setNull();
}
- mOutfitLinkPending.setNull();
}
}
@@ -728,43 +732,31 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id)
void LLOutfitGallery::linkPhotoToOutfit(LLUUID photo_id, LLUUID outfit_id)
{
- LLPointer<LLInventoryCallback> cb = new LLUpdateGalleryOnPhotoUpload();
+ LLPointer<LLInventoryCallback> cb = new LLUpdateGalleryOnPhotoLinked(this);
link_inventory_object(outfit_id, photo_id, cb);
}
bool LLOutfitGallery::checkRemovePhoto(LLUUID outfit_id)
{
- //remove existing photo of outfit from inventory
- texture_map_t::iterator texture_it = mTextureMap.find(outfit_id);
- if (texture_it != mTextureMap.end()) {
- gInventory.removeItem(texture_it->second->getUUID());
- return true;
+ //remove existing photo link from outfit folder
+ LLInventoryModel::cat_array_t sub_cat_array;
+ LLInventoryModel::item_array_t outfit_item_array;
+ gInventory.collectDescendents(
+ outfit_id,
+ sub_cat_array,
+ outfit_item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
+ BOOST_FOREACH(LLViewerInventoryItem* outfit_item, outfit_item_array)
+ {
+ LLViewerInventoryItem* linked_item = outfit_item->getLinkedItem();
+ if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE)
+ {
+ gInventory.removeItem(outfit_item->getUUID());
+ }
}
- return false;
+ return true;
}
-void LLOutfitGallery::computeDifferenceOfTextures(
- const LLInventoryModel::item_array_t& vtextures,
- uuid_vec_t& vadded,
- uuid_vec_t& vremoved)
+void LLUpdateGalleryOnPhotoLinked::fire(const LLUUID& inv_item_id)
{
- uuid_vec_t vnew;
- // Creating a vector of newly collected texture UUIDs.
- for (LLInventoryModel::item_array_t::const_iterator iter = vtextures.begin();
- iter != vtextures.end();
- iter++)
- {
- vnew.push_back((*iter)->getUUID());
- }
-
- uuid_vec_t vcur;
- // Creating a vector of currently uploaded texture UUIDs.
- for (texture_map_t::const_iterator iter = mTextureMap.begin();
- iter != mTextureMap.end();
- iter++)
- {
- vcur.push_back((*iter).second->getUUID());
- }
-
- LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved);
}
diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h
index 97b80acd19..ce3964ca1d 100644
--- a/indra/newview/lloutfitgallery.h
+++ b/indra/newview/lloutfitgallery.h
@@ -38,24 +38,26 @@
#include <vector>
class LLVFS;
+class LLOutfitGallery;
class LLOutfitGalleryItem;
class LLOutfitListGearMenuBase;
class LLOutfitGalleryGearMenu;
-class LLUpdateGalleryOnPhotoUpload : public LLInventoryCallback
+class LLUpdateGalleryOnPhotoLinked : public LLInventoryCallback
{
public:
- LLUpdateGalleryOnPhotoUpload(){}
- virtual ~LLUpdateGalleryOnPhotoUpload(){}
- /* virtual */ void fire(const LLUUID& inv_item){}
+ LLUpdateGalleryOnPhotoLinked(LLOutfitGallery* gallery) : mGallery(gallery) {}
+ virtual ~LLUpdateGalleryOnPhotoLinked(){}
+ /* virtual */ void fire(const LLUUID& inv_item_id);
private:
+ LLOutfitGallery* mGallery;
};
-
class LLOutfitGallery : public LLOutfitListBase
{
public:
friend class LLOutfitGalleryGearMenu;
+ friend class LLUpdateGalleryOnPhotoLinked;
struct Params
: public LLInitParam::Block<Params, LLPanel::Params>
@@ -76,8 +78,6 @@ public:
static const LLOutfitGallery::Params& getDefaultParams();
LLOutfitGallery(const LLOutfitGallery::Params& params = getDefaultParams());
-
-// LLOutfitGallery();
virtual ~LLOutfitGallery();
/*virtual*/ BOOL postBuild();
@@ -97,7 +97,6 @@ public:
void refreshTextures(const LLUUID& category_id);
void refreshOutfit(const LLUUID& category_id);
- void computeDifferenceOfTextures(const LLInventoryModel::item_array_t& vtextures, uuid_vec_t& vadded, uuid_vec_t& vremoved);
protected:
/*virtual*/ void onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id);
@@ -138,6 +137,7 @@ private:
LLPanel* mGalleryPanel;
LLPanel* mLastRowPanel;
LLUUID mOutfitLinkPending;
+ LLUUID mOutfitRenamePending;
bool mGalleryCreated;
int mRowCount;
int mItemsAddedCount;
@@ -152,18 +152,6 @@ private:
int mRowPanelWidth;
int mGalleryWidth;
- /*
- #define LAYOUT_STACK_WIDTH_FACTOR 166
- #define LAYOUT_STACK_WIDTH LAYOUT_STACK_WIDTH_FACTOR * ITEMS_IN_ROW//498
- #define GALLERY_WIDTH_FACTOR 163
- #define GALLERY_WIDTH GALLERY_WIDTH_FACTOR * ITEMS_IN_ROW//485//290
- */
-
- /*
- #define GALLERY_ITEM_HGAP 16
- #define ITEMS_IN_ROW 3
- */
-
typedef std::map<LLUUID, LLOutfitGalleryItem*> outfit_map_t;
typedef outfit_map_t::value_type outfit_map_value_t;
outfit_map_t mOutfitMap;