diff options
author | Stephen Leger <stephen@3dservices.ch> | 2017-08-03 16:59:40 +0300 |
---|---|---|
committer | Stephen Leger <stephen@3dservices.ch> | 2017-08-04 06:13:39 +0300 |
commit | 00b84551cf7798c402508bce9458a2ed2ca1fc77 (patch) | |
tree | 786d56eb32024f5fa2a6c84f12afbcc7a1e824e2 /archipack/archipack_object.py | |
parent | 83e5b12b75643ea5f71a5de40533d82d9179ab2a (diff) |
archipack: thumb generator to replace static thumbs, revert _preset to preset according to talk with ideasman42
Diffstat (limited to 'archipack/archipack_object.py')
-rw-r--r-- | archipack/archipack_object.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/archipack/archipack_object.py b/archipack/archipack_object.py index b99fc33b..7c3a2c16 100644 --- a/archipack/archipack_object.py +++ b/archipack/archipack_object.py @@ -36,7 +36,6 @@ from bpy_extras.view3d_utils import ( region_2d_to_origin_3d, region_2d_to_vector_3d ) -# from .materialutils import MaterialUtils class ArchipackObject(): @@ -151,18 +150,30 @@ class ArchipackCreateTool(): def load_preset(self, d): """ Load python preset + d: archipack object datablock preset: full filename.py with path """ d.auto_update = False + fallback = True if self.filepath != "": try: bpy.ops.script.python_file_run(filepath=self.filepath) + fallback = False except: - print("Archipack unable to load preset file : %s" % (self.filepath)) pass + if fallback: + # fallback to load preset on background process + try: + exec(compile(open(self.filepath).read(), self.filepath, 'exec')) + except: + print("Archipack unable to load preset file : %s" % (self.filepath)) + pass d.auto_update = True def add_material(self, o, material='DEFAULT', category=None): + # skip if preset allready add material + if "archipack_material" in o: + return try: if category is None: category = self.archipack_category |