diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-08-31 17:04:03 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-08-31 17:04:03 +0400 |
commit | 6b2aa6f863cfcc60ba90cf6accd7a302c4133ff3 (patch) | |
tree | 91159431acda24e64ba0107edb0cceeebd190484 /source | |
parent | 533192013fe8983d7e2b6d6b2b58dfe87d2b319a (diff) |
Fix #32408: image editor does not show paint brush circle on loading a .blend
file that has paint mode enabled.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 21 | ||||
-rw-r--r-- | source/blender/editors/util/ed_util.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 7 |
3 files changed, 23 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 953215b83aa..96f1f60a7e5 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5334,12 +5334,25 @@ static void toggle_paint_cursor(bContext *C, int enable) * 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); + } } } diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 6d9f2732d8a..1f34793a972 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -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 @@ void ED_editors_init(bContext *C) ED_object_toggle_modes(C, mode); } } + + /* image editor paint mode */ + ED_space_image_paint_update(wm, sce->toolsettings); } /* frees all editmode stuff */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index ad14c60e532..c4a60dba025 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -531,12 +531,7 @@ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) 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) |