diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-09-03 16:27:07 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-09-03 16:30:59 +0300 |
commit | 3dee8b4a12f068f3837946a0c2222459385305d3 (patch) | |
tree | a4db3e64875f0de1067922a27069fd30fe130969 | |
parent | d57cb8fa22eb757e0960cb1336f00e495519a939 (diff) |
Multi-Objects: OBJECT_OT_vertex_group_smooth
In this case we call the operation multiple times.
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index ca5c000819d..13166929090 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -3119,21 +3119,32 @@ void OBJECT_OT_vertex_group_invert(wmOperatorType *ot) static int vertex_group_smooth_exec(bContext *C, wmOperator *op) { - Object *ob = ED_object_context(C); const float fac = RNA_float_get(op->ptr, "factor"); const int repeat = RNA_int_get(op->ptr, "repeat"); eVGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); const float fac_expand = RNA_float_get(op->ptr, "expand"); + ViewLayer *view_layer = CTX_data_view_layer(C); - int subset_count, vgroup_tot; + uint objects_len = 0; + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *ob = objects[ob_index]; - const bool *vgroup_validmap = BKE_object_defgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); - vgroup_smooth_subset(ob, vgroup_validmap, vgroup_tot, subset_count, fac, repeat, fac_expand); - MEM_freeN((void *)vgroup_validmap); + int subset_count, vgroup_tot; - DEG_id_tag_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); - WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); + const bool *vgroup_validmap = BKE_object_defgroup_subset_from_select_type(ob, + subset_type, + &vgroup_tot, + &subset_count); + + vgroup_smooth_subset(ob, vgroup_validmap, vgroup_tot, subset_count, fac, repeat, fac_expand); + MEM_freeN((void *)vgroup_validmap); + + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); + WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); + } + MEM_freeN(objects); return OPERATOR_FINISHED; } |