From 64a2f9806238464895c726af9a96760377b3ebb6 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 19 Jun 2018 10:43:54 +0200 Subject: Fix (unreported) unauthorized relesing of derived_final DM in paint projection code. NEVER free yourself DM returned by mesh_get_derived_final(), it's always to one assigned to ob->derived_final! --- source/blender/editors/sculpt_paint/paint_image_proj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/sculpt_paint/paint_image_proj.c') diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 9843629b706..6a37b3df47f 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -3442,7 +3442,7 @@ static bool proj_paint_state_dm_init(ProjPaintState *ps) ps->dm = mesh_get_derived_final( ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE | (ps->do_face_sel ? CD_ORIGINDEX : 0)); - ps->dm_release = true; + ps->dm_release = false; } if (!CustomData_has_layer(&ps->dm->loopData, CD_MLOOPUV)) { -- cgit v1.2.3 From b09a8203e98ebdae78d325453641f33a608cfaaa Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 19 Jun 2018 10:48:37 +0200 Subject: Cleanup DM generation code for ProjPaint. Two branches were actually doing essentially the same thing here, no need to artificially complicate things. ;) --- source/blender/editors/sculpt_paint/paint_image_proj.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'source/blender/editors/sculpt_paint/paint_image_proj.c') diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 6a37b3df47f..2ecd6500fdf 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -3428,20 +3428,13 @@ static bool proj_paint_state_dm_init(ProjPaintState *ps) /* Workaround for subsurf selection, try the display mesh first */ if (ps->source == PROJ_SRC_IMAGE_CAM) { /* using render mesh, assume only camera was rendered from */ - ps->dm = mesh_create_derived_render(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE); + ps->dm = mesh_create_derived_render(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MLOOPUV | CD_MASK_MTFACE); ps->dm_release = true; } - else if (ps->ob->derivedFinal && - CustomData_has_layer(&ps->ob->derivedFinal->loopData, CD_MLOOPUV) && - (ps->do_face_sel == false || CustomData_has_layer(&ps->ob->derivedFinal->polyData, CD_ORIGINDEX))) - { - ps->dm = ps->ob->derivedFinal; - ps->dm_release = false; - } else { ps->dm = mesh_get_derived_final( ps->scene, ps->ob, - ps->scene->customdata_mask | CD_MASK_MTFACE | (ps->do_face_sel ? CD_ORIGINDEX : 0)); + ps->scene->customdata_mask | CD_MASK_MLOOPUV | CD_MASK_MTFACE | (ps->do_face_sel ? CD_ORIGINDEX : 0)); ps->dm_release = false; } -- cgit v1.2.3