From 0ea99ea01fc12fa0210a61a3664ff828d3984575 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Wed, 10 Oct 2012 14:07:30 -0700 Subject: Adding a setting to allow user to edit the specular color alpha. --- indra/newview/llfloaterdebugmaterials.cpp | 27 ++++++++++++++++------ indra/newview/llfloaterdebugmaterials.h | 4 ++++ .../default/xui/en/floater_debug_materials.xml | 24 +++++++++++++++---- 3 files changed, 44 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterdebugmaterials.cpp b/indra/newview/llfloaterdebugmaterials.cpp index 8951c833be..10a4e9e022 100644 --- a/indra/newview/llfloaterdebugmaterials.cpp +++ b/indra/newview/llfloaterdebugmaterials.cpp @@ -50,6 +50,7 @@ #include "llscrolllistitem.h" #include "llsd.h" #include "llselectmgr.h" +#include "llspinctrl.h" #include "llstring.h" #include "llstyle.h" #include "lltextbase.h" @@ -192,6 +193,9 @@ BOOL LLFloaterDebugMaterials::postBuild() mSpecularColor = findChild("specular_color"); llassert(mSpecularColor != NULL); + mSpecularColorAlpha = findChild("specular_color_alpha"); + llassert(mSpecularColorAlpha != NULL); + mSpecularExponent = findChild("specular_exponent"); llassert(mSpecularExponent != NULL); mSpecularExponent->setPrevalidate(LLTextValidate::validateInt); @@ -334,6 +338,7 @@ LLFloaterDebugMaterials::LLFloaterDebugMaterials(const LLSD& pParams) mSpecularMapRepeatY(NULL), mSpecularMapRotation(NULL), mSpecularColor(NULL), + mSpecularColorAlpha(NULL), mSpecularExponent(NULL), mEnvironmentExponent(NULL), mAlphaMaskCutoff(NULL), @@ -664,10 +669,8 @@ void LLFloaterDebugMaterials::requestPutMaterials(bool pIsDoSet) materialData[MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD] = static_cast(getSpecularMapRepeatY()); materialData[MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD] = static_cast(getSpecularMapRotation()); - const LLColor4& specularColor = mSpecularColor->get(); - LLColor4U specularColor4U = specularColor; - materialData[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = specularColor4U.getValue(); - + LLColor4U specularColor = getSpecularColor(); + materialData[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = specularColor.getValue(); materialData[MATERIALS_CAP_SPECULAR_EXP_FIELD] = static_cast(getSpecularExponent()); materialData[MATERIALS_CAP_ENV_INTENSITY_FIELD] = static_cast(getEnvironmentExponent()); materialData[MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD] = static_cast(getAlphMaskCutoff()); @@ -1215,6 +1218,7 @@ void LLFloaterDebugMaterials::setState(EState pState) void LLFloaterDebugMaterials::resetObjectEditInputs() { const LLSD zeroValue = static_cast(0); + const LLSD maxAlphaValue = static_cast(255); mNormalMap->clear(); mNormalMapOffsetX->setValue(zeroValue); @@ -1230,13 +1234,12 @@ void LLFloaterDebugMaterials::resetObjectEditInputs() mSpecularMapRepeatY->setValue(zeroValue); mSpecularMapRotation->setValue(zeroValue); - mSpecularColor->clear(); + mSpecularColor->set(mDefaultSpecularColor); + mSpecularColorAlpha->setValue(maxAlphaValue); mSpecularExponent->setValue(zeroValue); mEnvironmentExponent->setValue(zeroValue); mAlphaMaskCutoff->setValue(zeroValue); mDiffuseAlphaMode->setValue(zeroValue); - - mSpecularColor->set(mDefaultSpecularColor); } void LLFloaterDebugMaterials::clearGetResults() @@ -1431,6 +1434,16 @@ S32 LLFloaterDebugMaterials::getSpecularMapRotation() const return getLineEditorValue(mSpecularMapRotation); } +LLColor4U LLFloaterDebugMaterials::getSpecularColor() const +{ + const LLColor4& specularColor = mSpecularColor->get(); + LLColor4U specularColor4U = specularColor; + + specularColor4U.setAlpha(static_cast(llclamp(llround(mSpecularColorAlpha->get()), 0, 255))); + + return specularColor4U; +} + S32 LLFloaterDebugMaterials::getSpecularExponent() const { return getLineEditorValue(mSpecularExponent); diff --git a/indra/newview/llfloaterdebugmaterials.h b/indra/newview/llfloaterdebugmaterials.h index 65f3cbd6ca..6ada255015 100644 --- a/indra/newview/llfloaterdebugmaterials.h +++ b/indra/newview/llfloaterdebugmaterials.h @@ -37,10 +37,12 @@ class LLButton; class LLColorSwatchCtrl; +class LLColor4U; class LLLineEditor; class LLMaterialID; class LLScrollListCtrl; class LLSD; +class LLSpinCtrl; class LLTextBase; class LLTextureCtrl; class LLUICtrl; @@ -135,6 +137,7 @@ private: S32 getSpecularMapRepeatY() const; S32 getSpecularMapRotation() const; + LLColor4U getSpecularColor() const; S32 getSpecularExponent() const; S32 getEnvironmentExponent() const; S32 getAlphMaskCutoff() const; @@ -159,6 +162,7 @@ private: LLLineEditor* mSpecularMapRepeatY; LLLineEditor* mSpecularMapRotation; LLColorSwatchCtrl* mSpecularColor; + LLSpinCtrl* mSpecularColorAlpha; LLLineEditor* mSpecularExponent; LLLineEditor* mEnvironmentExponent; LLLineEditor* mAlphaMaskCutoff; diff --git a/indra/newview/skins/default/xui/en/floater_debug_materials.xml b/indra/newview/skins/default/xui/en/floater_debug_materials.xml index e2e197a14e..504a52e762 100644 --- a/indra/newview/skins/default/xui/en/floater_debug_materials.xml +++ b/indra/newview/skins/default/xui/en/floater_debug_materials.xml @@ -572,7 +572,7 @@ bevel_style="none" follows="left|top|right" layout="topleft" - height="132" + height="162" top_pad="-226" left_pad="20" width="243"> @@ -603,6 +603,22 @@ name="specular_color" tool_tip="Click to open color picker" width="40" /> + Specular Exponent @@ -715,7 +731,7 @@ layout="topleft" height="22" left="0" - top_pad="110" + top_pad="80" width="810">