MAINT-7801 FIXED "Take a snapshot" fails to assign new snapshot for Outfit if default folder for uploads was changed

meow-7.2.2
Mnikolenko Productengine 2017-09-15 16:45:46 +03:00
parent 14a6afea84
commit 0b7020c0c5
2 changed files with 24 additions and 6 deletions

View File

@ -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();
}
}

View File

@ -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;