Added hotkeys to switch mode disfunctional / lost hotkeys in keymap #65064

Closed
opened 2019-05-24 10:27:14 +02:00 by Reiner Prokein · 15 comments

Blender Version
Broken: version: 2.80 (sub 69), branch: master (modified), commit date: 2019-05-19 04:56, hash: f2eef45200
Worked: (optional)

Short description of error
When i add hotkeys to the modes, then this hotkeys does simply nothing. I can't jump to edit mode with added hotkey alt 2 for example.

The second thing could be related, which i can't really test since the hotkeys are disfunctional anyways.

But when i add a hotkey to switch to pose mode, with a armature selected, and switch to a primitive then, and export the keymap, then the hotkey to switch to pose mode is destroyed in the exported keymap. The mode is missing. Vice versa too. When i export the keymap with the armature selected, then the modes for the mesh primitives, to switch to sculpt mode for example, are gone.

What is obvious in the keymap manager is, when i change the object type, then the mode button for not fitting modes turns blank. That's the hotkeys that are missing then after exporting the keymap ...

Exact steps for others to reproduce the error

Open Blender. Add Hotkey Alt 2 for Edit Mode, Hotkey Alt 4 for Sculpt Mode with the cube selected. Then add Alt 3 for Pose Mode with a armature selected. Try to use the hotkeys.

Now export the keymap with the cube selected. And have a look at the code.

modebyhotkey.jpg

posemode.jpg

testkeymap.py

**Blender Version** Broken: version: 2.80 (sub 69), branch: master (modified), commit date: 2019-05-19 04:56, hash: `f2eef45200` Worked: (optional) **Short description of error** When i add hotkeys to the modes, then this hotkeys does simply nothing. I can't jump to edit mode with added hotkey alt 2 for example. The second thing could be related, which i can't really test since the hotkeys are disfunctional anyways. But when i add a hotkey to switch to pose mode, with a armature selected, and switch to a primitive then, and export the keymap, then the hotkey to switch to pose mode is destroyed in the exported keymap. The mode is missing. Vice versa too. When i export the keymap with the armature selected, then the modes for the mesh primitives, to switch to sculpt mode for example, are gone. What is obvious in the keymap manager is, when i change the object type, then the mode button for not fitting modes turns blank. That's the hotkeys that are missing then after exporting the keymap ... **Exact steps for others to reproduce the error** Open Blender. Add Hotkey Alt 2 for Edit Mode, Hotkey Alt 4 for Sculpt Mode with the cube selected. Then add Alt 3 for Pose Mode with a armature selected. Try to use the hotkeys. Now export the keymap with the cube selected. And have a look at the code. ![modebyhotkey.jpg](https://archive.blender.org/developer/F7064865/modebyhotkey.jpg) ![posemode.jpg](https://archive.blender.org/developer/F7064869/posemode.jpg) [testkeymap.py](https://archive.blender.org/developer/F7064871/testkeymap.py)
Author

Added subscriber: @tiles

Added subscriber: @tiles

Added subscriber: @ZedDB

Added subscriber: @ZedDB

At least for the first issue, the problem is that alt + 2 is already bound to something in the default keymap.

Just search for the alt + 2 in the keymap any the conflicting key maps will show.

Is the second issue still happening for you?

At least for the first issue, the problem is that alt + 2 is already bound to something in the default keymap. Just search for the `alt + 2` in the keymap any the conflicting key maps will show. Is the second issue still happening for you?
Author

Ah sorry for overlooking that i use a hotkey that is already in use. Yes, it still happens. It doesn't matter what hotkey i assign here. The problem isn't the double, it's that the hotkey gets lost when saving the keymap.

Ah sorry for overlooking that i use a hotkey that is already in use. Yes, it still happens. It doesn't matter what hotkey i assign here. The problem isn't the double, it's that the hotkey gets lost when saving the keymap.
Campbell Barton was assigned by Sebastian Parborg 2019-06-13 11:57:45 +02:00

I can confirm that the Mode for the pose keymap vanishes when selecting an object that doesn't have a pose mode.

I can confirm that the `Mode` for the pose keymap vanishes when selecting an object that doesn't have a pose mode.
Campbell Barton was unassigned by Brecht Van Lommel 2019-07-03 18:31:16 +02:00

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Added subscriber: @XSI-Guy

Added subscriber: @XSI-Guy

I am having the same issue even now with Blender 2.9 released version.

Has there been any progress on this issue ?

I am having the same issue even now with Blender 2.9 released version. Has there been any progress on this issue ?

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Hi @XSI-Guy this was triaged as a known issue, which is a way to document the current limitations of a module.

Anyone is welcome to help tackling it, but the UI module has no plans of working on it in the foreseeable future.

Hi @XSI-Guy this was triaged as a known issue, which is a way to document the current limitations of a module. Anyone is welcome to help tackling it, but the UI module has no plans of working on it in the foreseeable future.

Added subscriber: @alok1974

Added subscriber: @alok1974

I am trying to take a stab at this. Please note that the solutions that I propose down here might not be the best as I have started on Blender and its source code just a week ago!

Problem
While exporting, the keymap datais read from theuserpref` UI, which in turn is dynamically updated depending on the context of the selected object's mode . Object modes are culled for a context and thus modes available in one object context (like 'POSE' in armature) might not be available on another object context (mesh cube). This leads to blank UI and consequently <''> in the exported key config.

First Solution

  • Disable the mode field in the layout temporarily while exporting the keymaps. This can be done by calling draw_keymaps() in rna_keymap_ui.py with a modification to not draw box.template_keymap_item_properties(kmi). This keymap exports will be read from the internal memory correctly. mode.png

Pros

  • Cleaner solution in respect to other ones mentioned below

Cons

  • Hard to implement as calling the keymap UI redraw would need some serious effort (at least for me)

Second Solution (Tested and I have the code almost ready)

  • While reading the keymap from the UI, if the mode is not available, it's value is always returned as '', catch that and try to change the object context by creating alternative object types. I have figured out that all of the 13 available object modes can be covered with just 4 object types - Mesh, Armature, Grease Pencil and Particle Systems. The keymap mode must definitely belong to one of those. Changing to each one of them and then trying to get the mode will result in a non-empty value (or a str != "" in this case).

Pros

  • Works! (already tested and have an implementation ready)

Cons

  • Seems a bit hacky

I am looking to fix this, let me know if and how can I proceed @dfelinto, @ideasman42

Cheers!

I am trying to take a stab at this. Please note that the solutions that I propose down here might not be the best as I have started on Blender and its source code just a week ago! **Problem** While exporting, the `keymap` data` is read from the `userpref` UI, which in turn is dynamically updated depending on the context of the selected [object's mode ](https://github.com/blender/blender/blob/2b9e6943cdf5a892b874ce03ec0dea9d7b5399ff/source/blender/makesdna/DNA_object_enums.h#L30). Object modes are culled for a context and thus modes available in one object context (like 'POSE' in armature) might not be available on another object context (mesh cube). This leads to blank UI and consequently <''> in the exported key config. **First Solution** - Disable the mode field in the layout temporarily while exporting the keymaps. This can be done by calling `draw_keymaps()` in `rna_keymap_ui.py` with a modification to not draw [box.template_keymap_item_properties(kmi)](https://github.com/blender/blender/blob/2b9e6943cdf5a892b874ce03ec0dea9d7b5399ff/release/scripts/modules/rna_keymap_ui.py#L209). This keymap exports will be read from the internal memory correctly. ![mode.png](https://archive.blender.org/developer/F9930934/mode.png) Pros - Cleaner solution in respect to other ones mentioned below Cons - Hard to implement as calling the keymap UI redraw would need some serious effort (at least for me) **Second Solution (Tested and I have the code almost ready)** - While reading the keymap from the UI, if the mode is not available, it's value is always returned as '', catch that and try to change the object context by creating alternative object types. I have figured out that all of the 13 available object modes can be covered with just 4 object types - Mesh, Armature, Grease Pencil and Particle Systems. The keymap mode must definitely belong to one of those. Changing to each one of them and then trying to get the mode will result in a non-empty value (or a `str != ""` in this case). Pros - Works! (already tested and have an implementation ready) Cons - Seems a bit hacky I am looking to fix this, let me know if and how can I proceed @dfelinto, @ideasman42 Cheers!
Campbell Barton self-assigned this 2021-04-14 16:50:33 +02:00

This issue was referenced by 919558854d

This issue was referenced by 919558854d624f5db40acfa9f5674ac8c94873b6

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'

Thanks @ideasman42 !

I will learn a lot from the changes you made.

Thanks @ideasman42 ! I will learn a lot from the changes you made.
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
8 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#65064
No description provided.