1
1

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.
This commit is contained in:
2022-04-25 12:31:13 -03:00
parent 6963703801
commit 35dc4ba9e2
2 changed files with 15 additions and 1 deletions

View File

@@ -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)) {

View File

@@ -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) {