# How can I create a shortcut to activate / deactivate multiple checkboxes?

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?

Thanks!

• – gandalf3 Jun 19 '15 at 19:30
• You can do this by making a custom operator. It isn't too hard, see blender.stackexchange.com/a/5388/599 for an example. – gandalf3 Jun 19 '15 at 19:32
• Thanks gandalf3! Although, after one hour without success I can't say it isn't too hard... but I'll keep trying! – Zafio Jun 19 '15 at 22:11

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):
"""Tooltip"""
bl_idname = "object.toggle_checkboxes"
bl_label = "Toggle Checkboxes"

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

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

def register():
bpy.utils.register_class(opToggleCheckboxes)

# 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():
bpy.utils.unregister_class(opToggleCheckboxes)

# handle the keymap
wm = bpy.context.window_manager