283 const float mix_factor,
304 from_curves, to_curves, dst_curves);
306 from_curves, to_curves, dst_curves);
325 const int i_from_curve = from_curve_indices[
pos];
326 const int i_to_curve = to_curve_indices[
pos];
327 const IndexRange dst_points = dst_points_by_curve[i_dst_curve];
329 i_from_curve, from_curves_cyclic[i_from_curve]);
331 i_to_curve, to_curves_cyclic[i_to_curve]);
335 from_sample_indices.as_mutable_span().slice(dst_points).fill(0);
336 from_sample_factors.as_mutable_span().slice(dst_points).fill(0.0f);
339 length_parameterize::sample_uniform(from_lengths,
340 !from_curves_cyclic[i_from_curve],
341 from_sample_indices.as_mutable_span().slice(dst_points),
342 from_sample_factors.as_mutable_span().slice(dst_points));
346 to_sample_indices.as_mutable_span().slice(dst_points).fill(0);
347 to_sample_factors.as_mutable_span().slice(dst_points).fill(0.0f);
350 if (dst_curve_flip_direction[i_dst_curve]) {
351 length_parameterize::sample_uniform_reverse(
353 !to_curves_cyclic[i_to_curve],
354 to_sample_indices.as_mutable_span().slice(dst_points),
355 to_sample_factors.as_mutable_span().slice(dst_points));
358 length_parameterize::sample_uniform(to_lengths,
359 !to_curves_cyclic[i_to_curve],
360 to_sample_indices.as_mutable_span().slice(dst_points),
361 to_sample_factors.as_mutable_span().slice(dst_points));
368 for (
const int i_attribute : point_attributes.dst.index_range()) {
370 if (!point_attributes.dst[i_attribute]) {
374 const GSpan src_from = point_attributes.src_from[i_attribute];
375 const GSpan src_to = point_attributes.src_to[i_attribute];
376 GMutableSpan dst = point_attributes.dst[i_attribute].span;
380 if (!src_from.is_empty() && !src_to.is_empty()) {
381 GArray<> from_samples(dst.type(), dst.size());
382 GArray<> to_samples(dst.type(), dst.size());
383 sample_curve_attribute(from_curves,
391 sample_curve_attribute(to_curves,
399 mix_arrays(from_samples, to_samples, mix_factor, dst_curve_mask, dst_points_by_curve, dst);
401 else if (!src_from.is_empty()) {
411 else if (!src_to.is_empty()) {
424 Array<float3> from_samples(dst_positions.size());
425 Array<float3> to_samples(dst_positions.size());
431 from_evaluated_positions,
435 from_samples.as_mutable_span());
439 to_evaluated_positions,
443 to_samples.as_mutable_span());
446 to_samples.as_span(),
453 for (
const int i_attribute : curve_attributes.dst.index_range()) {
455 if (!curve_attributes.dst[i_attribute]) {
459 const GSpan src_from = curve_attributes.src_from[i_attribute];
460 const GSpan src_to = curve_attributes.src_to[i_attribute];
461 GMutableSpan dst = curve_attributes.dst[i_attribute].span;
465 const bool can_mix_attribute =
ELEM(bke::cpp_type_to_custom_data_type(dst.type()),
469 if (can_mix_attribute && !src_from.is_empty() && !src_to.is_empty()) {
470 GArray<> from_samples(dst.type(), dst.size());
471 GArray<> to_samples(dst.type(), dst.size());
472 array_utils::copy(GVArray::ForSpan(src_from), dst_curve_mask, from_samples);
473 array_utils::copy(GVArray::ForSpan(src_to), dst_curve_mask, to_samples);
474 mix_arrays(from_samples, to_samples, mix_factor, dst_curve_mask, dst);
476 else if (!src_from.is_empty()) {
477 array_utils::copy(GVArray::ForSpan(src_from), dst_curve_mask, dst);
479 else if (!src_to.is_empty()) {
480 array_utils::copy(GVArray::ForSpan(src_to), dst_curve_mask, dst);
484 for (bke::GSpanAttributeWriter &attribute : point_attributes.dst) {
487 for (bke::GSpanAttributeWriter &attribute : curve_attributes.dst) {