summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturectrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltexturectrl.cpp')
-rw-r--r--indra/newview/lltexturectrl.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index db3e6335ec..c51e90e632 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),
mSelectionSource(PICKER_UNKNOWN)
{
@@ -529,6 +530,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();
@@ -1507,7 +1510,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)
@@ -1895,11 +1904,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 && mInventoryPickType != PICK_MATERIAL);
}
@@ -1909,12 +1916,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);
@@ -2094,6 +2095,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);