How to Initialize keymaps for this gizmo group?

For gizmo function is a classmethod setup_keymap(keyconfig). How to properly initialize for gizmo in this function Keymaps?

#this is my Gizmo class
class GIZMO_GGT_object(GizmoGroup):
    bl_idname = "gizmo.pivot"
    bl_label = "Gizmo for pivot"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'WINDOW'
    bl_options = {'3D', 'PERSISTENT'} #'TOOL_INIT' , 'SHOW_MODAL_ALL', 'SELECT'

    def setup_keymap(keyconfig):
    def poll(cls, context):
    def setup(self, context):
    def draw_prepare(self, context):

I did one like this:

# Registration
addon_keymaps = []

def register():
    # handle the keymap
    wm = bpy.context.window_manager
    # Note that in background mode (no GUI available), keyconfigs are not available either,
    # so we have to check this to avoid nasty errors in background case.
    kc = wm.keyconfigs.addon
    if kc:
        km ='Window', space_type='EMPTY')
        kmi =, type = 'P', value = 'PRESS', ctrl=False, shift=True)
        addon_keymaps.append((km, kmi))
        km ='Window', space_type='EMPTY')
        kmi =, type = 'P', value = 'PRESS', ctrl=True, shift=True)
        addon_keymaps.append((km, kmi))

And the unregister like this:

def unregister():
    # handle the keymap
    for km, kmi in addon_keymaps:

Is this any help to you?

I for Addons initialize keymap, but i need inicializade keymap for custom gizmo, and I thought that this can be done through this function. I think I found in API that can help me specifically with this gizmo tweak . You as a more experienced programmer, how would you use this for gizmo? I unfortunately not found where would similar used.
I also found this. I try to activate gizmo only by dragging, but I want to be able to select the vertex behind the gizmo. I have already asked a question on this subject. I think I’m around)))

Unfortunately my knowledge of Gizmos is very limited, perhaps someone else has better ideas than me. Sorry, I am doing all I can here…

Cheers, Clock.

1 Like