From 808b8ed01849fc6e2cd5caba68843eebcadc5333 Mon Sep 17 00:00:00 2001 From: pavelkproductengine Date: Tue, 5 Apr 2016 17:44:53 +0300 Subject: MAINT-6228 Update Photo/Image Upload feature for Outfit Browser 1) Added "Select Photo" to outfit gear menu 2) Incorporated Texture Picker --- indra/newview/lltexturectrl.h | 141 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 140 insertions(+), 1 deletion(-) (limited to 'indra/newview/lltexturectrl.h') diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 15ca7bed92..3ea052ad57 100755 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -29,12 +29,20 @@ #define LL_LLTEXTURECTRL_H #include "llcoord.h" +#include "llfiltereditor.h" #include "llfloater.h" +#include "llfolderview.h" +#include "lllocalbitmaps.h" #include "llstring.h" #include "lluictrl.h" #include "llpermissionsflags.h" +#include "llradiogroup.h" #include "lltextbox.h" // for params +#include "llviewerinventory.h" #include "llviewborder.h" // for params +#include "llviewerobject.h" +#include "llviewertexture.h" +#include "llwindow.h" class LLButton; class LLFloaterTexturePicker; @@ -166,7 +174,7 @@ public: void closeDependentFloater(); void onFloaterClose(); - void onFloaterCommit(ETexturePickOp op, LLUUID id = LLUUID::null); + void onFloaterCommit(ETexturePickOp op, LLUUID id); // This call is returned when a drag is detected. Your callback // should return TRUE if the drag is acceptable. @@ -227,4 +235,135 @@ private: S32 mLabelWidth; }; +////////////////////////////////////////////////////////////////////////////////////////// +// LLFloaterTexturePicker +typedef boost::function floater_commit_callback; +typedef boost::function floater_close_callback; +typedef boost::function set_image_asset_id_callback; + +class LLFloaterTexturePicker : public LLFloater +{ +public: + LLFloaterTexturePicker( + LLView* owner, + LLUUID image_asset_id, + LLUUID default_image_asset_id, + LLUUID blank_image_asset_id, + BOOL tentative, + BOOL allow_no_texture, + const std::string& label, + PermissionMask immediate_filter_perm_mask, + PermissionMask dnd_filter_perm_mask, + PermissionMask non_immediate_filter_perm_mask, + BOOL can_apply_immediately, + LLUIImagePtr fallback_image_name + ); + + virtual ~LLFloaterTexturePicker(); + + // LLView overrides + /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, + BOOL drop, EDragAndDropType cargo_type, void *cargo_data, + EAcceptance *accept, + std::string& tooltip_msg); + /*virtual*/ void draw(); + /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + + // LLFloater overrides + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onClose(bool app_settings); + + // New functions + void setImageID(const LLUUID& image_asset_id, bool set_selection = true); + void updateImageStats(); + const LLUUID& getAssetID() { return mImageAssetID; } + const LLUUID& findItemID(const LLUUID& asset_id, BOOL copyable_only); + void setCanApplyImmediately(BOOL b); + + void setActive(BOOL active); + + LLView* getOwner() const { return mOwner; } + void setOwner(LLView* owner) { mOwner = owner; } + void stopUsingPipette(); + PermissionMask getFilterPermMask(); + + void updateFilterPermMask(); + void commitIfImmediateSet(); + void commitCancel(); + + void onFilterEdit(const std::string& search_string); + + void setCanApply(bool can_preview, bool can_apply); + void setTextureSelectedCallback(const texture_selected_callback& cb) { mTextureSelectedCallback = cb; } + 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; } + const LLUUID& getDefaultImageAssetID() { return mDefaultImageAssetID; } + const LLUUID& getBlankImageAssetID() { return mBlankImageAssetID; } + + static void onBtnSetToDefault(void* userdata); + static void onBtnSelect(void* userdata); + static void onBtnCancel(void* userdata); + void onBtnPipette(); + //static void onBtnRevert( void* userdata ); + static void onBtnBlank(void* userdata); + static void onBtnNone(void* userdata); + static void onBtnClear(void* userdata); + void onSelectionChange(const std::deque &items, BOOL user_action); + static void onShowFolders(LLUICtrl* ctrl, void* userdata); + static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata); + void onTextureSelect(const LLTextureEntry& te); + + static void onModeSelect(LLUICtrl* ctrl, void *userdata); + static void onBtnAdd(void* userdata); + static void onBtnRemove(void* userdata); + static void onBtnUpload(void* userdata); + static void onLocalScrollCommit(LLUICtrl* ctrl, void* userdata); + +protected: + LLPointer mTexturep; + LLView* mOwner; + + LLUUID mImageAssetID; // Currently selected texture + LLUIImagePtr mFallbackImage; // What to show if currently selected texture is null. + LLUUID mDefaultImageAssetID; + LLUUID mBlankImageAssetID; + BOOL mTentative; + BOOL mAllowNoTexture; + LLUUID mSpecialCurrentImageAssetID; // Used when the asset id has no corresponding texture in the user's inventory. + LLUUID mOriginalImageAssetID; + + std::string mLabel; + + LLTextBox* mTentativeLabel; + LLTextBox* mResolutionLabel; + + std::string mPendingName; + BOOL mActive; + + LLFilterEditor* mFilterEdit; + LLInventoryPanel* mInventoryPanel; + PermissionMask mImmediateFilterPermMask; + PermissionMask mDnDFilterPermMask; + PermissionMask mNonImmediateFilterPermMask; + BOOL mCanApplyImmediately; + BOOL mNoCopyTextureSelected; + F32 mContextConeOpacity; + LLSaveFolderState mSavedFolderState; + BOOL mSelectedItemPinned; + + LLRadioGroup* mModeSelector; + LLScrollListCtrl* mLocalScrollCtrl; + +private: + bool mCanApply; + bool mCanPreview; + bool mPreviewSettingChanged; + + texture_selected_callback mTextureSelectedCallback; + floater_close_callback mOnFloaterCloseCallback; + floater_commit_callback mOnFloaterCommitCallback; + set_image_asset_id_callback mSetImageAssetIDCallback; +}; + #endif // LL_LLTEXTURECTRL_H -- cgit v1.3 From 7187ec75a7095ab7bf1d49896d2f4f72b7899243 Mon Sep 17 00:00:00 2001 From: pavelkproductengine Date: Tue, 26 Jul 2016 19:18:03 +0300 Subject: 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" --- indra/newview/lloutfitgallery.cpp | 60 +++++++++++++++++++--- indra/newview/lloutfitgallery.h | 4 +- indra/newview/lltexturectrl.cpp | 7 ++- indra/newview/lltexturectrl.h | 3 ++ .../newview/skins/default/xui/en/notifications.xml | 4 +- indra/newview/skins/default/xui/en/strings.xml | 3 ++ 6 files changed, 69 insertions(+), 12 deletions(-) (limited to 'indra/newview/lltexturectrl.h') 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 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(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 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 texture); void onBeforeOutfitSnapshotSave(); void onAfterOutfitSnapshotSave(); protected: @@ -168,6 +169,7 @@ private: bool mGalleryCreated; int mRowCount; int mItemsAddedCount; + LLPointer mTextureSelected; /* Params */ int mRowPanelHeight; int mVerticalGap; @@ -266,7 +268,7 @@ public: void setHidden(bool hidden) {mHidden = hidden;} private: - LLPointer mTexturep; + LLPointer 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 floater_commit_callback; typedef boost::function floater_close_callback; typedef boost::function set_image_asset_id_callback; +typedef boost::function 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 - [REASON] + [REASON] fail none/none Can't load images larger than [WIDTH]*[HEIGHT] + Max outfit photo size is [WIDTH]*[HEIGHT]. Please resize or use another image + Max outfit photo size is [WIDTH]*[HEIGHT]. Please select another texture + Cannot verify photo dimensions. Please wait until photo size is displayed in picker -- cgit v1.3 From 84677aad4cfb5b892f9037118b0bb6cdbe9d6309 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 1 Aug 2016 15:18:32 +0300 Subject: MAINT-6602 disable ability to select local textures --- indra/newview/lloutfitgallery.cpp | 1 + indra/newview/lltexturectrl.cpp | 5 +++++ indra/newview/lltexturectrl.h | 2 ++ 3 files changed, 8 insertions(+) (limited to 'indra/newview/lltexturectrl.h') diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index a93cbb30f5..65fd3f95ab 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1244,6 +1244,7 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id) texture_floaterp->setTextureSelectedCallback(boost::bind(&LLOutfitGallery::onTextureSelectionChanged, this, _1)); texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLOutfitGallery::onTexturePickerCommit, this, _1, _2)); texture_floaterp->setOnUpdateImageStatsCallback(boost::bind(&LLOutfitGallery::onTexturePickerUpdateImageStats, this, _1)); + texture_floaterp->setLocalTextureEnabled(FALSE); } floaterp->openFloater(); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index a93f8da3f0..fd13f60606 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -941,6 +941,11 @@ void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string ) mInventoryPanel->setFilterSubString(search_string); } +void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled) +{ + mModeSelector->setIndexEnabled(1,enabled); +} + void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te ) { LLUUID inventory_item_id = findItemID(te.getID(), TRUE); diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 471a36094c..61f99de5c0 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -322,6 +322,8 @@ public: static void onBtnUpload(void* userdata); static void onLocalScrollCommit(LLUICtrl* ctrl, void* userdata); + void setLocalTextureEnabled(BOOL enabled); + protected: LLPointer mTexturep; LLView* mOwner; -- cgit v1.3