From a19eebe08d80fdba1b1bf20aa438fd55ceff2b6e Mon Sep 17 00:00:00 2001 From: Jinglin Li <jli@techfak.uni-bielefeld.de> Date: Fri, 16 Feb 2018 12:03:08 +0100 Subject: [PATCH] Version compatibility blender 2.79.0 and above --- navipy/sensors/renderer.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/navipy/sensors/renderer.py b/navipy/sensors/renderer.py index af791f7..fe38d48 100644 --- a/navipy/sensors/renderer.py +++ b/navipy/sensors/renderer.py @@ -63,21 +63,27 @@ class BlenderRender(): output_file.format.file_format = "OPEN_EXR" output_file.file_slots.remove(output_file.inputs[0]) tmp_fileoutput = dict() - tmp_fileoutput['Image'] = 'Image' - tmp_fileoutput['Depth'] = 'Depth' - tmp_fileoutput['Folder'] = tempfile.TemporaryDirectory().name - tmp_fileoutput['ext'] = '.exr' - output_file.file_slots.new(tmp_fileoutput['Image']) - output_file.file_slots.new(tmp_fileoutput['Depth']) - output_file.base_path = tmp_fileoutput['Folder'] - scene.node_tree.links.new( - render_layers.outputs['Image'], - output_file.inputs['Image'] - ) - scene.node_tree.links.new( - render_layers.outputs['Z'], - output_file.inputs['Depth'] - ) + tmp_fileoutput['Image'] = 'Image' + tmp_fileoutput['Depth'] = 'Depth' + tmp_fileoutput['Folder'] = tempfile.TemporaryDirectory().name + tmp_fileoutput['ext'] = '.exr' + output_file.file_slots.new(tmp_fileoutput['Image']) + output_file.file_slots.new(tmp_fileoutput['Depth']) + output_file.base_path = tmp_fileoutput['Folder'] + scene.node_tree.links.new( + render_layers.outputs['Image'], + output_file.inputs['Image'] + ) + if bpy.app.version < (2,79,0): + scene.node_tree.links.new( + render_layers.outputs['Z'], + output_file.inputs['Depth'] + ) + else: + scene.node_tree.links.new( + render_layers.outputs['Depth'], + output_file.inputs['Depth'] + ) self.tmp_fileoutput = tmp_fileoutput @property -- GitLab