Blender V4.3
view3d_navigate.hh File Reference
#include "BLI_utildefines.h"

Go to the source code of this file.

Classes

struct  ViewOpsType
 
struct  ViewOpsData
 
struct  V3D_SmoothParams
 

Macros

#define V3D_OP_TRACKBALLSIZE   (1.1f)
 

Enumerations

enum  eV3D_OpPropFlag { V3D_OP_PROP_MOUSE_CO = (1 << 0) , V3D_OP_PROP_DELTA = (1 << 1) , V3D_OP_PROP_USE_ALL_REGIONS = (1 << 2) , V3D_OP_PROP_USE_MOUSE_INIT = (1 << 3) }
 
enum  eV3D_OpEvent { VIEW_PASS = 0 , VIEW_APPLY , VIEW_CONFIRM , VIEW_CANCEL }
 
enum  {
  VIEW_MODAL_CANCEL = 0 , VIEW_MODAL_CONFIRM = 1 , VIEWROT_MODAL_AXIS_SNAP_ENABLE = 2 , VIEWROT_MODAL_AXIS_SNAP_DISABLE = 3 ,
  VIEWROT_MODAL_SWITCH_ZOOM = 4 , VIEWROT_MODAL_SWITCH_MOVE = 5 , VIEWROT_MODAL_SWITCH_ROTATE = 6
}
 
enum  eViewOpsFlag {
  VIEWOPS_FLAG_NONE = 0 , VIEWOPS_FLAG_ORBIT_SELECT = (1 << 0) , VIEWOPS_FLAG_DEPTH_NAVIGATE = (1 << 1) , VIEWOPS_FLAG_PERSP_ENSURE = (1 << 2) ,
  VIEWOPS_FLAG_ZOOM_TO_MOUSE = (1 << 3) , VIEWOPS_FLAG_INIT_ZFAC = (1 << 4)
}
 

Functions

 ENUM_OPERATORS (eV3D_OpPropFlag, V3D_OP_PROP_USE_MOUSE_INIT)
 
 ENUM_OPERATORS (eViewOpsFlag, VIEWOPS_FLAG_INIT_ZFAC)
 
bool view3d_location_poll (bContext *C)
 
bool view3d_rotation_poll (bContext *C)
 
bool view3d_zoom_or_dolly_poll (bContext *C)
 
int view3d_navigate_invoke_impl (bContext *C, wmOperator *op, const wmEvent *event, const ViewOpsType *nav_type)
 
int view3d_navigate_modal_fn (bContext *C, wmOperator *op, const wmEvent *event)
 
void view3d_navigate_cancel_fn (bContext *C, wmOperator *op)
 
void calctrackballvec (const rcti *rect, const int event_xy[2], float r_dir[3])
 
void viewmove_apply (ViewOpsData *vod, int x, int y)
 
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])
 
void viewrotate_apply_dyn_ofs (ViewOpsData *vod, const float viewquat_new[4])
 
bool view3d_orbit_calc_center (bContext *C, float r_dyn_ofs[3])
 
void view3d_operator_properties_common (wmOperatorType *ot, const eV3D_OpPropFlag flag)
 
void viewops_data_free (bContext *C, ViewOpsData *vod)
 
ViewOpsDataviewops_data_create (bContext *C, const wmEvent *event, const ViewOpsType *nav_type, const bool use_cursor_init)
 
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 viewdolly_modal_keymap (wmKeyConfig *keyconf)
 
void VIEW3D_OT_dolly (wmOperatorType *ot)
 
void fly_modal_keymap (wmKeyConfig *keyconf)
 
void view3d_keymap (wmKeyConfig *keyconf)
 
void VIEW3D_OT_fly (wmOperatorType *ot)
 
void viewmove_modal_keymap (wmKeyConfig *keyconf)
 
void VIEW3D_OT_move (wmOperatorType *ot)
 
void VIEW3D_OT_view_roll (wmOperatorType *ot)
 
void viewrotate_modal_keymap (wmKeyConfig *keyconf)
 
void VIEW3D_OT_rotate (wmOperatorType *ot)
 
void ED_view3d_smooth_view_ex (const Depsgraph *depsgraph, wmWindowManager *wm, wmWindow *win, ScrArea *area, View3D *v3d, ARegion *region, int smooth_viewtx, const V3D_SmoothParams *sview)
 
void ED_view3d_smooth_view (bContext *C, View3D *v3d, ARegion *region, int smooth_viewtx, const V3D_SmoothParams *sview)
 
void ED_view3d_smooth_view_undo_begin (bContext *C, const ScrArea *area)
 
void ED_view3d_smooth_view_undo_end (bContext *C, const ScrArea *area, const char *undo_str, bool undo_grouped)
 
void ED_view3d_smooth_view_force_finish (bContext *C, View3D *v3d, ARegion *region)
 
void ED_view3d_smooth_view_force_finish_no_camera_lock (const Depsgraph *depsgraph, wmWindowManager *wm, wmWindow *win, const Scene *scene, View3D *v3d, ARegion *region)
 
void VIEW3D_OT_smoothview (wmOperatorType *ot)
 
void VIEW3D_OT_view_all (wmOperatorType *ot)
 
void VIEW3D_OT_view_selected (wmOperatorType *ot)
 
void VIEW3D_OT_view_axis (wmOperatorType *ot)
 
void VIEW3D_OT_view_camera (wmOperatorType *ot)
 
void VIEW3D_OT_view_center_cursor (wmOperatorType *ot)
 
void VIEW3D_OT_view_center_pick (wmOperatorType *ot)
 
void VIEW3D_OT_view_orbit (wmOperatorType *ot)
 
void VIEW3D_OT_view_pan (wmOperatorType *ot)
 
void walk_modal_keymap (wmKeyConfig *keyconf)
 
void VIEW3D_OT_walk (wmOperatorType *ot)
 
void viewzoom_modal_keymap (wmKeyConfig *keyconf)
 
void VIEW3D_OT_zoom (wmOperatorType *ot)
 
void VIEW3D_OT_zoom_border (wmOperatorType *ot)
 

Variables

ViewOpsType ViewOpsType_dolly
 
const ViewOpsType ViewOpsType_move
 
const ViewOpsType ViewOpsType_roll
 
const ViewOpsType ViewOpsType_rotate
 
const ViewOpsType ViewOpsType_orbit
 
const ViewOpsType ViewOpsType_pan
 
const ViewOpsType ViewOpsType_zoom
 

Macro Definition Documentation

◆ V3D_OP_TRACKBALLSIZE

#define V3D_OP_TRACKBALLSIZE   (1.1f)

Size of the sphere being dragged for trackball rotation within the view bounds. also affects speed (smaller is faster).

Definition at line 17 of file view3d_navigate.hh.

Referenced by calctrackballvec(), and viewrotate_apply().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VIEW_MODAL_CANCEL 
VIEW_MODAL_CONFIRM 
VIEWROT_MODAL_AXIS_SNAP_ENABLE 
VIEWROT_MODAL_AXIS_SNAP_DISABLE 
VIEWROT_MODAL_SWITCH_ZOOM 
VIEWROT_MODAL_SWITCH_MOVE 
VIEWROT_MODAL_SWITCH_ROTATE 

Definition at line 55 of file view3d_navigate.hh.

◆ eV3D_OpEvent

Enumerator
VIEW_PASS 
VIEW_APPLY 
VIEW_CONFIRM 
VIEW_CANCEL 

Only supported by some viewport operators.

Definition at line 46 of file view3d_navigate.hh.

◆ eV3D_OpPropFlag

Enumerator
V3D_OP_PROP_MOUSE_CO 
V3D_OP_PROP_DELTA 
V3D_OP_PROP_USE_ALL_REGIONS 
V3D_OP_PROP_USE_MOUSE_INIT 

Definition at line 38 of file view3d_navigate.hh.

◆ eViewOpsFlag

Enumerator
VIEWOPS_FLAG_NONE 
VIEWOPS_FLAG_ORBIT_SELECT 

When enabled, rotate around the selection.

VIEWOPS_FLAG_DEPTH_NAVIGATE 

When enabled, use the depth under the cursor for navigation.

VIEWOPS_FLAG_PERSP_ENSURE 

When enabled run ED_view3d_persp_ensure this may switch out of camera view when orbiting or switch from orthographic to perspective when auto-perspective is enabled. Some operations don't require this (view zoom/pan or NDOF where subtle rotation is common so we don't want it to trigger auto-perspective).

VIEWOPS_FLAG_ZOOM_TO_MOUSE 
VIEWOPS_FLAG_INIT_ZFAC 

Definition at line 65 of file view3d_navigate.hh.

Function Documentation

◆ axis_set_view()

◆ calctrackballvec()

void calctrackballvec ( const rcti * rect,
const int event_xy[2],
float r_dir[3] )

◆ ED_view3d_smooth_view()

◆ ED_view3d_smooth_view_ex()

void ED_view3d_smooth_view_ex ( const Depsgraph * depsgraph,
wmWindowManager * wm,
wmWindow * win,
ScrArea * area,
View3D * v3d,
ARegion * region,
int smooth_viewtx,
const V3D_SmoothParams * sview )

The arguments are the desired situation.

Definition at line 205 of file view3d_navigate_smoothview.cc.

References angle_signed_normalized_qtqt(), BLI_assert, BLI_assert_msg, CAM_ORTHO, V3D_SmoothParams::camera, View3D::camera, V3D_SmoothParams::camera_old, copy_qt_qt(), copy_v3_v3(), Object::data, DEG_get_evaluated_object(), depsgraph, RegionView3D::dist, SmoothView3DState::dist, V3D_SmoothParams::dist, double(), SmoothView3DStore::dst, SmoothView3DStore::dyn_ofs, V3D_SmoothParams::dyn_ofs, ED_region_tag_redraw(), ED_view3d_camera_lock_init(), ED_view3d_camera_lock_sync(), ED_view3d_from_object(), ED_view3d_offset_distance(), equals_v3v3(), equals_v4v4(), fabsf, Object::id, RegionView3D::is_persp, SmoothView3DState::lens, V3D_SmoothParams::lens, View3D::lens, M_PI, MEM_mallocN, OB_CAMERA, OB_RENDER, RegionView3D::ofs, SmoothView3DState::ofs, V3D_SmoothParams::ofs, SmoothView3DStore::org, SmoothView3DStore::org_view, SmoothView3DStore::org_view_axis_roll, RegionView3D::persp, SmoothView3DState::quat, V3D_SmoothParams::quat, RegionView3D::rflag, RV3D_BOXVIEW, RV3D_LOCK_FLAGS, RV3D_LOCK_ROTATION, RV3D_NAVIGATING, RV3D_ORTHO, RV3D_PERSP, RV3D_VIEW_USER, View3D::shading, RegionView3D::smooth_timer, RegionView3D::sms, SmoothView3DStore::src, ID::tag, SmoothView3DStore::time_allowed, TIMER1, SmoothView3DStore::to_camera, Object::type, View3DShading::type, V3D_SmoothParams::undo_str, SmoothView3DStore::use_dyn_ofs, RegionView3D::view, view3d_boxview_copy(), VIEW3D_DIST_FALLBACK, view3d_orbit_apply_dyn_ofs(), view3d_smooth_view_state_backup(), view3d_smooth_view_state_restore(), RegionView3D::view_axis_roll, RegionView3D::view_render, RegionView3D::viewquat, WM_event_add_mousemove(), WM_event_timer_add(), and WM_event_timer_remove().

Referenced by ED_view3d_smooth_view(), view3d_localview_exit(), and view3d_localview_init().

◆ ED_view3d_smooth_view_force_finish()

void ED_view3d_smooth_view_force_finish ( bContext * C,
View3D * v3d,
ARegion * region )

Apply the smooth-view immediately, use when we need to start a new view operation. (so we don't end up half-applying a view operation when pressing keys quickly).

Definition at line 564 of file view3d_navigate_smoothview.cc.

References CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), CTX_wm_manager(), CTX_wm_window(), depsgraph, RegionView3D::sms, and view3d_smooth_view_force_finish_ex().

Referenced by view3d_from_minmax(), view3d_navigation_invoke_generic(), view_axis_exec(), view_camera_exec(), viewcenter_cursor_exec(), viewcenter_pick_invoke(), viewdolly_invoke(), vieworbit_exec(), and viewroll_invoke().

◆ ED_view3d_smooth_view_force_finish_no_camera_lock()

void ED_view3d_smooth_view_force_finish_no_camera_lock ( const Depsgraph * depsgraph,
wmWindowManager * wm,
wmWindow * win,
const Scene * scene,
View3D * v3d,
ARegion * region )

A version of ED_view3d_smooth_view_force_finish that doesn't support camera locking or auto-keying. Use for viewport actions that don't control the camera, entering/exiting the local-view for example (see code-comments for details).

Definition at line 578 of file view3d_navigate_smoothview.cc.

References depsgraph, RegionView3D::sms, and view3d_smooth_view_force_finish_ex().

Referenced by view3d_localview_exit(), and view3d_localview_init().

◆ ED_view3d_smooth_view_undo_begin()

void ED_view3d_smooth_view_undo_begin ( bContext * C,
const ScrArea * area )

Call before multiple smooth-view operations begin to properly handle undo.

Note
Only use explicit undo calls when multiple calls to smooth-view are necessary or when calling ED_view3d_smooth_view_ex. Otherwise pass in V3D_SmoothParams.undo_str so an undo step is pushed as needed.

Definition at line 46 of file view3d_navigate_smoothview.cc.

References View3D::camera, ED_view3d_camera_lock_undo_test(), Object::id, ID_TAG_DOIT, LISTBASE_FOREACH, RGN_TYPE_WINDOW, and ID::tag.

Referenced by ED_view3d_smooth_view(), view3d_all_exec(), and viewselected_exec().

◆ ED_view3d_smooth_view_undo_end()

void ED_view3d_smooth_view_undo_end ( bContext * C,
const ScrArea * area,
const char * undo_str,
bool undo_grouped )

◆ ENUM_OPERATORS() [1/2]

◆ ENUM_OPERATORS() [2/2]

ENUM_OPERATORS ( eViewOpsFlag ,
VIEWOPS_FLAG_INIT_ZFAC  )

◆ fly_modal_keymap()

◆ view3d_keymap()

◆ view3d_location_poll()

◆ view3d_navigate_cancel_fn()

void view3d_navigate_cancel_fn ( bContext * C,
wmOperator * op )

◆ view3d_navigate_invoke_impl()

◆ view3d_navigate_modal_fn()

◆ view3d_operator_properties_common()

◆ view3d_orbit_apply_dyn_ofs()

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] )

◆ view3d_orbit_calc_center()

◆ VIEW3D_OT_dolly()

◆ VIEW3D_OT_fly()

◆ VIEW3D_OT_move()

◆ VIEW3D_OT_rotate()

◆ VIEW3D_OT_smoothview()

◆ VIEW3D_OT_view_all()

◆ VIEW3D_OT_view_axis()

◆ VIEW3D_OT_view_camera()

◆ VIEW3D_OT_view_center_cursor()

◆ VIEW3D_OT_view_center_pick()

◆ VIEW3D_OT_view_orbit()

◆ VIEW3D_OT_view_pan()

◆ VIEW3D_OT_view_roll()

◆ VIEW3D_OT_view_selected()

◆ VIEW3D_OT_walk()

◆ VIEW3D_OT_zoom()

◆ VIEW3D_OT_zoom_border()

◆ view3d_rotation_poll()

bool view3d_rotation_poll ( bContext * C)

Definition at line 588 of file view3d_navigate.cc.

References RV3D_LOCK_ROTATION, and view3d_navigation_poll_impl().

Referenced by VIEW3D_OT_dolly(), and VIEW3D_OT_rotate().

◆ view3d_zoom_or_dolly_poll()

bool view3d_zoom_or_dolly_poll ( bContext * C)

◆ viewdolly_modal_keymap()

◆ viewmove_apply()

◆ viewmove_modal_keymap()

◆ viewops_data_create()

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 856 of file view3d_navigate.cc.

References ViewOpsData::init_context(), and ViewOpsData::init_navigation().

Referenced by viewdolly_invoke(), and viewroll_invoke().

◆ viewops_data_free()

◆ viewrotate_apply_dyn_ofs()

◆ viewrotate_modal_keymap()

◆ viewzoom_modal_keymap()

◆ walk_modal_keymap()

Variable Documentation

◆ ViewOpsType_dolly

ViewOpsType ViewOpsType_dolly
extern

Definition at line 332 of file view3d_navigate_view_dolly.cc.

Referenced by VIEW3D_OT_dolly(), and viewdolly_invoke().

◆ ViewOpsType_move

◆ ViewOpsType_orbit

const ViewOpsType ViewOpsType_orbit
extern

Definition at line 160 of file view3d_navigate_view_orbit.cc.

Referenced by VIEW3D_OT_view_orbit(), and vieworbit_exec().

◆ ViewOpsType_pan

const ViewOpsType ViewOpsType_pan
extern

◆ ViewOpsType_roll

const ViewOpsType ViewOpsType_roll
extern

◆ ViewOpsType_rotate

◆ ViewOpsType_zoom