summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-06-18 13:34:31 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-06-18 21:02:06 +0300
commita3a7733728fb463d911fdb7218d6db27f629d877 (patch)
treee09b0e3d6c06e235121a143c85706318e062dea4
parent55134593194a67a36c86eed0deff211b89eb18a1 (diff)
viewer-private#242 Last used picker mode can force picker into a disabled mode
-rw-r--r--indra/newview/lltexturectrl.cpp29
-rw-r--r--indra/newview/lltexturectrl.h3
2 files changed, 22 insertions, 10 deletions
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 4744edd5a3..2773f538cc 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -185,6 +185,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mSetImageAssetIDCallback(NULL),
mOnUpdateImageStatsCallback(NULL),
mBakeTextureEnabled(FALSE),
+ mLocalTextureEnabled(false),
mInventoryPickType(pick_type)
{
mCanApplyImmediately = can_apply_immediately;
@@ -524,6 +525,8 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask)
void LLFloaterTexturePicker::onOpen(const LLSD& key)
{
if (sLastPickerMode != 0
+ && (mLocalTextureEnabled || sLastPickerMode != 1)
+ && (mBakeTextureEnabled || sLastPickerMode != 2)
&& mModeSelector->selectByValue(sLastPickerMode))
{
changeMode();
@@ -1490,7 +1493,13 @@ void LLFloaterTexturePicker::refreshInventoryFilter()
void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled)
{
+ mLocalTextureEnabled = enabled;
mModeSelector->setEnabledByValue(1, enabled);
+ if (!enabled && (mModeSelector->getValue().asInteger() == 2))
+ {
+ mModeSelector->selectByValue(0);
+ onModeSelect(0, this);
+ }
}
void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled)
@@ -1877,11 +1886,9 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
if (texture_floaterp)
{
texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2, _3, _4, _5));
- }
- if (texture_floaterp)
- {
texture_floaterp->setSetImageAssetIDCallback(boost::bind(&LLTextureCtrl::setImageAssetID, this, _1));
+ texture_floaterp->setLocalTextureEnabled(mAllowLocalTexture);
texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled);
}
@@ -1891,12 +1898,6 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
floaterp->openFloater();
}
- LLFloaterTexturePicker* picker_floater = dynamic_cast<LLFloaterTexturePicker*>(floaterp);
- if (picker_floater)
- {
- picker_floater->setLocalTextureEnabled(mAllowLocalTexture);
- }
-
if (take_focus)
{
floaterp->setFocus(TRUE);
@@ -2076,6 +2077,16 @@ void LLTextureCtrl::setOnTextureSelectedCallback(texture_selected_callback cb)
}
}
+void LLTextureCtrl::setAllowLocalTexture(BOOL b)
+{
+ mAllowLocalTexture = b;
+ LLFloaterTexturePicker* picker_floater = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get());
+ if (picker_floater)
+ {
+ picker_floater->setLocalTextureEnabled(mAllowLocalTexture);
+ }
+}
+
void LLTextureCtrl::setImageAssetName(const std::string& name)
{
LLPointer<LLUIImage> imagep = LLUI::getUIImage(name);
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index db36ac9cc2..819b76e8bc 100644
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -181,7 +181,7 @@ public:
void setAllowNoTexture( BOOL b ) { mAllowNoTexture = b; }
bool getAllowNoTexture() const { return mAllowNoTexture; }
- void setAllowLocalTexture(BOOL b) { mAllowLocalTexture = b; }
+ void setAllowLocalTexture(BOOL b);
BOOL getAllowLocalTexture() const { return mAllowLocalTexture; }
const LLUUID& getImageItemID() { return mImageItemID; }
@@ -455,6 +455,7 @@ private:
set_on_update_image_stats_callback mOnUpdateImageStatsCallback;
BOOL mBakeTextureEnabled;
+ bool mLocalTextureEnabled;
static S32 sLastPickerMode;
};