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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-16 02:55:30 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-16 02:55:30 +0400
commit837d0ac2e0882bc63da15c96f41fa76da2486bf6 (patch)
treea7e9ac451f910823d63710c79cd44b9213d85913 /source/blender/editors/sculpt_paint/paint_vertex.c
parentb97397cae3fb74078e496d58cf0e37383732977c (diff)
Fix #35372: sculpting/painting long brush strokes with small brush size would
take up a lot of memory. The operator was recording an array with all stroke points. However this was not particularly useful, only sculpt mode had exec() implemented to redo the stroke, but it was not registering the operator anyway so there was no way to access the data after the operator was done. So no one was using this anyway. I did now implement exec for the paint modes so you can call the operator with stroke points from a script.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_vertex.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 388b0e769e8..5feb59c6082 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2575,6 +2575,18 @@ static int wpaint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
+static int wpaint_exec(bContext *C, wmOperator *op)
+{
+ op->customdata = paint_stroke_new(C, NULL, wpaint_stroke_test_start,
+ wpaint_stroke_update_step, NULL,
+ wpaint_stroke_done, 0);
+
+ /* frees op->customdata */
+ paint_stroke_exec(C, op);
+
+ return OPERATOR_FINISHED;
+}
+
static int wpaint_cancel(bContext *C, wmOperator *op)
{
paint_stroke_cancel(C, op);
@@ -2593,12 +2605,12 @@ void PAINT_OT_weight_paint(wmOperatorType *ot)
/* api callbacks */
ot->invoke = wpaint_invoke;
ot->modal = paint_stroke_modal;
- /* ot->exec = vpaint_exec; <-- needs stroke property */
+ ot->exec = wpaint_exec;
ot->poll = weight_paint_poll;
ot->cancel = wpaint_cancel;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING;
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
}
@@ -3105,6 +3117,18 @@ static int vpaint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
+static int vpaint_exec(bContext *C, wmOperator *op)
+{
+ op->customdata = paint_stroke_new(C, NULL, vpaint_stroke_test_start,
+ vpaint_stroke_update_step, NULL,
+ vpaint_stroke_done, 0);
+
+ /* frees op->customdata */
+ paint_stroke_exec(C, op);
+
+ return OPERATOR_FINISHED;
+}
+
static int vpaint_cancel(bContext *C, wmOperator *op)
{
paint_stroke_cancel(C, op);
@@ -3122,12 +3146,12 @@ void PAINT_OT_vertex_paint(wmOperatorType *ot)
/* api callbacks */
ot->invoke = vpaint_invoke;
ot->modal = paint_stroke_modal;
- /* ot->exec = vpaint_exec; <-- needs stroke property */
+ ot->exec = vpaint_exec;
ot->poll = vertex_paint_poll;
ot->cancel = vpaint_cancel;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING;
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
}