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

meow-7.2.2
Graham Madarasz 2013-06-11 12:48:59 -07:00
parent 01f595d871
commit 87946113cc
2 changed files with 37 additions and 6 deletions

View File

@ -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 );
}
}

View File

@ -297,8 +297,8 @@ private:
LLTextureEntry* tep = object ? object->getTE(face) : NULL;
if (tep)
{
material_ptr = object->getTE(face)->getMaterialParams();
if (!material_ptr.isNull())
material_ptr = tep->getMaterialParams();
if (!material_ptr.isNull() && !tep->getMaterialID().isNull())
{
ret = (material_ptr->*(MaterialGetFunc))();
}
@ -404,11 +404,10 @@ private:
static void getCurrent(LLMaterialPtr& material_ptr, bool& identical_material);
static void getMaxSpecularRepeats(F32& repeats, bool& identical);
static void getMaxNormalRepeats(F32& repeats, bool& identical);
static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha);
DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null)
DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null)
DEF_GET_MAT_STATE(U8,U8,getDiffuseAlphaMode,LLMaterial::DIFFUSE_ALPHA_MODE_NONE)
DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f)
DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f)
DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f)