[Bf-blender-cvs] [6a3af76fbe9] master: Geometry Nodes: Use attribute API in deform curves on surface node

Hans Goudey noreply at git.blender.org
Mon Oct 31 19:23:42 CET 2022


Commit: 6a3af76fbe92c9b0a4687b020131e1a03c50d117
Author: Hans Goudey
Date:   Mon Oct 31 19:09:25 2022 +0100
Branches: master
https://developer.blender.org/rB6a3af76fbe92c9b0a4687b020131e1a03c50d117

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.

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc

===================================================================

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,



More information about the Bf-blender-cvs mailing list