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
path: root/source
diff options
context:
space:
mode:
authorThomas Beck <software@plasmasolutions.de>2018-04-20 11:15:51 +0300
committerThomas Beck <software@plasmasolutions.de>2018-04-20 11:16:05 +0300
commit0e5a4f927a8b53fac2ccf3585fded74607c9c481 (patch)
tree236f43e0f88c7e347a4aafa047c5eea630ce1742 /source
parent8c269d94f4bd1baa080ad939ae96c736d9688016 (diff)
Edit Mesh: multi-object support for 'Make Planar Faces'
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 222c3f4040e..d804b6b5a79 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1475,19 +1475,32 @@ void MESH_OT_vert_connect_nonplanar(wmOperatorType *ot)
static int edbm_face_make_planar_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);
+
const int repeat = RNA_int_get(op->ptr, "repeat");
const float fac = RNA_float_get(op->ptr, "factor");
- if (!EDBM_op_callf(
- em, op, "planar_faces faces=%hf iterations=%i factor=%f",
- BM_ELEM_SELECT, repeat, fac))
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++)
{
- return OPERATOR_CANCELLED;
+ Object *obedit = objects[ob_index];
+ BMEditMesh *em = BKE_editmesh_from_object(obedit);
+ if (em->bm->totvertsel == 0) {
+ continue;
+ }
+
+ if (!EDBM_op_callf(
+ em, op, "planar_faces faces=%hf iterations=%i factor=%f",
+ BM_ELEM_SELECT, repeat, fac))
+ {
+ continue;
+ }
+
+ EDBM_update_generic(em, true, true);
}
+ MEM_freeN(objects);
- EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}