diff options
author | Germano <germano.costa@ig.com.br> | 2018-05-04 00:19:36 +0300 |
---|---|---|
committer | Germano <germano.costa@ig.com.br> | 2018-05-04 00:19:36 +0300 |
commit | 133dadcdee15bfde06c538ff013781a308833175 (patch) | |
tree | 8ba93713c4ff2d05ab4d878f6092b3aede811b6e | |
parent | 7915cc7ddbc221385e824f737ff7e48e5f52a1dd (diff) |
Fix `Transfer Mesh Data` with `Edge Mapping` of type `Projected Edge Interpolated` and `Ray Radius` other than 0.0.
`MREMAP_RAYCAST_APPROXIMATE_BVHEPSILON(ray_radius)` greatly increased the radius making for example that 0.1 becoming 1.5
Now the result is much more predictable.
-rw-r--r-- | source/blender/blenkernel/intern/mesh_remap.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c index c503799d28f..8dc812463db 100644 --- a/source/blender/blenkernel/intern/mesh_remap.c +++ b/source/blender/blenkernel/intern/mesh_remap.c @@ -862,7 +862,7 @@ void BKE_mesh_remap_calc_edges_from_dm( /* Here it's simpler to just allocate for all edges :/ */ float *weights = MEM_mallocN(sizeof(*weights) * (size_t)numedges_src, __func__); - bvhtree_from_mesh_edges(&treedata, dm_src, MREMAP_RAYCAST_APPROXIMATE_BVHEPSILON(ray_radius), 2, 6); + bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_EDGES, 2); for (i = 0; i < numedges_dst; i++) { /* For each dst edge, we sample some rays from it (interpolated from its vertices) @@ -916,8 +916,10 @@ void BKE_mesh_remap_calc_edges_from_dm( interp_v3_v3v3_slerp_safe(tmp_no, v1_no, v2_no, fac); while (n--) { + float radius = (ray_radius / w); + treedata.sphere_radius = radius; if (mesh_remap_bvhtree_query_raycast( - &treedata, &rayhit, tmp_co, tmp_no, ray_radius / w, max_dist, &hit_dist)) + &treedata, &rayhit, tmp_co, tmp_no, radius, max_dist, &hit_dist)) { weights[rayhit.index] += w; totweights += w; |