Blender V5.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
8
9#include "BLI_math_matrix.hh"
10#include "BLI_math_rotation.hh"
11#include "BLI_math_vector_c.hh"
12#include "BLI_rect.hh"
13#include "BLI_time.hh"
14
15#include "BKE_camera.h"
16#include "BKE_context.hh"
17#include "BKE_screen.hh"
18
19#include "WM_api.hh"
20
21#include "RNA_access.hh"
22
23#include "ED_screen.hh"
24
25#include "view3d_intern.hh"
26#include "view3d_navigate.hh" /* own include */
27
28namespace blender {
29
30/* -------------------------------------------------------------------- */
33
35{
36 /* NOTE: #viewdolly_modal_keymap has an exact copy of this, apply fixes to both. */
37
38 static const EnumPropertyItem modal_items[] = {
39 {VIEW_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
40 {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
41
42 {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
43 {VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
44
45 {0, nullptr, 0, nullptr, nullptr},
46 };
47
48 wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "View3D Zoom Modal");
49
50 /* This function is called for each space-type, only needs to add map once. */
51 if (keymap && keymap->modal_items) {
52 return;
53 }
54
55 keymap = WM_modalkeymap_ensure(keyconf, "View3D Zoom Modal", modal_items);
56
57 /* assign map to operators */
58 WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom");
59}
60
66 const Depsgraph *depsgraph,
67 View3D *v3d,
68 ARegion *region,
69 float dfac,
70 const int zoom_xy[2])
71{
72 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
73 const float zoomfac = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
74 const float zoomfac_new = clamp_f(
75 zoomfac * (1.0f / dfac), RV3D_CAMZOOM_MIN_FACTOR, RV3D_CAMZOOM_MAX_FACTOR);
76 const float camzoom_new = BKE_screen_view3d_zoom_from_fac(zoomfac_new);
77
78 if (zoom_xy != nullptr) {
79 float zoomfac_px;
80 rctf camera_frame_old;
81 rctf camera_frame_new;
82
83 const float2 pt_src(zoom_xy[0] - region->winrct.xmin, zoom_xy[1] - region->winrct.ymin);
84 float2 pt_dst;
85 float2 delta_px;
86
87 /* Calculate the center of zoom with roll applied. */
88 if (rv3d->camroll != 0.0f || (rv3d->rflag & RV3D_FLIP_X) != 0) {
89 const float2 center(region->winx / 2, region->winy / 2);
90
91 float2 pt_src_rotated = rotate_around_point_2d(
92 pt_src, center, math::AngleRadian(-rv3d->camroll));
93
95
96 camera_frame_old = BKE_camera_view_border(
97 scene, depsgraph, v3d, rv3d, region->winx, region->winy, false, false, true);
98
99 rv3d->camzoom = camzoom_new;
101
102 camera_frame_new = BKE_camera_view_border(
103 scene, depsgraph, v3d, rv3d, region->winx, region->winy, false, false, true);
104
105 BLI_rctf_transform_pt_v(&camera_frame_new, &camera_frame_old, pt_dst, pt_src_rotated);
106 pt_dst = rotate_around_point_2d(pt_dst, center, math::AngleRadian(rv3d->camroll));
107
108 delta_px = pt_dst - pt_src;
109
110 if ((rv3d->rflag & RV3D_FLIP_X) != 0) {
111 delta_px.x = -delta_px.x;
112 }
113
114 delta_px = rot_invert * delta_px;
115 }
116 else {
117 camera_frame_old = BKE_camera_view_border(
118 scene, depsgraph, v3d, rv3d, region->winx, region->winy, false, false, true);
119
120 rv3d->camzoom = camzoom_new;
122
123 camera_frame_new = BKE_camera_view_border(
124 scene, depsgraph, v3d, rv3d, region->winx, region->winy, false, false, true);
125
126 BLI_rctf_transform_pt_v(&camera_frame_new, &camera_frame_old, pt_dst, pt_src);
127
128 delta_px = pt_dst - pt_src;
129 }
130
131 /* translate the camera offset using pixel space delta
132 * mapped back to the camera (same logic as panning in camera view) */
133 zoomfac_px = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom) * 2.0f;
134
135 rv3d->camdx += delta_px.x / (region->winx * zoomfac_px);
136 rv3d->camdy += delta_px.y / (region->winy * zoomfac_px);
137 CLAMP(rv3d->camdx, -1.0f, 1.0f);
138 CLAMP(rv3d->camdy, -1.0f, 1.0f);
139 }
140 else {
141 rv3d->camzoom = camzoom_new;
143 }
144}
145
150static void view_zoom_to_window_xy_3d(ARegion *region, float dfac, const int zoom_xy[2])
151{
152 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
153 const float dist_new = rv3d->dist * dfac;
154
155 if (zoom_xy != nullptr) {
156 float dvec[3];
157 float tvec[3];
158 float tpos[3];
159 float xy_delta[2];
160
161 float zfac;
162
163 negate_v3_v3(tpos, rv3d->ofs);
164
165 xy_delta[0] = float(((zoom_xy[0] - region->winrct.xmin) * 2) - region->winx) / 2.0f;
166 xy_delta[1] = float(((zoom_xy[1] - region->winrct.ymin) * 2) - region->winy) / 2.0f;
167
168 /* Project cursor position into 3D space */
169 zfac = ED_view3d_calc_zfac(rv3d, tpos);
170 ED_view3d_win_to_delta(region, xy_delta, zfac, dvec);
171
172 /* Calculate view target position for dolly */
173 add_v3_v3v3(tvec, tpos, dvec);
174 negate_v3(tvec);
175
176 /* Offset to target position and dolly */
177 copy_v3_v3(rv3d->ofs, tvec);
178 rv3d->dist = dist_new;
179
180 /* Calculate final offset */
181 madd_v3_v3v3fl(rv3d->ofs, tvec, dvec, dfac);
182 }
183 else {
184 rv3d->dist = dist_new;
185 }
186}
187
188static float viewzoom_scale_value(const rcti *winrct,
189 const eViewZoom_Style viewzoom,
190 const bool zoom_invert,
191 const bool zoom_invert_force,
192 const int xy_curr[2],
193 const int xy_init[2],
194 const float val,
195 const float val_orig,
196 double *r_timer_lastdraw)
197{
198 float zfac;
199
200 if (viewzoom == USER_ZOOM_CONTINUE) {
201 double time = BLI_time_now_seconds();
202 float time_step = float(time - *r_timer_lastdraw);
203 float fac;
204
205 if (U.uiflag & USER_ZOOM_HORIZ) {
206 fac = float(xy_init[0] - xy_curr[0]);
207 }
208 else {
209 fac = float(xy_init[1] - xy_curr[1]);
210 }
211
212 fac /= UI_SCALE_FAC;
213
214 if (zoom_invert != zoom_invert_force) {
215 fac = -fac;
216 }
217
218 zfac = 1.0f + ((fac / 20.0f) * time_step);
219 *r_timer_lastdraw = time;
220 }
221 else if (viewzoom == USER_ZOOM_SCALE) {
222 /* method which zooms based on how far you move the mouse */
223
224 const int ctr[2] = {
225 BLI_rcti_cent_x(winrct),
226 BLI_rcti_cent_y(winrct),
227 };
228 float len_new = (5 * UI_SCALE_FAC) + (len_v2v2_int(ctr, xy_curr) / UI_SCALE_FAC);
229 float len_old = (5 * UI_SCALE_FAC) + (len_v2v2_int(ctr, xy_init) / UI_SCALE_FAC);
230
231 /* intentionally ignore 'zoom_invert' for scale */
232 if (zoom_invert_force) {
233 std::swap(len_new, len_old);
234 }
235
236 zfac = val_orig * (len_old / max_ff(len_new, 1.0f)) / val;
237 }
238 else { /* USER_ZOOM_DOLLY */
239 float len_new = 5 * UI_SCALE_FAC;
240 float len_old = 5 * UI_SCALE_FAC;
241
242 if (U.uiflag & USER_ZOOM_HORIZ) {
243 len_new += (winrct->xmax - (xy_curr[0])) / UI_SCALE_FAC;
244 len_old += (winrct->xmax - (xy_init[0])) / UI_SCALE_FAC;
245 }
246 else {
247 len_new += (winrct->ymax - (xy_curr[1])) / UI_SCALE_FAC;
248 len_old += (winrct->ymax - (xy_init[1])) / UI_SCALE_FAC;
249 }
250
251 if (zoom_invert != zoom_invert_force) {
252 std::swap(len_new, len_old);
253 }
254
255 zfac = val_orig * (2.0f * ((len_new / max_ff(len_old, 1.0f)) - 1.0f) + 1.0f) / val;
256 }
257
258 return zfac;
259}
260
261static float viewzoom_scale_value_offset(const rcti *winrct,
262 const eViewZoom_Style viewzoom,
263 const bool zoom_invert,
264 const bool zoom_invert_force,
265 const int xy_curr[2],
266 const int xy_init[2],
267 const int xy_offset[2],
268 const float val,
269 const float val_orig,
270 double *r_timer_lastdraw)
271{
272 const int xy_curr_offset[2] = {
273 xy_curr[0] + xy_offset[0],
274 xy_curr[1] + xy_offset[1],
275 };
276 const int xy_init_offset[2] = {
277 xy_init[0] + xy_offset[0],
278 xy_init[1] + xy_offset[1],
279 };
280 return viewzoom_scale_value(winrct,
281 viewzoom,
282 zoom_invert,
283 zoom_invert_force,
284 xy_curr_offset,
285 xy_init_offset,
286 val,
287 val_orig,
288 r_timer_lastdraw);
289}
290
292 const int xy[2],
293 const eViewZoom_Style viewzoom,
294 const bool zoom_invert,
295 const bool zoom_to_pos)
296{
297 float zfac;
298 float zoomfac_prev = BKE_screen_view3d_zoom_to_fac(vod->init.camzoom) * 2.0f;
299 float zoomfac = BKE_screen_view3d_zoom_to_fac(vod->rv3d->camzoom) * 2.0f;
300
302 viewzoom,
303 zoom_invert,
304 true,
305 xy,
306 vod->init.event_xy,
307 vod->init.event_xy_offset,
308 zoomfac,
309 zoomfac_prev,
310 &vod->prev.time);
311
312 if (!ELEM(zfac, 1.0f, 0.0f)) {
313 /* calculate inverted, then invert again (needed because of camera zoom scaling) */
314 zfac = 1.0f / zfac;
316 vod->depsgraph,
317 vod->v3d,
318 vod->region,
319 zfac,
320 zoom_to_pos ? vod->prev.event_xy : nullptr);
321 }
322
324}
325
327 const int xy[2],
328 const eViewZoom_Style viewzoom,
329 const bool zoom_invert,
330 const bool zoom_to_pos)
331{
332 const Bounds<float> dist_range = ED_view3d_dist_soft_range_get(vod->v3d, false);
333 float zfac = viewzoom_scale_value_offset(&vod->region->winrct,
334 viewzoom,
335 zoom_invert,
336 false,
337 xy,
338 vod->init.event_xy,
339 vod->init.event_xy_offset,
340 vod->rv3d->dist,
341 vod->init.dist,
342 &vod->prev.time);
343
344 if (zfac != 1.0f) {
345 const float zfac_min = dist_range.min / vod->rv3d->dist;
346 const float zfac_max = dist_range.max / vod->rv3d->dist;
347 CLAMP(zfac, zfac_min, zfac_max);
348
349 view_zoom_to_window_xy_3d(vod->region, zfac, zoom_to_pos ? vod->prev.event_xy : nullptr);
350 }
351
352 /* these limits were in old code too */
353 CLAMP(vod->rv3d->dist, dist_range.min, dist_range.max);
354
355 if (RV3D_LOCK_FLAGS(vod->rv3d) & RV3D_BOXVIEW) {
356 view3d_boxview_sync(vod->area, vod->region);
357 }
358
360
362}
363
365 const int xy[2],
366 const eViewZoom_Style viewzoom,
367 const bool zoom_invert)
368{
369 const bool zoom_to_pos = (vod->viewops_flag & VIEWOPS_FLAG_ZOOM_TO_MOUSE) != 0;
370
371 if ((vod->rv3d->persp == RV3D_CAMOB) &&
372 (vod->rv3d->is_persp && ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) == 0)
373 {
374 viewzoom_apply_camera(vod, xy, viewzoom, zoom_invert, zoom_to_pos);
375 }
376 else {
377 viewzoom_apply_3d(vod, xy, viewzoom, zoom_invert, zoom_to_pos);
378 }
379}
380
382 ViewOpsData *vod,
383 const eV3D_OpEvent event_code,
384 const int xy[2])
385{
386 bool use_autokey = false;
388
389 switch (event_code) {
390 case VIEW_APPLY: {
391 viewzoom_apply(vod, xy, eViewZoom_Style(U.viewzoom), (U.uiflag & USER_ZOOM_INVERT) != 0);
393 use_autokey = true;
394 }
395 break;
396 }
397 case VIEW_CONFIRM: {
398 use_autokey = true;
400 break;
401 }
402 case VIEW_CANCEL: {
403 vod->state_restore();
405 break;
406 }
407 case VIEW_PASS:
408 break;
409 }
410
411 if (use_autokey) {
412 ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, false, true);
413 }
414
415 return ret;
416}
417
419 const Depsgraph *depsgraph,
420 Scene *scene,
421 ScrArea *area,
422 ARegion *region,
423 const int delta,
424 const int zoom_xy[2])
425{
426 View3D *v3d = area->spacedata.first_as<View3D>();
427 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
428 bool use_cam_zoom;
429
430 use_cam_zoom = (rv3d->persp == RV3D_CAMOB) &&
431 !(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d));
432
433 const Bounds<float> dist_range = ED_view3d_dist_soft_range_get(v3d, false);
434
435 if (delta < 0) {
436 const float step = 1.2f;
437 if (use_cam_zoom) {
438 view_zoom_to_window_xy_camera(scene, depsgraph, v3d, region, step, zoom_xy);
439 }
440 else {
441 if (rv3d->dist < dist_range.max) {
442 view_zoom_to_window_xy_3d(region, step, zoom_xy);
443 }
444 }
445 }
446 else {
447 const float step = 1.0f / 1.2f;
448 if (use_cam_zoom) {
449 view_zoom_to_window_xy_camera(scene, depsgraph, v3d, region, step, zoom_xy);
450 }
451 else {
452 if (rv3d->dist > dist_range.min) {
453 view_zoom_to_window_xy_3d(region, step, zoom_xy);
454 }
455 }
456 }
457
458 if (RV3D_LOCK_FLAGS(rv3d) & RV3D_BOXVIEW) {
459 view3d_boxview_sync(area, region);
460 }
461
462 ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d);
463 ED_view3d_camera_lock_autokey(v3d, rv3d, C, false, true);
464
465 ED_region_tag_redraw(region);
466}
467
469{
470 BLI_assert(op->customdata == nullptr);
471
472 Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
473 Scene *scene = CTX_data_scene(C);
474 ScrArea *area = CTX_wm_area(C);
475 ARegion *region = CTX_wm_region(C);
476 View3D *v3d = area->spacedata.first_as<View3D>();
477 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
478
479 const int delta = RNA_int_get(op->ptr, "delta");
480 const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
481
482 int zoom_xy_buf[2];
483 const int *zoom_xy = nullptr;
484 const bool do_zoom_to_mouse_pos = (use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS));
485 if (do_zoom_to_mouse_pos) {
486 zoom_xy_buf[0] = RNA_struct_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") :
487 region->winx / 2;
488 zoom_xy_buf[1] = RNA_struct_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") :
489 region->winy / 2;
490 zoom_xy = zoom_xy_buf;
491 }
492
493 view_zoom_apply_step(C, depsgraph, scene, area, region, delta, zoom_xy);
495
496 return OPERATOR_FINISHED;
497}
498
500 ViewOpsData *vod,
501 const wmEvent *event,
502 PointerRNA *ptr)
503{
504 int xy[2];
505
506 PropertyRNA *prop;
507 prop = RNA_struct_find_property(ptr, "mx");
508 xy[0] = RNA_property_is_set(ptr, prop) ? RNA_property_int_get(ptr, prop) : event->xy[0];
509
510 prop = RNA_struct_find_property(ptr, "my");
511 xy[1] = RNA_property_is_set(ptr, prop) ? RNA_property_int_get(ptr, prop) : event->xy[1];
512
513 prop = RNA_struct_find_property(ptr, "delta");
514 const int delta = RNA_property_is_set(ptr, prop) ? RNA_property_int_get(ptr, prop) : 0;
515
516 if (delta) {
517 const bool do_zoom_to_mouse_pos = (vod->viewops_flag & VIEWOPS_FLAG_ZOOM_TO_MOUSE) != 0;
519 vod->depsgraph,
520 vod->scene,
521 vod->area,
522 vod->region,
523 delta,
524 do_zoom_to_mouse_pos ? xy : nullptr);
525
526 return OPERATOR_FINISHED;
527 }
528
529 eV3D_OpEvent event_code = ELEM(event->type, MOUSEZOOM, MOUSEPAN) ? VIEW_CONFIRM : VIEW_PASS;
530 if (event_code == VIEW_CONFIRM) {
531 if (U.uiflag & USER_ZOOM_HORIZ) {
532 vod->init.event_xy[0] = vod->prev.event_xy[0] = xy[0];
533 }
534 else {
535 /* Set y move = x move as MOUSEZOOM uses only x axis to pass magnification value */
536 vod->init.event_xy[1] = vod->prev.event_xy[1] = vod->init.event_xy[1] + xy[0] -
537 event->prev_xy[0];
538 }
539 viewzoom_apply(vod, event->prev_xy, USER_ZOOM_DOLLY, (U.uiflag & USER_ZOOM_INVERT) != 0);
540 ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, false, true);
541
542 return OPERATOR_FINISHED;
543 }
544
545 if (U.viewzoom == USER_ZOOM_CONTINUE) {
546 /* needs a timer to continue redrawing */
548 vod->prev.time = BLI_time_now_seconds();
549 }
550
552}
553
555{
556 /* Near duplicate logic in #viewdolly_invoke(), changes here may apply there too. */
558}
559
561{
562 /* identifiers */
563 ot->name = "Zoom View";
564 ot->description = "Zoom in/out in the view";
566
567 /* API callbacks. */
569 ot->exec = viewzoom_exec;
573
574 /* flags */
576
577 /* properties */
580}
581
583
586 /*idname*/ "VIEW3D_OT_zoom",
587 /*poll_fn*/ view3d_zoom_or_dolly_poll,
588 /*init_fn*/ viewzoom_invoke_impl,
589 /*apply_fn*/ viewzoom_modal_impl,
590};
591
592} // namespace blender
Camera data-block and utility functions.
Platform independent time functions.
#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
#define C
Definition RandGen.cpp:29
#define CLAMP(a, b, c)
#define ELEM(...)
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
AngleRadianBase< float > AngleRadian
MatT from_rotation(const RotationT &rotation)
BMesh Iterators.
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
bool ED_view3d_camera_lock_autokey(View3D *v3d, RegionView3D *rv3d, bContext *C, bool do_rotate, bool do_translate)
UserDef U
Definition blender.cc:58
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE void negate_v3_v3(float r[3], const float a[3])
ScrArea * CTX_wm_area(const bContext *C)
bool ED_view3d_camera_lock_check(const View3D *v3d, const RegionView3D *rv3d)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
Definition wm_keymap.cc:999
MINLINE void copy_v3_v3(float r[3], const float a[3])
bool ED_view3d_camera_lock_undo_grouped_push(const char *str, const View3D *v3d, const RegionView3D *rv3d, bContext *C)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
static void viewzoom_apply_3d(ViewOpsData *vod, const int xy[2], const eViewZoom_Style viewzoom, const bool zoom_invert, const bool zoom_to_pos)
void view3d_operator_properties_common(wmOperatorType *ot, const enum eV3D_OpPropFlag flag)
MINLINE float len_v2v2_int(const int v1[2], const int v2[2])
bool ED_view3d_camera_lock_sync(const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d)
MatBase< float, 2, 2 > float2x2
int RNA_int_get(PointerRNA *ptr, const char *name)
static void view_zoom_to_window_xy_3d(ARegion *region, float dfac, const int zoom_xy[2])
wmWindow * CTX_wm_window(const bContext *C)
static wmOperatorStatus viewzoom_exec(bContext *C, wmOperator *op)
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)
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:681
static wmOperatorStatus viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void viewzoom_apply(ViewOpsData *vod, const int xy[2], const eViewZoom_Style viewzoom, const bool zoom_invert)
void VIEW3D_OT_zoom(wmOperatorType *ot)
VecBase< float, 2 > float2
wmOperatorStatus view3d_navigate_invoke_impl(bContext *C, wmOperator *op, const wmEvent *event, const ViewOpsType *nav_type)
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
Definition BLI_rect.hh:190
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
Definition screen.cc:1288
wmWindowManager * CTX_wm_manager(const bContext *C)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
void viewzoom_modal_keymap(wmKeyConfig *keyconf)
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)
rctf BKE_camera_view_border(const struct Scene *scene, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winx, int winy, bool no_shift, bool no_zoom, bool no_roll)
MINLINE void negate_v3(float r[3])
@ VIEW_CONFIRM
Definition image_ops.cc:652
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3])
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
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 void view_zoom_apply_step(bContext *C, const Depsgraph *depsgraph, Scene *scene, ScrArea *area, ARegion *region, const int delta, const int zoom_xy[2])
@ VIEWOPS_FLAG_ZOOM_TO_MOUSE
@ VIEWOPS_FLAG_DEPTH_NAVIGATE
Bounds< float > ED_view3d_dist_soft_range_get(const View3D *v3d, bool use_persp_range)
@ VIEWROT_MODAL_SWITCH_MOVE
@ VIEWROT_MODAL_SWITCH_ROTATE
void view3d_navigate_cancel_fn(bContext *C, wmOperator *op)
void BLI_rctf_transform_pt_v(const rctf *dst, const rctf *src, float xy_dst[2], const float xy_src[2])
Definition rct.cc:540
bool view3d_zoom_or_dolly_poll(bContext *C)
const ViewOpsType ViewOpsType_zoom
static wmOperatorStatus viewzoom_invoke_impl(bContext *C, ViewOpsData *vod, const wmEvent *event, PointerRNA *ptr)
MINLINE float max_ff(float a, float b)
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
double BLI_time_now_seconds()
Definition time.cc:30
Scene * CTX_data_scene(const bContext *C)
@ V3D_OP_PROP_USE_MOUSE_INIT
float BKE_screen_view3d_zoom_to_fac(float camzoom)
Definition screen.cc:1283
static void viewzoom_apply_camera(ViewOpsData *vod, const int xy[2], const eViewZoom_Style viewzoom, const bool zoom_invert, const bool zoom_to_pos)
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
Definition wm_keymap.cc:972
@ OPTYPE_BLOCKING
Definition WM_types.hh:192
@ OPTYPE_GRAB_CURSOR_XY
Definition WM_types.hh:196
wmTimer * WM_event_timer_add(wmWindowManager *wm, wmWindow *win, const wmEventType event_type, const double time_step)
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
Definition BLI_rect.hh:186
static wmOperatorStatus viewzoom_modal_impl(bContext *C, ViewOpsData *vod, const eV3D_OpEvent event_code, const int xy[2])
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
ARegion * CTX_wm_region(const bContext *C)
void view3d_boxview_sync(ScrArea *area, ARegion *region)
void ED_view3d_win_to_delta(const ARegion *region, const float xy_delta[2], float zfac, float r_out[3], bool precise=false)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
bScreen * ED_screen_animation_playing(const wmWindowManager *wm)
MINLINE float clamp_f(float value, float min, float max)
wmOperatorStatus view3d_navigate_modal_fn(bContext *C, wmOperator *op, const wmEvent *event)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eRegionView3D_Flag rflag
eRegionView3D_Persp persp
ListBaseT< SpaceLink > spacedata
struct blender::ViewOpsData::@013213354235237006300365026145043140112021271057 prev
struct blender::ViewOpsData::@130157306301264131203124134151333300254160116071 init
wmEventType type
Definition WM_types.hh:817
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
void(*) cancel(bContext *C, wmOperator *op)
Definition WM_types.hh:1149
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1141
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1157
struct wmOperatorType * type