From 35dc4ba9e23ac37a22fee49c813aee2a6a2d3e61 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Mon, 25 Apr 2022 12:31:13 -0300 Subject: Fix T97401: Snap options ignored for Nurbs surfaces The editing data of a `SURF`s is similar to that of Curves and should be supported for snapping. But unlike Curve objects, for snapping, only support the nurb points if the object is in edit mode. This matches the solution for Meshes and avoids having to create a kind of "boundbox" for the SURF nurb points. --- source/blender/editors/transform/transform_snap.c | 8 +++++++- source/blender/editors/transform/transform_snap_object.cc | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 23619a2049a..afad4df2c88 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -638,7 +638,13 @@ static short snap_select_type_get(TransInfo *t) const int obedit_type = t->obedit_type; if (obedit_type != -1) { /* Edit mode */ - if (ELEM(obedit_type, OB_MESH, OB_ARMATURE, OB_CURVES_LEGACY, OB_LATTICE, OB_MBALL)) { + if (ELEM(obedit_type, + OB_MESH, + OB_ARMATURE, + OB_CURVES_LEGACY, + OB_SURF, + OB_LATTICE, + OB_MBALL)) { /* Temporary limited to edit mode meshes, armature, curves, lattice and metaballs. */ if ((obedit_type == OB_MESH) && (t->flag & T_PROP_EDIT)) { diff --git a/source/blender/editors/transform/transform_snap_object.cc b/source/blender/editors/transform/transform_snap_object.cc index abeb376a9a6..f533b2c298c 100644 --- a/source/blender/editors/transform/transform_snap_object.cc +++ b/source/blender/editors/transform/transform_snap_object.cc @@ -2746,6 +2746,14 @@ static void snap_obj_fn(SnapObjectContext *sctx, sctx, params, ob_eval, obmat, dt->dist_px, dt->r_loc, dt->r_no, dt->r_index); break; /* Use ATTR_FALLTHROUGH if we want to snap to the generated mesh. */ case OB_SURF: + if (BKE_object_is_in_editmode(ob_eval)) { + retval = snapCurve( + sctx, params, ob_eval, obmat, dt->dist_px, dt->r_loc, dt->r_no, dt->r_index); + if (params->edit_mode_type != SNAP_GEOM_FINAL) { + break; + } + } + ATTR_FALLTHROUGH; case OB_FONT: { const Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob_eval); if (mesh_eval) { -- cgit v1.2.3