Blender V4.3
view3d_navigate_view_zoom.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "BLI_math_vector.h"
10#include "BLI_rect.h"
11#include "BLI_time.h"
12
13#include "BKE_context.hh"
14#include "BKE_screen.hh"
15
16#include "WM_api.hh"
17
18#include "RNA_access.hh"
19
20#include "ED_screen.hh"
21
22#include "view3d_intern.hh"
23#include "view3d_navigate.hh" /* own include */
24
25/* -------------------------------------------------------------------- */
30{
31 /* NOTE: #viewdolly_modal_keymap has an exact copy of this, apply fixes to both. */
32
33 static const EnumPropertyItem modal_items[] = {
34 {VIEW_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
35 {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
36
37 {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
38 {VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
39
40 {0, nullptr, 0, nullptr, nullptr},
41 };
42
43 wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "View3D Zoom Modal");
44
45 /* This function is called for each space-type, only needs to add map once. */
46 if (keymap && keymap->modal_items) {
47 return;
48 }
49
50 keymap = WM_modalkeymap_ensure(keyconf, "View3D Zoom Modal", modal_items);
51
52 /* assign map to operators */
53 WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom");
54}
55
61 const Depsgraph *depsgraph,
62 View3D *v3d,
63 ARegion *region,
64 float dfac,
65 const int zoom_xy[2])
66{
67 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
68 const float zoomfac = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
69 const float zoomfac_new = clamp_f(
70 zoomfac * (1.0f / dfac), RV3D_CAMZOOM_MIN_FACTOR, RV3D_CAMZOOM_MAX_FACTOR);
71 const float camzoom_new = BKE_screen_view3d_zoom_from_fac(zoomfac_new);
72
73 if (zoom_xy != nullptr) {
74 float zoomfac_px;
75 rctf camera_frame_old;
76 rctf camera_frame_new;
77
78 const float pt_src[2] = {float(zoom_xy[0]), float(zoom_xy[1])};
79 float pt_dst[2];
80 float delta_px[2];
81
82 ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, false, &camera_frame_old);
83 BLI_rctf_translate(&camera_frame_old, region->winrct.xmin, region->winrct.ymin);
84
85 rv3d->camzoom = camzoom_new;
87
88 ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, false, &camera_frame_new);
89 BLI_rctf_translate(&camera_frame_new, region->winrct.xmin, region->winrct.ymin);
90
91 BLI_rctf_transform_pt_v(&camera_frame_new, &camera_frame_old, pt_dst, pt_src);
92 sub_v2_v2v2(delta_px, pt_dst, pt_src);
93
94 /* translate the camera offset using pixel space delta
95 * mapped back to the camera (same logic as panning in camera view) */
96 zoomfac_px = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom) * 2.0f;
97
98 rv3d->camdx += delta_px[0] / (region->winx * zoomfac_px);
99 rv3d->camdy += delta_px[1] / (region->winy * zoomfac_px);
100 CLAMP(rv3d->camdx, -1.0f, 1.0f);
101 CLAMP(rv3d->camdy, -1.0f, 1.0f);
102 }
103 else {
104 rv3d->camzoom = camzoom_new;
106 }
107}
108
113static void view_zoom_to_window_xy_3d(ARegion *region, float dfac, const int zoom_xy[2])
114{
115 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
116 const float dist_new = rv3d->dist * dfac;
117
118 if (zoom_xy != nullptr) {
119 float dvec[3];
120 float tvec[3];
121 float tpos[3];
122 float xy_delta[2];
123
124 float zfac;
125
126 negate_v3_v3(tpos, rv3d->ofs);
127
128 xy_delta[0] = float(((zoom_xy[0] - region->winrct.xmin) * 2) - region->winx) / 2.0f;
129 xy_delta[1] = float(((zoom_xy[1] - region->winrct.ymin) * 2) - region->winy) / 2.0f;
130
131 /* Project cursor position into 3D space */
132 zfac = ED_view3d_calc_zfac(rv3d, tpos);
133 ED_view3d_win_to_delta(region, xy_delta, zfac, dvec);
134
135 /* Calculate view target position for dolly */
136 add_v3_v3v3(tvec, tpos, dvec);
137 negate_v3(tvec);
138
139 /* Offset to target position and dolly */
140 copy_v3_v3(rv3d->ofs, tvec);
141 rv3d->dist = dist_new;
142
143 /* Calculate final offset */
144 madd_v3_v3v3fl(rv3d->ofs, tvec, dvec, dfac);
145 }
146 else {
147 rv3d->dist = dist_new;
148 }
149}
150
151static float viewzoom_scale_value(const rcti *winrct,
152 const eViewZoom_Style viewzoom,
153 const bool zoom_invert,
154 const bool zoom_invert_force,
155 const int xy_curr[2],
156 const int xy_init[2],
157 const float val,
158 const float val_orig,
159 double *r_timer_lastdraw)
160{
161 float zfac;
162
163 if (viewzoom == USER_ZOOM_CONTINUE) {
164 double time = BLI_time_now_seconds();
165 float time_step = float(time - *r_timer_lastdraw);
166 float fac;
167
168 if (U.uiflag & USER_ZOOM_HORIZ) {
169 fac = float(xy_init[0] - xy_curr[0]);
170 }
171 else {
172 fac = float(xy_init[1] - xy_curr[1]);
173 }
174
175 fac /= UI_SCALE_FAC;
176
177 if (zoom_invert != zoom_invert_force) {
178 fac = -fac;
179 }
180
181 zfac = 1.0f + ((fac / 20.0f) * time_step);
182 *r_timer_lastdraw = time;
183 }
184 else if (viewzoom == USER_ZOOM_SCALE) {
185 /* method which zooms based on how far you move the mouse */
186
187 const int ctr[2] = {
188 BLI_rcti_cent_x(winrct),
189 BLI_rcti_cent_y(winrct),
190 };
191 float len_new = (5 * UI_SCALE_FAC) + (float(len_v2v2_int(ctr, xy_curr)) / UI_SCALE_FAC);
192 float len_old = (5 * UI_SCALE_FAC) + (float(len_v2v2_int(ctr, xy_init)) / UI_SCALE_FAC);
193
194 /* intentionally ignore 'zoom_invert' for scale */
195 if (zoom_invert_force) {
196 std::swap(len_new, len_old);
197 }
198
199 zfac = val_orig * (len_old / max_ff(len_new, 1.0f)) / val;
200 }
201 else { /* USER_ZOOM_DOLLY */
202 float len_new = 5 * UI_SCALE_FAC;
203 float len_old = 5 * UI_SCALE_FAC;
204
205 if (U.uiflag & USER_ZOOM_HORIZ) {
206 len_new += (winrct->xmax - (xy_curr[0])) / UI_SCALE_FAC;
207 len_old += (winrct->xmax - (xy_init[0])) / UI_SCALE_FAC;
208 }
209 else {
210 len_new += (winrct->ymax - (xy_curr[1])) / UI_SCALE_FAC;
211 len_old += (winrct->ymax - (xy_init[1])) / UI_SCALE_FAC;
212 }
213
214 if (zoom_invert != zoom_invert_force) {
215 std::swap(len_new, len_old);
216 }
217
218 zfac = val_orig * (2.0f * ((len_new / max_ff(len_old, 1.0f)) - 1.0f) + 1.0f) / val;
219 }
220
221 return zfac;
222}
223
224static float viewzoom_scale_value_offset(const rcti *winrct,
225 const eViewZoom_Style viewzoom,
226 const bool zoom_invert,
227 const bool zoom_invert_force,
228 const int xy_curr[2],
229 const int xy_init[2],
230 const int xy_offset[2],
231 const float val,
232 const float val_orig,
233 double *r_timer_lastdraw)
234{
235 const int xy_curr_offset[2] = {
236 xy_curr[0] + xy_offset[0],
237 xy_curr[1] + xy_offset[1],
238 };
239 const int xy_init_offset[2] = {
240 xy_init[0] + xy_offset[0],
241 xy_init[1] + xy_offset[1],
242 };
243 return viewzoom_scale_value(winrct,
244 viewzoom,
245 zoom_invert,
246 zoom_invert_force,
247 xy_curr_offset,
248 xy_init_offset,
249 val,
250 val_orig,
251 r_timer_lastdraw);
252}
253
255 const int xy[2],
256 const eViewZoom_Style viewzoom,
257 const bool zoom_invert,
258 const bool zoom_to_pos)
259{
260 float zfac;
261 float zoomfac_prev = BKE_screen_view3d_zoom_to_fac(vod->init.camzoom) * 2.0f;
262 float zoomfac = BKE_screen_view3d_zoom_to_fac(vod->rv3d->camzoom) * 2.0f;
263
265 viewzoom,
266 zoom_invert,
267 true,
268 xy,
269 vod->init.event_xy,
271 zoomfac,
272 zoomfac_prev,
273 &vod->prev.time);
274
275 if (!ELEM(zfac, 1.0f, 0.0f)) {
276 /* calculate inverted, then invert again (needed because of camera zoom scaling) */
277 zfac = 1.0f / zfac;
279 vod->depsgraph,
280 vod->v3d,
281 vod->region,
282 zfac,
283 zoom_to_pos ? vod->prev.event_xy : nullptr);
284 }
285
287}
288
290 const int xy[2],
291 const eViewZoom_Style viewzoom,
292 const bool zoom_invert,
293 const bool zoom_to_pos)
294{
295 float zfac;
296 float dist_range[2];
297
298 ED_view3d_dist_range_get(vod->v3d, dist_range);
299
301 viewzoom,
302 zoom_invert,
303 false,
304 xy,
305 vod->init.event_xy,
307 vod->rv3d->dist,
308 vod->init.dist,
309 &vod->prev.time);
310
311 if (zfac != 1.0f) {
312 const float zfac_min = dist_range[0] / vod->rv3d->dist;
313 const float zfac_max = dist_range[1] / vod->rv3d->dist;
314 CLAMP(zfac, zfac_min, zfac_max);
315
316 view_zoom_to_window_xy_3d(vod->region, zfac, zoom_to_pos ? vod->prev.event_xy : nullptr);
317 }
318
319 /* these limits were in old code too */
320 CLAMP(vod->rv3d->dist, dist_range[0], dist_range[1]);
321
322 if (RV3D_LOCK_FLAGS(vod->rv3d) & RV3D_BOXVIEW) {
323 view3d_boxview_sync(vod->area, vod->region);
324 }
325
327
329}
330
332 const int xy[2],
333 const eViewZoom_Style viewzoom,
334 const bool zoom_invert)
335{
336 const bool zoom_to_pos = (vod->viewops_flag & VIEWOPS_FLAG_ZOOM_TO_MOUSE) != 0;
337
338 if ((vod->rv3d->persp == RV3D_CAMOB) &&
339 (vod->rv3d->is_persp && ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) == 0)
340 {
341 viewzoom_apply_camera(vod, xy, viewzoom, zoom_invert, zoom_to_pos);
342 }
343 else {
344 viewzoom_apply_3d(vod, xy, viewzoom, zoom_invert, zoom_to_pos);
345 }
346}
347
349 ViewOpsData *vod,
350 const eV3D_OpEvent event_code,
351 const int xy[2])
352{
353 bool use_autokey = false;
355
356 switch (event_code) {
357 case VIEW_APPLY: {
358 viewzoom_apply(vod, xy, (eViewZoom_Style)U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0);
360 use_autokey = true;
361 }
362 break;
363 }
364 case VIEW_CONFIRM: {
365 use_autokey = true;
367 break;
368 }
369 case VIEW_CANCEL: {
370 vod->state_restore();
372 break;
373 }
374 case VIEW_PASS:
375 break;
376 }
377
378 if (use_autokey) {
379 ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, false, true);
380 }
381
382 return ret;
383}
384
386 const Depsgraph *depsgraph,
387 Scene *scene,
388 ScrArea *area,
389 ARegion *region,
390 const int delta,
391 const int zoom_xy[2])
392{
393 View3D *v3d = static_cast<View3D *>(area->spacedata.first);
394 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
395 bool use_cam_zoom;
396 float dist_range[2];
397
398 use_cam_zoom = (rv3d->persp == RV3D_CAMOB) &&
399 !(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d));
400
401 ED_view3d_dist_range_get(v3d, dist_range);
402
403 if (delta < 0) {
404 const float step = 1.2f;
405 if (use_cam_zoom) {
406 view_zoom_to_window_xy_camera(scene, depsgraph, v3d, region, step, zoom_xy);
407 }
408 else {
409 if (rv3d->dist < dist_range[1]) {
410 view_zoom_to_window_xy_3d(region, step, zoom_xy);
411 }
412 }
413 }
414 else {
415 const float step = 1.0f / 1.2f;
416 if (use_cam_zoom) {
417 view_zoom_to_window_xy_camera(scene, depsgraph, v3d, region, step, zoom_xy);
418 }
419 else {
420 if (rv3d->dist > dist_range[0]) {
421 view_zoom_to_window_xy_3d(region, step, zoom_xy);
422 }
423 }
424 }
425
426 if (RV3D_LOCK_FLAGS(rv3d) & RV3D_BOXVIEW) {
427 view3d_boxview_sync(area, region);
428 }
429
431 ED_view3d_camera_lock_autokey(v3d, rv3d, C, false, true);
432
433 ED_region_tag_redraw(region);
434}
435
437{
438 BLI_assert(op->customdata == nullptr);
439
441 Scene *scene = CTX_data_scene(C);
442 ScrArea *area = CTX_wm_area(C);
443 ARegion *region = CTX_wm_region(C);
444 View3D *v3d = static_cast<View3D *>(area->spacedata.first);
445 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
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 int zoom_xy_buf[2];
451 const int *zoom_xy = nullptr;
452 const bool do_zoom_to_mouse_pos = (use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS));
453 if (do_zoom_to_mouse_pos) {
454 zoom_xy_buf[0] = RNA_struct_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") :
455 region->winx / 2;
456 zoom_xy_buf[1] = RNA_struct_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") :
457 region->winy / 2;
458 zoom_xy = zoom_xy_buf;
459 }
460
461 view_zoom_apply_step(C, depsgraph, scene, area, region, delta, zoom_xy);
463
464 return OPERATOR_FINISHED;
465}
466
468 ViewOpsData *vod,
469 const wmEvent *event,
471{
472 int xy[2];
473
474 PropertyRNA *prop;
475 prop = RNA_struct_find_property(ptr, "mx");
476 xy[0] = RNA_property_is_set(ptr, prop) ? RNA_property_int_get(ptr, prop) : event->xy[0];
477
478 prop = RNA_struct_find_property(ptr, "my");
479 xy[1] = RNA_property_is_set(ptr, prop) ? RNA_property_int_get(ptr, prop) : event->xy[1];
480
481 prop = RNA_struct_find_property(ptr, "delta");
482 const int delta = RNA_property_is_set(ptr, prop) ? RNA_property_int_get(ptr, prop) : 0;
483
484 if (delta) {
485 const bool do_zoom_to_mouse_pos = (vod->viewops_flag & VIEWOPS_FLAG_ZOOM_TO_MOUSE) != 0;
487 vod->depsgraph,
488 vod->scene,
489 vod->area,
490 vod->region,
491 delta,
492 do_zoom_to_mouse_pos ? xy : nullptr);
493
494 return OPERATOR_FINISHED;
495 }
496 else {
497 eV3D_OpEvent event_code = ELEM(event->type, MOUSEZOOM, MOUSEPAN) ? VIEW_CONFIRM : VIEW_PASS;
498 if (event_code == VIEW_CONFIRM) {
499 if (U.uiflag & USER_ZOOM_HORIZ) {
500 vod->init.event_xy[0] = vod->prev.event_xy[0] = xy[0];
501 }
502 else {
503 /* Set y move = x move as MOUSEZOOM uses only x axis to pass magnification value */
504 vod->init.event_xy[1] = vod->prev.event_xy[1] = vod->init.event_xy[1] + xy[0] -
505 event->prev_xy[0];
506 }
507 viewzoom_apply(vod, event->prev_xy, USER_ZOOM_DOLLY, (U.uiflag & USER_ZOOM_INVERT) != 0);
508 ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, false, true);
509
510 return OPERATOR_FINISHED;
511 }
512 }
513
514 if (U.viewzoom == USER_ZOOM_CONTINUE) {
515 /* needs a timer to continue redrawing */
518 }
519
521}
522
523/* viewdolly_invoke() copied this function, changes here may apply there */
524static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
525{
526 return view3d_navigate_invoke_impl(C, op, event, &ViewOpsType_zoom);
527}
528
530{
531 /* identifiers */
532 ot->name = "Zoom View";
533 ot->description = "Zoom in/out in the view";
535
536 /* api callbacks */
542
543 /* flags */
545
546 /* properties */
549}
550
555 /*idname*/ "VIEW3D_OT_zoom",
556 /*poll_fn*/ view3d_zoom_or_dolly_poll,
557 /*init_fn*/ viewzoom_invoke_impl,
558 /*apply_fn*/ viewzoom_modal_impl,
559};
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
Definition screen.cc:1003
float BKE_screen_view3d_zoom_to_fac(float camzoom)
Definition screen.cc:998
#define BLI_assert(a)
Definition BLI_assert.h:50
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:567
void BLI_rctf_transform_pt_v(const rctf *dst, const rctf *src, float xy_dst[2], const float xy_src[2])
Definition rct.c:530
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
Definition BLI_rect.h:176
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
Definition BLI_rect.h:172
Platform independent time functions.
double BLI_time_now_seconds(void)
Definition time.c:65
#define CLAMP(a, b, c)
#define ELEM(...)
@ USER_ZOOM_INVERT
@ USER_ZOOM_TO_MOUSEPOS
@ USER_ZOOM_HORIZ
eViewZoom_Style
@ USER_ZOOM_SCALE
@ USER_ZOOM_CONTINUE
@ USER_ZOOM_DOLLY
#define UI_SCALE_FAC
#define RV3D_CAMZOOM_MAX
#define RV3D_CAMZOOM_MIN_FACTOR
#define RV3D_LOCK_FLAGS(rv3d)
#define RV3D_CAMZOOM_MAX_FACTOR
#define RV3D_CAMZOOM_MIN
@ RV3D_CAMOB
@ RV3D_BOXVIEW
@ OPERATOR_RUNNING_MODAL
bScreen * ED_screen_animation_playing(const wmWindowManager *wm)
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:634
bool ED_view3d_camera_lock_sync(const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d)
void ED_view3d_dist_range_get(const View3D *v3d, float r_dist_range[2])
void ED_view3d_win_to_delta(const ARegion *region, const float xy_delta[2], float zfac, float r_out[3])
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3])
bool ED_view3d_camera_lock_check(const View3D *v3d, const RegionView3D *rv3d)
void ED_view3d_calc_camera_border(const Scene *scene, const Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const RegionView3D *rv3d, bool no_shift, rctf *r_viewborder)
bool ED_view3d_camera_lock_autokey(View3D *v3d, RegionView3D *rv3d, bContext *C, bool do_rotate, bool do_translate)
bool ED_view3d_camera_lock_undo_grouped_push(const char *str, const View3D *v3d, const RegionView3D *rv3d, bContext *C)
@ OPTYPE_BLOCKING
Definition WM_types.hh:164
@ OPTYPE_GRAB_CURSOR_XY
Definition WM_types.hh:168
unsigned int U
Definition btGjkEpa3.h:78
double time
const Depsgraph * depsgraph
draw_view in_light_buf[] float
@ VIEW_CONFIRM
Definition image_ops.cc:587
@ VIEW_PASS
Definition image_ops.cc:585
@ VIEW_APPLY
Definition image_ops.cc:586
return ret
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
struct ViewOpsData::@543 init
eViewOpsFlag viewops_flag
Depsgraph * depsgraph
ARegion * region
struct ViewOpsData::@544 prev
RegionView3D * rv3d
const char * idname
float xmin
int ymax
int xmax
int prev_xy[2]
Definition WM_types.hh:785
short type
Definition WM_types.hh:722
const void * modal_items
const char * name
Definition WM_types.hh:990
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1042
const char * idname
Definition WM_types.hh:992
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1036
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1022
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1006
const char * description
Definition WM_types.hh:996
void(* cancel)(bContext *C, wmOperator *op)
Definition WM_types.hh:1028
struct wmOperatorType * type
struct PointerRNA * ptr
void view3d_boxview_sync(ScrArea *area, ARegion *region)
void view3d_navigate_cancel_fn(bContext *C, wmOperator *op)
void view3d_operator_properties_common(wmOperatorType *ot, const enum eV3D_OpPropFlag flag)
int view3d_navigate_modal_fn(bContext *C, wmOperator *op, const wmEvent *event)
int view3d_navigate_invoke_impl(bContext *C, wmOperator *op, const wmEvent *event, const ViewOpsType *nav_type)
bool view3d_zoom_or_dolly_poll(bContext *C)
@ VIEWOPS_FLAG_DEPTH_NAVIGATE
@ VIEWOPS_FLAG_ZOOM_TO_MOUSE
eV3D_OpEvent
@ VIEW_CANCEL
@ VIEWROT_MODAL_SWITCH_ROTATE
@ VIEW_MODAL_CANCEL
@ VIEWROT_MODAL_SWITCH_MOVE
@ VIEW_MODAL_CONFIRM
@ V3D_OP_PROP_USE_MOUSE_INIT
@ V3D_OP_PROP_DELTA
@ V3D_OP_PROP_MOUSE_CO
static int viewzoom_invoke_impl(bContext *C, ViewOpsData *vod, const wmEvent *event, PointerRNA *ptr)
const ViewOpsType ViewOpsType_zoom
static int viewzoom_modal_impl(bContext *C, ViewOpsData *vod, const eV3D_OpEvent event_code, const int xy[2])
static void viewzoom_apply(ViewOpsData *vod, const int xy[2], const eViewZoom_Style viewzoom, const bool zoom_invert)
static void view_zoom_apply_step(bContext *C, const Depsgraph *depsgraph, Scene *scene, ScrArea *area, ARegion *region, const int delta, 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 void view_zoom_to_window_xy_camera(Scene *scene, const Depsgraph *depsgraph, View3D *v3d, ARegion *region, float dfac, const int zoom_xy[2])
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)
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.cc:170
@ MOUSEPAN
@ TIMER
@ MOUSEZOOM
PointerRNA * ptr
Definition wm_files.cc:4126
wmOperatorType * ot
Definition wm_files.cc:4125
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
Definition wm_keymap.cc:933
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
Definition wm_keymap.cc:960
wmTimer * WM_event_timer_add(wmWindowManager *wm, wmWindow *win, const int event_type, const double time_step)