MAINT-6228 Update Photo/Image Upload feature for Outfit Browser

1) Added "Select Photo" to outfit gear menu
2) Incorporated Texture Picker
meow-7.2.2
pavelkproductengine 2016-04-05 17:44:53 +03:00
parent 4f27522175
commit 808b8ed018
7 changed files with 339 additions and 146 deletions

View File

@ -42,6 +42,7 @@
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
#include "lllocalbitmaps.h"
#include "lltexturectrl.h"
#include "llviewermenufile.h"
#include "llwearableitemslist.h"
@ -552,13 +553,20 @@ BOOL LLOutfitGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask)
void LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id)
{
mImageAssetId = image_asset_id;
mTexturep = LLViewerTextureManager::getFetchedTexture(image_asset_id);
mTexturep->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
}
LLUUID LLOutfitGalleryItem::getImageAssetId()
{
return mImageAssetId;
}
void LLOutfitGalleryItem::setDefaultImage()
{
mTexturep = NULL;
mImageAssetId.setNull();
}
LLOutfitGalleryGearMenu::LLOutfitGalleryGearMenu(LLOutfitListBase* olist)
@ -572,7 +580,7 @@ void LLOutfitGalleryGearMenu::onUpdateItemsVisibility()
mMenu->setItemVisible("expand", FALSE);
mMenu->setItemVisible("collapse", FALSE);
mMenu->setItemVisible("upload_photo", TRUE);
mMenu->setItemVisible("load_assets", TRUE);
mMenu->setItemVisible("select_photo", TRUE);
LLOutfitListGearMenuBase::onUpdateItemsVisibility();
}
@ -586,6 +594,20 @@ void LLOutfitGalleryGearMenu::onUploadFoto()
}
}
void LLOutfitGalleryGearMenu::onSelectPhoto()
{
LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList);
LLUUID selected_outfit_id = getSelectedOutfitID();
if (gallery && !selected_outfit_id.isNull())
{
gallery->onSelectPhoto(selected_outfit_id);
}
}
void LLOutfitGallery::onTextureSelectionChanged(LLInventoryItem* itemp)
{
}
void LLOutfitGallery::loadPhotos()
{
//Iterate over inventory
@ -760,3 +782,87 @@ bool LLOutfitGallery::checkRemovePhoto(LLUUID outfit_id)
void LLUpdateGalleryOnPhotoLinked::fire(const LLUUID& inv_item_id)
{
}
LLUUID LLOutfitGallery::getPhotoAssetId(const LLUUID& outfit_id)
{
outfit_map_t::iterator outfit_it = mOutfitMap.find(outfit_id);
if (outfit_it != mOutfitMap.end())
{
return outfit_it->second->getImageAssetId();
}
return LLUUID();
}
LLUUID LLOutfitGallery::getDefaultPhoto()
{
return LLUUID();
}
void LLOutfitGallery::onTexturePickerCommit(LLTextureCtrl::ETexturePickOp op, LLUUID id)
{
LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if (floaterp && op == LLTextureCtrl::TEXTURE_SELECT)
{
LLUUID image_item_id;
if (id.notNull())
{
image_item_id = id;
}
else
{
image_item_id = floaterp->findItemID(floaterp->getAssetID(), FALSE);
}
checkRemovePhoto(getSelectedOutfitUUID());
linkPhotoToOutfit(image_item_id, getSelectedOutfitUUID());
}
}
void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id)
{
if (selected_outfit_id.notNull())
{
// show hourglass cursor when loading inventory window
// because inventory construction is slooow
getWindow()->setCursor(UI_CURSOR_WAIT);
LLFloater* floaterp = mFloaterHandle.get();
// Show the dialog
if (floaterp)
{
floaterp->openFloater();
}
else
{
floaterp = new LLFloaterTexturePicker(
this,
getPhotoAssetId(selected_outfit_id),
getPhotoAssetId(selected_outfit_id),
getPhotoAssetId(selected_outfit_id),
FALSE,
TRUE,
"SELECT PHOTO",
PERM_NONE,
PERM_NONE,
PERM_NONE,
FALSE,
NULL);
mFloaterHandle = floaterp->getHandle();
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));
}
floaterp->openFloater();
}
floaterp->setFocus(TRUE);
}
}

View File

@ -33,6 +33,7 @@
#include "lllayoutstack.h"
#include "lloutfitslist.h"
#include "llpanelappearancetab.h"
#include "lltexturectrl.h"
#include "llviewertexture.h"
#include <vector>
@ -81,6 +82,8 @@ public:
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& info);
void onSelectPhoto(LLUUID selected_outfit_id);
/*virtual*/ void setFilterSubString(const std::string& string);
@ -97,6 +100,7 @@ public:
void refreshTextures(const LLUUID& category_id);
void refreshOutfit(const LLUUID& category_id);
void onTexturePickerCommit(LLTextureCtrl::ETexturePickOp op, LLUUID id);
protected:
/*virtual*/ void onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id);
/*virtual*/ void onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid);
@ -110,6 +114,8 @@ protected:
private:
void loadPhotos();
void uploadPhoto(LLUUID outfit_id);
LLUUID getPhotoAssetId(const LLUUID& outfit_id);
LLUUID getDefaultPhoto();
void linkPhotoToOutfit(LLUUID outfit_id, LLUUID photo_id);
bool checkRemovePhoto(LLUUID outfit_id);
void addToGallery(LLOutfitGalleryItem* item);
@ -124,6 +130,9 @@ private:
void removeFromLastRow(LLOutfitGalleryItem* item);
LLOutfitGalleryItem* buildGalleryItem(std::string name);
void onTextureSelectionChanged(LLInventoryItem* itemp);
void buildGalleryPanel(int row_count);
void reshapeGalleryPanel(int row_count);
LLPanel* buildItemPanel(int left);
@ -151,12 +160,11 @@ private:
int mRowPanelWidth;
int mGalleryWidth;
LLHandle<LLFloater> mFloaterHandle;
typedef std::map<LLUUID, LLOutfitGalleryItem*> outfit_map_t;
typedef outfit_map_t::value_type outfit_map_value_t;
outfit_map_t mOutfitMap;
typedef std::map<LLUUID, LLViewerInventoryItem*> texture_map_t;
typedef texture_map_t::value_type texture_map_value_t;
texture_map_t mTextureMap;
typedef std::map<LLOutfitGalleryItem*, int> item_num_map_t;
typedef item_num_map_t::value_type item_numb_map_value_t;
item_num_map_t mItemIndexMap;
@ -174,9 +182,9 @@ public:
protected:
/*virtual*/ void onUpdateItemsVisibility();
private:
/*virtual*/ void onUploadFoto();
/*virtual*/ void onSelectPhoto();
};
class LLOutfitGalleryItem : public LLPanel
@ -194,11 +202,13 @@ public:
void setDefaultImage();
void setImageAssetId(LLUUID asset_id);
LLUUID getImageAssetId();
void setOutfitName(std::string name);
void setOutfitWorn(bool value);
void setSelected(bool value);
private:
LLPointer<LLViewerTexture> mTexturep;
LLUUID mImageAssetId;
LLTextBox* mOutfitNameText;
LLTextBox* mOutfitWornText;
LLPanel* mTextBgPanel;

View File

@ -1091,7 +1091,8 @@ LLOutfitListGearMenuBase::LLOutfitListGearMenuBase(LLOutfitListBase* olist)
registrar.add("Gear.WearAdd", boost::bind(&LLOutfitListGearMenuBase::onAdd, this));
registrar.add("Gear.UploadPhoto", boost::bind(&LLOutfitListGearMenuBase::onUploadFoto, this));
registrar.add("Gear.SelectPhoto", boost::bind(&LLOutfitListGearMenuBase::onSelectPhoto, this));
enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenuBase::onEnable, this, _2));
enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenuBase::onVisible, this, _2));
@ -1229,6 +1230,11 @@ void LLOutfitListGearMenuBase::onUploadFoto()
}
void LLOutfitListGearMenuBase::onSelectPhoto()
{
}
LLOutfitListGearMenu::LLOutfitListGearMenu(LLOutfitListBase* olist)
: LLOutfitListGearMenuBase(olist)
{}
@ -1242,7 +1248,7 @@ void LLOutfitListGearMenu::onUpdateItemsVisibility()
mMenu->setItemVisible("expand", TRUE);
mMenu->setItemVisible("collapse", TRUE);
mMenu->setItemVisible("upload_photo", FALSE);
mMenu->setItemVisible("load_assets", TRUE);
mMenu->setItemVisible("select_photo", FALSE);
LLOutfitListGearMenuBase::onUpdateItemsVisibility();
}

View File

@ -164,6 +164,8 @@ public:
protected:
virtual void onUpdateItemsVisibility();
virtual void onUploadFoto();
virtual void onSelectPhoto();
const LLUUID& getSelectedOutfitID();
LLOutfitListBase* mOutfitList;

View File

@ -37,8 +37,6 @@
#include "llbutton.h"
#include "lldraghandle.h"
#include "llfocusmgr.h"
#include "llviewertexture.h"
#include "llfolderview.h"
#include "llfolderviewmodel.h"
#include "llinventory.h"
#include "llinventoryfunctions.h"
@ -83,118 +81,13 @@ static const S32 LOCAL_TRACKING_ID_COLUMN = 1;
//static const char WHITE_IMAGE_NAME[] = "Blank Texture";
//static const char NO_IMAGE_NAME[] = "None";
//////////////////////////////////////////////////////////////////////////////////////////
// LLFloaterTexturePicker
class LLFloaterTexturePicker : public LLFloater
{
public:
LLFloaterTexturePicker(
LLTextureCtrl* owner,
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 );
LLTextureCtrl* getOwner() const { return mOwner; }
void setOwner(LLTextureCtrl* 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(texture_selected_callback cb) {mTextureSelectedCallback = cb;}
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<LLFolderViewItem*> &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<LLViewerTexture> mTexturep;
LLTextureCtrl* mOwner;
LLUUID mImageAssetID; // Currently selected texture
LLUIImagePtr mFallbackImage; // What to show if currently selected texture is null.
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;
};
LLFloaterTexturePicker::LLFloaterTexturePicker(
LLTextureCtrl* owner,
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,
@ -203,9 +96,13 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
LLUIImagePtr fallback_image)
: LLFloater(LLSD()),
mOwner( owner ),
mImageAssetID( owner->getImageAssetID() ),
mFallbackImage( fallback_image ),
mOriginalImageAssetID(owner->getImageAssetID()),
mImageAssetID( image_asset_id ),
mOriginalImageAssetID(image_asset_id),
mFallbackImage(fallback_image),
mDefaultImageAssetID(default_image_asset_id),
mBlankImageAssetID(blank_image_asset_id),
mTentative(tentative),
mAllowNoTexture(allow_no_texture),
mLabel(label),
mTentativeLabel(NULL),
mResolutionLabel(NULL),
@ -218,7 +115,10 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mSelectedItemPinned( FALSE ),
mCanApply(true),
mCanPreview(true),
mPreviewSettingChanged(false)
mPreviewSettingChanged(false),
mOnFloaterCommitCallback(NULL),
mOnFloaterCloseCallback(NULL),
mSetImageAssetIDCallback(NULL)
{
buildFromFile("floater_texture_ctrl.xml");
mCanApplyImmediately = can_apply_immediately;
@ -401,9 +301,9 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask)
void LLFloaterTexturePicker::onClose(bool app_quitting)
{
if (mOwner)
if (mOnFloaterCloseCallback)
{
mOwner->onFloaterClose();
mOnFloaterCloseCallback();
}
stopUsingPipette();
}
@ -584,9 +484,9 @@ void LLFloaterTexturePicker::draw()
mTentativeLabel->setVisible( FALSE );
}
getChildView("Default")->setEnabled(mImageAssetID != mOwner->getDefaultImageAssetID() || mOwner->getTentative());
getChildView("Blank")->setEnabled(mImageAssetID != mOwner->getBlankImageAssetID() || mOwner->getTentative());
getChildView("None")->setEnabled(mOwner->getAllowNoTexture() && (!mImageAssetID.isNull() || mOwner->getTentative()));
getChildView("Default")->setEnabled(mImageAssetID != mDefaultImageAssetID || mTentative);
getChildView("Blank")->setEnabled(mImageAssetID != mBlankImageAssetID || mTentative);
getChildView("None")->setEnabled(mAllowNoTexture && (!mImageAssetID.isNull() || mTentative));
LLFloater::draw();
@ -631,7 +531,7 @@ void LLFloaterTexturePicker::draw()
}
// Draw Tentative Label over the image
if( mOwner->getTentative() && !mViewModel->isDirty() )
if( mTentative && !mViewModel->isDirty() )
{
mTentativeLabel->setVisible( TRUE );
drawChild(mTentativeLabel);
@ -706,17 +606,17 @@ PermissionMask LLFloaterTexturePicker::getFilterPermMask()
void LLFloaterTexturePicker::commitIfImmediateSet()
{
if (!mNoCopyTextureSelected && mOwner && mCanApply)
if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply)
{
mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CHANGE);
mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, LLUUID::null);
}
}
void LLFloaterTexturePicker::commitCancel()
{
if (!mNoCopyTextureSelected && mOwner && mCanApply)
if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply)
{
mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CANCEL);
mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, LLUUID::null);
}
}
@ -727,7 +627,7 @@ void LLFloaterTexturePicker::onBtnSetToDefault(void* userdata)
self->setCanApply(true, true);
if (self->mOwner)
{
self->setImageID( self->mOwner->getDefaultImageAssetID() );
self->setImageID( self->getDefaultImageAssetID() );
}
self->commitIfImmediateSet();
}
@ -737,7 +637,7 @@ void LLFloaterTexturePicker::onBtnBlank(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setCanApply(true, true);
self->setImageID( self->mOwner->getBlankImageAssetID() );
self->setImageID( self->getBlankImageAssetID() );
self->commitIfImmediateSet();
}
@ -767,9 +667,9 @@ void LLFloaterTexturePicker::onBtnCancel(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setImageID( self->mOriginalImageAssetID );
if (self->mOwner)
if (self->mOnFloaterCommitCallback)
{
self->mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CANCEL);
self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, LLUUID::null);
}
self->mViewModel->resetDirty();
self->closeFloater();
@ -779,17 +679,18 @@ void LLFloaterTexturePicker::onBtnCancel(void* userdata)
void LLFloaterTexturePicker::onBtnSelect(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
LLUUID local_id = LLUUID::null;
if (self->mOwner)
{
LLUUID local_id = LLUUID::null;
if (self->mLocalScrollCtrl->getVisible() && !self->mLocalScrollCtrl->getAllSelected().empty())
{
LLUUID temp_id = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID();
local_id = LLLocalBitmapMgr::getWorldID(temp_id);
}
self->mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_SELECT, local_id);
}
if (self->mOnFloaterCommitCallback)
{
self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_SELECT, local_id);
}
self->closeFloater();
}
@ -943,11 +844,17 @@ void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata)
{
LLUUID tracking_id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel(LOCAL_TRACKING_ID_COLUMN);
LLUUID inworld_id = LLLocalBitmapMgr::getWorldID(tracking_id);
self->mOwner->setImageAssetID(inworld_id);
if (self->mSetImageAssetIDCallback)
{
self->mSetImageAssetIDCallback(inworld_id);
}
if (self->childGetValue("apply_immediate_check").asBoolean())
{
self->mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CHANGE, inworld_id);
if (self->mOnFloaterCommitCallback)
{
self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, inworld_id);
}
}
}
}
@ -1240,13 +1147,17 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
{
floaterp = new LLFloaterTexturePicker(
this,
getImageAssetID(),
getDefaultImageAssetID(),
getBlankImageAssetID(),
getTentative(),
getAllowNoTexture(),
mLabel,
mImmediateFilterPermMask,
mDnDFilterPermMask,
mNonImmediateFilterPermMask,
mCanApplyImmediately,
mFallbackImage);
mFloaterHandle = floaterp->getHandle();
LLFloaterTexturePicker* texture_floaterp = dynamic_cast<LLFloaterTexturePicker*>(floaterp);
@ -1254,6 +1165,18 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
{
texture_floaterp->setTextureSelectedCallback(mOnTextureSelectedCallback);
}
if (texture_floaterp && mOnCloseCallback)
{
texture_floaterp->setOnFloaterCloseCallback(boost::bind(&LLTextureCtrl::onFloaterClose, this));
}
if (texture_floaterp)
{
texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2));
}
if (texture_floaterp)
{
texture_floaterp->setSetImageAssetIDCallback(boost::bind(&LLTextureCtrl::setImageAssetID, this, _1));
}
LLFloater* root_floater = gFloaterView->getParentFloater(this);
if (root_floater)

View File

@ -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<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;
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<LLFolderViewItem*> &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<LLViewerTexture> 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

View File

@ -46,6 +46,13 @@
<on_click
function="Gear.UploadPhoto" />
</menu_item_call>
<menu_item_call
label="Select Photo"
layout="topleft"
name="select_photo">
<on_click
function="Gear.SelectPhoto" />
</menu_item_call>
<menu_item_separator name="sepatator1" />
<!-- copied (with minor modifications) from menu_inventory_add.xml -->