SSAO Toggle Button

Hey guys, I’m trying to make a toggle button (not Radio) for enabling and disabling SSAO (The viewport AO), I have tried so many times but I can’t seem to get it, if you edit the source it says “GPUFXSetting.use_SSAO” and the console says “Default” but I can’t get this to work as a button as I want to be able to keybind it and have it inside a custom Pie menu… Any help would be much appreciated :slight_smile:

Maybe this helps


import bpy

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        space_data = area.spaces.active
        fx = space_data.fx_settings
        fx.use_ssao = not(fx.use_ssao)
        break

is there a way to turn this off for particular objects ?

@ draguu No, afaik. Also, name ‘Screen Space AO’ suggests it’s a global effect. Well pronounced on any helper lines left visible.

Wow, thank you so much… worked perfectly. :smiley: :smiley: :smiley: