diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-10-03 17:01:24 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-10-03 17:01:24 +0400 |
commit | 782499717efa2464b700360ded6193a67a170781 (patch) | |
tree | 1112ce19ac91370d9c3643d9731bac86aedcfcc1 /source/blender | |
parent | 758e34b45d3fd3470e847b972897e6aff50954dd (diff) |
Fix #27532: Undo test texture after painting gives black blocks.
- Do not apply undo tiles on image if source or generated type was changed.
- Added null-check in own recent commit in this area.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index d556ff9797f..36711d14beb 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -360,6 +360,9 @@ typedef struct UndoImageTile { void *rect; int x, y; + + short source; + char gen_type; } UndoImageTile; static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0}; @@ -390,8 +393,9 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int int allocsize; for(tile=lb->first; tile; tile=tile->next) - if(tile->x == x_tile && tile->y == y_tile && strcmp(tile->idname, ima->id.name)==0 && strcmp(tile->ibufname, ibuf->name)==0) - return tile->rect; + if(tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source) + if(strcmp(tile->idname, ima->id.name)==0 && strcmp(tile->ibufname, ibuf->name)==0) + return tile->rect; if (*tmpibuf==NULL) *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect); @@ -407,6 +411,9 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int strcpy(tile->ibufname, ibuf->name); + tile->gen_type= ima->gen_type; + tile->source= ima->source; + undo_copy_tile(tile, *tmpibuf, ibuf, 0); undo_paint_push_count_alloc(UNDO_PAINT_IMAGE, allocsize); @@ -436,7 +443,7 @@ static void image_undo_restore(bContext *C, ListBase *lb) ibuf= BKE_image_get_ibuf(ima, NULL); - if(ima && strcmp(tile->ibufname, ibuf->name)!=0) { + if(ima && ibuf && strcmp(tile->ibufname, ibuf->name)!=0) { /* current ImBuf filename was changed, probably current frame was changed when paiting on image sequence, rather than storing full image user (which isn't so obvious, btw) try to find ImBuf with @@ -448,6 +455,9 @@ static void image_undo_restore(bContext *C, ListBase *lb) if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float)) continue; + if (ima->gen_type != tile->gen_type || ima->source != tile->source) + continue; + undo_copy_tile(tile, tmpibuf, ibuf, 1); GPU_free_image(ima); /* force OpenGL reload */ |