|
Blender V4.3
|
Snap cursor. More...
#include "DNA_object_types.h"#include "BLI_listbase.h"#include "BLI_math_matrix.h"#include "BLI_math_vector_types.hh"#include "BLI_rect.h"#include "MEM_guardedalloc.h"#include "BKE_context.hh"#include "BKE_global.hh"#include "BKE_layer.hh"#include "BKE_main.hh"#include "BKE_object.hh"#include "BKE_scene.hh"#include "BKE_screen.hh"#include "GPU_immediate.hh"#include "GPU_matrix.hh"#include "ED_screen.hh"#include "ED_transform.hh"#include "ED_transform_snap_object_context.hh"#include "ED_view3d.hh"#include "UI_resources.hh"#include "RNA_access.hh"#include "DEG_depsgraph_query.hh"#include "WM_api.hh"Go to the source code of this file.
Classes | |
| struct | SnapStateIntern |
| struct | SnapCursorDataIntern |
Macros | |
| #define | STATE_INTERN_GET(state) |
| #define | FADE(v) |
Variables | |
| static SnapCursorDataIntern | g_data_intern |
| static const float | eps_view_align = 1e-2f |
Snap cursor.
Definition in file view3d_cursor_snap.cc.
Referenced by v3d_cursor_plane_draw_grid().
Definition at line 44 of file view3d_cursor_snap.cc.
Referenced by ED_view3d_cursor_snap_state_active_set(), and ED_view3d_cursor_snap_state_free().
Definition at line 325 of file view3d_cursor_snap.cc.
References GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_line_width(), GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), imm_draw_cube_corners_3d(), immBindBuiltinProgram(), immUnbindProgram(), immUniformColor4ubv(), and immVertexFormat().
Referenced by v3d_cursor_snap_draw_fn().
|
static |
Definition at line 343 of file view3d_cursor_snap.cc.
References copy_v3_fl3(), GPU_matrix_model_view_get, GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_set, GPU_PRIM_LINE_LOOP, GPU_PRIM_LINE_STRIP, GPU_PRIM_LINES, imm_draw_circle_wire_3d(), immBegin(), immEnd(), immUniformColor4ubv(), immVertex3f(), SCE_SNAP_TO_EDGE, SCE_SNAP_TO_EDGE_ENDPOINT, SCE_SNAP_TO_EDGE_MIDPOINT, SCE_SNAP_TO_EDGE_PERPENDICULAR, SCE_SNAP_TO_FACE, SCE_SNAP_TO_GRID, SCE_SNAP_TO_POINT, translate_m4(), and UNPACK3.
Referenced by ED_view3d_cursor_snap_draw_util().
| SnapObjectContext * ED_view3d_cursor_snap_context_ensure | ( | Scene * | scene | ) |
Definition at line 1098 of file view3d_cursor_snap.cc.
References g_data_intern, SnapCursorDataIntern::snap_context_v3d, and v3d_cursor_snap_context_ensure().
Referenced by ED_gizmotypes_snap_3d_context_ensure().
| V3DSnapCursorData * ED_view3d_cursor_snap_data_get | ( | ) |
Definition at line 1092 of file view3d_cursor_snap.cc.
References g_data_intern, and SnapCursorDataIntern::snap_data.
Referenced by ED_gizmotypes_snap_3d_data_get(), ED_gizmotypes_snap_3d_is_enabled(), gizmo_snap_rna_location_get_fn(), gizmo_snap_rna_location_set_fn(), gizmo_snap_rna_normal_get_fn(), gizmo_snap_rna_snap_elem_index_get_fn(), gizmo_snap_rna_snap_srouce_type_get_fn(), gizmo_snap_rna_snap_srouce_type_set_fn(), snap_gizmo_test_select(), view3d_interactive_add_calc_snap(), and view3d_ob_drop_matrix_from_snap().
| void ED_view3d_cursor_snap_data_update | ( | V3DSnapCursorState * | state, |
| const bContext * | C, | ||
| const ARegion * | region, | ||
| const int | x, | ||
| const int | y ) |
Definition at line 1075 of file view3d_cursor_snap.cc.
References CTX_data_ensure_evaluated_depsgraph(), CTX_wm_view3d(), CTX_wm_window(), DEG_get_input_scene(), depsgraph, ED_view3d_cursor_snap_state_active_get(), wmWindow::eventstate, g_data_intern, SnapCursorDataIntern::modifier, state, v3d_cursor_eventstate_has_changed(), and v3d_cursor_snap_update().
Referenced by ED_gizmotypes_snap_3d_data_get(), snap_gizmo_test_select(), and view3d_interactive_add_begin().
| void ED_view3d_cursor_snap_draw_util | ( | RegionView3D * | rv3d, |
| const float | source_loc[3], | ||
| const float | target_loc[3], | ||
| const eSnapMode | source_type, | ||
| const eSnapMode | target_type, | ||
| const uchar | source_color[4], | ||
| const uchar | target_color[4] ) |
Definition at line 420 of file view3d_cursor_snap.cc.
References cursor_point_draw(), ED_view3d_pixel_size(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_line_width(), GPU_PRIM_LINES, GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2f(), immUniformColor4ubv(), immVertex3fv(), immVertexFormat(), pos, SCE_SNAP_TO_EDGE_PERPENDICULAR, TH_VERTEX_SIZE, and UI_GetThemeValuef().
Referenced by drawSnapping(), and v3d_cursor_snap_draw_fn().
| V3DSnapCursorState * ED_view3d_cursor_snap_state_active_get | ( | ) |
Definition at line 944 of file view3d_cursor_snap.cc.
References BLI_listbase_is_empty(), g_data_intern, ListBase::last, SnapCursorDataIntern::state_default, and SnapCursorDataIntern::state_intern.
Referenced by ED_view3d_cursor_snap_data_update(), ED_view3d_cursor_snap_state_prevpoint_set(), gizmo_snap_state_from_rna_get(), v3d_cursor_snap_draw_fn(), v3d_cursor_snap_poll_fn(), view3d_interactive_add_begin(), and view3d_ob_drop_copy_local_id().
| void ED_view3d_cursor_snap_state_active_set | ( | V3DSnapCursorState * | state | ) |
Definition at line 953 of file view3d_cursor_snap.cc.
References BLI_addtail(), BLI_assert_unreachable, BLI_remlink_safe(), g_data_intern, ListBase::last, state, SnapCursorDataIntern::state_default, SnapCursorDataIntern::state_intern, and STATE_INTERN_GET.
Referenced by snap_gizmo_draw().
| V3DSnapCursorState * ED_view3d_cursor_snap_state_create | ( | ) |
Definition at line 1029 of file view3d_cursor_snap.cc.
References BLI_addtail(), g_data_intern, SnapCursorDataIntern::handle, MEM_mallocN, SnapStateIntern::snap_state, SnapCursorDataIntern::state_default, SnapCursorDataIntern::state_intern, and v3d_cursor_snap_activate().
Referenced by snap_gizmo_draw(), snap_gizmo_setup(), view3d_interactive_add_begin(), view3d_ob_drop_on_enter(), and WIDGETGROUP_placement_setup().
| void ED_view3d_cursor_snap_state_default_set | ( | V3DSnapCursorState * | state | ) |
Definition at line 1015 of file view3d_cursor_snap.cc.
References V3DSnapCursorState::draw_box, V3DSnapCursorState::draw_plane, g_data_intern, V3DSnapCursorState::poll, V3DSnapCursorState::poll_data, V3DSnapCursorState::prevpoint, state, and SnapCursorDataIntern::state_default.
| void ED_view3d_cursor_snap_state_free | ( | V3DSnapCursorState * | state | ) |
Definition at line 1044 of file view3d_cursor_snap.cc.
References BLI_listbase_is_empty(), BLI_remlink(), g_data_intern, MEM_freeN(), state, SnapCursorDataIntern::state_intern, STATE_INTERN_GET, and v3d_cursor_snap_free().
Referenced by preview_plane_free_fn(), snap_cursor_free(), view3d_interactive_add_exit(), and view3d_ob_drop_on_exit().
| void ED_view3d_cursor_snap_state_prevpoint_set | ( | V3DSnapCursorState * | state, |
| const float | prev_point[3] ) |
Definition at line 1059 of file view3d_cursor_snap.cc.
References copy_v3_v3(), ED_view3d_cursor_snap_state_active_get(), g_data_intern, SnapCursorDataIntern::prevpoint_stack, and state.
Referenced by gizmo_snap_rna_prevpoint_set_fn(), view3d_interactive_add_begin(), and view3d_interactive_add_modal().
|
static |
Re-order mat so axis_align uses its own axis which is closest to v.
Definition at line 134 of file view3d_cursor_snap.cc.
References copy_m3_m3(), copy_v3_v3(), dot_v3v3(), fabsf, mod_i(), and v.
Referenced by v3d_cursor_snap_update().
|
static |
Definition at line 488 of file view3d_cursor_snap.cc.
References SnapCursorDataIntern::last_eventstate, SnapCursorDataIntern::modifier, state, V3D_SNAPCURSOR_TOGGLE_ALWAYS_TRUE, SnapCursorDataIntern::x, and SnapCursorDataIntern::y.
Referenced by ED_view3d_cursor_snap_data_update(), and v3d_cursor_snap_draw_fn().
|
static |
Definition at line 519 of file view3d_cursor_snap.cc.
References SnapCursorDataIntern::last_eventstate, and SnapCursorDataIntern::modifier.
Referenced by v3d_cursor_snap_update().
|
static |
Definition at line 510 of file view3d_cursor_snap.cc.
References cursor_snap, x, and y.
Referenced by v3d_cursor_snap_update().
|
static |
Definition at line 525 of file view3d_cursor_snap.cc.
References ELEM, EVT_LEFTALTKEY, EVT_LEFTCTRLKEY, EVT_LEFTSHIFTKEY, EVT_OSKEY, EVT_RIGHTALTKEY, EVT_RIGHTCTRLKEY, EVT_RIGHTSHIFTKEY, G, V3DSnapCursorData::is_snap_invert, wmKeyMap::items, SnapCursorDataIntern::keymap, KM_ALT, KM_CTRL, KM_OSKEY, KM_SHIFT, KMI_INACTIVE, SnapCursorDataIntern::last_eventstate, LISTBASE_FOREACH, SnapCursorDataIntern::modifier, SnapCursorDataIntern::snap_data, SnapCursorDataIntern::snap_on, and WM_keymap_active().
Referenced by v3d_cursor_snap_update().
|
static |
Definition at line 259 of file view3d_cursor_snap.cc.
References ceil_power_of_10(), dot_v3v3(), ED_view3d_global_to_vector(), ED_view3d_pixel_size(), fabsf, RegionView3D::is_persp, max_ff(), negate_v3_v3(), RegionView3D::ofs, square_f(), UI_SCALE_FAC, and v3d_cursor_plane_draw_grid().
Referenced by v3d_cursor_snap_draw_fn().
|
static |
Definition at line 162 of file view3d_cursor_snap.cc.
References BLI_assert, FADE, float, GPU_blend(), GPU_BLEND_ADDITIVE, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_line_width(), GPU_PRIM_LINES, GPU_SHADER_3D_SMOOTH_COLOR, GPU_vertformat_attr_add(), immAttr4fv(), immBeginAtMost(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immVertex3fv(), immVertexFormat(), MEM_freeN(), MEM_mallocN, mul_m4_v3(), UNPACK4, v2, x, and y.
Referenced by v3d_cursor_plane_draw().
|
static |
Calculate a 3x3 orientation matrix from the surface under the cursor.
Definition at line 101 of file view3d_cursor_snap.cc.
References copy_m3_m4(), copy_v3_v3(), dot_v3v3(), fabsf, negate_v3(), normalize_m3(), and orthogonalize_m3().
Referenced by v3d_cursor_snap_update().
|
static |
Definition at line 973 of file view3d_cursor_snap.cc.
References G, g_data_intern, SnapCursorDataIntern::handle, SnapCursorDataIntern::is_initiated, SnapCursorDataIntern::keymap, wmKeyMap::modal_items, RGN_TYPE_WINDOW, RNA_enum_value_from_id(), SnapCursorDataIntern::snap_on, SPACE_VIEW3D, v3d_cursor_snap_draw_fn(), v3d_cursor_snap_poll_fn(), WM_modalkeymap_find(), and WM_paint_cursor_activate().
Referenced by ED_view3d_cursor_snap_state_create().
|
static |
Definition at line 591 of file view3d_cursor_snap.cc.
References g_data_intern, LISTBASE_FOREACH, state, and SnapCursorDataIntern::state_intern.
Referenced by v3d_cursor_snap_update().
|
static |
Definition at line 578 of file view3d_cursor_snap.cc.
References ED_transform_snap_object_context_create(), ED_transform_snap_object_context_destroy(), g_data_intern, scene, SnapCursorDataIntern::scene, and SnapCursorDataIntern::snap_context_v3d.
Referenced by ED_view3d_cursor_snap_context_ensure(), and v3d_cursor_snap_update().
Definition at line 869 of file view3d_cursor_snap.cc.
References BKE_area_find_region_type(), BKE_area_find_region_xy(), copy_m4_m3(), copy_v3_v3(), CTX_data_ensure_evaluated_depsgraph(), CTX_wm_area(), CTX_wm_view3d(), CTX_wm_window(), cursor_box_draw(), DEG_get_input_scene(), depsgraph, ED_view3d_cursor_snap_draw_util(), ED_view3d_cursor_snap_state_active_get(), wmWindow::eventstate, g_data_intern, GPU_matrix_mul, GPU_matrix_projection_set, GPU_matrix_set, V3DSnapCursorData::loc, SnapCursorDataIntern::modifier, V3DSnapCursorData::plane_omat, RGN_ALIGN_QSPLIT, RGN_TYPE_WINDOW, SCE_SNAP_TO_EDGE_PERPENDICULAR, SCE_SNAP_TO_NONE, SnapCursorDataIntern::snap_data, state, V3DSnapCursorData::type_source, V3DSnapCursorData::type_target, UNPACK2, v3d_cursor_eventstate_has_changed(), v3d_cursor_plane_draw(), v3d_cursor_snap_update(), RegionView3D::viewmat, RegionView3D::winmat, wmViewport(), wmWindowViewport(), and xy.
Referenced by v3d_cursor_snap_activate().
|
static |
Definition at line 564 of file view3d_cursor_snap.cc.
References SCE_SNAP_ABS_GRID, SCE_SNAP_TO_GRID, SCE_SNAP_TO_INCREMENT, SCE_SNAP_TO_NONE, ToolSettings::snap_flag, ToolSettings::snap_mode, and ToolSettings::snap_mode_tools.
Referenced by v3d_cursor_snap_update().
|
static |
Definition at line 1000 of file view3d_cursor_snap.cc.
References ED_transform_snap_object_context_destroy(), g_data_intern, G_MAIN, SnapCursorDataIntern::handle, SnapCursorDataIntern::snap_context_v3d, and WM_paint_cursor_end().
Referenced by ED_view3d_cursor_snap_state_free().
|
static |
Definition at line 827 of file view3d_cursor_snap.cc.
References BKE_area_find_region_type(), CTX_wm_area(), CTX_wm_region(), CTX_wm_window(), ED_region_overlap_isect_xy(), ED_view3d_cursor_snap_state_active_get(), wmWindow::eventstate, G, RegionView3D::rflag, RGN_TYPE_WINDOW, RV3D_NAVIGATING, SPACE_VIEW3D, and state.
Referenced by v3d_cursor_snap_activate().
|
static |
Definition at line 602 of file view3d_cursor_snap.cc.
References BKE_scene_orientation_get_index(), BKE_view_layer_active_object_get(), BKE_view_layer_synced_ensure(), BLI_assert, BLI_assert_msg, copy_m3_m3(), copy_m3_m4(), copy_m4_m4(), copy_v3_v3(), copy_v3_v3_int(), CTX_data_scene(), CTX_data_view_layer(), depsgraph, dot_v3v3(), ED_transform_calc_orientation_from_type_ex(), ED_transform_snap_object_project_view3d(), ED_transform_snap_object_project_view3d_ex(), ED_view3d_win_to_3d(), ED_view3d_win_to_3d_on_plane(), V3DSnapCursorData::elem_index, eps_view_align, fabsf, float, g_data_intern, V3DSnapCursorData::is_enabled, RegionView3D::is_persp, V3DSnapCursorData::is_snap_invert, is_zero_v3(), V3DSnapCursorData::loc, mat3_align_axis_to_v3(), negate_v3(), negate_v3_v3(), V3DSnapCursorData::nor, V3DSnapCursorData::obmat, orthogonalize_m3(), params, ToolSettings::plane_axis, ToolSettings::plane_depth, plane_from_point_normal_v3(), V3DSnapCursorData::plane_omat, ToolSettings::plane_orient, SCE_ORIENT_DEFAULT, SCE_SNAP, SCE_SNAP_TARGET_ALL, SCE_SNAP_TO_EDGE, SCE_SNAP_TO_EDGE_MIDPOINT, SCE_SNAP_TO_EDGE_PERPENDICULAR, SCE_SNAP_TO_FACE, SCE_SNAP_TO_GEOM, SCE_SNAP_TO_GRID, SCE_SNAP_TO_NONE, SCE_SNAP_TO_VERTEX, SnapCursorDataIntern::snap_context_v3d, SnapCursorDataIntern::snap_data, SnapCursorDataIntern::snap_elem_hidden, ToolSettings::snap_flag, SNAP_GEOM_CAGE, SNAP_GEOM_EDIT, SNAP_GEOM_FINAL, SNAP_OCCLUSION_ALWAYS, SNAP_OCCLUSION_AS_SEEM, SNAP_OCCLUSION_NEVER, state, sub_v3_v3v3(), V3DSnapCursorData::type_target, unit_m3(), ToolSettings::use_plane_axis_auto, v3d_cursor_eventstate_save_modifier(), v3d_cursor_eventstate_save_xy(), v3d_cursor_is_snap_invert(), v3d_cursor_poject_surface_normal(), v3d_cursor_snap_calc_plane(), v3d_cursor_snap_context_ensure(), v3d_cursor_snap_elements(), V3D_PLACE_DEPTH_CURSOR_VIEW, V3D_PLACE_DEPTH_SURFACE, V3D_PLACE_ORIENT_SURFACE, V3D_SNAPCURSOR_OCCLUSION_ALWAYS_TRUE, V3D_SNAPCURSOR_SNAP_EDIT_GEOM_CAGE, V3D_SNAPCURSOR_SNAP_EDIT_GEOM_FINAL, V3D_SNAPCURSOR_TOGGLE_ALWAYS_TRUE, RegionView3D::viewinv, and zero_v3().
Referenced by ED_view3d_cursor_snap_data_update(), and v3d_cursor_snap_draw_fn().
Dot products below this will be considered view aligned. In this case we can't usefully project the mouse cursor onto the plane.
Definition at line 96 of file view3d_cursor_snap.cc.
Referenced by v3d_cursor_snap_update().
|
static |
Definition at line 81 of file view3d_cursor_snap.cc.
Referenced by ED_view3d_cursor_snap_context_ensure(), ED_view3d_cursor_snap_data_get(), ED_view3d_cursor_snap_data_update(), ED_view3d_cursor_snap_state_active_get(), ED_view3d_cursor_snap_state_active_set(), ED_view3d_cursor_snap_state_create(), ED_view3d_cursor_snap_state_default_set(), ED_view3d_cursor_snap_state_free(), ED_view3d_cursor_snap_state_prevpoint_set(), v3d_cursor_snap_activate(), v3d_cursor_snap_calc_plane(), v3d_cursor_snap_context_ensure(), v3d_cursor_snap_draw_fn(), v3d_cursor_snap_free(), and v3d_cursor_snap_update().