Page MenuHome

Edit Mode - 3D Cursor Snapping not working correctly
Closed, ResolvedPublic


Blender Version
Broken: Blender 2.8 dc26ef081b9

Short description of error
Once you start changing a mesh in edit mode the 3D cursor becomes confused on where it is supposed to snap to when left clicking.
Sometimes it snaps on the initial position of the polygons or it instead snaps slightly inside or outside of the surface of the mesh or doesn't snap at all. Once you switch into object mode the snapping works like normal again.
This can already be seen by just going into edit mode on the standard cube, moving/rotating/scaling it in any way and trying to left click on any surface of that cube.

Event Timeline

One solution (allowing the ray cast algorithm to see the edited mesh when available) is:

diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 66eaf34865f..d89d425f95b 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -4614,7 +4614,7 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2])
                        &(const struct SnapObjectParams){
                            .snap_select = SNAP_ALL,
-                           .use_object_edit_cage = false,
+                           .use_object_edit_cage = true,
                        mval_fl, &dist_px,
                        cursor_curr->location, ray_no, NULL,
Inês Almeida (brita_) claimed this task.

@Adam Latchem (adamlatchem), setting use_object_edit_cage = true doesn't fix the issue. Although I think this is the correct solution, it's just that the option isn't working at the moment.

From looking at the code the editmesh bvh isn't cached, so every time you snap the cursor it will generate a new BVH for all edit-meshes.

@Germano Cavalcante (mano-wii) could you look into this?

Bastien Montagne (mont29) triaged this task as Confirmed, Medium priority.Jul 22 2018, 1:14 PM

Re-assigning to mano-wii who is actually doing the work on this one :)