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).
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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__);
|
||||
|
||||
Reference in New Issue
Block a user