Curves: Add support for proportional editing #104620
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#104620
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "filedescriptor:curves-proportional-editing"
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 initial support for proportional editing. Also works with "Only Connected".
Nice! "Connected Only" doesn't work exactly as I expected, compared to mesh edit mode anyway. Points from one curve seem to affect points from other curves. I'm not sure how proportional editing works, but two mesh faces next to each other don't affect each other in the same way.
@ -28,6 +28,7 @@ static void createTransCurvesVerts(bContext * /*C*/, TransInfo *t)
MutableSpan<TransDataContainer> trans_data_contrainers(t->data_container, t->data_container_len);
Array<Vector<int64_t>> selected_indices_per_object(t->data_container_len);
Array<IndexMask> selection_per_object(t->data_container_len);
const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
prop
->proportional
? Curious what you think about that-- saving a few characters doesn't help so much here.@ -77,0 +70,4 @@
".selection", ATTR_DOMAIN_POINT, true);
threading::parallel_for(curves.curves_range(), 1024, [&](const IndexRange range) {
for (const int curve_i : range) {
bool has_any_selected = false;
What do you think about processing
has_any_selected
in a separate loop? It's probably possible to use one of the curves utilities with that name, right? In that case, maybe it's possible to skip the rest of the work in the curve in that case, and it probably makes the code a bit more readable.@ -77,0 +72,4 @@
for (const int curve_i : range) {
bool has_any_selected = false;
for (const int point_i : points_by_curve[curve_i]) {
TransData *td = &tc.data[point_i];
TransData &td = tc.data[point_i];
@ -77,0 +82,4 @@
has_any_selected = true;
}
td->flag = (selection[point_i]) ? TD_SELECTED : 0;
(selection[point_i])
->selection[point_i]
Unnecessary parentheses
@ -77,0 +91,4 @@
if (!has_any_selected) {
for (const int point_i : points_by_curve[curve_i]) {
TransData *td = &tc.data[point_i];
->
Curves: Add support for proportional editingto WIP: Curves: Add support for proportional editingThis is indeed not working right. Marking this as WIP for the time being.
Adding a note for myself. What I need to do is:
td->dist
when proportional edit is in connected only mode.b168662316
to4c82867844
WIP: Curves: Add support for proportional editingto Curves: Add support for proportional editingThis is working nicely!
@ -28,3 +62,4 @@
MutableSpan<TransDataContainer> trans_data_contrainers(t->data_container, t->data_container_len);
Array<Vector<int64_t>> selected_indices_per_object(t->data_container_len);
Array<IndexMask> selection_per_object(t->data_container_len);
const bool is_prop_edit = (t->flag & T_PROP_EDIT_ALL) != 0;
is_prop_edit
->use_proportional_edit
is_prop_connected
->proportional_connected_only
Or something like that
@ -74,3 +101,1 @@
copy_m3_m3(td->mtx, mtx);
}
});
float3 *positions_ptr = curves.positions_for_write().data();
Separate
positions_read
andpositions_ptr
shouldn't be necessary, the oldpositions
span should still work fineLast time I tried this, the compiler complained because I was passing pointers to
td->loc
when the Span is const. So I think I needfloat3 *positions_ptr = curves.positions_for_write().data();
just to pass the pointers into theTransData
struct.Just replacing
positions_ptr
with a mutable span seems to work fine here@ -77,0 +117,4 @@
}
if (!has_any_selected) {
for (const int point_i : points_by_curve[curve_i]) {
for (const int point_i : points) {
@ -77,0 +128,4 @@
}
const Span<float3> positions_curve = positions_read.slice(points_by_curve[curve_i]);
Array<float> closest_distances(positions_curve.size(), FLT_MAX);
This array makes things a bit more readable, but it isn't really necessary considering all the data will go into
TransData.dist
right after. It might be worth skipping the array, since this will be an allocation and free for every single curve.I am not sure how I would rewrite the code to not use an array in this case. The
td->dist
values are not sequential, so I can't write to them directly. But the implementation needs some container that I can build theInplacePriorityQueue
on top of.Ah right! That's totally fine, it was just a thought.
9ed2acb8fa
to2aceb2ba99
Works very well now!
I made some changes in a branch here: https://projects.blender.org/HooglyBoogly/blender/commits/branch/curves-proportional-editing
Feel free to cherry-pick them, or if you disagree anywhere let me know :)
I'll accept now since with those changes the path looks good to me.
@ -26,0 +37,4 @@
}
visited[index] = true;
/* TODO (Falk): Handle cyclic curves here. */
Tiny thing, but fairly sure this will end up in a cleanup commit by Campbell to remove the space between
TODO
and(Falk)
:PI'd remove your name or the space
2aceb2ba99
to92d4f78941
Pull request closed