From: Mikko Rasa Date: Thu, 28 May 2009 06:18:39 +0000 (+0000) Subject: Blender exporter: X-Git-Tag: 1.1~7 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=477280bc451f9796747b699d4a3714f9bd3d8f30;p=libs%2Fgl.git Blender exporter: - Detect autosmoothing - Export mesh with modifiers applied --- diff --git a/mesh_export.py b/mesh_export.py index 41ceb90a..7f59e671 100644 --- a/mesh_export.py +++ b/mesh_export.py @@ -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])