diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-08 13:45:00 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-08 19:53:31 +0300 |
commit | cdba2bc0fce86e814aaa5a969a018b5c1c9f8b3b (patch) | |
tree | 9c14874fd4e5b208bd80a269cf9a5c413cb1ff08 /source/blender/blenkernel | |
parent | 2a40c6ee2bba46b4e4475c45c2d2332cb417a541 (diff) |
BKE mesh remap: add utils to add needed cddata mask for source mesh.
In some cases (currently, only when using avanced mapping of loops),
code needs access to some cddata of the source mesh (CD_NORMAL...).
We need a way to inform calling code about that (actual issue requiring
this change is fixed in next commit).
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh_remap.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_remap.c | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_mesh_remap.h b/source/blender/blenkernel/BKE_mesh_remap.h index 170ee9f0ccb..754e5b2cd05 100644 --- a/source/blender/blenkernel/BKE_mesh_remap.h +++ b/source/blender/blenkernel/BKE_mesh_remap.h @@ -22,6 +22,7 @@ */ struct CustomData; +struct CustomData_MeshMasks; struct MVert; struct MemArena; struct Mesh; @@ -136,6 +137,10 @@ enum { MREMAP_MODE_TOPOLOGY = MREMAP_MODE_VERT | MREMAP_MODE_EDGE | MREMAP_MODE_LOOP | MREMAP_MODE_POLY, }; +void BKE_mesh_remap_calc_source_cddata_masks_from_map_modes( + const int vert_mode, const int edge_mode, const int loop_mode, const int poly_mode, + struct CustomData_MeshMasks *cddata_mask); + float BKE_mesh_remap_calc_difference_from_mesh( const struct SpaceTransform *space_transform, const struct MVert *verts_dst, const int numverts_dst, struct Mesh *me_src); diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c index ccb6265b17a..55e8a96fa16 100644 --- a/source/blender/blenkernel/intern/mesh_remap.c +++ b/source/blender/blenkernel/intern/mesh_remap.c @@ -303,6 +303,22 @@ void BKE_mesh_remap_find_best_match_from_mesh( /** \name Mesh to mesh mapping * \{ */ +void BKE_mesh_remap_calc_source_cddata_masks_from_map_modes( + const int UNUSED(vert_mode), const int UNUSED(edge_mode), const int loop_mode, const int UNUSED(poly_mode), + CustomData_MeshMasks *cddata_mask) +{ + /* vert, edge and poly mapping modes never need extra cddata from source object. */ + const bool need_lnors_src = (loop_mode & MREMAP_USE_LOOP) && (loop_mode & MREMAP_USE_NORMAL); + const bool need_pnors_src = need_lnors_src || ((loop_mode & MREMAP_USE_POLY) && (loop_mode & MREMAP_USE_NORMAL)); + + if (need_lnors_src) { + cddata_mask->lmask |= CD_MASK_NORMAL; + } + if (need_pnors_src) { + cddata_mask->pmask |= CD_MASK_NORMAL; + } +} + void BKE_mesh_remap_init(MeshPairRemap *map, const int items_num) { MemArena *mem = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); |