Fix Data Transfer Projected Face/Edge Interpolated mode is wrong
Caused by {rBcfa53e0fbeed} Above commit mixed up source and destination meshes causing bad lookups on calculated normals. Now make sure we get normals from our destination mesh to project along. Note this was only reported for Projected Face Interpolated mode, but same was true for Projected Edge Interpolated mode (though that one is a bit weird to test since I think there is generally something wrong with that mode -- with or without rBcfa53e0fbeed). Fixes T97528 Maniphest Tasks: T97528 Differential Revision: https://developer.blender.org/D14726
This commit is contained in:
parent
5179b8236b
commit
9c279723da
Notes:
blender-bot
2023-05-29 09:17:12 +02:00
Referenced by issue #97528, Regression: Data Transfer Projected Face Interpolated mode gives wrong results
|
@ -178,6 +178,7 @@ void BKE_mesh_remap_calc_verts_from_mesh(int mode,
|
|||
int numverts_dst,
|
||||
bool dirty_nors_dst,
|
||||
struct Mesh *me_src,
|
||||
struct Mesh *me_dst,
|
||||
MeshPairRemap *r_map);
|
||||
|
||||
void BKE_mesh_remap_calc_edges_from_mesh(int mode,
|
||||
|
@ -190,6 +191,7 @@ void BKE_mesh_remap_calc_edges_from_mesh(int mode,
|
|||
int numedges_dst,
|
||||
bool dirty_nors_dst,
|
||||
struct Mesh *me_src,
|
||||
struct Mesh *me_dst,
|
||||
MeshPairRemap *r_map);
|
||||
|
||||
void BKE_mesh_remap_calc_loops_from_mesh(int mode,
|
||||
|
|
|
@ -1501,6 +1501,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
|
|||
num_verts_dst,
|
||||
dirty_nors_dst,
|
||||
me_src,
|
||||
me_dst,
|
||||
&geom_map[VDATA]);
|
||||
geom_map_init[VDATA] = true;
|
||||
}
|
||||
|
@ -1579,6 +1580,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
|
|||
num_edges_dst,
|
||||
dirty_nors_dst,
|
||||
me_src,
|
||||
me_dst,
|
||||
&geom_map[EDATA]);
|
||||
geom_map_init[EDATA] = true;
|
||||
}
|
||||
|
|
|
@ -478,6 +478,7 @@ void BKE_mesh_remap_calc_verts_from_mesh(const int mode,
|
|||
const int numverts_dst,
|
||||
const bool UNUSED(dirty_nors_dst),
|
||||
Mesh *me_src,
|
||||
Mesh *me_dst,
|
||||
MeshPairRemap *r_map)
|
||||
{
|
||||
const float full_weight = 1.0f;
|
||||
|
@ -580,7 +581,7 @@ void BKE_mesh_remap_calc_verts_from_mesh(const int mode,
|
|||
MPoly *polys_src = me_src->mpoly;
|
||||
MLoop *loops_src = me_src->mloop;
|
||||
float(*vcos_src)[3] = BKE_mesh_vert_coords_alloc(me_src, NULL);
|
||||
const float(*vert_normals_src)[3] = BKE_mesh_vertex_normals_ensure(me_src);
|
||||
const float(*vert_normals_dst)[3] = BKE_mesh_vertex_normals_ensure(me_dst);
|
||||
|
||||
size_t tmp_buff_size = MREMAP_DEFAULT_BUFSIZE;
|
||||
float(*vcos)[3] = MEM_mallocN(sizeof(*vcos) * tmp_buff_size, __func__);
|
||||
|
@ -592,7 +593,7 @@ void BKE_mesh_remap_calc_verts_from_mesh(const int mode,
|
|||
if (mode == MREMAP_MODE_VERT_POLYINTERP_VNORPROJ) {
|
||||
for (i = 0; i < numverts_dst; i++) {
|
||||
copy_v3_v3(tmp_co, verts_dst[i].co);
|
||||
copy_v3_v3(tmp_no, vert_normals_src[i]);
|
||||
copy_v3_v3(tmp_no, vert_normals_dst[i]);
|
||||
|
||||
/* Convert the vertex to tree coordinates, if needed. */
|
||||
if (space_transform) {
|
||||
|
@ -703,6 +704,7 @@ void BKE_mesh_remap_calc_edges_from_mesh(const int mode,
|
|||
const int numedges_dst,
|
||||
const bool UNUSED(dirty_nors_dst),
|
||||
Mesh *me_src,
|
||||
Mesh *me_dst,
|
||||
MeshPairRemap *r_map)
|
||||
{
|
||||
const float full_weight = 1.0f;
|
||||
|
@ -938,7 +940,7 @@ void BKE_mesh_remap_calc_edges_from_mesh(const int mode,
|
|||
|
||||
BKE_bvhtree_from_mesh_get(&treedata, me_src, BVHTREE_FROM_EDGES, 2);
|
||||
|
||||
const float(*vert_normals_dst)[3] = BKE_mesh_vertex_normals_ensure(me_src);
|
||||
const float(*vert_normals_dst)[3] = BKE_mesh_vertex_normals_ensure(me_dst);
|
||||
|
||||
for (i = 0; i < numedges_dst; i++) {
|
||||
/* For each dst edge, we sample some rays from it (interpolated from its vertices)
|
||||
|
|
Loading…
Reference in New Issue