diff options
author | Hans Goudey <h.goudey@me.com> | 2022-02-28 18:46:34 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-02-28 18:46:34 +0300 |
commit | 9ec12c26f16ea3da1e6de95d5d5daf1057464830 (patch) | |
tree | 708e542d5d4de0efdda7b9a54def6b25b6b64039 /source/blender/blenkernel/intern/mesh_convert.cc | |
parent | 81bb86c7506c0ae5f07780a63f954a8416a0d4e6 (diff) |
Geometry Nodes: Begin conversion to new curves
This commit changes `CurveComponent` to store the new curve
type by adding conversions to and from `CurveEval` in most nodes.
This will temporarily make performance of curves in geometry nodes
much worse, but as functionality is implemented for the new type
and it is used in more places, performance will become better than
before.
We still use `CurveEval` for drawing curves, because the new `Curves`
data-block has no evaluated points yet. So the `Curve` ID is still
generated for rendering in the same way as before. It's also still
needed for drawing curve object edit mode overlays.
The old curve component isn't removed yet, because it is still used
to implement the conversions to and from `CurveEval`.
A few more attributes are added to make this possible:
- `nurbs_weight`: The weight for each control point on NURBS curves.
- `nurbs_order`: The order of the NURBS curve
- `knots_mode`: Necessary for conversion, not defined yet.
- `handle_type_{left/right}`: An 8 bit integer attribute.
Differential Revision: https://developer.blender.org/D14145
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_convert.cc')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_convert.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/mesh_convert.cc b/source/blender/blenkernel/intern/mesh_convert.cc index 5af599f0302..6b5c04ac25e 100644 --- a/source/blender/blenkernel/intern/mesh_convert.cc +++ b/source/blender/blenkernel/intern/mesh_convert.cc @@ -953,7 +953,7 @@ static const Mesh *get_evaluated_mesh_from_object(const Object *object) return nullptr; } -static const CurveEval *get_evaluated_curve_from_object(const Object *object) +static const Curves *get_evaluated_curves_from_object(const Object *object) { GeometrySet *geometry_set_eval = object->runtime.geometry_set_eval; if (geometry_set_eval) { @@ -968,8 +968,9 @@ static Mesh *mesh_new_from_evaluated_curve_type_object(const Object *evaluated_o if (mesh) { return BKE_mesh_copy_for_eval(mesh, false); } - const CurveEval *curve = get_evaluated_curve_from_object(evaluated_object); - if (curve) { + const Curves *curves = get_evaluated_curves_from_object(evaluated_object); + if (curves) { + std::unique_ptr<CurveEval> curve = curves_to_curve_eval(*curves); return blender::bke::curve_to_wire_mesh(*curve); } return nullptr; |