diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-05-08 12:12:23 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-05-08 12:15:00 +0300 |
commit | faaffc401171d301b87dfdabcec2aa15130be3db (patch) | |
tree | 79327da8b824c33891ac23b9e90a66e2c237c725 /source | |
parent | 63951bc98712b6dbaf684dfcfba4ee1dcf7e706f (diff) |
Edit Mesh: multi-object rotate_uvs support by Pablo Dobarro
Changes by me: Moving RNA_.*get outside for loop and indentation fix.
Maniphest Tasks: T54643
Differential Revision: https://developer.blender.org/D3221
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 0ac8d840b1f..b57a153cb2b 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2336,26 +2336,36 @@ void MESH_OT_faces_shade_flat(wmOperatorType *ot) static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op) { - Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = BKE_editmesh_from_object(ob); - BMOperator bmop; - /* get the direction from RNA */ const bool use_ccw = RNA_boolean_get(op->ptr, "use_ccw"); - /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_op_init(em, &bmop, op, "rotate_uvs faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw); + 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); + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *obedit = objects[ob_index]; + BMEditMesh *em = BKE_editmesh_from_object(obedit); - /* execute the operator */ - BMO_op_exec(em->bm, &bmop); + if (em->bm->totfacesel == 0) { + continue; + } - /* finish the operator */ - if (!EDBM_op_finish(em, &bmop, op, true)) { - return OPERATOR_CANCELLED; - } + BMOperator bmop; - EDBM_update_generic(em, false, false); + /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ + EDBM_op_init(em, &bmop, op, "rotate_uvs faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw); + + /* execute the operator */ + BMO_op_exec(em->bm, &bmop); + if (!EDBM_op_finish(em, &bmop, op, true)) { + continue; + } + + EDBM_update_generic(em, false, false); + } + + MEM_freeN(objects); return OPERATOR_FINISHED; } |