diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-08-06 17:44:15 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-08-06 17:44:26 +0300 |
commit | 3fab16fe8eb4a99607e00d5716ba88bf24020354 (patch) | |
tree | a14e541cbda24671ec882b2a90db32427a978bb8 /source/blender/editors/transform/transform_snap.c | |
parent | 4f64fa4f8628aa514ec1f14d798b2f406a3bf6ef (diff) |
Fix T90477: Cursor vertex snapping not working in UV editor
`t->obedit_type` is read to indicate if we are in uv edit mode.
Also fixes a crash introduced in {rBdd14ea18190ff27082009f73a556569a43377a71}.
Diffstat (limited to 'source/blender/editors/transform/transform_snap.c')
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 2619fdf3403..656a1e5d9c7 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -575,7 +575,7 @@ static void initSnappingMode(TransInfo *t) { ToolSettings *ts = t->settings; /* All obedit types will match. */ - const int obedit_type = t->data_container->obedit ? t->data_container->obedit->type : -1; + const int obedit_type = t->obedit_type; ViewLayer *view_layer = t->view_layer; Base *base_act = view_layer->basact; @@ -609,15 +609,22 @@ static void initSnappingMode(TransInfo *t) } } - if ((t->spacetype == SPACE_VIEW3D || t->spacetype == SPACE_IMAGE) && - (t->options & CTX_CAMERA) == 0) { + if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE) && !(t->options & CTX_CAMERA)) { /* Only 3D view or UV. */ /* Not with camera selected in camera view. */ setSnappingCallback(t); - if ((obedit_type != -1) && - ELEM(obedit_type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE, OB_MBALL)) { + if (t->options & (CTX_GPENCIL_STROKES | CTX_CURSOR | CTX_OBMODE_XFORM_OBDATA)) { + /* In "Edit Strokes" mode, + * snap tool can perform snap to selected or active objects (see T49632) + * TODO: perform self snap in gpencil_strokes. + * + * When we're moving the origins, allow snapping onto our own geometry (see T69132). */ + t->tsnap.modeSelect = SNAP_ALL; + } + else if ((obedit_type != -1) && + ELEM(obedit_type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE, OB_MBALL)) { /* Edit mode */ /* Temporary limited to edit mode meshes, armature, curves, metaballs. */ @@ -636,17 +643,7 @@ static void initSnappingMode(TransInfo *t) } else if (obedit_type == -1) { /* Object mode */ - if (t->options & (CTX_GPENCIL_STROKES | CTX_CURSOR | CTX_OBMODE_XFORM_OBDATA)) { - /* In "Edit Strokes" mode, - * snap tool can perform snap to selected or active objects (see T49632) - * TODO: perform self snap in gpencil_strokes. - * - * When we're moving the origins, allow snapping onto our own geometry (see T69132). */ - t->tsnap.modeSelect = SNAP_ALL; - } - else { - t->tsnap.modeSelect = SNAP_NOT_SELECTED; - } + t->tsnap.modeSelect = SNAP_NOT_SELECTED; } else { /* Increment if snap is not possible */ |