diff options
author | Hans Goudey <h.goudey@me.com> | 2022-07-19 18:14:46 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-07-19 18:16:30 +0300 |
commit | 6a1ab4747b7758017721cb191046a9db800f7894 (patch) | |
tree | a3e28d26c96c2070b231bcb6c5f6a9b0409361aa /source/blender/blenkernel/intern/curves_utils.cc | |
parent | 9246ff373a19df24255d924979c78793f97b2834 (diff) |
Geometry Nodes: Copy parameters when copying a curves data-block
Previously, things like materials, symmetry, and selection options
stored on `Curves` weren't copied to the result in nodes like the
subdivide and resample nodes. Now they are, which fixes some
unexpected behavior and allows visualization of the sculpt mode
selection.
In the realize instances and join nodes the behavior is the same as
for meshes, the parameters are taken from the first (top) input.
I also refactored some functions to return a `CurvesGeometry` by-value,
which makes it the responsibility of the node to copy the parameters.
That should make the algorithms more reusable in other situations.
Differential Revision: https://developer.blender.org/D15408
Diffstat (limited to 'source/blender/blenkernel/intern/curves_utils.cc')
-rw-r--r-- | source/blender/blenkernel/intern/curves_utils.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curves_utils.cc b/source/blender/blenkernel/intern/curves_utils.cc index f7db60ee588..d98832e796c 100644 --- a/source/blender/blenkernel/intern/curves_utils.cc +++ b/source/blender/blenkernel/intern/curves_utils.cc @@ -84,6 +84,18 @@ void fill_points(const CurvesGeometry &curves, }); } +bke::CurvesGeometry copy_only_curve_domain(const bke::CurvesGeometry &src_curves) +{ + bke::CurvesGeometry dst_curves(0, src_curves.curves_num()); + CustomData_copy(&src_curves.curve_data, + &dst_curves.curve_data, + CD_MASK_ALL, + CD_DUPLICATE, + src_curves.curves_num()); + dst_curves.runtime->type_counts = src_curves.runtime->type_counts; + return dst_curves; +} + IndexMask indices_for_type(const VArray<int8_t> &types, const std::array<int, CURVE_TYPES_NUM> &type_counts, const CurveType type, |