Mesh Remap: Change the sphere_radius parameter instead of creating a bvhtree with...
authorGermano <germano.costa@ig.com.br>
Fri, 4 May 2018 10:43:08 +0000 (07:43 -0300)
committerGermano <germano.costa@ig.com.br>
Fri, 4 May 2018 10:43:08 +0000 (07:43 -0300)
This is the desirable behavior.
It also removes one more use of `bvhtree_from_mesh_looptri`.

source/blender/blenkernel/intern/mesh_remap.c

index 8dc812463dbee03b9d4f55e60377a3e3f1ed0097..84994e807842ba71b34b811da2ca2fe68bd0ba87 100644 (file)
@@ -543,15 +543,13 @@ void BKE_mesh_remap_calc_verts_from_dm(
                        float *weights = MEM_mallocN(sizeof(*weights) * tmp_buff_size, __func__);
 
                        dm_src->getVertCos(dm_src, vcos_src);
-                       if (mode & MREMAP_USE_NORPROJ) {
-                               bvhtree_from_mesh_looptri(
-                                       &treedata, dm_src, ray_radius, 2, 6);
-                       }
-                       else {
-                               bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_LOOPTRI, 2);
-                       }
+
+                       bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_LOOPTRI, 2);
 
                        if (mode == MREMAP_MODE_VERT_POLYINTERP_VNORPROJ) {
+                               if (mode & MREMAP_USE_NORPROJ) {
+                                       treedata.sphere_radius = ray_radius;
+                               }
                                for (i = 0; i < numverts_dst; i++) {
                                        copy_v3_v3(tmp_co, verts_dst[i].co);
                                        normal_short_to_float_v3(tmp_no, verts_dst[i].no);