Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/curve_eval.cc
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | blender::Span<SplinePtr> CurveEval::splines() const | ||||
| return splines_; | return splines_; | ||||
| } | } | ||||
| blender::MutableSpan<SplinePtr> CurveEval::splines() | blender::MutableSpan<SplinePtr> CurveEval::splines() | ||||
| { | { | ||||
| return splines_; | return splines_; | ||||
| } | } | ||||
| /** | |||||
| * \return True if the curve contains a spline with the given type. | |||||
| * | |||||
| * \note If you are looping over all of the splines in the same scope anyway, | |||||
| * it's better to avoid calling this function, in case there are many splines. | |||||
| */ | |||||
| bool CurveEval::has_spline_with_type(const Spline::Type type) const | |||||
| { | |||||
| for (const SplinePtr &spline : this->splines()) { | |||||
| if (spline->type() == type) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| void CurveEval::resize(const int size) | void CurveEval::resize(const int size) | ||||
| { | { | ||||
| splines_.resize(size); | splines_.resize(size); | ||||
| attributes.reallocate(size); | attributes.reallocate(size); | ||||
| } | } | ||||
| /** | /** | ||||
| * \warning Call #reallocate on the spline's attributes after adding all splines. | * \warning Call #reallocate on the spline's attributes after adding all splines. | ||||
| ▲ Show 20 Lines • Show All 271 Lines • ▼ Show 20 Lines | spline->attributes.foreach_attribute( | ||||
| /* Attributes on different splines should all have the same type. */ | /* Attributes on different splines should all have the same type. */ | ||||
| BLI_assert(meta_data == *map_data); | BLI_assert(meta_data == *map_data); | ||||
| }); | }); | ||||
| return true; | return true; | ||||
| }, | }, | ||||
| ATTR_DOMAIN_POINT); | ATTR_DOMAIN_POINT); | ||||
| } | } | ||||
| #endif | #endif | ||||
| } | } | ||||
| No newline at end of file | |||||