Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mesh/editmesh_utils.c
| Context not available. | |||||
| { | { | ||||
| /* clear bmesh */ | /* clear bmesh */ | ||||
| BM_mesh_clear(em->bm); | BM_mesh_clear(em->bm); | ||||
| /* free derived meshes */ | /* free derived meshes */ | ||||
| BKE_editmesh_free_derivedmesh(em); | BKE_editmesh_free_derivedmesh(em); | ||||
| /* free tessellation data */ | /* free tessellation data */ | ||||
| em->tottri = 0; | em->tottri = 0; | ||||
| if (em->looptris) { | if (em->looptris) { | ||||
| Context not available. | |||||
| tots[0] = &em->bm->totvertsel; | tots[0] = &em->bm->totvertsel; | ||||
| tots[1] = &em->bm->totedgesel; | tots[1] = &em->bm->totedgesel; | ||||
| tots[2] = &em->bm->totfacesel; | tots[2] = &em->bm->totfacesel; | ||||
| em->bm->totvertsel = em->bm->totedgesel = em->bm->totfacesel = 0; | em->bm->totvertsel = em->bm->totedgesel = em->bm->totfacesel = 0; | ||||
| for (i = 0; i < 3; i++) { | for (i = 0; i < 3; i++) { | ||||
| Context not available. | |||||
| va_end(list); | va_end(list); | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (!em->emcopy) | if (!em->emcopy) | ||||
| em->emcopy = BKE_editmesh_copy(em); | em->emcopy = BKE_editmesh_copy(em); | ||||
| em->emcopyusers++; | em->emcopyusers++; | ||||
| Context not available. | |||||
| bool EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const bool do_report) | bool EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const bool do_report) | ||||
| { | { | ||||
| const char *errmsg; | const char *errmsg; | ||||
| BMO_op_finish(em->bm, bmop); | BMO_op_finish(em->bm, bmop); | ||||
| if (BMO_error_get(em->bm, &errmsg, NULL)) { | if (BMO_error_get(em->bm, &errmsg, NULL)) { | ||||
| Context not available. | |||||
| { | { | ||||
| BMEditMesh *em = emv; | BMEditMesh *em = emv; | ||||
| Mesh *obme = obdata; | Mesh *obme = obdata; | ||||
| UndoMesh *um = MEM_callocN(sizeof(UndoMesh), "undo Mesh"); | UndoMesh *um = MEM_callocN(sizeof(UndoMesh), "undo Mesh"); | ||||
| /* make sure shape keys work */ | /* make sure shape keys work */ | ||||
| um->me.key = obme->key ? BKE_key_copy_nolib(obme->key) : NULL; | um->me.key = obme->key ? BKE_key_copy_nolib(obme->key) : NULL; | ||||
| Context not available. | |||||
| em_tmp = BKE_editmesh_create(bm, true); | em_tmp = BKE_editmesh_create(bm, true); | ||||
| *em = *em_tmp; | *em = *em_tmp; | ||||
| em->selectmode = um->selectmode; | em->selectmode = um->selectmode; | ||||
| bm->selectmode = um->selectmode; | bm->selectmode = um->selectmode; | ||||
| em->ob = ob; | em->ob = ob; | ||||
| Context not available. | |||||
| const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); | const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); | ||||
| BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE); | BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE); | ||||
| totverts = bm->totvert; | totverts = bm->totvert; | ||||
| totuv = 0; | totuv = 0; | ||||
| Context not available. | |||||
| BKE_mesh_uv_vert_map_free(vmap); | BKE_mesh_uv_vert_map_free(vmap); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| a = 0; | a = 0; | ||||
| BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { | BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { | ||||
| if ((use_select == false) || BM_elem_flag_test(efa, BM_ELEM_SELECT)) { | if ((use_select == false) || BM_elem_flag_test(efa, BM_ELEM_SELECT)) { | ||||
| Context not available. | |||||
| buf->tfindex = i; | buf->tfindex = i; | ||||
| buf->f = a; | buf->f = a; | ||||
| buf->separate = 0; | buf->separate = 0; | ||||
| buf->next = vmap->vert[BM_elem_index_get(l->v)]; | buf->next = vmap->vert[BM_elem_index_get(l->v)]; | ||||
| vmap->vert[BM_elem_index_get(l->v)] = buf; | vmap->vert[BM_elem_index_get(l->v)] = buf; | ||||
| buf++; | buf++; | ||||
| i++; | i++; | ||||
| } | } | ||||
| Context not available. | |||||
| a++; | a++; | ||||
| } | } | ||||
| /* sort individual uvs for each vert */ | /* sort individual uvs for each vert */ | ||||
| a = 0; | a = 0; | ||||
| BM_ITER_MESH (ev, &iter, bm, BM_VERTS_OF_MESH) { | BM_ITER_MESH (ev, &iter, bm, BM_VERTS_OF_MESH) { | ||||
| Context not available. | |||||
| efa = BM_face_at_index(bm, v->f); | efa = BM_face_at_index(bm, v->f); | ||||
| /* tf = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ | /* tf = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ | ||||
| l = BM_iter_at_index(bm, BM_LOOPS_OF_FACE, efa, v->tfindex); | l = BM_iter_at_index(bm, BM_LOOPS_OF_FACE, efa, v->tfindex); | ||||
| luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); | luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); | ||||
| uv = luv->uv; | uv = luv->uv; | ||||
| lastv = NULL; | lastv = NULL; | ||||
| iterv = vlist; | iterv = vlist; | ||||
| Context not available. | |||||
| next = iterv->next; | next = iterv->next; | ||||
| efa = BM_face_at_index(bm, iterv->f); | efa = BM_face_at_index(bm, iterv->f); | ||||
| /* tf = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ | /* tf = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ | ||||
| l = BM_iter_at_index(bm, BM_LOOPS_OF_FACE, efa, iterv->tfindex); | l = BM_iter_at_index(bm, BM_LOOPS_OF_FACE, efa, iterv->tfindex); | ||||
| luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); | luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); | ||||
| uv2 = luv->uv; | uv2 = luv->uv; | ||||
| sub_v2_v2v2(uvdiff, uv2, uv); | sub_v2_v2v2(uvdiff, uv2, uv); | ||||
| if (fabsf(uvdiff[0]) < limit[0] && fabsf(uvdiff[1]) < limit[1]) { | if (fabsf(uvdiff[0]) < limit[0] && fabsf(uvdiff[1]) < limit[1]) { | ||||
| Context not available. | |||||
| MTexPoly *EDBM_mtexpoly_active_get(BMEditMesh *em, BMFace **r_act_efa, const bool sloppy, const bool selected) | MTexPoly *EDBM_mtexpoly_active_get(BMEditMesh *em, BMFace **r_act_efa, const bool sloppy, const bool selected) | ||||
| { | { | ||||
| BMFace *efa = NULL; | BMFace *efa = NULL; | ||||
| if (!EDBM_mtexpoly_check(em)) | if (!EDBM_mtexpoly_check(em)) | ||||
| return NULL; | return NULL; | ||||
| efa = BM_mesh_active_face_get(em->bm, sloppy, selected); | efa = BM_mesh_active_face_get(em->bm, sloppy, selected); | ||||
| if (efa) { | if (efa) { | ||||
| Context not available. | |||||