Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/geometry_component_curve.cc
| Show First 20 Lines • Show All 848 Lines • ▼ Show 20 Lines | public: | ||||
| GVMutableArrayPtr try_get_for_write(GeometryComponent &component) const final | GVMutableArrayPtr try_get_for_write(GeometryComponent &component) const final | ||||
| { | { | ||||
| CurveEval *curve = get_curve_from_component_for_write(component); | CurveEval *curve = get_curve_from_component_for_write(component); | ||||
| if (curve == nullptr) { | if (curve == nullptr) { | ||||
| return {}; | return {}; | ||||
| } | } | ||||
| bool curve_has_bezier_spline = false; | |||||
| for (SplinePtr &spline : curve->splines()) { | |||||
| if (spline->type() == Spline::Type::Bezier) { | |||||
| curve_has_bezier_spline = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| /* Use the regular position virtual array when there aren't any Bezier splines | /* Use the regular position virtual array when there aren't any Bezier splines | ||||
| * to avoid the overhead of checking the spline type for every point. */ | * to avoid the overhead of checking the spline type for every point. */ | ||||
| if (!curve_has_bezier_spline) { | if (!curve->has_spline_with_type(Spline::Type::Bezier)) { | ||||
| return BuiltinPointAttributeProvider<float3>::try_get_for_write(component); | return BuiltinPointAttributeProvider<float3>::try_get_for_write(component); | ||||
| } | } | ||||
| /* Changing the positions requires recalculation of cached evaluated data in many cases. | /* Changing the positions requires recalculation of cached evaluated data in many cases. | ||||
| * This could set more specific flags in the future to avoid unnecessary recomputation. */ | * This could set more specific flags in the future to avoid unnecessary recomputation. */ | ||||
| for (SplinePtr &spline : curve->splines()) { | for (SplinePtr &spline : curve->splines()) { | ||||
| spline->mark_cache_invalid(); | spline->mark_cache_invalid(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 329 Lines • Show Last 20 Lines | |||||