blender version
wjlszhang opened this issue · 3 comments
Hi, @panmari
I meet problem when I run the script provided in the README, I got the issue below, is it related to the blender verison?
(base) hengaigaoke@linux:~/work/blfg/render$ blender --background --python render_blender.py -- --output_folder=output lowjaw.obj
Blender 3.3.1 (hash b292cfe5a936 built 2022-10-05 00:14:35)
Read prefs: /home/hengaigaoke/.config/blender/3.3/config/userpref.blend
Error: Python: Traceback (most recent call last):
File "/home/hengaigaoke/work/blfg/render/render_blender.py", line 56, in
scene.view_layers["View Layer"].use_pass_normal = True
KeyError: 'bpy_prop_collection[key]: key "View Layer" not found'
Thanks so much!
Your assumption looks reasonable to me, the script is only tested for Blender 2.9.
If you find a fix, could you please prepare a pull request?
@wjlszhang You can fix it by simply modifying the key View Layer
to ViewLayer
.
e.g.,
scene.view_layers["View Layer"].use_pass_normal = True
->
scene.view_layers["ViewLayer"].use_pass_normal = True
I solved this issue by setting
context.window.view_layer.use_pass_normal = True
context.window.view_layer.use_pass_diffuse_color = True
context.window.view_layer.use_pass_z = True