summaryrefslogtreecommitdiff
path: root/indra/llcharacter/llkeyframemotion.cpp
diff options
context:
space:
mode:
authorFawrsk <fawrsk@gmail.com>2023-01-05 07:42:27 -0400
committerGitHub <noreply@github.com>2023-01-05 13:42:27 +0200
commitd0f115ae093e8268da2a3245d6cb2f3bcc544f1c (patch)
treea85ec8f19e1ceceee819a9dd70d3effddb1be677 /indra/llcharacter/llkeyframemotion.cpp
parentbdfb47cc6bd6af77ec7cd4c04f83606c222ac437 (diff)
SL-18893 Cleanup for loops in llcharacter to use C++11 range based for loops (#42)
Diffstat (limited to 'indra/llcharacter/llkeyframemotion.cpp')
-rw-r--r--indra/llcharacter/llkeyframemotion.cpp37
1 files changed, 12 insertions, 25 deletions
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index ebf7454a61..04c1475161 100644
--- a/indra/llcharacter/llkeyframemotion.cpp
+++ b/indra/llcharacter/llkeyframemotion.cpp
@@ -626,10 +626,8 @@ BOOL LLKeyframeMotion::setupPose()
}
// initialize joint constraints
- for (JointMotionList::constraint_list_t::iterator iter = mJointMotionList->mConstraints.begin();
- iter != mJointMotionList->mConstraints.end(); ++iter)
+ for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints)
{
- JointConstraintSharedData* shared_constraintp = *iter;
JointConstraint* constraintp = new JointConstraint(shared_constraintp);
initializeConstraint(constraintp);
mConstraints.push_front(constraintp);
@@ -764,19 +762,15 @@ void LLKeyframeMotion::applyConstraints(F32 time, U8* joint_mask)
if (mCharacter->getSkeletonSerialNum() != mLastSkeletonSerialNum)
{
mLastSkeletonSerialNum = mCharacter->getSkeletonSerialNum();
- for (constraint_list_t::iterator iter = mConstraints.begin();
- iter != mConstraints.end(); ++iter)
+ for (JointConstraint* constraintp : mConstraints)
{
- JointConstraint* constraintp = *iter;
initializeConstraint(constraintp);
}
}
// apply constraints
- for (constraint_list_t::iterator iter = mConstraints.begin();
- iter != mConstraints.end(); ++iter)
+ for (JointConstraint* constraintp : mConstraints)
{
- JointConstraint* constraintp = *iter;
applyConstraint(constraintp, time, joint_mask);
}
}
@@ -786,10 +780,8 @@ void LLKeyframeMotion::applyConstraints(F32 time, U8* joint_mask)
//-----------------------------------------------------------------------------
void LLKeyframeMotion::onDeactivate()
{
- for (constraint_list_t::iterator iter = mConstraints.begin();
- iter != mConstraints.end(); ++iter)
+ for (JointConstraint* constraintp : mConstraints)
{
- JointConstraint* constraintp = *iter;
deactivateConstraint(constraintp);
}
}
@@ -2007,10 +1999,9 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
success &= dp.packS32(joint_motionp->mRotationCurve.mNumKeys, "num_rot_keys");
LL_DEBUGS("BVH") << "Joint " << joint_motionp->mJointName << LL_ENDL;
- for (RotationCurve::key_map_t::iterator iter = joint_motionp->mRotationCurve.mKeys.begin();
- iter != joint_motionp->mRotationCurve.mKeys.end(); ++iter)
+ for (RotationCurve::key_map_t::value_type rot_pair : joint_motionp->mRotationCurve.mKeys)
{
- RotationKey& rot_key = iter->second;
+ RotationKey& rot_key = rot_pair.second;
U16 time_short = F32_to_U16(rot_key.mTime, 0.f, mJointMotionList->mDuration);
success &= dp.packU16(time_short, "time");
@@ -2029,10 +2020,9 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
}
success &= dp.packS32(joint_motionp->mPositionCurve.mNumKeys, "num_pos_keys");
- for (PositionCurve::key_map_t::iterator iter = joint_motionp->mPositionCurve.mKeys.begin();
- iter != joint_motionp->mPositionCurve.mKeys.end(); ++iter)
+ for (PositionCurve::key_map_t::value_type pos_pair : joint_motionp->mPositionCurve.mKeys)
{
- PositionKey& pos_key = iter->second;
+ PositionKey& pos_key = pos_pair.second;
U16 time_short = F32_to_U16(pos_key.mTime, 0.f, mJointMotionList->mDuration);
success &= dp.packU16(time_short, "time");
@@ -2051,10 +2041,8 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
success &= dp.packS32(mJointMotionList->mConstraints.size(), "num_constraints");
LL_DEBUGS("BVH") << "num_constraints " << mJointMotionList->mConstraints.size() << LL_ENDL;
- for (JointMotionList::constraint_list_t::const_iterator iter = mJointMotionList->mConstraints.begin();
- iter != mJointMotionList->mConstraints.end(); ++iter)
+ for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints)
{
- JointConstraintSharedData* shared_constraintp = *iter;
success &= dp.packU8(shared_constraintp->mChainLength, "chain_length");
success &= dp.packU8(shared_constraintp->mConstraintType, "constraint_type");
char source_volume[16]; /* Flawfinder: ignore */
@@ -2406,14 +2394,13 @@ void LLKeyframeDataCache::dumpDiagInfo()
LL_INFOS() << "-----------------------------------------------------" << LL_ENDL;
// print each loaded mesh, and it's memory usage
- for (keyframe_data_map_t::iterator map_it = sKeyframeDataMap.begin();
- map_it != sKeyframeDataMap.end(); ++map_it)
+ for (keyframe_data_map_t::value_type data_pair : sKeyframeDataMap)
{
U32 joint_motion_kb;
- LLKeyframeMotion::JointMotionList *motion_list_p = map_it->second;
+ LLKeyframeMotion::JointMotionList *motion_list_p = data_pair.second;
- LL_INFOS() << "Motion: " << map_it->first << LL_ENDL;
+ LL_INFOS() << "Motion: " << data_pair.first << LL_ENDL;
joint_motion_kb = motion_list_p->dumpDiagInfo();