2.5/Sculpt:
authorNicholas Bishop <nicholasbishop@gmail.com>
Thu, 20 Aug 2009 05:44:32 +0000 (05:44 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Thu, 20 Aug 2009 05:44:32 +0000 (05:44 +0000)
* Fixed sculpt brush stroke exec (F4 operator)
* Made a generic paint stroke exec

source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/editors/sculpt_paint/sculpt.c

index c6c93026c44e253bd402b782a5237ec24c7da8c1..a0187566c433b20607492243f9f9587d8a4785bb 100644 (file)
@@ -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);
index 1167e011c865361b9aabb9345f8317e818be24d6..715399af88805f4151d4ead5dc8efba3505ccb81 100644 (file)
@@ -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;
index 94703dbe4ff681864de62edd4acdc919a36a7591..e02062107995aadf57970ce481bf137429055933 100644 (file)
@@ -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);