diff --git a/io_mesh_ply/__init__.py b/io_mesh_ply/__init__.py index bdac6fa2bab3789562f2d0c3e432fcbdd70f0ffb..e6ad0af14641ea093e2cc7c036fb49fbb2452ad8 100644 --- a/io_mesh_ply/__init__.py +++ b/io_mesh_ply/__init__.py @@ -39,6 +39,7 @@ if "bpy" in locals(): imp.reload(import_ply) +import os import bpy from bpy.props import * from io_utils import ImportHelper, ExportHelper @@ -48,13 +49,28 @@ class ImportPLY(bpy.types.Operator, ImportHelper): '''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):