Post #5322: I tried the Node Connect example. It’s a very practical use case and quite insig
📋 Metadata
- Author: Pluglug
- Date: 2024-12-04 17:54:19
- Type:
discussion - Quality Score: 8/10
- Reply to: post_05316
- Replies (2): post_05324, post_05325
🏷️ Tags
hotkeys configuration advanced pie-menu
⚙️ Related PME Features
- Pie Menu Editor
- Keymap registration
- Operator configuration
- Custom hotkeys
💬 Content
I tried the Node Connect example. It’s a very practical use case and quite insightful.
I haven’t fully explored the other examples yet, so my understanding isn’t complete, but let’s dive into hacking the Keymap registration process.
That said, I haven’t tested for potential side effects, so I’ll refrain from providing this as a formal patch.
However, this is a great opportunity to take a closer look at PME’s source code. I believe you’re already on “this side,” so let me offer some unsolicited guidance. It might seem a bit tricky, but stick with me!

Background: PME’s Core
PME registers items in the Keymap through an operator called wm.pme_user_pie_menu_call. This operator is designed to be triggered by default using a Press event (the only exception is double-click).
Options like Hold and Click Drag (Tweak) are actually handled internally within the operator.
Note : PME’s Click Drag is different from Blender’s native implementation. In earlier statements and code by roaoao, this feature was referred to as Tweak.
Although this operator itself isn’t directly related to our changes, it’s a fundamental part of PME.
You can find the relevant code here:
operators.py line 1347: WM_OT_pme_user_pie_menu_call
Tracing the Code
There are various ways to edit code, but for this guide, I’ll use VSCode as an example. The same steps can be adapted for other editors as well.
Using VSCode
-
Open the project
Launch VSCode, go to File > Open Folder, and select thepie_menu_editorfolder. -
Search the code
- Use
Ctrl + Fto search within the currently open file. - Use
Ctrl + Shift + Fto search across the entire project. Try searching forPMItemoropen_mode.
- Use
For other editors
Most modern editors support similar functionality for opening folders and searching entire projects. Check your editor’s documentation or shortcuts to achieve the same results.
1. Locating Hotkey Registration
The first step is to find where PME registers its hotkeys. Each menu item in PME (represented as a PMItem) is registered in Blender’s Keymap through the following methods:
types.pyline 715:PMItem.register_hotkeytypes.pyline 32#:PMItem.update_keymap_item
Here’s a snippet of the code. You’ll notice that hotkeys like PRESS and DOUBLE_CLICK are registered based on the self.open_mode property.
class PMItem(bpy.types.PropertyGroup):
# ...
def register_hotkey(self, km_names=None):
# ...
kmi.value = \
'DOUBLE_CLICK' if self.open_mode == 'DOUBLE_CLICK' \
else 'PRESS'
2. Understanding theopen_mode Property
Next, we need to find where the open_mode property is defined. You can locate it within the same file under the PMItem class:
types.pyline 387:PMItem.open_mode
This property is defined as an EnumProperty and determines how the menu item’s hotkey functions.
Here’s the relevant code:
class PMItem(bpy.types.PropertyGroup):
# ...
open_mode: bpy.props.EnumProperty(
name="Hotkey Mode",
items=CC.OPEN_MODE_ITEMS,
update=update_open_mode)
The key point here is the OPEN_MODE_ITEMS list, which defines the selectable options for this EnumProperty.
3. FindingOPEN_MODE_ITEMS
Now, let’s locate the OPEN_MODE_ITEMS list. This can be found in:
constants.pyline 209:OPEN_MODE_ITEMS
This list defines existing modes like PRESS, HOLD, and DOUBLE_CLICK. Here’s a snippet:
OPEN_MODE_ITEMS = (
('PRESS', "Press", "Press the key", ph.get_icon("pPress"), 0),
('HOLD', "Hold", "Hold down the key", ph.get_icon("pHold"), 1),
('DOUBLE_CLICK', "Double Click", "Double click the key",
ph.get_icon("pDouble"), 2),
# ...
)
Adding New Modes
With this understanding, we can add new modes (CLICK and CLICK_DRAG) to open_mode.
Step 1: Edit the Definition
Edit the OPEN_MODE_ITEMS list in constants.py as follows:
OPEN_MODE_ITEMS = (
('PRESS', "Press", "Press the key", ph.get_icon("pPress"), 0),
('HOLD', "Hold", "Hold down the key", ph.get_icon("pHold"), 1),
('DOUBLE_CLICK', "Double Click", "Double click the key",
ph.get_icon("pDouble"), 2),
('TWEAK', "Click Drag", "Hold down the key and move the mouse",
ph.get_icon("pTweak"), 3),
('CHORDS', "Key Chords", "Click sequence of 2 keys",
ph.get_icon("pChord"), 4),
('CLICK', "Click (TEST)", "Click the key",
ph.get_icon("pPress"), 5), # Add item
('CLICK_DRAG', "Click Drag (TEST)", "Click and drag the key",
ph.get_icon("pTweak"), 6), # Add item
)
(Fixed missing)
Step 2: Modify the Registration Methods
Update the register_hotkey and update_keymap_item methods in types.py as shown below:
class PMItem(bpy.types.PropertyGroup):
# ...
def register_hotkey(self, km_names=None):
# ...
if pr.kh.available():
# ...
for key in keys:
for km_name in km_names:
# ...
# kmi.value = \
# 'DOUBLE_CLICK' if self.open_mode == 'DOUBLE_CLICK' \
# else 'PRESS' # Comment out for testing
kmi.value = {
"DOUBLE_CLICK": "DOUBLE_CLICK",
"CLICK": "CLICK",
"CLICK_DRAG": "CLICK_DRAG"
}.get(self.open_mode, "PRESS") # Change
# ...
def update_keymap_item(self, context):
# ...
if kmis:
for k, kmi in kmis.items():
# ...
kmi.key_modifier = self.key_mod
# kmi.value = \
# 'DOUBLE_CLICK' if self.open_mode == 'DOUBLE_CLICK' \
# else 'PRESS' # Comment out for testing
kmi.value = {
"DOUBLE_CLICK": "DOUBLE_CLICK",
"CLICK": "CLICK",
"CLICK_DRAG": "CLICK_DRAG"
}.get(self.open_mode, "PRESS") # Change
Testing
- Launch Blender and check if the new modes (
CLICK,CLICK_DRAG) appear in the list. - Assign these modes to a Keymap and verify their functionality.
- Restart Blender to confirm that the settings persist.
Remaining Issues…
Currently, Hotkeys using the new modes might not display correctly in PME’s settings UI.
This is likely because the Keymap display doesn’t fully recognize the new open_mode options. Search for open_mode in keymap_helper to find where adjustments might be needed.

Could this be your next challenge? 
This is an experimental fix, and while it may enhance PME’s flexibility, success and side effects remain uncertain. I’d love to hear how it works for you—let me know your results!
❤️ 6 likes