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.cpp50
1 files changed, 29 insertions, 21 deletions
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index ff01e537ee..2027e958d5 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -88,7 +88,8 @@ bool get_is_predefined_texture(LLUUID asset_id)
|| asset_id == DEFAULT_OBJECT_NORMAL
|| asset_id == BLANK_OBJECT_NORMAL
|| asset_id == IMG_WHITE
- || asset_id == LLUUID(SCULPT_DEFAULT_TEXTURE))
+ || asset_id == LLUUID(SCULPT_DEFAULT_TEXTURE)
+ || asset_id == BLANK_MATERIAL_ASSET_ID)
{
return true;
}
@@ -163,7 +164,6 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mFallbackImage(fallback_image),
mDefaultImageAssetID(default_image_asset_id),
mBlankImageAssetID(blank_image_asset_id),
- mTentative(tentative),
mAllowNoTexture(allow_no_texture),
mLabel(label),
mTentativeLabel(NULL),
@@ -188,6 +188,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mLocalTextureEnabled(false),
mInventoryPickType(pick_type)
{
+ setTentative(tentative);
mCanApplyImmediately = can_apply_immediately;
buildFromFile("floater_texture_ctrl.xml");
setCanMinimize(false);
@@ -199,7 +200,7 @@ LLFloaterTexturePicker::~LLFloaterTexturePicker()
void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selection /*=true*/)
{
- if( ((mImageAssetID != image_id) || mTentative) && mActive)
+ if( ((mImageAssetID != image_id) || getTentative()) && mActive)
{
mNoCopyTextureSelected = false;
mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
@@ -277,6 +278,7 @@ void LLFloaterTexturePicker::setImageIDFromItem(const LLInventoryItem* itemp, bo
asset_id = BLANK_MATERIAL_ASSET_ID;
}
setImageID(asset_id, set_selection);
+ setTentative(false);
}
void LLFloaterTexturePicker::setActive( bool active )
@@ -657,7 +659,7 @@ void LLFloaterTexturePicker::draw()
bool valid_dims = updateImageStats();
// if we're inactive, gray out "apply immediate" checkbox
- mSelectBtn->setEnabled(mActive && mCanApply && valid_dims);
+ mSelectBtn->setEnabled(mActive && mCanApply && valid_dims && !getTentative());
mPipetteBtn->setEnabled(mActive);
mPipetteBtn->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
@@ -722,9 +724,9 @@ void LLFloaterTexturePicker::draw()
mTentativeLabel->setVisible( false );
}
- mDefaultBtn->setEnabled(mImageAssetID != mDefaultImageAssetID || mTentative);
- mBlankBtn->setEnabled((mImageAssetID != mBlankImageAssetID && mBlankImageAssetID.notNull()) || mTentative);
- mNoneBtn->setEnabled(mAllowNoTexture && (!mImageAssetID.isNull() || mTentative));
+ mDefaultBtn->setEnabled(mImageAssetID != mDefaultImageAssetID || getTentative());
+ mBlankBtn->setEnabled((mImageAssetID != mBlankImageAssetID && mBlankImageAssetID.notNull()) || getTentative());
+ mNoneBtn->setEnabled(mAllowNoTexture && (!mImageAssetID.isNull() || getTentative()));
LLFloater::draw();
@@ -777,7 +779,7 @@ void LLFloaterTexturePicker::draw()
}
// Draw Tentative Label over the image
- if( mTentative && !mViewModel->isDirty() )
+ if( getTentative() && !mViewModel->isDirty() )
{
mTentativeLabel->setVisible( true );
drawChild(mTentativeLabel);
@@ -980,6 +982,7 @@ void LLFloaterTexturePicker::onBtnSetToDefault(void* userdata)
if (self->mOwner)
{
self->setImageID( self->getDefaultImageAssetID() );
+ self->setTentative(false);
}
self->commitIfImmediateSet();
}
@@ -990,6 +993,7 @@ void LLFloaterTexturePicker::onBtnBlank(void* userdata)
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setCanApply(true, true);
self->setImageID( self->getBlankImageAssetID() );
+ self->setTentative(false);
self->commitIfImmediateSet();
}
@@ -1000,21 +1004,10 @@ void LLFloaterTexturePicker::onBtnNone(void* userdata)
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setCanApply(true, true);
self->setImageID( LLUUID::null );
+ self->setTentative(false);
self->commitIfImmediateSet();
}
-/*
-// static
-void LLFloaterTexturePicker::onBtnRevert(void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setImageID( self->mOriginalImageAssetID );
- // TODO: Change this to tell the owner to cancel. It needs to be
- // smart enough to restore multi-texture selections.
- self->mOwner->onFloaterCommit();
- self->mViewModel->resetDirty();
-}*/
-
// static
void LLFloaterTexturePicker::onBtnCancel(void* userdata)
{
@@ -1221,6 +1214,7 @@ void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata)
if (self->mSetImageAssetIDCallback)
{
self->mSetImageAssetIDCallback(inworld_id);
+ self->setTentative(false);
}
if (self->childGetValue("apply_immediate_check").asBoolean())
@@ -1299,6 +1293,7 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data
}
self->setImageID(imageID);
+ self->setTentative(false);
self->mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
if (!self->mPreviewSettingChanged)
@@ -1319,7 +1314,7 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data
void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply, bool inworld_image)
{
- mSelectBtn->setEnabled(can_apply);
+ mSelectBtn->setEnabled(can_apply && !getTentative()); // will be updated on draw
getChildRef<LLUICtrl>("preview_disabled").setVisible(!can_preview && inworld_image);
getChildRef<LLUICtrl>("apply_immediate_check").setVisible(can_preview);
@@ -1626,6 +1621,7 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
else
{
setImageID(te.getID());
+ setTentative(false);
}
mNoCopyTextureSelected = false;
@@ -1839,6 +1835,17 @@ void LLTextureCtrl::clear()
setImageAssetID(LLUUID::null);
}
+void LLTextureCtrl::setTentative(bool tentative)
+{
+ LLFloater* floaterp = mFloaterHandle.get();
+
+ if (floaterp)
+ {
+ floaterp->setTentative(tentative);
+ }
+ LLUICtrl::setTentative(tentative);
+}
+
void LLTextureCtrl::setLabel(const std::string& label)
{
mLabel = label;
@@ -2112,6 +2119,7 @@ void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id )
if( floaterp && getEnabled() )
{
floaterp->setImageID( asset_id );
+ floaterp->setTentative(getTentative());
floaterp->resetDirty();
}
}