diff options
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_mesh_conv.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_conv.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 24a06ea3d6f..e0c8cb61900 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -112,6 +112,7 @@ void BM_mesh_cd_flag_apply(BMesh *bm, const char cd_flag) /* CustomData_bmesh_init_pool() must run first */ BLI_assert(bm->vdata.totlayer == 0 || bm->vdata.pool != NULL); BLI_assert(bm->edata.totlayer == 0 || bm->edata.pool != NULL); + BLI_assert(bm->pdata.totlayer == 0 || bm->pdata.pool != NULL); if (cd_flag & ME_CDFLAG_VERT_BWEIGHT) { if (!CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) { @@ -145,6 +146,29 @@ void BM_mesh_cd_flag_apply(BMesh *bm, const char cd_flag) BM_data_layer_free(bm, &bm->edata, CD_CREASE); } } +#ifdef WITH_FREESTYLE + if (cd_flag & ME_CDFLAG_FREESTYLE_EDGE) { + if (!CustomData_has_layer(&bm->edata, CD_FREESTYLE_EDGE)) { + BM_data_layer_add(bm, &bm->edata, CD_FREESTYLE_EDGE); + } + } + else { + if (CustomData_has_layer(&bm->edata, CD_FREESTYLE_EDGE)) { + BM_data_layer_free(bm, &bm->edata, CD_FREESTYLE_EDGE); + } + } + + if (cd_flag & ME_CDFLAG_FREESTYLE_FACE) { + if (!CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE)) { + BM_data_layer_add(bm, &bm->pdata, CD_FREESTYLE_FACE); + } + } + else { + if (CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE)) { + BM_data_layer_free(bm, &bm->pdata, CD_FREESTYLE_FACE); + } + } +#endif } char BM_mesh_cd_flag_from_bmesh(BMesh *bm) @@ -159,6 +183,14 @@ char BM_mesh_cd_flag_from_bmesh(BMesh *bm) if (CustomData_has_layer(&bm->edata, CD_CREASE)) { cd_flag |= ME_CDFLAG_EDGE_CREASE; } +#ifdef WITH_FREESTYLE + if (CustomData_has_layer(&bm->edata, CD_FREESTYLE_EDGE)) { + cd_flag |= ME_CDFLAG_FREESTYLE_EDGE; + } + if (CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE)) { + cd_flag |= ME_CDFLAG_FREESTYLE_FACE; + } +#endif return cd_flag; } |