Blender  V3.3
view3d_navigate.c File Reference
#include "DNA_curve_types.h"
#include "DNA_gpencil_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BLT_translation.h"
#include "BKE_armature.h"
#include "BKE_context.h"
#include "BKE_gpencil_geom.h"
#include "BKE_layer.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_vfont.h"
#include "DEG_depsgraph_query.h"
#include "ED_mesh.h"
#include "ED_particle.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "WM_api.h"
#include "WM_message.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "UI_resources.h"
#include "view3d_intern.h"
#include "view3d_navigate.h"

Go to the source code of this file.

Functions

Navigation Polls
static bool view3d_navigation_poll_impl (bContext *C, const char viewlock)
 
bool view3d_location_poll (bContext *C)
 
bool view3d_rotation_poll (bContext *C)
 
bool view3d_zoom_or_dolly_poll (bContext *C)
 
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])
 
void viewrotate_apply_dyn_ofs (ViewOpsData *vod, const float viewquat_new[4])
 
bool view3d_orbit_calc_center (bContext *C, float r_dyn_ofs[3])
 
static enum eViewOpsFlag viewops_flag_from_args (bool use_select, bool use_depth)
 
enum eViewOpsFlag viewops_flag_from_prefs (void)
 
ViewOpsDataviewops_data_create (bContext *C, const wmEvent *event, enum eViewOpsFlag viewops_flag)
 
void viewops_data_free (bContext *C, ViewOpsData *vod)
 
Generic View Operator Utilities
static 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)
 
View All Operator

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

static bool view3d_object_skip_minmax (const View3D *v3d, const RegionView3D *rv3d, const Object *ob, const bool skip_camera, bool *r_only_center)
 
static void view3d_object_calc_minmax (Depsgraph *depsgraph, Scene *scene, Object *ob_eval, const bool only_center, float min[3], float max[3])
 
static void view3d_from_minmax (bContext *C, View3D *v3d, ARegion *region, const float min[3], const float max[3], bool ok_dist, const int smooth_viewtx)
 
static void view3d_from_minmax_multi (bContext *C, View3D *v3d, const float min[3], const float max[3], const bool ok_dist, const int smooth_viewtx)
 
static int view3d_all_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_view_all (wmOperatorType *ot)
 
Frame Selected Operator

Move & Zoom the view to fit selected contents.

static int viewselected_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_view_selected (wmOperatorType *ot)
 
View Center Cursor Operator
static int viewcenter_cursor_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_view_center_cursor (wmOperatorType *ot)
 
View Center Pick Operator
static int viewcenter_pick_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void VIEW3D_OT_view_center_pick (wmOperatorType *ot)
 
View Camera Operator
static int view_camera_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_view_camera (wmOperatorType *ot)
 

View Orbit Operator

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

enum  { V3D_VIEW_STEPLEFT = 1 , V3D_VIEW_STEPRIGHT , V3D_VIEW_STEPDOWN , V3D_VIEW_STEPUP }
 
static const EnumPropertyItem prop_view_orbit_items []
 
static int vieworbit_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_view_orbit (wmOperatorType *ot)
 

View Pan Operator

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

enum  { V3D_VIEW_PANLEFT = 1 , V3D_VIEW_PANRIGHT , V3D_VIEW_PANDOWN , V3D_VIEW_PANUP }
 
static const EnumPropertyItem prop_view_pan_items []
 
static int viewpan_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void VIEW3D_OT_view_pan (wmOperatorType *ot)
 

View Axis Operator

static const EnumPropertyItem prop_view_items []
 
static int view_axis_exec (bContext *C, wmOperator *op)
 
void VIEW3D_OT_view_axis (wmOperatorType *ot)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
V3D_VIEW_STEPLEFT 
V3D_VIEW_STEPRIGHT 
V3D_VIEW_STEPDOWN 
V3D_VIEW_STEPUP 

Definition at line 1408 of file view3d_navigate.c.

◆ anonymous enum

anonymous enum
Enumerator
V3D_VIEW_PANLEFT 
V3D_VIEW_PANRIGHT 
V3D_VIEW_PANDOWN 
V3D_VIEW_PANUP 

Definition at line 1561 of file view3d_navigate.c.

Function Documentation

◆ axis_set_view()

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

◆ calctrackballvec()

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

◆ view3d_all_exec()

static int view3d_all_exec ( bContext C,
wmOperator op 
)
static

◆ view3d_from_minmax()

static void view3d_from_minmax ( bContext C,
View3D v3d,
ARegion region,
const float  min[3],
const float  max[3],
bool  ok_dist,
const int  smooth_viewtx 
)
static

◆ view3d_from_minmax_multi()

static void view3d_from_minmax_multi ( bContext C,
View3D v3d,
const float  min[3],
const float  max[3],
const bool  ok_dist,
const int  smooth_viewtx 
)
static

◆ view3d_location_poll()

bool view3d_location_poll ( bContext C)

◆ view3d_navigation_poll_impl()

static bool view3d_navigation_poll_impl ( bContext C,
const char  viewlock 
)
static

◆ view3d_object_calc_minmax()

static void view3d_object_calc_minmax ( Depsgraph depsgraph,
Scene scene,
Object ob_eval,
const bool  only_center,
float  min[3],
float  max[3] 
)
static

◆ view3d_object_skip_minmax()

static bool view3d_object_skip_minmax ( const View3D v3d,
const RegionView3D rv3d,
const Object ob,
const bool  skip_camera,
bool r_only_center 
)
static

◆ view3d_operator_properties_common()

void view3d_operator_properties_common ( wmOperatorType ot,
const enum eV3D_OpPropFlag  flag 
)

◆ 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()

bool view3d_orbit_calc_center ( bContext C,
float  r_dyn_ofs[3] 
)

◆ VIEW3D_OT_view_all()

void VIEW3D_OT_view_all ( wmOperatorType ot)

◆ VIEW3D_OT_view_axis()

void VIEW3D_OT_view_axis ( wmOperatorType ot)

◆ VIEW3D_OT_view_camera()

void VIEW3D_OT_view_camera ( wmOperatorType ot)

◆ VIEW3D_OT_view_center_cursor()

void VIEW3D_OT_view_center_cursor ( wmOperatorType ot)

◆ VIEW3D_OT_view_center_pick()

void VIEW3D_OT_view_center_pick ( wmOperatorType ot)

◆ VIEW3D_OT_view_orbit()

void VIEW3D_OT_view_orbit ( wmOperatorType ot)

◆ VIEW3D_OT_view_pan()

void VIEW3D_OT_view_pan ( wmOperatorType ot)

◆ VIEW3D_OT_view_selected()

void VIEW3D_OT_view_selected ( wmOperatorType ot)

◆ view3d_rotation_poll()

bool view3d_rotation_poll ( bContext C)

Definition at line 65 of file view3d_navigate.c.

References C, 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)

◆ view_axis_exec()

static int view_axis_exec ( bContext C,
wmOperator op 
)
static

◆ view_camera_exec()

static int view_camera_exec ( bContext C,
wmOperator op 
)
static

◆ viewcenter_cursor_exec()

static int viewcenter_cursor_exec ( bContext C,
wmOperator op 
)
static

◆ viewcenter_pick_invoke()

static int viewcenter_pick_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ viewmove_apply()

void viewmove_apply ( ViewOpsData vod,
int  x,
int  y 
)

◆ viewops_data_create()

ViewOpsData* viewops_data_create ( bContext C,
const wmEvent event,
enum eViewOpsFlag  viewops_flag 
)

Definition at line 265 of file view3d_navigate.c.

References add_v2_v2v2_int(), ViewOpsData::area, BLI_rcti_cent_x(), BLI_rcti_cent_y(), ViewOpsData::bmain, C, calctrackballvec(), ViewOpsData::camzoom, RegionView3D::camzoom, closest_to_line_v3(), copy_m3_m4(), copy_qt_qt(), copy_v2_v2_int(), copy_v3_v3(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), CTX_wm_area(), CTX_wm_region(), ViewOpsData::curr, depsgraph, ViewOpsData::depsgraph, ViewOpsData::dist, RegionView3D::dist, ViewOpsData::dyn_ofs, ED_region_tag_redraw(), ED_view3d_autodist(), ED_view3d_calc_zfac(), ED_view3d_camera_lock_init(), ED_view3d_persp_ensure(), ED_view3d_win_to_3d(), ED_view3d_win_to_vector(), ViewOpsData::event_type, ViewOpsData::event_xy, ViewOpsData::event_xy_offset, ListBase::first, float(), ViewOpsData::init, RegionView3D::is_persp, len_v3v3(), MEM_callocN, ViewOpsData::mousevec, mul_m3_v3(), wmEvent::mval, negate_v3(), negate_v3_v3(), ViewOpsData::ofs, RegionView3D::ofs, RegionView3D::persmat, ViewOpsData::persp, RegionView3D::persp, ViewOpsData::prev, ViewOpsData::quat, ViewOpsData::region, ARegion::regiondata, ViewOpsData::reverse, RegionView3D::rflag, ViewOpsData::rv3d, RV3D_NAVIGATING, ViewOpsData::scene, ScrArea::spacedata, sub_v3_v3v3(), ViewOpsData::trackvec, ViewOpsData::use_dyn_ofs, ViewOpsData::v3d, view3d_operator_needs_opengl(), view3d_orbit_calc_center(), RegionView3D::viewinv, VIEWOPS_FLAG_DEPTH_NAVIGATE, VIEWOPS_FLAG_ORBIT_SELECT, VIEWOPS_FLAG_PERSP_ENSURE, VIEWOPS_FLAG_USE_MOUSE_INIT, ViewOpsData::viewquat, RegionView3D::viewquat, ARegion::winrct, ARegion::winx, ARegion::winy, wmEvent::xy, zero_v2_int(), and ViewOpsData::zfac.

Referenced by viewdolly_invoke(), viewmove_invoke(), viewpan_invoke(), viewroll_invoke(), viewrotate_invoke(), and viewzoom_invoke().

◆ viewops_data_free()

void viewops_data_free ( struct bContext C,
ViewOpsData vod 
)

◆ viewops_flag_from_args()

static enum eViewOpsFlag viewops_flag_from_args ( bool  use_select,
bool  use_depth 
)
static

Definition at line 160 of file view3d_navigate.c.

◆ viewops_flag_from_prefs()

enum eViewOpsFlag viewops_flag_from_prefs ( void  )

◆ vieworbit_exec()

static int vieworbit_exec ( bContext C,
wmOperator op 
)
static

◆ viewpan_invoke()

static int viewpan_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ viewrotate_apply_dyn_ofs()

void viewrotate_apply_dyn_ofs ( ViewOpsData vod,
const float  viewquat_new[4] 
)

◆ viewselected_exec()

static int viewselected_exec ( bContext C,
wmOperator op 
)
static

Definition at line 857 of file view3d_navigate.c.

References blender::compositor::area(), BASE_SELECTED, BASE_SELECTED_EDITABLE, BKE_gpencil_stroke_minmax(), BKE_paint_select_face_test(), BKE_paint_stroke_get_average(), BKE_pose_minmax(), C, copy_v3_v3(), CTX_DATA_BEGIN, CTX_data_edit_object(), CTX_DATA_END, CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_area(), CTX_wm_region(), CTX_wm_region_view3d(), CTX_wm_view3d(), Object::data, DEG_get_evaluated_view_layer(), DEG_get_original_object(), depsgraph, ED_view3d_camera_lock_check(), ED_view3d_clipping_clamp_minmax(), ED_view3d_minmax_verts(), ED_view3d_smooth_view_undo_begin(), ED_view3d_smooth_view_undo_end(), BezTriple::f1, BezTriple::f2, BezTriple::f3, ListBase::first, FIRSTBASE, View3D::flag2, FOREACH_OBJECT_IN_MODE_BEGIN, FOREACH_OBJECT_IN_MODE_END, ARegion::gizmo_map, GP_STROKE_3DSPACE, GP_STROKE_SELECT, GPENCIL_ANY_MODE, INIT_MINMAX, max, min, minmax_v3v3_v3(), Object::mode, mul_m4_v3(), wmOperatorType::name, Base::next, NULL, OB_ARMATURE, OB_GPENCIL, OB_MODE_PARTICLE_EDIT, OB_MODE_POSE, OB_MODE_SCULPT, OB_MODE_TEXTURE_PAINT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, OBACT, Base::object, ViewLayer::object_bases, Object::obmat, OPERATOR_FINISHED, paintface_minmax(), PE_minmax(), wmOperator::ptr, ARegion::regiondata, RNA_boolean_get(), RV3D_CLIPPING_ENABLED, scene, SELECT, Object::type, wmOperator::type, V3D_LOCK_CAMERA, BezTriple::vec, view3d_from_minmax(), view3d_from_minmax_multi(), view3d_object_calc_minmax(), view3d_object_skip_minmax(), WM_gizmomap_is_any_selected(), WM_gizmomap_minmax(), and WM_operator_smooth_viewtx_get().

Referenced by VIEW3D_OT_view_selected().

Variable Documentation

◆ prop_view_items

const EnumPropertyItem prop_view_items[]
static
Initial value:
= {
{RV3D_VIEW_LEFT, "LEFT", ICON_TRIA_LEFT, "Left", "View from the left"},
{RV3D_VIEW_RIGHT, "RIGHT", ICON_TRIA_RIGHT, "Right", "View from the right"},
{RV3D_VIEW_BOTTOM, "BOTTOM", ICON_TRIA_DOWN, "Bottom", "View from the bottom"},
{RV3D_VIEW_TOP, "TOP", ICON_TRIA_UP, "Top", "View from the top"},
{RV3D_VIEW_FRONT, "FRONT", 0, "Front", "View from the front"},
{RV3D_VIEW_BACK, "BACK", 0, "Back", "View from the back"},
{0, NULL, 0, NULL, NULL},
}
#define RV3D_VIEW_BACK
#define RV3D_VIEW_BOTTOM
#define RV3D_VIEW_LEFT
#define RV3D_VIEW_RIGHT
#define RV3D_VIEW_TOP
#define RV3D_VIEW_FRONT

Definition at line 1136 of file view3d_navigate.c.

Referenced by VIEW3D_OT_view_axis().

◆ prop_view_orbit_items

const EnumPropertyItem prop_view_orbit_items[]
static
Initial value:
= {
{V3D_VIEW_STEPLEFT, "ORBITLEFT", 0, "Orbit Left", "Orbit the view around to the left"},
{V3D_VIEW_STEPRIGHT, "ORBITRIGHT", 0, "Orbit Right", "Orbit the view around to the right"},
{V3D_VIEW_STEPUP, "ORBITUP", 0, "Orbit Up", "Orbit the view up"},
{V3D_VIEW_STEPDOWN, "ORBITDOWN", 0, "Orbit Down", "Orbit the view down"},
{0, NULL, 0, NULL, NULL},
}
@ V3D_VIEW_STEPRIGHT
@ V3D_VIEW_STEPUP
@ V3D_VIEW_STEPLEFT
@ V3D_VIEW_STEPDOWN

Definition at line 1415 of file view3d_navigate.c.

Referenced by VIEW3D_OT_view_orbit().

◆ prop_view_pan_items

const EnumPropertyItem prop_view_pan_items[]
static
Initial value:
= {
{V3D_VIEW_PANLEFT, "PANLEFT", 0, "Pan Left", "Pan the view to the left"},
{V3D_VIEW_PANRIGHT, "PANRIGHT", 0, "Pan Right", "Pan the view to the right"},
{V3D_VIEW_PANUP, "PANUP", 0, "Pan Up", "Pan the view up"},
{V3D_VIEW_PANDOWN, "PANDOWN", 0, "Pan Down", "Pan the view down"},
{0, NULL, 0, NULL, NULL},
}
@ V3D_VIEW_PANLEFT
@ V3D_VIEW_PANDOWN
@ V3D_VIEW_PANUP
@ V3D_VIEW_PANRIGHT

Definition at line 1568 of file view3d_navigate.c.

Referenced by VIEW3D_OT_view_pan().