From 82aa300e1ce47f2b77e868ba43ffeaff0dc7bf96 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 21 Sep 2020 14:24:55 +0200 Subject: Fix T79373: Forbid painting on linked image from 3DView. As noted by @lichtwerk (thanks), one can have a local object and/or material using a linked image data-block, this case needs some different handling to prevent painting on such linked image. For now, tweak `BKE_paint_proj_mesh_data_check` (eeeek, that name prefix!) to consider paintslots with linked image as 'non-existing'. --- source/blender/editors/sculpt_paint/paint_image_proj.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index bc1080208a5..0c07b84426b 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -6333,19 +6333,15 @@ bool BKE_paint_proj_mesh_data_check( for (int i = 1; i < ob->totcol + 1; i++) { Material *ma = BKE_object_material_get(ob, i); - if (ma) { + if (ma && !ID_IS_LINKED(ma)) { hasmat = true; - if (!ma->texpaintslot) { + if (ma->texpaintslot == NULL) { /* refresh here just in case */ BKE_texpaint_slot_refresh_cache(scene, ma); - - /* if still no slots, we have to add */ - if (ma->texpaintslot) { - hastex = true; - break; - } } - else { + if (ma->texpaintslot != NULL && + (ma->texpaintslot[ma->paint_active_slot].ima == NULL || + !ID_IS_LINKED(ma->texpaintslot[ma->paint_active_slot].ima))) { hastex = true; break; } @@ -6354,7 +6350,7 @@ bool BKE_paint_proj_mesh_data_check( } } else if (imapaint->mode == IMAGEPAINT_MODE_IMAGE) { - if (imapaint->canvas == NULL) { + if (imapaint->canvas == NULL || ID_IS_LINKED(imapaint->canvas)) { hastex = false; } } -- cgit v1.2.3