[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1466] trunk/py/scripts/addons/ io_mesh_ply/__init__.py: Allow importing of multiples ply files at once

Bouchard Guillaume guillaume.bouchard at liris.cnrs.fr
Fri Jan 21 14:45:06 CET 2011


Revision: 1466
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1466
Author:   guillaum
Date:     2011-01-21 13:45:05 +0000 (Fri, 21 Jan 2011)
Log Message:
-----------
Allow importing of multiples ply files at once

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

Modified: trunk/py/scripts/addons/io_mesh_ply/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/__init__.py	2011-01-21 12:37:03 UTC (rev 1465)
+++ trunk/py/scripts/addons/io_mesh_ply/__init__.py	2011-01-21 13:45:05 UTC (rev 1466)
@@ -39,6 +39,7 @@
         imp.reload(import_ply)
 
 
+import os
 import bpy
 from bpy.props import *
 from io_utils import ImportHelper, ExportHelper
@@ -48,15 +49,30 @@
     '''Load a BVH motion capture file'''
     bl_idname = "import_mesh.ply"
     bl_label = "Import PLY"
+    
+    files = CollectionProperty(name="File Path",
+                          description="File path used for importing "
+                                      "the PLY file",
+                          type=bpy.types.OperatorFileListElement)
 
+    directory = StringProperty()
+
     filename_ext = ".ply"
     filter_glob = StringProperty(default="*.ply", options={'HIDDEN'})
 
     def execute(self, context):
+        paths = [os.path.join(self.directory, name.name) for name in self.files]
+        if not paths:
+            paths.append(self.filepath)
+
         from . import import_ply
-        return import_ply.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
 
+        for path in paths:
+            import_ply.load(self, context, path)
 
+        return {'FINISHED'}
+
+
 class ExportPLY(bpy.types.Operator, ExportHelper):
     '''Export a single object as a stanford PLY with normals, colours and texture coordinates.'''
     bl_idname = "export_mesh.ply"



More information about the Bf-extensions-cvs mailing list