From 58f29fc9ab06d7b143ae53fda4afbcd4032240fe Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Mon, 29 Oct 2012 19:47:26 +0000 Subject: Fix: wrong brush drawn in image painting, image editor if uv sculpt is on. Now the correct paint struct is returned and the image zoom is calculated correctly --- source/blender/blenkernel/intern/paint.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/paint.c') diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 5a302cba2ab..36f96045ced 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -36,6 +36,7 @@ #include "DNA_meshdata_types.h" #include "DNA_scene_types.h" #include "DNA_brush_types.h" +#include "DNA_space_types.h" #include "BLI_bitmap.h" #include "BLI_utildefines.h" @@ -87,6 +88,7 @@ Paint *paint_get_active(Scene *sce) Paint *paint_get_active_from_context(const bContext *C) { Scene *sce = CTX_data_scene(C); + SpaceImage *sima; if (sce) { ToolSettings *ts = sce->toolsettings; @@ -95,12 +97,12 @@ Paint *paint_get_active_from_context(const bContext *C) if (sce->basact && sce->basact->object) obact = sce->basact->object; - if (CTX_wm_space_image(C) != NULL) { + if ((sima = CTX_wm_space_image(C)) != NULL) { if (obact && obact->mode == OB_MODE_EDIT) { - if (ts->use_uv_sculpt) - return &ts->uvsculpt->paint; - else + if (sima->mode == SI_MODE_PAINT) return &ts->imapaint.paint; + else if (ts->use_uv_sculpt) + return &ts->uvsculpt->paint; } else { return &ts->imapaint.paint; -- cgit v1.2.3