Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/armature_deform.c')
-rw-r--r--source/blender/blenkernel/intern/armature_deform.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/armature_deform.c b/source/blender/blenkernel/intern/armature_deform.c
index bca5503c8d2..770a90b7190 100644
--- a/source/blender/blenkernel/intern/armature_deform.c
+++ b/source/blender/blenkernel/intern/armature_deform.c
@@ -49,6 +49,7 @@
#include "BKE_armature.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
+#include "BKE_gpencil.h"
#include "BKE_lattice.h"
#include "DEG_depsgraph_build.h"
@@ -487,6 +488,7 @@ static void armature_deform_coords_impl(const Object *ob_arm,
bool use_dverts = false;
int armature_def_nr;
int cd_dvert_offset = -1;
+ MDeformVert *temp_dverts = NULL;
/* in editmode, or not an armature */
if (arm->edbo || (ob_arm->pose == NULL)) {
@@ -523,9 +525,33 @@ static void armature_deform_coords_impl(const Object *ob_arm,
}
}
else if (ob_target->type == OB_GPENCIL) {
- dverts = gps_target->dvert;
- if (dverts) {
- dverts_len = gps_target->totpoints;
+ if (GPENCIL_STROKE_TYPE_BEZIER(gps_target)) {
+ bGPDcurve *gpc = gps_target->editcurve;
+ dverts = gpc->dvert;
+ if (dverts != NULL) {
+ dverts_len = gpc->tot_curve_points * 3;
+ temp_dverts = MEM_mallocN(sizeof(MDeformVert) * dverts_len, __func__);
+ for (i = 0; i < gpc->tot_curve_points; i++) {
+ MDeformVert *dvert_src = &gpc->dvert[i];
+ int idx = i * 3;
+ for (int w = 0; w < 3; w++) {
+ MDeformVert *dvert_dst = &temp_dverts[idx + w];
+ memcpy(dvert_dst, dvert_src, sizeof(MDeformVert));
+ if (dvert_src->dw) {
+ dvert_dst->dw = MEM_mallocN(sizeof(MDeformWeight) * dvert_src->totweight,
+ __func__);
+ memcpy(dvert_dst->dw, dvert_src->dw, sizeof(MDeformWeight) * dvert_src->totweight);
+ }
+ }
+ }
+ dverts = temp_dverts;
+ }
+ }
+ else {
+ dverts = gps_target->dvert;
+ if (dverts) {
+ dverts_len = gps_target->totpoints;
+ }
}
}
}
@@ -619,6 +645,15 @@ static void armature_deform_coords_impl(const Object *ob_arm,
if (pchan_from_defbase) {
MEM_freeN(pchan_from_defbase);
}
+
+ if (temp_dverts != NULL) {
+ bGPDcurve *gpc = gps_target->editcurve;
+ for (i = 0; i < gpc->tot_curve_points * 3; i++) {
+ MDeformVert *dvert = &temp_dverts[i];
+ MEM_SAFE_FREE(dvert->dw);
+ }
+ MEM_freeN(temp_dverts);
+ }
}
void BKE_armature_deform_coords_with_gpencil_stroke(const Object *ob_arm,