Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2009-09-18 07:11:17 +0400
committerMatt Ebb <matt@mke3.net>2009-09-18 07:11:17 +0400
commitbf6f23ff5f8af6ae28b5efa113b5b628ad2edb6b (patch)
tree9ed96f6ffea10ee0bb76e3a5db108e1c27ef6b81 /source/blender
parenta393a9c6f05b66692fbbb7ae2a3f101744e550f0 (diff)
* 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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/brush.c9
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c10
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c12
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c5
-rw-r--r--source/blender/editors/space_image/space_image.c5
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c4
6 files changed, 35 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 76a26762abe..9ae0863a78a 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -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));
}
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 870b66cdbbd..e8dd27f1bd2 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -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;
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 2375e4e70ec..c43d903d4a6 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -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)
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index b08e8ab5c2b..822e79bea1e 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -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)
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 75e7461df95..e325a820e92 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -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;
}
}
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 15e12e73b49..12c2b272258 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -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);