[Bf-blender-cvs] [35dc4ba9e23] master: Fix T97401: Snap options ignored for Nurbs surfaces

Germano Cavalcante noreply at git.blender.org
Mon Apr 25 17:36:10 CEST 2022


Commit: 35dc4ba9e23ac37a22fee49c813aee2a6a2d3e61
Author: Germano Cavalcante
Date:   Mon Apr 25 12:31:13 2022 -0300
Branches: master
https://developer.blender.org/rB35dc4ba9e23ac37a22fee49c813aee2a6a2d3e61

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.

===================================================================

M	source/blender/editors/transform/transform_snap.c
M	source/blender/editors/transform/transform_snap_object.cc

===================================================================

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



More information about the Bf-blender-cvs mailing list