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

Mitchell Stokes mogurijin at gmail.com
Sat Jan 8 21:25:40 CET 2011


Revision: 1371
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1371
Author:   moguri
Date:     2011-01-08 20:25:39 +0000 (Sat, 08 Jan 2011)
Log Message:
-----------
== FBX Importer ==
  * Preliminary lamp support
  * Todo: Shadows, transforms (location, rotation, scale)

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:31:13 UTC (rev 1370)
+++ contrib/py/scripts/addons/io_import_fbx.py	2011-01-08 20:25:39 UTC (rev 1371)
@@ -267,6 +267,30 @@
 
                         obj = bpy.data.objects.new(fbx_name, camera)
                         base = scene.objects.link(obj)
+                        
+                    elif name2.endswith(" \"Light\""):
+                        
+                        light = bpy.data.lamps.new(name=fbx_name)
+                        
+                        props = tag_get_single(value2, "Properties60")[1]
+                        
+                        
+                        # Lamp types
+                        light_types = {0: 'POINT', 1: 'SUN', 2: 'SPOT'}
+                        
+                        light.type = light_types[tag_get_prop(props, "LightType")]
+                        light.energy = max(tag_get_prop(props, "Intensity")/100, 0)
+                        light.color = tag_get_prop(props, "Color")
+                        light.distance = tag_get_prop(props, "DecayStart")
+                        
+                        if light.type == 'SPOT':
+                            light.spot_size = math.rad(tag_get_prop(props, "Cone angle"))
+                        
+                        # Todo: shadows
+                        
+                        obj = bpy.data.objects.new(fbx_name, light)
+                        base = scene.objects.link(obj)
+                        
 
                     if obj:
                         # Update our object dict



More information about the Bf-extensions-cvs mailing list