From a5660211f46cc99cefd6ab93d1a1136b19d33b4b Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 18 Jul 2017 16:17:59 +0300 Subject: MAINT-7607 FIXED Viewer crashes when double clicking on scroll bar arrow in Outfit Gallery tab --- indra/newview/lloutfitgallery.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'indra/newview/lloutfitgallery.cpp') diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 31e89c0ed0..5518656f3f 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -344,7 +344,7 @@ void LLOutfitGallery::removeFromLastRow(LLOutfitGalleryItem* item) mItemPanels.pop_back(); } -LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name) +LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name, LLUUID outfit_id) { LLOutfitGalleryItem::Params giparams; LLOutfitGalleryItem* gitem = LLUICtrlFactory::create(giparams); @@ -353,6 +353,7 @@ LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name) gitem->setFollowsLeft(); gitem->setFollowsTop(); gitem->setOutfitName(name); + gitem->setUUID(outfit_id); return gitem; } @@ -511,7 +512,7 @@ void LLOutfitGallery::updateAddedCategory(LLUUID cat_id) if (!cat) return; std::string name = cat->getName(); - LLOutfitGalleryItem* item = buildGalleryItem(name); + LLOutfitGalleryItem* item = buildGalleryItem(name, cat_id); mOutfitMap.insert(LLOutfitGallery::outfit_map_value_t(cat_id, item)); item->setRightMouseDownCallback(boost::bind(&LLOutfitListBase::outfitRightClickCallBack, this, _1, _2, _3, cat_id)); @@ -661,7 +662,8 @@ LLOutfitGalleryItem::LLOutfitGalleryItem(const Params& p) mSelected(false), mWorn(false), mDefaultImage(true), - mOutfitName("") + mOutfitName(""), + mUUID(LLUUID()) { buildFromFile("panel_outfit_gallery_item.xml"); } @@ -745,23 +747,20 @@ BOOL LLOutfitGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) return LLUICtrl::handleRightMouseDown(x, y, mask); } -BOOL LLOutfitGallery::handleDoubleClick(S32 x, S32 y, MASK mask) +BOOL LLOutfitGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) { LLTabContainer* appearence_tabs = LLPanelOutfitsInventory::findInstance()->getChild("appearance_tabs"); - LLPanel* panel = NULL; - LLAccordionCtrl* accordion = NULL; - if (appearence_tabs != NULL) + if (appearence_tabs && (mUUID != LLUUID())) { appearence_tabs->selectTabByName("outfitslist_tab"); - panel = appearence_tabs->getCurrentPanel(); - if (panel != NULL) + LLPanel* panel = appearence_tabs->getCurrentPanel(); + if (panel) { - accordion = panel->getChild("outfits_accordion"); + LLAccordionCtrl* accordion = panel->getChild("outfits_accordion"); LLOutfitsList* outfit_list = dynamic_cast(panel); if (accordion != NULL && outfit_list != NULL) { - LLUUID item_id = getSelectedOutfitUUID(); - outfit_list->setSelectedOutfitByUUID(item_id); + outfit_list->setSelectedOutfitByUUID(mUUID); LLAccordionCtrlTab* tab = accordion->getSelectedTab(); tab->showAndFocusHeader(); return TRUE; @@ -769,7 +768,7 @@ BOOL LLOutfitGallery::handleDoubleClick(S32 x, S32 y, MASK mask) } } - return LLUICtrl::handleDoubleClick(x, y, mask); + return LLPanel::handleDoubleClick(x, y, mask); } void LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id) -- cgit v1.2.3 From b7894fce4f16f7722dcf5bb1b781c08b1478a600 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 14 Aug 2017 20:04:06 +0300 Subject: MAINT-7665 Outfit folders should be capable of accepting images for preview --- indra/newview/lloutfitgallery.cpp | 75 +++++++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 18 deletions(-) (limited to 'indra/newview/lloutfitgallery.cpp') diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 5518656f3f..0d289e6d87 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -699,13 +699,24 @@ void LLOutfitGalleryItem::draw() const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); if (mTexturep) { - LLRect interior = border; - interior.stretch(-1); + if (mImageUpdatePending && mTexturep->getDiscardLevel() >= 0) + { + mImageUpdatePending = false; + if (mTexturep->getOriginalWidth() > MAX_OUTFIT_PHOTO_WIDTH || mTexturep->getOriginalHeight() > MAX_OUTFIT_PHOTO_HEIGHT) + { + setDefaultImage(); + } + } + else + { + LLRect interior = border; + interior.stretch(-1); - gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); + gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); - // Pump the priority - mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight())); + // Pump the priority + mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight())); + } } } @@ -771,12 +782,19 @@ BOOL LLOutfitGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) return LLPanel::handleDoubleClick(x, y, mask); } -void LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id) +bool LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id) { - mImageAssetId = image_asset_id; - mTexturep = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - getChildView("preview_outfit")->setVisible(FALSE); - mDefaultImage = false; + LLPointer texture = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + if (texture && texture->getOriginalWidth() <= MAX_OUTFIT_PHOTO_WIDTH && texture->getOriginalHeight() <= MAX_OUTFIT_PHOTO_HEIGHT) + { + mImageAssetId = image_asset_id; + mTexturep = texture; + getChildView("preview_outfit")->setVisible(FALSE); + mDefaultImage = false; + mImageUpdatePending = (texture->getDiscardLevel() == -1); + return true; + } + return false; } LLUUID LLOutfitGalleryItem::getImageAssetId() @@ -790,6 +808,7 @@ void LLOutfitGalleryItem::setDefaultImage() mImageAssetId.setNull(); getChildView("preview_outfit")->setVisible(TRUE); mDefaultImage = true; + mImageUpdatePending = false; } LLContextMenu* LLOutfitGalleryContextMenu::createMenu() @@ -1025,13 +1044,28 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) BOOST_FOREACH(LLViewerInventoryItem* outfit_item, outfit_item_array) { LLViewerInventoryItem* linked_item = outfit_item->getLinkedItem(); - if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE) + LLUUID asset_id, inv_id; + std::string item_name; + if (linked_item != NULL) { - 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) + if (linked_item->getActualType() == LLAssetType::AT_TEXTURE) + { + asset_id = linked_item->getAssetUUID(); + inv_id = linked_item->getUUID(); + item_name = linked_item->getName(); + } + } + else if (outfit_item->getActualType() == LLAssetType::AT_TEXTURE) + { + asset_id = outfit_item->getAssetUUID(); + inv_id = outfit_item->getUUID(); + item_name = outfit_item->getName(); + } + if (asset_id.notNull()) + { + photo_loaded |= mOutfitMap[category_id]->setImageAssetId(asset_id); + // Rename links + if (!mOutfitRenamePending.isNull() && mOutfitRenamePending.asString() == item_name) { LLViewerInventoryCategory *outfit_cat = gInventory.getCategory(mOutfitRenamePending); LLStringUtil::format_map_t photo_string_args; @@ -1039,7 +1073,7 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) 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); + update_inventory_item(inv_id, updates, NULL); mOutfitRenamePending.setNull(); LLFloater* inv_floater = LLFloaterReg::getInstance("inventory"); if (inv_floater) @@ -1052,7 +1086,11 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) appearance_floater->setFocus(TRUE); } } - break; + if (item_name == LLAppearanceMgr::sExpectedTextureName) + { + // Images with "appropriate" name take priority + break; + } } if (!photo_loaded) { @@ -1067,6 +1105,7 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) } } +// Refresh linked textures from "textures" uploads folder void LLOutfitGallery::refreshTextures(const LLUUID& category_id) { LLInventoryModel::cat_array_t cat_array; -- cgit v1.2.3 From 1b264af38ca835f4dc64e965846a71313d4be781 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 23 Aug 2017 18:39:47 +0300 Subject: MAINT-7737 Fixed memory leak in Outfit Gallery --- indra/newview/lloutfitgallery.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/lloutfitgallery.cpp') diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 0d289e6d87..cca65f2ce1 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1215,6 +1215,7 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id) upload_pending_name, callback, expected_upload_cost, nruserdata); mOutfitLinkPending = outfit_id; } + delete unit; } } -- cgit v1.2.3