From c9fbd9e2e820ce4d5e62468f757ee0502fa93af1 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Wed, 27 Apr 2022 14:48:25 -0700 Subject: SL-17116 work on implementing MaterialID in ExtraParams of ObjectUpdate and related messages --- indra/llprimitive/llprimitive.cpp | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'indra/llprimitive/llprimitive.cpp') diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 67c225d25d..c46e5fb3c5 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -39,6 +39,7 @@ #include "llsdutil_math.h" #include "llprimtexturelist.h" #include "llmaterialid.h" +#include "llsdutil.h" /** * exported constants @@ -1690,6 +1691,8 @@ BOOL LLNetworkData::isValid(U16 param_type, U32 size) return (size == 28); case PARAMS_EXTENDED_MESH: return (size == 4); + case PARAMS_RENDER_MATERIAL: + return (size == 16); } return FALSE; @@ -2181,3 +2184,69 @@ bool LLExtendedMeshParams::fromLLSD(LLSD& sd) return false; } + +//============================================================================ + +LLRenderMaterialParams::LLRenderMaterialParams() +{ + mType = PARAMS_RENDER_MATERIAL; +} + +BOOL LLRenderMaterialParams::pack(LLDataPacker &dp) const +{ + return dp.packUUID(mMaterial, "material"); + +// return TRUE; +} + +BOOL LLRenderMaterialParams::unpack(LLDataPacker &dp) +{ + return dp.unpackUUID(mMaterial, "material"); + +// return TRUE; +} + +bool LLRenderMaterialParams::operator==(const LLNetworkData& data) const +{ + if (data.mType != PARAMS_RENDER_MATERIAL) + { + return false; + } + + const LLRenderMaterialParams ¶m = static_cast(data); + + return param.mMaterial == mMaterial; +} + +void LLRenderMaterialParams::copy(const LLNetworkData& data) +{ + llassert_always(data.mType == PARAMS_RENDER_MATERIAL); + const LLRenderMaterialParams ¶m = static_cast(data); + mMaterial = param.mMaterial; +} + +LLSD LLRenderMaterialParams::asLLSD() const +{ + return llsd::map("material", mMaterial); +} + +bool LLRenderMaterialParams::fromLLSD(LLSD& sd) +{ + if (sd.has("material")) + { + setMaterial(sd["material"]); + return true; + } + + return false; +} + +void LLRenderMaterialParams::setMaterial(const LLUUID & id) +{ + mMaterial = id; +} + +LLUUID LLRenderMaterialParams::getMaterial() const +{ + return mMaterial; +} -- cgit v1.2.3