diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-08-31 21:37:38 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-08-31 22:00:30 +0300 |
commit | 333feea6e9450379f5314f327cf1ac1aef6d8a07 (patch) | |
tree | 733c5da53fbae58268a4c1d68beb2fc383ad5187 /source/blender/editors/sculpt_paint/paint_image.c | |
parent | 0018483dfaf96af569fad40bed6f47389ef3358f (diff) |
Fix T45258, impossible to select brush when removing it from 2d
painting.
Also system added a brush every time it found no paint brush in the
system which is not what we would want.
Solution:
* Brush panel stays visible always, regardless of whether there is a
brush or not.
* We search for first available brush when we find no brush in paint
struct instead of always generating a new one.
* Generating and searching for a brush take a mode argument now. Needed
some refactoring to users of BKE_paint_init as well.
* Did some style cleanups for paint mode enums.
Patch is big but it's mostly argument refactoring.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 64e0aa822df..f0c9c023876 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1045,8 +1045,9 @@ static void toggle_paint_cursor(bContext *C, int enable) * 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) +void ED_space_image_paint_update(wmWindowManager *wm, Scene *scene) { + ToolSettings *settings = scene->toolsettings; wmWindow *win; ScrArea *sa; ImagePaintSettings *imapaint = &settings->imapaint; @@ -1059,7 +1060,7 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings) enabled = true; if (enabled) { - BKE_paint_init(&settings->unified_paint_settings, &imapaint->paint, PAINT_CURSOR_TEXTURE_PAINT); + BKE_paint_init(scene, ePaintTexture2D, PAINT_CURSOR_TEXTURE_PAINT); paint_cursor_start_explicit(&imapaint->paint, wm, image_paint_poll); } @@ -1212,7 +1213,7 @@ static int sample_color_exec(bContext *C, wmOperator *op) RNA_int_get_array(op->ptr, "location", location); use_palette = RNA_boolean_get(op->ptr, "palette"); - paint_sample_color(C, ar, location[0], location[1], mode == PAINT_TEXTURE_PROJECTIVE, use_palette); + paint_sample_color(C, ar, location[0], location[1], mode == ePaintTextureProjective, use_palette); if (show_cursor) { paint->flags |= PAINT_SHOW_BRUSH; @@ -1250,7 +1251,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event RNA_int_set_array(op->ptr, "location", event->mval); - paint_sample_color(C, ar, event->mval[0], event->mval[1], mode == PAINT_TEXTURE_PROJECTIVE, false); + paint_sample_color(C, ar, event->mval[0], event->mval[1], mode == ePaintTextureProjective, false); WM_cursor_modal_set(win, BC_EYEDROPPER_CURSOR); WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush); @@ -1289,7 +1290,7 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event) { ARegion *ar = CTX_wm_region(C); RNA_int_set_array(op->ptr, "location", event->mval); - paint_sample_color(C, ar, event->mval[0], event->mval[1], mode == PAINT_TEXTURE_PROJECTIVE, false); + paint_sample_color(C, ar, event->mval[0], event->mval[1], mode == ePaintTextureProjective, false); WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush); break; } @@ -1298,7 +1299,7 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event) if (event->val == KM_PRESS) { ARegion *ar = CTX_wm_region(C); RNA_int_set_array(op->ptr, "location", event->mval); - paint_sample_color(C, ar, event->mval[0], event->mval[1], mode == PAINT_TEXTURE_PROJECTIVE, true); + paint_sample_color(C, ar, event->mval[0], event->mval[1], mode == ePaintTextureProjective, true); if (!data->sample_palette) { data->sample_palette = true; sample_color_update_header(data, C); @@ -1416,7 +1417,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) ob->mode |= mode_flag; - BKE_paint_init(&scene->toolsettings->unified_paint_settings, &imapaint->paint, PAINT_CURSOR_TEXTURE_PAINT); + BKE_paint_init(scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT); if (U.glreslimit != 0) GPU_free_images(); |