UX: Polyline Gesture #119353

Open
opened 2024-03-12 00:44:15 +01:00 by Sean Kim · 5 comments
Member

Issue

Currently, there is no support for a generic polyline gesture that allows developers to take advantage of a common structure similar to the other WM_gesture types (e.g. WM_GESTURE_RECT, WM_GESTURE_CIRCLE, WM_GESTURE_LASSO, etc).

Revision History:

  • 2024-03-13: Added minor updates to the User Interaction section.
  • 2024-03-19: Minor addition to User Interaction.

Proposal

I propose adding a new WM_GESTURE_POLYLINE type and corresponding default operator callbacks so that existing actions that use other gesture types can also be modified to use this mode of selection (e.g. SCULPT_OT_face_set_lasso_gesture, MASK_OT_select_lasso, SCULPT_OT_trim_lasso_gesture, etc).

A prototype of this feature can be seen below:

initial_polyline.gif

User Interaction

Upon selecting the operator via either the toolbar or a menu, the first click inside the viewport will add a point. The specific modifier key or mouse button applied to this action will vary based on tool but will align with user expectations for similar lasso tools - the key difference being that it does not require a drag action. The user's cursor will track the next point and display both its current position and a line connecting it to the previous point selected. Any subsequent clicks will repeat this process, saving the current point to where the user's cursor was at the time of selection.

After two points are saved, a line will be drawn back to the initial point to indicate to the user what the resulting selected will look like. At this point, the user can press Enter to confirm the selected area and submit the data for the operator specific actions. A user can also click on the original starting point to submit the gesture instead of pressing Enter

At any point, a user can press Esc to cancel the operation.

Similar to the Lasso gesture, this gesture will also support holding Spacebar to move the selection area around before submitting it.

A status bar will be added to inform users of the modified controls.

Code

A new wmGesture::type will be added named WM_GESTURE_POLYLINE. The wmGesture customdata data will be similar to WM_GESTURE_LASSO - an array of shorts representing the selected mouse positions in screen space. This array will need fewer entries inside it as it will not be updated upon every mouse movement, only when clicked.

Much of the existing lasso code can be repurposed for this implementation since they share similar features for drawing and selection.

For users of these new default callbacks, they should be able to use existing code that works for WM_GESTURE_LASSO, as the process of selecting the bounding box of the points and creating a bitmap of the area will work similarly.

Open Questions

  • Does the user need to be able to click on the starting point to complete the loop and execute the gesture?

    Yes, this should be possible.

  • Is there an upper limit to the number of gesture points that we should enforce?

    There should be no issue with allowing the user to select as many points as they want, it is unlikely there will be any memory concerns in comparison to the lasso tool.

  • All other generic gesture operations appear to correspond to click + drag invocations. Is there an issue with adding this new type that follows a completely different input model?

## Issue Currently, there is no support for a generic polyline gesture that allows developers to take advantage of a common structure similar to the other `WM_gesture` types (e.g. `WM_GESTURE_RECT`, `WM_GESTURE_CIRCLE`, `WM_GESTURE_LASSO`, etc). ## Revision History: * 2024-03-13: Added minor updates to the **User Interaction** section. * 2024-03-19: Minor addition to **User Interaction**. ## Proposal I propose adding a new `WM_GESTURE_POLYLINE` type and corresponding default operator callbacks so that existing actions that use other gesture types can also be modified to use this mode of selection (e.g. `SCULPT_OT_face_set_lasso_gesture`, `MASK_OT_select_lasso`, `SCULPT_OT_trim_lasso_gesture`, etc). A prototype of this feature can be seen below: ![initial_polyline.gif](/attachments/2629afe6-96b1-464d-b668-80cc777937bb) ### User Interaction Upon selecting the operator via either the toolbar or a menu, the first click inside the viewport will add a point. The specific modifier key or mouse button applied to this action will vary based on tool but will align with user expectations for similar lasso tools - the key difference being that it does not require a drag action. The user's cursor will track the next point and display both its current position and a line connecting it to the previous point selected. Any subsequent clicks will repeat this process, saving the current point to where the user's cursor was at the time of selection. After two points are saved, a line will be drawn back to the initial point to indicate to the user what the resulting selected will look like. At this point, the user can press `Enter` to confirm the selected area and submit the data for the operator specific actions. A user can also click on the original starting point to submit the gesture instead of pressing `Enter` At any point, a user can press `Esc` to cancel the operation. Similar to the Lasso gesture, this gesture will also support holding `Spacebar` to move the selection area around before submitting it. A status bar will be added to inform users of the modified controls. ### Code A new `wmGesture::type` will be added named `WM_GESTURE_POLYLINE`. The `wmGesture` `customdata` data will be similar to `WM_GESTURE_LASSO` - an array of `short`s representing the selected mouse positions in screen space. This array will need fewer entries inside it as it will not be updated upon every mouse movement, only when clicked. Much of the existing lasso code can be repurposed for this implementation since they share similar features for drawing and selection. For users of these new default callbacks, they should be able to use existing code that works for `WM_GESTURE_LASSO`, as the process of selecting the bounding box of the points and creating a bitmap of the area will work similarly. ## Open Questions * ~~Does the user need to be able to click on the starting point to complete the loop and execute the gesture?~~ Yes, this should be possible. * ~~Is there an upper limit to the number of gesture points that we should enforce?~~ There should be no issue with allowing the user to select as many points as they want, it is unlikely there will be any memory concerns in comparison to the lasso tool. * All other generic gesture operations appear to correspond to click + drag invocations. Is there an issue with adding this new type that follows a completely different input model?
Sean Kim added the
Type
Design
label 2024-03-12 00:44:15 +01:00

Cool stuff... 👍

Does the user need to be able to click on the starting point to complete the loop and execute the gesture?

That's another common way of executing this type of tool, yes. So it would be nice to have that ability here too...

Is there an upper limit to the number of gesture points that we should enforce?

I never encountered a limit when using this kind of tool in other software... if there's a limit, the number must be fairly high... 🤔

All other generic gesture operations appear to correspond to click + drag invocations. Is there an issue with adding this new type that follows a completely different input model?

IMHO, that shouldn't be an issue... That's the nature of this tool and how it works.. no issue at all..

Cool stuff... 👍 > Does the user need to be able to click on the starting point to complete the loop and execute the gesture? That's another common way of executing this type of tool, yes. So it would be nice to have that ability here too... > Is there an upper limit to the number of gesture points that we should enforce? I never encountered a limit when using this kind of tool in other software... if there's a limit, the number must be fairly high... 🤔 > All other generic gesture operations appear to correspond to click + drag invocations. Is there an issue with adding this new type that follows a completely different input model? IMHO, that shouldn't be an issue... That's the nature of this tool and how it works.. no issue at all..
Author
Member

@TheRedWaxPolice - Appreciate the feedback. I've edited the main post

@TheRedWaxPolice - Appreciate the feedback. I've edited the main post

Nice to see polygonal lasso concept. It is long awaited.
A couple of questions

  • Will it support object/edit mode?
  • How about the ability to start/draw polygonal lasso via Ctrl+RMB clicks, similar to regular lasso?
Nice to see polygonal lasso concept. It is long awaited. A couple of questions - Will it support object/edit mode? - How about the ability to start/draw polygonal lasso via Ctrl+RMB clicks, similar to regular lasso?
Author
Member

@1D_Inc

  • Will it support object/edit mode?

I assume you mean as a Select Polyline tool, similar to Select Lasso - if so yes, this should be able to be used for that tool as well, though the first implementation that I'm working on is Polyline Hide.

  • How about the ability to start/draw polygonal lasso via Ctrl+RMB clicks, similar to regular lasso?

Assuming you're using Select Lasso as a reference point again, yes, that should be able to be added for an equivalent tool.

@1D_Inc > - Will it support object/edit mode? I assume you mean as a *Select Polyline* tool, similar to *Select Lasso* - if so yes, this should be able to be used for that tool as well, though the first implementation that I'm working on is *Polyline Hide*. > - How about the ability to start/draw polygonal lasso via Ctrl+RMB clicks, similar to regular lasso? Assuming you're using *Select Lasso* as a reference point again, yes, that should be able to be added for an equivalent tool.

Sounds great!
Thank you.

Sounds great! Thank you.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
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
3 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#119353
No description provided.