summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive')
-rwxr-xr-xindra/llprimitive/llprimitive.cpp52
-rwxr-xr-xindra/llprimitive/llprimitive.h5
-rwxr-xr-xindra/llprimitive/llprimtexturelist.cpp11
-rwxr-xr-xindra/llprimitive/llprimtexturelist.h2
-rwxr-xr-xindra/llprimitive/lltextureentry.cpp4
-rwxr-xr-xindra/llprimitive/lltextureentry.h4
6 files changed, 56 insertions, 22 deletions
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index 29747cb09c..9eff74f1e8 100755
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -317,9 +317,9 @@ S32 LLPrimitive::setTEMaterialID(const U8 index, const LLMaterialID& pMaterialID
return mTextureList.setMaterialID(index, pMaterialID);
}
-S32 LLPrimitive::setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams)
+S32 LLPrimitive::setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer)
{
- return mTextureList.setMaterialParams(index, pMaterialParams);
+ return mTextureList.setMaterialParams(index, pMaterialParams, isInitFromServer);
}
LLMaterialPtr LLPrimitive::getTEMaterialParams(const U8 index)
@@ -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 1bf83e36b4..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; }
};
@@ -385,7 +384,7 @@ public:
virtual S32 setTEMediaFlags(const U8 te, const U8 flags);
virtual S32 setTEGlow(const U8 te, const F32 glow);
virtual S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
- virtual S32 setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams);
+ virtual S32 setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer);
virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed
virtual void setTESelected(const U8 te, bool sel);
diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp
index f4f08248b8..6aae2f97c6 100755
--- a/indra/llprimitive/llprimtexturelist.cpp
+++ b/indra/llprimitive/llprimtexturelist.cpp
@@ -368,11 +368,18 @@ S32 LLPrimTextureList::setMaterialID(const U8 index, const LLMaterialID& pMateri
return TEM_CHANGE_NONE;
}
-S32 LLPrimTextureList::setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams)
+S32 LLPrimTextureList::setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer)
{
if (index < mEntryList.size())
{
- return mEntryList[index]->setMaterialParams(pMaterialParams);
+ if (!isInitFromServer && mEntryList[index]->isMatParamsInitFromServer())
+ {
+ return TEM_CHANGE_NONE;
+ }
+ else
+ {
+ return mEntryList[index]->setMaterialParams(pMaterialParams);
+ }
}
return TEM_CHANGE_NONE;
}
diff --git a/indra/llprimitive/llprimtexturelist.h b/indra/llprimitive/llprimtexturelist.h
index 49c636e40f..63e6372405 100755
--- a/indra/llprimitive/llprimtexturelist.h
+++ b/indra/llprimitive/llprimtexturelist.h
@@ -105,7 +105,7 @@ public:
S32 setMediaFlags(const U8 index, const U8 media_flags);
S32 setGlow(const U8 index, const F32 glow);
S32 setMaterialID(const U8 index, const LLMaterialID& pMaterialID);
- S32 setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams);
+ S32 setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer);
LLMaterialPtr getMaterialParams(const U8 index);
diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp
index 284dfc15f4..6020031099 100755
--- a/indra/llprimitive/lltextureentry.cpp
+++ b/indra/llprimitive/lltextureentry.cpp
@@ -63,6 +63,7 @@ LLTextureEntry::LLTextureEntry()
: mMediaEntry(NULL)
, mSelected(false)
, mMaterialUpdatePending(false)
+ , mInitMatParamsFromServer(false)
{
init(LLUUID::null,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
}
@@ -71,6 +72,7 @@ LLTextureEntry::LLTextureEntry(const LLUUID& tex_id)
: mMediaEntry(NULL)
, mSelected(false)
, mMaterialUpdatePending(false)
+ , mInitMatParamsFromServer(false)
{
init(tex_id,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
}
@@ -79,6 +81,7 @@ LLTextureEntry::LLTextureEntry(const LLTextureEntry &rhs)
: mMediaEntry(NULL)
, mSelected(false)
, mMaterialUpdatePending(false)
+ , mInitMatParamsFromServer(false)
{
mID = rhs.mID;
mScaleS = rhs.mScaleS;
@@ -562,6 +565,7 @@ S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams)
mMaterialUpdatePending = true;
}
mMaterial = pMaterialParams;
+ this->mInitMatParamsFromServer = TRUE;
return TEM_CHANGE_TEXTURE;
}
diff --git a/indra/llprimitive/lltextureentry.h b/indra/llprimitive/lltextureentry.h
index a40c3988f2..81e2e8a5a2 100755
--- a/indra/llprimitive/lltextureentry.h
+++ b/indra/llprimitive/lltextureentry.h
@@ -160,6 +160,8 @@ public:
const LLMaterialID& getMaterialID() const { return mMaterialID; };
const LLMaterialPtr getMaterialParams() const { return mMaterial; };
+ bool isMatParamsInitFromServer() const { return mInitMatParamsFromServer; };
+
// *NOTE: it is possible for hasMedia() to return true, but getMediaData() to return NULL.
// CONVERSELY, it is also possible for hasMedia() to return false, but getMediaData()
// to NOT return NULL.
@@ -217,6 +219,8 @@ protected:
bool mMaterialUpdatePending;
LLMaterialID mMaterialID;
LLMaterialPtr mMaterial;
+ bool mInitMatParamsFromServer; // Flag to identification when material paramas initialized from
+
// Note the media data is not sent via the same message structure as the rest of the TE
LLMediaEntry* mMediaEntry; // The media data for the face