diff options
author | Hans Goudey <h.goudey@me.com> | 2022-07-08 23:35:18 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-07-08 23:35:18 +0300 |
commit | 111bf7d76b080555fd524b2b4a138bcad2e5b206 (patch) | |
tree | e9e14ca4102ec0c73261745a9ff7b7aa2de1cc57 /source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc | |
parent | b4db5a93bcf92b731d0e358602816cce2dbbd7cb (diff) | |
parent | 2ee68917287627a3803a8eae91d4d788ac316185 (diff) |
Merge branch 'master' into temp-legacy-mesh-format-option
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc | 24 |
1 files changed, 11 insertions, 13 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 60b5f0383ca..ab7ddfa71f1 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 @@ -252,10 +252,8 @@ static void node_geo_exec(GeoNodeExecParams params) BKE_mesh_wrapper_ensure_mdata(surface_mesh_eval); - MeshComponent mesh_eval; - mesh_eval.replace(surface_mesh_eval, GeometryOwnershipType::ReadOnly); - MeshComponent mesh_orig; - mesh_orig.replace(surface_mesh_orig, GeometryOwnershipType::ReadOnly); + const AttributeAccessor mesh_attributes_eval = bke::mesh_attributes(*surface_mesh_eval); + const AttributeAccessor mesh_attributes_orig = bke::mesh_attributes(*surface_mesh_orig); Curves &curves_id = *curves_geometry.get_curves_for_write(); CurvesGeometry &curves = CurvesGeometry::wrap(curves_id.geometry); @@ -266,7 +264,7 @@ static void node_geo_exec(GeoNodeExecParams params) params.error_message_add(NodeWarningType::Error, message); return; } - if (!mesh_eval.attribute_exists(uv_map_name)) { + if (!mesh_attributes_eval.contains(uv_map_name)) { pass_through_input(); char *message = BLI_sprintfN(TIP_("Evaluated surface missing UV map: %s."), uv_map_name.c_str()); @@ -274,7 +272,7 @@ static void node_geo_exec(GeoNodeExecParams params) MEM_freeN(message); return; } - if (!mesh_orig.attribute_exists(uv_map_name)) { + if (!mesh_attributes_orig.contains(uv_map_name)) { pass_through_input(); char *message = BLI_sprintfN(TIP_("Original surface missing UV map: %s."), uv_map_name.c_str()); @@ -282,7 +280,7 @@ static void node_geo_exec(GeoNodeExecParams params) MEM_freeN(message); return; } - if (!mesh_eval.attribute_exists(rest_position_name)) { + if (!mesh_attributes_eval.contains(rest_position_name)) { pass_through_input(); params.error_message_add(NodeWarningType::Error, TIP_("Evaluated surface missing attribute: rest_position.")); @@ -294,12 +292,12 @@ static void node_geo_exec(GeoNodeExecParams params) TIP_("Curves are not attached to any UV map.")); return; } - const VArraySpan<float2> uv_map_orig = mesh_orig.attribute_get_for_read<float2>( - uv_map_name, ATTR_DOMAIN_CORNER, {0.0f, 0.0f}); - const VArraySpan<float2> uv_map_eval = mesh_eval.attribute_get_for_read<float2>( - uv_map_name, ATTR_DOMAIN_CORNER, {0.0f, 0.0f}); - const VArraySpan<float3> rest_positions = mesh_eval.attribute_get_for_read<float3>( - rest_position_name, ATTR_DOMAIN_POINT, {0.0f, 0.0f, 0.0f}); + const VArraySpan<float2> uv_map_orig = mesh_attributes_orig.lookup<float2>(uv_map_name, + ATTR_DOMAIN_CORNER); + const VArraySpan<float2> uv_map_eval = mesh_attributes_eval.lookup<float2>(uv_map_name, + 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 Span<MLoopTri> looptris_orig{BKE_mesh_runtime_looptri_ensure(surface_mesh_orig), |