[Bf-extensions-cvs] [253a936d] master: archipack: allow importing without executing

Campbell Barton noreply at git.blender.org
Tue Aug 8 13:54:40 CEST 2017


Commit: 253a936d60bf944b303bd899d9edbbc543af989b
Author: Campbell Barton
Date:   Tue Aug 8 21:55:12 2017 +1000
Branches: master
https://developer.blender.org/rBA253a936d60bf944b303bd899d9edbbc543af989b

archipack: allow importing without executing

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

M	archipack/archipack_thumbs.py

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

diff --git a/archipack/archipack_thumbs.py b/archipack/archipack_thumbs.py
index 5b14e91b..57f1804a 100644
--- a/archipack/archipack_thumbs.py
+++ b/archipack/archipack_thumbs.py
@@ -171,13 +171,14 @@ def generateThumb(context, cls, preset):
     log("### COMPLETED ############################")
 
 
-preset = ""
+if __name__ == "__main__":
+    preset = ""
 
-for arg in sys.argv:
-    if arg.startswith("cls:"):
-        cls = arg[4:]
-    if arg.startswith("preset:"):
-        preset = arg[7:]
+    for arg in sys.argv:
+        if arg.startswith("cls:"):
+            cls = arg[4:]
+        if arg.startswith("preset:"):
+            preset = arg[7:]
 
 
-generateThumb(bpy.context, cls, preset)
+    generateThumb(bpy.context, cls, preset)



More information about the Bf-extensions-cvs mailing list