[Bf-blender-cvs] [a2cc85b2649] master: Cleanup Collada: Avoid unintentional reuse of previous defined variable

Gaia Clary noreply at git.blender.org
Sun Mar 11 21:00:09 CET 2018


Commit: a2cc85b2649a72707275b7b44908c3f936cd25ea
Author: Gaia Clary
Date:   Sun Mar 11 20:09:26 2018 +0100
Branches: master
https://developer.blender.org/rBa2cc85b2649a72707275b7b44908c3f936cd25ea

Cleanup Collada: Avoid unintentional reuse of previous defined variable

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.

===================================================================

M	source/blender/collada/ArmatureImporter.cpp

===================================================================

diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 0ea8324ed7c..c62aa054176 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -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);
 		}
 	}



More information about the Bf-blender-cvs mailing list