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.


You could try

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

(thanks to @nicklamer on #blenderpython)

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.