]> git.tdb.fi Git - libs/gl.git/commitdiff
Blender exporter:
authorMikko Rasa <tdb@tdb.fi>
Thu, 28 May 2009 06:18:39 +0000 (06:18 +0000)
committerMikko Rasa <tdb@tdb.fi>
Thu, 28 May 2009 06:18:39 +0000 (06:18 +0000)
- Detect autosmoothing
- Export mesh with modifiers applied

mesh_export.py

index 41ceb90a7baed794eaf7fa1cf6cc6d0276efb5e2..7f59e671b01decaa542207e681a64ae2e7899d73 100644 (file)
@@ -151,7 +151,10 @@ class Mesh:
 
                self.lines=[Line(e) for e in self.edges.itervalues() if not e.faces]
 
-               smooth_limit=math.cos(m.degr*math.pi/180)
+               if m.mode&Blender.Mesh.Modes.AUTOSMOOTH:
+                       smooth_limit=math.cos(m.degr*math.pi/180)
+               else:
+                       smooth_limit=-1
                for e in self.edges.itervalues():
                        e.v1=self.verts[e.v1.index]
                        e.v2=self.verts[e.v2.index]
@@ -382,7 +385,9 @@ class Exporter:
                if obj.getType()!="Mesh":
                        raise Exception, "Can only export Mesh data"
 
-               mesh=Mesh(obj.getData(mesh=True))
+               mesh=Blender.Mesh.New("export_tmp")
+               mesh.getFromObject(obj)
+               mesh=Mesh(mesh)
 
                if self.debug:
                        ntris=sum([len(f.verts)-2 for f in mesh.faces])