summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive/llmodel.cpp')
-rw-r--r--indra/llprimitive/llmodel.cpp44
1 files changed, 36 insertions, 8 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 985ccee91e..0c313e460e 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -50,8 +50,12 @@ std::string model_names[] =
const int MODEL_NAMES_LENGTH = sizeof(model_names) / sizeof(std::string);
LLModel::LLModel(LLVolumeParams& params, F32 detail)
- : LLVolume(params, detail), mNormalizedScale(1,1,1), mNormalizedTranslation(0,0,0)
- , mPelvisOffset( 0.0f ), mStatus(NO_ERRORS), mSubmodelID(0)
+ : LLVolume(params, detail),
+ mNormalizedScale(1,1,1),
+ mNormalizedTranslation(0,0,0),
+ mPelvisOffset( 0.0f ),
+ mStatus(NO_ERRORS),
+ mSubmodelID(0)
{
mDecompID = -1;
mLocalID = -1;
@@ -826,6 +830,7 @@ LLSD LLModel::writeModel(
const LLModel::Decomposition& decomp,
BOOL upload_skin,
BOOL upload_joints,
+ BOOL lock_scale_if_joint_position,
BOOL nowrite,
BOOL as_slm,
int submodel_id)
@@ -845,7 +850,7 @@ LLSD LLModel::writeModel(
if (skinning)
{ //write skinning block
- mdl["skin"] = high->mSkinInfo.asLLSD(upload_joints);
+ mdl["skin"] = high->mSkinInfo.asLLSD(upload_joints, lock_scale_if_joint_position);
}
if (!decomp.mBaseHull.empty() ||
@@ -1026,6 +1031,7 @@ LLSD LLModel::writeModel(
S32 count = 0;
for (weight_list::iterator iter = weights.begin(); iter != weights.end(); ++iter)
{
+ // Note joint index cannot exceed 255.
if (iter->mJointIdx < 255 && iter->mJointIdx >= 0)
{
U8 idx = (U8) iter->mJointIdx;
@@ -1159,7 +1165,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite, BO
LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
{
- //1. If a vertex has been weighted then we'll find it via pos and return it's weight list
+ //1. If a vertex has been weighted then we'll find it via pos and return its weight list
weight_map::iterator iterPos = mSkinWeights.begin();
weight_map::iterator iterEnd = mSkinWeights.end();
@@ -1382,7 +1388,6 @@ bool LLModel::loadModel(std::istream& is)
}
return false;
-
}
bool LLModel::isMaterialListSubset( LLModel* ref )
@@ -1497,7 +1502,6 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn
return true;
}
-
bool LLModel::loadSkinInfo(LLSD& header, std::istream &is)
{
S32 offset = header["skin"]["offset"].asInteger();
@@ -1540,8 +1544,17 @@ bool LLModel::loadDecomposition(LLSD& header, std::istream& is)
return true;
}
+LLMeshSkinInfo::LLMeshSkinInfo():
+ mPelvisOffset(0.0),
+ mLockScaleIfJointPosition(false),
+ mInvalidJointsScrubbed(false)
+{
+}
-LLMeshSkinInfo::LLMeshSkinInfo(LLSD& skin)
+LLMeshSkinInfo::LLMeshSkinInfo(LLSD& skin):
+ mPelvisOffset(0.0),
+ mLockScaleIfJointPosition(false),
+ mInvalidJointsScrubbed(false)
{
fromLLSD(skin);
}
@@ -1553,6 +1566,7 @@ void LLMeshSkinInfo::fromLLSD(LLSD& skin)
for (U32 i = 0; i < skin["joint_names"].size(); ++i)
{
mJointNames.push_back(skin["joint_names"][i]);
+ mJointNums.push_back(-1);
}
}
@@ -1605,9 +1619,18 @@ void LLMeshSkinInfo::fromLLSD(LLSD& skin)
{
mPelvisOffset = skin["pelvis_offset"].asReal();
}
+
+ if (skin.has("lock_scale_if_joint_position"))
+ {
+ mLockScaleIfJointPosition = skin["lock_scale_if_joint_position"].asBoolean();
+ }
+ else
+ {
+ mLockScaleIfJointPosition = false;
+ }
}
-LLSD LLMeshSkinInfo::asLLSD(bool include_joints) const
+LLSD LLMeshSkinInfo::asLLSD(bool include_joints, bool lock_scale_if_joint_position) const
{
LLSD ret;
@@ -1645,6 +1668,11 @@ LLSD LLMeshSkinInfo::asLLSD(bool include_joints) const
}
}
+ if (lock_scale_if_joint_position)
+ {
+ ret["lock_scale_if_joint_position"] = lock_scale_if_joint_position;
+ }
+
ret["pelvis_offset"] = mPelvisOffset;
}