diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2010-10-20 04:42:19 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2010-10-20 04:42:19 +0400 |
commit | e12f950d25327b5df911fe0128a3f3f5d873446d (patch) | |
tree | eead6baebc86032d75c159976da1b0e7a8be2765 /source/blender/editors | |
parent | b741740ffabd0170415845354d5f8e3fdf657f1f (diff) |
== Paint ==
Fixed bug #24239, "Fkey doesn't work in image paint unless also in 3D texture paint"
* Fixed brush cursor not showing when painting in the image editor without 3d texture painting enabled
* Fixed fkey not working when not in 3d texture paint
Note:
This does not handle showing the brush cursor when reloading a file saved with image painting on but 3d texture painting off. The method used for object paint modes doesn't apply quite the same here, so I left that alone for now.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_image.h | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 21 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 3 |
3 files changed, 25 insertions, 3 deletions
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 1d674112b8d..c5f0983f494 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -32,7 +32,9 @@ struct SpaceImage; struct bContext; struct Image; struct ImageUser; +struct ToolSettings; struct uiBlock; +struct wmWindowManager; /* space_image.c, exported for transform */ struct Image *ED_space_image(struct SpaceImage *sima); @@ -47,6 +49,8 @@ void ED_space_image_aspect(struct SpaceImage *sima, float *aspx, float *aspy); void ED_space_image_zoom(struct SpaceImage *sima, struct ARegion *ar, float *zoomx, float *zoomy); void ED_space_image_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy); +void ED_space_image_paint_update(struct wmWindowManager *wm, struct ToolSettings *settings); + void ED_image_size(struct Image *ima, int *width, int *height); void ED_image_aspect(struct Image *ima, float *aspx, float *aspy); void ED_image_uv_aspect(struct Image *ima, float *aspx, float *aspy); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 71754c3589a..a5b5baad4c5 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4961,23 +4961,38 @@ static void toggle_paint_cursor(bContext *C, int enable) settings->imapaint.paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), image_paint_poll, brush_drawcursor, NULL); } +/* enable the paint cursor if it isn't already. + + purpose is to make sure the paint cursor is shown if paint + mode is enabled in the image editor. the paint poll will + ensure that the cursor is hidden when not in paint mode */ +void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings) +{ + ImagePaintSettings *imapaint = &settings->imapaint; + + if(!imapaint->paintcursor) { + imapaint->paintcursor = + WM_paint_cursor_activate(wm, image_paint_poll, + brush_drawcursor, NULL); + } +} + /* ************ image paint radial control *************/ static int paint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) { float zoom; ToolSettings *ts = CTX_data_scene(C)->toolsettings; get_imapaint_zoom(C, &zoom, &zoom); - toggle_paint_cursor(C, !ts->imapaint.paintcursor); + toggle_paint_cursor(C, 0); brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), zoom); return WM_radial_control_invoke(C, op, event); } static int paint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) { - ToolSettings *ts = CTX_data_scene(C)->toolsettings; int ret = WM_radial_control_modal(C, op, event); if(ret != OPERATOR_RUNNING_MODAL) - toggle_paint_cursor(C, !ts->imapaint.paintcursor); + toggle_paint_cursor(C, 1); return ret; } diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 2e0338b370e..6f246692987 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -428,6 +428,9 @@ void ED_keymap_paint(wmKeyConfig *keyconf) keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0); keymap->poll= image_texture_paint_poll; + RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE); + RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); + RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE); RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); |