diff --git a/components/resource/animation.cpp b/components/resource/animation.cpp index 34ae162ee7..d2d7d08d55 100644 --- a/components/resource/animation.cpp +++ b/components/resource/animation.cpp @@ -10,7 +10,7 @@ namespace Resource mStartTime(0.0f) { const osgAnimation::ChannelList& channels = anim.getChannels(); - for (const osg::ref_ptr 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 channel: mChannels) + for (const auto& channel: mChannels) { channel->update(time, 1.0f, 0); } diff --git a/components/resource/keyframemanager.cpp b/components/resource/keyframemanager.cpp index af0f365ee5..41b10bd65d 100644 --- a/components/resource/keyframemanager.cpp +++ b/components/resource/keyframemanager.cpp @@ -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 channel: channels) + for (const auto& channel: channels) { mergedAnimationTrack->addChannel(channel.get()->clone()); // is ->clone needed? } diff --git a/components/sceneutil/osgacontroller.cpp b/components/sceneutil/osgacontroller.cpp index 87e6f02fee..d77b8d666c 100644 --- a/components/sceneutil/osgacontroller.cpp +++ b/components/sceneutil/osgacontroller.cpp @@ -31,7 +31,7 @@ namespace SceneUtil void LinkVisitor::link(osgAnimation::UpdateMatrixTransform* umt) { const osgAnimation::ChannelList& channels = mAnimation->getChannels(); - for (const osg::ref_ptr 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 mergedAnimationTrack : mMergedAnimationTracks) + for (const auto& mergedAnimationTrack : mMergedAnimationTracks) { if (mergedAnimationTrack->getName() != animationName) continue; const osgAnimation::ChannelList& channels = mergedAnimationTrack->getChannels(); - for (const osg::ref_ptr 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 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 mergedAnimationTrack : mMergedAnimationTracks) + for (const auto& mergedAnimationTrack : mMergedAnimationTracks) { if (!mLinker.valid()) mLinker = new LinkVisitor(); mLinker->setAnimation(mergedAnimationTrack);