[Bf-blender-cvs] [509445955c2] gpencil-new-data-proposal: fix stroke insertion in new data structure

Amelie Fondevilla noreply at git.blender.org
Mon Dec 12 18:19:30 CET 2022


Commit: 509445955c24d905e9cf63e7f039bc36985dac1a
Author: Amelie Fondevilla
Date:   Mon Dec 12 18:03:11 2022 +0100
Branches: gpencil-new-data-proposal
https://developer.blender.org/rB509445955c24d905e9cf63e7f039bc36985dac1a

fix stroke insertion in new data structure

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

M	source/blender/blenkernel/intern/gpencil_new_proposal_test.cc

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

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
index 23a4e20a224..a40da2a6719 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
@@ -150,13 +150,16 @@ static void insert_new_stroke_new_gpencil_data(GPFrame &gpf,
                                                float *position,
                                                float *pressure)
 {
+  int stroke_index{gpf.strokes_num()};
   gpf.add_new_stroke(point_num);
   CurvesGeometry &curves = gpf.strokes_as_curves();
+
   int point_index{0};
-  for (float3 &pos : curves.positions_for_write()) {
-    pos.x = position[3 * point_index];
-    pos.y = position[3 * point_index + 1];
-    pos.z = position[3 * point_index + 2];
+  MutableSpan<float3> pos = curves.positions_for_write();
+  for (int point_index_in_curve : curves.points_for_curve(stroke_index)) {
+    pos[point_index_in_curve].x = position[3 * point_index];
+    pos[point_index_in_curve].y = position[3 * point_index + 1];
+    pos[point_index_in_curve].z = position[3 * point_index + 2];
     ++point_index;
   }
 }



More information about the Bf-blender-cvs mailing list