Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-04-18 20:10:02 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-04-18 20:15:01 +0300
commit4704f2687a519f1d9a1fe7984da82c30d5f14227 (patch)
tree2ea64ec34b61e88099b5ee525fce96c6002bf0ae
parent7560aabf71dd4c7687ff0110e722287d66358bbd (diff)
Edit Mesh: multi-object flip normals support
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 275dc228f21..7e2e63eb457 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1626,18 +1626,29 @@ void MESH_OT_duplicate(wmOperatorType *ot)
* \{ */
static int edbm_flip_normals_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);
- if (!EDBM_op_callf(
- em, op, "reverse_faces faces=%hf flip_multires=%b",
- BM_ELEM_SELECT, true))
- {
- 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, false);
+ if (em->bm->totfacesel == 0) {
+ continue;
+ }
+ if (!EDBM_op_callf(
+ em, op, "reverse_faces faces=%hf flip_multires=%b",
+ BM_ELEM_SELECT, true))
+ {
+ continue;
+ }
+
+ EDBM_update_generic(em, true, false);
+ }
+
+ MEM_freeN(objects);
return OPERATOR_FINISHED;
}