Keymap priorities are different #91794

Closed
opened 2021-09-28 22:51:29 +02:00 by Ovionis · 8 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1650 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 472.12

Blender Version
Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-09-27 18:29, hash: c53ffda8a4
Worked: 3.0.0 Alpha, branch: master, commit date: 2021-08-23 15:09, hash: 7d17f2addf

Short description of error
1 ) Keymaps in the same area (3D View), don't prioritize their order above their activation. Specifically, I have a command as {key shift}+{key tab}.
From top down, #1 is view3d.localview_clickdrag (Local View), as [Click Drag],

  • 2 is view3d.localview (Local View), as [Click],
  • 3 is wm.context_toggle (Context Toggle), as [Press].

Before #3 would not run because #2 would run unless I move the mouse in which case #1 would run (as intended), now #3 will always run no matter what unless I disable it.

2 ) Keymaps from Screen, no longer override keymaps for example from 3D View.
In Screen I have {key shift}+{key Z} for screen.repeat_last (Repeat Last), as Press.
In 3D View I have {key shift}+{key Z} for view3d.toggle_shading (Toggle Shading Type), as Press.

Before, Repeat would work, now it only works if I move the mouse outside of the 3D View's area (because no other area has the same key in use)

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1650 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 472.12 **Blender Version** Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-09-27 18:29, hash: `c53ffda8a4` Worked: 3.0.0 Alpha, branch: master, commit date: 2021-08-23 15:09, hash: `7d17f2addf` **Short description of error** 1 ) Keymaps in the same area (3D View), don't prioritize their order above their activation. Specifically, I have a command as {key shift}+{key tab}. From top down, #1 is `view3d.localview_clickdrag` (Local View), as [Click Drag], - 2 is `view3d.localview` (Local View), as [Click], - 3 is `wm.context_toggle` (Context Toggle), as [Press]. Before #3 would not run because #2 would run unless I move the mouse in which case #1 would run (as intended), now #3 will always run no matter what unless I disable it. 2 ) Keymaps from Screen, no longer override keymaps for example from 3D View. In Screen I have {key shift}+{key Z} for `screen.repeat_last` (Repeat Last), as Press. In 3D View I have {key shift}+{key Z} for `view3d.toggle_shading` (Toggle Shading Type), as Press. Before, Repeat would work, now it only works if I move the mouse outside of the 3D View's area (because no other area has the same key in use)
Author

Added subscriber: @Phigon

Added subscriber: @Phigon
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

In Screen I have {key Shift Z} for screen.repeat_last (Repeat Last), as Press.

Hi, thanks for the report. I think you have customized the Keymap.

Not sure I understand the first part of the report but in 2nd part you have assigned same keys for two different operations, which conflicts with Blender’s default keymap.

Worked: 3.0.0 Alpha, branch: master, commit date: 2021-08-23

Could you please clarify the exact issue? Tested on master & 962153dbed , both gave me the same output.

> In Screen I have {key Shift Z} for screen.repeat_last (Repeat Last), as Press. Hi, thanks for the report. I think you have customized the Keymap. Not sure I understand the first part of the report but in 2nd part you have assigned same keys for two different operations, which conflicts with Blender’s default keymap. > Worked: 3.0.0 Alpha, branch: master, commit date: 2021-08-23 Could you please clarify the exact issue? Tested on master & 962153dbed , both gave me the same output.
Author

Yes I'm using custom keys. I use an addon to add keys above Blender's keys.

1

Go to the preferences under 3D View or whatever, and add 2 keys with something unused (like {key u}). Set the first to be Click Drag, and the second to be Click.
Maybe transform.translate and object.select_all.
When you press the button without moving the mouse, the second op will run, and if you drag the mouse first the first will run. You can switch them around if you want.
Next change the / add a key below to be Press. The above key(s) will now never run again, unless the bottom op's poll fails.

2

Go to the preferences, under 3D View, add a key and op {key u} (or pick the key of an existing op).
Under Screen or Window add something, like ed.undo_history (which can be used in and out of the 3D View).
Only the 3D View's op will run in the 3D View.

Yes I'm using custom keys. I use an addon to add keys above Blender's keys. # 1 Go to the preferences under 3D View or whatever, and add 2 keys with something unused (like {key u}). Set the first to be Click Drag, and the second to be Click. Maybe `transform.translate` and `object.select_all`. When you press the button without moving the mouse, the second op will run, and if you drag the mouse first the first will run. You can switch them around if you want. Next change the / add a key below to be Press. The above key(s) will now never run again, unless the bottom op's poll fails. # 2 Go to the preferences, under 3D View, add a key and op {key u} (or pick the key of an existing op). Under Screen or Window add something, like `ed.undo_history` (which can be used in and out of the 3D View). Only the 3D View's op will run in the 3D View.

Added subscribers: @lichtwerk, @ideasman42, @iss

Added subscribers: @lichtwerk, @ideasman42, @iss

Here all builds give consistent results: First time keymap for 3D view is used, then keymap for Window is used.

I don't think there is any system in place to resolve keymap conflicts between various areas apart from operator poll functions. Usually this is hardcoded in operators to pass through events if some conditions are not met. Not sure if keymaps are read in order, but I don't think this would be meant to be deterministic.

Not 100% sure on this though, but I don't see code to dispatch duplicate keymaps. @lichtwerk, @ideasman42 Am I correct here?

Here all builds give consistent results: First time keymap for 3D view is used, then keymap for Window is used. I don't think there is any system in place to resolve keymap conflicts between various areas apart from operator poll functions. Usually this is hardcoded in operators to pass through events if some conditions are not met. Not sure if keymaps are read in order, but I don't think this would be meant to be deterministic. Not 100% sure on this though, but I don't see code to dispatch duplicate keymaps. @lichtwerk, @ideasman42 Am I correct here?
Author

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Ovionis self-assigned this 2021-09-30 19:08:55 +02:00
Author

Sorry, my fault.

I went to record both blender builds, side by side repeating my previous instructions, wherein this time it would not work.
Confused, as I could swear it worked last time, I did some tests and found the problem was my addon's keymapping.
One of the things I do with it is disable Blender keys (and I didn't realize I already specified key conflicts between Click/Drag and Press).

What went wrong was that my addon compared with "is" for bools instead of "==", and before the keymap bool shift/ctrl/alt were actual Booleans, and now return an int.
For example bpy.context.window_manager.keyconfigs.active.keymaps['3D View'].keymap_items['wm.context_toggle'].shift would return True, now it returns 1

My previous steps possibly worked because of a glitch or I'm just misremembering but either way, I can't repeat the process on video and have got my keys working, so the problem is solved.

Sorry, my fault. I went to record both blender builds, side by side repeating my previous instructions, wherein this time it would not work. Confused, as I could swear it worked last time, I did some tests and found the problem was my addon's keymapping. One of the things I do with it is disable Blender keys (and I didn't realize I already specified key conflicts between Click/Drag and Press). What went wrong was that my addon compared with "is" for bools instead of "==", and before the keymap `bool` shift/ctrl/alt were actual Booleans, and now return an `int`. For example `bpy.context.window_manager.keyconfigs.active.keymaps['3D View'].keymap_items['wm.context_toggle'].shift` would return `True`, now it returns `1` My previous steps possibly worked because of a glitch or I'm just misremembering but either way, I can't repeat the process on video and have got my keys working, so the problem is solved.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 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: blender/blender#91794
No description provided.