summaryrefslogtreecommitdiff
path: root/indra/llappearance/llpolyskeletaldistortion.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2023-05-17 23:57:11 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2023-05-17 23:57:11 +0300
commit53ed0ec70ce5c774c57c9783050c7e1b35885eec (patch)
tree62015d4736d86dc1cebc378ff59c33b1e01f42bc /indra/llappearance/llpolyskeletaldistortion.cpp
parent784436a5b89062df69251c9ac28904f06a018011 (diff)
parent5a70639b7992842a9f74ec81b11bac56608b8f2e (diff)
Merge branch 'main' into DRTVWR-567
# Conflicts: # doc/contributions.txt
Diffstat (limited to 'indra/llappearance/llpolyskeletaldistortion.cpp')
-rw-r--r--indra/llappearance/llpolyskeletaldistortion.cpp38
1 files changed, 15 insertions, 23 deletions
diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp
index 360f17508f..586e631ded 100644
--- a/indra/llappearance/llpolyskeletaldistortion.cpp
+++ b/indra/llappearance/llpolyskeletaldistortion.cpp
@@ -143,38 +143,35 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
mID = info->mID;
setWeight(getDefaultWeight());
- LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
- for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
+ for (LLPolySkeletalBoneInfo& bone_info : getInfo()->mBoneInfoList)
{
- LLPolySkeletalBoneInfo *bone_info = &(*iter);
- LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
+ LLJoint* joint = mAvatar->getJoint(bone_info.mBoneName);
if (!joint)
{
// There's no point continuing after this error - means
// that either the skeleton or lad file is broken.
- LL_WARNS() << "Joint " << bone_info->mBoneName << " not found." << LL_ENDL;
+ LL_WARNS() << "Joint " << bone_info.mBoneName << " not found." << LL_ENDL;
return FALSE;
}
// store it
- mJointScales[joint] = bone_info->mScaleDeformation;
+ mJointScales[joint] = bone_info.mScaleDeformation;
// apply to children that need to inherit it
- for (LLJoint::joints_t::iterator iter = joint->mChildren.begin();
- iter != joint->mChildren.end(); ++iter)
+ for (LLJoint* joint : joint->mChildren)
{
- LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter);
+ LLAvatarJoint* child_joint = (LLAvatarJoint*)joint;
if (child_joint->inheritScale())
{
LLVector3 childDeformation = LLVector3(child_joint->getScale());
- childDeformation.scaleVec(bone_info->mScaleDeformation);
+ childDeformation.scaleVec(bone_info.mScaleDeformation);
mJointScales[child_joint] = childDeformation;
}
}
- if (bone_info->mHasPositionDeformation)
+ if (bone_info.mHasPositionDeformation)
{
- mJointOffsets[joint] = bone_info->mPositionDeformation;
+ mJointOffsets[joint] = bone_info.mPositionDeformation;
}
}
return TRUE;
@@ -195,15 +192,12 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
LLJoint* joint;
- joint_vec_map_t::iterator iter;
- for (iter = mJointScales.begin();
- iter != mJointScales.end();
- iter++)
+ for (joint_vec_map_t::value_type& scale_pair : mJointScales)
{
- joint = iter->first;
+ joint = scale_pair.first;
LLVector3 newScale = joint->getScale();
- LLVector3 scaleDelta = iter->second;
+ LLVector3 scaleDelta = scale_pair.second;
LLVector3 offset = (effective_weight - mLastWeight) * scaleDelta;
newScale = newScale + offset;
//An aspect of attached mesh objects (which contain joint offsets) that need to be cleaned up when detached
@@ -218,13 +212,11 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
joint->setScale(newScale, true);
}
- for (iter = mJointOffsets.begin();
- iter != mJointOffsets.end();
- iter++)
+ for (joint_vec_map_t::value_type& offset_pair : mJointOffsets)
{
- joint = iter->first;
+ joint = offset_pair.first;
LLVector3 newPosition = joint->getPosition();
- LLVector3 positionDelta = iter->second;
+ LLVector3 positionDelta = offset_pair.second;
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
// SL-315
bool allow_attachment_pos_overrides = true;