diff options
-rw-r--r-- | indra/newview/llfloaterdebugmaterials.cpp | 348 | ||||
-rw-r--r-- | indra/newview/llfloaterdebugmaterials.h | 43 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_debug_materials.xml | 925 |
3 files changed, 1065 insertions, 251 deletions
diff --git a/indra/newview/llfloaterdebugmaterials.cpp b/indra/newview/llfloaterdebugmaterials.cpp index 6d6034ac9d..632772c31a 100644 --- a/indra/newview/llfloaterdebugmaterials.cpp +++ b/indra/newview/llfloaterdebugmaterials.cpp @@ -38,10 +38,12 @@ #include "llagent.h" #include "llbutton.h" +#include "llcolorswatch.h" #include "llenvmanager.h" #include "llfloater.h" #include "llfontgl.h" #include "llhttpclient.h" +#include "lllineeditor.h" #include "llscrolllistcell.h" #include "llscrolllistctrl.h" #include "llscrolllistitem.h" @@ -50,28 +52,43 @@ #include "llstring.h" #include "llstyle.h" #include "lltextbase.h" +#include "lltexturectrl.h" +#include "lltextvalidate.h" #include "lluicolortable.h" +#include "lluictrl.h" #include "llviewerobject.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" #include "v4color.h" #include "v4coloru.h" -#define MATERIALS_CAPABILITY_NAME "RenderMaterials" - -#define MATERIALS_CAP_FULL_PER_FACE_FIELD "FullMaterialsPerFace" -#define MATERIALS_CAP_FACE_FIELD "Face" -#define MATERIALS_CAP_MATERIAL_FIELD "Material" -#define MATERIALS_CAP_OBJECT_ID_FIELD "ID" -#define MATERIALS_CAP_MATERIAL_ID_FIELD "MaterialID" - -#define MATERIALS_CAP_NORMAL_MAP_FIELD "NormMap" -#define MATERIALS_CAP_SPECULAR_MAP_FIELD "SpecMap" -#define MATERIALS_CAP_SPECULAR_COLOR_FIELD "SpecColor" -#define MATERIALS_CAP_SPECULAR_EXP_FIELD "SpecExp" -#define MATERIALS_CAP_ENV_INTENSITY_FIELD "EnvIntensity" -#define MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD "AlphaMaskCutoff" -#define MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD "DiffuseAlphaMode" +#define MATERIALS_CAPABILITY_NAME "RenderMaterials" + +#define MATERIALS_CAP_FULL_PER_FACE_FIELD "FullMaterialsPerFace" +#define MATERIALS_CAP_FACE_FIELD "Face" +#define MATERIALS_CAP_MATERIAL_FIELD "Material" +#define MATERIALS_CAP_OBJECT_ID_FIELD "ID" +#define MATERIALS_CAP_MATERIAL_ID_FIELD "MaterialID" + +#define MATERIALS_CAP_NORMAL_MAP_FIELD "NormMap" +#define MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD "NormOffsetX" +#define MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD "NormOffsetY" +#define MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD "NormRepeatX" +#define MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD "NormRepeatY" +#define MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD "NormRotation" + +#define MATERIALS_CAP_SPECULAR_MAP_FIELD "SpecMap" +#define MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD "SpecOffsetX" +#define MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD "SpecOffsetY" +#define MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD "SpecRepeatX" +#define MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD "SpecRepeatY" +#define MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD "SpecRotation" + +#define MATERIALS_CAP_SPECULAR_COLOR_FIELD "SpecColor" +#define MATERIALS_CAP_SPECULAR_EXP_FIELD "SpecExp" +#define MATERIALS_CAP_ENV_INTENSITY_FIELD "EnvIntensity" +#define MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD "AlphaMaskCutoff" +#define MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD "DiffuseAlphaMode" class MaterialsResponder : public LLHTTPClient::Responder { @@ -105,6 +122,85 @@ BOOL LLFloaterDebugMaterials::postBuild() llassert(mGetScrollList != NULL); mGetScrollList->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onGetResultsSelectionChange, this)); + mNormalMap = findChild<LLTextureCtrl>("normal_map"); + llassert(mNormalMap != NULL); + + mNormalMapOffsetX = findChild<LLLineEditor>("normal_map_offset_x"); + llassert(mNormalMapOffsetX != NULL); + mNormalMapOffsetX->setPrevalidate(LLTextValidate::validateInt); + mNormalMapOffsetX->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mNormalMapOffsetY = findChild<LLLineEditor>("normal_map_offset_y"); + llassert(mNormalMapOffsetY != NULL); + mNormalMapOffsetY->setPrevalidate(LLTextValidate::validateInt); + mNormalMapOffsetY->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mNormalMapRepeatX = findChild<LLLineEditor>("normal_map_repeat_x"); + llassert(mNormalMapRepeatX != NULL); + mNormalMapRepeatX->setPrevalidate(LLTextValidate::validateInt); + mNormalMapRepeatX->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mNormalMapRepeatY = findChild<LLLineEditor>("normal_map_repeat_y"); + llassert(mNormalMapRepeatY != NULL); + mNormalMapRepeatY->setPrevalidate(LLTextValidate::validateInt); + mNormalMapRepeatY->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mNormalMapRotation = findChild<LLLineEditor>("normal_map_rotation"); + llassert(mNormalMapRotation != NULL); + mNormalMapRotation->setPrevalidate(LLTextValidate::validateInt); + mNormalMapRotation->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mSpecularMap = findChild<LLTextureCtrl>("specular_map"); + llassert(mSpecularMap != NULL); + + mSpecularMapOffsetX = findChild<LLLineEditor>("specular_map_offset_x"); + llassert(mSpecularMapOffsetX != NULL); + mSpecularMapOffsetX->setPrevalidate(LLTextValidate::validateInt); + mSpecularMapOffsetX->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mSpecularMapOffsetY = findChild<LLLineEditor>("specular_map_offset_y"); + llassert(mSpecularMapOffsetY != NULL); + mSpecularMapOffsetY->setPrevalidate(LLTextValidate::validateInt); + mSpecularMapOffsetY->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mSpecularMapRepeatX = findChild<LLLineEditor>("specular_map_repeat_x"); + llassert(mSpecularMapRepeatX != NULL); + mSpecularMapRepeatX->setPrevalidate(LLTextValidate::validateInt); + mSpecularMapRepeatX->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mSpecularMapRepeatY = findChild<LLLineEditor>("specular_map_repeat_y"); + llassert(mSpecularMapRepeatY != NULL); + mSpecularMapRepeatY->setPrevalidate(LLTextValidate::validateInt); + mSpecularMapRepeatY->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mSpecularMapRotation = findChild<LLLineEditor>("specular_map_rotation"); + llassert(mSpecularMapRotation != NULL); + mSpecularMapRotation->setPrevalidate(LLTextValidate::validateInt); + mSpecularMapRotation->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mSpecularColor = findChild<LLColorSwatchCtrl>("specular_color"); + llassert(mSpecularColor != NULL); + + mSpecularExponent = findChild<LLLineEditor>("specular_exponent"); + llassert(mSpecularExponent != NULL); + mSpecularExponent->setPrevalidate(LLTextValidate::validateInt); + mSpecularExponent->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mEnvironmentExponent = findChild<LLLineEditor>("environment_exponent"); + llassert(mEnvironmentExponent != NULL); + mEnvironmentExponent->setPrevalidate(LLTextValidate::validateInt); + mEnvironmentExponent->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mAlphaMaskCutoff = findChild<LLLineEditor>("alpha_mask_cutoff"); + llassert(mAlphaMaskCutoff != NULL); + mAlphaMaskCutoff->setPrevalidate(LLTextValidate::validateInt); + mAlphaMaskCutoff->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + + mDiffuseAlphaMode = findChild<LLLineEditor>("diffuse_alpha_mode"); + llassert(mDiffuseAlphaMode != NULL); + mDiffuseAlphaMode->setPrevalidate(LLTextValidate::validateInt); + mDiffuseAlphaMode->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onValueEntered, this, _1)); + mPutSetButton = findChild<LLButton>("put_set_button"); llassert(mPutSetButton != NULL); mPutSetButton->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onPutSetClicked, this)); @@ -127,6 +223,8 @@ BOOL LLFloaterDebugMaterials::postBuild() mPostScrollList = findChild<LLScrollListCtrl>("post_scroll_list"); llassert(mPostScrollList != NULL); + mDefaultSpecularColor = LLUIColorTable::instance().getColor("White"); + mWarningColor = LLUIColorTable::instance().getColor("MaterialWarningColor"); mErrorColor = LLUIColorTable::instance().getColor("MaterialErrorColor"); @@ -155,6 +253,7 @@ void LLFloaterDebugMaterials::onOpen(const LLSD& pKey) } checkRegionMaterialStatus(); + resetObjectEditInputs(); clearGetResults(); clearPutResults(); clearPostResults(); @@ -164,6 +263,7 @@ void LLFloaterDebugMaterials::onOpen(const LLSD& pKey) void LLFloaterDebugMaterials::onClose(bool pIsAppQuitting) { mGetScrollList->setCommitOnSelectionChange(FALSE); + resetObjectEditInputs(); clearGetResults(); clearPutResults(); clearPostResults(); @@ -191,6 +291,23 @@ LLFloaterDebugMaterials::LLFloaterDebugMaterials(const LLSD& pParams) mStatusText(NULL), mGetButton(NULL), mGetScrollList(NULL), + mNormalMap(NULL), + mNormalMapOffsetX(NULL), + mNormalMapOffsetY(NULL), + mNormalMapRepeatX(NULL), + mNormalMapRepeatY(NULL), + mNormalMapRotation(NULL), + mSpecularMap(NULL), + mSpecularMapOffsetX(NULL), + mSpecularMapOffsetY(NULL), + mSpecularMapRepeatX(NULL), + mSpecularMapRepeatY(NULL), + mSpecularMapRotation(NULL), + mSpecularColor(NULL), + mSpecularExponent(NULL), + mEnvironmentExponent(NULL), + mAlphaMaskCutoff(NULL), + mDiffuseAlphaMode(NULL), mPutSetButton(NULL), mPutClearButton(NULL), mPutScrollList(NULL), @@ -215,6 +332,24 @@ void LLFloaterDebugMaterials::onGetClicked() requestGetMaterials(); } +void LLFloaterDebugMaterials::onValueEntered(LLUICtrl* pUICtrl) +{ + LLLineEditor *pLineEditor = static_cast<LLLineEditor *>(pUICtrl); + llassert(pLineEditor != NULL); + + const std::string &valueString = pLineEditor->getText(); + + S32 intValue = 0; + bool doResetValue = (!valueString.empty() && !LLStringUtil::convertToS32(valueString, intValue)); + + if (doResetValue) + { + llwarns << "cannot parse string '" << valueString << "' to an S32 value" <<llendl; + LLSD value = static_cast<LLSD::Integer>(intValue); + pLineEditor->setValue(value); + } +} + void LLFloaterDebugMaterials::onPutSetClicked() { requestPutMaterials(true); @@ -441,56 +576,37 @@ void LLFloaterDebugMaterials::requestPutMaterials(bool pIsDoSet) { LLSD materialData = LLSD::emptyMap(); -#define FACE_MODULATOR 4 - if ((curFaceIndex % FACE_MODULATOR) == 0) - { - materialData[MATERIALS_CAP_NORMAL_MAP_FIELD] = LLUUID("dd88438d-895e-4cc4-3557-f8b6870be6e5"); // Library > Textures > Rock > Rock - Rippling - materialData[MATERIALS_CAP_SPECULAR_MAP_FIELD] = LLUUID("c7f1beb3-4c5f-f70e-6d96-7668ff8aea0a"); // Library > Textures > Rock > Rock - Granite - LLColor4U specularColor(255, 255, 255, 255); - materialData[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = specularColor.getValue(); - materialData[MATERIALS_CAP_SPECULAR_EXP_FIELD] = static_cast<LLSD::Integer>(100); - materialData[MATERIALS_CAP_ENV_INTENSITY_FIELD] = static_cast<LLSD::Integer>(25); - materialData[MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD] = static_cast<LLSD::Integer>(37); - materialData[MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD] = static_cast<LLSD::Integer>(0); - } - else if ((curFaceIndex % FACE_MODULATOR) == 1) - { - materialData[MATERIALS_CAP_NORMAL_MAP_FIELD] = LLUUID("cfcd9d0b-f04b-f01a-8b29-519e27078896"); // Library > Textures > Terrain Textures > Terrain Textures - Winter > Primitive Island - Base Ice-rock - materialData[MATERIALS_CAP_SPECULAR_MAP_FIELD] = LLUUID("fcad96ba-3495-d426-9713-21cf721332a4"); // Library > Textures > Terrain Textures > Terrain Textures - Winter > Primitive Island - Ice-rock - LLColor4U specularColor(100, 50, 200, 128); - materialData[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = specularColor.getValue(); - materialData[MATERIALS_CAP_SPECULAR_EXP_FIELD] = static_cast<LLSD::Integer>(255); - materialData[MATERIALS_CAP_ENV_INTENSITY_FIELD] = static_cast<LLSD::Integer>(0); - materialData[MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD] = static_cast<LLSD::Integer>(5); - materialData[MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD] = static_cast<LLSD::Integer>(1); - } - else if ((curFaceIndex % FACE_MODULATOR) == 2) - { - materialData[MATERIALS_CAP_NORMAL_MAP_FIELD] = LLUUID("6ed3abd3-527a-856d-3771-2a04ea4c16e1"); // Library > Textures > Waterfalls > Water - ripple layer 1 - materialData[MATERIALS_CAP_SPECULAR_MAP_FIELD] = LLUUID("e7c01539-4836-cd47-94ac-55af7502e4db"); // Library > Textures > Waterfalls > Water - ripple layer 2 - LLColor4U specularColor(128, 128, 128, 255); - materialData[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = specularColor.getValue(); - materialData[MATERIALS_CAP_SPECULAR_EXP_FIELD] = static_cast<LLSD::Integer>(1); - materialData[MATERIALS_CAP_ENV_INTENSITY_FIELD] = static_cast<LLSD::Integer>(255); - materialData[MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD] = static_cast<LLSD::Integer>(75); - materialData[MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD] = static_cast<LLSD::Integer>(3); - } - else if ((curFaceIndex % FACE_MODULATOR) == 3) - { - // do nothing - } - - if ((curFaceIndex % FACE_MODULATOR) != 3) + materialData[MATERIALS_CAP_NORMAL_MAP_FIELD] = mNormalMap->getImageAssetID(); + materialData[MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD] = static_cast<LLSD::Integer>(getNormalMapOffsetX()); + materialData[MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD] = static_cast<LLSD::Integer>(getNormalMapOffsetY()); + materialData[MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD] = static_cast<LLSD::Integer>(getNormalMapRepeatX()); + materialData[MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD] = static_cast<LLSD::Integer>(getNormalMapRepeatY()); + materialData[MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD] = static_cast<LLSD::Integer>(getNormalMapRotation()); + + materialData[MATERIALS_CAP_SPECULAR_MAP_FIELD] = mSpecularMap->getImageAssetID(); + materialData[MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD] = static_cast<LLSD::Integer>(getSpecularMapOffsetX()); + materialData[MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD] = static_cast<LLSD::Integer>(getSpecularMapOffsetY()); + materialData[MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD] = static_cast<LLSD::Integer>(getSpecularMapRepeatX()); + materialData[MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD] = static_cast<LLSD::Integer>(getSpecularMapRepeatY()); + materialData[MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD] = static_cast<LLSD::Integer>(getSpecularMapRotation()); + + const LLColor4& specularColor = mSpecularColor->get(); + LLColor4U specularColor4U = specularColor; + materialData[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = specularColor4U.getValue(); + + materialData[MATERIALS_CAP_SPECULAR_EXP_FIELD] = static_cast<LLSD::Integer>(getSpecularExponent()); + materialData[MATERIALS_CAP_ENV_INTENSITY_FIELD] = static_cast<LLSD::Integer>(getEnvironmentExponent()); + materialData[MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD] = static_cast<LLSD::Integer>(getAlphMaskCutoff()); + materialData[MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD] = static_cast<LLSD::Integer>(getDiffuseAlphaMode()); + + LLSD faceData = LLSD::emptyMap(); + faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(curFaceIndex); + faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(viewerObject->getLocalID()); + if (pIsDoSet) { - LLSD faceData = LLSD::emptyMap(); - faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(curFaceIndex); - faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(viewerObject->getLocalID()); - if (pIsDoSet) - { - faceData[MATERIALS_CAP_MATERIAL_FIELD] = materialData; - } - facesData.append(faceData); + faceData[MATERIALS_CAP_MATERIAL_FIELD] = materialData; } + facesData.append(faceData); } } @@ -844,6 +960,33 @@ void LLFloaterDebugMaterials::setState(EState pState) updateControls(); } +void LLFloaterDebugMaterials::resetObjectEditInputs() +{ + const LLSD zeroValue = static_cast<LLSD::Integer>(0); + + mNormalMap->clear(); + mNormalMapOffsetX->setValue(zeroValue); + mNormalMapOffsetY->setValue(zeroValue); + mNormalMapRepeatX->setValue(zeroValue); + mNormalMapRepeatY->setValue(zeroValue); + mNormalMapRotation->setValue(zeroValue); + + mSpecularMap->clear(); + mSpecularMapOffsetX->setValue(zeroValue); + mSpecularMapOffsetY->setValue(zeroValue); + mSpecularMapRepeatX->setValue(zeroValue); + mSpecularMapRepeatY->setValue(zeroValue); + mSpecularMapRotation->setValue(zeroValue); + + mSpecularColor->clear(); + mSpecularExponent->setValue(zeroValue); + mEnvironmentExponent->setValue(zeroValue); + mAlphaMaskCutoff->setValue(zeroValue); + mDiffuseAlphaMode->setValue(zeroValue); + + mSpecularColor->set(mDefaultSpecularColor); +} + void LLFloaterDebugMaterials::clearGetResults() { mGetScrollList->deleteAllItems(); @@ -962,6 +1105,85 @@ std::string LLFloaterDebugMaterials::convertToPrintableMaterialID(const LLSD& pB return materialIDString; } +S32 LLFloaterDebugMaterials::getNormalMapOffsetX() const +{ + return getLineEditorValue(mNormalMapOffsetX); +} + +S32 LLFloaterDebugMaterials::getNormalMapOffsetY() const +{ + return getLineEditorValue(mNormalMapOffsetY); +} + +S32 LLFloaterDebugMaterials::getNormalMapRepeatX() const +{ + return getLineEditorValue(mNormalMapRepeatX); +} + +S32 LLFloaterDebugMaterials::getNormalMapRepeatY() const +{ + return getLineEditorValue(mNormalMapRepeatY); +} + +S32 LLFloaterDebugMaterials::getNormalMapRotation() const +{ + return getLineEditorValue(mNormalMapRotation); +} + +S32 LLFloaterDebugMaterials::getSpecularMapOffsetX() const +{ + return getLineEditorValue(mSpecularMapOffsetX); +} + +S32 LLFloaterDebugMaterials::getSpecularMapOffsetY() const +{ + return getLineEditorValue(mSpecularMapOffsetY); +} + +S32 LLFloaterDebugMaterials::getSpecularMapRepeatX() const +{ + return getLineEditorValue(mSpecularMapRepeatX); +} + +S32 LLFloaterDebugMaterials::getSpecularMapRepeatY() const +{ + return getLineEditorValue(mSpecularMapRepeatY); +} + +S32 LLFloaterDebugMaterials::getSpecularMapRotation() const +{ + return getLineEditorValue(mSpecularMapRotation); +} + +S32 LLFloaterDebugMaterials::getSpecularExponent() const +{ + return getLineEditorValue(mSpecularExponent); +} + +S32 LLFloaterDebugMaterials::getEnvironmentExponent() const +{ + return getLineEditorValue(mEnvironmentExponent); +} + +S32 LLFloaterDebugMaterials::getAlphMaskCutoff() const +{ + return getLineEditorValue(mAlphaMaskCutoff); +} + +S32 LLFloaterDebugMaterials::getDiffuseAlphaMode() const +{ + return getLineEditorValue(mDiffuseAlphaMode); +} + +S32 LLFloaterDebugMaterials::getLineEditorValue(const LLLineEditor *pLineEditor) const +{ + S32 value = 0; + + LLStringUtil::convertToS32(pLineEditor->getText(), value); + + return value; +} + MaterialsResponder::MaterialsResponder(const std::string& pMethod, const std::string& pCapabilityURL, CallbackFunction pCallback) : LLHTTPClient::Responder(), mMethod(pMethod), diff --git a/indra/newview/llfloaterdebugmaterials.h b/indra/newview/llfloaterdebugmaterials.h index 6d221581c4..9cdf04c908 100644 --- a/indra/newview/llfloaterdebugmaterials.h +++ b/indra/newview/llfloaterdebugmaterials.h @@ -36,9 +36,13 @@ #include "v4color.h" class LLButton; +class LLColorSwatchCtrl; +class LLLineEditor; class LLScrollListCtrl; class LLSD; class LLTextBase; +class LLTextureCtrl; +class LLUICtrl; class LLFloaterDebugMaterials : public LLFloater { @@ -67,6 +71,7 @@ private: virtual ~LLFloaterDebugMaterials(); void onGetClicked(); + void onValueEntered(LLUICtrl* pUICtrl); void onPutSetClicked(); void onPutClearClicked(); void onGoodPostClicked(); @@ -102,6 +107,7 @@ private: void setState(EState pState); inline EState getState() const; + void resetObjectEditInputs(); void clearGetResults(); void clearPutResults(); void clearPostResults(); @@ -110,9 +116,44 @@ private: void updateControls(); std::string convertToPrintableMaterialID(const LLSD& pBinaryHash) const; + S32 getNormalMapOffsetX() const; + S32 getNormalMapOffsetY() const; + S32 getNormalMapRepeatX() const; + S32 getNormalMapRepeatY() const; + S32 getNormalMapRotation() const; + + S32 getSpecularMapOffsetX() const; + S32 getSpecularMapOffsetY() const; + S32 getSpecularMapRepeatX() const; + S32 getSpecularMapRepeatY() const; + S32 getSpecularMapRotation() const; + + S32 getSpecularExponent() const; + S32 getEnvironmentExponent() const; + S32 getAlphMaskCutoff() const; + S32 getDiffuseAlphaMode() const; + S32 getLineEditorValue(const LLLineEditor *pLineEditor) const; + LLTextBase* mStatusText; LLButton* mGetButton; LLScrollListCtrl* mGetScrollList; + LLTextureCtrl* mNormalMap; + LLLineEditor* mNormalMapOffsetX; + LLLineEditor* mNormalMapOffsetY; + LLLineEditor* mNormalMapRepeatX; + LLLineEditor* mNormalMapRepeatY; + LLLineEditor* mNormalMapRotation; + LLTextureCtrl* mSpecularMap; + LLLineEditor* mSpecularMapOffsetX; + LLLineEditor* mSpecularMapOffsetY; + LLLineEditor* mSpecularMapRepeatX; + LLLineEditor* mSpecularMapRepeatY; + LLLineEditor* mSpecularMapRotation; + LLColorSwatchCtrl* mSpecularColor; + LLLineEditor* mSpecularExponent; + LLLineEditor* mEnvironmentExponent; + LLLineEditor* mAlphaMaskCutoff; + LLLineEditor* mDiffuseAlphaMode; LLButton* mPutSetButton; LLButton* mPutClearButton; LLScrollListCtrl* mPutScrollList; @@ -120,6 +161,8 @@ private: LLButton* mBadPostButton; LLScrollListCtrl* mPostScrollList; + LLColor4 mDefaultSpecularColor; + EState mState; LLColor4 mWarningColor; LLColor4 mErrorColor; 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 0c4d311c0f..122b5e54e1 100644 --- a/indra/newview/skins/default/xui/en/floater_debug_materials.xml +++ b/indra/newview/skins/default/xui/en/floater_debug_materials.xml @@ -3,7 +3,7 @@ positioning="cascading" can_tear_off="false" can_resize="true" - height="575" + height="680" width="1244" min_height="600" min_width="1100" @@ -66,205 +66,754 @@ top_pad="0" left="12" width="1220"/> - <panel - border="false" - bevel_style="none" + <tab_container follows="left|top|right" layout="topleft" - height="167" + tab_position="top" + name="view_test_tab_container" + left="10" top_pad="10" + height="500" width="1220"> - <button - follows="left|top" - height="22" - label="Get" - layout="topleft" - name="get_button" - top_pad="0" - width="214"/> - <scroll_list - column_padding="0" - draw_heading="true" + <panel + border="true" + bevel_style="none" follows="left|top|right" - height="135" layout="topleft" + label="Region" + height="167" top_pad="10" - tab_stop="false" - multi_select="true" - name="get_scroll_list" width="1220"> - <scroll_list.columns - label="Material ID" - name="id" - dynamic_width="true" /> - <scroll_list.columns - label="Normal Map" - name="normal_map" - width="225" /> - <scroll_list.columns - label="Specular Map" - name="specular_map" - width="225" /> - <scroll_list.columns - label="Specular Color" - name="specular_color" - width="120" /> - <scroll_list.columns - label="Specular Exponent" - name="specular_exponent" - width="112" /> - <scroll_list.columns - label="Env Intensity" - name="env_intensity" - width="80" /> - <scroll_list.columns - label="Alpha Mask Cutoff" - name="alpha_mask_cutoff" - width="110" /> - <scroll_list.columns - label="Diffuse Alpha Mode" - name="diffuse_alpha_mode" - width="118" /> - </scroll_list> - </panel> - <view_border - bevel_style="none" - follows="left|right|top" - height="0" - layout="topleft" - name="horiz_separator" - top_pad="10" - left="12" - width="1220"/> - <panel - border="false" - bevel_style="none" - follows="left|top|right" - layout="topleft" - left="12" - top_pad="10" - height="132" - width="450"> - <button - follows="left|top" - height="22" - label="Put Face Data Set" - layout="topleft" - name="put_set_button" - top_pad="0" - width="214"/> - <button - follows="left|top" - height="22" - label="Put Face Data Clear" - layout="topleft" - name="put_clear_button" - left_pad="20" - width="214"/> - <scroll_list - column_padding="0" - draw_heading="true" + <panel + border="false" + bevel_style="none" + follows="left|top|right" + layout="topleft" + height="167" + top_pad="10" + width="1220"> + <button + follows="left|top" + height="22" + label="Get" + layout="topleft" + name="get_button" + top_pad="0" + width="214"/> + <scroll_list + column_padding="0" + draw_heading="true" + follows="left|top|right" + height="135" + layout="topleft" + top_pad="10" + tab_stop="false" + multi_select="true" + name="get_scroll_list" + width="1220"> + <scroll_list.columns + label="Material ID" + name="id" + dynamic_width="true" /> + <scroll_list.columns + label="Normal Map" + name="normal_map" + width="225" /> + <scroll_list.columns + label="Specular Map" + name="specular_map" + width="225" /> + <scroll_list.columns + label="Specular Color" + name="specular_color" + width="120" /> + <scroll_list.columns + label="Specular Exponent" + name="specular_exponent" + width="112" /> + <scroll_list.columns + label="Env Intensity" + name="env_intensity" + width="80" /> + <scroll_list.columns + label="Alpha Mask Cutoff" + name="alpha_mask_cutoff" + width="110" /> + <scroll_list.columns + label="Diffuse Alpha Mode" + name="diffuse_alpha_mode" + width="118" /> + </scroll_list> + </panel> + </panel> + <panel + border="true" + bevel_style="none" follows="left|top|right" - height="100" layout="topleft" - left="0" + label="Object editing" + height="167" top_pad="10" - tab_stop="false" - multi_select="true" - name="put_scroll_list" - width="400"> - <scroll_list.columns - label="Object ID" - name="object_id" - width="80" /> - <scroll_list.columns - label="Face Index" - name="face_index" - width="70" /> - <scroll_list.columns - label="MaterialID" - name="material_id" - dynamic_width="true" /> - </scroll_list> - </panel> - <view_border - bevel_style="none" - follows="left|right|top" - height="0" - layout="topleft" - name="horiz_separator" - top_pad="10" - left="12" - width="1220"/> - <panel - border="false" - bevel_style="none" - follows="left|top|right" - layout="topleft" - left="12" - top_pad="10" - height="132" - width="1220"> - <button - follows="left|top" - height="22" - label="Post Good Material ID" - layout="topleft" - name="good_post_button" - top_pad="0" - width="214"/> - <button - follows="left|top" - height="22" - label="Post Bad Material ID" - layout="topleft" - name="bad_post_button" - left_pad="20" - width="214"/> - <scroll_list - column_padding="0" - draw_heading="true" + width="1220"> + <panel + border="false" + bevel_style="none" + follows="left|top|right" + layout="topleft" + left="2" + top_pad="10" + height="410" + width="810"> + <panel + border="false" + bevel_style="none" + follows="left|top|right" + layout="topleft" + height="265" + top_pad="0" + width="810"> + <panel + border="false" + bevel_style="none" + follows="left|top|right" + layout="topleft" + height="226" + top_pad="0" + width="263"> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left="0" + top_pad="38" + width="160"> + Normal Map + </text> + <texture_picker + allow_no_texture="true" + can_apply_immediately="true" + default_image_name="Default" + follows="left|top" + left_pad="0" + top_pad="-50" + label_width="0" + height="100" + width="100" + mouse_opaque="true" + name="normal_map" + tool_tip="Click to open texture picker" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-260" + top_pad="10" + width="160"> + Normal Map Offset X + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="normal_map_offset_x" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Normal Map Offset Y + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="normal_map_offset_y" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Normal Map Repeat X + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="normal_map_repeat_x" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Normal Map Repeat Y + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="normal_map_repeat_y" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Normal Map Rotation + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="normal_map_rotation" + width="80" /> + </panel> + <panel + border="false" + bevel_style="none" + follows="left|top|right" + layout="topleft" + height="226" + top_pad="-226" + left_pad="20" + width="263"> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left="0" + top_pad="38" + width="160"> + Specular Map + </text> + <texture_picker + allow_no_texture="true" + can_apply_immediately="true" + default_image_name="Default" + follows="left|top" + left_pad="0" + top_pad="-50" + label_width="0" + height="100" + width="100" + mouse_opaque="true" + name="specular_map" + tool_tip="Click to open texture picker" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-260" + top_pad="10" + width="160"> + Specular Map Offset X + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="specular_map_offset_x" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Specular Map Offset Y + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="specular_map_offset_y" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Specular Map Repeat X + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="specular_map_repeat_x" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Specular Map Repeat Y + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="specular_map_repeat_y" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Specular Map Rotation + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="specular_map_rotation" + width="80" /> + </panel> + <panel + border="false" + bevel_style="none" + follows="left|top|right" + layout="topleft" + height="132" + top_pad="-226" + left_pad="20" + width="243"> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left="0" + top_pad="10" + width="160"> + Specular Color + </text> + <color_swatch + can_apply_immediately="true" + color="1 1 1 1" + follows="left|top" + height="30" + layout="topleft" + label_height="0" + label_width="0" + left_pad="0" + top_pad="-22" + name="specular_color" + tool_tip="Click to open color picker" + width="40" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-200" + top_pad="10" + width="160"> + Specular Exponent + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="specular_exponent" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Environment Exponent + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="environment_exponent" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Alpha Mask Cuttoff + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="alpha_mask_cutoff" + width="80" /> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left_pad="-240" + top_pad="10" + width="160"> + Diffuse Alpha Mode + </text> + <line_editor + border_style="line" + border_thickness="1" + default_text="0" + follows="left|top" + height="20" + layout="topleft" + left_pad="0" + top_pad="-18" + max_length_chars="255" + name="diffuse_alpha_mode" + width="80" /> + </panel> + <panel + border="false" + bevel_style="none" + follows="left|top|right" + layout="topleft" + height="22" + left="0" + top_pad="110" + width="450"> + <button + follows="left|top" + height="22" + label="Set Face Data" + layout="topleft" + name="put_set_button" + left="0" + top="0" + width="214"/> + <button + follows="left|top" + height="22" + label="Clear Face Data" + layout="topleft" + name="put_clear_button" + left_pad="20" + width="214"/> + </panel> + + </panel> + <view_border + bevel_style="none" + follows="left|right|top" + height="0" + layout="topleft" + name="horiz_separator" + top_pad="10" + left="0" + width="810"/> + <panel + border="false" + bevel_style="none" + follows="left|top|right" + layout="topleft" + height="125" + top_pad="20" + width="400"> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + left="0" + top_pad="0" + width="160"> + Results + </text> + <scroll_list + column_padding="0" + draw_heading="true" + follows="left|top|right" + height="100" + layout="topleft" + left="0" + top_pad="10" + tab_stop="false" + multi_select="true" + name="put_scroll_list" + width="400"> + <scroll_list.columns + label="Object ID" + name="object_id" + width="80" /> + <scroll_list.columns + label="Face Index" + name="face_index" + width="70" /> + <scroll_list.columns + label="MaterialID" + name="material_id" + dynamic_width="true" /> + </scroll_list> + </panel> + </panel> + </panel> + <panel + border="true" + bevel_style="none" follows="left|top|right" - height="100" layout="topleft" + label="Viewable objects" + height="167" top_pad="10" - left="0" - tab_stop="false" - multi_select="true" - name="post_scroll_list" width="1220"> - <scroll_list.columns - label="Material ID" - name="id" - dynamic_width="true" /> - <scroll_list.columns - label="Normal Map" - name="normal_map" - width="225" /> - <scroll_list.columns - label="Specular Map" - name="specular_map" - width="225" /> - <scroll_list.columns - label="Specular Color" - name="specular_color" - width="120" /> - <scroll_list.columns - label="Specular Exponent" - name="specular_exponent" - width="112" /> - <scroll_list.columns - label="Env Intensity" - name="env_intensity" - width="80" /> - <scroll_list.columns - label="Alpha Mask Cutoff" - name="alpha_mask_cutoff" - width="110" /> - <scroll_list.columns - label="Diffuse Alpha Mode" - name="diffuse_alpha_mode" - width="118" /> - </scroll_list> - </panel> - </floater> + <panel + border="false" + bevel_style="none" + follows="left|top|right" + layout="topleft" + left="12" + top_pad="10" + height="132" + width="1220"> + <button + follows="left|top" + height="22" + label="Post Good Material ID" + layout="topleft" + name="good_post_button" + top_pad="0" + width="214"/> + <button + follows="left|top" + height="22" + label="Post Bad Material ID" + layout="topleft" + name="bad_post_button" + left_pad="20" + width="214"/> + <scroll_list + column_padding="0" + draw_heading="true" + follows="left|top|right" + height="100" + layout="topleft" + top_pad="10" + left="0" + tab_stop="false" + multi_select="true" + name="post_scroll_list" + width="1220"> + <scroll_list.columns + label="Material ID" + name="id" + dynamic_width="true" /> + <scroll_list.columns + label="Normal Map" + name="normal_map" + width="225" /> + <scroll_list.columns + label="Specular Map" + name="specular_map" + width="225" /> + <scroll_list.columns + label="Specular Color" + name="specular_color" + width="120" /> + <scroll_list.columns + label="Specular Exponent" + name="specular_exponent" + width="112" /> + <scroll_list.columns + label="Env Intensity" + name="env_intensity" + width="80" /> + <scroll_list.columns + label="Alpha Mask Cutoff" + name="alpha_mask_cutoff" + width="110" /> + <scroll_list.columns + label="Diffuse Alpha Mode" + name="diffuse_alpha_mode" + width="118" /> + </scroll_list> + </panel> + </panel> + </tab_container> +</floater> |