This patch adds a modal key to move the selection box/lasso/line while drawing it. It also sets "repeat": False on the animation playback key to prevent accidental playback if the spacebar is released after the mouse button.
Details
Diff Detail
- Repository
- rB Blender
Event Timeline
Brilliant! I love the fact that it's generic so it works everywhere!
Here I tested it on Box Selection, Box Mask, Box Face Sets, Box Trim, Render Border.
Thanks for working on this Erik!
Nice to see this finally in blender.. 👍
Does it also work with the line gestures tools like the Line Project tool of sculpt mode? This tool desperately needs this functionality.
Testing this, it doesn't work when accessing border select with modifiers.
So if you have the box select tool, pressing Ctrl-drag means you need to release Ctrl before pressing spacebar.
I suspect some users will run into this, in this case would the fix be to allow space-bar with any modifier state? Or do we require releasing modifiers before pressing space.
| release/scripts/presets/keyconfig/keymap_data/blender_default.py | ||
|---|---|---|
| 2945 | repeat will need to be set to false for all uses of the space-bar. Check the 2.7x keymap too. | |
Added repeat: false to all space bar commands, and any: true to allow modifiers while moving the selection.
| source/blender/windowmanager/WM_types.h | ||
|---|---|---|
| 490–492 | There is no need to store the size here, rectangle can be moved while maintaining it's current size. | |
| source/blender/windowmanager/intern/wm_gesture_ops.c | ||
| 212 | Prefer the order of these checks be swapped, so the move case is checked first, using else { ... } for the default dragging behavior. | |
| 219–222 | Suggest to calculate the offset, then use BLI_rcti_translate | |
| source/blender/windowmanager/intern/wm_gesture_ops.c | ||
|---|---|---|
| 219–222 | I get what you mean, but don't know how to do it. Translate is a relative function, do I not need to store atleast the coordinates of the beginning of the move operation? | |
- The 2.7x keymap doesn't ignore repeat events.
- There is no need to disable repeat on release events.
This also works with the lasso tool now, so maybe the review can be postponed a little while until I update the diff again.
Added the move function to line gestures too, so now all selection types and the new sculpt line project for example should be supported.
| source/blender/windowmanager/intern/wm_gesture_ops.c | ||
|---|---|---|
| 696–699 | This seems unnecessarily confusing, it can be written as. for (int i = 0; i < gesture->points; i++) {
lasso[(i * 2)] += x;
lasso[(i * 2) + 1] += y;
} | |
There's one thing that worries me about the latest update.
If the event value is 'ANY', repeated press events would cause the value to toggle. I'm not sure if we should rely on the repeat=False behavior, because it was only recently introduced and is quite OS dependent. I think it's fine (it's supported on Win, Linux/X11 & macOS now). But there's a chance it will break on some systems.
But this seems fine. Should there be an issue it's easy to restore the previous patch version.
| source/blender/windowmanager/intern/wm_gesture_ops.c | ||
|---|---|---|
| 697 | This distance, being always unscaled pixels, should mean that this lasso smoothing will be different when using a high-dpi displays. | |

