Permalink
Browse files

llprimitive merge

  • Loading branch information...
Shyotl committed Apr 9, 2016
1 parent 691a539 commit d40256fb31d458f65ba8c1dedca8ae0bb9fa8756
View
@@ -194,8 +194,12 @@ const U8 LL_SCULPT_TYPE_MESH = 5;
const U8 LL_SCULPT_TYPE_MASK = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE |
LL_SCULPT_TYPE_CYLINDER | LL_SCULPT_TYPE_MESH;
// for value checks, assign new value after adding new types
const U8 LL_SCULPT_TYPE_MAX = LL_SCULPT_TYPE_MESH;
const U8 LL_SCULPT_FLAG_INVERT = 64;
const U8 LL_SCULPT_FLAG_MIRROR = 128;
const U8 LL_SCULPT_FLAG_MASK = LL_SCULPT_FLAG_INVERT | LL_SCULPT_FLAG_MIRROR;
const S32 LL_SCULPT_MESH_MAX_FACES = 8;
@@ -1539,10 +1539,7 @@ LLModel* LLModel::loadModelFromDomMesh(domMesh *mesh)
std::string LLModel::getName() const
{
if (!mRequestedLabel.empty())
return mRequestedLabel;
else
return mLabel;
return mRequestedLabel.empty() ? mLabel : mRequestedLabel;
}
//static
@@ -40,6 +40,7 @@
#include "llprimtexturelist.h"
#include "imageids.h"
#include "llmaterialid.h"
#include "llvolume.h"
/**
* exported constants
@@ -321,6 +322,11 @@ S32 LLPrimitive::setTEMaterialParams(const U8 index, const LLMaterialPtr pMateri
return mTextureList.setMaterialParams(index, pMaterialParams);
}
LLMaterialPtr LLPrimitive::getTEMaterialParams(const U8 index)
{
return mTextureList.getMaterialParams(index);
}
//===============================================================
S32 LLPrimitive::setTEBumpShinyFullbright(const U8 index, const U8 bump)
{
@@ -987,8 +993,6 @@ BOOL LLPrimitive::setMaterial(U8 material)
}
}
const F32 LL_MAX_SCALE_S = 100.0f;
const F32 LL_MAX_SCALE_T = 100.0f;
S32 LLPrimitive::packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const
{
S32 face_index;
@@ -1843,9 +1847,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;
}
@@ -1870,8 +1877,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);
}
@@ -1889,20 +1895,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;
}
}
//============================================================================
@@ -259,9 +259,8 @@ class LLSculptParams : public LLNetworkData
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; }
};
@@ -389,6 +388,8 @@ class LLPrimitive : public LLXform
virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed
virtual void setTESelected(const U8 te, bool sel);
LLMaterialPtr getTEMaterialParams(const U8 index);
void copyTEs(const LLPrimitive *primitive);
S32 packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const;
S32 unpackTEField(U8 *cur_ptr, U8 *buffer_end, U8 *data_ptr, U8 data_size, U8 face_count, EMsgVariableType type);
@@ -137,7 +137,7 @@ S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te)
// we're changing an existing entry
llassert(mEntryList[index]);
delete (mEntryList[index]);
if (&te)
if (te != LLTextureEntry::null)
{
mEntryList[index] = te.newCopy();
}
@@ -377,6 +377,16 @@ S32 LLPrimTextureList::setMaterialParams(const U8 index, const LLMaterialPtr pMa
return TEM_CHANGE_NONE;
}
LLMaterialPtr LLPrimTextureList::getMaterialParams(const U8 index)
{
if (index < mEntryList.size())
{
return mEntryList[index]->getMaterialParams();
}
return LLMaterialPtr();
}
S32 LLPrimTextureList::size() const
{
return mEntryList.size();
@@ -115,6 +115,8 @@ class LLPrimTextureList
S32 setMaterialID(const U8 index, const LLMaterialID& pMaterialID);
S32 setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams);
LLMaterialPtr getMaterialParams(const U8 index);
S32 size() const;
// void forceResize(S32 new_size);
@@ -89,6 +89,10 @@ class LLTextureEntry
bool operator==(const LLTextureEntry &rhs) const;
bool operator!=(const LLTextureEntry &rhs) const;
// Added to allow use with std::map
//
bool operator <(const LLTextureEntry &rhs) const;
LLSD asLLSD() const;
void asLLSD(LLSD& sd) const;
@@ -2141,17 +2141,17 @@ void LLPanelObject::sendSculpt()
return;
LLSculptParams sculpt_params;
LLUUID sculpt_id = LLUUID::null;
if (mCtrlSculptTexture)
sculpt_params.setSculptTexture(mCtrlSculptTexture->getImageAssetID());
sculpt_id = mCtrlSculptTexture->getImageAssetID();
U8 sculpt_type = 0;
if (mCtrlSculptType)
sculpt_type |= mCtrlSculptType->getCurrentIndex();
bool enabled = true;
enabled = sculpt_type != LL_SCULPT_TYPE_MESH;
bool enabled = sculpt_type != LL_SCULPT_TYPE_MESH;
if (mCtrlSculptMirror)
{
@@ -2168,7 +2168,7 @@ void LLPanelObject::sendSculpt()
if ((mCtrlSculptInvert) && (mCtrlSculptInvert->get()))
sculpt_type |= LL_SCULPT_FLAG_INVERT;
sculpt_params.setSculptType(sculpt_type);
sculpt_params.setSculptTexture(sculpt_id, sculpt_type);
mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
}
@@ -1119,8 +1119,7 @@ void LLToolDragAndDrop::dropMesh(LLViewerObject* hit_obj,
}
LLSculptParams sculpt_params;
sculpt_params.setSculptTexture(asset_id);
sculpt_params.setSculptType(LL_SCULPT_TYPE_MESH);
sculpt_params.setSculptTexture(asset_id, LL_SCULPT_TYPE_MESH);
hit_obj->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
dialog_refresh_all();
@@ -1370,7 +1370,7 @@ void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object)
LLUUID t_id = sculpt.getSculptTexture();
if (mAssetMap.count(t_id))
{
sculpt.setSculptTexture(mAssetMap[t_id]);
sculpt.setSculptTexture(mAssetMap[t_id], sculpt.getSculptType());
}
object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt, true);

0 comments on commit d40256f

Please sign in to comment.