Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_snap.c
| Show First 20 Lines • Show All 807 Lines • ▼ Show 20 Lines | if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE, SPACE_SEQ)) { | ||||
| } | } | ||||
| } | } | ||||
| if (t->spacetype == SPACE_VIEW3D) { | if (t->spacetype == SPACE_VIEW3D) { | ||||
| if (t->tsnap.object_context == NULL) { | if (t->tsnap.object_context == NULL) { | ||||
| t->tsnap.use_backface_culling = snap_use_backface_culling(t); | t->tsnap.use_backface_culling = snap_use_backface_culling(t); | ||||
| t->tsnap.object_context = ED_transform_snap_object_context_create(t->scene, 0); | t->tsnap.object_context = ED_transform_snap_object_context_create(t->scene, 0); | ||||
| if (t->data_type == TC_MESH_VERTS) { | if (t->data_type == &TransConvertType_Mesh) { | ||||
| /* Ignore elements being transformed. */ | /* Ignore elements being transformed. */ | ||||
| ED_transform_snap_object_context_set_editmesh_callbacks( | ED_transform_snap_object_context_set_editmesh_callbacks( | ||||
| t->tsnap.object_context, | t->tsnap.object_context, | ||||
| (bool (*)(BMVert *, void *))BM_elem_cb_check_hflag_disabled, | (bool (*)(BMVert *, void *))BM_elem_cb_check_hflag_disabled, | ||||
| bm_edge_is_snap_target, | bm_edge_is_snap_target, | ||||
| bm_face_is_snap_target, | bm_face_is_snap_target, | ||||
| POINTER_FROM_UINT((BM_ELEM_SELECT | BM_ELEM_HIDDEN))); | POINTER_FROM_UINT((BM_ELEM_SELECT | BM_ELEM_HIDDEN))); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | static void snap_target_median_impl(TransInfo *t, float r_median[3]) | ||||
| // TargetSnapOffset(t, NULL); | // TargetSnapOffset(t, NULL); | ||||
| } | } | ||||
| static void snap_target_grid_ensure(TransInfo *t) | static void snap_target_grid_ensure(TransInfo *t) | ||||
| { | { | ||||
| /* Only need to calculate once. */ | /* Only need to calculate once. */ | ||||
| if ((t->tsnap.status & TARGET_GRID_INIT) == 0) { | if ((t->tsnap.status & TARGET_GRID_INIT) == 0) { | ||||
| if (t->data_type == TC_CURSOR_VIEW3D) { | if (t->data_type == &TransConvertType_Cursor3D) { | ||||
| /* Use a fallback when transforming the cursor. | /* Use a fallback when transforming the cursor. | ||||
| * In this case the center is _not_ derived from the cursor which is being transformed. */ | * In this case the center is _not_ derived from the cursor which is being transformed. */ | ||||
| copy_v3_v3(t->tsnap.snapTargetGrid, TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->data->iloc); | copy_v3_v3(t->tsnap.snapTargetGrid, TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->data->iloc); | ||||
| } | } | ||||
| else if (t->around == V3D_AROUND_CURSOR) { | else if (t->around == V3D_AROUND_CURSOR) { | ||||
| /* Use a fallback for cursor selection, | /* Use a fallback for cursor selection, | ||||
| * this isn't useful as a global center for absolute grid snapping | * this isn't useful as a global center for absolute grid snapping | ||||
| * since its not based on the position of the selection. */ | * since its not based on the position of the selection. */ | ||||
| ▲ Show 20 Lines • Show All 580 Lines • Show Last 20 Lines | |||||