[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1370] contrib/py/scripts/addons/ io_import_fbx.py: == FBX Importer ==

Mitchell Stokes mogurijin at gmail.com
Sat Jan 8 20:31:13 CET 2011


Revision: 1370
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1370
Author:   moguri
Date:     2011-01-08 19:31:13 +0000 (Sat, 08 Jan 2011)
Log Message:
-----------
== FBX Importer ==
  * Handle parent rotations

Modified Paths:
--------------
    contrib/py/scripts/addons/io_import_fbx.py

Modified: contrib/py/scripts/addons/io_import_fbx.py
===================================================================
--- contrib/py/scripts/addons/io_import_fbx.py	2011-01-08 19:20:04 UTC (rev 1369)
+++ contrib/py/scripts/addons/io_import_fbx.py	2011-01-08 19:31:13 UTC (rev 1370)
@@ -271,6 +271,14 @@
                     if obj:
                         # Update our object dict
                         objects[fbx_name] = obj
+                        
+                        # Take care of parenting (we assume the parent has already been processed)
+                        parent = connections.get(fbx_name)
+                        if parent and parent != 'blend_root':
+                            obj.parent = objects[parent]
+                            parent = obj.parent
+                        else:
+                            parent = None
                     
                         # apply transformation
                         props = tag_get_single(value2, "Properties60")[1]
@@ -281,16 +289,15 @@
                         
                         # Convert rotation
                         rot_mat = mathutils.Euler([math.radians(i) for i in rot]).to_matrix()
-                        rot_mat *= mtx_x90
+                        if parent:
+                            rot_mat = mathutils.Matrix(parent.matrix_world).rotation_part().invert() * rot_mat
+                        else:
+                            rot_mat *= mtx_x90
 
                         obj.location = loc
                         obj.rotation_euler = rot_mat.to_euler()[:]
                         obj.scale = sca
                         
-                        # Take care of parenting (we assume the parent has already been processed)
-                        parent = connections.get(fbx_name)
-                        if parent and parent != 'blend_root':
-                            obj.parent = objects[parent]
                         
 
     return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list