diff options
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 0ad7d144496..c31d40e5474 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -405,7 +405,7 @@ static void free_vpaint_prev(VPaint *vp) static void free_wpaint_prev(VPaint *vp) { if (vp->wpaint_prev) { - MEM_freeN(vp->wpaint_prev); + free_dverts(vp->wpaint_prev, vp->tot); vp->wpaint_prev = NULL; vp->tot = 0; } @@ -2498,7 +2498,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot) RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); } -static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op)) +static int weight_paint_set_exec(bContext *C, wmOperator *op) { struct Scene *scene = CTX_data_scene(C); Object *obact = CTX_data_active_object(C); @@ -2506,6 +2506,10 @@ static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op)) Brush *brush = paint_brush(&ts->wpaint->paint); float vgroup_weight = BKE_brush_weight_get(scene, brush); + if (wpaint_ensure_data(C, op) == FALSE) { + return OPERATOR_CANCELLED; + } + wpaint_fill(scene->toolsettings->wpaint, obact, vgroup_weight); ED_region_tag_redraw(CTX_wm_region(C)); /* XXX - should redraw all 3D views */ return OPERATOR_FINISHED; @@ -3217,6 +3221,10 @@ static int paint_weight_gradient_invoke(bContext *C, wmOperator *op, wmEvent *ev { int ret; + if (wpaint_ensure_data(C, op) == FALSE) { + return OPERATOR_CANCELLED; + } + ret = WM_gesture_straightline_invoke(C, op, event); if (ret & OPERATOR_RUNNING_MODAL) { struct ARegion *ar = CTX_wm_region(C); |