[Bf-blender-cvs] [6d5ba885717] temp-gpencil-bezier-stroke-type: GPencil: More work to copy weights

Antonio Vazquez noreply at git.blender.org
Tue Apr 6 16:52:25 CEST 2021


Commit: 6d5ba88571755735a4e4e359cdd015ab6012aab4
Author: Antonio Vazquez
Date:   Tue Apr 6 16:52:20 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB6d5ba88571755735a4e4e359cdd015ab6012aab4

GPencil: More work to copy weights

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

M	source/blender/blenkernel/intern/armature_deform.c

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

diff --git a/source/blender/blenkernel/intern/armature_deform.c b/source/blender/blenkernel/intern/armature_deform.c
index de28aeb47fc..fdd8d304258 100644
--- a/source/blender/blenkernel/intern/armature_deform.c
+++ b/source/blender/blenkernel/intern/armature_deform.c
@@ -527,11 +527,17 @@ static void armature_deform_coords_impl(const Object *ob_arm,
         if (dverts) {
           dverts_len = gpc->tot_curve_points * 3;
           temp_dverts = MEM_mallocN(sizeof(MDeformVert) * dverts_len, __func__);
-          for (int i = 0; i < gpc->tot_curve_points; i++) {
+          for (i = 0; i < gpc->tot_curve_points; i++) {
             int idx = i * 3;
-            MDeformVert *dvert = &gpc->dvert[i];
-            MDeformVert *temp_dvert = &temp_dverts[idx];
-            // TODO: Here copy the weights
+            for (int w = 0; w < 3; w++) {
+              MDeformVert *dvert = &gpc->dvert[i];
+              MDeformVert *temp_dvert = &temp_dverts[idx + w];
+              memcpy(temp_dvert, dvert, sizeof(MDeformVert));
+              if (dvert->dw) {
+                temp_dvert->dw = MEM_mallocN(sizeof(MDeformWeight) * dvert->totweight, __func__);
+                memcpy(temp_dvert->dw, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
+              }
+            }
           }
         }
       }



More information about the Bf-blender-cvs mailing list