Extrude Widget: with/without axis constraint
[blender.git] / source / blender / editors / transform / transform_snap_object.c
index 5c46d1d0e597f109eca0e4f34e29ee9cf4f7e952..40b714100149d4a4f7afe67ae584940b85b2cf4c 100644 (file)
@@ -450,7 +450,7 @@ static bool raycastDerivedMesh(
                }
 
                if (treedata->tree == NULL) {
-                       bvhtree_from_mesh_looptri(treedata, dm, 0.0f, 4, 6);
+                       bvhtree_from_mesh_get(treedata, dm, BVHTREE_FROM_LOOPTRI, 4);
 
                        if (treedata->tree == NULL) {
                                return retval;
@@ -1694,10 +1694,10 @@ static bool snapDerivedMesh(
                if (treedata->tree == NULL) {
                        switch (snapdata->snap_to) {
                                case SCE_SNAP_MODE_EDGE:
-                                       bvhtree_from_mesh_edges(treedata, dm, 0.0f, 2, 6);
+                                       bvhtree_from_mesh_get(treedata, dm, BVHTREE_FROM_EDGES, 2);
                                        break;
                                case SCE_SNAP_MODE_VERTEX:
-                                       bvhtree_from_mesh_verts(treedata, dm, 0.0f, 2, 6);
+                                       bvhtree_from_mesh_get(treedata, dm, BVHTREE_FROM_VERTS, 2);
                                        break;
                        }
                }
@@ -2083,7 +2083,7 @@ static bool snapObjectsRay(
  * \{ */
 
 SnapObjectContext *ED_transform_snap_object_context_create(
-        Main *bmain, Scene *scene, int flag)
+        Main *bmain, Scene *scene, Depsgraph *depsgraph, int flag)
 {
        SnapObjectContext *sctx = MEM_callocN(sizeof(*sctx), __func__);
 
@@ -2091,6 +2091,7 @@ SnapObjectContext *ED_transform_snap_object_context_create(
 
        sctx->bmain = bmain;
        sctx->scene = scene;
+       sctx->depsgraph = depsgraph;
 
        sctx->cache.object_map = BLI_ghash_ptr_new(__func__);
        sctx->cache.mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
@@ -2099,11 +2100,11 @@ SnapObjectContext *ED_transform_snap_object_context_create(
 }
 
 SnapObjectContext *ED_transform_snap_object_context_create_view3d(
-        Main *bmain, Scene *scene, int flag,
+        Main *bmain, Scene *scene, Depsgraph *depsgraph, int flag,
         /* extra args for view3d */
         const ARegion *ar, const View3D *v3d)
 {
-       SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, flag);
+       SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, depsgraph, flag);
 
        sctx->use_v3d = true;
        sctx->v3d_data.ar = ar;
@@ -2355,7 +2356,8 @@ bool ED_transform_snap_object_project_view3d_ex(
         const struct SnapObjectParams *params,
         const float mval[2], float *dist_px,
         float *ray_depth,
-        float r_loc[3], float r_no[3], int *r_index)
+        float r_loc[3], float r_no[3], int *r_index,
+        Object **r_ob, float r_obmat[4][4])
 {
        float ray_origin[3], ray_start[3], ray_normal[3], depth_range[2], ray_end[3];
 
@@ -2388,7 +2390,7 @@ bool ED_transform_snap_object_project_view3d_ex(
                        sctx,
                        ray_start, ray_normal,
                        params->snap_select, params->use_object_edit_cage,
-                       ray_depth, r_loc, r_no, r_index, NULL, NULL, NULL);
+                       ray_depth, r_loc, r_no, r_index, r_ob, r_obmat, NULL);
        }
        else {
                SnapData snapdata;
@@ -2399,7 +2401,7 @@ bool ED_transform_snap_object_project_view3d_ex(
                return snapObjectsRay(
                        sctx, &snapdata,
                        params->snap_select, params->use_object_edit_cage,
-                       ray_depth, dist_px, r_loc, r_no, NULL, NULL);
+                       ray_depth, dist_px, r_loc, r_no, r_ob, r_obmat);
        }
 }
 
@@ -2417,7 +2419,8 @@ bool ED_transform_snap_object_project_view3d(
                params,
                mval, dist_px,
                ray_depth,
-               r_loc, r_no, NULL);
+               r_loc, r_no, NULL,
+               NULL, NULL);
 }
 
 /**