Curves: Add select more/less #104626
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#104626
Loading…
Reference in New Issue
No description provided.
Delete Branch "filedescriptor/blender:curves-select-more-less"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This adds the "Select More/Less" operators for Curves. Both operators use the
select_adjacent
function to (de)select adjacent points.fce8214871
to17363c293d
Just two small comments inline.
@ -270,0 +313,4 @@
MutableSpan<bool> selection_typed = selection.typed<bool>();
return !selection_typed[current] && selection_typed[next];
}
else if (selection.type().is<float>()) {
else after return
@ -270,0 +346,4 @@
if (check_adjacent_selection(selection_curve, point_i, point_i - 1)) {
apply_selection_operation_at_index(selection_curve, point_i, SEL_OP_ADD);
}
}
Looks like this doesn't handle cyclic curves. For some similar logic,
ControlPointNeighborFieldInput
might be worth checking out.IMO, this is pushing the boundaries of what should be done with dynamic types per index, since there's 2 reads per index. But I strongly doubt the selection operators will noticeably non-instantaneous, and it can always be improved later.
@ -199,6 +199,46 @@ static void invert_selection(GMutableSpan selection)
}
}
static void apply_selection_operation_at_index(GMutableSpan selection,
Looks like this doesn't need to move in this patch anymore? It looks like the type could still be abstracted, but duplicating things twice isn't so bad in return for making the type-interaction more obvious.
@ -270,0 +323,4 @@
threading::parallel_for(curves.curves_range(), 256, [&](const IndexRange range) {
for (const int curve_i : range) {
MutableSpan<bool> selection_curve = selection_typed.slice(points_by_curve[curve_i]);
const int last_i = points_by_curve.size(curve_i) - 1;
I think a local
const IndexRange points
variable to hold the curve points range would make this slightly more readable.@ -270,0 +340,4 @@
}
/* Handle cyclic curve case. */
if (cyclic[curve_i]) {
Nice, that's simpler than I expected. Only needing to propagate it by one element helps!
@ -270,0 +365,4 @@
/* Handle all cases in the backwards direction. */
for (int point_i = last_i; point_i > 0; point_i--) {
if ((selection_typed[point_i] == 0.0f) && (selection_typed[point_i - 1] > 0.0f)) {
This mix of using
selection_typed
andselection_curve
is confusing, it's hard to tell what's correct here.If it's possible, I'd suggest only using actual point indices (rather than 0..points.size() for each curve). Having a local
IndexRange
variable with the.last(N)
method should make that simpler.Ah good catch, that's actually a bug I was trying to fix. It didn't work with float selection, so I think that is why.
824cee6ec3
to6d5f46c4e0
@ -270,0 +272,4 @@
const OffsetIndices points_by_curve = curves.points_by_curve();
bke::GSpanAttributeWriter selection = ensure_selection_attribute(
curves, ATTR_DOMAIN_POINT, CD_PROP_BOOL);
VArray<bool> cyclic = curves.cyclic();
VArray<bool> cyclic
->const VArray<bool> cyclic