diff options
-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__); |