Configurable Keybindings (and missing shortcut keys)

Involved development of the OpenMW construction set.
aesylwinn
Posts: 231
Joined: 14 Dec 2015, 20:30

Configurable Keybindings (and missing shortcut keys)

Post by aesylwinn » 09 Jun 2016, 22:25

The next large feature I think I'll implement is configurable keybindings (for the editor). I'm posting this now so people can post their thoughts/opinions. There are still a couple smaller features/fixes I want to finish before starting this.

I believe this task involves:
1. Ability to customize controls in scene editor for camera/editing.
2. Shortcuts for actions in various context menus.
3. Perhaps some shortcuts for global actions (like saving)

I am assuming that only mouse and keyboard input is relevant here. Qt by itself does not appear to support joysticks anyway.
Also, this thread isn't really about what the default key configuration should be, so please post about that elsewhere if you want to. That's a task that can be more easily discussed after this feature is implemented anyway.

User avatar
damiel
Posts: 28
Joined: 16 Apr 2016, 11:46

Re: Configurable Keybindings (and missing shortcut keys)

Post by damiel » 09 Jun 2016, 23:08

aesylwinn wrote: 3. Perhaps some shortcuts for global actions (like saving)
As far as i can tell there is already a shortcut for saving, its alt + f + s for me atleast and you can reach the other menus the same way. It would be nice to actually show those shortcuts in the menu, i stumbled across the shortcuts by accident more or less...

aesylwinn
Posts: 231
Joined: 14 Dec 2015, 20:30

Re: Configurable Keybindings (and missing shortcut keys)

Post by aesylwinn » 09 Jun 2016, 23:55

Interesting. I didn't realize you could do that. Based on how it works and from what I can see in the code, it might be something Qt does automatically by searching the names.
This brings up the question of whether this behavior should remain or be re-implemented so it can be customized.

Chris
Posts: 1298
Joined: 04 Sep 2011, 08:33

Re: Configurable Keybindings (and missing shortcut keys)

Post by Chris » 10 Jun 2016, 01:24

aesylwinn wrote:Interesting. I didn't realize you could do that. Based on how it works and from what I can see in the code, it might be something Qt does automatically by searching the names.
It's something Qt does for you when menus labels are properly set up. Menu labels can specify an "action" character (I don't recall what the actual term is). Like for the File menu, you set the name as "&File" and the letter F will be underlined and you can press alt+f to open it. Similarly for menu entries, so if the Save entry has the name "&Save", the S will be underlined and you can press the s key while the menu's open to activate it. So "alt+f, s" will automatically work to activate the save action in the file menu.

User avatar
Zini
Posts: 5134
Joined: 06 Aug 2011, 15:16

Re: Configurable Keybindings (and missing shortcut keys)

Post by Zini » 10 Jun 2016, 10:08

There is no perhaps in #3. Ideally we want all functions to be accessible via the keyboard. Additional thoughts:

- A major part of the task is also to figure out sensible default key bindings. Its okay to leave rarely used functions without a default key binding.
- Ideally we also would want to check for collisions between keybindings (i.e. the same key can not be assigned twice globally and a global key can also not be re-used for a context sensitive function (like a menu item in the scene view). I consider this feature kinda optional, since it is rather complex and a bit above the scope of the primary task.
- Within the scene subview we have two special modifier keys (shift and control). Maybe it would make sense to make them remappable too.
- The cell arrows and the cell markers have various functions when clicked on them. The cell marker functions aren't implemented yet, so we can skip them for now. But it would be nice to have optional keybindings for the cell arrows. That can only work for those functions that work on all cells (shift primary edit and shift secondary edit). This should be based on cardinal directions and not on the orientation of the camera.
- Ideally we would want to communicate the key-bindings to the user outside the user settings UI. At least for menus it should be obvious how to do that. In other cases the information could be included in tooltips. Again, this is not part of the core task and we could probably do without it for the time being.
- If you are doing the tooltip part too, then you should also look at mouse button names in tooltips. I think it would be a good idea to use the actual buttons names (left button, middle button, right button) instead of the abstract ones (primary edit and so on).

The UI for changing should be implemented in a class inherited from CSVPrefs::PageBase (as part of the regular user settings system).

aesylwinn
Posts: 231
Joined: 14 Dec 2015, 20:30

Re: Configurable Keybindings (and missing shortcut keys)

Post by aesylwinn » 10 Jun 2016, 17:47

Chris wrote:you set the name as "&File" and the letter F will be underlined and you can press alt+f to open it.
I had wondered about the ampersands, but I didn't look into it. Thanks for the explanation. :) My main concern with keeping the behavior is that it could conflict with other keybindings in a way that cannot be detected (they would have to be manually blacklisted).
Edit: The underline doesn't seem to happen on Windows, though I can see it on linux.
Zini wrote:A major part of the task is also to figure out sensible default key bindings. Its okay to leave rarely used functions without a default key binding.
For the global shortcuts, I plan on using Qt's StandardKey for what's applicable. I'll probably just pick what I think makes sense for the rest, and change them as requested in the pull request. When I said "this thread isn't really about what the default key configuration should be" I didn't properly state that I was only referring to the default keybindings that already exist.
Zini wrote:Ideally we also would want to check for collisions between keybindings
My plan is to use a class with global state for checking if a key conflicts whenever it is assigned. It would probably be the class inherited from CSVPrefs::PageBase.

aesylwinn
Posts: 231
Joined: 14 Dec 2015, 20:30

Re: Configurable Keybindings (and missing shortcut keys)

Post by aesylwinn » 28 Jul 2016, 03:21

The list of shortcuts that will be configurable can be seen in the code block below or at the pull request. If anyone disagrees with one of the defaults I've added or if you want more defaults set, then please post here or on the pull request. As long as it's reasonable and won't conflict, I'll add it. Please mention both the shortcut identifier and the sequence you want assigned to it.

Code: Select all

document-file-newgame
{
    Description: Create new game
    Sequence:  
}

document-file-newaddon
{
    Description: Create new addon
    Sequence:  
}

document-file-open
{
    Description: Open
    Sequence:  
}

document-file-save
{
    Description: Save
    Sequence: Qt::ControlModifier | Qt::Key_S 
}

document-file-verify
{
    Description: Verify
    Sequence:  
}

document-file-merge
{
    Description: Merge
    Sequence:  
}

document-file-errorlog
{
    Description: Load error log
    Sequence:  
}

document-file-metadata
{
    Description: Meta Data
    Sequence:  
}

document-file-close
{
    Description: Close
    Sequence:  
}

document-file-exit
{
    Description: Exit
    Sequence:  
}

document-edit-undo
{
    Description: Undo
    Sequence: Qt::ControlModifier | Qt::Key_Z 
}

document-edit-redo
{
    Description: Redo
    Sequence: Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Z 
}

document-edit-preferences
{
    Description: Show Preferences
    Sequence:  
}

document-edit-search
{
    Description: Show Search
    Sequence:  
}

document-view-newview
{
    Description: New View
    Sequence:  
}

document-view-statusbar
{
    Description: Show Status Bar
    Sequence:  
}

document-view-filters
{
    Description: Show Filters
    Sequence:  
}

document-world-regions
{
    Description: Show Regions
    Sequence:  
}

document-world-cells
{
    Description: Show Cells
    Sequence:  
}

document-world-referencables
{
    Description: Show Referencables
    Sequence:  
}

document-world-references
{
    Description: Show References
    Sequence:  
}

document-world-pathgrid
{
    Description: Show Pathgrids
    Sequence:  
}

document-world-regionmap
{
    Description: Show Region Map
    Sequence:  
}

document-mechanics-globals
{
    Description: Show Globals
    Sequence:  
}

document-mechanics-gamesettings
{
    Description: Show Game Settings
    Sequence:  
}

document-mechanics-scripts
{
    Description: Show Scripts
    Sequence:  
}

document-mechanics-spells
{
    Description: Show Spells
    Sequence:  
}

document-mechanics-enchantments
{
    Description: Show Enchantments
    Sequence:  
}

document-mechanics-magiceffects
{
    Description: Show Magic Effects
    Sequence:  
}

document-mechanics-startscripts
{
    Description: Show Start Scripts
    Sequence:  
}

document-character-skills
{
    Description: Show Skills
    Sequence:  
}

document-character-classes
{
    Description: Show Classes
    Sequence:  
}

document-character-factions
{
    Description: Show Factions
    Sequence:  
}

document-character-races
{
    Description: Show Races
    Sequence:  
}

document-character-birthsigns
{
    Description: Show Birthsigns
    Sequence:  
}

document-character-topics
{
    Description: Show Topics
    Sequence:  
}

document-character-journals
{
    Description: Show Journals
    Sequence:  
}

document-character-topicinfos
{
    Description: Show Topic Infos
    Sequence:  
}

document-character-journalinfos
{
    Description: Show Journal Infos
    Sequence:  
}

document-character-bodyparts
{
    Description: Show Body Parts
    Sequence:  
}

document-assets-sounds
{
    Description: Show Sound Assets
    Sequence:  
}

document-assets-soundgens
{
    Description: Show Sound Generators
    Sequence:  
}

document-assets-meshes
{
    Description: Show Mesh Assets
    Sequence:  
}

document-assets-icons
{
    Description: Show Icon Assets
    Sequence:  
}

document-assets-music
{
    Description: Show Music Assets
    Sequence:  
}

document-assets-soundres
{
    Description: Show Sound Files
    Sequence:  
}

document-assets-textures
{
    Description: TShow exture Assets
    Sequence:  
}

document-assets-videos
{
    Description: Show Video Assets
    Sequence:  
}

document-debug-run
{
    Description: Run Debug
    Sequence:  
}

document-debug-shutdown
{
    Description: Stop Debug
    Sequence:  
}

document-debug-runlog
{
    Description: Run Log
    Sequence:  
}

table-edit
{
    Description: Edit record
    Sequence:  
}

table-add
{
    Description: Add row/record
    Sequence: Qt::ControlModifier | Qt::Key_N 
}

table-clone
{
    Description: Clone record
    Sequence:  
}

table-revert
{
    Description: Revert record
    Sequence:  
}

table-remove
{
    Description: Remove row/record
    Sequence: Qt::Key_Delete 
}

table-moveup
{
    Description: Move record up
    Sequence:  
}

table-movedown
{
    Description: Move record down
    Sequence:  
}

table-view
{
    Description: View record
    Sequence:  
}

table-preview
{
    Description: Preview record
    Sequence:  
}

table-extendeddelete
{
    Description: Extended record deletion
    Sequence:  
}

table-extendedrevert
{
    Description: Extended record revertion
    Sequence:  
}

reporttable-show
{
    Description: Show report
    Sequence:  
}

reporttable-remove
{
    Description: Remove report
    Sequence: Qt::Key_Delete 
}

reporttable-replace
{
    Description: Replace report
    Sequence:  
}

reporttable-refresh
{
    Description: Refresh report
    Sequence:  
}

free-forward
{
    Description: Forward
    Sequence: Qt::Key_W , Qt::Key_Shift
}

free-backward
{
    Description: Backward
    Sequence: Qt::Key_S 
}

free-left
{
    Description: Left
    Sequence: Qt::Key_A 
}

free-right
{
    Description: Right
    Sequence: Qt::Key_D 
}

free-roll-left
{
    Description: Roll left
    Sequence: Qt::Key_Q 
}

free-roll-right
{
    Description: Roll right
    Sequence: Qt::Key_E 
}

free-speed-mode
{
    Description: Speed mode toggle
    Sequence: Qt::Key_F 
}

orbit-up
{
    Description: Up
    Sequence: Qt::Key_W , Qt::Key_Shift
}

orbit-down
{
    Description: Down
    Sequence: Qt::Key_S 
}

orbit-left
{
    Description: Left
    Sequence: Qt::Key_A 
}

orbit-right
{
    Description: Right
    Sequence: Qt::Key_D 
}

orbit-roll-left
{
    Description: Roll left
    Sequence: Qt::Key_Q 
}

orbit-roll-right
{
    Description: Roll right
    Sequence: Qt::Key_E 
}

orbit-speed-mode
{
    Description: Speed mode toggle
    Sequence: Qt::Key_F 
}

orbit-center-selection
{
    Description: Center on selected
    Sequence: Qt::Key_C 
}

scene-navi-primary
{
    Description: Camera rotation from mouse movement
    Sequence: Qt::LeftButton 
}

scene-navi-secondary
{
    Description: Camera translation from mouse movement
    Sequence: Qt::ControlModifier |  int Qt::LeftButton 
}

scene-edit-primary
{
    Description: Primary edit
    Sequence: Qt::RightButton 
}

scene-edit-secondary
{
    Description: Secondary edit
    Sequence: Qt::ControlModifier |  int Qt::RightButton 
}

scene-select-primary
{
    Description: Primary select
    Sequence: Qt::MiddleButton 
}

scene-select-secondary
{
    Description: Secondary select
    Sequence: Qt::ControlModifier |  int Qt::MiddleButton 
}

scene-load-cam-cell
{
    Description: Load camera cell
    Sequence: Qt::KeypadModifier | Qt::Key_5 
}

scene-load-cam-eastcell
{
    Description: Load east cell
    Sequence: Qt::KeypadModifier | Qt::Key_6 
}

scene-load-cam-northcell
{
    Description: Load north cell
    Sequence: Qt::KeypadModifier | Qt::Key_8 
}

scene-load-cam-westcell
{
    Description: Load west cell
    Sequence: Qt::KeypadModifier | Qt::Key_4 
}

scene-load-cam-southcell
{
    Description: Load south cell
    Sequence: Qt::KeypadModifier | Qt::Key_2 
}

scene-edit-abort
{
    Description: Abort
    Sequence: Qt::Key_Escape 
}

scene-focus-toolbar
{
    Description: Toggle toolbar focus
    Sequence: Qt::Key_T 
}

scene-render-stats
{
    Description: Debug rendering stats
    Sequence: Qt::Key_F3 
}

I apologize for not taking the time to convert that into a format that is easier to read.

Lamoot
Posts: 59
Joined: 22 Apr 2016, 12:03

Re: Configurable Keybindings (and missing shortcut keys)

Post by Lamoot » 28 Jul 2016, 15:16

It'd be useful to have familiarity between open source programs in OpenMW pipeline. Under "Scene", the following shortcuts would make 3d view controls closer to how they are in Blender. (GIMP and Inkscape also use MMB to move the view around)

scene-navi-primary - MMB
scene-navi-secondary - SHIFT + MMB
scene-select-primary - RMB
scene-select-secondary - SHIFT + RMB
scene-edit-primary - LMB
scene-edit-secondary - SHIFT + LMB

Then for opening, closing files and the editor:

document-file-open - CTRL + O
document-file-close - CTRL + W
document-file-exit - CTRL + Q
document-edit-search - CTRL + F
document-file-newgame - CTRL + N

table-add - SHIFT + A
(used in Blender to add new objects)

table-clone - SHIFT + D
(used in Blender to duplicate an object)

aesylwinn
Posts: 231
Joined: 14 Dec 2015, 20:30

Re: Configurable Keybindings (and missing shortcut keys)

Post by aesylwinn » 28 Jul 2016, 20:36

Lamoot wrote:document-file-open - CTRL + O
document-file-close - CTRL + W
document-file-exit - CTRL + Q
document-edit-search - CTRL + F
document-file-newgame - CTRL + N

table-add - SHIFT + A
(used in Blender to add new objects)

table-clone - SHIFT + D
(used in Blender to duplicate an object)
These are good. Regarding "document-file-close" and "document-file-exit", close is for closing the current document/view since you can have multiple ones open while exit is for exiting the application. Do these assignments still make sense? I'm not that familiar with them and where they are typically used.
Lamoot wrote:scene-navi-primary - MMB
scene-navi-secondary - SHIFT + MMB
scene-select-primary - RMB
scene-select-secondary - SHIFT + RMB
scene-edit-primary - LMB
scene-edit-secondary - SHIFT + LMB
These were previously set defaults which I said I did not want to change. However, I do agree that it would be nice to share controls with other programs. Do Maya and Max share those controls? Perhaps there should be a poll to decide these. I'll let Zini have the final word on these.

User avatar
AnyOldName3
Posts: 564
Joined: 26 Nov 2015, 03:25

Re: Configurable Keybindings (and missing shortcut keys)

Post by AnyOldName3 » 29 Jul 2016, 01:28

We could have selectable presets, although that might not be the best thing to have in the first iteration of this feature, as it's more work and would delay 0.40 even longer.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests