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:
authorAntonioya <blendergit@gmail.com>2018-08-26 17:39:01 +0300
committerAntonioya <blendergit@gmail.com>2018-08-26 17:40:06 +0300
commit1948681440c011ae3008cd5d2a575eb6d45dc7ec (patch)
treec1ae82fe27da01caf3efdeab5d99a6b6e30950d8 /source/blender/editors/gpencil/gpencil_brush.c
parent85aafba04c18a849eda08fe3f7d46a515ba455d6 (diff)
GP: Reduce weight paint data memory footprint
Before, the weight data array was created always, but now only is added when a weight value is assigned. This change was suggested by algorithm, and both agreed it was good idea.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_brush.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index ddce148a3a3..4ab344c7861 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -876,6 +876,9 @@ static bool gp_brush_weight_apply(
tGP_BrushEditData *gso, bGPDstroke *gps, int pt_index,
const int radius, const int co[2])
{
+ /* create dvert */
+ BKE_gpencil_dvert_ensure(gps);
+
bGPDspoint *pt = gps->points + pt_index;
MDeformVert *dvert = gps->dvert + pt_index;
float inf;
@@ -1055,8 +1058,10 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso)
new_stroke = MEM_dupallocN(gps);
new_stroke->points = MEM_dupallocN(gps->points);
- new_stroke->dvert = MEM_dupallocN(gps->dvert);
- BKE_gpencil_stroke_weights_duplicate(gps, new_stroke);
+ if (gps->dvert != NULL) {
+ new_stroke->dvert = MEM_dupallocN(gps->dvert);
+ BKE_gpencil_stroke_weights_duplicate(gps, new_stroke);
+ }
new_stroke->triangles = MEM_dupallocN(gps->triangles);
new_stroke->next = new_stroke->prev = NULL;