Cleanup Collada: Avoid unintentional reuse of previous defined variable
authorGaia Clary <gaia.clary@machinimatrix.org>
Sun, 11 Mar 2018 19:09:26 +0000 (20:09 +0100)
committerGaia Clary <gaia.clary@machinimatrix.org>
Sun, 11 Mar 2018 19:59:49 +0000 (20:59 +0100)
The variable child was redeclared multiple times in the same function.
While this has not created any issues i still changed this to avoid
confusion and keep the usage of the variables more local.

source/blender/collada/ArmatureImporter.cpp

index 0ea8324..c62aa05 100644 (file)
@@ -282,12 +282,11 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, Bone *parentbone
        BoneExtensionMap &extended_bones = bone_extension_manager.getExtensionMap(armature);
        BoneExtended *dominant_child = NULL;
        int maxlen = 0;
-       Bone *child;
 
        if (parentbone == NULL)
                return;
 
-       child = (Bone *)parentbone->childbase.first;
+       Bone *child = (Bone *)parentbone->childbase.first;
        if (child && (import_settings->find_chains || child->next==NULL)) {
                for (; child; child = child->next) {
                        BoneExtended *be = extended_bones[child->name];
@@ -337,8 +336,8 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, Bone *parentbone
                                }
                        }
                }
-               for (Bone *child = (Bone *)parentbone->childbase.first; child; child = child->next) {
-                       ArmatureImporter::connect_bone_chains(armature, child, UNLIMITED_CHAIN_MAX);
+               for (Bone *ch = (Bone *)parentbone->childbase.first; ch; ch = ch->next) {
+                       ArmatureImporter::connect_bone_chains(armature, ch, UNLIMITED_CHAIN_MAX);
                }
        }
        else if (maxlen>1 && maxlen > this->import_settings->min_chain_length) {
@@ -348,8 +347,8 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, Bone *parentbone
        else {
                /* can't connect this Bone. Proceed with children ... */
                if (pbe) pbe->set_leaf_bone(true);
-               for (Bone *child = (Bone *)parentbone->childbase.first; child; child = child->next) {
-                       ArmatureImporter::connect_bone_chains(armature, child, UNLIMITED_CHAIN_MAX);
+               for (Bone *ch = (Bone *)parentbone->childbase.first; ch; ch = ch->next) {
+                       ArmatureImporter::connect_bone_chains(armature, ch, UNLIMITED_CHAIN_MAX);
                }
        }