summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpavelkproductengine <pavelkproductengine@lindenlab.com>2016-07-26 19:18:03 +0300
committerpavelkproductengine <pavelkproductengine@lindenlab.com>2016-07-26 19:18:03 +0300
commit7187ec75a7095ab7bf1d49896d2f4f72b7899243 (patch)
tree05e0a5b0a4e50036d5812c2ae06ceb27a8facf39
parent97d73a7c31da32f1555215efe6a21a3428153341 (diff)
MAINT-6476 VOB - User can add any size image to an Outfit Gallery outfit folders
Added restriction of image size that can be added to outfit via "Select Photo"
-rw-r--r--indra/newview/lloutfitgallery.cpp60
-rw-r--r--indra/newview/lloutfitgallery.h4
-rw-r--r--indra/newview/lltexturectrl.cpp7
-rw-r--r--indra/newview/lltexturectrl.h3
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml4
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml3
6 files changed, 69 insertions, 12 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index a65ab26c52..a93cbb30f5 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -55,6 +55,9 @@
static LLPanelInjector<LLOutfitGallery> t_outfit_gallery("outfit_gallery");
+#define MAX_OUTFIT_PHOTO_WIDTH 256
+#define MAX_OUTFIT_PHOTO_HEIGHT 256
+
LLOutfitGallery::LLOutfitGallery(const LLOutfitGallery::Params& p)
: LLOutfitListBase(),
mTexturesObserver(NULL),
@@ -74,7 +77,8 @@ LLOutfitGallery::LLOutfitGallery(const LLOutfitGallery::Params& p)
mItemHorizontalGap(p.item_horizontal_gap),
mItemsInRow(p.items_in_row),
mRowPanWidthFactor(p.row_panel_width_factor),
- mGalleryWidthFactor(p.gallery_width_factor)
+ mGalleryWidthFactor(p.gallery_width_factor),
+ mTextureSelected(NULL)
{
updateGalleryWidth();
}
@@ -1069,8 +1073,8 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id)
image_load_error = image_info.getLastError();
}
- S32 max_width = gSavedSettings.getS32("max_texture_dimension_X");
- S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y");
+ S32 max_width = MAX_OUTFIT_PHOTO_WIDTH;
+ S32 max_height = MAX_OUTFIT_PHOTO_HEIGHT;
if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height))
{
@@ -1078,14 +1082,14 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id)
args["WIDTH"] = llformat("%d", max_width);
args["HEIGHT"] = llformat("%d", max_height);
- image_load_error = LLTrans::getString("texture_load_dimensions_error", args);
+ image_load_error = LLTrans::getString("outfit_photo_load_dimensions_error", args);
}
if (!image_load_error.empty())
{
LLSD subst;
subst["REASON"] = image_load_error;
- LLNotificationsUtil::add("ImageLoadError", subst);
+ LLNotificationsUtil::add("OutfitPhotoLoadError", subst);
return;
}
@@ -1158,7 +1162,43 @@ void LLOutfitGallery::onTexturePickerCommit(LLTextureCtrl::ETexturePickOp op, LL
else
{
image_item_id = floaterp->findItemID(floaterp->getAssetID(), FALSE);
+ if (image_item_id.isNull())
+ {
+ LL_WARNS() << "id or image_item_id is NULL!" << LL_ENDL;
+ return;
+ }
+ }
+
+ std::string image_load_error;
+ S32 max_width = MAX_OUTFIT_PHOTO_WIDTH;
+ S32 max_height = MAX_OUTFIT_PHOTO_HEIGHT;
+ if (mTextureSelected.isNull() ||
+ mTextureSelected->getFullWidth() == 0 ||
+ mTextureSelected->getFullHeight() == 0)
+ {
+ image_load_error = LLTrans::getString("outfit_photo_verify_dimensions_error");
+ LL_WARNS() << "Cannot verify selected texture dimensions" << LL_ENDL;
+ return;
+ }
+ S32 width = mTextureSelected->getFullWidth();
+ S32 height = mTextureSelected->getFullHeight();
+ if ((width > max_width) || (height > max_height))
+ {
+ LLStringUtil::format_map_t args;
+ args["WIDTH"] = llformat("%d", max_width);
+ args["HEIGHT"] = llformat("%d", max_height);
+
+ image_load_error = LLTrans::getString("outfit_photo_select_dimensions_error", args);
}
+
+ if (!image_load_error.empty())
+ {
+ LLSD subst;
+ subst["REASON"] = image_load_error;
+ LLNotificationsUtil::add("OutfitPhotoLoadError", subst);
+ return;
+ }
+
checkRemovePhoto(getSelectedOutfitUUID());
linkPhotoToOutfit(image_item_id, getSelectedOutfitUUID());
}
@@ -1196,15 +1236,14 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id)
NULL);
mFloaterHandle = floaterp->getHandle();
+ mTextureSelected = NULL;
LLFloaterTexturePicker* texture_floaterp = dynamic_cast<LLFloaterTexturePicker*>(floaterp);
if (texture_floaterp)
{
texture_floaterp->setTextureSelectedCallback(boost::bind(&LLOutfitGallery::onTextureSelectionChanged, this, _1));
- }
- if (texture_floaterp)
- {
texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLOutfitGallery::onTexturePickerCommit, this, _1, _2));
+ texture_floaterp->setOnUpdateImageStatsCallback(boost::bind(&LLOutfitGallery::onTexturePickerUpdateImageStats, this, _1));
}
floaterp->openFloater();
@@ -1241,3 +1280,8 @@ void LLOutfitGallery::onAfterOutfitSnapshotSave()
mOutfitLinkPending = selected_outfit_id;
}
}
+
+void LLOutfitGallery::onTexturePickerUpdateImageStats(LLPointer<LLViewerTexture> texture)
+{
+ mTextureSelected = texture;
+}
diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h
index f5954d9cc2..6b13f264a4 100644
--- a/indra/newview/lloutfitgallery.h
+++ b/indra/newview/lloutfitgallery.h
@@ -111,6 +111,7 @@ public:
void refreshOutfit(const LLUUID& category_id);
void onTexturePickerCommit(LLTextureCtrl::ETexturePickOp op, LLUUID id);
+ void onTexturePickerUpdateImageStats(LLPointer<LLViewerTexture> texture);
void onBeforeOutfitSnapshotSave();
void onAfterOutfitSnapshotSave();
protected:
@@ -168,6 +169,7 @@ private:
bool mGalleryCreated;
int mRowCount;
int mItemsAddedCount;
+ LLPointer<LLViewerTexture> mTextureSelected;
/* Params */
int mRowPanelHeight;
int mVerticalGap;
@@ -266,7 +268,7 @@ public:
void setHidden(bool hidden) {mHidden = hidden;}
private:
- LLPointer<LLViewerTexture> mTexturep;
+ LLPointer<LLViewerFetchedTexture> mTexturep;
LLUUID mImageAssetId;
LLTextBox* mOutfitNameText;
LLTextBox* mOutfitWornText;
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 858486514f..f77e0349b5 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -118,7 +118,8 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mPreviewSettingChanged(false),
mOnFloaterCommitCallback(NULL),
mOnFloaterCloseCallback(NULL),
- mSetImageAssetIDCallback(NULL)
+ mSetImageAssetIDCallback(NULL),
+ mOnUpdateImageStatsCallback(NULL)
{
buildFromFile("floater_texture_ctrl.xml");
mCanApplyImmediately = can_apply_immediately;
@@ -195,6 +196,10 @@ void LLFloaterTexturePicker::updateImageStats()
{
std::string formatted_dims = llformat("%d x %d", mTexturep->getFullWidth(),mTexturep->getFullHeight());
mResolutionLabel->setTextArg("[DIMENSIONS]", formatted_dims);
+ if (mOnUpdateImageStatsCallback)
+ {
+ mOnUpdateImageStatsCallback(mTexturep);
+ }
}
else
{
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index 3ea052ad57..471a36094c 100644
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -240,6 +240,7 @@ private:
typedef boost::function<void(LLTextureCtrl::ETexturePickOp op, LLUUID id)> floater_commit_callback;
typedef boost::function<void()> floater_close_callback;
typedef boost::function<void(const LLUUID& asset_id)> set_image_asset_id_callback;
+typedef boost::function<void(LLPointer<LLViewerTexture> texture)> set_on_update_image_stats_callback;
class LLFloaterTexturePicker : public LLFloater
{
@@ -298,6 +299,7 @@ public:
void setOnFloaterCloseCallback(const floater_close_callback& cb) { mOnFloaterCloseCallback = cb; }
void setOnFloaterCommitCallback(const floater_commit_callback& cb) { mOnFloaterCommitCallback = cb; }
void setSetImageAssetIDCallback(const set_image_asset_id_callback& cb) { mSetImageAssetIDCallback = cb; }
+ void setOnUpdateImageStatsCallback(const set_on_update_image_stats_callback& cb) { mOnUpdateImageStatsCallback = cb; }
const LLUUID& getDefaultImageAssetID() { return mDefaultImageAssetID; }
const LLUUID& getBlankImageAssetID() { return mBlankImageAssetID; }
@@ -364,6 +366,7 @@ private:
floater_close_callback mOnFloaterCloseCallback;
floater_commit_callback mOnFloaterCommitCallback;
set_image_asset_id_callback mSetImageAssetIDCallback;
+ set_on_update_image_stats_callback mOnUpdateImageStatsCallback;
};
#endif // LL_LLTEXTURECTRL_H
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index f96b8636f5..bb9c767f2b 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -11019,9 +11019,9 @@ Cannot create large prims that intersect other players. Please re-try when othe
<notification
icon="alert.tga"
- name="ImageLoadError"
+ name="OutfitPhotoLoadError"
type="alertmodal">
- [REASON]
+ [REASON]
<tag>fail</tag>
<usetemplate
name="okbutton"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index ae63546082..17bb9a9e43 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -3806,6 +3806,9 @@ Abuse Report</string>
<string name="DefaultMimeType">none/none</string>
<string name="texture_load_dimensions_error">Can't load images larger than [WIDTH]*[HEIGHT]</string>
+ <string name="outfit_photo_load_dimensions_error">Max outfit photo size is [WIDTH]*[HEIGHT]. Please resize or use another image</string>
+ <string name="outfit_photo_select_dimensions_error">Max outfit photo size is [WIDTH]*[HEIGHT]. Please select another texture</string>
+ <string name="outfit_photo_verify_dimensions_error">Cannot verify photo dimensions. Please wait until photo size is displayed in picker</string>
<!-- language specific white-space characters, delimiters, spacers, item separation symbols -->
<string name="sentences_separator" value=" "></string>