diff options
-rw-r--r-- | indra/newview/lloutfitgallery.cpp | 28 | ||||
-rw-r--r-- | indra/newview/lloutfitgallery.h | 2 |
2 files changed, 24 insertions, 6 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index cca65f2ce1..c38d3ab140 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -72,6 +72,7 @@ LLOutfitGallery::LLOutfitGallery(const LLOutfitGallery::Params& p) mItemsAddedCount(0), mOutfitLinkPending(NULL), mOutfitRenamePending(NULL), + mSnapshotFolderID(NULL), mRowPanelHeight(p.row_panel_height), mVerticalGap(p.vertical_gap), mHorizontalGap(p.horizontal_gap), @@ -1011,8 +1012,8 @@ void LLOutfitGallery::onTextureSelectionChanged(LLInventoryItem* itemp) void LLOutfitGallery::loadPhotos() { //Iterate over inventory - LLUUID textures = gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE); - LLViewerInventoryCategory* textures_category = gInventory.getCategory(textures); + mSnapshotFolderID = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE); + LLViewerInventoryCategory* textures_category = gInventory.getCategory(mSnapshotFolderID); if (!textures_category) return; if (mTexturesObserver == NULL) @@ -1022,12 +1023,26 @@ void LLOutfitGallery::loadPhotos() } // Start observing changes in "Textures" category. - mTexturesObserver->addCategory(textures, - boost::bind(&LLOutfitGallery::refreshTextures, this, textures)); - + mTexturesObserver->addCategory(mSnapshotFolderID, + boost::bind(&LLOutfitGallery::refreshTextures, this, mSnapshotFolderID)); + textures_category->fetch(); } +void LLOutfitGallery::updateSnapshotFolderObserver() +{ + if(mSnapshotFolderID != gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE)) + { + if (gInventory.containsObserver(mTexturesObserver)) + { + gInventory.removeObserver(mTexturesObserver); + } + delete mTexturesObserver; + mTexturesObserver = NULL; + loadPhotos(); + } +} + void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) { LLViewerInventoryCategory* category = gInventory.getCategory(category_id); @@ -1200,7 +1215,7 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id) LLViewerInventoryCategory *outfit_cat = gInventory.getCategory(outfit_id); if (!outfit_cat) return; - + updateSnapshotFolderObserver(); checkRemovePhoto(outfit_id); std::string upload_pending_name = outfit_id.asString(); std::string upload_pending_desc = ""; @@ -1372,6 +1387,7 @@ void LLOutfitGallery::onBeforeOutfitSnapshotSave() if (!selected_outfit_id.isNull()) { checkRemovePhoto(selected_outfit_id); + updateSnapshotFolderObserver(); } } diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h index b1ca850508..383924a7d6 100644 --- a/indra/newview/lloutfitgallery.h +++ b/indra/newview/lloutfitgallery.h @@ -130,6 +130,7 @@ protected: private: void loadPhotos(); void uploadPhoto(LLUUID outfit_id); + void updateSnapshotFolderObserver(); LLUUID getPhotoAssetId(const LLUUID& outfit_id); LLUUID getDefaultPhoto(); void linkPhotoToOutfit(LLUUID outfit_id, LLUUID photo_id); @@ -168,6 +169,7 @@ private: LLPanel* mLastRowPanel; LLUUID mOutfitLinkPending; LLUUID mOutfitRenamePending; + LLUUID mSnapshotFolderID; LLTextBox* mMessageTextBox; bool mGalleryCreated; int mRowCount; |