diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-05-08 10:58:34 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-05-08 11:07:29 +0300 |
commit | 853e55b0436fea35ad18746a4e972e845caa4c62 (patch) | |
tree | c3bce72a83a92bc2f20789f4278c7e8697d4b40b | |
parent | 848d9cda0eecfdd0bfa6907d1b902ef93f81a463 (diff) |
Multi-Object Editing: subdivide edgering support by Henry @Skippi
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3215
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index f44c15fbd0a..f07f1a2272d 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -243,24 +243,36 @@ static void mesh_operator_edgering_props_get(wmOperator *op, struct EdgeRingOpSu static int edbm_subdivide_edge_ring_exec(bContext *C, wmOperator *op) { - Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = BKE_editmesh_from_object(obedit); + + ViewLayer *view_layer = CTX_data_view_layer(C); + uint objects_len = 0; + Object * *objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); struct EdgeRingOpSubdProps op_props; mesh_operator_edgering_props_get(op, &op_props); - if (!EDBM_op_callf( - em, op, - "subdivide_edgering edges=%he interp_mode=%i cuts=%i smooth=%f " - "profile_shape=%i profile_shape_factor=%f", - BM_ELEM_SELECT, op_props.interp_mode, op_props.cuts, op_props.smooth, - op_props.profile_shape, op_props.profile_shape_factor)) - { - return OPERATOR_CANCELLED; - } + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object * obedit = objects[ob_index]; + BMEditMesh * em = BKE_editmesh_from_object(obedit); - EDBM_update_generic(em, true, true); + if (em->bm->totedgesel == 0) { + continue; + } + if (!EDBM_op_callf( + em, op, + "subdivide_edgering edges=%he interp_mode=%i cuts=%i smooth=%f " + "profile_shape=%i profile_shape_factor=%f", + BM_ELEM_SELECT, op_props.interp_mode, op_props.cuts, op_props.smooth, + op_props.profile_shape, op_props.profile_shape_factor)) + { + continue; + } + + EDBM_update_generic(em, true, true); + } + + MEM_freeN(objects); return OPERATOR_FINISHED; } |