Revision: 58760
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58760
Author:   psy-fi
Date:     2013-07-31 09:42:07 +0000 (Wed, 31 Jul 2013)
Log Message:
-----------
* Support undo for bucket fill
* Color correct brush color properly.

Modified Paths:
--------------
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c

Modified: 
branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c   
2013-07-31 09:18:40 UTC (rev 58759)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c   
2013-07-31 09:42:07 UTC (rev 58760)
@@ -1296,11 +1296,13 @@
                Paint *p = BKE_paint_get_active(CTX_data_scene(C));
                Brush *br = BKE_paint_brush(p);
 
-               copy_v3_v3(color, br->rgb);
+               srgb_to_linearrgb_v3_v3(color, br->rgb);
        }
 
        mode = BKE_paintmode_get_active_from_context(C);
 
+       undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
+                             image_undo_restore, image_undo_free);
        switch(mode) {
                case PAINT_TEXTURE_2D:
                        paint_2d_bucket_fill(C, color);
@@ -1311,6 +1313,8 @@
                        break;
        }
 
+       undo_paint_push_end(UNDO_PAINT_IMAGE);
+
        RNA_float_set_array(op->ptr, "color", color);
 
        return OPERATOR_FINISHED;
@@ -1329,7 +1333,7 @@
        ot->poll = image_paint_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER;
+       ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        RNA_def_float_color(ot->srna, "color", 3, NULL, 0.0, 1.0, "Color", 
"Color for bucket fill", 0.0, 1.0);
 }

Modified: 
branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c
===================================================================
--- 
branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c    
    2013-07-31 09:18:40 UTC (rev 58759)
+++ 
branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c    
    2013-07-31 09:42:07 UTC (rev 58760)
@@ -1232,6 +1232,9 @@
 
        ibuf = BKE_image_acquire_ibuf(ima, &sima->iuser, NULL);
 
+       if (!ibuf)
+               return;
+
        do_float = (ibuf->rect_float != NULL);
        /* first check if our image is float. If it is not we should correct 
the colour to
         * be in gamma space */
@@ -1244,6 +1247,9 @@
                color_f[3] = 1.0;
        }
 
+       /* this will be substituted by something else when selection is 
available */
+       imapaint_dirty_region(ima, ibuf, 0, 0, ibuf->x, ibuf->y);
+
        if (do_float) {
                for (; i < ibuf->x; i++) {
                        for (j = 0; j < ibuf->y; j++) {
@@ -1259,11 +1265,10 @@
                }
        }
 
-       ibuf->userflags |= IB_BITMAPDIRTY;
+       imapaint_image_update(sima, ima, ibuf, false);
+       imapaint_clear_partial_redraw();
 
        BKE_image_release_ibuf(ima, ibuf, NULL);
 
-       GPU_free_image(ima);
-
        WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
 }

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

Reply via email to