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

Mitchell Stokes mogurijin at gmail.com
Sat Jan 8 09:10:00 CET 2011


Revision: 1365
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1365
Author:   moguri
Date:     2011-01-08 08:09:59 +0000 (Sat, 08 Jan 2011)
Log Message:
-----------
== FBX Importer ==
  * Degree -> rad for object rotations
  * Use internal object dict instead of scene.objects

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 07:49:30 UTC (rev 1364)
+++ contrib/py/scripts/addons/io_import_fbx.py	2011-01-08 08:09:59 UTC (rev 1365)
@@ -179,6 +179,7 @@
     import math
     
     fbx_data = []
+    objects = {}
     parse_fbx(path, fbx_data)
     # Now lets get in the mesh data for fun.
 
@@ -220,7 +221,6 @@
 
                     # "Model::MyCamera", "Camera"  -->  MyCamera
                     fbx_name = name2.split(',')[0].strip()[1:-1].split("::", 1)[-1]
-
                     # we dont parse this part properly
                     # the name2 can be somtrhing like
                     # Model "Model::kimiko", "Mesh"
@@ -265,8 +265,11 @@
                         obj = bpy.data.objects.new(fbx_name, camera)
                         base = scene.objects.link(obj)
 
-                    # apply transformation
                     if obj:
+                        # Update our object dict
+                        objects[fbx_name] = obj
+                    
+                        # apply transformation
                         props = tag_get_single(value2, "Properties60")[1]
                         
                         # Note, rotations is not correct!
@@ -275,13 +278,13 @@
                         sca = tag_get_prop(props, "Lcl Scaling")
 
                         obj.location = loc
-                        obj.rotation_euler = rot
+                        obj.rotation_euler = [math.radians(i) for i in rot]
                         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 = scene.objects[parent]
+                            obj.parent = objects[parent]
                         
 
     return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list