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:
authorAntonio Vazquez <blendergit@gmail.com>2022-05-30 16:41:07 +0300
committerAntonio Vazquez <blendergit@gmail.com>2022-05-30 16:42:08 +0300
commit70171cdfdfd80329f31844bf2b31cfc4dc1376ca (patch)
treeb3d6a387095a0e3a22a610dbb4d725eb4964e586 /source/blender
parent24e74f8bef813820076cce08635e7c4cb3f2da13 (diff)
Fix T98488: GPencil weightpaint not visible if first point is no weight
The problem was because the check was done with the total weights of the first element of the array and if this was null or 0, the weights were not duplicated. As this bug was introduced fixing T97150 due a problem in the weight data, now instead to duplicate all stroke data to create the perimeter for the PDF/SVG, only the points are duplicated because the weights are not needed. This fix the original bug and also reduce the memory used by the export process.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c2
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.cc9
2 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 84621be1960..699f8b356bd 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -867,7 +867,7 @@ bGPDstroke *BKE_gpencil_stroke_duplicate(bGPDstroke *gps_src,
if (dup_points) {
gps_dst->points = MEM_dupallocN(gps_src->points);
- if ((gps_src->dvert != NULL) && (gps_src->dvert->totweight > 0)) {
+ if (gps_src->dvert != NULL) {
gps_dst->dvert = MEM_dupallocN(gps_src->dvert);
BKE_gpencil_stroke_weights_duplicate(gps_src, gps_dst);
}
diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc b/source/blender/blenkernel/intern/gpencil_geom.cc
index dd22d64aee1..792474d30ea 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -4209,7 +4209,14 @@ bGPDstroke *BKE_gpencil_stroke_perimeter_from_view(struct RegionView3D *rv3d,
if (gps->totpoints == 0) {
return nullptr;
}
- bGPDstroke *gps_temp = BKE_gpencil_stroke_duplicate(gps, true, false);
+ /* Duplicate only points and fill data. Weight and Curve are not needed. */
+ bGPDstroke *gps_temp = (bGPDstroke *)MEM_dupallocN(gps);
+ gps_temp->prev = gps_temp->next = nullptr;
+ gps_temp->triangles = (bGPDtriangle *)MEM_dupallocN(gps->triangles);
+ gps_temp->points = (bGPDspoint *)MEM_dupallocN(gps->points);
+ gps_temp->dvert = nullptr;
+ gps_temp->editcurve = nullptr;
+
const bool cyclic = ((gps_temp->flag & GP_STROKE_CYCLIC) != 0);
/* If Cyclic, add a new point. */