diff options
author | Stephen Leger <stephen@3dservices.ch> | 2019-06-06 14:28:23 +0300 |
---|---|---|
committer | Stephen Leger <stephen@3dservices.ch> | 2019-06-06 14:28:23 +0300 |
commit | a2c280a16b947b7e4e05cb595c54769af053e26b (patch) | |
tree | 587c3936d6f89c47c2a429ac68d6099ab4134003 | |
parent | 2d691e2e0c46b3d91b491cfeda94523c1517a085 (diff) |
Archipack: fix offline rendering of thumbs
-rw-r--r-- | archipack/__init__.py | 2 | ||||
-rw-r--r-- | archipack/archipack_preset.py | 2 | ||||
-rw-r--r-- | archipack/archipack_thumbs.py | 12 | ||||
-rw-r--r-- | archipack/archipack_wall2.py | 5 |
4 files changed, 13 insertions, 8 deletions
diff --git a/archipack/__init__.py b/archipack/__init__.py index e8ec83a6..431f7d15 100644 --- a/archipack/__init__.py +++ b/archipack/__init__.py @@ -31,7 +31,7 @@ bl_info = { 'author': 's-leger', 'license': 'GPL', 'deps': '', - 'version': (1, 2, 82), + 'version': (1, 2, 83), 'blender': (2, 80, 0), 'location': 'View3D > Tools > Create > Archipack', 'warning': '', diff --git a/archipack/archipack_preset.py b/archipack/archipack_preset.py index 745b1826..f859b51f 100644 --- a/archipack/archipack_preset.py +++ b/archipack/archipack_preset.py @@ -295,6 +295,8 @@ class PresetMenu(): self.imageList.append(image.filepath_raw) elif os.path.exists(filepath + '.png') and os.path.isfile(filepath + '.png'): image = bpy.data.images.load(filepath=filepath + '.png') + if hasattr(image, "colorspace_settings"): + image.colorspace_settings.name = 'Raw' self.imageList.append(image) if image is None: image = self.default_image diff --git a/archipack/archipack_thumbs.py b/archipack/archipack_thumbs.py index 3cdbee64..ce6d0b48 100644 --- a/archipack/archipack_thumbs.py +++ b/archipack/archipack_thumbs.py @@ -41,17 +41,20 @@ def create_lamp(context, loc): location=loc) lamp = context.active_object lamp.data.use_nodes = True + lamp.location = loc tree = lamp.data.node_tree return tree, tree.nodes, lamp.data def create_camera(context, loc, rot): bpy.ops.object.camera_add( - align='VIEW', + align='WORLD', enter_editmode=False, location=loc, rotation=rot) cam = context.active_object + cam.location = loc + cam.rotation_euler = rot context.scene.camera = cam return cam @@ -78,9 +81,6 @@ def apply_simple_material(o, name, color): o.data.materials.append(m) -# /home/stephen/blender-28-git/build_linux_full/bin/blender --background --factory-startup -noaudio --python /home/stephen/blender-28-git/build_linux_full/bin/2.80/scripts/addons/archipack/archipack_thumbs.py -- addon:archipack matlib:/medias/stephen/DATA/lib/ cls:roof preset:/home/stephen/.config/blender/2.80/scripts/presets/archipack_roof/square.py - - def generateThumb(context, cls, preset, engine): log("### RENDER THUMB ############################") @@ -169,17 +169,19 @@ def generateThumb(context, cls, preset, engine): # add 3 lights tree, nodes, lamp = create_lamp(context, (3.69736, -7, 6.0)) - lamp.energy = 50 + lamp.energy = 1000 emit = nodes["Emission"] emit.inputs[1].default_value = 2000.0 tree, nodes, lamp = create_lamp(context, (9.414563179016113, 5.446230888366699, 5.903861999511719)) + lamp.energy = 400 emit = nodes["Emission"] falloff = nodes.new(type="ShaderNodeLightFalloff") falloff.inputs[0].default_value = 5 tree.links.new(falloff.outputs[2], emit.inputs[1]) tree, nodes, lamp = create_lamp(context, (-7.847615718841553, 1.03135085105896, 5.903861999511719)) + lamp.energy = 200 emit = nodes["Emission"] falloff = nodes.new(type="ShaderNodeLightFalloff") falloff.inputs[0].default_value = 5 diff --git a/archipack/archipack_wall2.py b/archipack/archipack_wall2.py index 8e3bfb43..78e3176f 100644 --- a/archipack/archipack_wall2.py +++ b/archipack/archipack_wall2.py @@ -2234,8 +2234,9 @@ class ARCHIPACK_OT_wall2_draw(ArchipackDrawTool, Operator): for o in self.sel: o.select_set(state=True) # select and make active - self.act.select_set(state=True) - context.view_layer.objects.active = self.act + if self.act is not None: + self.act.select_set(state=True) + context.view_layer.objects.active = self.act else: o = self.o |