I would like to create a shortcut to activate/deactivate (Occlude, Cull and Normal) checkboxes at the same in Texture Paint mode with a single key. Is it possible? or is scripting required for something like that?



1 Answer 1


Here's the script to do it. It currently toggles Backface Culling, MatCap, and Ambient Occlusion. I don't think there's a Normal toggle in object mode. did you mean in Edit Mode, toggling Face/Vertex Normals?

I've set up a key command to use SHIFT+SPACE but you can change that if you want.

import bpy

def main(context):

    area = bpy.context.area

    if area.type == 'VIEW_3D':
        bpy.context.space_data.show_backface_culling = not bpy.context.space_data.show_backface_culling
        bpy.context.space_data.use_matcap = not bpy.context.space_data.use_matcap
        bpy.context.space_data.fx_settings.use_ssao = not bpy.context.space_data.fx_settings.use_ssao

class opToggleCheckboxes(bpy.types.Operator):
    bl_idname = "object.toggle_checkboxes"
    bl_label = "Toggle Checkboxes"

    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        return {'FINISHED'}

addon_keymaps = []

def register():

    # handle the keymap
    wm = bpy.context.window_manager
    km = wm.keyconfigs.active.keymaps['3D View']
    kmi = km.keymap_items.new(opToggleCheckboxes.bl_idname, 'SPACE', 'PRESS', shift=True)

def unregister():

    # handle the keymap
    wm = bpy.context.window_manager
    for km in addon_keymaps:
    # clear the list
    del addon_keymaps[:]

if __name__ == "__main__":
  • $\begingroup$ Thank you Todd! The options I meant were from Project Paint panel in Texture Paint mode, but that code it was easy to change! $\endgroup$
    – Zafio
    Jun 23, 2015 at 10:48
  • $\begingroup$ With some extra help from Diego Quevedo made a tiny Addon, that also changes the cursor color when project paint options are inactive: blenderartists.org/forum/… $\endgroup$
    – Zafio
    Jun 24, 2015 at 18:53

You must log in to answer this question.

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