Page MenuHome

Industry Compatible Keymap
ClosedPublic

Authored by William Reynish (billreynish) on Mar 31 2019, 12:03 PM.

Details

Summary

This is an initial implementation of T54963.

Purpose

This is an official keymap intended for users who use Blender in heterogeneous workflows, be it together with Unity, Unreal, Substance, Maya, Modo or other DCC apps.

It is not meant to mimic [insert favourite app] completely, but should feel a lot more familiar if you have used other 3D DCC apps.

The keymap is much more 'light' compared to the built-in keymap. Many fewer commands have keys assigned to them. It expects users to make use of the active tools, and also to use the right-click context menu to find and use relevant commands.

Brief Overview

NavigationAlt + LMB, MMB, RMB
Transform ToolsW, E, R, T
Box SelectQ
Play/PauseSpace
Insert LocRotScale KeyS
Insert Location KeyShift-W
Insert Rotation KeyShift-E
Insert Scale KeyShift-R
Mode/Element switching1-9 number row
SearchTab
Quick FavouritesShift-Tab
Frame SelectedF
Frame AllA
Select AllCtrl/⌘-A
Deselect AllCtrl/⌘-Shift-A
Select InverseCtrl/⌘-I
Select MoreArrow Up
Select LessArrow Down
DuplicateCtrl/⌘-D
RenameReturn
RenderCtrl/⌘-Return

Special Features

It also has a few 'innovations' inside it:

Left click support for dragging the Timeline.

We do this by being able to drag the timeline inside the marker area at the bottom of the animation editors.
Dragging elsewhere selects and moves keyframes

Mode/Element switching combined

We use the number keys to switch both the mode and element.
So, 1: Object, 2: Vertex, 3: Edge, 4:Face, 5: Sculpt and so on. This allows users to switch context quickly and easily just using the number row.

macOS ⌘-key (Command) support

The macOS ⌘-key (Command) is fully supported. Anything where you would use Ctrl on Windows or Linux, you do by using ⌘ on the Mac. This is handled automatically by the keymap.

Feedback

I want to get this included, so that we/I can start to gather feedback from users before we ship 2.8

Implementation

In order to do some of the things required by the keymap, I had to add a few operators inside it, to do things like switch mode and selection element at the same time, or to insert Loc/Rot/Scale keyframes bypassing the Insert Keyframe menu.

Diff Detail

Repository
rB Blender
Branch
arcpatch-D4626 (branched from master)
Build Status
Buildable 3273
Build 3273: arc lint + arc unit

Event Timeline

William Reynish (billreynish) edited the summary of this revision. (Show Details)

My only concern with the marker-area approach for the time scrubbing thing is that it'll get a bit yucky when there are markers present (i.e. all the selection ambiguity problems). That said, Da Vinci Resolve does something similar (except AFAIK it doesn't have the markers to cause conflicts). It's also still more flexible this way than restricting to only click-dragging the line itself.

release/scripts/presets/keyconfig/keymap_data/Industry_compatible.py
120 ↗(On Diff #14504)

Just calling bpy.ops.anim.keyframe_insert() directly should do the same thing actually

Use Ctrl/Cmd-D for Duplicate
Use Ctrl-click as an alternative way to get context menus

@Joshua Leung (aligorith):

Thanks, but as far as I can see, bpy.ops.anim.keyframe_insert() only works if you have keying sets enabled?

I also tried simply assigning keys normally to the items inside the keyframe menu, but that doesn't work. So that's why I went with this somewhat odd workaround.

If you can show me a better/simpler/more straight forward way to make it insert keys directly, I'm happy to use it instead.

@Joshua Leung (aligorith):

re. the marker area, we could make it a lot more obvious by doing the following change to move it to the top and also to make it more obvious:

If this is done, I think we should use the same approach in the built-in default keymap too.

It would be simply fantastic if you could help out with the above change. I think you are the one who knows the code for the animation editors the best. :)

  • Step 1: Move marker area to the top
  • Step 2: Make it always visible and more visually prominent
  • Step 3: Move the frame numbers from the scrollbar to this area
  • Step 4: Make the scrollbar thinner to match other areas

@William Reynish (billreynish) IIRC, you can use the type argument to it too.

For example, the following works on the default cube:

bpy.ops.anim.keyframe_insert(type="Location")
...
bpy.ops.anim.keyframe_insert(type="Rotation")

@Joshua Leung (aligorith) When I use that operator inside the keymap, it fails and complains that there is no keying set. Maybe it's to do with the keying sets being initialized after the keymap?

I'll keep the workaround until I can get the simpler solution working properly.

Use arrow up/down for select more/less. No modifier key is needed.

William Reynish (billreynish) edited the summary of this revision. (Show Details)

Fixed error in keyframing.

William Reynish (billreynish) edited the summary of this revision. (Show Details)

Based on user feedback:

  • Use Tab for Operator Search
  • Use Shift-Tab for for Quick Favourites
  • Make Deselect Shift-Ctrl-A / Shift-Cmd-A

Updated in-app keymap overview description to fit latest changes and include more items.

Campbell Barton (campbellbarton) requested changes to this revision.EditedApr 1 2019, 9:01 AM

Main concern is having to maintain a lot of duplicate keymap items, this could be handled automatically.

The following code makes all ctrl keys have an oskey version.

def keyconfig_data_oskey_from_ctrl(keyconfig_data_src):
    keyconfig_data_dst = []
    for km_name, km_parms, km_items_data_src in keyconfig_data_src:
        km_items_data_dst = km_items_data_src.copy()
        items_dst = []
        km_items_data_dst["items"] = items_dst
        for item_src in km_items_data_src["items"]:
            item_op, item_event, item_prop = item_src
            if "ctrl" in item_event:
                item_event = item_event.copy()
                item_event["oskey"] = item_event["ctrl"]
                del item_event["ctrl"]
                items_dst.append((item_op, item_event, item_prop))
            items_dst.append(item_src)
        keyconfig_data_dst.append((km_name, km_parms, km_items_data_dst))
    return keyconfig_data_dst

Then in the loading function, this can be written.

def load():
    from bl_keymap_utils.io import keyconfig_init_from_data

    prefs = bpy.context.preferences

    kc = bpy.context.window_manager.keyconfigs.new(idname)
    kc_prefs = kc.preferences
    params = industry_compatible.Params(use_mouse_emulate_3_button=prefs.inputs.use_mouse_emulate_3_button)
    keyconfig_data = industry_compatible.generate_keymaps(params)
    
    # *** Only Lines Changed ***
    from sys import platform
    if platform == 'darwin':
        keyconfig_data = keyconfig_data_oskey_from_ctrl(keyconfig_data)

    keyconfig_init_from_data(kc, keyconfig_data)

I don't think we should use the preferences as a way to show labels describing a keymap summary, although thats not such a big change. We could have a different way to do the same thing.

release/scripts/presets/keyconfig/keymap_data/Industry_compatible.py
53–57 ↗(On Diff #14511)

While this is fine, there are _many_ duplicate shortcuts - where both oskey and ctrl are used, this shouldn't be needed.

65–109 ↗(On Diff #14511)

This should be a single operator with VERT/EDGE/FACE option.

212–219 ↗(On Diff #14511)

Why both? ctrl and oskey?

The oskey part shouldn't be added on anything besides apple.

We could have a post process that duplicates all ctrl shortcuts and adds an oskey version of them - it's not much hassle - compared to maintaining duplicate keys all over.

704–705 ↗(On Diff #14511)

Why use ctrl and oskey at the same time?

1686 ↗(On Diff #14511)

This looks to be a duplicate of ("text.select_line", {"type": 'A', "value": 'PRESS', "shift": True, params.ctrl_or_cmd: True}, None), below.

This revision now requires changes to proceed.Apr 1 2019, 9:01 AM

@Campbell Barton (campbellbarton)
Thanks for review. I'll look at your points.

Currently, to support Cmd and Ctrl, I am using params.ctrl_or_cmd in places where it will use either. This is then set to "ctrl" or "oskey" via a check in the template at the top.

Your method seems a lot more complex - would you prefer I use your method instead?

This issue with params.ctrl_or_cmd is - as I understand it, not a general solution we can apply everywhere because there are times both are expected to be used.

If it was generic - we could go with that. Otherwise, having a single location that gives us both makes it a lot easier to maintain, even if later on we do something more sophisticated,
it allows everyone to work on the same keymap without duplicating anything - or having users of one platform breaking things for others.

When there is too much copy-pasted code it's hard to avoid things getting out of sync by accident - and it takes extra time even if we manage to do it.

for now I think an automatic duplication is a quick way to have the new keymap maintainable with minimal fuss.

Then we can simply state:

For this keymap Ctrl and Cmd are interchangeable

No need to document every detail about when it is/isn't shared.

Later on we could handle this on an event handling level for eg.

@Campbell Barton (campbellbarton) Ok I might try your method. One question: Will it make it so the Cmd-key is displayed in the menus? For that to work, I think the Cmd ("oskey") shortcut must be placed before the Ctrl equivalent.

Currently, as it works here, the Cmd-key is shown in all the menus if on a Mac. On Win/Linux it shows Ctrl instead.

There may be a few places, as you point out, where shortcuts are entered twice, both with "oskey"and "ctrl", but those are inherited from the default keymap. I pretty much mostly am using params.ctrl_or_cmd in order to make sure entries are not duplicated.

We completely agree it's best to not have entries be duplicated, which is exactly why I added the params.ctrl_or_cmd template, which is used throughout the keymap.

I can de-duplicate those remaining instances, and either make them use params.ctrl_or_cmd or go with your method, even though I'm still not exactly sure what the advantage or the more complicated solution is.

Is there a reason why params.ctrl_or_cmd is bad, and your solution is better? Doesn't your solution get the same result, but using more code that seems more complex? Or is there something I am missing?

I can de-duplicate those remaining instances, and either make them use params.ctrl_or_cmd or go with your method, even though I'm still not exactly sure what the advantage or the more complicated solution is.

Sounds good.

Is there a reason why params.ctrl_or_cmd is bad, and your solution is better? Doesn't your solution get the same result, but using more code that seems more complex? Or is there something I am missing?

No, if it's a general solution that can be used everywhere - it's fine. I assumed it wasn't used because both existed in many cases.

There is a small down-side that we can't copy-paste keymap items between this and the default (without find-replacing 'ctrl'), but I don't consider that a deal breaker.

I didn't look closely at the implementation, but I'm fine with this being committed early and improving it incrementally.

There is a small down-side that we can't copy-paste keymap items between this and the default (without find-replacing 'ctrl'), but I don't consider that a deal breaker.

We can add params.ctrl_or_cmd to the default keymap and always set it to ctrl perhaps. Also makes diffing the two files less noisy.

I could also just adopt Campbell's method if you guys think it's a better solution. I'm not wedded to using params.cmd_or_ctrl - it was just the best (only?) solution I knew how to do without adding hundreds of duplicated entries.

Would prefer to do this in one place compared to having params.ctrl_or_cmd everywhere. - it's verbose and we may remove if the event system can handle it (similar to middle mouse button emulation).

William Reynish (billreynish) marked 2 inline comments as done.

@Campbell Barton (campbellbarton) I tried to use your medthod for supporting Cmd or Ctrl automatically, but it didn't seem to work here. It could be my fault if I pasted it in the wrong places. For now I have kept params.ctrl_or_cmd. If you want, you are welcome to post an updated diff here with your version instead.

I addressed your other issues.

  • De-duplicated more items that were duplicated for Cmd and Ctrl
  • Remove keymaps for most tools. Just inherit the keymap from the default keymap instead
  • Remove most modal keymaps. Just inherit the keymap from the default keymap instead

This removes hundreds of unnecessary lines in the keymap

Fixed an issue where the basic tools would try to execute in the paint modes. Now those tools only have keymaps inside the modes where they work.

@Campbell Barton (campbellbarton) If I wanted to tweak the keymap for the actual transform gizmos themselves, how would I go about that? Are they able to be defined in a keymap?

For example, I would like to remove the Shift-clicking on the Move gizmo handles to constrain on the other axes, but using it for extruding instead.

William Reynish (billreynish) edited the summary of this revision. (Show Details)
  • Merged operators to be single operators with options
  • Added JKL controls to scrub time in Object and Pose modes
  • Corrected path.
  • Change case for keymap data filename.

Activating the keymap has the following warnings:

Warning: property 'action' not found in keymap item 'CLIP_OT_graph_select_box'
Warning: property 'action' not found in keymap item 'CLIP_OT_graph_select_box'
Warning: property 'next' not found in keymap item 'SCREEN_OT_frame_jump'
Warning: property 'next' not found in keymap item 'SCREEN_OT_frame_jump'
Warning: property 'next' not found in keymap item 'SCREEN_OT_frame_jump'
Warning: property 'next' not found in keymap item 'SCREEN_OT_frame_jump'
Warning: property 'release_confirm' not found in keymap item 'OBJECT_OT_duplicate_move'
Warning: property 'release_confirm' not found in keymap item 'MESH_OT_duplicate_move'
Warning: property 'release_confirm' not found in keymap item 'CURVE_OT_duplicate_move'
Warning: property 'release_confirm' not found in keymap item 'ARMATURE_OT_duplicate_move'
Warning: property 'release_confirm' not found in keymap item 'MBALL_OT_duplicate_move'
Warning: property 'release_confirm' not found in keymap item 'GPENCIL_OT_duplicate_move'
  • Replace params.ctrl_or_cmd with a keymap transforming function
  • Remove unused code
Harbormaster completed remote builds in B3272: Diff 14569.
  • Move operators out of data file.
  • Add FIXME for string properties which should be enums.

Think this is nearly ready for inclusion, blockers AFAICS.

  • Currently there are invalid properties in the keymap that show as warnings, these should be resolved.
  • String properties are used for what should be enums for the operators.

Both of these are fairly straightforward to resolve.


Open Topics:

  • Presets have no mechanism to unregister operators (once enabled, these operators will never unregister).
  • Using the preferences for a summary of shortcuts seems strange/misuse of preferences.
  • Replacing Cmd for all shortcuts might cause conflicts with the OS? Some macOS global shortcuts use Cmd

@Campbell Barton (campbellbarton)
Yes, am sorting out those issues. I have already converted the ops to enum properties.

> Presets have no mechanism to unregister operators (once enabled, these operators will never unregister).

Hmm yes, don't know how to solve/address that. Obviously in practice it is probably unlikely to cause issues, but it does seem ugly that enabling a keymap will add operators, even when you switch away from that keymap.
Only solution I can think of, other than accepting it, is to include these operators in Blender proper, so they aren't just part of the keymap.

> Using the preferences for a summary of shortcuts seems strange/misuse of preferences.

Yeah, I can remove it - it does seem a bit out of place. Although it could be nice to have the ability to have a little text box with the main shortcuts, or a little text explanation of what it's for. But then again, you can already see that in the menus.

> Replacing Cmd for all shortcuts might cause conflicts with the OS? Some macOS global shortcuts use Cmd

Yes, it's true. But luckily with your solution Ctrl continues to work :)
The main issues are Cmd-H and Cmd-M, which are used to hide and minimise the app, respectively.

  • Removed keymap text Preferences box
  • Changed operators to use EnumProperty instead of StringProperty
  • Removed warnings for frame jump and duplicate_move

There are still some warnings for box select in the Clip Editor, which I don't understand - they are identical to how it's set up in the default keymap.

Fixed warnings for clip editor box select. It was my own silly fault.

I do get two warnings now:

  • Warning: property 'action' not found in keymap item 'OperatorProperties'
  • Warning: property 'mode' not found in keymap item 'OperatorProperties'

But these warnings aren't very helpful. Any ideas of how I mighty debug what is causing this?

Issues addressed & committed rBb932635bfd0260019157de796556cd1f7a7c762b

release/scripts/presets/keyconfig/industry_compatible.py
30–38

This can be written as two lines, no need for expanding into blocks.

44–91

All its operations should be possible w/o a special operator.

If not, some basic options can be added to existing operators to make it possible.

This revision is now accepted and ready to land.Apr 10 2019, 2:00 PM

Is there a way of resetting the 3D Cursor using the Industry Compatible Keymap? I tried to do this and couldn't find a way. The search bar didn't return anything, nor did Google, so I eventually just gave up and went back to default shortcuts. If this is going to be the experience of a Maya user using 2.8 for the first time, I can tell you that the vast majority of your users will give up, either on the keymap or on Blender itself.

I can understand the need to keep the keymap minimal, but perhaps there should be more pie menus enabled in this mode, so that the new user can find certain functions by clicking and finding it manually. Otherwise, the experience of the user will be:

  1. Watch Blender tutorial
  2. Realise that they can't complete (x) using the Industry Keymap
  3. Look through a bunch of menus to see if they can do it some other way
  4. When they can't find it in a menu, Google it
  5. Google doesn't have any information, because nobody uses the Industry Keymap
  6. Delete Blender 2.8 from hard disk, then Google "how to torrent Maya"

@Alan Noble (AlanNoble) Yes, use Right Click > Snap > Cursor to World Origin.

Please use this thread for further feedback: https://devtalk.blender.org/t/industry-compatible-keymap-questions-suggestions-and-answers/6911/21