diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-17 08:24:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-17 08:24:22 +0400 |
commit | 3040a6abafca5b5242cf447c6ab968af52c51373 (patch) | |
tree | f4351b215088fb2b19fe0f4a33b0b83797658ba2 /source/blender/editors | |
parent | 2fe92248a0cf05f5664fc65df47641982beb2eaa (diff) |
- draw inner pressure circle for weightpaint, vertexpaint, projectpaint modes.
- only draw pressure circle if the pressure is used for brush size.
- remove 'last-pressure' workaround for project paint, its no longer needed.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 33 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 32 |
3 files changed, 60 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index c92640c3ced..280e967f4d5 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -597,7 +597,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) glTranslatef(translation[0], translation[1], 0); /* draw an inner brush */ - if (ups->draw_pressure) { + if (ups->draw_pressure && BKE_brush_use_size_pressure(scene, brush)) { /* inner at full alpha */ glutil_draw_lined_arc(0.0, M_PI * 2.0, final_radius * ups->pressure_value, 40); /* outer at half alpha */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index cad19a7b5b8..0169078390e 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4965,7 +4965,6 @@ typedef struct PaintOperation { int first; int prevmouse[2]; - float prev_pressure; /* need this since we don't get tablet events for pressure change */ int orig_brush_size; double starttime; @@ -5183,6 +5182,11 @@ static int texture_paint_init(bContext *C, wmOperator *op) /* create painter */ pop->painter = BKE_brush_painter_new(scene, pop->s.brush); + { + UnifiedPaintSettings *ups = &settings->unified_paint_settings; + ups->draw_pressure = true; + } + return 1; } @@ -5271,6 +5275,11 @@ static void paint_exit(bContext *C, wmOperator *op) BKE_reportf(op->reports, RPT_WARNING, "Packed MultiLayer files cannot be painted: %s", pop->s.warnpackedfile); MEM_freeN(pop); + + { + UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; + ups->draw_pressure = false; + } } static int paint_exec(bContext *C, wmOperator *op) @@ -5313,8 +5322,9 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) if (wmtab->Active == EVT_TABLET_ERASER) pop->s.blend = IMB_BLEND_ERASE_ALPHA; } - else { /* otherwise airbrush becomes 1.0 pressure instantly */ - pressure = pop->prev_pressure ? pop->prev_pressure : 1.0f; + else { + BLI_assert(fabsf(WM_cursor_pressure(CTX_wm_window(C))) == 1.0f); + pressure = 1.0f; } if (pop->first) { @@ -5347,7 +5357,10 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) /* apply */ paint_apply(C, op, &itemptr); - pop->prev_pressure = pressure; + { + UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; + ups->pressure_value = pressure; + } } static int paint_invoke(bContext *C, wmOperator *op, wmEvent *event) @@ -5358,7 +5371,7 @@ static int paint_invoke(bContext *C, wmOperator *op, wmEvent *event) MEM_freeN(op->customdata); return OPERATOR_CANCELLED; } - + paint_apply_event(C, op, event); pop = op->customdata; @@ -5488,6 +5501,16 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], alpha); glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); + { + UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; + /* hrmf, duplicate paint_draw_cursor logic here */ + if (ups->draw_pressure && BKE_brush_use_size_pressure(scene, brush)) { + /* inner at full alpha */ + glutil_draw_lined_arc(0, (float)(M_PI * 2.0), size * ups->pressure_value, 40); + /* outer at half alpha */ + glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], alpha * 0.5f); + } + } glutil_draw_lined_arc(0, (float)(M_PI * 2.0), size, 40); glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 08c26aaa755..719179c35b8 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2172,6 +2172,11 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, const float UNU if (me->editflag & ME_EDIT_MIRROR_X) { wpd->vgroup_mirror = wpaint_mirror_vgroup_ensure(ob, wpd->vgroup_active); } + + { + UnifiedPaintSettings *ups = &ts->unified_paint_settings; + ups->draw_pressure = true; + } return TRUE; } @@ -2414,6 +2419,11 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P swap_m4m4(vc->rv3d->persmat, mat); + { + UnifiedPaintSettings *ups = &ts->unified_paint_settings; + ups->pressure_value = pressure; + } + DAG_id_tag_update(ob->data, 0); ED_region_tag_redraw(vc->ar); } @@ -2454,7 +2464,12 @@ static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) } } } - + + { + UnifiedPaintSettings *ups = &ts->unified_paint_settings; + ups->draw_pressure = false; + } + DAG_id_tag_update(ob->data, 0); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); @@ -2735,6 +2750,11 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const fl invert_m4_m4(imat, mat); copy_m3_m4(vpd->vpimat, imat); + { + UnifiedPaintSettings *ups = &ts->unified_paint_settings; + ups->draw_pressure = true; + } + return 1; } @@ -2889,6 +2909,11 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P do_shared_vertexcol(me, do_tessface); } + { + UnifiedPaintSettings *ups = &ts->unified_paint_settings; + ups->pressure_value = pressure; + } + ED_region_tag_redraw(vc->ar); if (vpd->use_fast_update == FALSE) { @@ -2920,6 +2945,11 @@ static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) BLI_memarena_free(vpd->polyfacemap_arena); } + { + UnifiedPaintSettings *ups = &ts->unified_paint_settings; + ups->draw_pressure = false; + } + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); MEM_freeN(vpd); |