Commit: 133dadcdee15bfde06c538ff013781a308833175
Author: Germano
Date:   Thu May 3 18:19:36 2018 -0300
Branches: master
https://developer.blender.org/rB133dadcdee15bfde06c538ff013781a308833175

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.

===================================================================

M       source/blender/blenkernel/intern/mesh_remap.c

===================================================================

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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to