static void mesh_ensure_tessellation_customdata(Mesh *me) { if (UNLIKELY((me->totface != 0) && (me->totpoly == 0))) { /* Pass, otherwise this function clears 'mface' before * versioning 'mface -> mpoly' code kicks in [#30583] * * Callers could also check but safer to do here - campbell */ } else { const int tottex_original = CustomData_number_of_layers(&me->pdata, CD_MTEXPOLY); const int totcol_original = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL); const int tottex_tessface = CustomData_number_of_layers(&me->fdata, CD_MTFACE); const int totcol_tessface = CustomData_number_of_layers(&me->fdata, CD_MCOL); if (tottex_tessface != tottex_original || totcol_tessface != totcol_original) { BKE_mesh_tessface_clear(me); CustomData_from_bmeshpoly(&me->fdata, &me->pdata, &me->ldata, me->totface); /* TODO - add some --debug-mesh option */ if (G.debug & G_DEBUG) { /* note: this warning may be un-called for if we are initializing the mesh for the * first time from bmesh, rather then giving a warning about this we could be smarter * and check if there was any data to begin with, for now just print the warning with * some info to help troubleshoot whats going on - campbell */ printf("%s: warning! Tessellation uvs or vcol data got out of sync, " "had to reset!\n CD_MTFACE: %d != CD_MTEXPOLY: %d || CD_MCOL: %d != CD_MLOOPCOL: %d\n", __func__, tottex_tessface, tottex_original, totcol_tessface, totcol_original); } } } }
static void rna_Mesh_flip_normals(Mesh *mesh) { BKE_mesh_polygons_flip(mesh->mpoly, mesh->mloop, &mesh->ldata, mesh->totpoly); BKE_mesh_tessface_clear(mesh); BKE_mesh_calc_normals(mesh); DAG_id_tag_update(&mesh->id, 0); }
void MeshImporter::bmeshConversion() { for (std::map<COLLADAFW::UniqueId, Mesh *>::iterator m = uid_mesh_map.begin(); m != uid_mesh_map.end(); ++m) { if ((*m).second) { Mesh *me = (*m).second; BKE_mesh_tessface_clear(me); BKE_mesh_calc_normals(me); //BKE_mesh_validate(me, 1); } } }