Curves: Add support for proportional editing #104620

Closed
Falk David wants to merge 15 commits from filedescriptor:curves-proportional-editing into blender-v3.5-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 5 additions and 4 deletions
Showing only changes of commit b9833856a3 - Show all commits

View File

@ -6991,9 +6991,9 @@ class VIEW3D_PT_proportional_edit(Panel):
if context.mode != 'OBJECT':
sub = col.column()
sub.prop(tool_settings, "use_proportional_connected")
# TODO: Implement connected mode for curves object
sub.active = context.active_object.type != 'CURVES'
sub.prop(tool_settings, "use_proportional_connected")
sub = col.column()
sub.active = not tool_settings.use_proportional_connected
sub.prop(tool_settings, "use_proportional_projected")

View File

@ -37,6 +37,7 @@ static void calculate_curve_point_distances_for_proportional_editing(
}
visited[idx] = true;
/* TODO (Falk): Handle cyclic curves here. */
filedescriptor marked this conversation as resolved
Review

Tiny thing, but fairly sure this will end up in a cleanup commit by Campbell to remove the space between TODO and (Falk) :P

I'd remove your name or the space

Tiny thing, but fairly sure this will end up in a cleanup commit by Campbell to remove the space between `TODO` and `(Falk)` :P I'd remove your name or the space
if (idx > 0 && !visited[idx - 1]) {
int adj = idx - 1;
float dist = r_distances[idx] + math::distance(positions[idx], positions[adj]);
@ -99,8 +100,8 @@ static void createTransCurvesVerts(bContext * /*C*/, TransInfo *t)
MutableSpan<float3> positions = curves.positions_for_write();
filedescriptor marked this conversation as resolved
Review

Separate positions_read and positions_ptr shouldn't be necessary, the old positions span should still work fine

Separate `positions_read` and `positions_ptr` shouldn't be necessary, the old `positions` span should still work fine
Review

Last time I tried this, the compiler complained because I was passing pointers to td->loc when the Span is const. So I think I need float3 *positions_ptr = curves.positions_for_write().data(); just to pass the pointers into the TransData struct.

Last time I tried this, the compiler complained because I was passing pointers to `td->loc` when the Span is const. So I think I need `float3 *positions_ptr = curves.positions_for_write().data();` just to pass the pointers into the `TransData` struct.
Review

Just replacing positions_ptr with a mutable span seems to work fine here

Just replacing `positions_ptr` with a mutable span seems to work fine here
if (is_prop_edit) {
Span<float3> positions_read = curves.positions();
OffsetIndices<int> points_by_curve = curves.points_by_curve();
const Span<float3> positions_read = curves.positions();
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
VArray<bool> selection = curves.attributes().lookup_or_default<bool>(
".selection", ATTR_DOMAIN_POINT, true);
threading::parallel_for(curves.curves_range(), 512, [&](const IndexRange range) {
@ -108,7 +109,7 @@ static void createTransCurvesVerts(bContext * /*C*/, TransInfo *t)
bool has_any_selected = false;
const IndexRange points = points_by_curve[curve_i];
Span<float3> positions_curve = positions_read.slice(points_by_curve[curve_i]);
const Span<float3> positions_curve = positions_read.slice(points_by_curve[curve_i]);
Array<float> closest_distances(positions_curve.size(), FLT_MAX);
for (const int i : IndexRange(points.size())) {