|
Blender V4.3
|
#include "DNA_curve_types.h"#include "BLI_math_geom.h"#include "BLI_math_matrix.hh"#include "BLI_math_rotation.h"#include "BLI_math_vector.hh"#include "BLI_rect.h"#include "BKE_context.hh"#include "BKE_layer.hh"#include "BKE_object.hh"#include "BKE_paint.hh"#include "BKE_vfont.hh"#include "DEG_depsgraph_query.hh"#include "ED_screen.hh"#include "ED_transform.hh"#include "WM_api.hh"#include "RNA_access.hh"#include "RNA_define.hh"#include "view3d_intern.hh"#include "view3d_navigate.hh"Go to the source code of this file.
Classes | |
| struct | ViewOpsData_Utility |
Functions | |
| static eViewOpsFlag | viewops_flag_from_prefs () |
Navigation Utilities | |
| static const ViewOpsType * | view3d_navigation_type_from_idname (const char *idname) |
| ViewOpsData * | ED_view3d_navigation_init (bContext *C, const wmKeyMapItem *kmi_merge) |
| bool | ED_view3d_navigation_do (bContext *C, ViewOpsData *vod, const wmEvent *event, const float depth_loc_override[3]) |
| void | ED_view3d_navigation_free (bContext *C, ViewOpsData *vod) |
ViewOpsData definition | |
| static eViewOpsFlag | navigate_pivot_get (bContext *C, Depsgraph *depsgraph, ARegion *region, View3D *v3d, const wmEvent *event, eViewOpsFlag viewops_flag, const float dyn_ofs_override[3], float r_pivot[3]) |
Generic Operator Callback Utils | |
| static bool | view3d_navigation_poll_impl (bContext *C, const char viewlock) |
| static eV3D_OpEvent | view3d_navigate_event (ViewOpsData *vod, const wmEvent *event) |
| static int | view3d_navigation_invoke_generic (bContext *C, ViewOpsData *vod, const wmEvent *event, PointerRNA *ptr, const ViewOpsType *nav_type, const float dyn_ofs_override[3]) |
| int | view3d_navigate_invoke_impl (bContext *C, wmOperator *op, const wmEvent *event, const ViewOpsType *nav_type) |
Generic Callbacks | |
| bool | view3d_location_poll (bContext *C) |
| bool | view3d_rotation_poll (bContext *C) |
| bool | view3d_zoom_or_dolly_poll (bContext *C) |
| int | view3d_navigate_modal_fn (bContext *C, wmOperator *op, const wmEvent *event) |
| void | view3d_navigate_cancel_fn (bContext *C, wmOperator *op) |
Generic View Operator Properties | |
| void | view3d_operator_properties_common (wmOperatorType *ot, const enum eV3D_OpPropFlag flag) |
Generic View Operator Custom-Data | |
| void | calctrackballvec (const rcti *rect, const int event_xy[2], float r_dir[3]) |
| void | view3d_orbit_apply_dyn_ofs (float r_ofs[3], const float ofs_old[3], const float viewquat_old[4], const float viewquat_new[4], const float dyn_ofs[3]) |
| static void | view3d_orbit_apply_dyn_ofs_ortho_correction (float ofs[3], const float viewquat_old[4], const float viewquat_new[4], const float dyn_ofs[3]) |
| void | viewrotate_apply_dyn_ofs (ViewOpsData *vod, const float viewquat_new[4]) |
| bool | view3d_orbit_calc_center (bContext *C, float r_dyn_ofs[3]) |
| ViewOpsData * | viewops_data_create (bContext *C, const wmEvent *event, const ViewOpsType *nav_type, const bool use_cursor_init) |
| void | viewops_data_free (bContext *C, ViewOpsData *vod) |
Generic View Operator Utilities | |
| void | axis_set_view (bContext *C, View3D *v3d, ARegion *region, const float quat_[4], char view, char view_axis_roll, int perspo, const float *align_to_quat, const int smooth_viewtx) |
| void | viewmove_apply (ViewOpsData *vod, int x, int y) |
| void axis_set_view | ( | bContext * | C, |
| View3D * | v3d, | ||
| ARegion * | region, | ||
| const float | quat_[4], | ||
| char | view, | ||
| char | view_axis_roll, | ||
| int | perspo, | ||
| const float * | align_to_quat, | ||
| const int | smooth_viewtx ) |
| align_to_quat | When not nullptr, set the axis relative to this rotation. |
Definition at line 886 of file view3d_navigate.cc.
References C, View3D::camera, V3D_SmoothParams::camera_old, copy_v3_v3(), CTX_data_ensure_evaluated_depsgraph(), DEG_get_evaluated_object(), RegionView3D::dist, V3D_SmoothParams::dist, V3D_SmoothParams::dyn_ofs, ED_region_tag_redraw(), ED_view3d_from_object(), ED_view3d_smooth_view(), mul_qt_qtqt(), negate_v3(), normalize_qt_qt(), RegionView3D::ofs, V3D_SmoothParams::ofs, RegionView3D::persp, V3D_SmoothParams::quat, ARegion::regiondata, RV3D_CAMOB, RV3D_LOCK_FLAGS, RV3D_LOCK_ROTATION, RV3D_ORTHO, RV3D_VIEW_AXIS_ROLL_0, RV3D_VIEW_IS_AXIS, RV3D_VIEW_USER, U, V3D_SmoothParams::undo_str, USER_AUTOPERSP, USER_ORBIT_SELECTION, RegionView3D::view, view, view3d_orbit_calc_center(), and RegionView3D::view_axis_roll.
Referenced by view_axis_exec(), and view_camera_exec().
Definition at line 666 of file view3d_navigate.cc.
References BLI_rcti_cent_x(), BLI_rcti_cent_y(), BLI_rcti_size_x(), BLI_rcti_size_y(), float, len_v2(), M_SQRT2, min_ff(), size(), sqrtf, square_f(), and V3D_OP_TRACKBALLSIZE.
Referenced by ViewOpsData::init_navigation(), and viewrotate_apply().
| bool ED_view3d_navigation_do | ( | bContext * | C, |
| ViewOpsData * | vod, | ||
| const wmEvent * | event, | ||
| const float | depth_loc_override[3] ) |
Definition at line 1075 of file view3d_navigate.cc.
References ViewOpsType::apply_fn, C, ViewOpsData::depsgraph, ED_view3d_update_viewmat(), ViewOpsData::end_navigation(), EVT_MODAL_MAP, ViewOpsData_Utility::is_modal_event, ViewOpsData_Utility::keymap_items, LISTBASE_FOREACH, ViewOpsData::nav_type, OPERATOR_CANCELLED, OPERATOR_RUNNING_MODAL, ViewOpsType::poll_fn, ViewOpsData::region, RegionView3D::rflag, ViewOpsData::rv3d, RV3D_NAVIGATING, ViewOpsData::scene, wmEvent::type, ViewOpsData::v3d, wmEvent::val, view3d_navigate_event(), view3d_navigation_invoke_generic(), view3d_navigation_type_from_idname(), WM_event_match(), and wmEvent::xy.
Referenced by blender::ed::greasepencil::grease_pencil_primitive_modal(), and transform_modal().
| void ED_view3d_navigation_free | ( | bContext * | C, |
| ViewOpsData * | vod ) |
Definition at line 1148 of file view3d_navigate.cc.
References C, and ViewOpsData::end_navigation().
Referenced by blender::ed::greasepencil::grease_pencil_primitive_exit(), and postTrans().
| ViewOpsData * ED_view3d_navigation_init | ( | bContext * | C, |
| const wmKeyMapItem * | kmi_merge ) |
Utilities to perform navigation. Call ED_view3d_navigation_init to create a context and ED_view3d_navigation_do to perform navigation in modal operators.
Definition at line 1064 of file view3d_navigate.cc.
References C, and CTX_wm_region_view3d().
Referenced by blender::ed::greasepencil::grease_pencil_primitive_invoke(), and initTransInfo().
|
static |
Definition at line 172 of file view3d_navigate.cc.
References BLI_assert, C, CTX_wm_window(), depsgraph, ED_view3d_autodist(), ED_view3d_autodist_last_check(), ED_view3d_autodist_last_clear(), ED_view3d_autodist_last_get(), ED_view3d_autodist_last_set(), ED_view3d_depth_override(), ED_view3d_has_depth_buffer_updated(), ED_view3d_win_to_3d_int(), wmEvent::mval, negate_v3_v3(), RegionView3D::ofs, ARegion::regiondata, V3D_DEPTH_NO_GPENCIL, view3d_orbit_calc_center(), VIEWOPS_FLAG_DEPTH_NAVIGATE, and VIEWOPS_FLAG_ORBIT_SELECT.
Referenced by ViewOpsData::init_navigation().
| bool view3d_location_poll | ( | bContext * | C | ) |
Definition at line 584 of file view3d_navigate.cc.
References C, RV3D_LOCK_LOCATION, and view3d_navigation_poll_impl().
Referenced by VIEW3D_OT_move(), VIEW3D_OT_view_center_cursor(), VIEW3D_OT_view_center_pick(), and VIEW3D_OT_view_pan().
| void view3d_navigate_cancel_fn | ( | bContext * | C, |
| wmOperator * | op ) |
Definition at line 625 of file view3d_navigate.cc.
References C, wmOperator::customdata, and viewops_data_free().
Referenced by VIEW3D_OT_dolly(), VIEW3D_OT_move(), VIEW3D_OT_rotate(), VIEW3D_OT_view_roll(), and VIEW3D_OT_zoom().
|
static |
Definition at line 486 of file view3d_navigate.cc.
References ViewOpsData::axis_snap, wmEvent::customdata, ViewOpsData::event_type, EVT_ESCKEY, EVT_MODAL_MAP, ViewOpsData::init, KM_PRESS, KM_RELEASE, MOUSEMOVE, ViewOpsData::nav_type, RegionView3D::persp, ViewOpsData::persp_with_auto_persp_applied, ViewOpsData::rv3d, TIMER, ViewOpsData::timer, wmEvent::type, wmEvent::val, VIEW_APPLY, VIEW_CANCEL, VIEW_CONFIRM, VIEW_MODAL_CANCEL, VIEW_MODAL_CONFIRM, VIEW_PASS, ViewOpsType_move, ViewOpsType_rotate, ViewOpsType_zoom, VIEWROT_MODAL_AXIS_SNAP_DISABLE, VIEWROT_MODAL_AXIS_SNAP_ENABLE, VIEWROT_MODAL_SWITCH_MOVE, VIEWROT_MODAL_SWITCH_ROTATE, and VIEWROT_MODAL_SWITCH_ZOOM.
Referenced by ED_view3d_navigation_do(), and view3d_navigate_modal_fn().
| int view3d_navigate_invoke_impl | ( | bContext * | C, |
| wmOperator * | op, | ||
| const wmEvent * | event, | ||
| const ViewOpsType * | nav_type ) |
Definition at line 558 of file view3d_navigate.cc.
References C, wmOperator::customdata, ViewOpsData::init_context(), OPERATOR_RUNNING_MODAL, wmOperator::ptr, ret, view3d_navigation_invoke_generic(), viewops_data_free(), and WM_event_add_modal_handler().
Referenced by viewmove_invoke(), viewpan_invoke(), viewrotate_invoke(), and viewzoom_invoke().
| int view3d_navigate_modal_fn | ( | bContext * | C, |
| wmOperator * | op, | ||
| const wmEvent * | event ) |
Definition at line 599 of file view3d_navigate.cc.
References ViewOpsType::apply_fn, C, wmOperator::customdata, ED_view3d_camera_lock_undo_push(), ViewOpsData::end_navigation(), ViewOpsType::idname, wmOperatorType::name, ViewOpsData::nav_type, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, wmOperator::ptr, ret, ViewOpsData::rv3d, wmOperator::type, ViewOpsData::v3d, view3d_navigate_event(), view3d_navigation_invoke_generic(), viewops_data_free(), WM_operator_type_set(), WM_operatortype_find(), and wmEvent::xy.
Referenced by VIEW3D_OT_move(), VIEW3D_OT_rotate(), and VIEW3D_OT_zoom().
|
static |
Definition at line 536 of file view3d_navigate.cc.
References C, ED_view3d_smooth_view_force_finish(), ViewOpsType::init_fn, ViewOpsData::init_navigation(), OPERATOR_CANCELLED, ptr, ViewOpsData::region, RNA_property_boolean_get(), RNA_struct_find_property(), and ViewOpsData::v3d.
Referenced by ED_view3d_navigation_do(), view3d_navigate_invoke_impl(), and view3d_navigate_modal_fn().
|
static |
Definition at line 476 of file view3d_navigate.cc.
References C, CTX_wm_region_view3d(), ED_operator_region_view3d_active(), and RV3D_LOCK_FLAGS.
Referenced by view3d_location_poll(), view3d_rotation_poll(), and view3d_zoom_or_dolly_poll().
|
static |
Definition at line 1037 of file view3d_navigate.cc.
References STREQ, ViewOpsType_move, ViewOpsType_pan, ViewOpsType_rotate, and ViewOpsType_zoom.
Referenced by ED_view3d_navigation_do(), and ViewOpsData_Utility::ViewOpsData_Utility().
| void view3d_operator_properties_common | ( | wmOperatorType * | ot, |
| const enum eV3D_OpPropFlag | flag ) |
Definition at line 637 of file view3d_navigate.cc.
References flag, ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_int(), RNA_def_property_flag(), V3D_OP_PROP_DELTA, V3D_OP_PROP_MOUSE_CO, V3D_OP_PROP_USE_ALL_REGIONS, V3D_OP_PROP_USE_MOUSE_INIT, and WM_operator_properties_use_cursor_init().
Referenced by VIEW3D_OT_dolly(), VIEW3D_OT_move(), VIEW3D_OT_rotate(), VIEW3D_OT_view_all(), VIEW3D_OT_view_selected(), and VIEW3D_OT_zoom().
| void view3d_orbit_apply_dyn_ofs | ( | float | r_ofs[3], |
| const float | ofs_old[3], | ||
| const float | viewquat_old[4], | ||
| const float | viewquat_new[4], | ||
| const float | dyn_ofs[3] ) |
Definition at line 690 of file view3d_navigate.cc.
References add_v3_v3(), invert_qt_normalized(), invert_qt_qt_normalized(), mul_qt_qtqt(), mul_qt_v3(), and sub_v3_v3v3().
Referenced by ED_view3d_smooth_view_ex(), view3d_smoothview_apply_with_interp(), viewroll_apply(), and viewrotate_apply_dyn_ofs().
|
static |
Definition at line 707 of file view3d_navigate.cc.
References acosf, dot_v3v3(), invert_qt_qt_normalized(), LIKELY, M_PI_2, madd_v3_v3fl(), max_ff(), and mul_qt_v3().
Referenced by viewrotate_apply_dyn_ofs().
Definition at line 784 of file view3d_navigate.cc.
References add_v3_v3(), BASE_SELECTED, BKE_object_boundbox_get(), BKE_object_pose_armature_get(), BKE_paint_stroke_get_average(), BKE_view_layer_active_object_get(), BKE_view_layer_object_bases_get(), BKE_view_layer_synced_ensure(), bounds(), C, copy_v3_v3(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), CTX_wm_view3d(), Object::data, DEG_get_evaluated_scene(), DEG_get_evaluated_view_layer(), DEG_get_original_object(), depsgraph, ED_transform_calc_pivot_pos(), Curve::editfont, LISTBASE_FOREACH, blender::math::midpoint(), Object::mode, mul_v3_fl(), OB_FONT, OB_MODE_ALL_PAINT, OB_MODE_EDIT, OB_MODE_OBJECT, OB_MODE_WEIGHT_PAINT, EditFont::textcurs, blender::math::transform_point(), Object::type, V3D_AROUND_CENTER_MEDIAN, and zero_v3().
Referenced by axis_set_view(), and navigate_pivot_get().
| bool view3d_rotation_poll | ( | bContext * | C | ) |
Definition at line 589 of file view3d_navigate.cc.
References C, RV3D_LOCK_ROTATION, and view3d_navigation_poll_impl().
Referenced by VIEW3D_OT_dolly(), and VIEW3D_OT_rotate().
| bool view3d_zoom_or_dolly_poll | ( | bContext * | C | ) |
Definition at line 594 of file view3d_navigate.cc.
References C, RV3D_LOCK_ZOOM_AND_DOLLY, and view3d_navigation_poll_impl().
Referenced by VIEW3D_OT_view_selected(), VIEW3D_OT_zoom(), and VIEW3D_OT_zoom_border().
| void viewmove_apply | ( | ViewOpsData * | vod, |
| int | x, | ||
| int | y ) |
Definition at line 995 of file view3d_navigate.cc.
References ViewOpsData::area, ViewOpsData::depsgraph, ED_region_tag_redraw(), ED_view3d_camera_lock_check(), ED_view3d_camera_lock_sync(), ED_view3d_camera_view_pan(), ED_view3d_offset_lock_check(), ED_view3d_win_to_delta(), ViewOpsData::event_xy, float, ViewOpsData::init, RegionView3D::ofs, RegionView3D::ofs_lock, RegionView3D::persp, ViewOpsData::prev, ViewOpsData::region, ViewOpsData::rv3d, RV3D_BOXVIEW, RV3D_CAMOB, RV3D_LOCK_FLAGS, sub_v3_v3(), ViewOpsData::v3d, view3d_boxview_sync(), ARegion::winx, ARegion::winy, x, y, and ViewOpsData::zfac.
Referenced by viewmove_invoke_impl(), viewmove_modal_impl(), and viewpan_invoke_impl().
| ViewOpsData * viewops_data_create | ( | bContext * | C, |
| const wmEvent * | event, | ||
| const ViewOpsType * | nav_type, | ||
| const bool | use_cursor_init ) |
Allocate, fill in context pointers and calculate the values for ViewOpsData
Definition at line 857 of file view3d_navigate.cc.
References C, ViewOpsData::init_context(), and ViewOpsData::init_navigation().
Referenced by viewdolly_invoke(), and viewroll_invoke().
| void viewops_data_free | ( | bContext * | C, |
| ViewOpsData * | vod ) |
Allocate and fill in context pointers for ViewOpsData
Definition at line 868 of file view3d_navigate.cc.
References C, and ViewOpsData::end_navigation().
Referenced by view3d_navigate_cancel_fn(), view3d_navigate_invoke_impl(), view3d_navigate_modal_fn(), viewdolly_exec(), viewdolly_invoke(), viewdolly_modal(), viewroll_exec(), viewroll_invoke(), and viewroll_modal().
|
static |
If the mode requires it, always set the VIEWOPS_FLAG_PERSP_ENSURE. The function ED_view3d_persp_ensure already handles the checking of the preferences. And even with the option disabled, in some modes, it is still necessary to exit the camera view.
Definition at line 40 of file view3d_navigate.cc.
References flag, U, USER_DEPTH_NAVIGATE, USER_ORBIT_SELECTION, USER_ZOOM_TO_MOUSEPOS, VIEWOPS_FLAG_DEPTH_NAVIGATE, VIEWOPS_FLAG_INIT_ZFAC, VIEWOPS_FLAG_ORBIT_SELECT, VIEWOPS_FLAG_PERSP_ENSURE, and VIEWOPS_FLAG_ZOOM_TO_MOUSE.
Referenced by ViewOpsData::init_navigation().
| void viewrotate_apply_dyn_ofs | ( | ViewOpsData * | vod, |
| const float | viewquat_new[4] ) |
Definition at line 770 of file view3d_navigate.cc.
References ViewOpsData::dyn_ofs, ViewOpsData::init, RegionView3D::ofs, ViewOpsData::ofs, ViewOpsData::quat, ViewOpsData::rv3d, ViewOpsData::use_dyn_ofs, ViewOpsData::use_dyn_ofs_ortho_correction, view3d_orbit_apply_dyn_ofs(), and view3d_orbit_apply_dyn_ofs_ortho_correction().
Referenced by viewrotate_apply(), and viewrotate_apply_snap().