[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1374] contrib/py/scripts/addons/ io_import_fbx.py: FBX Importer: handles smoothing in meshes

Mitchell Stokes mogurijin at gmail.com
Sat Jan 8 22:44:42 CET 2011


Revision: 1374
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1374
Author:   moguri
Date:     2011-01-08 21:44:42 +0000 (Sat, 08 Jan 2011)
Log Message:
-----------
FBX Importer: handles smoothing in meshes

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 21:27:22 UTC (rev 1373)
+++ contrib/py/scripts/addons/io_import_fbx.py	2011-01-08 21:44:42 UTC (rev 1374)
@@ -255,6 +255,25 @@
 
                             me.from_pydata(blen_verts, [], blen_faces)
                             me.update()
+                            
+                            # Handle smoothing
+                            for i in tag_get_iter(value2, "LayerElementSmoothing"):
+                                i = i[1]
+                                type = tag_get_single(i, "MappingInformationType")[1]
+                                
+                                if type == "ByPolygon":
+                                    smooth_faces = tag_get_single(i, "Smoothing")[1]
+                                    
+                                    for idx, f in enumerate(me.faces):
+                                        f.use_smooth = smooth_faces[idx]
+                                elif type == "ByEdge":
+                                    smooth_edges = tag_get_single(i, "Smoothing")[1]
+                                    
+                                    for idx, ed in enumerate(me.edges):
+                                        ed.use_edge_sharp = smooth_edges[idx]
+                                else:
+                                    print("WARNING: %s, unsupported smoothing type: %s" % (fbx_name, type))
+                            
 
                             obj = bpy.data.objects.new(fbx_name, me)
                             base = scene.objects.link(obj)



More information about the Bf-extensions-cvs mailing list