How is the keymap management done under the hood?

Hey Friends,

As a matter of fact the keymap management has become more or less useless for users. There are dozens of long year open bugs around. Like existing hotkeys not showing at the menu items. You might be able to change a hotkey, or not. A new created hotkey might end in the correct category after adding it, or not. Most of the times it ends in the Window category then, conflicting with other hotkeys. You might be able to remove a hotkey, but not longer be able to readd it. The new added hotkeys from the last two weeks are all like this. Remove them. Then try to readd them. They either end in the Window category again, or you can’t even add them back. Now deal with a custom keymap, and try to add the new Blender hotkeys for the new tools …

The hotkeys for the tool shelf tools is a completely different beast anyways that can just be maintained by programmers. Once they are gone from the keymap manager there is no user way to add them back. And to create a working custom keymap with these tool shelf tools is nearly mission impossible even for a programmer.

And so on. The list of problems with the current implementation is endless. Every little change at the front end can break the keymap nowadays. And the only fix goes across the python code then. A normal user is lost with that. So my advice ends always in “don’t” when somebody asks me how to modify the keymap nowadays. Which is a sad answer for both of us.

Note that it is not about a single bug or being unhappy about the development speed or the effort. I appreciate the work and know too well how much effort goes into such a feature. It’s about the masses. And the state of unfixed for years. Just do a search in the bug tracker for open keymap related bugs.

This long list shows that it is about the whole concept that makes it even for Blender developers hard up to impossible to fix the bugs related to the keymap management. And writing bug reports obviously does not longer help when even Blender developers are lost with fixing them then.

My question is what could be done here, how could a solution look like. Are there plans to overcome the known bugs and get the keymap manager back to functional for users? And are you, as the Blender developers, even aware in what broken state the keymap management currently really is?

Is there some information about the current implementation available? A hint where to start with a rewrite? The idea of a concept? Is it even possible to work around the current system? Or would we end in a rewrite of Blender?

I know that the matter is super complicated. But i simply search for a way to help out here, in case i can. I find it sad to see the keymap manager falling more and more apart over the years. And with every change and additional hokey it falls a bit more apart and is getting a bit more useless for the users.

Kind regards

1 Like

How is the keymap management done under the hood?

Poorly :slight_smile:

As someone who uses and maintains a completely custom keymap, it has reached a level where I just edit the keymap .py file in an external code editor to avoid keymap corruption.

1 Like

Yes, custom keymaps is one of the many dilemmas. As told, the list of problems of the current implementation is very long.

I search for a possible solution :slight_smile:

I use custom key maps too, and unfortunately because of that I was still using the old Knife tool.
The new Knife tool had new and additional keymaps for snapping and global as well as local axis orientation etc.
Unfortunately, these new settings did not show up in my custom keymap as it was made prior update.
Logically, if there’s a change or update in a tool behavior, it should be updated under the hood for all types of keymaps, be it custom too.

Uh, thanks for telling. I miss the knife with shift for only selected -.-

When working a lot with keymaps, you will see that you change a key AND have to look for all the other things getting influenced, fix or delete doubles/tripples/quadripples,…
Also there are some addons, that revert back to their initial settings after some days of use. I often / regular have this with machin 3 tools, for example. I change only two keys in this addons keymap preferences and look for further complications in the keymap and eliminate them, if!. Then a few days later for some reason they changed back, while using the tools. Over and over again. Even after the update…
There are other addons doing it, too.

So it’s a buggy thing and you should keep not only a backup of the but also the pycache Folder inside the keyconfig Folder.
Exporting as file and importing is the worst thing you can do, as I found out many times.
Just copy and paste your keymap by hand into the right folder AND
DON’T Install an addon and then after you replace the keymap with a saved one (from before the addon install). That will produce the worst case…

So in other words, above are the instructions, if you are bored on a loooong sunday and have nothing else to do… :slight_smile:

I actually do export the keymap from within the keymap manager. But afterwards i compare it with the keymap python file before the changes. And just add the changes back that are actually the ones that i want to have. That way you also learn your trouble makers. This can be done with code merging tools like Meld for example. Or with Winmerge.

1 Like

Keymap system refactor

New Visual Keymap Editor

They are aware and there have been efforts with no concrete conclusion.

1 Like

Many thanks. This is the kind of information that i am looking for :slight_smile:

So from what i can see they are still stuck in the design and brainstorming what the goal really is. Hm. This can take several more years.

Is there any addon around that deals with the keymap? Maybe one of these could be expanded, and deal as a starting point.

maybe ask them directly, so you clearly know where they stuck and why.
saves a huge amount of time, instead of asking users, who have not a clear clue, like you.
then you have the picture of the progress and where and how to get the problem on.

as you have noticed here, everybody just has a half knowledge about keymaps and the development etc…

They should be able to give you a startup.
Just here you can ask a dev via mentioning his name like “@name” an he will come back to you or redirect you to the right dev. You can ask for example Pablo!

hope that helps.

1 Like

While keymap editor overhaul would certainly be useful, it’s not an easy task, given how rotten and extensive the keymap code it. What could go a long way, though, is just fixing at least the basic bugs like this one:

Thanks. I’ll have a look into it. I just thought this is already the place to ask such questions.

One of my most basic question is if it even makes sense to start as a lone wolf here. Or if this isn’t better done by the core team. I don’t have the man power to rewrite Blender from scratch …

Yeah, we have a ton of these. When you use custom keymaps for example, then it doesn’t partially display tooltips in the tool shelf anymore. I still wonder how these tooltips are tied to the keymap at all.The whole system has a problem. This is why i think it is better to start from scratch.

It is the right place to ask here, but whom is the question.
There are others out there, as far as I know, but you’ll have to find them and
work with them and the devs together…

And the mayor thing is to make a plan beforehand. You can’t just fix a thing here and there,
otherwise it would have been done already.
Where is the problem, what has to be fixed in what order etc…

Everybody who has knowledge about. I am happy about every hint :slight_smile:

It all starts with to know how the current implementation is done. And what is possible with this implementation. As told, i don’t have the man power to rewrite the Blender core. But when it’s all Python, then there would be a chance to write a keymap manager as an addon.

I am still at the point where i don’t understand this part. Reading and writing is done by C. Quite a few things are managed by some special classes in the . But where is the rest?

I am personally no friend of planning everything beforehand into detail. I love evolutionary prototyping, and to work along some basic ideas and guides. And then look while development where the pitfalls are.

One of these basic ideas and guides is to have a separate keymap for every editor type. And no global hotkeys anymore. That way you can already avoid a ton of conflicts. And the hotkeys will land in the correct category. Currently you need to use quite a few tricks to get this happen. And in some cases it already fails.


as said. The best is to ask the devs, and you’ll get a clue.
They also may redirect you to some more information as a dev for python.

And trust me, you’ll need a proper plan. The blender devs are not having meetings for no reason.

Anyways, just ask the devs for more. I for myself have nothing more than you, like most other users.

The one does not exclude the other. You also need a plan for the method of evolutionary prototyping. But here you can toy around with the possibilities already. And this saves you time in the long run. You can’t plan everything ahead. Usually 90% of the once planned features and ideas will not make it into the project anyways.

I develop since over 20 years with this method, and am pretty happy with it. But i understand of course that not everybody can work this way :slight_smile:

Yeah well, than have fun making your way on your own.
Nuff said!

No reason to become angry, my comment wasn’t meant bad in any way. It’s just another way of working. Which i thought could be of interest for other develpers too. I have for example the feeling that the asset browser devleopment could have benefit from it a lot.

Anyways. I understand of course that not everybody can work this way. And thanks for your advice :slight_smile: