diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-08 01:58:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-08 01:58:58 +0400 |
commit | db4a85162d2f7f8ffac9fd905dafabfefe4360d7 (patch) | |
tree | 682af11eb14eab5bdb6a744aab4dbf65d24f1854 /source/blender/blenkernel | |
parent | 333433d15e049971792f56580044893aa74837ce (diff) |
edits to rna/tessface UV layer needed to get OBJ import/export functional.
add the function to create new UV layers, this only works when there are no polygon layers already created (to prevent confusion since scripts with polygon layers should be adding MTexPoly and MLoopUV layers)
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index d5d96bcd79b..e298f087e9c 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1904,6 +1904,12 @@ void convert_mfaces_to_mpolys(Mesh *mesh) int numTex, numCol; int i, j, totloop; + /* just incase some of these layers are filled in (can happen with python created meshes) */ + CustomData_free(&mesh->ldata, mesh->totloop); + CustomData_free(&mesh->pdata, mesh->totpoly); + memset(&mesh->ldata, 0, sizeof(mesh->ldata)); + memset(&mesh->pdata, 0, sizeof(mesh->pdata)); + mesh->totpoly = mesh->totface; mesh->mpoly = MEM_callocN(sizeof(MPoly)*mesh->totpoly, "mpoly converted"); CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_ASSIGN, mesh->mpoly, mesh->totpoly); |