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:
authorJacques Lucke <jacques@blender.org>2022-02-21 13:52:46 +0300
committerJacques Lucke <jacques@blender.org>2022-02-21 13:52:46 +0300
commit141d5851d7d240dbe96854553c7a2c076a1b68bd (patch)
tree5be034d7e8dd01091b23d7704ff4c3bf4b54ef4c /source/blender/editors/sculpt_paint/paint_vertex.c
parent5be74160c06a51fa61dce6293ddbd538562e766b (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/paint_vertex.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index a82636023f8..8373f028109 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2551,7 +2551,7 @@ static int wpaint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
event->type);
if ((retval = op->type->modal(C, op, event)) == OPERATOR_FINISHED) {
- paint_stroke_free(C, op);
+ paint_stroke_free(C, op, op->customdata);
return OPERATOR_FINISHED;
}
/* add modal handler */
@@ -2575,7 +2575,7 @@ static int wpaint_exec(bContext *C, wmOperator *op)
0);
/* frees op->customdata */
- paint_stroke_exec(C, op);
+ paint_stroke_exec(C, op, op->customdata);
return OPERATOR_FINISHED;
}
@@ -2588,7 +2588,12 @@ static void wpaint_cancel(bContext *C, wmOperator *op)
ob->sculpt->cache = NULL;
}
- paint_stroke_cancel(C, op);
+ paint_stroke_cancel(C, op, op->customdata);
+}
+
+static int wpaint_modal(bContext *C, wmOperator *op, const wmEvent *event)
+{
+ return paint_stroke_modal(C, op, event, op->customdata);
}
void PAINT_OT_weight_paint(wmOperatorType *ot)
@@ -2600,7 +2605,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot)
/* api callbacks */
ot->invoke = wpaint_invoke;
- ot->modal = paint_stroke_modal;
+ ot->modal = wpaint_modal;
ot->exec = wpaint_exec;
ot->poll = weight_paint_poll;
ot->cancel = wpaint_cancel;
@@ -3497,7 +3502,7 @@ static int vpaint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
event->type);
if ((retval = op->type->modal(C, op, event)) == OPERATOR_FINISHED) {
- paint_stroke_free(C, op);
+ paint_stroke_free(C, op, op->customdata);
return OPERATOR_FINISHED;
}
@@ -3522,7 +3527,7 @@ static int vpaint_exec(bContext *C, wmOperator *op)
0);
/* frees op->customdata */
- paint_stroke_exec(C, op);
+ paint_stroke_exec(C, op, op->customdata);
return OPERATOR_FINISHED;
}
@@ -3535,7 +3540,12 @@ static void vpaint_cancel(bContext *C, wmOperator *op)
ob->sculpt->cache = NULL;
}
- paint_stroke_cancel(C, op);
+ paint_stroke_cancel(C, op, op->customdata);
+}
+
+static int vpaint_modal(bContext *C, wmOperator *op, const wmEvent *event)
+{
+ return paint_stroke_modal(C, op, event, op->customdata);
}
void PAINT_OT_vertex_paint(wmOperatorType *ot)
@@ -3547,7 +3557,7 @@ void PAINT_OT_vertex_paint(wmOperatorType *ot)
/* api callbacks */
ot->invoke = vpaint_invoke;
- ot->modal = paint_stroke_modal;
+ ot->modal = vpaint_modal;
ot->exec = vpaint_exec;
ot->poll = vertex_paint_poll;
ot->cancel = vpaint_cancel;