New WorkSpaceTool tool does not see the operator from addon

I have made simple scale active object addon, that supposed to use new WorkSpaceTool tool system. Problem is the new tool, does not see the test_scale operator from:

bl_keymap = (
        ("mesh.test_scale", {"type": 'LEFTMOUSE', "value": 'PRESS'} ),

Only after reloading addons with F8 (bpy.ops.script.reload()) it starts to work (when new tool is selected, LMB click scales the active object).
Any ideas why MyTool won’t load the “mesh.test_scale” correctly when blender is started? Here is the python addon file

1 Like

Is the tool not there in the toolbar, or is just the tool shortcut not working?

Tool is registered ok. If is use existing (build in) operator in bl_keymap - for the tool, it also works ok.
It is just if bl_keymap uses operator defined in the addon itself, then tool icon won’t work (icon is there, but does nothing, unless I reload all addons). It may be blender bug I think.

Can confirm the same is happening to me. Should be a bug then, would be great if you can report it via the Help -> Report a Bug menu in Blender.

Last post is from 12 days ago. Has this issue been looked into?
Are scripted operators still not supported with WorkSpaceTool?

I reported bug :
which was marked as duplicate of:

So it seems there is problem with proper regiestering of ‘modal keymaps’ (not sure what that is).

1 Like

@JoseConseco thank you, I’ll subscribe to that.

This bug does not appear to be fixed in the 2.8 release candidate.
Am I expected to be fixed by release?
If so, what should we do?

I know the reply is a bit late. I got it working with this code registering empty keymap to defautl setting and then adding value to it:

kmToolQuickSlice = "3D View Tool: Edit Mesh, Slice"

keymapSnap = (kmToolQuickSlice,
        {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
        {"items": [
            ("wm.modal_quick_slice", {"type": 'LEFTMOUSE', "value": 'PRESS'},
             {"properties": []}),

emptykeymapSnap= (kmToolQuickSlice,
        {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
        {"items": []},)

def registerKeymaps():
    keyconfigs = bpy.context.window_manager.keyconfigs
    kc_defaultconf = keyconfigs.default
    kc_addonconf = keyconfigs.addon
    from import keyconfig_init_from_data
    keyconfig_init_from_data(kc_defaultconf, [emptykeymapSnap])
    keyconfig_init_from_data(kc_addonconf, [keymapSnap])

def unregisterKeymaps():
    keyconfigs = bpy.context.window_manager.keyconfigs
    defaultmap = keyconfigs.get("blender").keymaps
    addonmap   = keyconfigs.get("blender addon").keymaps

    for km_name, km_args, km_content in [keymapSnap]:
        keymap = addonmap.find(km_name, **km_args)
        keymap_items = keymap.keymap_items
        for item in km_content['items']:
            item_id = keymap_items.find(item[0])
            if item_id != -1:
        defaultmap.remove(defaultmap.find(km_name, **km_args))


1 Like