diff options
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 26120b771bf..449146fe640 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2163,7 +2163,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData me->flag &= ~ME_FGON; } - polyindex = CustomData_get_layer(fdata, CD_POLYINDEX); + polyindex = CustomData_get_layer(fdata, CD_ORIGINDEX); j = 0; /* current loop index */ ml = mloop; @@ -2505,12 +2505,9 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, ScanFillContext sf_ctx; ScanFillVert *sf_vert, *sf_vert_last, *sf_vert_first; ScanFillFace *sf_tri; - int *mface_orig_index = NULL; - BLI_array_declare(mface_orig_index); int *mface_to_poly_map = NULL; BLI_array_declare(mface_to_poly_map); int lindex[4]; /* only ever use 3 in this case */ - int *poly_orig_index; int poly_index, j, mface_index; const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY); @@ -2528,7 +2525,6 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, mface_index = 0; mp = mpoly; - poly_orig_index = CustomData_get_layer(pdata, CD_ORIGINDEX); for (poly_index = 0; poly_index < totpoly; poly_index++, mp++) { if (mp->totloop < 3) { /* do nothing */ @@ -2548,10 +2544,6 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, mf->v4 = 0; \ mf->mat_nr = mp->mat_nr; \ mf->flag = mp->flag; \ - if (poly_orig_index) { \ - BLI_array_append(mface_orig_index, \ - poly_orig_index[poly_index]); \ - } \ (void)0 /* ALMOST IDENTICAL TO DEFINE ABOVE (see EXCEPTION) */ @@ -2567,10 +2559,6 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, mf->v4 = mp->loopstart + 3; /* EXCEPTION */ \ mf->mat_nr = mp->mat_nr; \ mf->flag = mp->flag; \ - if (poly_orig_index) { \ - BLI_array_append(mface_orig_index, \ - poly_orig_index[poly_index]); \ - } \ mf->edcode |= TESSFACE_IS_QUAD; /* EXCEPTION */ \ (void)0 @@ -2617,9 +2605,6 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, if (totfilltri) { BLI_array_grow_items(mface_to_poly_map, totfilltri); BLI_array_grow_items(mface, totfilltri); - if (poly_orig_index) { - BLI_array_grow_items(mface_orig_index, totfilltri); - } for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next, mf++) { mface_to_poly_map[mface_index] = poly_index; @@ -2638,10 +2623,6 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, mf->edcode |= TESSFACE_SCANFILL; /* tag for sorting loop indices */ #endif - if (poly_orig_index) { - mface_orig_index[mface_index] = poly_orig_index[poly_index]; - } - mface_index++; } } @@ -2659,23 +2640,13 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, if (LIKELY((MEM_allocN_len(mface) / sizeof(*mface)) != totface)) { mface = MEM_reallocN(mface, sizeof(*mface) * totface); mface_to_poly_map = MEM_reallocN(mface_to_poly_map, sizeof(*mface_to_poly_map) * totface); - if (mface_orig_index) { - mface_orig_index = MEM_reallocN(mface_orig_index, sizeof(*mface_orig_index) * totface); - } } CustomData_add_layer(fdata, CD_MFACE, CD_ASSIGN, mface, totface); - /* CD_POLYINDEX will contain an array of indices from tessfaces to the polygons + /* CD_ORIGINDEX will contain an array of indices from tessfaces to the polygons * they are directly tessellated from */ - CustomData_add_layer(fdata, CD_POLYINDEX, CD_ASSIGN, mface_to_poly_map, totface); - if (mface_orig_index) { - /* If polys had a CD_ORIGINDEX layer, then the tessellated faces will get this - * layer as well, pointing to polys from the original mesh (not the polys - * that just got tessellated) */ - CustomData_add_layer(fdata, CD_ORIGINDEX, CD_ASSIGN, mface_orig_index, totface); - } - + CustomData_add_layer(fdata, CD_ORIGINDEX, CD_ASSIGN, mface_to_poly_map, totface); CustomData_from_bmeshpoly(fdata, pdata, ldata, totface); if (do_face_nor_cpy) { |