Blender  V3.3
view3d_navigate.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
14 #define V3D_OP_TRACKBALLSIZE (1.1f)
15 
16 struct ARegion;
17 struct Depsgraph;
18 struct Dial;
19 struct Main;
20 struct RegionView3D;
21 struct Scene;
22 struct ScrArea;
23 struct View3D;
24 struct bContext;
25 struct rcti;
26 struct wmEvent;
27 struct wmOperator;
28 
31  V3D_OP_PROP_DELTA = (1 << 1),
34 };
35 
36 enum {
37  VIEW_PASS = 0,
40 };
41 
42 /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
43 enum {
44  VIEW_MODAL_CONFIRM = 1, /* used for all view operations */
50 };
51 
65 };
66 
68 typedef struct ViewOpsData {
70  struct Main *bmain;
71  struct Scene *scene;
72  struct ScrArea *area;
73  struct ARegion *region;
74  struct View3D *v3d;
75  struct RegionView3D *rv3d;
77 
79  struct wmTimer *timer;
80 
82  struct {
83  float dist;
84  float camzoom;
85  float quat[4];
87  int event_xy[2];
93  float ofs[3];
95  float zfac;
96 
98  float trackvec[3];
100  float mousevec[3];
101 
106  char persp;
107 
109  struct Dial *dial;
110  } init;
111 
113  struct {
114  int event_xy[2];
116  double time;
117  } prev;
118 
120  struct {
124  float viewquat[4];
125  } curr;
126 
127  float reverse;
128  bool axis_snap; /* view rotate only */
129 
131  float dyn_ofs[3];
134 
135 /* view3d_navigate.c */
136 
137 bool view3d_location_poll(struct bContext *C);
138 bool view3d_rotation_poll(struct bContext *C);
139 bool view3d_zoom_or_dolly_poll(struct bContext *C);
140 
142 void calctrackballvec(const struct rcti *rect, const int event_xy[2], float r_dir[3]);
143 void viewmove_apply(ViewOpsData *vod, int x, int y);
144 void view3d_orbit_apply_dyn_ofs(float r_ofs[3],
145  const float ofs_old[3],
146  const float viewquat_old[4],
147  const float viewquat_new[4],
148  const float dyn_ofs[3]);
149 void viewrotate_apply_dyn_ofs(ViewOpsData *vod, const float viewquat_new[4]);
150 bool view3d_orbit_calc_center(struct bContext *C, float r_dyn_ofs[3]);
151 
153 
157 void viewops_data_free(struct bContext *C, ViewOpsData *vod);
158 
163  const struct wmEvent *event,
164  enum eViewOpsFlag viewops_flag);
165 
166 void VIEW3D_OT_view_all(struct wmOperatorType *ot);
173 void VIEW3D_OT_view_pan(struct wmOperatorType *ot);
174 
175 /* view3d_navigate_dolly.c */
176 
177 void viewdolly_modal_keymap(struct wmKeyConfig *keyconf);
178 void VIEW3D_OT_dolly(struct wmOperatorType *ot);
179 
180 /* view3d_navigate_fly.c */
181 
182 void fly_modal_keymap(struct wmKeyConfig *keyconf);
183 void view3d_keymap(struct wmKeyConfig *keyconf);
184 void VIEW3D_OT_fly(struct wmOperatorType *ot);
185 
186 /* view3d_navigate_move.c */
187 
188 void viewmove_modal_keymap(struct wmKeyConfig *keyconf);
189 void VIEW3D_OT_move(struct wmOperatorType *ot);
190 
191 /* view3d_navigate_ndof.c */
192 
193 #ifdef WITH_INPUT_NDOF
194 struct wmNDOFMotionData;
195 
199 void view3d_ndof_fly(const struct wmNDOFMotionData *ndof,
200  struct View3D *v3d,
201  struct RegionView3D *rv3d,
202  bool use_precision,
203  short protectflag,
204  bool *r_has_translate,
205  bool *r_has_rotate);
206 void VIEW3D_OT_ndof_orbit(struct wmOperatorType *ot);
207 void VIEW3D_OT_ndof_orbit_zoom(struct wmOperatorType *ot);
208 void VIEW3D_OT_ndof_pan(struct wmOperatorType *ot);
209 void VIEW3D_OT_ndof_all(struct wmOperatorType *ot);
210 #endif /* WITH_INPUT_NDOF */
211 
212 /* view3d_navigate_roll.c */
213 
215 
216 /* view3d_navigate_rotate.c */
217 
218 void viewrotate_modal_keymap(struct wmKeyConfig *keyconf);
219 void VIEW3D_OT_rotate(struct wmOperatorType *ot);
220 
221 /* view3d_navigate_smoothview.c */
222 
228 typedef struct V3D_SmoothParams {
230  const float *ofs, *quat, *dist, *lens;
231 
233  const float *dyn_ofs;
234 
236  const char *undo_str;
243 
248  struct wmWindowManager *wm,
249  struct wmWindow *win,
250  struct ScrArea *area,
251  struct View3D *v3d,
252  struct ARegion *region,
253  int smooth_viewtx,
254  const V3D_SmoothParams *sview);
255 
257  struct View3D *v3d,
258  struct ARegion *region,
259  int smooth_viewtx,
260  const V3D_SmoothParams *sview);
261 
274  struct ScrArea *area,
275  const char *undo_str,
276  bool undo_grouped);
277 
283  struct View3D *v3d,
284  struct ARegion *region);
285 
287 
288 /* view3d_navigate_walk.c */
289 
290 void walk_modal_keymap(struct wmKeyConfig *keyconf);
291 void VIEW3D_OT_walk(struct wmOperatorType *ot);
292 
293 /* view3d_navigate_zoom.c */
294 
295 void viewzoom_modal_keymap(struct wmKeyConfig *keyconf);
296 void VIEW3D_OT_zoom(struct wmOperatorType *ot);
297 
298 /* view3d_navigate_zoom_border.c */
299 
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
#define C
Definition: RandGen.cpp:25
const Depsgraph * depsgraph
static void area(int d1, int d2, int e1, int e2, float weights[2])
Definition: BKE_main.h:121
const float * lens
const float * quat
const float * dist
const char * undo_str
struct Object * camera
struct Object * camera_old
const float * ofs
const float * dyn_ofs
struct Dial * dial
struct ViewOpsData::@578 curr
float viewquat[4]
struct RegionView3D * rv3d
struct wmTimer * timer
float dyn_ofs[3]
struct ViewOpsData::@577 prev
struct Depsgraph * depsgraph
struct ARegion * region
struct ViewOpsData::@576 init
float quat[4]
float trackvec[3]
int event_xy_offset[2]
struct ScrArea * area
struct Scene * scene
float mousevec[3]
struct Main * bmain
struct View3D * v3d
float ofs[3]
@ VIEWROT_MODAL_SWITCH_ROTATE
@ VIEWROT_MODAL_AXIS_SNAP_ENABLE
@ VIEWROT_MODAL_SWITCH_MOVE
@ VIEW_MODAL_CONFIRM
@ VIEWROT_MODAL_SWITCH_ZOOM
@ VIEWROT_MODAL_AXIS_SNAP_DISABLE
void view3d_keymap(struct wmKeyConfig *keyconf)
Definition: view3d_ops.c:210
void viewdolly_modal_keymap(struct wmKeyConfig *keyconf)
struct ViewOpsData ViewOpsData
void VIEW3D_OT_view_orbit(struct wmOperatorType *ot)
void VIEW3D_OT_walk(struct wmOperatorType *ot)
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 VIEW3D_OT_view_center_cursor(struct wmOperatorType *ot)
void ED_view3d_smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *region, int smooth_viewtx, const V3D_SmoothParams *sview)
eViewOpsFlag
@ VIEWOPS_FLAG_USE_MOUSE_INIT
@ VIEWOPS_FLAG_ORBIT_SELECT
@ VIEWOPS_FLAG_DEPTH_NAVIGATE
@ VIEWOPS_FLAG_PERSP_ENSURE
bool view3d_location_poll(struct bContext *C)
void ED_view3d_smooth_view_force_finish(struct bContext *C, struct View3D *v3d, struct ARegion *region)
void viewmove_modal_keymap(struct wmKeyConfig *keyconf)
void VIEW3D_OT_view_pan(struct wmOperatorType *ot)
void VIEW3D_OT_view_all(struct wmOperatorType *ot)
bool view3d_orbit_calc_center(struct bContext *C, float r_dyn_ofs[3])
void VIEW3D_OT_smoothview(struct wmOperatorType *ot)
struct V3D_SmoothParams V3D_SmoothParams
void VIEW3D_OT_zoom(struct wmOperatorType *ot)
void walk_modal_keymap(struct wmKeyConfig *keyconf)
void VIEW3D_OT_view_center_pick(struct wmOperatorType *ot)
enum eViewOpsFlag viewops_flag_from_prefs(void)
void viewmove_apply(ViewOpsData *vod, int x, int y)
void ED_view3d_smooth_view_ex(const struct Depsgraph *depsgraph, struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *area, struct View3D *v3d, struct ARegion *region, int smooth_viewtx, const V3D_SmoothParams *sview)
void calctrackballvec(const struct rcti *rect, const int event_xy[2], float r_dir[3])
bool view3d_zoom_or_dolly_poll(struct bContext *C)
eV3D_OpPropFlag
@ V3D_OP_PROP_USE_MOUSE_INIT
@ V3D_OP_PROP_DELTA
@ V3D_OP_PROP_USE_ALL_REGIONS
@ V3D_OP_PROP_MOUSE_CO
void VIEW3D_OT_fly(struct wmOperatorType *ot)
void view3d_operator_properties_common(struct wmOperatorType *ot, const enum eV3D_OpPropFlag flag)
void VIEW3D_OT_dolly(struct wmOperatorType *ot)
void fly_modal_keymap(struct wmKeyConfig *keyconf)
void viewrotate_modal_keymap(struct wmKeyConfig *keyconf)
void VIEW3D_OT_zoom_border(struct wmOperatorType *ot)
void VIEW3D_OT_view_camera(struct wmOperatorType *ot)
void ED_view3d_smooth_view_undo_end(struct bContext *C, struct ScrArea *area, const char *undo_str, bool undo_grouped)
void VIEW3D_OT_view_roll(struct wmOperatorType *ot)
@ VIEW_CONFIRM
@ VIEW_PASS
@ VIEW_APPLY
void viewrotate_apply_dyn_ofs(ViewOpsData *vod, const float viewquat_new[4])
void viewops_data_free(struct bContext *C, ViewOpsData *vod)
ViewOpsData * viewops_data_create(struct bContext *C, const struct wmEvent *event, enum eViewOpsFlag viewops_flag)
void viewzoom_modal_keymap(struct wmKeyConfig *keyconf)
void VIEW3D_OT_view_axis(struct wmOperatorType *ot)
bool view3d_rotation_poll(struct bContext *C)
void ED_view3d_smooth_view_undo_begin(struct bContext *C, struct ScrArea *area)
void VIEW3D_OT_rotate(struct wmOperatorType *ot)
void VIEW3D_OT_view_selected(struct wmOperatorType *ot)
void VIEW3D_OT_move(struct wmOperatorType *ot)
wmOperatorType * ot
Definition: wm_files.c:3479