- 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.
This commit is contained in:
@@ -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 */
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user