Blender V5.3
view3d_navigate.hh File Reference
#include <optional>
#include "MEM_guardedalloc.h"
#include "BLI_bounds_types.hh"
#include "BLI_enum_flags.hh"
#include "BLI_math_vector_types.hh"
#include "DNA_windowmanager_enums.h"

Go to the source code of this file.

Classes

struct  blender::ViewOpsType
struct  blender::ViewOpsData
struct  blender::V3D_SmoothParams

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define V3D_OP_TRACKBALLSIZE   (1.1f)

Enumerations

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

Functions

 blender::ENUM_OPERATORS (eV3D_OpPropFlag)
 blender::ENUM_OPERATORS (eViewOpsFlag)
Generic Callbacks
bool blender::view3d_location_poll (bContext *C)
bool blender::view3d_rotation_poll (bContext *C)
bool blender::view3d_zoom_or_dolly_poll (bContext *C)
bool blender::view3d_zoom_or_dolly_or_rotation_poll (bContext *C)
wmOperatorStatus blender::view3d_navigate_modal_fn (bContext *C, wmOperator *op, const wmEvent *event)
void blender::view3d_navigate_cancel_fn (bContext *C, wmOperator *op)
Generic Operator Callback Utils
wmOperatorStatus blender::view3d_navigate_invoke_impl (bContext *C, wmOperator *op, const wmEvent *event, const ViewOpsType *nav_type)
Generic View Operator Custom-Data
void blender::calctrackballvec (const rcti *rect, const int event_xy[2], float r_dir[3])
void blender::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 blender::viewrotate_apply_dyn_ofs (ViewOpsData *vod, const float viewquat_new[4])
bool blender::view3d_orbit_calc_center (bContext *C, float r_dyn_ofs[3])
void blender::viewops_data_free (bContext *C, ViewOpsData *vod)
ViewOpsData * blender::viewops_data_create (bContext *C, const wmEvent *event, const ViewOpsType *nav_type, const bool use_cursor_init)
Generic View Operator Utilities
void blender::viewmove_apply (ViewOpsData *vod, int x, int y)
void blender::axis_set_view (bContext *C, View3D *v3d, ARegion *region, const float quat_[4], eRegionView3D_View view, eRegionView3D_ViewAxisRoll view_axis_roll, eRegionView3D_Persp perspo, const float *align_to_quat, const int smooth_viewtx)
Generic View Horizon Utilities
float blender::view3d_horizon_correct_quat (float quat[4], const float horizon_plane[3], const bool horizon_plane_no_flip, const float axis_fallback[3], const float angle_target, const float factor)
float blender::view3d_horizon_correct_quat_ease_out (float quat[4], const float horizon_plane[3], const bool horizon_plane_no_flip, const float factor)
Generic View Operator Properties
void blender::view3d_operator_properties_common (wmOperatorType *ot, const enum eV3D_OpPropFlag flag)
View Dolly Operator

Like zoom but translates the view offset along the view direction which avoids #RegionView3D.dist approaching zero.

void blender::viewdolly_modal_keymap (wmKeyConfig *keyconf)
void blender::VIEW3D_OT_dolly (wmOperatorType *ot)
Modal Key-map
void blender::fly_modal_keymap (wmKeyConfig *keyconf)
void blender::walk_modal_keymap (wmKeyConfig *keyconf)
Registration
void blender::view3d_keymap (wmKeyConfig *keyconf)
Fly Operator
void blender::VIEW3D_OT_fly (wmOperatorType *ot)
View Move (Pan) Operator
void blender::viewmove_modal_keymap (wmKeyConfig *keyconf)
void blender::VIEW3D_OT_move (wmOperatorType *ot)
View Roll Operator
void blender::VIEW3D_OT_view_roll (wmOperatorType *ot)
View Rotate Operator
void blender::viewrotate_modal_keymap (wmKeyConfig *keyconf)
void blender::VIEW3D_OT_rotate (wmOperatorType *ot)
Smooth View Operator & Utilities

Use for view transitions to have smooth (animated) transitions.

Note
This operator is one of the "timer refresh" ones, similar to animation playback.
void blender::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 blender::ED_view3d_smooth_view (bContext *C, View3D *v3d, ARegion *region, int smooth_viewtx, const V3D_SmoothParams *sview)
void blender::ED_view3d_smooth_view_force_finish (bContext *C, View3D *v3d, ARegion *region)
void blender::ED_view3d_smooth_view_force_finish_no_camera_lock (const Depsgraph *depsgraph, wmWindowManager *wm, wmWindow *win, const Scene *scene, View3D *v3d, ARegion *region)
void blender::VIEW3D_OT_smoothview (wmOperatorType *ot)
Smooth View Undo Handling

When the camera is locked to the viewport smooth-view operations may need to perform an undo push.

In this case the smooth-view camera transformation is temporarily completed, undo is pushed then the change is rewound, and smooth-view completes from its timer. In the case smooth-view executed the change immediately - an undo push is called.

NOTE(@ideasman42): While this is not ideal it's necessary as making the undo-push once smooth-view is complete because smooth-view is non-blocking and it's possible other operations are executed once smooth-view has started.

void blender::ED_view3d_smooth_view_undo_begin (bContext *C, const ScrArea *area)
void blender::ED_view3d_smooth_view_undo_end (bContext *C, const ScrArea *area, const char *undo_str, bool undo_grouped)
High Level Viewport Bounds Calculation

Move & Zoom the view to fit all of its contents.

std::optional< Bounds< float3 > > blender::view3d_calc_minmax_visible (Depsgraph *depsgraph, ScrArea *area, ARegion *region, bool use_all_regions, bool clip_bounds)
std::optional< Bounds< float3 > > blender::view3d_calc_minmax_selected (Depsgraph *depsgraph, ScrArea *area, ARegion *region, bool use_all_regions, bool clip_bounds, bool *r_do_zoom)
bool blender::view3d_calc_point_in_selected_bounds (Depsgraph *depsgraph, struct ViewLayer *view_layer_eval, const View3D *v3d, const float3 &point, const float scale_margin)
View All Operator

Move & Zoom the view to fit all of its contents.

void blender::VIEW3D_OT_view_all (wmOperatorType *ot)
Frame Selected Operator

Move & Zoom the view to fit selected contents.

void blender::VIEW3D_OT_view_selected (wmOperatorType *ot)
View Axis Operator
void blender::VIEW3D_OT_view_axis (wmOperatorType *ot)
View Camera Operator
void blender::VIEW3D_OT_view_camera (wmOperatorType *ot)
View Center Cursor Operator
void blender::VIEW3D_OT_view_center_cursor (wmOperatorType *ot)
View Center Pick Operator
void blender::VIEW3D_OT_view_center_pick (wmOperatorType *ot)
View Orbit Operator

Rotate (orbit) in incremental steps. For interactive orbit see VIEW3D_OT_rotate.

void blender::VIEW3D_OT_view_orbit (wmOperatorType *ot)
View Pan Operator

Move (pan) in incremental steps. For interactive pan see VIEW3D_OT_move.

void blender::VIEW3D_OT_view_pan (wmOperatorType *ot)
Walk Operator
void blender::VIEW3D_OT_walk (wmOperatorType *ot)
View Zoom Operator
void blender::viewzoom_modal_keymap (wmKeyConfig *keyconf)
void blender::VIEW3D_OT_zoom (wmOperatorType *ot)
Border Zoom Operator
void blender::VIEW3D_OT_zoom_border (wmOperatorType *ot)

Variables

ViewOpsType blender::ViewOpsType_dolly
const ViewOpsType blender::ViewOpsType_move
const ViewOpsType blender::ViewOpsType_roll
const ViewOpsType blender::ViewOpsType_rotate
const ViewOpsType blender::ViewOpsType_orbit
const ViewOpsType blender::ViewOpsType_pan
const ViewOpsType blender::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 27 of file view3d_navigate.hh.

Referenced by blender::calctrackballvec(), and blender::viewrotate_apply().