Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mesh_validate.c
| Show First 20 Lines • Show All 1,587 Lines • ▼ Show 20 Lines | void BKE_mesh_calc_edges(Mesh *mesh, bool update, const bool select) | ||||
| if (mesh->totpoly) { | if (mesh->totpoly) { | ||||
| /* second pass, iterate through all loops again and assign | /* second pass, iterate through all loops again and assign | ||||
| * the newly created edges to them. */ | * the newly created edges to them. */ | ||||
| for (mp = mesh->mpoly, i = 0; i < mesh->totpoly; mp++, i++) { | for (mp = mesh->mpoly, i = 0; i < mesh->totpoly; mp++, i++) { | ||||
| MLoop *l = &mesh->mloop[mp->loopstart]; | MLoop *l = &mesh->mloop[mp->loopstart]; | ||||
| MLoop *l_prev = (l + (mp->totloop - 1)); | MLoop *l_prev = (l + (mp->totloop - 1)); | ||||
| int j; | int j; | ||||
| for (j = 0; j < mp->totloop; j++, l++) { | for (j = 0; j < mp->totloop; j++, l++) { | ||||
| /* lookup hashed edge index */ | /* Lookup hashed edge index, if it's valid. */ | ||||
| if (l_prev->v != l->v) { | |||||
| med_index = POINTER_AS_INT(BLI_edgehash_lookup(eh, l_prev->v, l->v)); | med_index = POINTER_AS_INT(BLI_edgehash_lookup(eh, l_prev->v, l->v)); | ||||
| } | |||||
| else { | |||||
| /* This is an invalid edge; normally this does not happen in Blender, but it can be part | |||||
| * of an imported mesh with invalid geometry. See T76514. */ | |||||
| med_index = 0; | |||||
| } | |||||
| l_prev->e = med_index; | l_prev->e = med_index; | ||||
| l_prev = l; | l_prev = l; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* free old CustomData and assign new one */ | /* free old CustomData and assign new one */ | ||||
| CustomData_free(&mesh->edata, mesh->totedge); | CustomData_free(&mesh->edata, mesh->totedge); | ||||
| ▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines | |||||