Customizable keyboard shortcuts for modal tools #8

Closed
opened 2024-10-06 06:37:28 +02:00 by Spencer Magnusson · 1 comment

Pasted from GitHub:

Due to a reverted commit in Blender's code, add-ons cannot define their own keymaps for modal operators (granted, it seems like it didn't fully work beforehand anyway). For Light Painter, the controls are all in keymap.py for those who need to edit them (and feel free to create PRs if you feel it would benefit others!). But to be more accessible for users, options are limited:

  • manually make properties for each possible tool command, including the key itself and whether each modifier key needs to be held down to use it (ie Alt, Shift, and Ctrl keys). The upside is that this is direct, and all possible key options can be generated from bpy.types.Event.bl_rna.properties["type"].enum_items. The downside is this won't be accessible in the keymap preferences, but in the Light Painter add-on preferences.
  • make "dummy" operator keymaps that don't actually work, but just used to match input to Light Painter. While it's located in keymaps, it's still not ideal.

It might be worth checking with Blender team to see if this feature is planned or someone is already working on it. If so, then it's a matter of setting up the modal keymap once the feature is merged.

Since it could not be found in Blender's issues or tasks, I made a post on RightClickSelect: blender.community/c/rightclickselect/koWX/. If you would like this feature built into Blender (along with supporting other add-on developers who use modals), please vote here.

Pasted from GitHub: Due to a [reverted commit](https://projects.blender.org/blender/blender/commit/e8dd96516c60c4c43c8eb217f2c2cc61761cd0a0) in Blender's code, add-ons cannot define their own keymaps for modal operators (granted, it seems like it didn't fully work beforehand anyway). For Light Painter, the controls are all in [keymap.py](https://github.com/semagnum/light-painter/blob/main/keymap.py) for those who need to edit them (and feel free to create PRs if you feel it would benefit others!). But to be more accessible for users, options are limited: - manually make properties for each possible tool command, including the key itself and whether each modifier key needs to be held down to use it (ie `Alt`, `Shift`, and `Ctrl` keys). The upside is that this is direct, and all possible key options can be generated from `bpy.types.Event.bl_rna.properties["type"].enum_items`. The downside is this won't be accessible in the keymap preferences, but in the Light Painter add-on preferences. - make "dummy" operator keymaps that don't actually work, but just used to match input to Light Painter. While it's located in keymaps, it's still not ideal. It might be worth checking with Blender team to see if this feature is planned or someone is already working on it. If so, then it's a matter of setting up the modal keymap once the feature is merged. Since it could not be found in Blender's issues or tasks, I made a post on RightClickSelect: [blender.community/c/rightclickselect/koWX/](https://blender.community/c/rightclickselect/koWX/?sorting=hot). If you would like this feature built into Blender (along with supporting other add-on developers who use modals), please vote here.
Spencer Magnusson added the
enhancement
documentation
labels 2024-10-06 06:37:28 +02:00
Author
Owner

Made some "dummy" keymaps that at least allow users to modify them with a reasonable interface. The post I linked is still relevant; my add-on isn't the only one that would benefit from modal-specific keymaps.

Made some "dummy" keymaps that at least allow users to modify them with a reasonable interface. The post I linked is still relevant; my add-on isn't the only one that would benefit from modal-specific keymaps.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: SMagnusson/light-painter#8
No description provided.