From b3c8b727c60f277f7f00dd525f35b3c8a32f7d3c Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Fri, 21 Jan 2011 10:16:07 +0000
Subject: [PATCH] support for calling the operator with only filepath set.

---
 io_mesh_stl/__init__.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/io_mesh_stl/__init__.py b/io_mesh_stl/__init__.py
index fdf7a1b49..0a1ca354a 100644
--- a/io_mesh_stl/__init__.py
+++ b/io_mesh_stl/__init__.py
@@ -80,7 +80,10 @@ class ImportSTL(bpy.types.Operator, ImportHelper):
     directory = StringProperty()
 
     def execute(self, context):
-        paths = (os.path.join(self.directory, name.name) for name in self.files)
+        paths = [os.path.join(self.directory, name.name) for name in self.files]
+
+        if not paths:
+            paths.append(self.filepath)
 
         for path in paths:
             objName = bpy.path.display_name(path.split("\\")[-1].split("/")[-1])
-- 
GitLab