diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-20 09:44:32 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-20 09:44:32 +0400 |
commit | 210ef4c07c0f8fe602068bfc797ef8dd588a6204 (patch) | |
tree | 0b7e25b29cf3e149c60cf8edd03fedb1a576b66d /source/blender/editors/sculpt_paint | |
parent | 7dfc1317acc63aea67d4ebd5db8d64c5bef4b8c8 (diff) |
2.5/Sculpt:
* Fixed sculpt brush stroke exec (F4 operator)
* Made a generic paint stroke exec
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 15 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 14 |
3 files changed, 20 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index c6c93026c44..a0187566c43 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -49,6 +49,7 @@ typedef void (*StrokeDone)(struct bContext *C, struct PaintStroke *stroke); struct PaintStroke *paint_stroke_new(bContext *C, StrokeTestStart test_start, StrokeUpdateStep update_step, StrokeDone done); int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event); +int paint_stroke_exec(struct bContext *C, struct wmOperator *op); struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke); void *paint_stroke_mode_data(struct PaintStroke *stroke); void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 1167e011c86..715399af888 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -265,6 +265,21 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } +int paint_stroke_exec(bContext *C, wmOperator *op) +{ + PaintStroke *stroke = op->customdata; + + RNA_BEGIN(op->ptr, itemptr, "stroke") { + stroke->update_step(C, stroke, &itemptr); + } + RNA_END; + + MEM_freeN(stroke); + op->customdata = NULL; + + return OPERATOR_FINISHED; +} + ViewContext *paint_stroke_view_context(PaintStroke *stroke) { return &stroke->vc; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 94703dbe4ff..e0206210799 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1410,7 +1410,7 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *stroke, P do_symmetrical_brush_actions(sd, ss); /* Cleanup */ - sculpt_flush_update(C); // XXX: during exec, shouldn't do this every time + sculpt_flush_update(C); sculpt_post_stroke_free(ss); } @@ -1448,20 +1448,14 @@ static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op) Sculpt *sd = CTX_data_tool_settings(C)->sculpt; SculptSession *ss = CTX_data_active_object(C)->sculpt; + op->customdata = paint_stroke_new(C, sculpt_stroke_test_start, sculpt_stroke_update_step, sculpt_stroke_done); + sculpt_brush_stroke_init(C); sculpt_update_cache_invariants(sd, ss, C, op); sculptmode_update_all_projverts(ss); - RNA_BEGIN(op->ptr, itemptr, "stroke") { - sculpt_update_cache_variants(sd, ss, &itemptr); - - sculpt_restore_mesh(sd, ss); - do_symmetrical_brush_actions(sd, ss); - - sculpt_post_stroke_free(ss); - } - RNA_END; + paint_stroke_exec(C, op); sculpt_flush_update(C); sculpt_cache_free(ss->cache); |