Use const auto&

pull/3041/head
Nelsson Huotari 4 years ago
parent c8d85dcf30
commit 256aa5e71d

@ -10,7 +10,7 @@ namespace Resource
mStartTime(0.0f)
{
const osgAnimation::ChannelList& channels = anim.getChannels();
for (const osg::ref_ptr<osgAnimation::Channel> channel: channels)
for (const auto& channel: channels)
addChannel(channel.get()->clone());
}
@ -31,7 +31,7 @@ namespace Resource
bool Animation::update (double time)
{
for (const osg::ref_ptr<osgAnimation::Channel> channel: mChannels)
for (const auto& channel: mChannels)
{
channel->update(time, 1.0f, 0);
}

@ -44,7 +44,7 @@ namespace Resource
std::string loopstop = animationName + std::string(": loop stop");
const osgAnimation::ChannelList& channels = animation->getChannels();
for (const osg::ref_ptr<osgAnimation::Channel> channel: channels)
for (const auto& channel: channels)
{
mergedAnimationTrack->addChannel(channel.get()->clone()); // is ->clone needed?
}

@ -31,7 +31,7 @@ namespace SceneUtil
void LinkVisitor::link(osgAnimation::UpdateMatrixTransform* umt)
{
const osgAnimation::ChannelList& channels = mAnimation->getChannels();
for (const osg::ref_ptr<osgAnimation::Channel> channel: channels)
for (const auto& channel: channels)
{
const std::string& channelName = channel->getName();
const std::string& channelTargetName = channel->getTargetName();
@ -125,13 +125,13 @@ namespace SceneUtil
}
//Find the root transform track in animation
for (const osg::ref_ptr<Resource::Animation> mergedAnimationTrack : mMergedAnimationTracks)
for (const auto& mergedAnimationTrack : mMergedAnimationTracks)
{
if (mergedAnimationTrack->getName() != animationName) continue;
const osgAnimation::ChannelList& channels = mergedAnimationTrack->getChannels();
for (const osg::ref_ptr<osgAnimation::Channel> channel: channels)
for (const auto& channel: channels)
{
if (channel->getTargetName() != "root" || channel->getName() != "transform") continue;
@ -150,7 +150,7 @@ namespace SceneUtil
void OsgAnimationController::update(float time, std::string animationName)
{
for (const osg::ref_ptr<Resource::Animation> mergedAnimationTrack : mMergedAnimationTracks)
for (const auto& mergedAnimationTrack : mMergedAnimationTracks)
{
if (mergedAnimationTrack->getName() == animationName) mergedAnimationTrack->update(time);
}
@ -162,7 +162,7 @@ namespace SceneUtil
{
if (mNeedToLink)
{
for (const osg::ref_ptr<Resource::Animation> mergedAnimationTrack : mMergedAnimationTracks)
for (const auto& mergedAnimationTrack : mMergedAnimationTracks)
{
if (!mLinker.valid()) mLinker = new LinkVisitor();
mLinker->setAnimation(mergedAnimationTrack);

Loading…
Cancel
Save