Cycles Bake Pass Direct, Indirect, Color contributions

How to set Cycles bake settings ‘Direct’, ‘Indirect’ and ‘Color’ contributions with a script?


I tried:

scene = bpy.context.scene
scene.BakeSettings.use_pass_color = True

and

scene.bake_settings.use_pass_color = True

But it says “Scene object has no attribute BakeSettings” (or bake_settings)

scene.cycles.use_pass_color = True
scene.cycles.use_pass_direct = False
scene.cycles.use_pass_indirect = False

These don’t cause the script to fail but have no effect at all on the bake results.

Bump.

I have the same problem.

EDIT: I got it.

bpy.ops.object.bake(type=‘DIFFUSE’, pass_filter=set({‘COLOR’}))