Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'archipack/archipack_object.py')
-rw-r--r--archipack/archipack_object.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/archipack/archipack_object.py b/archipack/archipack_object.py
index 18ae43e5..b99fc33b 100644
--- a/archipack/archipack_object.py
+++ b/archipack/archipack_object.py
@@ -36,7 +36,7 @@ from bpy_extras.view3d_utils import (
region_2d_to_origin_3d,
region_2d_to_vector_3d
)
-from .materialutils import MaterialUtils
+# from .materialutils import MaterialUtils
class ArchipackObject():
@@ -117,9 +117,9 @@ class ArchipackObject():
o.select = True
except:
pass
-
- self.previously_active.select = True
- context.scene.objects.active = self.previously_active
+ if self.previously_active is not None:
+ self.previously_active.select = True
+ context.scene.objects.active = self.previously_active
self.previously_selected = None
self.previously_active = None
@@ -156,19 +156,20 @@ class ArchipackCreateTool():
d.auto_update = False
if self.filepath != "":
try:
- # print("Archipack loading preset: %s" % d.auto_update)
bpy.ops.script.python_file_run(filepath=self.filepath)
- # print("Archipack preset loaded auto_update: %s" % d.auto_update)
except:
print("Archipack unable to load preset file : %s" % (self.filepath))
pass
d.auto_update = True
- def add_material(self, o):
+ def add_material(self, o, material='DEFAULT', category=None):
try:
- getattr(MaterialUtils, "add_" + self.archipack_category + "_materials")(o)
+ if category is None:
+ category = self.archipack_category
+ if bpy.ops.archipack.material.poll():
+ bpy.ops.archipack.material(category=category, material=material)
except:
- print("Archipack MaterialUtils.add_%s_materials not found" % (self.archipack_category))
+ print("Archipack %s materials not found" % (self.archipack_category))
pass
def manipulate(self):