[Bf-blender-cvs] [19313877999] master: Fix: Curve trim node test failure

Hans Goudey noreply at git.blender.org
Thu Dec 23 01:38:38 CET 2021


Commit: 1931387799919e5a6bb4ebfec8922a6bf6ab3ca5
Author: Hans Goudey
Date:   Wed Dec 22 18:38:30 2021 -0600
Branches: master
https://developer.blender.org/rB1931387799919e5a6bb4ebfec8922a6bf6ab3ca5

Fix: Curve trim node test failure

Caused by 60c59d7d611dfd726. The position wasn't copied into the correct
place on each spline. Somehow I didn't catch that in the tests I ran.

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

M	source/blender/geometry/intern/mesh_to_curve_convert.cc

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

diff --git a/source/blender/geometry/intern/mesh_to_curve_convert.cc b/source/blender/geometry/intern/mesh_to_curve_convert.cc
index 398ce609d55..965c09984fa 100644
--- a/source/blender/geometry/intern/mesh_to_curve_convert.cc
+++ b/source/blender/geometry/intern/mesh_to_curve_convert.cc
@@ -93,13 +93,18 @@ static std::unique_ptr<CurveEval> create_curve_from_vert_indices(
     }
   }
 
+  VArray<float3> mesh_positions = mesh_component.attribute_get_for_read(
+      "position", ATTR_DOMAIN_POINT, float3(0));
+  threading::parallel_for(splines.index_range(), 128, [&](IndexRange range) {
+    for (const int i : range) {
+      copy_attribute_to_points(mesh_positions, vert_indices[i], splines[i]->positions());
+    }
+  });
+
   for (const bke::AttributeIDRef &attribute_id : source_attribute_ids) {
     if (mesh_component.attribute_is_builtin(attribute_id)) {
-      /* Don't copy attributes that are built-in on meshes but not on curves,
-       * except for the position attribute. */
-      if (!(attribute_id == "position")) {
-        continue;
-      }
+      /* Don't copy attributes that are built-in on meshes but not on curves. */
+      continue;
     }
 
     if (!attribute_id.should_be_kept()) {



More information about the Bf-blender-cvs mailing list