Snap: add support for meshes generated from other types of objects.

Curves with modifiers generate a mesh internally.
These can be used for raycasting.
This commit is contained in:
Germano Cavalcante 2019-05-29 13:17:29 -03:00
parent dff24f96f0
commit 9dafc8ee2c
Notes: blender-bot 2023-02-14 02:26:40 +01:00
Referenced by issue #65133, Selection not snapping to mesh generated from curves with modifiers
1 changed files with 32 additions and 13 deletions

View File

@ -712,22 +712,21 @@ static bool raycastObj(SnapObjectContext *sctx,
ListBase *r_hit_list)
{
bool retval = false;
if (use_occlusion_test) {
if (use_obedit && sctx->use_v3d && XRAY_ENABLED(sctx->v3d_data.v3d)) {
/* Use of occlude geometry in editing mode disabled. */
return false;
}
if (ELEM(ob->dt, OB_BOUNDBOX, OB_WIRE)) {
/* Do not hit objects that are in wire or bounding box
* display mode. */
return false;
}
}
switch (ob->type) {
case OB_MESH: {
if (use_occlusion_test) {
if (use_obedit && sctx->use_v3d && XRAY_ENABLED(sctx->v3d_data.v3d)) {
/* Use of occlude geometry in editing mode disabled. */
return false;
}
if (ELEM(ob->dt, OB_BOUNDBOX, OB_WIRE)) {
/* Do not hit objects that are in wire or bounding box
* display mode. */
return false;
}
}
Mesh *me = ob->data;
bool use_hide = false;
if (BKE_object_is_in_editmode(ob)) {
@ -767,6 +766,26 @@ static bool raycastObj(SnapObjectContext *sctx,
r_hit_list);
break;
}
case OB_CURVE:
case OB_SURF:
case OB_FONT: {
if (ob->runtime.mesh_eval) {
retval = raycastMesh(sctx,
ray_start,
ray_dir,
ob,
ob->runtime.mesh_eval,
obmat,
ob_index,
false,
ray_depth,
r_loc,
r_no,
r_index,
r_hit_list);
break;
}
}
}
if (retval) {