summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorWilliam Todd Stinson <stinson@lindenlab.com>2012-12-04 15:46:10 -0800
committerWilliam Todd Stinson <stinson@lindenlab.com>2012-12-04 15:46:10 -0800
commite2b5e11820cf234d035bdb07f4b145c397fdf67b (patch)
tree4147194fa9f652ede4d08e035cee3e3bdd88d872 /indra/newview
parent1bfeddc0039c7a18cdd878c4fcc3a51529eb1019 (diff)
Implementing string conversion and comparison operator overrides for the LLMaterialID class.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterdebugmaterials.cpp52
-rw-r--r--indra/newview/llfloaterdebugmaterials.h2
2 files changed, 9 insertions, 45 deletions
diff --git a/indra/newview/llfloaterdebugmaterials.cpp b/indra/newview/llfloaterdebugmaterials.cpp
index 3420665883..d5ed667c4d 100644
--- a/indra/newview/llfloaterdebugmaterials.cpp
+++ b/indra/newview/llfloaterdebugmaterials.cpp
@@ -1029,7 +1029,7 @@ void LLFloaterDebugMaterials::parseQueryViewableObjects()
rowParams.columns.add(cellParams);
cellParams.font = LLFontGL::getFontMonospace();
- std::string materialIDString = convertToPrintableMaterialID(objectMaterialID);
+ std::string materialIDString = objectMaterialID.asString();
cellParams.column = "material_id";
cellParams.value = materialIDString;
rowParams.columns.add(cellParams);
@@ -1090,8 +1090,9 @@ void LLFloaterDebugMaterials::parseGetResponse()
llassert(material.isMap());
llassert(material.has(MATERIALS_CAP_OBJECT_ID_FIELD));
llassert(material.get(MATERIALS_CAP_OBJECT_ID_FIELD).isBinary());
- const LLSD &materialID = material.get(MATERIALS_CAP_OBJECT_ID_FIELD);
- std::string materialIDString = convertToPrintableMaterialID(materialID);
+ const LLSD &materialIdLLSD = material.get(MATERIALS_CAP_OBJECT_ID_FIELD);
+ LLMaterialID materialID(materialIdLLSD);
+ std::string materialIDString = materialID.asString();
llassert(material.has(MATERIALS_CAP_MATERIAL_FIELD));
const LLSD &materialData = material.get(MATERIALS_CAP_MATERIAL_FIELD);
@@ -1311,7 +1312,8 @@ void LLFloaterDebugMaterials::parsePutResponse(const LLSD& pContent)
llassert(face.has(MATERIALS_CAP_MATERIAL_ID_FIELD));
llassert(face.get(MATERIALS_CAP_MATERIAL_ID_FIELD).isBinary());
- std::string materialIDString = convertToPrintableMaterialID(face.get(MATERIALS_CAP_MATERIAL_ID_FIELD));
+ LLMaterialID materialID(face.get(MATERIALS_CAP_MATERIAL_ID_FIELD));
+ std::string materialIDString = materialID.asString();
cellParams.font = LLFontGL::getFontMonospace();
@@ -1381,8 +1383,9 @@ void LLFloaterDebugMaterials::parsePostResponse(const LLSD& pMultiContent)
llassert(material.isMap());
llassert(material.has(MATERIALS_CAP_OBJECT_ID_FIELD));
llassert(material.get(MATERIALS_CAP_OBJECT_ID_FIELD).isBinary());
- const LLSD &materialID = material.get(MATERIALS_CAP_OBJECT_ID_FIELD);
- std::string materialIDString = convertToPrintableMaterialID(materialID);
+ const LLSD &materialIdLLSD = material.get(MATERIALS_CAP_OBJECT_ID_FIELD);
+ LLMaterialID materialID(materialIdLLSD);
+ std::string materialIDString = materialID.asString();
llassert(material.has(MATERIALS_CAP_MATERIAL_FIELD));
const LLSD &materialData = material.get(MATERIALS_CAP_MATERIAL_FIELD);
@@ -1787,43 +1790,6 @@ void LLFloaterDebugMaterials::updateControls()
}
}
-std::string LLFloaterDebugMaterials::convertToPrintableMaterialID(const LLSD& pBinaryHash) const
-{
- llassert(pBinaryHash.isBinary());
- const LLSD::Binary &materialIDValue = pBinaryHash.asBinary();
- unsigned int valueSize = materialIDValue.size();
-
- llassert(valueSize == 16);
- std::string materialID(reinterpret_cast<const char *>(&materialIDValue[0]), valueSize);
- std::string materialIDString;
- for (unsigned int i = 0U; i < (valueSize / 4); ++i)
- {
- if (i != 0U)
- {
- materialIDString += "-";
- }
- const U32 *value = reinterpret_cast<const U32*>(&materialID.c_str()[i * 4]);
- materialIDString += llformat("%08x", *value);
- }
- return materialIDString;
-}
-
-std::string LLFloaterDebugMaterials::convertToPrintableMaterialID(const LLMaterialID& pMaterialID) const
-{
- std::string materialID(reinterpret_cast<const char *>(pMaterialID.get()), 16);
- std::string materialIDString;
- for (unsigned int i = 0U; i < 4; ++i)
- {
- if (i != 0U)
- {
- materialIDString += "-";
- }
- const U32 *value = reinterpret_cast<const U32*>(&materialID.c_str()[i * 4]);
- materialIDString += llformat("%08x", *value);
- }
- return materialIDString;
-}
-
S32 LLFloaterDebugMaterials::getNormalMapOffsetX() const
{
return getLineEditorValue(mNormalMapOffsetX);
diff --git a/indra/newview/llfloaterdebugmaterials.h b/indra/newview/llfloaterdebugmaterials.h
index 565e440187..c5179ef6b0 100644
--- a/indra/newview/llfloaterdebugmaterials.h
+++ b/indra/newview/llfloaterdebugmaterials.h
@@ -133,8 +133,6 @@ private:
void updateStatusMessage();
void updateControls();
- std::string convertToPrintableMaterialID(const LLSD& pBinaryHash) const;
- std::string convertToPrintableMaterialID(const LLMaterialID& pMaterialID) const;
S32 getNormalMapOffsetX() const;
S32 getNormalMapOffsetY() const;