[Bf-blender-cvs] [82aa300e1ce] master: Fix T79373: Forbid painting on linked image from 3DView.
Bastien Montagne
noreply at git.blender.org
Mon Sep 21 14:29:14 CEST 2020
Commit: 82aa300e1ce47f2b77e868ba43ffeaff0dc7bf96
Author: Bastien Montagne
Date: Mon Sep 21 14:24:55 2020 +0200
Branches: master
https://developer.blender.org/rB82aa300e1ce47f2b77e868ba43ffeaff0dc7bf96
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'.
===================================================================
M 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 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;
}
}
More information about the Bf-blender-cvs
mailing list