[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3404] trunk/py/scripts/addons: Turned out only raw exporter had same bug...

Bastien Montagne montagne29 at wanadoo.fr
Sun May 27 11:38:40 CEST 2012


Revision: 3404
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3404
Author:   mont29
Date:     2012-05-27 09:38:39 +0000 (Sun, 27 May 2012)
Log Message:
-----------
Turned out only raw exporter had same bug...

Also, only calc_tessface() when needed, and use ExportHelper for RAW!

Modified Paths:
--------------
    trunk/py/scripts/addons/io_mesh_ply/export_ply.py
    trunk/py/scripts/addons/io_mesh_raw/__init__.py
    trunk/py/scripts/addons/io_mesh_raw/export_raw.py

Modified: trunk/py/scripts/addons/io_mesh_ply/export_ply.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2012-05-27 08:30:06 UTC (rev 3403)
+++ trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2012-05-27 09:38:39 UTC (rev 3404)
@@ -66,7 +66,8 @@
     # mesh.transform(obj.matrix_world) # XXX
 
     # Be sure tessface & co are available!
-    mesh.calc_tessface()
+    if not mesh.tessfaces and mesh.polygons:
+        mesh.calc_tessface()
 
     has_uv = (len(mesh.tessface_uv_textures) > 0)
     has_uv_vertex = (len(mesh.sticky) > 0)

Modified: trunk/py/scripts/addons/io_mesh_raw/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_raw/__init__.py	2012-05-27 08:30:06 UTC (rev 3403)
+++ trunk/py/scripts/addons/io_mesh_raw/__init__.py	2012-05-27 09:38:39 UTC (rev 3404)
@@ -43,6 +43,7 @@
     import bpy
 
 from bpy.props import StringProperty, BoolProperty
+from bpy_extras.io_utils import ExportHelper
 
 
 class RawImporter(bpy.types.Operator):
@@ -67,20 +68,14 @@
         return {'RUNNING_MODAL'}
 
 
-class RawExporter(bpy.types.Operator):
+class RawExporter(bpy.types.Operator, ExportHelper):
     '''Save Raw triangle mesh data'''
     bl_idname = "export_mesh.raw"
     bl_label = "Export RAW"
 
-    filepath = StringProperty(
-            subtype='FILE_PATH',
-            )
-    check_existing = BoolProperty(
-            name="Check Existing",
-            description="Check and warn on overwriting existing files",
-            default=True,
-            options={'HIDDEN'},
-            )
+    filename_ext = ".raw"
+    filter_glob = StringProperty(default="*.raw", options={'HIDDEN'})
+
     apply_modifiers = BoolProperty(
             name="Apply Modifiers",
             description="Use transformed mesh data from each object",
@@ -101,14 +96,7 @@
 
         return {'FINISHED'}
 
-    def invoke(self, context, event):
-        if not self.filepath:
-            self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ".raw")
-        wm = context.window_manager
-        wm.fileselect_add(self)
-        return {'RUNNING_MODAL'}
 
-
 def menu_import(self, context):
     self.layout.operator(RawImporter.bl_idname, text="Raw Faces (.raw)")
 

Modified: trunk/py/scripts/addons/io_mesh_raw/export_raw.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_raw/export_raw.py	2012-05-27 08:30:06 UTC (rev 3403)
+++ trunk/py/scripts/addons/io_mesh_raw/export_raw.py	2012-05-27 09:38:39 UTC (rev 3404)
@@ -75,6 +75,8 @@
             is_tmp_mesh = True
         else:
             me = obj.data
+            if not me.tessfaces and me.polygons:
+                me.calc_tessface()
             is_tmp_mesh = False
 
         if me is not None:



More information about the Bf-extensions-cvs mailing list