Revision: 40770
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40770
Author:   nazgul
Date:     2011-10-03 11:04:05 +0000 (Mon, 03 Oct 2011)
Log Message:
-----------
Fix #28780: Undo while painting image sequences issue

- Store imbuf file path in UndoImageTile structure, so imbuf can be verified
  before applying titles on it.
- If current image's imbuf file path isn't equal to file path stored in
  undo block, search for imbuf in ima->ibufs.

  Probably it can be optimized, but storing all settings which defines
  needed imbuf (image source type, offset, image file name, current
  scene frame and so messes up undo code and requires deeper changes
  which probably better not to start on bcon4).

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 08:01:07 UTC (rev 40769)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c     
2011-10-03 11:04:05 UTC (rev 40770)
@@ -356,6 +356,7 @@
        struct UndoImageTile *next, *prev;
 
        char idname[MAX_ID_NAME];       /* name instead of pointer*/
+       char ibufname[IB_FILENAME_SIZE];
 
        void *rect;
        int x, y;
@@ -389,7 +390,7 @@
        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)
+               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 (*tmpibuf==NULL)
@@ -404,6 +405,8 @@
        allocsize *= (ibuf->rect_float)? sizeof(float): sizeof(char);
        tile->rect= MEM_mapallocN(allocsize, "UndeImageTile.rect");
 
+       strcpy(tile->ibufname, ibuf->name);
+
        undo_copy_tile(tile, *tmpibuf, ibuf, 0);
        undo_paint_push_count_alloc(UNDO_PAINT_IMAGE, allocsize);
 
@@ -433,6 +436,21 @@
 
                ibuf= BKE_image_get_ibuf(ima, NULL);
 
+               if(ima && 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
+                          matched file name in list of already loaded images */
+
+                       ibuf= ima->ibufs.first;
+                       while(ibuf) {
+                               if(strcmp(tile->ibufname, ibuf->name)==0)
+                                       break;
+
+                               ibuf= ibuf->next;
+                       }
+               }
+
                if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
                        continue;
 

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

Reply via email to