Curves: Add select linked #104569

Merged
Falk David merged 5 commits from filedescriptor/blender:curves-select-linked into main 2023-02-10 18:58:10 +01:00
Member

This adds a new select_linked function that selects all the points
on a curve if there is at least one point already selected.
This also adds a keymap for the operator.

This adds a new `select_linked` function that selects all the points on a curve if there is at least one point already selected. This also adds a keymap for the operator.
Falk David added 1 commit 2023-02-10 14:07:46 +01:00
c7f1a1571b Curves: Add select linked
This adds a new `select_linked` function that selects all the points
on a curve if there is at least one point already selected.
This also adds a keymap for the operator.
Falk David requested review from Hans Goudey 2023-02-10 14:07:56 +01:00
Hans Goudey requested changes 2023-02-10 15:00:01 +01:00
Hans Goudey left a comment
Member

Just a few small comments.

Just a few small comments.
@ -985,1 +985,4 @@
static int select_linked_exec(bContext *C, wmOperator */*op*/)
{
VectorSet<Curves *> unique_curves = curves::get_unique_editable_curves(*C);
Member

(I know, copied code) but the curves:: namespace specification shouldn't be necessary here, since we're already in that namespace.

(I know, copied code) but the `curves::` namespace specification shouldn't be necessary here, since we're already in that namespace.
filedescriptor marked this conversation as resolved
@ -986,0 +989,4 @@
for (Curves *curves_id : unique_curves) {
CurvesGeometry &curves = curves_id->geometry.wrap();
select_linked(curves);
/* Use #ID_RECALC_GEOMETRY instead of #ID_RECALC_SELECT because it is handled as a generic
Member

Might be nice to replace these three lines with a utility function like update_tag_selection_changed(C, curves_id), especially so that comment doesn't have to be repeated everywhere. A separate commit though obviously.

Might be nice to replace these three lines with a utility function like `update_tag_selection_changed(C, curves_id)`, especially so that comment doesn't have to be repeated everywhere. A separate commit though obviously.
Author
Member

I can create a PR for this after, yes.

I can create a PR for this after, yes.
@ -986,0 +1002,4 @@
{
ot->name = "Select Linked";
ot->idname = __func__;
ot->description = "Select linked points of curves";
Member

Best to avoid reusing the word "linked" in the description. How about Select all points in curves with any point selection?

Best to avoid reusing the word "linked" in the description. How about `Select all points in curves with any point selection`?
filedescriptor marked this conversation as resolved
@ -240,0 +250,4 @@
threading::parallel_for(curves.curves_range(), 256, [&](const IndexRange range) {
for (const int curve_i : range) {
MutableSpan<T> selection_curve_typed = selection_typed.slice(points_by_curve[curve_i]);
if (selection_curve_typed.as_span().contains(T(1))) {
Member

For proper float support, this should probably check for anything greater than 0, right?
I'd suggest separating that check to a small local function BTW as a way to give it a nice name and to make it easier to generalize in the future if we want to.

For proper float support, this should probably check for anything greater than 0, right? I'd suggest separating that check to a small local function BTW as a way to give it a nice name and to make it easier to generalize in the future if we want to.
filedescriptor marked this conversation as resolved
Falk David added 3 commits 2023-02-10 18:32:21 +01:00
Falk David requested review from Hans Goudey 2023-02-10 18:32:37 +01:00
Hans Goudey reviewed 2023-02-10 18:41:03 +01:00
@ -92,0 +92,4 @@
/**
* Return true if any element in the span is selected, on either domain with either type.
*/
bool has_any_selected(const GSpan selection);
Member

Not that it's better, but maybe using the same name has_anything_selected would be better for consistency?

Not that it's better, but maybe using the same name `has_anything_selected` would be better for consistency?
filedescriptor marked this conversation as resolved
Hans Goudey approved these changes 2023-02-10 18:41:42 +01:00
Hans Goudey left a comment
Member

Looks great!

Looks great!
@ -91,1 +91,4 @@
/**
* Return true if any element in the span is selected, on either domain with either type.
*/
Member

const GSpan selection -> GSpan selection

`const GSpan selection` -> `GSpan selection`
filedescriptor marked this conversation as resolved
Falk David added 1 commit 2023-02-10 18:57:39 +01:00
Falk David merged commit 6f8c441950 into main 2023-02-10 18:58:10 +01:00
Falk David deleted branch curves-select-linked 2023-02-10 18:58:10 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
2 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#104569
No description provided.