[Bf-extensions-cvs] [2b6a756] master: Fix T48713: Problem when importing FBX file with 2 armatures.

Bastien Montagne noreply at git.blender.org
Fri Jun 24 12:53:47 CEST 2016


Commit: 2b6a7563ac4db60d02c9530c4d1870ea8c3a6a0e
Author: Bastien Montagne
Date:   Fri Jun 24 12:51:59 2016 +0200
Branches: master
https://developer.blender.org/rBA2b6a7563ac4db60d02c9530c4d1870ea8c3a6a0e

Fix T48713: Problem when importing FBX file with 2 armatures.

Yet another case of the infamous 'iterating over something while modifying it' issue.
Here, setting parent of a node actually modifies the children list of its previous parent,
which resulted in missed items in the iteration.

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

M	io_scene_fbx/__init__.py
M	io_scene_fbx/import_fbx.py

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

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index decd947..687e090 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "FBX format",
     "author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
-    "version": (3, 7, 4),
+    "version": (3, 7, 5),
     "blender": (2, 77, 0),
     "location": "File > Import-Export",
     "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index ca3a06e..4055a3b 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1677,11 +1677,12 @@ class FbxImportHelperNode:
                 armature = self
             else:
                 # otherwise insert a new node
+                # XXX Maybe in case self is virtual FBX root node, we should instead add one armature per bone child?
                 armature = FbxImportHelperNode(None, None, None, False)
                 armature.fbx_name = "Armature"
                 armature.is_armature = True
 
-                for child in self.children:
+                for child in tuple(self.children):
                     if child.is_bone:
                         child.parent = armature



More information about the Bf-extensions-cvs mailing list