3
$\begingroup$

I am trying to access the world shading settings in python.
I want to enable ambient occlusion and give it a value of 0.5. I have tried:

bpy.types.WorldLighting.use_ambient_occlusion()

But I didn't work.

$\endgroup$
1

1 Answer 1

4
$\begingroup$

To turn Ambient Occlusion on you must set its value to True. What you are doing wrong is that you are trying to execute the function use_ambient_occlusion() which does not exist because it's variable not a function.

import bpy
bpy.context.scene.world.light_settings.use_ambient_occlusion = True  # turn AO on
bpy.context.scene.world.light_settings.ao_factor = 0.5  # set it to 0.5
$\endgroup$

You must log in to answer this question.

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