4
$\begingroup$

I'm trying to reach view3d.view_qcd_slot allegedly located inside Object Mode category. But I'm getting KeyError: 'bpy_prop_collection[key]: key "view3d.view_qcd_slot" not found'

Here's my train of thought:

I've got this code that works for view3d.move located inside 3D View category.

wm = bpy.context.window_manager
wm.keyconfigs.default.keymaps['3D View'].keymap_items['view3d.move'].active = False

When I try it with my desired keybind, both .keymaps['3D View'].keymap_items['view3d.view_qcd_slot'] as well as .keymaps['Object Mode'].keymap_items['view3d.view_qcd_slot'] throw the not found error.

Inside the Preferences window it seems that view3d.view_qcd_slot is nested a little bit deeper, like so: illustration of how the two keybinds are nested inside preferences

But when I exported my keybinds to a .py file to inspect it it seems they're right next to each other: illustration of keybinds in code form

So I'm super confused why .keymaps['Object Mode'].keymap_items['view3d.view_qcd_slot'] doesn't work. Maybe it has something to do with keyconfigs.default?

$\endgroup$

1 Answer 1

4
$\begingroup$

The keymap item view3d.view_qcd_slot for the Collection Manager add-on can be access through:

km = wm.keyconfigs.addon.keymaps["Object Mode"]
kmi = km.keymap_items["view3d.discard_qcd_history"]

Blender's Python API separates the access to the key configurations of add-ons from the default one. Hence wm.keyconfigs.addon has to be used.

$\endgroup$
3
  • $\begingroup$ Oh wow! I guess I confused it with the native system that hides (eye icon) collections with 1,2,3,4... keys, which Collection Manager does as well but with enabling/disabling checkboxes. But you're right! Now I see I can actually just disable the QCD hotkeys altogether in the addon's settings. Still, thank you very much! $\endgroup$
    – AlexM
    May 14 at 9:52
  • $\begingroup$ The API page confuses me. Should this entry also be available through the wm.keyconfigs.user? $\endgroup$ May 14 at 14:59
  • 1
    $\begingroup$ @MartyFouts Yes, it is also available through wm.keyconfigs.user. I do not know the reason for this design decision either and would have to look it up. $\endgroup$
    – Robert Gützkow
    May 14 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.