diff options
author | Hans Goudey <h.goudey@me.com> | 2022-07-05 23:51:12 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-07-05 23:51:12 +0300 |
commit | 7688f0ace7a6c45aaa8304d2a26a760be0056aa6 (patch) | |
tree | d101d9e6321d5e4acf9a4f4f3c23ffd00ea32658 /source/blender/geometry/GEO_set_curve_type.hh | |
parent | c52a18abf84b29ca19aa79ef1ce580e67a437779 (diff) |
Curves: Move type conversion to the geometry module
This helps to separate concerns, and makes the functionality
available for edit mode.
Diffstat (limited to 'source/blender/geometry/GEO_set_curve_type.hh')
-rw-r--r-- | source/blender/geometry/GEO_set_curve_type.hh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/geometry/GEO_set_curve_type.hh b/source/blender/geometry/GEO_set_curve_type.hh new file mode 100644 index 00000000000..f7ac8be5889 --- /dev/null +++ b/source/blender/geometry/GEO_set_curve_type.hh @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#include "DNA_curves_types.h" + +#include "BLI_function_ref.hh" +#include "BLI_index_mask.hh" + +struct Curves; +struct CurveComponent; + +namespace blender::bke { +class CurvesGeometry; +} + +namespace blender::geometry { + +/** + * Try the conversion to the #dst_type-- avoiding the majority of the work done in + * #convert_curves by modifying an existing object in place rather than creating a new one. + * + * \note This function is necessary because attributes do not have proper support for CoW. + * + * \param get_writable_curves_fn: Should return the write-able curves to change directly if + * possible. This is a function in order to avoid the cost of retrieval when unnecessary. + */ +bool try_curves_conversion_in_place(IndexMask selection, + CurveType dst_type, + FunctionRef<Curves &()> get_writable_curves_fn); + +/** + * Change the types of the selected curves, potentially changing the total point count. + */ +Curves *convert_curves(const CurveComponent &src_component, + const bke::CurvesGeometry &src_curves, + IndexMask selection, + CurveType dst_type); + +} // namespace blender::geometry |