diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-02-07 15:41:45 +0200 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-02-07 15:41:45 +0200 |
commit | 1a923ff8d3f4c1bc9c44be42b75295073e80a4c8 (patch) | |
tree | f2336b751b0c76fd33033cf263303ee7fc27978f /indra/newview/llfloatermodelpreview.cpp | |
parent | dd015ce7fc3f6ae3ccf0c6c7f04b2f1b94a90670 (diff) |
SL-548 Fixed pelvis position and optimized
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rw-r--r-- | indra/newview/llfloatermodelpreview.cpp | 80 |
1 files changed, 43 insertions, 37 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b846853755..82b3fa200c 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3875,6 +3875,7 @@ void LLModelPreview::loadedCallback( LLModelPreview* pPreview = static_cast< LLModelPreview* >(opaque); if (pPreview && !LLModelPreview::sIgnoreLoadedCallback) { + // Load loader's warnings into floater's log tab const LLSD out = pPreview->mModelLoader->logOut(); LLSD::array_const_iterator iter_out = out.beginArray(); LLSD::array_const_iterator end_out = out.endArray(); @@ -3980,7 +3981,7 @@ BOOL LLModelPreview::render() bool use_shaders = LLGLSLShader::sNoFixedFunction; bool edges = mViewOption["show_edges"]; - bool joints = mViewOption["show_joint_overrides"]; + bool joint_overrides = mViewOption["show_joint_overrides"]; bool joint_positions = mViewOption["show_joint_positions"]; bool skin_weight = mViewOption["show_skin_weight"]; bool textures = mViewOption["show_textures"]; @@ -4502,6 +4503,10 @@ BOOL LLModelPreview::render() else { target_pos = getPreviewAvatar()->getPositionAgent(); + getPreviewAvatar()->clearAttachmentOverrides(); // removes pelvis fixup + LLUUID fake_mesh_id; + fake_mesh_id.generate(); + getPreviewAvatar()->addPelvisFixup(mPelvisZOffset, fake_mesh_id); bool pelvis_recalc = false; LLViewerCamera::getInstance()->setOriginAndLookAt( @@ -4518,6 +4523,43 @@ BOOL LLModelPreview::render() if (!model->mSkinWeights.empty()) { + const LLMeshSkinInfo *skin = &model->mSkinInfo; + U32 count = LLSkinningUtil::getMeshJointCount(skin); + + if (joint_overrides) + { + LLUUID fake_mesh_id; + fake_mesh_id.generate(); + for (U32 j = 0; j < count; ++j) + { + LLJoint *joint = getPreviewAvatar()->getJoint(skin->mJointNums[j]); + if (joint && skin->mAlternateBindMatrix.size() > 0) + { + const LLVector3& jointPos = skin->mAlternateBindMatrix[j].getTranslation(); + if (joint->aboveJointPosThreshold(jointPos)) + { + bool override_changed; + joint->addAttachmentPosOverride(jointPos, fake_mesh_id, "model", override_changed); + + if (override_changed) + { + //If joint is a pelvis then handle old/new pelvis to foot values + if (joint->getName() == "mPelvis") + { + pelvis_recalc = true; + } + } + if (skin->mLockScaleIfJointPosition) + { + // Note that unlike positions, there's no threshold check here, + // just a lock at the default value. + joint->addAttachmentScaleOverride(joint->getDefaultScale(), fake_mesh_id, "model"); + } + } + } + } + } + for (U32 i = 0, e = mVertexBuffer[mPreviewLOD][model].size(); i < e; ++i) { LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i]; @@ -4535,44 +4577,8 @@ BOOL LLModelPreview::render() //build matrix palette LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; - const LLMeshSkinInfo *skin = &model->mSkinInfo; - U32 count = LLSkinningUtil::getMeshJointCount(skin); LLSkinningUtil::initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, getPreviewAvatar()); - getPreviewAvatar()->clearAttachmentOverrides(); - if (joints) - { - LLUUID fake_mesh_id; - fake_mesh_id.generate(); - for (U32 j = 0; j < count; ++j) - { - LLJoint *joint = getPreviewAvatar()->getJoint(skin->mJointNums[j]); - if (joint && skin->mAlternateBindMatrix.size() > 0) - { - const LLVector3& jointPos = skin->mAlternateBindMatrix[j].getTranslation(); - if (joint->aboveJointPosThreshold(jointPos)) - { - bool override_changed; - joint->addAttachmentPosOverride(jointPos, fake_mesh_id, "model", override_changed); - - if (override_changed) - { - //If joint is a pelvis then handle old/new pelvis to foot values - if (joint->getName() == "mPelvis") - { - pelvis_recalc = true; - } - } - if (skin->mLockScaleIfJointPosition) - { - // Note that unlike positions, there's no threshold check here, - // just a lock at the default value. - joint->addAttachmentScaleOverride(joint->getDefaultScale(), fake_mesh_id, "model"); - } - } - } - } - } LLMatrix4a bind_shape_matrix; bind_shape_matrix.loadu(skin->mBindShapeMatrix); |