Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc
| Show First 20 Lines • Show All 350 Lines • ▼ Show 20 Lines | static void geometry_set_curve_trim(GeometrySet &geometry_set, | ||||
| CurveEval &curve = *geometry_set.get_curve_for_write(); | CurveEval &curve = *geometry_set.get_curve_for_write(); | ||||
| MutableSpan<SplinePtr> splines = curve.splines(); | MutableSpan<SplinePtr> splines = curve.splines(); | ||||
| threading::parallel_for(splines.index_range(), 128, [&](IndexRange range) { | threading::parallel_for(splines.index_range(), 128, [&](IndexRange range) { | ||||
| for (const int i : range) { | for (const int i : range) { | ||||
| Spline &spline = *splines[i]; | Spline &spline = *splines[i]; | ||||
| /* Currently this node doesn't support cyclic splines, it could in the future though. */ | /* If the spline is cyclic, shut it off if trimming */ | ||||
| if (spline.is_cyclic()) { | if (spline.is_cyclic()) { | ||||
| if (mode == GEO_NODE_CURVE_SAMPLE_FACTOR) { | |||||
| if (starts[i] > 0.0f || ends[i] < 1.0f) { | |||||
| spline.set_cyclic(false); | |||||
| } | |||||
| else { | |||||
| continue; | continue; | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| if (starts[i] > 0.0f || ends[i] < spline.length()) { | |||||
| spline.set_cyclic(false); | |||||
| } | |||||
| else { | |||||
| continue; | |||||
| } | |||||
| } | |||||
| } | |||||
| /* Return a spline with one point instead of implicitly | /* Return a spline with one point instead of implicitly | ||||
| * reversing the spline or switching the parameters. */ | * reversing the spline or switching the parameters. */ | ||||
| if (ends[i] < starts[i]) { | if (ends[i] < starts[i]) { | ||||
| spline.resize(1); | spline.resize(1); | ||||
| continue; | continue; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines | |||||