summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2016-09-02 16:44:57 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2016-09-02 16:44:57 -0400
commit34ced1aa2cc286db26e2866cfc7a53ef72d828a4 (patch)
tree7ae48b379e7e1916d9d22d390ad9466f7b255402 /indra/llprimitive
parenta2875ba53ec02235a0db5734264108c0f0898269 (diff)
SL-395 - partial support for joint scale locking via flag in skin info
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/lldaeloader.cpp33
-rw-r--r--indra/llprimitive/llmodel.cpp11
-rw-r--r--indra/llprimitive/llmodel.h1
3 files changed, 30 insertions, 15 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index 37ebdf2cec..c194d677c8 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -1379,6 +1379,16 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
if ( !missingSkeletonOrScene )
{
+ // FIXME: mesh_id is used to determine which mesh gets to
+ // set the joint offset, in the event of a conflict. Since
+ // we don't know the mesh id yet, we can't guarantee that
+ // joint offsets will be applied with the same priority as
+ // in the uploaded model. If the file contains multiple
+ // meshes with conflicting joint offsets, preview may be
+ // incorrect.
+ LLUUID fake_mesh_id;
+ fake_mesh_id.generate();
+
//Set the joint translations on the avatar
JointMap :: const_iterator masterJointIt = mJointMap.begin();
JointMap :: const_iterator masterJointItEnd = mJointMap.end();
@@ -1393,19 +1403,16 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
LLJoint* pJoint = mJointLookupFunc(lookingForJoint,mOpaqueData);
if ( pJoint )
{
- // FIXME: mesh_id is used to determine which
- // mesh gets to set the joint offset, in the
- // event of a conflict. Since we don't know
- // the mesh id yet, we can't guarantee that
- // joint offsets will be applied with the same
- // priority as in the uploaded model. If the
- // file contains multiple meshes with
- // conflicting joint offsets, preview may be
- // incorrect.
- LLUUID fake_mesh_id;
- fake_mesh_id.generate();
- bool dummy; // not used
- pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), fake_mesh_id, "", dummy);
+ const LLVector3& joint_pos = jointTransform.getTranslation();
+ if (pJoint->aboveJointPosThreshold(joint_pos))
+ {
+ bool override_changed; // not used
+ pJoint->addAttachmentPosOverride(joint_pos, fake_mesh_id, "", override_changed);
+ if (model->mSkinInfo.mLockScaleIfJointPosition)
+ {
+ pJoint->addAttachmentScaleOverride(pJoint->getDefaultScale(), fake_mesh_id, "");
+ }
+ }
}
else
{
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 398f0997f3..cd9e5cfa54 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;
@@ -1446,6 +1450,9 @@ void LLMeshSkinInfo::fromLLSD(LLSD& skin)
{
mPelvisOffset = skin["pelvis_offset"].asReal();
}
+
+ // FIXME BENTO check contents of asset.
+ mLockScaleIfJointPosition = true;
}
LLSD LLMeshSkinInfo::asLLSD(bool include_joints) const
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index 5f98942340..fe6ce148c4 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -54,6 +54,7 @@ public:
LLSD asLLSD(bool include_joints) const;
LLMatrix4 mBindShapeMatrix;
float mPelvisOffset;
+ bool mLockScaleIfJointPosition;
};
class LLModel : public LLVolume