Page MenuHome

Preferences - Keymap - "Left/Right Mouse" EXTRA panel
Closed, ArchivedPublic

Description

System Information
Operating system: Win
Graphics card:

Blender Version
Broken: 2.80 2018-12-07

Worked: (optional)

Short description of error
Selecting custom keymap causes disappearance of "Left/Right Mouse..." EXTRA panel.
That can do serious repercussions for add-on based on operators that are placed in that panel.

Exact steps for others to reproduce the error
Preferences -> Input -> Add keykonfig preset ( make any name )
Then "Left/Right Mouse..." extra panel disappears.
Then for example PieMenuEditor add-on that based on operator from that panel causes error:
//Traceback (most recent call last):

File "C:\Users\Tomasz\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\pie_menu_editor\operators.py", line 1889, in invoke
  cpm_key = keymap_helper.to_system_mouse_key(cpm.key, context)
File "C:\Users\Tomasz\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\pie_menu_editor\keymap_helper.py", line 441, in to_system_mouse_key
  default = is_default_select_key()
File "C:\Users\Tomasz\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\pie_menu_editor\keymap_helper.py", line 424, in is_default_select_key
  ret = kc.preferences.select_mouse == 'RIGHT'

AttributeError: 'NoneType' object has no attribute 'select_mouse'

location: <unknown location>:-1

location: <unknown location>:-1//

Even if this is a add-on developer problem he could not have idea that this kind of error can occur.
I advice to leave that EXTRA panel no matter what keymap preset is selected and make it work over the keymap configuration.
I can cause some kind on incoherency when user will edit the keymap that is related to operators form that EXTRA panel.
But for end user is more comfortable to have it all the time.

To fix that coherency you could just disable (inactive) operator buttons that are related to the specific shortcut key but it is not consistent with keymap setup.
For example if user will make custom keymap preset and set P key for Play animation and T for Tools and S for Search then the SPACE button will be "free" and not consistent with any operators form Spacebar Action.
Then all that operators should stay inactive/unselected until user select any of these buttons to override specific keymap config function (Play, Search or Tools) and attach spacebar key to one of these.

Default Keymap preset:

Custom Keymap preset:

Details

Type
Bug

Event Timeline

Brecht Van Lommel (brecht) closed this task as Archived.
Brecht Van Lommel (brecht) claimed this task.

Indeed the API changed here, and add-ons need to be updated. For the addons that we ship the code was changed to this. For external ones like the pie menu editor it's up to the author.

getattr(kc.preferences, "select_mouse", "LEFT")

This preset panel is not supported for custom keymaps, that was an intentional choice since we can't reliably do such global changes to custom keymaps.

lucas veber (lucky3) reopened this task as Open.

Sorry if I'm missing something, but there's still an issue apparently...
Tested with the latest build, after reloading factory settings and deleting any existing custom keymaps.
Please try the following:

  • Open the text editor and paste this code:
import bpy
wm = bpy.context.window_manager
keyconfig = wm.keyconfigs.active
select = getattr(keyconfig.preferences, "select_mouse", "LEFT")
print(select)
  • In the User Preferences, assign the default "Blender" keymap, execute the script, and then assign the "Blender 27X" keymap, execute the script.

It should have printed in the console, as expected, "LEFT" then "RIGHT" respectively. So far, so good.

  • Create a new keymap
  • Execute the script: "LEFT" is printed, whereas selection is actually using the right click.

For custom keymaps you can't know if selection is done using left or right, the code just makes it default to left in that case.

Trying to figure it out automatically in a better way would be nice, but that's not supported at the moment.

Then it's a serious issue... If the user has a custom keymap active, how an addon can know if the user has set left or right click for selection?
There's a bunch of existing addons based on selection, it would break them all.

lucas veber (lucky3) added a comment.EditedFeb 25 2019, 3:47 PM

(it used to work perfectly in 2.79, so this is clearly a regression...)
Custom keymaps are often used when importing/exporting key maps, it happens all the time when switching computers. Not being able to choose the mouse selection button when using custom keymap is a serious design flaw.
If it's not fixed, bug reports will pile up...

HI guys, is there a chance to get this working? Without this functionality many hands are tied. Or at least propose a workaround that works. Thanks.

Best Regards!
Albert