[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1364] contrib/py/scripts/addons/ io_import_fbx.py: == FBX Importer ==
Mitchell Stokes
mogurijin at gmail.com
Sat Jan 8 08:49:31 CET 2011
Revision: 1364
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1364
Author: moguri
Date: 2011-01-08 07:49:30 +0000 (Sat, 08 Jan 2011)
Log Message:
-----------
== FBX Importer ==
* Parenting is now being handled
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:18:17 UTC (rev 1363)
+++ contrib/py/scripts/addons/io_import_fbx.py 2011-01-08 07:49:30 UTC (rev 1364)
@@ -159,6 +159,17 @@
while i < len(lines):
i = read_fbx(i, fbx_data)
+def parse_connections(fbx_data):
+ c = {}
+ for tag, name, value in fbx_data:
+ type, child, parent = [i.strip() for i in value.replace('"', '').split(',')]
+ if type == "OO":
+ parent = parent.replace('Model::', '')
+ child = child.replace('Model::', '')
+
+ c[child] = parent
+
+ return c
# Blender code starts here:
import bpy
@@ -190,6 +201,8 @@
return None
scene = bpy.context.scene
+
+ connections = parse_connections(tag_get_single(fbx_data, "Connections")[1])
for tag1, name1, value1 in fbx_data:
if tag1 == "Objects":
@@ -264,6 +277,12 @@
obj.location = loc
obj.rotation_euler = 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]
+
return {'FINISHED'}
@@ -303,4 +322,4 @@
if __name__ == "__main__":
- import_fbx("/test.fbx")
+ import_fbx("/test.fbx")
\ No newline at end of file
More information about the Bf-extensions-cvs
mailing list