Changeset View
Changeset View
Standalone View
Standalone View
source/blender/bmesh/operators/bmo_mirror.c
| Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | if (fabsf(v->co[axis]) <= dist) { | ||||
| BLI_assert(v_new != NULL); | BLI_assert(v_new != NULL); | ||||
| BMO_slot_map_elem_insert(&weldop, slot_targetmap, v_new, v); | BMO_slot_map_elem_insert(&weldop, slot_targetmap, v_new, v); | ||||
| } | } | ||||
| } | } | ||||
| if (mirror_u || mirror_v) { | if (mirror_u || mirror_v) { | ||||
| BMFace *f; | BMFace *f; | ||||
| BMLoop *l; | BMLoop *l; | ||||
| MLoopUV *luv; | float *luv; | ||||
| const int totlayer = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV); | const int totlayer = CustomData_number_of_layers(&bm->ldata, CD_PROP_FLOAT2); | ||||
| BMIter liter; | BMIter liter; | ||||
| BMO_ITER (f, &siter, dupeop.slots_out, "geom.out", BM_FACE) { | BMO_ITER (f, &siter, dupeop.slots_out, "geom.out", BM_FACE) { | ||||
| BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { | BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { | ||||
| for (i = 0; i < totlayer; i++) { | for (i = 0; i < totlayer; i++) { | ||||
| luv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i); | luv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_PROP_FLOAT2, i); | ||||
| if (mirror_u) { | if (mirror_u) { | ||||
| float uv_u = luv->uv[0]; | float uv_u = luv[0]; | ||||
| if (mirror_udim) { | if (mirror_udim) { | ||||
| luv->uv[0] = ceilf(uv_u) - fmodf(uv_u, 1.0f); | luv[0] = ceilf(uv_u) - fmodf(uv_u, 1.0f); | ||||
| } | } | ||||
| else { | else { | ||||
| luv->uv[0] = 1.0f - uv_u; | luv[0] = 1.0f - uv_u; | ||||
| } | } | ||||
| } | } | ||||
| if (mirror_v) { | if (mirror_v) { | ||||
| float uv_v = luv->uv[1]; | float uv_v = luv[1]; | ||||
| if (mirror_udim) { | if (mirror_udim) { | ||||
| luv->uv[1] = ceilf(uv_v) - fmodf(uv_v, 1.0f); | luv[1] = ceilf(uv_v) - fmodf(uv_v, 1.0f); | ||||
| } | } | ||||
| else { | else { | ||||
| luv->uv[1] = 1.0f - uv_v; | luv[1] = 1.0f - uv_v; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| BMO_op_exec(bm, &weldop); | BMO_op_exec(bm, &weldop); | ||||
| BMO_op_finish(bm, &weldop); | BMO_op_finish(bm, &weldop); | ||||
| BMO_op_finish(bm, &dupeop); | BMO_op_finish(bm, &dupeop); | ||||
| BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW); | BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW); | ||||
| } | } | ||||