diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-05-29 19:17:29 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-05-29 19:18:29 +0300 |
commit | 9dafc8ee2c542949e87e5e81b0ba5088bbd46af9 (patch) | |
tree | a3f676d5286eb18e6625de4967aa27d8bf1ea4c4 /source/blender/editors | |
parent | dff24f96f07f3180c601186cb23147bd8437dffe (diff) |
Snap: add support for meshes generated from other types of objects.
Curves with modifiers generate a mesh internally.
These can be used for raycasting.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/transform/transform_snap_object.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index f81d01ca754..0043a424208 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -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) { |