Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_cursor_snap.c
| Show First 20 Lines • Show All 708 Lines • ▼ Show 20 Lines | if (orient_surface) { | ||||
| } | } | ||||
| v3d_cursor_poject_surface_normal(face_nor, obmat, omat); | v3d_cursor_poject_surface_normal(face_nor, obmat, omat); | ||||
| } | } | ||||
| } | } | ||||
| float *co_depth = snap_elem ? co : scene->cursor.location; | float *co_depth = snap_elem ? co : scene->cursor.location; | ||||
| snap_elem &= ~data_intern->snap_elem_hidden; | snap_elem &= ~data_intern->snap_elem_hidden; | ||||
| if (snap_elem == 0) { | if (snap_elem == 0) { | ||||
| RegionView3D *rv3d = region->regiondata; | |||||
| float plane[4]; | float plane[4]; | ||||
| if (state->plane_depth != V3D_PLACE_DEPTH_CURSOR_VIEW) { | if (state->plane_depth != V3D_PLACE_DEPTH_CURSOR_VIEW) { | ||||
| const float *plane_normal = omat[state->plane_axis]; | const float *plane_normal = omat[state->plane_axis]; | ||||
| plane_from_point_normal_v3(plane, co_depth, plane_normal); | plane_from_point_normal_v3(plane, co_depth, plane_normal); | ||||
| } | } | ||||
| if ((state->plane_depth == V3D_PLACE_DEPTH_CURSOR_VIEW) || | if ((state->plane_depth == V3D_PLACE_DEPTH_CURSOR_VIEW) || | ||||
| !ED_view3d_win_to_3d_on_plane(region, plane, mval_fl, true, co)) { | !ED_view3d_win_to_3d_on_plane(region, plane, mval_fl, rv3d->is_persp, co)) { | ||||
| ED_view3d_win_to_3d(v3d, region, co_depth, mval_fl, co); | ED_view3d_win_to_3d(v3d, region, co_depth, mval_fl, co); | ||||
| } | } | ||||
| if (snap_data->is_enabled && (snap_elements & SCE_SNAP_MODE_INCREMENT)) { | if (snap_data->is_enabled && (snap_elements & SCE_SNAP_MODE_INCREMENT)) { | ||||
| v3d_cursor_snap_calc_incremental(scene, v3d, region, state->prevpoint, co); | v3d_cursor_snap_calc_incremental(scene, v3d, region, state->prevpoint, co); | ||||
| } | } | ||||
| } | } | ||||
| else if (snap_elem == SCE_SNAP_MODE_VERTEX) { | else if (snap_elem == SCE_SNAP_MODE_VERTEX) { | ||||
| ▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | if (data_intern->snap_context_v3d) { | ||||
| ED_transform_snap_object_context_destroy(data_intern->snap_context_v3d); | ED_transform_snap_object_context_destroy(data_intern->snap_context_v3d); | ||||
| data_intern->snap_context_v3d = NULL; | data_intern->snap_context_v3d = NULL; | ||||
| } | } | ||||
| } | } | ||||
| void ED_view3d_cursor_snap_state_default_set(V3DSnapCursorState *state) | void ED_view3d_cursor_snap_state_default_set(V3DSnapCursorState *state) | ||||
| { | { | ||||
| g_data_intern.state_default = *state; | g_data_intern.state_default = *state; | ||||
| /* These values are temporarily set by the tool. | |||||
| * They are not convenient as default values. | |||||
| * So reset to null. */ | |||||
| g_data_intern.state_default.gzgrp_type = NULL; | |||||
| g_data_intern.state_default.prevpoint = NULL; | |||||
| g_data_intern.state_default.draw_plane = false; | |||||
| g_data_intern.state_default.draw_box = false; | |||||
| } | } | ||||
| V3DSnapCursorState *ED_view3d_cursor_snap_active(void) | V3DSnapCursorState *ED_view3d_cursor_snap_active(void) | ||||
| { | { | ||||
| SnapCursorDataIntern *data_intern = &g_data_intern; | SnapCursorDataIntern *data_intern = &g_data_intern; | ||||
| if (!data_intern->handle) { | if (!data_intern->handle) { | ||||
| v3d_cursor_snap_activate(); | v3d_cursor_snap_activate(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines | |||||