[Bf-extensions-cvs] [c5077c1] master: io_points_pcd - Add object with the name of the file.

Aurel Wildfellner noreply at git.blender.org
Wed Nov 11 17:32:00 CET 2015


Commit: c5077c10b4214b4761e0df76ea7ce1aac37d44a9
Author: Aurel Wildfellner
Date:   Wed Nov 11 17:31:36 2015 +0100
Branches: master
https://developer.blender.org/rBACc5077c10b4214b4761e0df76ea7ce1aac37d44a9

io_points_pcd - Add object with the name of the file.

===================================================================

M	io_points_pcd/__init__.py

===================================================================

diff --git a/io_points_pcd/__init__.py b/io_points_pcd/__init__.py
index 08ed92d..fe6c9c2 100644
--- a/io_points_pcd/__init__.py
+++ b/io_points_pcd/__init__.py
@@ -53,7 +53,7 @@ class ImportPCD(bpy.types.Operator, ImportHelper):
     filename_ext = ".pcd"
 
     filter_glob = StringProperty(default="*.pcd", options={'HIDDEN'})
-    object_name = StringProperty(default="pointcloud", options={'HIDDEN'})
+    object_name = StringProperty(default="", options={'HIDDEN'})
 
     files = CollectionProperty(name="File Path",
                           description="File path used for importing "
@@ -68,7 +68,17 @@ class ImportPCD(bpy.types.Operator, ImportHelper):
             paths.append(self.filepath)
 
         for path in paths:
-            pcd_utils.import_pcd(path, self.object_name)
+
+            objname = ""
+
+            if self.object_name == "":
+                # name the object with the filename exluding .pcd
+                objname = os.path.basename(path)[:-4]
+            else:
+                # use name set by calling the operator with the arg
+                objname = self.object_name
+
+            pcd_utils.import_pcd(path, objname)
 
         return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list