Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
| Show First 20 Lines • Show All 311 Lines • ▼ Show 20 Lines | case Spline::Type::NURBS: { | ||||
| const NURBSpline &src = static_cast<const NURBSpline &>(spline); | const NURBSpline &src = static_cast<const NURBSpline &>(spline); | ||||
| NURBSpline &dst = static_cast<NURBSpline &>(r_spline); | NURBSpline &dst = static_cast<NURBSpline &>(r_spline); | ||||
| copy_data(src.weights(), dst.weights(), mask); | copy_data(src.weights(), dst.weights(), mask); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void copy_dynamic_attributes(const CustomDataAttributes &src, | void copy_all_attributes_with_mask(const CustomDataAttributes &src, | ||||
| CustomDataAttributes &dst, | CustomDataAttributes &dst, | ||||
| const IndexMask mask) | const IndexMask mask) | ||||
| { | { | ||||
| src.foreach_attribute( | src.foreach_attribute( | ||||
| [&](const AttributeIDRef &attribute_id, const AttributeMetaData &meta_data) { | [&](const AttributeIDRef &attribute_id, const AttributeMetaData &meta_data) { | ||||
| std::optional<GSpan> src_attribute = src.get_for_read(attribute_id); | std::optional<GSpan> src_attribute = src.get_for_read(attribute_id); | ||||
| BLI_assert(src_attribute); | BLI_assert(src_attribute); | ||||
| if (!dst.create(attribute_id, meta_data.data_type)) { | if (!dst.create(attribute_id, meta_data.data_type)) { | ||||
| /* Since the source spline of the same type had the attribute, adding it should work. | /* Since the source spline of the same type had the attribute, adding it should work. | ||||
| Show All 18 Lines | |||||
| * multiple newer splines. | * multiple newer splines. | ||||
| */ | */ | ||||
| static SplinePtr spline_delete(const Spline &spline, const IndexMask mask) | static SplinePtr spline_delete(const Spline &spline, const IndexMask mask) | ||||
| { | { | ||||
| SplinePtr new_spline = spline.copy_only_settings(); | SplinePtr new_spline = spline.copy_only_settings(); | ||||
| new_spline->resize(mask.size()); | new_spline->resize(mask.size()); | ||||
| spline_copy_builtin_attributes(spline, *new_spline, mask); | spline_copy_builtin_attributes(spline, *new_spline, mask); | ||||
| copy_dynamic_attributes(spline.attributes, new_spline->attributes, mask); | copy_all_attributes_with_mask(spline.attributes, new_spline->attributes, mask); | ||||
| return new_spline; | return new_spline; | ||||
| } | } | ||||
| static std::unique_ptr<CurveEval> curve_separate(const CurveEval &input_curve, | static std::unique_ptr<CurveEval> curve_separate(const CurveEval &input_curve, | ||||
| const Span<bool> selection, | const Span<bool> selection, | ||||
| const AttributeDomain selection_domain, | const AttributeDomain selection_domain, | ||||
| const bool invert) | const bool invert) | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | else { | ||||
| } | } | ||||
| } | } | ||||
| if (copied_splines.is_empty()) { | if (copied_splines.is_empty()) { | ||||
| return {}; | return {}; | ||||
| } | } | ||||
| output_curve->attributes.reallocate(output_curve->splines().size()); | output_curve->attributes.reallocate(output_curve->splines().size()); | ||||
| copy_dynamic_attributes( | copy_all_attributes_with_mask( | ||||
| input_curve.attributes, output_curve->attributes, IndexMask(copied_splines)); | input_curve.attributes, output_curve->attributes, IndexMask(copied_splines)); | ||||
| return output_curve; | return output_curve; | ||||
| } | } | ||||
| static void separate_curve_selection(GeometrySet &geometry_set, | static void separate_curve_selection(GeometrySet &geometry_set, | ||||
| const Field<bool> &selection_field, | const Field<bool> &selection_field, | ||||
| const AttributeDomain selection_domain, | const AttributeDomain selection_domain, | ||||
| ▲ Show 20 Lines • Show All 831 Lines • Show Last 20 Lines | |||||