summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorKitty Barnett <develop@catznip.com>2012-12-02 21:29:43 +0100
committerKitty Barnett <develop@catznip.com>2012-12-02 21:29:43 +0100
commita0392ec5ec5703bd54bc4e091820d1c1423bbad4 (patch)
tree962b7969e4606eed57644e15ded30ee0b353bbca /indra
parent2feac960904b0b94d05253e4c345f1853ed3bbbf (diff)
Refactor LLFloaterDebugMaterials::convertToPrintableMaterialID() as LLMaterialID::asString() so it can be used everywhere
Diffstat (limited to 'indra')
-rw-r--r--indra/llprimitive/llmaterialid.cpp15
-rw-r--r--indra/llprimitive/llmaterialid.h1
-rw-r--r--indra/newview/llfloaterdebugmaterials.cpp19
-rw-r--r--indra/newview/llfloaterdebugmaterials.h1
4 files changed, 17 insertions, 19 deletions
diff --git a/indra/llprimitive/llmaterialid.cpp b/indra/llprimitive/llmaterialid.cpp
index 7df23e5ee0..73a61f9c54 100644
--- a/indra/llprimitive/llmaterialid.cpp
+++ b/indra/llprimitive/llmaterialid.cpp
@@ -111,6 +111,21 @@ LLSD LLMaterialID::asLLSD() const
return materialID;
}
+std::string LLMaterialID::asString() const
+{
+ std::string materialIDString;
+ for (unsigned int i = 0U; i < 4; ++i)
+ {
+ if (i != 0U)
+ {
+ materialIDString += "-";
+ }
+ const U32 *value = reinterpret_cast<const U32*>(&mID[i * 4]);
+ materialIDString += llformat("%08x", *value);
+ }
+ return materialIDString;
+}
+
void LLMaterialID::parseFromBinary (const LLSD::Binary& pMaterialID)
{
llassert(pMaterialID.size() == (MATERIAL_ID_SIZE * sizeof(U8)));
diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h
index 1578172aec..a474703f79 100644
--- a/indra/llprimitive/llmaterialid.h
+++ b/indra/llprimitive/llmaterialid.h
@@ -50,6 +50,7 @@ public:
void clear();
LLSD asLLSD() const;
+ std::string asString() const;
static const LLMaterialID null;
diff --git a/indra/newview/llfloaterdebugmaterials.cpp b/indra/newview/llfloaterdebugmaterials.cpp
index 026fd1a28c..7b3ad7aa13 100644
--- a/indra/newview/llfloaterdebugmaterials.cpp
+++ b/indra/newview/llfloaterdebugmaterials.cpp
@@ -972,9 +972,8 @@ void LLFloaterDebugMaterials::parseQueryViewableObjects()
rowParams.columns.add(cellParams);
cellParams.font = LLFontGL::getFontMonospace();
- std::string materialIDString = convertToPrintableMaterialID(objectMaterialID);
cellParams.column = "material_id";
- cellParams.value = materialIDString;
+ cellParams.value = objectMaterialID.asString();
rowParams.columns.add(cellParams);
LLSD rowValue = LLSD::emptyMap();
@@ -1624,22 +1623,6 @@ std::string LLFloaterDebugMaterials::convertToPrintableMaterialID(const LLSD& pB
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;
-}
-
template<typename T> T getLineEditorValue(const LLLineEditor *pLineEditor);
template<> U8 getLineEditorValue(const LLLineEditor *pLineEditor)
diff --git a/indra/newview/llfloaterdebugmaterials.h b/indra/newview/llfloaterdebugmaterials.h
index 0643d7a252..572b17af27 100644
--- a/indra/newview/llfloaterdebugmaterials.h
+++ b/indra/newview/llfloaterdebugmaterials.h
@@ -135,7 +135,6 @@ private:
void updateStatusMessage();
void updateControls();
std::string convertToPrintableMaterialID(const LLSD& pBinaryHash) const;
- std::string convertToPrintableMaterialID(const LLMaterialID& pMaterialID) const;
LLMaterial getMaterial() const;