llprimitive merge
This commit is contained in:
@@ -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 |
|
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;
|
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_INVERT = 64;
|
||||||
const U8 LL_SCULPT_FLAG_MIRROR = 128;
|
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;
|
const S32 LL_SCULPT_MESH_MAX_FACES = 8;
|
||||||
|
|
||||||
|
|||||||
@@ -1539,10 +1539,7 @@ LLModel* LLModel::loadModelFromDomMesh(domMesh *mesh)
|
|||||||
|
|
||||||
std::string LLModel::getName() const
|
std::string LLModel::getName() const
|
||||||
{
|
{
|
||||||
if (!mRequestedLabel.empty())
|
return mRequestedLabel.empty() ? mLabel : mRequestedLabel;
|
||||||
return mRequestedLabel;
|
|
||||||
else
|
|
||||||
return mLabel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "llprimtexturelist.h"
|
#include "llprimtexturelist.h"
|
||||||
#include "imageids.h"
|
#include "imageids.h"
|
||||||
#include "llmaterialid.h"
|
#include "llmaterialid.h"
|
||||||
|
#include "llvolume.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* exported constants
|
* exported constants
|
||||||
@@ -321,6 +322,11 @@ S32 LLPrimitive::setTEMaterialParams(const U8 index, const LLMaterialPtr pMateri
|
|||||||
return mTextureList.setMaterialParams(index, pMaterialParams);
|
return mTextureList.setMaterialParams(index, pMaterialParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLMaterialPtr LLPrimitive::getTEMaterialParams(const U8 index)
|
||||||
|
{
|
||||||
|
return mTextureList.getMaterialParams(index);
|
||||||
|
}
|
||||||
|
|
||||||
//===============================================================
|
//===============================================================
|
||||||
S32 LLPrimitive::setTEBumpShinyFullbright(const U8 index, const U8 bump)
|
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 LLPrimitive::packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const
|
||||||
{
|
{
|
||||||
S32 face_index;
|
S32 face_index;
|
||||||
@@ -1843,9 +1847,12 @@ BOOL LLSculptParams::pack(LLDataPacker &dp) const
|
|||||||
|
|
||||||
BOOL LLSculptParams::unpack(LLDataPacker &dp)
|
BOOL LLSculptParams::unpack(LLDataPacker &dp)
|
||||||
{
|
{
|
||||||
dp.unpackUUID(mSculptTexture, "texture");
|
U8 type;
|
||||||
dp.unpackU8(mSculptType, "type");
|
LLUUID id;
|
||||||
|
dp.unpackUUID(id, "texture");
|
||||||
|
dp.unpackU8(type, "type");
|
||||||
|
|
||||||
|
setSculptTexture(id, type);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1870,8 +1877,7 @@ bool LLSculptParams::operator==(const LLNetworkData& data) const
|
|||||||
void LLSculptParams::copy(const LLNetworkData& data)
|
void LLSculptParams::copy(const LLNetworkData& data)
|
||||||
{
|
{
|
||||||
const LLSculptParams *param = (LLSculptParams*)&data;
|
const LLSculptParams *param = (LLSculptParams*)&data;
|
||||||
mSculptTexture = param->mSculptTexture;
|
setSculptTexture(param->mSculptTexture, param->mSculptType);
|
||||||
mSculptType = param->mSculptType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1889,20 +1895,38 @@ LLSD LLSculptParams::asLLSD() const
|
|||||||
bool LLSculptParams::fromLLSD(LLSD& sd)
|
bool LLSculptParams::fromLLSD(LLSD& sd)
|
||||||
{
|
{
|
||||||
const char *w;
|
const char *w;
|
||||||
w = "texture";
|
U8 type;
|
||||||
if (sd.has(w))
|
|
||||||
{
|
|
||||||
setSculptTexture( sd[w] );
|
|
||||||
} else goto fail;
|
|
||||||
w = "type";
|
w = "type";
|
||||||
if (sd.has(w))
|
if (sd.has(w))
|
||||||
{
|
{
|
||||||
setSculptType( (U8)sd[w].asInteger() );
|
type = sd[w].asInteger();
|
||||||
} else goto fail;
|
}
|
||||||
|
else return false;
|
||||||
|
|
||||||
|
w = "texture";
|
||||||
|
if (sd.has(w))
|
||||||
|
{
|
||||||
|
setSculptTexture(sd[w], type);
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
|
||||||
return true;
|
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 @@ public:
|
|||||||
operator LLSD() const { return asLLSD(); }
|
operator LLSD() const { return asLLSD(); }
|
||||||
bool fromLLSD(LLSD& sd);
|
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; }
|
LLUUID getSculptTexture() const { return mSculptTexture; }
|
||||||
void setSculptType(U8 type) { mSculptType = type; }
|
|
||||||
U8 getSculptType() const { return mSculptType; }
|
U8 getSculptType() const { return mSculptType; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -389,6 +388,8 @@ public:
|
|||||||
virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed
|
virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed
|
||||||
virtual void setTESelected(const U8 te, bool sel);
|
virtual void setTESelected(const U8 te, bool sel);
|
||||||
|
|
||||||
|
LLMaterialPtr getTEMaterialParams(const U8 index);
|
||||||
|
|
||||||
void copyTEs(const LLPrimitive *primitive);
|
void copyTEs(const LLPrimitive *primitive);
|
||||||
S32 packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const;
|
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);
|
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
|
// we're changing an existing entry
|
||||||
llassert(mEntryList[index]);
|
llassert(mEntryList[index]);
|
||||||
delete (mEntryList[index]);
|
delete (mEntryList[index]);
|
||||||
if (&te)
|
if (te != LLTextureEntry::null)
|
||||||
{
|
{
|
||||||
mEntryList[index] = te.newCopy();
|
mEntryList[index] = te.newCopy();
|
||||||
}
|
}
|
||||||
@@ -377,6 +377,16 @@ S32 LLPrimTextureList::setMaterialParams(const U8 index, const LLMaterialPtr pMa
|
|||||||
return TEM_CHANGE_NONE;
|
return TEM_CHANGE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLMaterialPtr LLPrimTextureList::getMaterialParams(const U8 index)
|
||||||
|
{
|
||||||
|
if (index < mEntryList.size())
|
||||||
|
{
|
||||||
|
return mEntryList[index]->getMaterialParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
return LLMaterialPtr();
|
||||||
|
}
|
||||||
|
|
||||||
S32 LLPrimTextureList::size() const
|
S32 LLPrimTextureList::size() const
|
||||||
{
|
{
|
||||||
return mEntryList.size();
|
return mEntryList.size();
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ public:
|
|||||||
S32 setMaterialID(const U8 index, const LLMaterialID& pMaterialID);
|
S32 setMaterialID(const U8 index, const LLMaterialID& pMaterialID);
|
||||||
S32 setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams);
|
S32 setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams);
|
||||||
|
|
||||||
|
LLMaterialPtr getMaterialParams(const U8 index);
|
||||||
|
|
||||||
S32 size() const;
|
S32 size() const;
|
||||||
|
|
||||||
// void forceResize(S32 new_size);
|
// void forceResize(S32 new_size);
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ public:
|
|||||||
bool operator==(const LLTextureEntry &rhs) const;
|
bool operator==(const LLTextureEntry &rhs) const;
|
||||||
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;
|
LLSD asLLSD() const;
|
||||||
void asLLSD(LLSD& sd) const;
|
void asLLSD(LLSD& sd) const;
|
||||||
operator LLSD() const { return asLLSD(); }
|
operator LLSD() const { return asLLSD(); }
|
||||||
|
|||||||
@@ -2141,17 +2141,17 @@ void LLPanelObject::sendSculpt()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
LLSculptParams sculpt_params;
|
LLSculptParams sculpt_params;
|
||||||
|
LLUUID sculpt_id = LLUUID::null;
|
||||||
|
|
||||||
if (mCtrlSculptTexture)
|
if (mCtrlSculptTexture)
|
||||||
sculpt_params.setSculptTexture(mCtrlSculptTexture->getImageAssetID());
|
sculpt_id = mCtrlSculptTexture->getImageAssetID();
|
||||||
|
|
||||||
U8 sculpt_type = 0;
|
U8 sculpt_type = 0;
|
||||||
|
|
||||||
if (mCtrlSculptType)
|
if (mCtrlSculptType)
|
||||||
sculpt_type |= mCtrlSculptType->getCurrentIndex();
|
sculpt_type |= mCtrlSculptType->getCurrentIndex();
|
||||||
|
|
||||||
bool enabled = true;
|
bool enabled = sculpt_type != LL_SCULPT_TYPE_MESH;
|
||||||
enabled = sculpt_type != LL_SCULPT_TYPE_MESH;
|
|
||||||
|
|
||||||
if (mCtrlSculptMirror)
|
if (mCtrlSculptMirror)
|
||||||
{
|
{
|
||||||
@@ -2168,7 +2168,7 @@ void LLPanelObject::sendSculpt()
|
|||||||
if ((mCtrlSculptInvert) && (mCtrlSculptInvert->get()))
|
if ((mCtrlSculptInvert) && (mCtrlSculptInvert->get()))
|
||||||
sculpt_type |= LL_SCULPT_FLAG_INVERT;
|
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);
|
mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1119,8 +1119,7 @@ void LLToolDragAndDrop::dropMesh(LLViewerObject* hit_obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLSculptParams sculpt_params;
|
LLSculptParams sculpt_params;
|
||||||
sculpt_params.setSculptTexture(asset_id);
|
sculpt_params.setSculptTexture(asset_id, LL_SCULPT_TYPE_MESH);
|
||||||
sculpt_params.setSculptType(LL_SCULPT_TYPE_MESH);
|
|
||||||
hit_obj->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
|
hit_obj->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
|
||||||
|
|
||||||
dialog_refresh_all();
|
dialog_refresh_all();
|
||||||
|
|||||||
@@ -1370,7 +1370,7 @@ void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object)
|
|||||||
LLUUID t_id = sculpt.getSculptTexture();
|
LLUUID t_id = sculpt.getSculptTexture();
|
||||||
if (mAssetMap.count(t_id))
|
if (mAssetMap.count(t_id))
|
||||||
{
|
{
|
||||||
sculpt.setSculptTexture(mAssetMap[t_id]);
|
sculpt.setSculptTexture(mAssetMap[t_id], sculpt.getSculptType());
|
||||||
}
|
}
|
||||||
|
|
||||||
object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt, true);
|
object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user