summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2015-07-17 17:36:33 +0300
committerandreykproductengine <akleshchev@productengine.com>2015-07-17 17:36:33 +0300
commitd9341caf45fa888824c93d9c2b24fdb7659f181b (patch)
tree923e35ad6197d9487f56f87dc6417c5972858bc5 /indra/llprimitive
parent62c748936c42451d4a17c5321d804111203a9e4f (diff)
MAINT-5364 FIXED Object with invalid sculpt topology type cannot be seen or selected
Diffstat (limited to 'indra/llprimitive')
-rwxr-xr-xindra/llprimitive/llprimitive.cpp48
-rwxr-xr-xindra/llprimitive/llprimitive.h3
2 files changed, 35 insertions, 16 deletions
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index 8e009972d0..9eff74f1e8 100755
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -1869,9 +1869,12 @@ BOOL LLSculptParams::pack(LLDataPacker &dp) const
BOOL LLSculptParams::unpack(LLDataPacker &dp)
{
- dp.unpackUUID(mSculptTexture, "texture");
- dp.unpackU8(mSculptType, "type");
-
+ U8 type;
+ LLUUID id;
+ dp.unpackUUID(id, "texture");
+ dp.unpackU8(type, "type");
+
+ setSculptTexture(id, type);
return TRUE;
}
@@ -1896,8 +1899,7 @@ bool LLSculptParams::operator==(const LLNetworkData& data) const
void LLSculptParams::copy(const LLNetworkData& data)
{
const LLSculptParams *param = (LLSculptParams*)&data;
- mSculptTexture = param->mSculptTexture;
- mSculptType = param->mSculptType;
+ setSculptTexture(param->mSculptTexture, param->mSculptType);
}
@@ -1915,20 +1917,38 @@ LLSD LLSculptParams::asLLSD() const
bool LLSculptParams::fromLLSD(LLSD& sd)
{
const char *w;
- w = "texture";
+ U8 type;
+ w = "type";
if (sd.has(w))
{
- setSculptTexture( sd[w] );
- } else goto fail;
- w = "type";
+ type = sd[w].asInteger();
+ }
+ else return false;
+
+ w = "texture";
if (sd.has(w))
{
- setSculptType( (U8)sd[w].asInteger() );
- } else goto fail;
-
+ setSculptTexture(sd[w], type);
+ }
+ else return false;
+
return true;
- fail:
- return false;
+}
+
+void LLSculptParams::setSculptTexture(const LLUUID& texture_id, U8 sculpt_type)
+{
+ U8 type = sculpt_type & LL_SCULPT_TYPE_MASK;
+ U8 flags = sculpt_type & LL_SCULPT_FLAG_MASK;
+ if (sculpt_type != (type | flags) || type > LL_SCULPT_TYPE_MAX)
+ {
+ mSculptTexture.set(SCULPT_DEFAULT_TEXTURE);
+ mSculptType = LL_SCULPT_TYPE_SPHERE;
+ }
+ else
+ {
+ mSculptTexture = texture_id;
+ mSculptType = sculpt_type;
+ }
}
//============================================================================
diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h
index db7327e900..54870fbb10 100755
--- a/indra/llprimitive/llprimitive.h
+++ b/indra/llprimitive/llprimitive.h
@@ -259,9 +259,8 @@ public:
operator LLSD() const { return asLLSD(); }
bool fromLLSD(LLSD& sd);
- void setSculptTexture(const LLUUID& id) { mSculptTexture = id; }
+ void setSculptTexture(const LLUUID& texture_id, U8 sculpt_type);
LLUUID getSculptTexture() const { return mSculptTexture; }
- void setSculptType(U8 type) { mSculptType = type; }
U8 getSculptType() const { return mSculptType; }
};