summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelface.cpp
diff options
context:
space:
mode:
authorGraham Madarasz <graham@lindenlab.com>2013-06-11 12:48:59 -0700
committerGraham Madarasz <graham@lindenlab.com>2013-06-11 12:48:59 -0700
commit87946113cc2a6f0d60c11275bf4aa168c2ea19d6 (patch)
treeaa0955a5b63484d5358988b17ac82d06af2ed8ed /indra/newview/llpanelface.cpp
parent01f595d8716f7b80ab0088d93434fa77cc812c16 (diff)
NORSPEC-257 can't use automated TEMaterialGet functor as we need two possible defaults for diffuse alpha mode based on the alpha content of the diffuse texture
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rwxr-xr-xindra/newview/llpanelface.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 4fd55e1cf2..5d5df01782 100755
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -815,7 +815,7 @@ void LLPanelFace::updateUI()
// See if that's been overridden by a material setting for same...
//
- LLSelectedTEMaterial::getDiffuseAlphaMode(alpha_mode, identical_alpha_mode);
+ LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(alpha_mode, identical_alpha_mode, mIsAlpha);
LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode");
if (combobox_alphamode)
@@ -2288,6 +2288,38 @@ void LLPanelFace::LLSelectedTEMaterial::getMaxNormalRepeats(F32& repeats, bool&
identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_norm_repeats_func, repeats);
}
+void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha)
+{
+ struct LLSelectedTEGetDiffuseAlphaMode : public LLSelectedTEGetFunctor<U8>
+ {
+ LLSelectedTEGetDiffuseAlphaMode() : _isAlpha(false) {}
+ LLSelectedTEGetDiffuseAlphaMode(bool diffuse_texture_has_alpha) : _isAlpha(diffuse_texture_has_alpha) {}
+ virtual ~LLSelectedTEGetDiffuseAlphaMode() {}
+
+ U8 get(LLViewerObject* object, S32 face)
+ {
+ U8 diffuse_mode = _isAlpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+
+ LLTextureEntry* tep = object->getTE(face);
+ if (tep)
+ {
+ LLMaterial* mat = tep->getMaterialParams().get();
+ mat = (tep->getMaterialID().isNull() ? NULL : mat);
+ if (mat)
+ {
+ diffuse_mode = mat->getDiffuseAlphaMode();
+ }
+ }
+
+ return diffuse_mode;
+ }
+ bool _isAlpha; // whether or not the diffuse texture selected contains alpha information
+ } get_diff_mode(diffuse_texture_has_alpha);
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &get_diff_mode, diffuse_alpha_mode);
+}
+
+static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical);
+
void LLPanelFace::LLSelectedTE::getObjectScaleS(F32& scale_s, bool& identical)
{
struct LLSelectedTEGetObjectScaleS : public LLSelectedTEGetFunctor<F32>
@@ -2336,4 +2368,4 @@ void LLPanelFace::LLSelectedTE::getMaxDiffuseRepeats(F32& repeats, bool& identic
} max_diff_repeats_func;
identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_diff_repeats_func, repeats );
-} \ No newline at end of file
+}