Revision: 50289
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50289
Author:   blendix
Date:     2012-08-31 13:04:03 +0000 (Fri, 31 Aug 2012)
Log Message:
-----------
Fix #32408: image editor does not show paint brush circle on loading a .blend
file that has paint mode enabled.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/editors/util/ed_util.c
    trunk/blender/source/blender/makesrna/intern/rna_space.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c     
2012-08-31 12:08:08 UTC (rev 50288)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c     
2012-08-31 13:04:03 UTC (rev 50289)
@@ -5334,12 +5334,25 @@
  * ensure that the cursor is hidden when not in paint mode */
 void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings)
 {
+       wmWindow *win;
+       ScrArea *sa;
        ImagePaintSettings *imapaint = &settings->imapaint;
+       int enabled = FALSE;
 
-       if (!imapaint->paintcursor) {
-               imapaint->paintcursor =
-                   WM_paint_cursor_activate(wm, image_paint_poll,
-                                            brush_drawcursor, NULL);
+       for (win = wm->windows.first; win; win = win->next)
+               for (sa = win->screen->areabase.first; sa; sa = sa->next)
+                       if (sa->spacetype == SPACE_IMAGE)
+                               if (((SpaceImage*)sa->spacedata.first)->mode == 
SI_MODE_PAINT)
+                                       enabled = TRUE;
+
+       if (enabled) {
+               BKE_paint_init(&imapaint->paint, PAINT_CURSOR_TEXTURE_PAINT);
+
+               if (!imapaint->paintcursor) {
+                       imapaint->paintcursor =
+                               WM_paint_cursor_activate(wm, image_paint_poll,
+                                                                               
 brush_drawcursor, NULL);
+               }
        }
 }
 

Modified: trunk/blender/source/blender/editors/util/ed_util.c
===================================================================
--- trunk/blender/source/blender/editors/util/ed_util.c 2012-08-31 12:08:08 UTC 
(rev 50288)
+++ trunk/blender/source/blender/editors/util/ed_util.c 2012-08-31 13:04:03 UTC 
(rev 50289)
@@ -49,6 +49,7 @@
 #include "BKE_packedFile.h"
 
 #include "ED_armature.h"
+#include "ED_image.h"
 #include "ED_mesh.h"
 #include "ED_object.h"
 #include "ED_sculpt.h"
@@ -67,6 +68,7 @@
 
 void ED_editors_init(bContext *C)
 {
+       wmWindowManager *wm = CTX_wm_manager(C);
        Main *bmain = CTX_data_main(C);
        Scene *sce = CTX_data_scene(C);
        Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL;
@@ -86,6 +88,9 @@
                                ED_object_toggle_modes(C, mode);
                }
        }
+
+       /* image editor paint mode */
+       ED_space_image_paint_update(wm, sce->toolsettings);
 }
 
 /* frees all editmode stuff */

Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c    2012-08-31 
12:08:08 UTC (rev 50288)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c    2012-08-31 
13:04:03 UTC (rev 50289)
@@ -531,12 +531,7 @@
 
 static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, 
PointerRNA *ptr)
 {
-       SpaceImage *sima = (SpaceImage *)(ptr->data);
-       if (sima->mode == SI_MODE_PAINT) {
-               BKE_paint_init(&scene->toolsettings->imapaint.paint, 
PAINT_CURSOR_TEXTURE_PAINT);
-
-               ED_space_image_paint_update(bmain->wm.first, 
scene->toolsettings);
-       }
+       ED_space_image_paint_update(bmain->wm.first, scene->toolsettings);
 }
 
 static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr)

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

Reply via email to