diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/bmesh/operators/bmo_mirror.c | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/bmesh/operators/bmo_mirror.c')
-rw-r--r-- | source/blender/bmesh/operators/bmo_mirror.c | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c index 2ef96d1df03..36297b3f816 100644 --- a/source/blender/bmesh/operators/bmo_mirror.c +++ b/source/blender/bmesh/operators/bmo_mirror.c @@ -31,87 +31,87 @@ #include "bmesh.h" #include "intern/bmesh_operators_private.h" /* own include */ -#define ELE_NEW 1 +#define ELE_NEW 1 void bmo_mirror_exec(BMesh *bm, BMOperator *op) { - BMOperator dupeop, weldop; - BMOIter siter; - BMIter iter; - BMVert *v, **vmap; - int vmap_size = 0; - float mtx[4][4]; - float imtx[4][4]; - float scale[3] = {1.0f, 1.0f, 1.0f}; - float dist = BMO_slot_float_get(op->slots_in, "merge_dist"); - int i, ototvert; - int axis = BMO_slot_int_get(op->slots_in, "axis"); - bool mirror_u = BMO_slot_bool_get(op->slots_in, "mirror_u"); - bool mirror_v = BMO_slot_bool_get(op->slots_in, "mirror_v"); - BMOpSlot *slot_targetmap; - - ototvert = bm->totvert; - - BMO_slot_mat4_get(op->slots_in, "matrix", mtx); - invert_m4_m4(imtx, mtx); - - BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%s", op, "geom"); - BMO_op_exec(bm, &dupeop); - - BMO_slot_buffer_flag_enable(bm, dupeop.slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW); - - /* create old -> new mappin */ - vmap = BMO_iter_as_arrayN(dupeop.slots_out, "geom.out", BM_VERT, &vmap_size, NULL, 0); - - /* feed old data to transform bmo */ - scale[axis] = -1.0f; - BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, mtx); - BMO_op_callf(bm, op->flag, "scale verts=%fv vec=%v", ELE_NEW, scale); - BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, imtx); - - BMO_op_init(bm, &weldop, op->flag, "weld_verts"); - - slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap"); - - v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for (i = 0; i < ototvert; i++) { - if (fabsf(v->co[axis]) <= dist) { - BLI_assert(vmap_size >= i); - BMO_slot_map_elem_insert(&weldop, slot_targetmap, vmap[i], v); - } - v = BM_iter_step(&iter); - } - - if (mirror_u || mirror_v) { - BMFace *f; - BMLoop *l; - MLoopUV *luv; - const int totlayer = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV); - BMIter liter; - - BMO_ITER (f, &siter, dupeop.slots_out, "geom.out", BM_FACE) { - BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - for (i = 0; i < totlayer; i++) { - luv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i); - if (mirror_u) { - luv->uv[0] = 1.0f - luv->uv[0]; - } - if (mirror_v) { - luv->uv[1] = 1.0f - luv->uv[1]; - } - } - } - } - } - - BMO_op_exec(bm, &weldop); - - BMO_op_finish(bm, &weldop); - BMO_op_finish(bm, &dupeop); - - BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW); - - if (vmap) { - MEM_freeN(vmap); - } + BMOperator dupeop, weldop; + BMOIter siter; + BMIter iter; + BMVert *v, **vmap; + int vmap_size = 0; + float mtx[4][4]; + float imtx[4][4]; + float scale[3] = {1.0f, 1.0f, 1.0f}; + float dist = BMO_slot_float_get(op->slots_in, "merge_dist"); + int i, ototvert; + int axis = BMO_slot_int_get(op->slots_in, "axis"); + bool mirror_u = BMO_slot_bool_get(op->slots_in, "mirror_u"); + bool mirror_v = BMO_slot_bool_get(op->slots_in, "mirror_v"); + BMOpSlot *slot_targetmap; + + ototvert = bm->totvert; + + BMO_slot_mat4_get(op->slots_in, "matrix", mtx); + invert_m4_m4(imtx, mtx); + + BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%s", op, "geom"); + BMO_op_exec(bm, &dupeop); + + BMO_slot_buffer_flag_enable(bm, dupeop.slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW); + + /* create old -> new mappin */ + vmap = BMO_iter_as_arrayN(dupeop.slots_out, "geom.out", BM_VERT, &vmap_size, NULL, 0); + + /* feed old data to transform bmo */ + scale[axis] = -1.0f; + BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, mtx); + BMO_op_callf(bm, op->flag, "scale verts=%fv vec=%v", ELE_NEW, scale); + BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, imtx); + + BMO_op_init(bm, &weldop, op->flag, "weld_verts"); + + slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap"); + + v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); + for (i = 0; i < ototvert; i++) { + if (fabsf(v->co[axis]) <= dist) { + BLI_assert(vmap_size >= i); + BMO_slot_map_elem_insert(&weldop, slot_targetmap, vmap[i], v); + } + v = BM_iter_step(&iter); + } + + if (mirror_u || mirror_v) { + BMFace *f; + BMLoop *l; + MLoopUV *luv; + const int totlayer = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV); + BMIter liter; + + BMO_ITER (f, &siter, dupeop.slots_out, "geom.out", BM_FACE) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { + for (i = 0; i < totlayer; i++) { + luv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i); + if (mirror_u) { + luv->uv[0] = 1.0f - luv->uv[0]; + } + if (mirror_v) { + luv->uv[1] = 1.0f - luv->uv[1]; + } + } + } + } + } + + BMO_op_exec(bm, &weldop); + + BMO_op_finish(bm, &weldop); + BMO_op_finish(bm, &dupeop); + + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW); + + if (vmap) { + MEM_freeN(vmap); + } } |