5
$\begingroup$

In Blender 2.8 how do I change the settings for the workbench render properties via python? The settings for the workbench render, not a viewport. For example if I manually change the lighting to FLAT, then the info panel reflects the command

bpy.context.scene.shading.light = 'FLAT'

but when running this myself it says that 'Scene' doesn't contain the attribute 'shading'. Same result if I directly access the scene object through bpy.data.

In the same render settings panel, in the 'Film' dropdown I can successfully change the Alpha Mode with bpy.context.scene.render.alpha_mode = "TRANSPARENT", but the settings related to the render engine have no such access that I can find.

$\endgroup$

1 Answer 1

3
$\begingroup$

You could try

bpy.data.scenes['Scene'].display.shading.light = 'FLAT'

or

bpy.context.scene.display.shading.light = 'FLAT'

(thanks to @nicklamer on #blenderpython)

$\endgroup$
1
  • 1
    $\begingroup$ Also works for accessing bpy.context.scene.display.shading.color_type $\endgroup$
    – Simon Repp
    Oct 30, 2019 at 12:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .