diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-12-07 14:21:11 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-12-07 14:41:17 +0300 |
commit | 11c4066159e12ff630673c5fd94b37fb8c0f9102 (patch) | |
tree | 79c365fe59bf852478c561c1a7fd1679831a2be7 /source/blender/io/collada/DocumentImporter.cpp | |
parent | 2072134faadf4fd901c88ed7440e2289d61e0299 (diff) |
Cleanup: partial Clang-Tidy modernize-loop-convert
Modernize loops by using the `for(type variable : container)` syntax.
Some loops were trivial to fix, whereas others required more attention
to avoid semantic changes. I couldn't address all old-style loops, so
this commit doesn't enable the `modernize-loop-convert` rule.
Although Clang-Tidy's auto-fixer prefers to use `auto` for the loop
variable declaration, I made as many declarations as possible explicit.
To me this increases local readability, as you don't need to fully
understand the container in order to understand the loop variable type.
No functional changes.
Diffstat (limited to 'source/blender/io/collada/DocumentImporter.cpp')
-rw-r--r-- | source/blender/io/collada/DocumentImporter.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index b85a96d89de..10c1a90576c 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -241,10 +241,8 @@ void DocumentImporter::finish() armature_importer.fix_animation(); #endif - for (std::vector<const COLLADAFW::VisualScene *>::iterator vsit = vscenes.begin(); - vsit != vscenes.end(); - vsit++) { - const COLLADAFW::NodePointerArray &roots = (*vsit)->getRootNodes(); + for (const COLLADAFW::VisualScene *vscene : vscenes) { + const COLLADAFW::NodePointerArray &roots = vscene->getRootNodes(); for (unsigned int i = 0; i < roots.getCount(); i++) { translate_anim_recursive(roots[i], nullptr, nullptr); @@ -665,9 +663,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, goto finally; } - for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); - ++it) { - ob = *it; + for (Object *ob : *objects_done) { std::string nodename = node->getName().empty() ? node->getOriginalId() : node->getName(); BKE_libblock_rename(bmain, &ob->id, (char *)nodename.c_str()); object_map.insert(std::pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), ob)); @@ -681,10 +677,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, /* create_constraints(et,ob); */ } - for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); - ++it) { - ob = *it; - + for (Object *ob : *objects_done) { if (read_transform) { anim_importer.read_node_transform(node, ob); /* overwrites location set earlier */ } |