Blender  V3.3
view3d_navigate_zoom.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "BLI_math.h"
8 #include "BLI_rect.h"
9 
10 #include "BKE_context.h"
11 #include "BKE_screen.h"
12 
13 #include "DEG_depsgraph_query.h"
14 
15 #include "WM_api.h"
16 
17 #include "RNA_access.h"
18 
19 #include "ED_screen.h"
20 
21 #include "PIL_time.h"
22 
23 #include "view3d_intern.h"
24 #include "view3d_navigate.h" /* own include */
25 
26 /* -------------------------------------------------------------------- */
30 /* #viewdolly_modal_keymap has an exact copy of this, apply fixes to both. */
32 {
33  static const EnumPropertyItem modal_items[] = {
34  {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
35 
36  {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
37  {VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
38 
39  {0, NULL, 0, NULL, NULL},
40  };
41 
42  wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "View3D Zoom Modal");
43 
44  /* this function is called for each spacetype, only needs to add map once */
45  if (keymap && keymap->modal_items) {
46  return;
47  }
48 
49  keymap = WM_modalkeymap_ensure(keyconf, "View3D Zoom Modal", modal_items);
50 
51  /* disabled mode switching for now, can re-implement better, later on */
52 #if 0
54  &(const KeyMapItem_Params){
55  .type = LEFTMOUSE,
56  .value = KM_RELEASE,
57  .modifier = KM_ANY,
58  .direction = KM_ANY,
59  },
62  &(const KeyMapItem_Params){
63  .type = EVT_LEFTCTRLKEY,
64  .value = KM_RELEASE,
65  .modifier = KM_ANY,
66  .direction = KM_ANY,
67  },
70  &(const KeyMapItem_Params){
71  .type = EVT_LEFTSHIFTKEY,
72  .value = KM_PRESS,
73  .modifier = KM_ANY,
74  .direction = KM_ANY,
75  },
77 #endif
78 
79  /* assign map to operators */
80  WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom");
81 }
82 
89  View3D *v3d,
90  ARegion *region,
91  float dfac,
92  const int zoom_xy[2])
93 {
94  RegionView3D *rv3d = region->regiondata;
95  const float zoomfac = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
96  const float zoomfac_new = clamp_f(
97  zoomfac * (1.0f / dfac), RV3D_CAMZOOM_MIN_FACTOR, RV3D_CAMZOOM_MAX_FACTOR);
98  const float camzoom_new = BKE_screen_view3d_zoom_from_fac(zoomfac_new);
99 
100  if (zoom_xy != NULL) {
101  float zoomfac_px;
102  rctf camera_frame_old;
103  rctf camera_frame_new;
104 
105  const float pt_src[2] = {zoom_xy[0], zoom_xy[1]};
106  float pt_dst[2];
107  float delta_px[2];
108 
109  ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &camera_frame_old, false);
110  BLI_rctf_translate(&camera_frame_old, region->winrct.xmin, region->winrct.ymin);
111 
112  rv3d->camzoom = camzoom_new;
114 
115  ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &camera_frame_new, false);
116  BLI_rctf_translate(&camera_frame_new, region->winrct.xmin, region->winrct.ymin);
117 
118  BLI_rctf_transform_pt_v(&camera_frame_new, &camera_frame_old, pt_dst, pt_src);
119  sub_v2_v2v2(delta_px, pt_dst, pt_src);
120 
121  /* translate the camera offset using pixel space delta
122  * mapped back to the camera (same logic as panning in camera view) */
123  zoomfac_px = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom) * 2.0f;
124 
125  rv3d->camdx += delta_px[0] / (region->winx * zoomfac_px);
126  rv3d->camdy += delta_px[1] / (region->winy * zoomfac_px);
127  CLAMP(rv3d->camdx, -1.0f, 1.0f);
128  CLAMP(rv3d->camdy, -1.0f, 1.0f);
129  }
130  else {
131  rv3d->camzoom = camzoom_new;
133  }
134 }
135 
140 static void view_zoom_to_window_xy_3d(ARegion *region, float dfac, const int zoom_xy[2])
141 {
142  RegionView3D *rv3d = region->regiondata;
143  const float dist_new = rv3d->dist * dfac;
144 
145  if (zoom_xy != NULL) {
146  float dvec[3];
147  float tvec[3];
148  float tpos[3];
149  float xy_delta[2];
150 
151  float zfac;
152 
153  negate_v3_v3(tpos, rv3d->ofs);
154 
155  xy_delta[0] = (float)(((zoom_xy[0] - region->winrct.xmin) * 2) - region->winx) / 2.0f;
156  xy_delta[1] = (float)(((zoom_xy[1] - region->winrct.ymin) * 2) - region->winy) / 2.0f;
157 
158  /* Project cursor position into 3D space */
159  zfac = ED_view3d_calc_zfac(rv3d, tpos);
160  ED_view3d_win_to_delta(region, xy_delta, zfac, dvec);
161 
162  /* Calculate view target position for dolly */
163  add_v3_v3v3(tvec, tpos, dvec);
164  negate_v3(tvec);
165 
166  /* Offset to target position and dolly */
167  copy_v3_v3(rv3d->ofs, tvec);
168  rv3d->dist = dist_new;
169 
170  /* Calculate final offset */
171  madd_v3_v3v3fl(rv3d->ofs, tvec, dvec, dfac);
172  }
173  else {
174  rv3d->dist = dist_new;
175  }
176 }
177 
178 static float viewzoom_scale_value(const rcti *winrct,
179  const eViewZoom_Style viewzoom,
180  const bool zoom_invert,
181  const bool zoom_invert_force,
182  const int xy_curr[2],
183  const int xy_init[2],
184  const float val,
185  const float val_orig,
186  double *r_timer_lastdraw)
187 {
188  float zfac;
189 
190  if (viewzoom == USER_ZOOM_CONTINUE) {
191  double time = PIL_check_seconds_timer();
192  float time_step = (float)(time - *r_timer_lastdraw);
193  float fac;
194 
195  if (U.uiflag & USER_ZOOM_HORIZ) {
196  fac = (float)(xy_init[0] - xy_curr[0]);
197  }
198  else {
199  fac = (float)(xy_init[1] - xy_curr[1]);
200  }
201 
202  fac /= U.dpi_fac;
203 
204  if (zoom_invert != zoom_invert_force) {
205  fac = -fac;
206  }
207 
208  zfac = 1.0f + ((fac / 20.0f) * time_step);
209  *r_timer_lastdraw = time;
210  }
211  else if (viewzoom == USER_ZOOM_SCALE) {
212  /* method which zooms based on how far you move the mouse */
213 
214  const int ctr[2] = {
215  BLI_rcti_cent_x(winrct),
216  BLI_rcti_cent_y(winrct),
217  };
218  float len_new = (5 * U.dpi_fac) + ((float)len_v2v2_int(ctr, xy_curr) / U.dpi_fac);
219  float len_old = (5 * U.dpi_fac) + ((float)len_v2v2_int(ctr, xy_init) / U.dpi_fac);
220 
221  /* intentionally ignore 'zoom_invert' for scale */
222  if (zoom_invert_force) {
223  SWAP(float, len_new, len_old);
224  }
225 
226  zfac = val_orig * (len_old / max_ff(len_new, 1.0f)) / val;
227  }
228  else { /* USER_ZOOM_DOLLY */
229  float len_new = 5 * U.dpi_fac;
230  float len_old = 5 * U.dpi_fac;
231 
232  if (U.uiflag & USER_ZOOM_HORIZ) {
233  len_new += (winrct->xmax - (xy_curr[0])) / U.dpi_fac;
234  len_old += (winrct->xmax - (xy_init[0])) / U.dpi_fac;
235  }
236  else {
237  len_new += (winrct->ymax - (xy_curr[1])) / U.dpi_fac;
238  len_old += (winrct->ymax - (xy_init[1])) / U.dpi_fac;
239  }
240 
241  if (zoom_invert != zoom_invert_force) {
242  SWAP(float, len_new, len_old);
243  }
244 
245  zfac = val_orig * (2.0f * ((len_new / max_ff(len_old, 1.0f)) - 1.0f) + 1.0f) / val;
246  }
247 
248  return zfac;
249 }
250 
251 static float viewzoom_scale_value_offset(const rcti *winrct,
252  const eViewZoom_Style viewzoom,
253  const bool zoom_invert,
254  const bool zoom_invert_force,
255  const int xy_curr[2],
256  const int xy_init[2],
257  const int xy_offset[2],
258  const float val,
259  const float val_orig,
260  double *r_timer_lastdraw)
261 {
262  const int xy_curr_offset[2] = {
263  xy_curr[0] + xy_offset[0],
264  xy_curr[1] + xy_offset[1],
265  };
266  const int xy_init_offset[2] = {
267  xy_init[0] + xy_offset[0],
268  xy_init[1] + xy_offset[1],
269  };
270  return viewzoom_scale_value(winrct,
271  viewzoom,
272  zoom_invert,
273  zoom_invert_force,
274  xy_curr_offset,
275  xy_init_offset,
276  val,
277  val_orig,
278  r_timer_lastdraw);
279 }
280 
282  const int xy[2],
283  const eViewZoom_Style viewzoom,
284  const bool zoom_invert,
285  const bool zoom_to_pos)
286 {
287  float zfac;
288  float zoomfac_prev = BKE_screen_view3d_zoom_to_fac(vod->init.camzoom) * 2.0f;
289  float zoomfac = BKE_screen_view3d_zoom_to_fac(vod->rv3d->camzoom) * 2.0f;
290 
292  viewzoom,
293  zoom_invert,
294  true,
295  xy,
296  vod->init.event_xy,
297  vod->init.event_xy_offset,
298  zoomfac,
299  zoomfac_prev,
300  &vod->prev.time);
301 
302  if (!ELEM(zfac, 1.0f, 0.0f)) {
303  /* calculate inverted, then invert again (needed because of camera zoom scaling) */
304  zfac = 1.0f / zfac;
306  vod->depsgraph,
307  vod->v3d,
308  vod->region,
309  zfac,
310  zoom_to_pos ? vod->prev.event_xy : NULL);
311  }
312 
314 }
315 
317  const int xy[2],
318  const eViewZoom_Style viewzoom,
319  const bool zoom_invert,
320  const bool zoom_to_pos)
321 {
322  float zfac;
323  float dist_range[2];
324 
325  ED_view3d_dist_range_get(vod->v3d, dist_range);
326 
328  viewzoom,
329  zoom_invert,
330  false,
331  xy,
332  vod->init.event_xy,
333  vod->init.event_xy_offset,
334  vod->rv3d->dist,
335  vod->init.dist,
336  &vod->prev.time);
337 
338  if (zfac != 1.0f) {
339  const float zfac_min = dist_range[0] / vod->rv3d->dist;
340  const float zfac_max = dist_range[1] / vod->rv3d->dist;
341  CLAMP(zfac, zfac_min, zfac_max);
342 
343  view_zoom_to_window_xy_3d(vod->region, zfac, zoom_to_pos ? vod->prev.event_xy : NULL);
344  }
345 
346  /* these limits were in old code too */
347  CLAMP(vod->rv3d->dist, dist_range[0], dist_range[1]);
348 
349  if (RV3D_LOCK_FLAGS(vod->rv3d) & RV3D_BOXVIEW) {
350  view3d_boxview_sync(vod->area, vod->region);
351  }
352 
353  ED_view3d_camera_lock_sync(vod->depsgraph, vod->v3d, vod->rv3d);
354 
356 }
357 
358 static void viewzoom_apply(ViewOpsData *vod,
359  const int xy[2],
360  const eViewZoom_Style viewzoom,
361  const bool zoom_invert,
362  const bool zoom_to_pos)
363 {
364  if ((vod->rv3d->persp == RV3D_CAMOB) &&
365  (vod->rv3d->is_persp && ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) == 0) {
366  viewzoom_apply_camera(vod, xy, viewzoom, zoom_invert, zoom_to_pos);
367  }
368  else {
369  viewzoom_apply_3d(vod, xy, viewzoom, zoom_invert, zoom_to_pos);
370  }
371 }
372 
373 static int viewzoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
374 {
375  ViewOpsData *vod = op->customdata;
376  short event_code = VIEW_PASS;
377  bool use_autokey = false;
379 
380  /* execute the events */
381  if (event->type == TIMER && event->customdata == vod->timer) {
382  /* continuous zoom */
383  event_code = VIEW_APPLY;
384  }
385  else if (event->type == MOUSEMOVE) {
386  event_code = VIEW_APPLY;
387  }
388  else if (event->type == EVT_MODAL_MAP) {
389  switch (event->val) {
390  case VIEW_MODAL_CONFIRM:
391  event_code = VIEW_CONFIRM;
392  break;
394  WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL, event);
395  event_code = VIEW_CONFIRM;
396  break;
398  WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL, event);
399  event_code = VIEW_CONFIRM;
400  break;
401  }
402  }
403  else if (event->type == vod->init.event_type && event->val == KM_RELEASE) {
404  event_code = VIEW_CONFIRM;
405  }
406 
407  if (event_code == VIEW_APPLY) {
408  const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
409  viewzoom_apply(vod,
410  event->xy,
411  (eViewZoom_Style)U.viewzoom,
412  (U.uiflag & USER_ZOOM_INVERT) != 0,
413  (use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)));
415  use_autokey = true;
416  }
417  }
418  else if (event_code == VIEW_CONFIRM) {
419  use_autokey = true;
421  }
422 
423  if (use_autokey) {
424  ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, false, true);
425  }
426 
427  if (ret & OPERATOR_FINISHED) {
428  ED_view3d_camera_lock_undo_push(op->type->name, vod->v3d, vod->rv3d, C);
430  op->customdata = NULL;
431  }
432 
433  return ret;
434 }
435 
437 {
440  View3D *v3d;
441  RegionView3D *rv3d;
442  ScrArea *area;
443  ARegion *region;
444  bool use_cam_zoom;
445  float dist_range[2];
446 
447  const int delta = RNA_int_get(op->ptr, "delta");
448  const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
449 
450  if (op->customdata) {
451  ViewOpsData *vod = op->customdata;
452 
453  area = vod->area;
454  region = vod->region;
455  }
456  else {
457  area = CTX_wm_area(C);
458  region = CTX_wm_region(C);
459  }
460 
461  v3d = area->spacedata.first;
462  rv3d = region->regiondata;
463 
464  use_cam_zoom = (rv3d->persp == RV3D_CAMOB) &&
465  !(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d));
466 
467  int zoom_xy_buf[2];
468  const int *zoom_xy = NULL;
469  if (use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) {
470  zoom_xy_buf[0] = RNA_struct_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") :
471  region->winx / 2;
472  zoom_xy_buf[1] = RNA_struct_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") :
473  region->winy / 2;
474  zoom_xy = zoom_xy_buf;
475  }
476 
477  ED_view3d_dist_range_get(v3d, dist_range);
478 
479  if (delta < 0) {
480  const float step = 1.2f;
481  if (use_cam_zoom) {
482  view_zoom_to_window_xy_camera(scene, depsgraph, v3d, region, step, zoom_xy);
483  }
484  else {
485  if (rv3d->dist < dist_range[1]) {
486  view_zoom_to_window_xy_3d(region, step, zoom_xy);
487  }
488  }
489  }
490  else {
491  const float step = 1.0f / 1.2f;
492  if (use_cam_zoom) {
493  view_zoom_to_window_xy_camera(scene, depsgraph, v3d, region, step, zoom_xy);
494  }
495  else {
496  if (rv3d->dist > dist_range[0]) {
497  view_zoom_to_window_xy_3d(region, step, zoom_xy);
498  }
499  }
500  }
501 
502  if (RV3D_LOCK_FLAGS(rv3d) & RV3D_BOXVIEW) {
503  view3d_boxview_sync(area, region);
504  }
505 
507  ED_view3d_camera_lock_autokey(v3d, rv3d, C, false, true);
508 
509  ED_region_tag_redraw(region);
510 
513  op->customdata = NULL;
514 
515  return OPERATOR_FINISHED;
516 }
517 
518 /* viewdolly_invoke() copied this function, changes here may apply there */
519 static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
520 {
521  ViewOpsData *vod;
522 
523  const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
524 
525  vod = op->customdata = viewops_data_create(
526  C,
527  event,
529  (use_cursor_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0));
530 
532 
533  /* if one or the other zoom position aren't set, set from event */
534  if (!RNA_struct_property_is_set(op->ptr, "mx") || !RNA_struct_property_is_set(op->ptr, "my")) {
535  RNA_int_set(op->ptr, "mx", event->xy[0]);
536  RNA_int_set(op->ptr, "my", event->xy[1]);
537  }
538 
539  if (RNA_struct_property_is_set(op->ptr, "delta")) {
540  viewzoom_exec(C, op);
541  }
542  else {
543  if (ELEM(event->type, MOUSEZOOM, MOUSEPAN)) {
544 
545  if (U.uiflag & USER_ZOOM_HORIZ) {
546  vod->init.event_xy[0] = vod->prev.event_xy[0] = event->xy[0];
547  }
548  else {
549  /* Set y move = x move as MOUSEZOOM uses only x axis to pass magnification value */
550  vod->init.event_xy[1] = vod->prev.event_xy[1] = vod->init.event_xy[1] + event->xy[0] -
551  event->prev_xy[0];
552  }
553  viewzoom_apply(vod,
554  event->prev_xy,
556  (U.uiflag & USER_ZOOM_INVERT) != 0,
557  (use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)));
558  ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, false, true);
559 
561  op->customdata = NULL;
562  return OPERATOR_FINISHED;
563  }
564 
565  if (U.viewzoom == USER_ZOOM_CONTINUE) {
566  /* needs a timer to continue redrawing */
569  }
570 
571  /* add temp handler */
573 
574  return OPERATOR_RUNNING_MODAL;
575  }
576  return OPERATOR_FINISHED;
577 }
578 
580 {
582  op->customdata = NULL;
583 }
584 
586 {
587  /* identifiers */
588  ot->name = "Zoom View";
589  ot->description = "Zoom in/out in the view";
590  ot->idname = "VIEW3D_OT_zoom";
591 
592  /* api callbacks */
594  ot->exec = viewzoom_exec;
598 
599  /* flags */
601 
602  /* properties */
605 }
606 
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1528
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
Definition: screen.c:1032
float BKE_screen_view3d_zoom_to_fac(float camzoom)
Definition: screen.c:1027
MINLINE float max_ff(float a, float b)
MINLINE float clamp_f(float value, float min, float max)
MINLINE float len_v2v2_int(const int v1[2], const int v2[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void negate_v3(float r[3])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
void BLI_rctf_translate(struct rctf *rect, float x, float y)
Definition: rct.c:566
void BLI_rctf_transform_pt_v(const rctf *dst, const rctf *src, float xy_dst[2], const float xy_src[2])
Definition: rct.c:529
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
Definition: BLI_rect.h:173
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
Definition: BLI_rect.h:169
#define SWAP(type, a, b)
#define ELEM(...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
@ USER_ZOOM_INVERT
@ USER_ZOOM_TO_MOUSEPOS
@ USER_ZOOM_HORIZ
eViewZoom_Style
@ USER_ZOOM_SCALE
@ USER_ZOOM_CONTINUE
@ USER_ZOOM_DOLLY
#define RV3D_CAMZOOM_MAX
#define RV3D_CAMZOOM_MIN_FACTOR
#define RV3D_LOCK_FLAGS(rv3d)
#define RV3D_CAMZOOM_MAX_FACTOR
#define RV3D_CAMOB
@ RV3D_BOXVIEW
#define RV3D_CAMZOOM_MIN
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
bScreen * ED_screen_animation_playing(const struct wmWindowManager *wm)
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:655
bool ED_view3d_camera_lock_sync(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d)
bool ED_view3d_camera_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d)
void ED_view3d_win_to_delta(const struct ARegion *region, const float xy_delta[2], float zfac, float r_out[3])
void ED_view3d_dist_range_get(const struct View3D *v3d, float r_dist_range[2])
bool ED_view3d_camera_lock_autokey(struct View3D *v3d, struct RegionView3D *rv3d, struct bContext *C, bool do_rotate, bool do_translate)
Definition: view3d_utils.c:665
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3])
bool ED_view3d_camera_lock_undo_push(const char *str, View3D *v3d, struct RegionView3D *rv3d, struct bContext *C)
Definition: view3d_utils.c:726
bool ED_view3d_camera_lock_undo_grouped_push(const char *str, View3D *v3d, struct RegionView3D *rv3d, struct bContext *C)
Definition: view3d_utils.c:731
void ED_view3d_calc_camera_border(const struct Scene *scene, struct Depsgraph *depsgraph, const struct ARegion *region, const struct View3D *v3d, const struct RegionView3D *rv3d, struct rctf *r_viewborder, bool no_shift)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
Platform independent time functions.
#define C
Definition: RandGen.cpp:25
@ KM_ANY
Definition: WM_types.h:265
@ KM_PRESS
Definition: WM_types.h:267
@ KM_RELEASE
Definition: WM_types.h:268
@ OPTYPE_BLOCKING
Definition: WM_types.h:150
@ OPTYPE_GRAB_CURSOR_XY
Definition: WM_types.h:154
@ WM_OP_INVOKE_DEFAULT
Definition: WM_types.h:201
unsigned int U
Definition: btGjkEpa3.h:78
double time
Scene scene
const Depsgraph * depsgraph
@ VIEW_CONFIRM
Definition: image_ops.c:583
@ VIEW_PASS
Definition: image_ops.c:581
@ VIEW_APPLY
Definition: image_ops.c:582
static void area(int d1, int d2, int e1, int e2, float weights[2])
return ret
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:4921
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5301
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
void * regiondata
struct RegionView3D * rv3d
struct wmTimer * timer
struct ViewOpsData::@577 prev
struct Depsgraph * depsgraph
struct ARegion * region
struct ViewOpsData::@576 init
int event_xy_offset[2]
struct ScrArea * area
struct Scene * scene
struct View3D * v3d
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
short val
Definition: WM_types.h:680
int xy[2]
Definition: WM_types.h:682
int prev_xy[2]
Definition: WM_types.h:728
short type
Definition: WM_types.h:678
void * customdata
Definition: WM_types.h:715
const void * modal_items
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:935
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:927
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct wmOperatorType * type
struct PointerRNA * ptr
double PIL_check_seconds_timer(void)
Definition: time.c:64
void view3d_boxview_sync(struct ScrArea *area, struct ARegion *region)
Definition: view3d_utils.c:890
void view3d_operator_properties_common(wmOperatorType *ot, const enum eV3D_OpPropFlag flag)
void viewops_data_free(bContext *C, ViewOpsData *vod)
ViewOpsData * viewops_data_create(bContext *C, const wmEvent *event, enum eViewOpsFlag viewops_flag)
enum eViewOpsFlag viewops_flag_from_prefs(void)
bool view3d_zoom_or_dolly_poll(bContext *C)
@ VIEWROT_MODAL_SWITCH_ROTATE
@ VIEWROT_MODAL_SWITCH_MOVE
@ VIEW_MODAL_CONFIRM
@ VIEWOPS_FLAG_USE_MOUSE_INIT
@ VIEWOPS_FLAG_ORBIT_SELECT
void ED_view3d_smooth_view_force_finish(struct bContext *C, struct View3D *v3d, struct ARegion *region)
@ V3D_OP_PROP_USE_MOUSE_INIT
@ V3D_OP_PROP_DELTA
@ V3D_OP_PROP_MOUSE_CO
static void viewzoom_apply(ViewOpsData *vod, const int xy[2], const eViewZoom_Style viewzoom, const bool zoom_invert, const bool zoom_to_pos)
static void view_zoom_to_window_xy_camera(Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *region, float dfac, const int zoom_xy[2])
static void viewzoom_apply_3d(ViewOpsData *vod, const int xy[2], const eViewZoom_Style viewzoom, const bool zoom_invert, const bool zoom_to_pos)
static int viewzoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
static float viewzoom_scale_value(const rcti *winrct, const eViewZoom_Style viewzoom, const bool zoom_invert, const bool zoom_invert_force, const int xy_curr[2], const int xy_init[2], const float val, const float val_orig, double *r_timer_lastdraw)
static int viewzoom_exec(bContext *C, wmOperator *op)
static void viewzoom_cancel(bContext *C, wmOperator *op)
void viewzoom_modal_keymap(wmKeyConfig *keyconf)
static void viewzoom_apply_camera(ViewOpsData *vod, const int xy[2], const eViewZoom_Style viewzoom, const bool zoom_invert, const bool zoom_to_pos)
static float viewzoom_scale_value_offset(const rcti *winrct, const eViewZoom_Style viewzoom, const bool zoom_invert, const bool zoom_invert_force, const int xy_curr[2], const int xy_init[2], const int xy_offset[2], const float val, const float val_orig, double *r_timer_lastdraw)
void VIEW3D_OT_zoom(wmOperatorType *ot)
static void view_zoom_to_window_xy_3d(ARegion *region, float dfac, const int zoom_xy[2])
static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int xy[2]
Definition: wm_draw.c:135
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
int WM_operator_name_call(bContext *C, const char *opstring, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
@ MOUSEPAN
@ TIMER
@ EVT_MODAL_MAP
@ MOUSEZOOM
@ EVT_LEFTCTRLKEY
@ MOUSEMOVE
@ LEFTMOUSE
@ EVT_LEFTSHIFTKEY
wmOperatorType * ot
Definition: wm_files.c:3479
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
Definition: wm_keymap.c:914
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
Definition: wm_keymap.c:985
wmKeyMapItem * WM_modalkeymap_add_item(wmKeyMap *km, const KeyMapItem_Params *params, int value)
Definition: wm_keymap.c:927
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
Definition: wm_keymap.c:888
wmTimer * WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
Definition: wm_window.c:1630