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:
authorBastien Montagne <bastien@blender.org>2020-09-21 15:24:55 +0300
committerBastien Montagne <bastien@blender.org>2020-09-21 15:24:55 +0300
commit82aa300e1ce47f2b77e868ba43ffeaff0dc7bf96 (patch)
tree9c5c3f745f3872a269b8d6f4bfb99df3064028fd /source/blender/editors/sculpt_paint
parent154752243dd726676d5e7c3c2ddf6a9dced678e2 (diff)
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'.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c16
1 files changed, 6 insertions, 10 deletions
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;
}
}