diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2013-03-03 20:33:39 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2013-03-03 20:33:39 +0400 |
commit | f4320ad2edc5af1d11067d11533bf54ea6003dc4 (patch) | |
tree | 722ca15f378501318734433349977b52e1f1b5b7 /source/blender/editors/sculpt_paint/paint_image.c | |
parent | e80b0db58c30fa07544508abaa4f93d023f90d54 (diff) |
Cleanup, move uv sculpt specific code to sculpt_uv.c. Also rename
brush_drawcursor to a more indicative of its users name until paint
cursor unification is done.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 67 |
1 files changed, 4 insertions, 63 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index edeb66d9281..8cc290aee1f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4889,16 +4889,6 @@ static Brush *image_paint_brush(bContext *C) return paint_brush(&settings->imapaint.paint); } -static Brush *uv_sculpt_brush(bContext *C) -{ - Scene *scene = CTX_data_scene(C); - ToolSettings *settings = scene->toolsettings; - - if (!settings->uvsculpt) - return NULL; - return paint_brush(&settings->uvsculpt->paint); -} - static int image_paint_poll(bContext *C) { Object *obact = CTX_data_active_object(C); @@ -4924,30 +4914,6 @@ static int image_paint_poll(bContext *C) return 0; } -static int uv_sculpt_brush_poll(bContext *C) -{ - BMEditMesh *em; - int ret; - Object *obedit = CTX_data_edit_object(C); - SpaceImage *sima = CTX_wm_space_image(C); - Scene *scene = CTX_data_scene(C); - ToolSettings *toolsettings = scene->toolsettings; - - if (!uv_sculpt_brush(C) || !obedit || obedit->type != OB_MESH) - return 0; - - em = BMEdit_FromObject(obedit); - ret = EDBM_mtexpoly_check(em); - - if (ret && sima) { - ARegion *ar = CTX_wm_region(C); - if ((toolsettings->use_uv_sculpt) && ar->regiontype == RGN_TYPE_WINDOW) - return 1; - } - - return 0; -} - static int image_paint_3d_poll(bContext *C) { if (CTX_wm_region_view3d(C)) @@ -5484,7 +5450,7 @@ static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) /************************ cursor drawing *******************************/ -static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)) +void brush_drawcursor_texpaint_uvsculpt(bContext *C, int x, int y, void *UNUSED(customdata)) { #define PX_SIZE_FADE_MAX 12.0f #define PX_SIZE_FADE_MIN 4.0f @@ -5560,7 +5526,8 @@ static void toggle_paint_cursor(bContext *C, int enable) settings->imapaint.paintcursor = NULL; } else if (enable) - settings->imapaint.paintcursor = WM_paint_cursor_activate(wm, image_paint_poll, brush_drawcursor, NULL); + settings->imapaint.paintcursor = + WM_paint_cursor_activate(wm, image_paint_poll, brush_drawcursor_texpaint_uvsculpt, NULL); } /* enable the paint cursor if it isn't already. @@ -5587,32 +5554,11 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings) if (!imapaint->paintcursor) { imapaint->paintcursor = WM_paint_cursor_activate(wm, image_paint_poll, - brush_drawcursor, NULL); + brush_drawcursor_texpaint_uvsculpt, NULL); } } } - -void ED_space_image_uv_sculpt_update(wmWindowManager *wm, ToolSettings *settings) -{ - if (settings->use_uv_sculpt) { - if (!settings->uvsculpt) { - settings->uvsculpt = MEM_callocN(sizeof(*settings->uvsculpt), "UV Smooth paint"); - settings->uv_sculpt_tool = UV_SCULPT_TOOL_GRAB; - settings->uv_sculpt_settings = UV_SCULPT_LOCK_BORDERS | UV_SCULPT_ALL_ISLANDS; - settings->uv_relax_method = UV_SCULPT_TOOL_RELAX_LAPLACIAN; - } - - BKE_paint_init(&settings->uvsculpt->paint, PAINT_CURSOR_SCULPT); - - WM_paint_cursor_activate(wm, uv_sculpt_brush_poll, - brush_drawcursor, NULL); - } - else { - if (settings->uvsculpt) - settings->uvsculpt->paint.flags &= ~PAINT_SHOW_BRUSH; - } -} /************************ grab clone operator ************************/ typedef struct GrabClone { @@ -5937,11 +5883,6 @@ int image_texture_paint_poll(bContext *C) return (texture_paint_poll(C) || image_paint_poll(C)); } -int uv_sculpt_poll(bContext *C) -{ - return uv_sculpt_brush_poll(C); -} - int facemask_paint_poll(bContext *C) { return paint_facesel_test(CTX_data_active_object(C)); |