summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloaterchangeitemthumbnail.cpp6
-rw-r--r--indra/newview/llfloaterchangeitemthumbnail.h2
-rw-r--r--indra/newview/llpanelprofile.cpp36
-rw-r--r--indra/newview/lltexturectrl.cpp145
-rw-r--r--indra/newview/lltexturectrl.h13
5 files changed, 118 insertions, 84 deletions
diff --git a/indra/newview/llfloaterchangeitemthumbnail.cpp b/indra/newview/llfloaterchangeitemthumbnail.cpp
index 1ad235ac0a..d7fbf1384b 100644
--- a/indra/newview/llfloaterchangeitemthumbnail.cpp
+++ b/indra/newview/llfloaterchangeitemthumbnail.cpp
@@ -698,11 +698,11 @@ void LLFloaterChangeItemThumbnail::showTexturePicker(const LLUUID &thumbnail_id)
{
//texture_floaterp->setTextureSelectedCallback();
//texture_floaterp->setOnUpdateImageStatsCallback();
- texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLUUID id)
+ texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLPickerSource, const LLUUID&, const LLUUID&)
{
if (op == LLTextureCtrl::TEXTURE_SELECT)
{
- onTexturePickerCommit(id);
+ onTexturePickerCommit();
}
}
);
@@ -722,7 +722,7 @@ void LLFloaterChangeItemThumbnail::showTexturePicker(const LLUUID &thumbnail_id)
floaterp->setFocus(TRUE);
}
-void LLFloaterChangeItemThumbnail::onTexturePickerCommit(LLUUID id)
+void LLFloaterChangeItemThumbnail::onTexturePickerCommit()
{
LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mPickerHandle.get();
diff --git a/indra/newview/llfloaterchangeitemthumbnail.h b/indra/newview/llfloaterchangeitemthumbnail.h
index de2a20bf2a..02f934337b 100644
--- a/indra/newview/llfloaterchangeitemthumbnail.h
+++ b/indra/newview/llfloaterchangeitemthumbnail.h
@@ -92,7 +92,7 @@ private:
void* userdata);
void showTexturePicker(const LLUUID &thumbnail_id);
- void onTexturePickerCommit(LLUUID id);
+ void onTexturePickerCommit();
void setThumbnailId(const LLUUID &new_thumbnail_id);
static void setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& object_id);
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index c67be5bb28..b6c2d1f0fd 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -1956,25 +1956,11 @@ void LLPanelProfileSecondLife::onShowTexturePicker()
mFloaterTexturePickerHandle = texture_floaterp->getHandle();
- texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLUUID id)
+ texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLPickerSource source, const LLUUID& asset_id, const LLUUID&)
{
if (op == LLTextureCtrl::TEXTURE_SELECT)
{
- LLUUID image_asset_id;
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterTexturePickerHandle.get();
- if (floaterp)
- {
- if (id.notNull())
- {
- image_asset_id = id;
- }
- else
- {
- image_asset_id = floaterp->getAssetID();
- }
- }
-
- onCommitProfileImage(image_asset_id);
+ onCommitProfileImage(asset_id);
}
});
texture_floaterp->setLocalTextureEnabled(FALSE);
@@ -2297,25 +2283,11 @@ void LLPanelProfileFirstLife::onChangePhoto()
mFloaterTexturePickerHandle = texture_floaterp->getHandle();
- texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLUUID id)
+ texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLPickerSource source, const LLUUID& asset_id, const LLUUID&)
{
if (op == LLTextureCtrl::TEXTURE_SELECT)
{
- LLUUID image_asset_id;
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterTexturePickerHandle.get();
- if (floaterp)
- {
- if (id.notNull())
- {
- image_asset_id = id;
- }
- else
- {
- image_asset_id = floaterp->getAssetID();
- }
- }
-
- onCommitPhoto(image_asset_id);
+ onCommitPhoto(asset_id);
}
});
texture_floaterp->setLocalTextureEnabled(FALSE);
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 21bb855704..36fa4e9a37 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -713,17 +713,76 @@ PermissionMask LLFloaterTexturePicker::getFilterPermMask()
void LLFloaterTexturePicker::commitIfImmediateSet()
{
- if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply)
+ if (!mNoCopyTextureSelected && mCanApply)
{
- mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, LLUUID::null);
+ commitCallback();
}
}
+void LLFloaterTexturePicker::commitCallback()
+{
+ if (!mOnFloaterCommitCallback)
+ {
+ return;
+ }
+ LLUUID asset_id = mImageAssetID;
+ LLUUID inventory_id;
+ LLPickerSource mode = (LLPickerSource)mModeSelector->getValue().asInteger();
+
+ switch (mode)
+ {
+ case PICKER_INVENTORY:
+ {
+ LLFolderView* root_folder = mInventoryPanel->getRootFolder();
+ if (root_folder && root_folder->getCurSelectedItem())
+ {
+ LLFolderViewItem* last_selected = root_folder->getCurSelectedItem();
+ LLFolderViewModelItemInventory* inv_view = static_cast<LLFolderViewModelItemInventory*>(last_selected->getViewModelItem());
+
+ LLInventoryItem* itemp = gInventory.getItem(inv_view->getUUID());
+ if (itemp && itemp->getAssetUUID() == mImageAssetID)
+ {
+ inventory_id = inv_view->getUUID();
+ }
+ else
+ {
+ mode = PICKER_UNKNOWN; // source of id unknown
+ }
+ }
+ else
+ {
+ mode = PICKER_UNKNOWN; // source of id unknown
+ }
+ break;
+ }
+ case PICKER_LOCAL:
+ {
+ if (!mLocalScrollCtrl->getAllSelected().empty())
+ {
+ LLUUID temp_id = mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID();
+ asset_id = LLLocalBitmapMgr::getInstance()->getWorldID(temp_id);
+ }
+ else
+ {
+ asset_id = mImageAssetID;
+ mode = PICKER_UNKNOWN; // source of id unknown
+ }
+ break;
+ }
+ case PICKER_BAKE:
+ break;
+ default:
+ mode = PICKER_UNKNOWN; // source of id unknown
+ break;
+ }
+
+ mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, mode, asset_id, inventory_id);
+}
void LLFloaterTexturePicker::commitCancel()
{
if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply)
{
- mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, LLUUID::null);
+ mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, PICKER_UNKNOWN, mOriginalImageAssetID, LLUUID::null);
}
}
@@ -776,7 +835,7 @@ void LLFloaterTexturePicker::onBtnCancel(void* userdata)
self->setImageID( self->mOriginalImageAssetID );
if (self->mOnFloaterCommitCallback)
{
- self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, LLUUID::null);
+ self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, PICKER_UNKNOWN, self->mOriginalImageAssetID, LLUUID::null);
}
self->mViewModel->resetDirty();
self->closeFloater();
@@ -786,20 +845,7 @@ void LLFloaterTexturePicker::onBtnCancel(void* userdata)
void LLFloaterTexturePicker::onBtnSelect(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- LLUUID local_id = LLUUID::null;
- if (self->mOwner)
- {
- if (self->mLocalScrollCtrl->getVisible() && !self->mLocalScrollCtrl->getAllSelected().empty())
- {
- LLUUID temp_id = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID();
- local_id = LLLocalBitmapMgr::getInstance()->getWorldID(temp_id);
- }
- }
-
- if (self->mOnFloaterCommitCallback)
- {
- self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_SELECT, local_id);
- }
+ self->commitCallback();
self->closeFloater();
}
@@ -861,25 +907,25 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata)
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
int index = self->mModeSelector->getValue().asInteger();
- self->mDefaultBtn->setVisible(index == 0 ? TRUE : FALSE);
- self->mBlankBtn->setVisible(index == 0 ? TRUE : FALSE);
- self->mNoneBtn->setVisible(index == 0 ? TRUE : FALSE);
- self->mPipetteBtn->setVisible(index == 0 ? TRUE : FALSE);
- self->getChild<LLFilterEditor>("inventory search editor")->setVisible(index == 0 ? TRUE : FALSE);
- self->getChild<LLInventoryPanel>("inventory panel")->setVisible(index == 0 ? TRUE : FALSE);
+ self->mDefaultBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
+ self->mBlankBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
+ self->mNoneBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
+ self->mPipetteBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
+ self->getChild<LLFilterEditor>("inventory search editor")->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
+ self->getChild<LLInventoryPanel>("inventory panel")->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
/*self->getChild<LLCheckBox>("show_folders_check")->setVisible(mode);
no idea under which conditions the above is even shown, needs testing. */
- self->getChild<LLButton>("l_add_btn")->setVisible(index == 1 ? TRUE : FALSE);
- self->getChild<LLButton>("l_rem_btn")->setVisible(index == 1 ? TRUE : FALSE);
- self->getChild<LLButton>("l_upl_btn")->setVisible(index == 1 ? TRUE : FALSE);
- self->getChild<LLScrollListCtrl>("l_name_list")->setVisible(index == 1 ? TRUE : FALSE);
+ self->getChild<LLButton>("l_add_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE);
+ self->getChild<LLButton>("l_rem_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE);
+ self->getChild<LLButton>("l_upl_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE);
+ self->getChild<LLScrollListCtrl>("l_name_list")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE);
- self->getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(index == 2 ? TRUE : FALSE);
+ self->getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(index == PICKER_BAKE ? TRUE : FALSE);
self->getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setVisible(FALSE);// index == 2 ? TRUE : FALSE);
- if (index == 2)
+ if (index == PICKER_BAKE)
{
self->stopUsingPipette();
@@ -1020,7 +1066,7 @@ void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata)
{
if (self->mOnFloaterCommitCallback)
{
- self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, inworld_id);
+ self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, PICKER_LOCAL, inworld_id, LLUUID::null);
}
}
}
@@ -1457,7 +1503,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
}
if (texture_floaterp)
{
- texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2));
+ texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2, _3, _4));
}
if (texture_floaterp)
{
@@ -1574,7 +1620,7 @@ void LLTextureCtrl::onFloaterClose()
mFloaterHandle.markDead();
}
-void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id)
+void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLPickerSource source, const LLUUID& asset_id, const LLUUID& inv_id)
{
LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
@@ -1588,22 +1634,29 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id)
else if (mCommitOnSelection || op == TEXTURE_SELECT)
mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
- if(floaterp->isDirty() || id.notNull()) // mModelView->setDirty does not work.
+ if(floaterp->isDirty() || asset_id.notNull()) // mModelView->setDirty does not work.
{
setTentative( FALSE );
- if (id.notNull())
- {
- mImageItemID = id;
- mImageAssetID = id;
- }
- else
- {
- mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE);
- LL_DEBUGS() << "mImageItemID: " << mImageItemID << LL_ENDL;
- mImageAssetID = floaterp->getAssetID();
- LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << LL_ENDL;
- }
+ switch(source)
+ {
+ case PICKER_INVENTORY:
+ mImageItemID = inv_id;
+ mImageAssetID = asset_id;
+ break;
+ case PICKER_BAKE:
+ case PICKER_LOCAL:
+ mImageItemID = LLUUID::null;
+ mImageAssetID = asset_id;
+ break;
+ case PICKER_UNKNOWN:
+ default:
+ mImageItemID = floaterp->findItemID(asset_id, FALSE);
+ mImageAssetID = asset_id;
+ break;
+ }
+
+ LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << ", mImageItemID: " << mImageItemID << LL_ENDL;
if (op == TEXTURE_SELECT && mOnSelectCallback)
{
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index 8ef6d9bee7..3cf8861075 100644
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -63,6 +63,14 @@ bool get_is_predefined_texture(LLUUID asset_id);
LLUUID get_copy_free_item_by_asset_id(LLUUID image_id, bool no_trans_perm = false);
bool get_can_copy_texture(LLUUID image_id);
+enum LLPickerSource
+{
+ PICKER_INVENTORY,
+ PICKER_LOCAL,
+ PICKER_BAKE,
+ PICKER_UNKNOWN, // on cancel, default ids
+};
+
//////////////////////////////////////////////////////////////////////////////////////////
// LLTextureCtrl
@@ -188,7 +196,7 @@ public:
void closeDependentFloater();
void onFloaterClose();
- void onFloaterCommit(ETexturePickOp op, LLUUID id);
+ void onFloaterCommit(ETexturePickOp op, LLPickerSource source, const LLUUID& local_id, const LLUUID& inv_id);
// This call is returned when a drag is detected. Your callback
// should return TRUE if the drag is acceptable.
@@ -256,7 +264,7 @@ private:
//////////////////////////////////////////////////////////////////////////////////////////
// LLFloaterTexturePicker
-typedef boost::function<void(LLTextureCtrl::ETexturePickOp op, LLUUID id)> floater_commit_callback;
+typedef boost::function<void(LLTextureCtrl::ETexturePickOp op, LLPickerSource source, const LLUUID& asset_id, const LLUUID& inventory_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;
@@ -309,6 +317,7 @@ public:
void updateFilterPermMask();
void commitIfImmediateSet();
+ void commitCallback();
void commitCancel();
void onFilterEdit(const std::string& search_string);