summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterdebugmaterials.cpp
diff options
context:
space:
mode:
authorWilliam Todd Stinson <stinson@lindenlab.com>2012-10-09 17:59:46 -0700
committerWilliam Todd Stinson <stinson@lindenlab.com>2012-10-09 17:59:46 -0700
commitf84f821df7a0edf472420995ae3e5140bbf05996 (patch)
treef6143b20b62de00facb9a26d0bc2580a4a6f8f58 /indra/newview/llfloaterdebugmaterials.cpp
parent8a8339a9a85b930bb01f98f4f99f28082a476309 (diff)
Adding ability to edit materials per face.
Diffstat (limited to 'indra/newview/llfloaterdebugmaterials.cpp')
-rw-r--r--indra/newview/llfloaterdebugmaterials.cpp73
1 files changed, 40 insertions, 33 deletions
diff --git a/indra/newview/llfloaterdebugmaterials.cpp b/indra/newview/llfloaterdebugmaterials.cpp
index 8e37736394..da1068d879 100644
--- a/indra/newview/llfloaterdebugmaterials.cpp
+++ b/indra/newview/llfloaterdebugmaterials.cpp
@@ -600,6 +600,32 @@ void LLFloaterDebugMaterials::requestPutMaterials(bool pIsDoSet)
LLSD facesData = LLSD::emptyArray();
+ LLSD materialData = LLSD::emptyMap();
+ if (pIsDoSet)
+ {
+ 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());
+ }
LLObjectSelectionHandle selectionHandle = LLSelectMgr::getInstance()->getEditSelection();
for (LLObjectSelection::valid_iterator objectIter = selectionHandle->valid_begin();
@@ -608,42 +634,23 @@ void LLFloaterDebugMaterials::requestPutMaterials(bool pIsDoSet)
LLSelectNode* objectNode = *objectIter;
LLViewerObject* viewerObject = objectNode->getObject();
- S32 numFaces = viewerObject->getNumFaces();
- for (S32 curFaceIndex = 0; curFaceIndex < numFaces; ++curFaceIndex)
+ if (viewerObject != NULL)
{
- LLSD materialData = LLSD::emptyMap();
-
- 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)
+ S32 numTEs = llmin(static_cast<S32>(viewerObject->getNumTEs()), viewerObject->getNumFaces());
+ for (S32 curTEIndex = 0; curTEIndex < numTEs; ++curTEIndex)
{
- faceData[MATERIALS_CAP_MATERIAL_FIELD] = materialData;
+ if (objectNode->isTESelected(curTEIndex))
+ {
+ LLSD faceData = LLSD::emptyMap();
+ faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(curTEIndex);
+ faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(viewerObject->getLocalID());
+ if (pIsDoSet)
+ {
+ faceData[MATERIALS_CAP_MATERIAL_FIELD] = materialData;
+ }
+ facesData.append(faceData);
+ }
}
- facesData.append(faceData);
}
}