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:
authorLukas Stockner <lukas.stockner@freenet.de>2019-12-18 02:00:00 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2019-12-18 02:04:47 +0300
commit9a12f97f264e725a350368a87f75181298e47ff3 (patch)
treeaff33e0931a5cf13e972d3715ea6b2d7ca1ffa45 /source/blender/editors/sculpt_paint/paint_image_proj.c
parente6a5e5077bfcca8f56fd7feb914af3c8db72bb50 (diff)
Fix T72487: Painting on unitialized UDIM tile crashes
The UDIM commit accidentally removed the check for whether an ImBuf exists before trying to paint on it.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image_proj.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 6a67c469955..d649f5017eb 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -748,11 +748,7 @@ static bool project_paint_PickColor(const ProjPaintState *ps,
iuser.tile = tile_number;
ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
if (ibuf == NULL) {
- iuser.tile = 0;
- ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
- if (ibuf == NULL) {
- return 0;
- }
+ return false;
}
if (interp) {
@@ -3554,16 +3550,7 @@ static void project_bucket_init(const ProjPaintState *ps,
break;
}
}
- if (ibuf == NULL) {
- /* Failed to find the specific tile, fall back to the primary tile. */
- for (image_index = 0; image_index < ps->image_tot; image_index++) {
- ProjPaintImage *projIma = &ps->projImages[image_index];
- if ((projIma->ima == tpage) && (projIma->iuser.tile == 0)) {
- ibuf = projIma->ibuf;
- break;
- }
- }
- }
+ BLI_assert(ibuf != NULL);
}
/* context switching done */
@@ -4454,11 +4441,19 @@ static void project_paint_prepare_all_faces(ProjPaintState *ps,
}
if (image_index == ps->image_tot) {
- PrepareImageEntry *e = MEM_callocN(sizeof(PrepareImageEntry), "PrepareImageEntry");
- e->ima = tpage;
- e->tile = tile;
- BLI_addtail(&used_images, e);
- ps->image_tot++;
+ ImageUser iuser;
+ BKE_imageuser_default(&iuser);
+ iuser.tile = tile;
+ if (BKE_image_has_ibuf(tpage, &iuser)) {
+ PrepareImageEntry *e = MEM_callocN(sizeof(PrepareImageEntry), "PrepareImageEntry");
+ e->ima = tpage;
+ e->tile = tile;
+ BLI_addtail(&used_images, e);
+ ps->image_tot++;
+ }
+ else {
+ image_index = -1;
+ }
}
tpage_last = tpage;