From 12788538496a6c63f876926f27a99cf8b0ad9c97 Mon Sep 17 00:00:00 2001 From: mano-wii Date: Tue, 2 Jul 2019 08:59:40 +1000 Subject: Fix T61360: Smooth Weights affects all objects --- source/blender/editors/object/object_vgroup.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/object/object_vgroup.c') diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 678f6f50096..4f61443ac54 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -3278,9 +3278,18 @@ static int vertex_group_smooth_exec(bContext *C, wmOperator *op) ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob_ctx = ED_object_context(C); - uint objects_len = 0; - Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data( - view_layer, CTX_wm_view3d(C), &objects_len, ob_ctx->mode); + uint objects_len; + Object **objects; + if (ob_ctx->mode == OB_MODE_WEIGHT_PAINT) { + /* Until weight paint supports multi-edit, use only the active. */ + objects_len = 1; + objects = &ob_ctx; + } + else { + objects = BKE_view_layer_array_from_objects_in_mode_unique_data( + view_layer, CTX_wm_view3d(C), &objects_len, ob_ctx->mode); + } + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { Object *ob = objects[ob_index]; @@ -3296,7 +3305,9 @@ static int vertex_group_smooth_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); } - MEM_freeN(objects); + if (objects != &ob_ctx) { + MEM_freeN(objects); + } return OPERATOR_FINISHED; } -- cgit v1.2.3