diff options
author | Jacques Lucke <jacques@blender.org> | 2022-02-21 13:52:46 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-02-21 13:52:46 +0300 |
commit | 141d5851d7d240dbe96854553c7a2c076a1b68bd (patch) | |
tree | 5be034d7e8dd01091b23d7704ff4c3bf4b54ef4c /source/blender/editors/sculpt_paint/curves_sculpt_ops.cc | |
parent | 5be74160c06a51fa61dce6293ddbd538562e766b (diff) |
Paint: decouple op->customdata from PaintStroke
Previously, all operators using `PaintStroke` would have to store
the stroke in `op->customdata`. That made it impossible to store
other operator specific data in `op->customdata` that was unrelated
to the stroke.
This patch changes it so that the `PaintStroke` is passed to api
functions as a separate argument, which allows storing the stroke
as a subfield of some other struct in `op->customdata`.
Diffstat (limited to 'source/blender/editors/sculpt_paint/curves_sculpt_ops.cc')
-rw-r--r-- | source/blender/editors/sculpt_paint/curves_sculpt_ops.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc index ead016174c9..c4421210379 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc @@ -59,9 +59,14 @@ static int sculpt_curves_stroke_invoke(bContext *C, wmOperator *op, const wmEven return OPERATOR_RUNNING_MODAL; } +static int sculpt_curves_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event) +{ + return paint_stroke_modal(C, op, event, static_cast<PaintStroke *>(op->customdata)); +} + static void sculpt_curves_stroke_cancel(bContext *C, wmOperator *op) { - paint_stroke_cancel(C, op); + paint_stroke_cancel(C, op, static_cast<PaintStroke *>(op->customdata)); } static void SCULPT_CURVES_OT_brush_stroke(struct wmOperatorType *ot) @@ -71,7 +76,7 @@ static void SCULPT_CURVES_OT_brush_stroke(struct wmOperatorType *ot) ot->description = "Sculpt curves using a brush"; ot->invoke = sculpt_curves_stroke_invoke; - ot->modal = paint_stroke_modal; + ot->modal = sculpt_curves_stroke_modal; ot->cancel = sculpt_curves_stroke_cancel; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |