Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mesh/mesh_data.c
| Show First 20 Lines • Show All 905 Lines • ▼ Show 20 Lines | static void mesh_add_verts(Mesh *mesh, int len) | ||||
| CustomData vdata; | CustomData vdata; | ||||
| MVert *mvert; | MVert *mvert; | ||||
| int i, totvert; | int i, totvert; | ||||
| if (len == 0) | if (len == 0) | ||||
| return; | return; | ||||
| totvert = mesh->totvert + len; | totvert = mesh->totvert + len; | ||||
| CustomData_copy(&mesh->vdata, &vdata, CD_MASK_MESH, CD_DEFAULT, totvert); | CustomData_copy(&mesh->vdata, &vdata, CD_MASK_MESH.vmask, CD_DEFAULT, totvert); | ||||
| CustomData_copy_data(&mesh->vdata, &vdata, 0, 0, mesh->totvert); | CustomData_copy_data(&mesh->vdata, &vdata, 0, 0, mesh->totvert); | ||||
| if (!CustomData_has_layer(&vdata, CD_MVERT)) | if (!CustomData_has_layer(&vdata, CD_MVERT)) | ||||
| CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, NULL, totvert); | CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, NULL, totvert); | ||||
| CustomData_free(&mesh->vdata, mesh->totvert); | CustomData_free(&mesh->vdata, mesh->totvert); | ||||
| mesh->vdata = vdata; | mesh->vdata = vdata; | ||||
| BKE_mesh_update_customdata_pointers(mesh, false); | BKE_mesh_update_customdata_pointers(mesh, false); | ||||
| Show All 16 Lines | static void mesh_add_edges(Mesh *mesh, int len) | ||||
| int i, totedge; | int i, totedge; | ||||
| if (len == 0) | if (len == 0) | ||||
| return; | return; | ||||
| totedge = mesh->totedge + len; | totedge = mesh->totedge + len; | ||||
| /* update customdata */ | /* update customdata */ | ||||
| CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge); | CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH.emask, CD_DEFAULT, totedge); | ||||
| CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge); | CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge); | ||||
| if (!CustomData_has_layer(&edata, CD_MEDGE)) | if (!CustomData_has_layer(&edata, CD_MEDGE)) | ||||
| CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge); | CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge); | ||||
| CustomData_free(&mesh->edata, mesh->totedge); | CustomData_free(&mesh->edata, mesh->totedge); | ||||
| mesh->edata = edata; | mesh->edata = edata; | ||||
| BKE_mesh_update_customdata_pointers(mesh, false); /* new edges don't change tessellation */ | BKE_mesh_update_customdata_pointers(mesh, false); /* new edges don't change tessellation */ | ||||
| Show All 13 Lines | static void mesh_add_tessfaces(Mesh *mesh, int len) | ||||
| int i, totface; | int i, totface; | ||||
| if (len == 0) | if (len == 0) | ||||
| return; | return; | ||||
| totface = mesh->totface + len; /* new face count */ | totface = mesh->totface + len; /* new face count */ | ||||
| /* update customdata */ | /* update customdata */ | ||||
| CustomData_copy(&mesh->fdata, &fdata, CD_MASK_MESH, CD_DEFAULT, totface); | CustomData_copy(&mesh->fdata, &fdata, CD_MASK_MESH.fmask, CD_DEFAULT, totface); | ||||
| CustomData_copy_data(&mesh->fdata, &fdata, 0, 0, mesh->totface); | CustomData_copy_data(&mesh->fdata, &fdata, 0, 0, mesh->totface); | ||||
| if (!CustomData_has_layer(&fdata, CD_MFACE)) | if (!CustomData_has_layer(&fdata, CD_MFACE)) | ||||
| CustomData_add_layer(&fdata, CD_MFACE, CD_CALLOC, NULL, totface); | CustomData_add_layer(&fdata, CD_MFACE, CD_CALLOC, NULL, totface); | ||||
| CustomData_free(&mesh->fdata, mesh->totface); | CustomData_free(&mesh->fdata, mesh->totface); | ||||
| mesh->fdata = fdata; | mesh->fdata = fdata; | ||||
| BKE_mesh_update_customdata_pointers(mesh, true); | BKE_mesh_update_customdata_pointers(mesh, true); | ||||
| Show All 12 Lines | static void mesh_add_loops(Mesh *mesh, int len) | ||||
| int totloop; | int totloop; | ||||
| if (len == 0) | if (len == 0) | ||||
| return; | return; | ||||
| totloop = mesh->totloop + len; /* new face count */ | totloop = mesh->totloop + len; /* new face count */ | ||||
| /* update customdata */ | /* update customdata */ | ||||
| CustomData_copy(&mesh->ldata, &ldata, CD_MASK_MESH, CD_DEFAULT, totloop); | CustomData_copy(&mesh->ldata, &ldata, CD_MASK_MESH.lmask, CD_DEFAULT, totloop); | ||||
| CustomData_copy_data(&mesh->ldata, &ldata, 0, 0, mesh->totloop); | CustomData_copy_data(&mesh->ldata, &ldata, 0, 0, mesh->totloop); | ||||
| if (!CustomData_has_layer(&ldata, CD_MLOOP)) | if (!CustomData_has_layer(&ldata, CD_MLOOP)) | ||||
| CustomData_add_layer(&ldata, CD_MLOOP, CD_CALLOC, NULL, totloop); | CustomData_add_layer(&ldata, CD_MLOOP, CD_CALLOC, NULL, totloop); | ||||
| CustomData_free(&mesh->ldata, mesh->totloop); | CustomData_free(&mesh->ldata, mesh->totloop); | ||||
| mesh->ldata = ldata; | mesh->ldata = ldata; | ||||
| BKE_mesh_update_customdata_pointers(mesh, true); | BKE_mesh_update_customdata_pointers(mesh, true); | ||||
| mesh->totloop = totloop; | mesh->totloop = totloop; | ||||
| } | } | ||||
| static void mesh_add_polys(Mesh *mesh, int len) | static void mesh_add_polys(Mesh *mesh, int len) | ||||
| { | { | ||||
| CustomData pdata; | CustomData pdata; | ||||
| MPoly *mpoly; | MPoly *mpoly; | ||||
| int i, totpoly; | int i, totpoly; | ||||
| if (len == 0) | if (len == 0) | ||||
| return; | return; | ||||
| totpoly = mesh->totpoly + len; /* new face count */ | totpoly = mesh->totpoly + len; /* new face count */ | ||||
| /* update customdata */ | /* update customdata */ | ||||
| CustomData_copy(&mesh->pdata, &pdata, CD_MASK_MESH, CD_DEFAULT, totpoly); | CustomData_copy(&mesh->pdata, &pdata, CD_MASK_MESH.pmask, CD_DEFAULT, totpoly); | ||||
| CustomData_copy_data(&mesh->pdata, &pdata, 0, 0, mesh->totpoly); | CustomData_copy_data(&mesh->pdata, &pdata, 0, 0, mesh->totpoly); | ||||
| if (!CustomData_has_layer(&pdata, CD_MPOLY)) | if (!CustomData_has_layer(&pdata, CD_MPOLY)) | ||||
| CustomData_add_layer(&pdata, CD_MPOLY, CD_CALLOC, NULL, totpoly); | CustomData_add_layer(&pdata, CD_MPOLY, CD_CALLOC, NULL, totpoly); | ||||
| CustomData_free(&mesh->pdata, mesh->totpoly); | CustomData_free(&mesh->pdata, mesh->totpoly); | ||||
| mesh->pdata = pdata; | mesh->pdata = pdata; | ||||
| BKE_mesh_update_customdata_pointers(mesh, true); | BKE_mesh_update_customdata_pointers(mesh, true); | ||||
| ▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines | |||||