* Added notifiers/redraws for brush edits in 3d view and image editor (so using radial control updates tool properties)

* Changed the non-projection paint code to use the brush falloff curve, rather than a predefined falloff. This makes non-projection painting in the 3d view, and image editor painting much more consistent with other brush usage.
This commit is contained in:
Matt Ebb 2009-09-18 03:11:17 +00:00
parent a393a9c6f0
commit bf6f23ff5f
6 changed files with 35 additions and 10 deletions

@ -446,6 +446,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **o
ImBuf *ibuf;
float xy[2], dist, rgba[4], *dstf;
int x, y, rowbytes, xoff, yoff, imbflag;
int maxsize = brush->size >> 1;
char *dst, crgb[3];
imbflag= (flt)? IB_rectfloat: IB_rect;
@ -470,7 +471,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **o
dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]);
VECCOPY(dstf, brush->rgb);
dstf[3]= brush_sample_falloff(brush, dist);
dstf[3]= brush_curve_strength(brush, dist, maxsize);
}
else if (texfall == 1) {
brush_sample_tex(brush, xy, dstf);
@ -483,7 +484,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **o
dstf[0] = rgba[0]*brush->rgb[0];
dstf[1] = rgba[1]*brush->rgb[1];
dstf[2] = rgba[2]*brush->rgb[2];
dstf[3] = rgba[3]*brush_sample_falloff(brush, dist);
dstf[3] = rgba[3]*brush_curve_strength(brush, dist, maxsize);
}
}
}
@ -506,7 +507,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **o
dst[0]= crgb[0];
dst[1]= crgb[1];
dst[2]= crgb[2];
dst[3]= FTOCHAR(brush_sample_falloff(brush, dist));
dst[3]= FTOCHAR(brush_curve_strength(brush, dist, maxsize));
}
else if (texfall == 1) {
brush_sample_tex(brush, xy, rgba);
@ -522,7 +523,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **o
dst[0] = FTOCHAR(rgba[0]*brush->rgb[0]);
dst[1] = FTOCHAR(rgba[1]*brush->rgb[1]);
dst[2] = FTOCHAR(rgba[2]*brush->rgb[2]);
dst[3] = FTOCHAR(rgba[3]*brush_sample_falloff(brush, dist));
dst[3] = FTOCHAR(rgba[3]*brush_curve_strength(brush, dist, maxsize));
}
}
}

@ -4897,12 +4897,15 @@ static int paint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *even
static int paint_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint);
float zoom;
int ret;
char str[256];
get_imapaint_zoom(C, &zoom, &zoom);
ret = brush_radial_control_exec(op, paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint), 2.0 / zoom);
ret = brush_radial_control_exec(op, brush, 2.0 / zoom);
WM_radial_control_string(op, str, 256);
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
return ret;
}
@ -5216,10 +5219,13 @@ static int texture_paint_radial_control_invoke(bContext *C, wmOperator *op, wmEv
static int texture_paint_radial_control_exec(bContext *C, wmOperator *op)
{
int ret = brush_radial_control_exec(op, paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint), 2);
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint);
int ret = brush_radial_control_exec(op, brush, 2);
char str[256];
WM_radial_control_string(op, str, 256);
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
return ret;
}

@ -1136,7 +1136,11 @@ static int vpaint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *eve
static int vpaint_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->vpaint->paint);
return brush_radial_control_exec(op, brush, 1);
int ret = brush_radial_control_exec(op, brush, 1);
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
return ret;
}
static int wpaint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
@ -1161,7 +1165,11 @@ static int wpaint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *eve
static int wpaint_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->wpaint->paint);
return brush_radial_control_exec(op, brush, 1);
int ret = brush_radial_control_exec(op, brush, 1);
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
return ret;
}
void PAINT_OT_weight_paint_radial_control(wmOperatorType *ot)

@ -1091,8 +1091,11 @@ static int sculpt_radial_control_modal(bContext *C, wmOperator *op, wmEvent *eve
static int sculpt_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_tool_settings(C)->sculpt->paint);
int ret = brush_radial_control_exec(op, brush, 1);
return brush_radial_control_exec(op, brush, 1);
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
return ret;
}
static void SCULPT_OT_radial_control(wmOperatorType *ot)

@ -486,7 +486,10 @@ static void image_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
switch(wmn->category) {
case NC_BRUSH:
if(wmn->action==NA_EDITED)
ED_region_tag_redraw(ar);
break;
}
}

@ -566,6 +566,10 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
break;
}
break;
case NC_BRUSH:
if(wmn->action==NA_EDITED)
ED_region_tag_redraw(ar);
break;
case NC_SPACE:
if(wmn->data == ND_SPACE_VIEW3D)
ED_region_tag_redraw(ar);