|
Blender V5.0
|
#include "DNA_curve_types.h"#include "BLI_dial_2d.h"#include "BLI_listbase.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 wmOperatorStatus | view3d_navigation_invoke_generic (bContext *C, ViewOpsData *vod, const wmEvent *event, PointerRNA *ptr, const ViewOpsType *nav_type, const float dyn_ofs_override[3]) |
| wmOperatorStatus | 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) |
| bool | view3d_zoom_or_dolly_or_rotation_poll (bContext *C) |
| wmOperatorStatus | 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 932 of file view3d_navigate.cc.
References C, View3D::camera, V3D_SmoothParams::camera_old, copy_v3_v3(), CTX_data_ensure_evaluated_depsgraph(), DEG_get_evaluated(), 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 695 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 1120 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 blender::ed::transform::transform_modal().
| void ED_view3d_navigation_free | ( | bContext * | C, |
| ViewOpsData * | vod ) |
Definition at line 1193 of file view3d_navigate.cc.
References C, and ViewOpsData::end_navigation().
Referenced by blender::ed::greasepencil::grease_pencil_primitive_exit(), and blender::ed::transform::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 1109 of file view3d_navigate.cc.
References C, and CTX_wm_region_view3d().
Referenced by blender::ed::greasepencil::grease_pencil_primitive_invoke(), and blender::ed::transform::initTransInfo().
|
static |
Definition at line 174 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(), View3D_Runtime::flag, wmEvent::mval, negate_v3_v3(), RegionView3D::ofs, ARegion::regiondata, View3D::runtime, V3D_DEPTH_NO_GPENCIL, V3D_RUNTIME_OFS_LAST_CENTER_IS_VALID, view3d_orbit_calc_center(), VIEWOPS_FLAG_DEPTH_NAVIGATE, VIEWOPS_FLAG_NONE, and VIEWOPS_FLAG_ORBIT_SELECT.
Referenced by ViewOpsData::init_navigation().
| bool view3d_location_poll | ( | bContext * | C | ) |
Definition at line 606 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 654 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 507 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().
| wmOperatorStatus view3d_navigate_invoke_impl | ( | bContext * | C, |
| wmOperator * | op, | ||
| const wmEvent * | event, | ||
| const ViewOpsType * | nav_type ) |
Definition at line 579 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().
| wmOperatorStatus view3d_navigate_modal_fn | ( | bContext * | C, |
| wmOperator * | op, | ||
| const wmEvent * | event ) |
Definition at line 628 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 557 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 497 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(), view3d_zoom_or_dolly_or_rotation_poll(), and view3d_zoom_or_dolly_poll().
|
static |
Definition at line 1082 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 666 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 719 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 736 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 813 of file view3d_navigate.cc.
References add_v2_v2(), add_v3_v3(), BASE_SELECTED, BKE_object_boundbox_get(), BKE_object_pose_armature_get(), BKE_paint_get_active_from_context(), BKE_paint_stroke_get_average(), BKE_view_layer_active_object_get(), BKE_view_layer_object_bases_get(), BKE_view_layer_synced_ensure(), bounds(), C, blender::ed::transform::calc_pivot_pos(), copy_v3_v3(), CTX_data_ensure_evaluated_depsgraph(), CTX_wm_view3d(), Object::data, DEG_get_evaluated_scene(), DEG_get_evaluated_view_layer(), DEG_get_original(), depsgraph, Curve::editfont, ELEM, View3D_Runtime::flag, i, LISTBASE_FOREACH, blender::math::midpoint(), Object::mode, mul_v3_fl(), negate_v3_v3(), OB_FONT, OB_MODE_ALL_PAINT, OB_MODE_EDIT, OB_MODE_OBJECT, OB_MODE_PAINT_GREASE_PENCIL, OB_MODE_SCULPT_CURVES, OB_MODE_SCULPT_GREASE_PENCIL, OB_MODE_VERTEX_GREASE_PENCIL, OB_MODE_WEIGHT_GREASE_PENCIL, OB_MODE_WEIGHT_PAINT, View3D_Runtime::ofs_last_center, View3D::runtime, EditFont::textcurs, blender::math::transform_point(), Object::type, V3D_AROUND_CENTER_MEDIAN, V3D_RUNTIME_OFS_LAST_CENTER_IS_VALID, and zero_v3().
Referenced by axis_set_view(), and navigate_pivot_get().
| bool view3d_rotation_poll | ( | bContext * | C | ) |
Definition at line 611 of file view3d_navigate.cc.
References C, RV3D_LOCK_ROTATION, and view3d_navigation_poll_impl().
Referenced by VIEW3D_OT_rotate().
| bool view3d_zoom_or_dolly_or_rotation_poll | ( | bContext * | C | ) |
Definition at line 621 of file view3d_navigate.cc.
References C, RV3D_LOCK_ROTATION, RV3D_LOCK_ZOOM_AND_DOLLY, and view3d_navigation_poll_impl().
Referenced by VIEW3D_OT_dolly().
| bool view3d_zoom_or_dolly_poll | ( | bContext * | C | ) |
Definition at line 616 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 1040 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 906 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 917 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 42 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 799 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().