Curves: Add support for proportional editing #104620
@ -6991,9 +6991,9 @@ class VIEW3D_PT_proportional_edit(Panel):
|
|||||||
|
|
||||||
if context.mode != 'OBJECT':
|
if context.mode != 'OBJECT':
|
||||||
sub = col.column()
|
sub = col.column()
|
||||||
sub.prop(tool_settings, "use_proportional_connected")
|
|
||||||
# TODO: Implement connected mode for curves object
|
# TODO: Implement connected mode for curves object
|
||||||
sub.active = context.active_object.type != 'CURVES'
|
sub.active = context.active_object.type != 'CURVES'
|
||||||
|
sub.prop(tool_settings, "use_proportional_connected")
|
||||||
sub = col.column()
|
sub = col.column()
|
||||||
sub.active = not tool_settings.use_proportional_connected
|
sub.active = not tool_settings.use_proportional_connected
|
||||||
sub.prop(tool_settings, "use_proportional_projected")
|
sub.prop(tool_settings, "use_proportional_projected")
|
||||||
|
@ -37,6 +37,7 @@ static void calculate_curve_point_distances_for_proportional_editing(
|
|||||||
}
|
}
|
||||||
visited[idx] = true;
|
visited[idx] = true;
|
||||||
|
|
||||||
|
/* TODO (Falk): Handle cyclic curves here. */
|
||||||
filedescriptor marked this conversation as resolved
|
|||||||
if (idx > 0 && !visited[idx - 1]) {
|
if (idx > 0 && !visited[idx - 1]) {
|
||||||
int adj = idx - 1;
|
int adj = idx - 1;
|
||||||
float dist = r_distances[idx] + math::distance(positions[idx], positions[adj]);
|
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();
|
MutableSpan<float3> positions = curves.positions_for_write();
|
||||||
filedescriptor marked this conversation as resolved
Hans Goudey
commented
Separate Separate `positions_read` and `positions_ptr` shouldn't be necessary, the old `positions` span should still work fine
Falk David
commented
Last time I tried this, the compiler complained because I was passing pointers to 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.
Hans Goudey
commented
Just replacing Just replacing `positions_ptr` with a mutable span seems to work fine here
|
|||||||
if (is_prop_edit) {
|
if (is_prop_edit) {
|
||||||
Span<float3> positions_read = curves.positions();
|
const Span<float3> positions_read = curves.positions();
|
||||||
OffsetIndices<int> points_by_curve = curves.points_by_curve();
|
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
|
||||||
VArray<bool> selection = curves.attributes().lookup_or_default<bool>(
|
VArray<bool> selection = curves.attributes().lookup_or_default<bool>(
|
||||||
".selection", ATTR_DOMAIN_POINT, true);
|
".selection", ATTR_DOMAIN_POINT, true);
|
||||||
threading::parallel_for(curves.curves_range(), 512, [&](const IndexRange range) {
|
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;
|
bool has_any_selected = false;
|
||||||
|
|
||||||
const IndexRange points = points_by_curve[curve_i];
|
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);
|
Array<float> closest_distances(positions_curve.size(), FLT_MAX);
|
||||||
|
|
||||||
for (const int i : IndexRange(points.size())) {
|
for (const int i : IndexRange(points.size())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user
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