Revision: 40772
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40772
Author:   nazgul
Date:     2011-10-03 13:01:24 +0000 (Mon, 03 Oct 2011)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c     
2011-10-03 12:56:33 UTC (rev 40771)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c     
2011-10-03 13:01:24 UTC (rev 40772)
@@ -360,6 +360,9 @@
 
        void *rect;
        int x, y;
+
+       short source;
+       char gen_type;
 } UndoImageTile;
 
 static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0};
@@ -390,8 +393,9 @@
        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 @@
 
        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 @@
 
                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 @@
                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 */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to