[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4253] trunk/py/scripts/addons/ io_scene_obj/export_obj.py: triangulate works again

Campbell Barton ideasman42 at gmail.com
Sun Feb 10 13:58:03 CET 2013


Revision: 4253
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4253
Author:   campbellbarton
Date:     2013-02-10 12:58:02 +0000 (Sun, 10 Feb 2013)
Log Message:
-----------
triangulate works again

Modified Paths:
--------------
    trunk/py/scripts/addons/io_scene_obj/export_obj.py

Modified: trunk/py/scripts/addons/io_scene_obj/export_obj.py
===================================================================
--- trunk/py/scripts/addons/io_scene_obj/export_obj.py	2013-02-10 12:55:10 UTC (rev 4252)
+++ trunk/py/scripts/addons/io_scene_obj/export_obj.py	2013-02-10 12:58:02 UTC (rev 4253)
@@ -34,15 +34,12 @@
 
 
 def mesh_triangulate(me):
-    pass
-    '''
     import bmesh
     bm = bmesh.new()
     bm.from_mesh(me)
     bmesh.ops.triangulate(bm, faces=bm.faces)
     bm.to_mesh(me)
     bm.free()
-    '''
 
 
 def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
@@ -371,6 +368,10 @@
 
             me.transform(EXPORT_GLOBAL_MATRIX * ob_mat)
 
+            if EXPORT_TRI:
+                # _must_ do this first since it re-allocs arrays
+                mesh_triangulate(me)
+
             if EXPORT_UV:
                 faceuv = len(me.uv_textures) > 0
                 if faceuv:
@@ -397,9 +398,6 @@
 
                 continue  # dont bother with this mesh.
 
-            if EXPORT_TRI:
-                mesh_triangulate(me)
-
             if EXPORT_NORMALS and face_index_pairs:
                 me.calc_normals()
 



More information about the Bf-extensions-cvs mailing list