== 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.
This commit is contained in:
Nicholas Bishop 2010-10-20 00:42:19 +00:00
parent b741740ffa
commit e12f950d25
4 changed files with 27 additions and 3 deletions

@ -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);

@ -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;
}

@ -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);

@ -373,6 +373,8 @@ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
static void rna_SpaceImageEditor_paint_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
ED_space_image_paint_update(bmain->wm.first, scene->toolsettings);
}
static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr)