Commit: 1fbd300adb9a1b371abe9b5b7f24fa6de1fbe6f4
Author: Hans Goudey
Date:   Thu Oct 13 18:21:39 2022 -0500
Branches: master
https://developer.blender.org/rB1fbd300adb9a1b371abe9b5b7f24fa6de1fbe6f4

Fix: Curves sculpt adding resets attribute values

Error in 9088a1f4764f371f7.

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

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

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

diff --git a/source/blender/geometry/intern/add_curves_on_mesh.cc 
b/source/blender/geometry/intern/add_curves_on_mesh.cc
index 25935691bf4..a03c9b994a9 100644
--- a/source/blender/geometry/intern/add_curves_on_mesh.cc
+++ b/source/blender/geometry/intern/add_curves_on_mesh.cc
@@ -385,10 +385,11 @@ AddCurvesOnMeshOutputs add_curves_on_mesh(CurvesGeometry 
&curves,
           return true;
         }
         bke::GSpanAttributeWriter attribute = 
attributes.lookup_for_write_span(id);
-        const int new_elements_num = attribute.domain == ATTR_DOMAIN_POINT ? 
new_points_num :
-                                                                             
new_curves_num;
+        /* The new elements are added at the end of the array. */
+        const int old_elements_num = attribute.domain == ATTR_DOMAIN_POINT ? 
old_points_num :
+                                                                             
old_curves_num;
         const CPPType &type = attribute.span.type();
-        GMutableSpan new_data = attribute.span.take_back(new_elements_num);
+        GMutableSpan new_data = attribute.span.drop_front(old_elements_num);
         type.fill_assign_n(type.default_value(), new_data.data(), 
new_data.size());
         attribute.finish();
         return true;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to