Pie menu disable on release key patch


#1

I’m trying to do this myself but I can’t capture the keyboard release event. Any ideas?

source/blender/editors/interface/interface_region_menu_pie.c

if (event->val == KM_RELEASE){
    printf(" key released");
    return OPERATOR_CANCELLED;
}
else{
     printf(" key");
}

#2

Personally I don’t think this would be a good change. For accessibility reasons it is best to rely on keys being kept pressed as little as possible. Not everyone can do that.

If you want to implement this, then you need to store the key that launch the pie menu when it is created in UI_pie_menu_begin, then handle a matching key release event in ui_pie_handler.


#3

Thank you so much @brecht, I’ll prove it.


#4

This approach makes it so pie menus are always dismissed when releasing the key.

However, we still want to support just tapping a key to open pie menus.

The thing that we should fix, is that when holding a key to open pie menus, then releasing the key should, indeed dismiss it.


#5

I’ve already done it, finally I just had to modify only a one file.

In this file: blender/source/blender/editors/interface/interface_handlers.c
after the line 9368 ( right after this line that goes like this: if (event->type == block->pie_data.event && !is_click_style) { )

we add these lines of code:

switch (event->val) {
    case KM_RELEASE:  
        menu->menuretval = UI_RETURN_CANCEL;
        break;
}

I think there should be an option in the preferences with a checkbox that allows you to enable these 4 lines of code. I’m not going to go into which is the best way to implement it, but I think it would be good to comment this on the meeting on Wednesday because those 4 lines of code, are the limit that make the difference for users like me in that we want to use the pie menu, or dissable it in all parts of blender for that we are very annoyed by this behavior by default.

Thank you for everything guys!.


#6

If it works well, and can reliably distinguish between a tap and a hold, it doesn’t need to be an option - it should just work this way.


#7

For the behavior that I am wanting to have is not necessary distinguish between a tap and a hold…


#8

In that case I think this is the wrong approach.

Currently, pie menus work so that you can just tap a key which opens a pie menu. You can then click to enable an option.

You can also, for faster access, hold a key, move your mouse cursor, and release.

Both work currently, and should continue to work. This is very important. Otherwise, pie menus are too difficult to use.

The only problem is, there’s a glitch which makes it so the hold-release feature isn’t properly engaged when not moving the cursor at all.


#9

The cases you’re talking about here still work with my code perfectly. Except clicking because it loses its meaning.


#10

Ok then - if it’s able to fix the inconsistent glitch we had for release event, then I think that sounds good.


#11

The easiest thing is to copy the code fragment and try it yourself, so you can tell me what you think.


#12

Ok, I’ve tested it now.

We cannot accept this. This change makes it so pie menus are instantly dismissed, even if you just tap to open a pie menu. This is no good. It must be possible to tap to open a pie menu normally, without having to hold a key.


#13

Not even optionally?. Well then someone tell me how I can deactivate all the pie menus easily without having to go changing one by one all the hotkeys thank you.


#14

my 2 cent
could not be written so that if you keep pressed for a minimum of thousandths of seconds activate the “tap pressed = disable on release” otherwise “on tap just open the pie menu without closing release”?


#15

It already works like this, essentially. There’s just a glitch that makes it so it doesn’t work if you don’t move the cursor, that’s all.


#16

I tried to investigate in all ways on windows 10 how to disable this damn function but I could not disable it


#17

There’s no need for this option at all. You can already hold -> release to select items in the pie menus. You can also tap and then click. Both methods work, and should continue to work.

If the glitch is fixed so that you can release after holding, even if the cursor doesn’t move, then we are all set.


#18

The main problem is when you press a shortcut by mistake such as ctrl + tab and did not expect to see a pie menu on your screen and by mistake you are forced to make an extra click or give esc to remove the pie menu.


#19

So there’s no way to deactivate all the pie menus easily?


#20

You can use the old shortcuts and behaviour by picking the 2.7x keymap. But, we will make sure to only add pie menus where it makes sense.

Pie menus are faster than regular menus, and allow us to make better use of the keyboard layout.

Pie menus can be improved by making some small changes. Details here: https://developer.blender.org/T56949