From 17d3f3786376578b765cd7a9b7f9a9e391e53cb9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 16 Feb 2023 21:33:14 +0200 Subject: SL-17640 Fix 'Apply now' being enabled when importing --- indra/newview/llmaterialeditor.cpp | 15 +++++++++++++++ indra/newview/lltexturectrl.cpp | 12 +++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 41085afb3d..64ce5fd4d2 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -420,6 +420,13 @@ BOOL LLMaterialEditor::postBuild() mEmissiveTextureCtrl->setOnSelectCallback(boost::bind(&LLMaterialEditor::onSelectCtrl, this, _1, _2, MATERIAL_EMISIVE_TEX_DIRTY)); mNormalTextureCtrl->setOnSelectCallback(boost::bind(&LLMaterialEditor::onSelectCtrl, this, _1, _2, MATERIAL_NORMAL_TEX_DIRTY)); } + else + { + mBaseColorTextureCtrl->setCanApplyImmediately(false); + mMetallicTextureCtrl->setCanApplyImmediately(false); + mEmissiveTextureCtrl->setCanApplyImmediately(false); + mNormalTextureCtrl->setCanApplyImmediately(false); + } if (!mIsOverride) { @@ -461,6 +468,10 @@ BOOL LLMaterialEditor::postBuild() mBaseColorCtrl->setOnCancelCallback(boost::bind(&LLMaterialEditor::onCancelCtrl, this, _1, _2, MATERIAL_BASE_COLOR_DIRTY)); mBaseColorCtrl->setOnSelectCallback(boost::bind(&LLMaterialEditor::onSelectCtrl, this, _1, _2, MATERIAL_BASE_COLOR_DIRTY)); } + else + { + mBaseColorCtrl->setCanApplyImmediately(false); + } // transparency is a part of base color childSetCommitCallback("transparency", changes_callback, (void*)&MATERIAL_BASE_COLOR_DIRTY); childSetCommitCallback("alpha mode", changes_callback, (void*)&MATERIAL_ALPHA_MODE_DIRTY); @@ -477,6 +488,10 @@ BOOL LLMaterialEditor::postBuild() mEmissiveColorCtrl->setOnCancelCallback(boost::bind(&LLMaterialEditor::onCancelCtrl, this, _1, _2, MATERIAL_EMISIVE_COLOR_DIRTY)); mEmissiveColorCtrl->setOnSelectCallback(boost::bind(&LLMaterialEditor::onSelectCtrl, this, _1, _2, MATERIAL_EMISIVE_COLOR_DIRTY)); } + else + { + mEmissiveColorCtrl->setCanApplyImmediately(false); + } if (!mIsOverride) { diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 4849015e79..6c38550049 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -251,7 +251,9 @@ void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b) { mCanApplyImmediately = b; - getChild("apply_immediate_check")->setValue(mCanApplyImmediately); + LLUICtrl *apply_checkbox = getChild("apply_immediate_check"); + apply_checkbox->setValue(mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview")); + apply_checkbox->setEnabled(mCanApplyImmediately); } void LLFloaterTexturePicker::stopUsingPipette() @@ -528,7 +530,7 @@ BOOL LLFloaterTexturePicker::postBuild() mNoCopyTextureSelected = FALSE; - getChild("apply_immediate_check")->setValue(gSavedSettings.getBOOL("TextureLivePreview")); + getChild("apply_immediate_check")->setValue(mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview")); childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this); getChildView("apply_immediate_check")->setEnabled(mCanApplyImmediately); @@ -862,7 +864,7 @@ void LLFloaterTexturePicker::onSelectionChange(const std::dequemPreviewSettingChanged) { - self->mCanPreview = gSavedSettings.getBOOL("TextureLivePreview"); + self->mCanPreview = self->mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview"); } else { @@ -1184,7 +1186,7 @@ void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply) getChildRef("apply_immediate_check").setVisible(can_preview); mCanApply = can_apply; - mCanPreview = can_preview ? gSavedSettings.getBOOL("TextureLivePreview") : false; + mCanPreview = can_preview ? (mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview")) : false; mPreviewSettingChanged = true; } -- cgit v1.2.3