diff options
author | Hans Goudey <h.goudey@me.com> | 2022-10-31 21:09:25 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-10-31 21:09:25 +0300 |
commit | 6a3af76fbe92c9b0a4687b020131e1a03c50d117 (patch) | |
tree | acac80af2a8482166a0b3a4c40121149eb10f9a6 | |
parent | c39eb09ae587e1d9365b14d7c28b98b4a85f297f (diff) |
Geometry Nodes: Use attribute API in deform curves on surface node
Retrieve the surface UV coordinates with the attribute API instead of
the helper function. This allows more flexibility of data types (and
domains), which is helpful especially because geometry nodes
can't write 2D vectors yet.
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc index 0932624bdc3..dabd2a1a9f2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc @@ -310,7 +310,8 @@ static void node_geo_exec(GeoNodeExecParams params) ATTR_DOMAIN_CORNER); const VArraySpan<float3> rest_positions = mesh_attributes_eval.lookup<float3>(rest_position_name, ATTR_DOMAIN_POINT); - const Span<float2> surface_uv_coords = curves.surface_uv_coords(); + const VArraySpan<float2> surface_uv_coords = curves.attributes().lookup_or_default( + "surface_uv_coordinate", ATTR_DOMAIN_CURVE, float2(0)); const Span<MLoopTri> looptris_orig = surface_mesh_orig->looptris(); const Span<MLoopTri> looptris_eval = surface_mesh_eval->looptris(); @@ -379,7 +380,8 @@ static void node_geo_exec(GeoNodeExecParams params) invalid_uv_count); /* Then also deform edit curve information for use in sculpt mode. */ const CurvesGeometry &curves_orig = CurvesGeometry::wrap(edit_hints->curves_id_orig.geometry); - const Span<float2> surface_uv_coords_orig = curves_orig.surface_uv_coords(); + const VArraySpan<float2> surface_uv_coords_orig = curves_orig.attributes().lookup_or_default( + "surface_uv_coordinate", ATTR_DOMAIN_CURVE, float2(0)); if (!surface_uv_coords_orig.is_empty()) { deform_curves(curves_orig, *surface_mesh_orig, |