Blender V5.0
view3d_edit.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include "DNA_armature_types.h"
12#include "DNA_camera_types.h"
13#include "DNA_world_types.h"
14
15#include "MEM_guardedalloc.h"
16
17#include "BLI_listbase.h"
18#include "BLI_math_geom.h"
19#include "BLI_math_matrix.h"
20#include "BLI_math_rotation.h"
21#include "BLI_math_vector.h"
22#include "BLI_rect.h"
23#include "BLI_string_utf8.h"
24
25#include "BKE_action.hh"
26#include "BKE_armature.hh"
27#include "BKE_camera.h"
28#include "BKE_lib_id.hh"
29#include "BKE_object.hh"
30#include "BKE_report.hh"
31#include "BKE_scene.hh"
32#include "BKE_screen.hh"
33
35
36#include "WM_api.hh"
37#include "WM_message.hh"
38
39#include "RNA_access.hh"
40#include "RNA_define.hh"
41
42#include "ED_screen.hh"
43#include "ED_transform.hh"
45#include "ED_undo.hh"
46
47#include "view3d_intern.hh" /* own include */
48#include "view3d_navigate.hh"
49
50/* test for unlocked camera view in quad view */
52{
53 View3D *v3d;
54 ARegion *region;
55
56 if (ED_view3d_context_user_region(C, &v3d, &region)) {
57 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
58 if ((rv3d->persp == RV3D_CAMOB) && !(RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ANY_TRANSFORM)) {
59 return true;
60 }
61 }
62
63 return false;
64}
65
67{
68 View3D *v3d = CTX_wm_view3d(C);
69 if (v3d) {
71 if (rv3d) {
72 return ED_view3d_offset_lock_check(v3d, rv3d);
73 }
74 }
75 return false;
76}
77
78/* -------------------------------------------------------------------- */
81
83{
84 View3D *v3d = CTX_wm_view3d(C);
85
86 if (v3d) {
88
90
91 return OPERATOR_FINISHED;
92 }
93
94 return OPERATOR_CANCELLED;
95}
96
98{
99
100 /* identifiers */
101 ot->name = "View Lock Clear";
102 ot->description = "Clear all view locking";
103 ot->idname = "VIEW3D_OT_view_lock_clear";
104
105 /* API callbacks. */
106 ot->exec = view_lock_clear_exec;
108
109 /* flags */
110 ot->flag = 0;
111}
112
114
115/* -------------------------------------------------------------------- */
118
120{
121 View3D *v3d = CTX_wm_view3d(C);
123
124 if (v3d) {
126
127 v3d->ob_center = obact; /* can be nullptr */
128
129 if (obact && obact->type == OB_ARMATURE) {
130 if (obact->mode & OB_MODE_POSE) {
132 Object *obact_eval = DEG_get_evaluated(depsgraph, obact);
134 if (pcham_act) {
135 STRNCPY_UTF8(v3d->ob_center_bone, pcham_act->name);
136 }
137 }
138 else {
139 EditBone *ebone_act = ((bArmature *)obact->data)->act_edbone;
140 if (ebone_act) {
141 STRNCPY_UTF8(v3d->ob_center_bone, ebone_act->name);
142 }
143 }
144 }
145
147
148 return OPERATOR_FINISHED;
149 }
150
151 return OPERATOR_CANCELLED;
152}
153
155{
156
157 /* identifiers */
158 ot->name = "View Lock to Active";
159 ot->description = "Lock the view to the active object/bone";
160 ot->idname = "VIEW3D_OT_view_lock_to_active";
161
162 /* API callbacks. */
165
166 /* flags */
167 ot->flag = 0;
168}
169
171
172/* -------------------------------------------------------------------- */
175
177{
179 Scene *scene = CTX_data_scene(C);
180 float xfac, yfac;
181 float size[2];
182
183 View3D *v3d;
184 ARegion *region;
185 RegionView3D *rv3d;
186
187 /* no nullptr check is needed, poll checks */
188 ED_view3d_context_user_region(C, &v3d, &region);
189 rv3d = static_cast<RegionView3D *>(region->regiondata);
190
191 rv3d->camdx = rv3d->camdy = 0.0f;
192
193 ED_view3d_calc_camera_border_size(scene, depsgraph, region, v3d, rv3d, size);
194
195 /* 4px is just a little room from the edge of the area */
196 xfac = float(region->winx) / float(size[0] + 4);
197 yfac = float(region->winy) / float(size[1] + 4);
198
201
203
204 return OPERATOR_FINISHED;
205}
206
208{
209 /* identifiers */
210 ot->name = "Frame Camera Bounds";
211 ot->description = "Center the camera view, resizing the view to fit its bounds";
212 ot->idname = "VIEW3D_OT_view_center_camera";
213
214 /* API callbacks. */
217
218 /* flags */
219 ot->flag = 0;
220}
221
223
224/* -------------------------------------------------------------------- */
227
238
240{
241 /* identifiers */
242 ot->name = "View Lock Center";
243 ot->description = "Center the view lock offset";
244 ot->idname = "VIEW3D_OT_view_center_lock";
245
246 /* API callbacks. */
248 ot->poll = view3d_lock_poll;
249
250 /* flags */
251 ot->flag = 0;
252}
253
255
256/* -------------------------------------------------------------------- */
259
261{
262 View3D *v3d = CTX_wm_view3d(C);
263 ARegion *region = CTX_wm_region(C);
265
266 Scene *scene = CTX_data_scene(C);
267
268 rcti rect;
269 rctf vb, border;
270
271 /* get box select values using rna */
273
274 /* calculate range */
275
276 if (rv3d->persp == RV3D_CAMOB) {
278 ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, false, &vb);
279 }
280 else {
281 vb.xmin = 0;
282 vb.ymin = 0;
283 vb.xmax = region->winx;
284 vb.ymax = region->winy;
285 }
286
287 border.xmin = (float(rect.xmin) - vb.xmin) / BLI_rctf_size_x(&vb);
288 border.ymin = (float(rect.ymin) - vb.ymin) / BLI_rctf_size_y(&vb);
289 border.xmax = (float(rect.xmax) - vb.xmin) / BLI_rctf_size_x(&vb);
290 border.ymax = (float(rect.ymax) - vb.ymin) / BLI_rctf_size_y(&vb);
291
292 /* actually set border */
293 CLAMP(border.xmin, 0.0f, 1.0f);
294 CLAMP(border.ymin, 0.0f, 1.0f);
295 CLAMP(border.xmax, 0.0f, 1.0f);
296 CLAMP(border.ymax, 0.0f, 1.0f);
297
298 if (rv3d->persp == RV3D_CAMOB) {
299 scene->r.border = border;
300
302 }
303 else {
304 v3d->render_border = border;
305
307 }
308
309 /* drawing a border outside the camera view switches off border rendering */
310 if (border.xmin == border.xmax || border.ymin == border.ymax) {
311 if (rv3d->persp == RV3D_CAMOB) {
312 scene->r.mode &= ~R_BORDER;
313 }
314 else {
316 }
317 }
318 else {
319 if (rv3d->persp == RV3D_CAMOB) {
320 scene->r.mode |= R_BORDER;
321 }
322 else {
323 v3d->flag2 |= V3D_RENDER_BORDER;
324 }
325 }
326
327 if (rv3d->persp == RV3D_CAMOB) {
329 ED_undo_push(C, op->type->name);
330 }
331 return OPERATOR_FINISHED;
332}
333
335{
336 /* identifiers */
337 ot->name = "Set Render Region";
338 ot->description = "Set the boundaries of the border render and enable border render";
339 ot->idname = "VIEW3D_OT_render_border";
340
341 /* API callbacks. */
342 ot->invoke = WM_gesture_box_invoke;
343 ot->exec = render_border_exec;
344 ot->modal = WM_gesture_box_modal;
345 ot->cancel = WM_gesture_box_cancel;
346
348
349 /* flags */
350 /* No undo, edited data is usually not undo-able, otherwise (camera view),
351 * a manual undo push is done. */
352 ot->flag = OPTYPE_REGISTER;
353
354 /* properties */
356}
357
359
360/* -------------------------------------------------------------------- */
363
365{
366 View3D *v3d = CTX_wm_view3d(C);
368
369 Scene *scene = CTX_data_scene(C);
370 rctf *border = nullptr;
371
372 if (rv3d->persp == RV3D_CAMOB) {
373 scene->r.mode &= ~R_BORDER;
374 border = &scene->r.border;
375
377 }
378 else {
380 border = &v3d->render_border;
381
383 }
384
385 border->xmin = 0.0f;
386 border->ymin = 0.0f;
387 border->xmax = 1.0f;
388 border->ymax = 1.0f;
389
390 if (rv3d->persp == RV3D_CAMOB) {
392 ED_undo_push(C, op->type->name);
393 }
394 return OPERATOR_FINISHED;
395}
396
398{
399 /* identifiers */
400 ot->name = "Clear Render Region";
401 ot->description = "Clear the boundaries of the border render and disable border render";
402 ot->idname = "VIEW3D_OT_clear_render_border";
403
404 /* API callbacks. */
407
408 /* flags */
409 /* No undo, edited data is usually not undo-able, otherwise (camera view),
410 * a manual undo push is done. */
411 ot->flag = OPTYPE_REGISTER;
412}
413
415
416/* -------------------------------------------------------------------- */
421
423 Depsgraph *depsgraph,
424 ARegion *region,
425 View3D *v3d)
426{
427 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
428 float size[2];
429
430 int im_width, im_height;
431 BKE_render_resolution(&scene->r, false, &im_width, &im_height);
432
433 ED_view3d_calc_camera_border_size(scene, depsgraph, region, v3d, rv3d, size);
434
435 rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(float(im_width) / size[0]);
437}
438
440{
442 Scene *scene = CTX_data_scene(C);
443
444 View3D *v3d;
445 ARegion *region;
446
447 /* no nullptr check is needed, poll checks */
448 ED_view3d_context_user_region(C, &v3d, &region);
449
450 /* NOTE: don't call #ED_view3d_smooth_view_force_finish as the camera zoom
451 * isn't controlled by smooth-view, there is no need to "finish". */
452
453 view3d_set_1_to_1_viewborder(scene, depsgraph, region, v3d);
454
456
457 return OPERATOR_FINISHED;
458}
459
461{
462 /* identifiers */
463 ot->name = "Zoom Camera 1:1";
464 ot->description = "Match the camera to 1:1 to the render output";
465 ot->idname = "VIEW3D_OT_zoom_camera_1_to_1";
466
467 /* API callbacks. */
470
471 /* flags */
472 ot->flag = 0;
473}
474
476
477/* -------------------------------------------------------------------- */
480
482{
483 View3D *v3d;
484 ARegion *region;
485 RegionView3D *rv3d;
486
487 /* no nullptr check is needed, poll checks */
488 ED_view3d_context_user_region(C, &v3d, &region);
490
491 rv3d = static_cast<RegionView3D *>(region->regiondata);
492
493 /* Could add a separate lock flag for locking persp. */
494 if ((RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ANY_TRANSFORM) == 0) {
495 if (rv3d->persp != RV3D_ORTHO) {
496 rv3d->persp = RV3D_ORTHO;
497 }
498 else {
499 rv3d->persp = RV3D_PERSP;
500 }
501 rv3d->rflag &= ~RV3D_WAS_CAMOB;
502 ED_region_tag_redraw(region);
503 }
504
505 return OPERATOR_FINISHED;
506}
507
509{
510 /* identifiers */
511 ot->name = "View Perspective/Orthographic";
512 ot->description = "Switch the current view from perspective/orthographic projection";
513 ot->idname = "VIEW3D_OT_view_persportho";
514
515 /* API callbacks. */
516 ot->exec = viewpersportho_exec;
518
519 /* flags */
520 ot->flag = 0;
521}
522
524
525/* -------------------------------------------------------------------- */
530
532 wmOperator * /*op*/,
533 const wmEvent *event)
534{
535 eViewNavigation_Method mode = eViewNavigation_Method(U.navigation_mode);
536
537 switch (mode) {
540 C, "VIEW3D_OT_fly", blender::wm::OpCallContext::InvokeDefault, nullptr, event);
541 break;
543 default:
545 C, "VIEW3D_OT_walk", blender::wm::OpCallContext::InvokeDefault, nullptr, event);
546 break;
547 }
548
549 return OPERATOR_FINISHED;
550}
551
553{
554 /* identifiers */
555 ot->name = "View Navigation (Walk/Fly)";
556 ot->description =
557 "Interactively navigate around the scene (uses the mode (walk/fly) preference)";
558 ot->idname = "VIEW3D_OT_navigate";
559
560 /* API callbacks. */
561 ot->invoke = view3d_navigate_invoke;
563}
564
566
567/* -------------------------------------------------------------------- */
570
572{
573 /* Needed to support drag-and-drop & camera buttons context. */
574 View3D *v3d = CTX_wm_view3d(C);
575 if (v3d != nullptr) {
576 if (v3d->camera && v3d->camera->data && v3d->camera->type == OB_CAMERA) {
577 return static_cast<Camera *>(v3d->camera->data);
578 }
579 return nullptr;
580 }
581
582 return static_cast<Camera *>(CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data);
583}
584
586{
588 Image *ima;
589 CameraBGImage *bgpic;
590
592 /* may be nullptr, continue anyway */
593
595 bgpic->ima = ima;
596
597 cam->flag |= CAM_SHOW_BG_IMAGE;
598
601
602 return OPERATOR_FINISHED;
603}
604
609
611{
612 /* identifiers */
613 ot->name = "Add Camera Background Image";
614 ot->description = "Add a new background image to the active camera";
615 ot->idname = "VIEW3D_OT_camera_background_image_add";
616
617 /* API callbacks. */
620
621 /* flags */
623
624 /* properties */
626 ot->srna, "filepath", nullptr, FILE_MAX, "Filepath", "Path to image file");
629 prop = RNA_def_boolean(ot->srna,
630 "relative_path",
631 true,
632 "Relative Path",
633 "Select the file relative to the blend file");
635
637}
638
640
641/* -------------------------------------------------------------------- */
644
646{
647 Camera *cam = static_cast<Camera *>(CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data);
648 const int index = RNA_int_get(op->ptr, "index");
649 CameraBGImage *bgpic_rem = static_cast<CameraBGImage *>(BLI_findlink(&cam->bg_images, index));
650
651 if (bgpic_rem) {
652 if (ID_IS_OVERRIDE_LIBRARY(cam) &&
654 {
657 "Cannot remove background image %d from camera '%s', as it is from the linked "
658 "reference data",
659 index,
660 cam->id.name + 2);
661 return OPERATOR_CANCELLED;
662 }
663
664 id_us_min((ID *)bgpic_rem->ima);
665 id_us_min((ID *)bgpic_rem->clip);
666
668
671
672 return OPERATOR_FINISHED;
673 }
674 return OPERATOR_CANCELLED;
675}
676
678{
679 /* identifiers */
680 ot->name = "Remove Camera Background Image";
681 ot->description = "Remove a background image from the camera";
682 ot->idname = "VIEW3D_OT_camera_background_image_remove";
683
684 /* API callbacks. */
687
688 /* flags */
689 ot->flag = 0;
690
691 /* properties */
693 ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove", 0, INT_MAX);
694}
695
697
698/* -------------------------------------------------------------------- */
701
703{
704 Main *bmain = CTX_data_main(C);
705 Scene *scene = CTX_data_scene(C);
706
708 bmain, op->ptr, ID_WO);
709 if (world == nullptr) {
710 return OPERATOR_CANCELLED;
711 }
712
713 id_us_min((ID *)scene->world);
714 id_us_plus(&world->id);
715 scene->world = world;
716
719
721
722 return OPERATOR_FINISHED;
723}
724
726{
728}
729
731{
732 /* identifiers */
733 ot->name = "Drop World";
734 ot->description = "Drop a world into the scene";
735 ot->idname = "VIEW3D_OT_drop_world";
736
737 /* API callbacks. */
738 ot->exec = drop_world_exec;
739 ot->poll = drop_world_poll;
740
741 /* flags */
743
744 /* properties */
746}
747
749
750/* -------------------------------------------------------------------- */
755
756static void calc_local_clipping(float clip_local[6][4],
757 const BoundBox *clipbb,
758 const float mat[4][4])
759{
760 BoundBox clipbb_local;
761 float imat[4][4];
762
763 invert_m4_m4(imat, mat);
764
765 for (int i = 0; i < 8; i++) {
766 mul_v3_m4v3(clipbb_local.vec[i], imat, clipbb->vec[i]);
767 }
768
769 ED_view3d_clipping_calc_from_boundbox(clip_local, &clipbb_local, is_negative_m4(mat));
770}
771
772void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
773{
774 if (rv3d->rflag & RV3D_CLIPPING) {
775 calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);
776 }
777}
778
780{
781 ARegion *region = CTX_wm_region(C);
783 rcti rect;
784
786
787 rv3d->rflag |= RV3D_CLIPPING;
788 rv3d->clipbb = MEM_callocN<BoundBox>("clipbb");
789
790 /* nullptr object because we don't want it in object space */
791 ED_view3d_clipping_calc(rv3d->clipbb, rv3d->clip, region, nullptr, &rect);
792
793 return OPERATOR_FINISHED;
794}
795
797{
799 ARegion *region = CTX_wm_region(C);
800
801 if (rv3d->rflag & RV3D_CLIPPING) {
802 rv3d->rflag &= ~RV3D_CLIPPING;
803 ED_region_tag_redraw(region);
804 MEM_SAFE_FREE(rv3d->clipbb);
805 return OPERATOR_FINISHED;
806 }
807 return WM_gesture_box_invoke(C, op, event);
808}
809
811{
812
813 /* identifiers */
814 ot->name = "Clipping Region";
815 ot->description = "Set the view clipping region";
816 ot->idname = "VIEW3D_OT_clip_border";
817
818 /* API callbacks. */
819 ot->invoke = view3d_clipping_invoke;
820 ot->exec = view3d_clipping_exec;
821 ot->modal = WM_gesture_box_modal;
822 ot->cancel = WM_gesture_box_cancel;
823
825
826 /* flags */
827 ot->flag = 0;
828
829 /* properties */
831}
832
834
835/* -------------------------------------------------------------------- */
838
840 const int mval[2],
841 const bool use_depth,
842 float r_cursor_co[3])
843{
844 ARegion *region = CTX_wm_region(C);
845 View3D *v3d = CTX_wm_view3d(C);
846 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
847 bool flip;
848 bool depth_used = false;
849
850 /* normally the caller should ensure this,
851 * but this is called from areas that aren't already dealing with the viewport */
852 if (rv3d == nullptr) {
853 return;
854 }
855
856 ED_view3d_calc_zfac_ex(rv3d, r_cursor_co, &flip);
857
858 /* Reset the depth based on the view offset (we _know_ the offset is in front of us). */
859 if (flip) {
860 negate_v3_v3(r_cursor_co, rv3d->ofs);
861 /* re initialize, no need to check flip again */
862 ED_view3d_calc_zfac(rv3d, r_cursor_co);
863 }
864
865 if (use_depth) { /* maybe this should be accessed some other way */
867
869
870 /* Ensure the depth buffer is updated for #ED_view3d_autodist. */
871 ED_view3d_depth_override(depsgraph, region, v3d, nullptr, V3D_DEPTH_ALL, false, nullptr);
872
873 if (ED_view3d_autodist(region, v3d, mval, r_cursor_co, nullptr)) {
874 depth_used = true;
875 }
876 }
877
878 if (depth_used == false) {
879 float depth_pt[3];
880 copy_v3_v3(depth_pt, r_cursor_co);
881 ED_view3d_win_to_3d_int(v3d, region, depth_pt, mval, r_cursor_co);
882 }
883}
884
886 const int mval[2],
887 const bool use_depth,
888 enum eV3DCursorOrient orientation,
889 float r_cursor_co[3],
890 float r_cursor_quat[4])
891{
892 Scene *scene = CTX_data_scene(C);
893 View3D *v3d = CTX_wm_view3d(C);
894 ARegion *region = CTX_wm_region(C);
895 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
896
897 /* XXX, caller should check. */
898 if (rv3d == nullptr) {
899 return;
900 }
901
902 ED_view3d_cursor3d_position(C, mval, use_depth, r_cursor_co);
903
904 if (orientation == V3D_CURSOR_ORIENT_NONE) {
905 /* pass */
906 }
907 else if (orientation == V3D_CURSOR_ORIENT_VIEW) {
908 copy_qt_qt(r_cursor_quat, rv3d->viewquat);
909 r_cursor_quat[0] *= -1.0f;
910 }
911 else if (orientation == V3D_CURSOR_ORIENT_XFORM) {
912 float mat[3][3];
914 mat3_to_quat(r_cursor_quat, mat);
915 }
916 else if (orientation == V3D_CURSOR_ORIENT_GEOM) {
917 copy_qt_qt(r_cursor_quat, rv3d->viewquat);
918 r_cursor_quat[0] *= -1.0f;
919
920 const float mval_fl[2] = {float(mval[0]), float(mval[1])};
921 float ray_no[3];
922 float ray_co[3];
923
926
927 float obmat[4][4];
928 const Object *ob_dummy = nullptr;
929 float dist_px = 0;
931 params.snap_target_select = SCE_SNAP_TARGET_ALL;
935 snap_context,
937 region,
938 v3d,
940 &params,
941 nullptr,
942 mval_fl,
943 nullptr,
944 &dist_px,
945 ray_co,
946 ray_no,
947 nullptr,
948 &ob_dummy,
949 obmat,
950 nullptr) != 0)
951 {
952 if (use_depth) {
953 copy_v3_v3(r_cursor_co, ray_co);
954 }
955
956 /* Math normal (Z). */
957 {
958 float tquat[4];
959 float z_src[3] = {0, 0, 1};
960 mul_qt_v3(r_cursor_quat, z_src);
961 rotation_between_vecs_to_quat(tquat, z_src, ray_no);
962 mul_qt_qtqt(r_cursor_quat, tquat, r_cursor_quat);
963 }
964
965 /* Match object matrix (X). */
966 {
967 const float ortho_axis_dot[3] = {
968 dot_v3v3(ray_no, obmat[0]),
969 dot_v3v3(ray_no, obmat[1]),
970 dot_v3v3(ray_no, obmat[2]),
971 };
972 const int ortho_axis = axis_dominant_v3_ortho_single(ortho_axis_dot);
973
974 float tquat_best[4];
975 float angle_best = -1.0f;
976
977 float tan_dst[3];
978 project_plane_v3_v3v3(tan_dst, obmat[ortho_axis], ray_no);
979 normalize_v3(tan_dst);
980
981 /* As the tangent is arbitrary from the users point of view,
982 * make the cursor 'roll' on the shortest angle.
983 * otherwise this can cause noticeable 'flipping', see #72419. */
984 for (int axis = 0; axis < 2; axis++) {
985 float tan_src[3] = {0, 0, 0};
986 tan_src[axis] = 1.0f;
987 mul_qt_v3(r_cursor_quat, tan_src);
988
989 for (int axis_sign = 0; axis_sign < 2; axis_sign++) {
990 float tquat_test[4];
991 rotation_between_vecs_to_quat(tquat_test, tan_src, tan_dst);
992 const float angle_test = angle_normalized_qt(tquat_test);
993 if (angle_test < angle_best || angle_best == -1.0f) {
994 angle_best = angle_test;
995 copy_qt_qt(tquat_best, tquat_test);
996 }
997 negate_v3(tan_src);
998 }
999 }
1000 mul_qt_qtqt(r_cursor_quat, tquat_best, r_cursor_quat);
1001 }
1002 }
1004 }
1005}
1006
1008 const int mval[2],
1009 const bool use_depth,
1010 enum eV3DCursorOrient orientation)
1011{
1012 Scene *scene = CTX_data_scene(C);
1013 View3D *v3d = CTX_wm_view3d(C);
1014 ARegion *region = CTX_wm_region(C);
1015 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
1016
1017 View3DCursor *cursor_curr = &scene->cursor;
1018 View3DCursor cursor_prev = *cursor_curr;
1019
1020 {
1021 blender::math::Quaternion quat, quat_prev;
1022 quat = cursor_curr->rotation();
1023 copy_qt_qt(&quat_prev.w, &quat.w);
1025 C, mval, use_depth, orientation, cursor_curr->location, &quat.w);
1026
1027 if (!equals_v4v4(&quat_prev.w, &quat.w)) {
1028 if ((cursor_curr->rotation_mode == ROT_MODE_AXISANGLE) && RV3D_VIEW_IS_AXIS(rv3d->view)) {
1029 float tmat[3][3], cmat[3][3];
1030 quat_to_mat3(tmat, &quat.w);
1031 negate_v3_v3(cursor_curr->rotation_axis, tmat[2]);
1032 axis_angle_to_mat3(cmat, cursor_curr->rotation_axis, 0.0f);
1034 cmat[0], tmat[0], cursor_curr->rotation_axis);
1035 }
1036 else {
1037 cursor_curr->set_rotation(quat, true);
1038 }
1039 }
1040 }
1041
1042 /* offset the cursor lock to avoid jumping to new offset */
1043 if (v3d->ob_center_cursor) {
1044 if (U.uiflag & USER_LOCK_CURSOR_ADJUST) {
1045
1046 float co_2d_curr[2], co_2d_prev[2];
1047
1049 region, cursor_prev.location, co_2d_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
1051 region, cursor_curr->location, co_2d_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK))
1052 {
1053 rv3d->ofs_lock[0] += (co_2d_curr[0] - co_2d_prev[0]) / (region->winx * 0.5f);
1054 rv3d->ofs_lock[1] += (co_2d_curr[1] - co_2d_prev[1]) / (region->winy * 0.5f);
1055 }
1056 }
1057 else {
1058 /* Cursor may be outside of the view,
1059 * prevent it getting 'lost', see: #40353 & #45301 */
1060 zero_v2(rv3d->ofs_lock);
1061 }
1062 }
1063
1064 if (v3d->localvd) {
1066 }
1067 else {
1069 }
1070
1071 {
1072 wmMsgBus *mbus = CTX_wm_message_bus(C);
1073 wmMsgParams_RNA msg_key_params = {{}};
1074 msg_key_params.ptr = RNA_pointer_create_discrete(
1075 &scene->id, &RNA_View3DCursor, &scene->cursor);
1076 WM_msg_publish_rna_params(mbus, &msg_key_params);
1077 }
1078
1080}
1081
1083{
1084 bool use_depth = (U.uiflag & USER_DEPTH_CURSOR);
1085 {
1086 PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_depth");
1087 if (RNA_property_is_set(op->ptr, prop)) {
1088 use_depth = RNA_property_boolean_get(op->ptr, prop);
1089 }
1090 else {
1091 RNA_property_boolean_set(op->ptr, prop, use_depth);
1092 }
1093 }
1094 const enum eV3DCursorOrient orientation = eV3DCursorOrient(RNA_enum_get(op->ptr, "orientation"));
1095 ED_view3d_cursor3d_update(C, event->mval, use_depth, orientation);
1096
1097 /* Use pass-through to allow click-drag to transform the cursor. */
1099}
1100
1102{
1103
1104 /* identifiers */
1105 ot->name = "Set 3D Cursor";
1106 ot->description = "Set the location of the 3D cursor";
1107 ot->idname = "VIEW3D_OT_cursor3d";
1108
1109 /* API callbacks. */
1110 ot->invoke = view3d_cursor3d_invoke;
1111
1113
1114 /* flags */
1115 // ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1116
1117 PropertyRNA *prop;
1118 static const EnumPropertyItem orientation_items[] = {
1119 {V3D_CURSOR_ORIENT_NONE, "NONE", 0, "None", "Leave orientation unchanged"},
1120 {V3D_CURSOR_ORIENT_VIEW, "VIEW", 0, "View", "Orient to the viewport"},
1122 "XFORM",
1123 0,
1124 "Transform",
1125 "Orient to the current transform setting"},
1126 {V3D_CURSOR_ORIENT_GEOM, "GEOM", 0, "Geometry", "Match the surface normal"},
1127 {0, nullptr, 0, nullptr, nullptr},
1128 };
1129
1130 prop = RNA_def_boolean(
1131 ot->srna, "use_depth", true, "Surface Project", "Project onto the surface");
1133
1134 prop = RNA_def_enum(ot->srna,
1135 "orientation",
1136 orientation_items,
1138 "Orientation",
1139 "Preset viewpoint to use");
1141}
1142
1144
1145/* -------------------------------------------------------------------- */
1148
1150 {OB_WIRE, "WIREFRAME", 0, "Wireframe", "Toggle wireframe shading"},
1151 {OB_SOLID, "SOLID", 0, "Solid", "Toggle solid shading"},
1152 {OB_MATERIAL, "MATERIAL", 0, "Material Preview", "Toggle material preview shading"},
1153 {OB_RENDER, "RENDERED", 0, "Rendered", "Toggle rendered shading"},
1154 {0, nullptr, 0, nullptr, nullptr},
1155};
1156
1158{
1159 Main *bmain = CTX_data_main(C);
1160 View3D *v3d = CTX_wm_view3d(C);
1161 ScrArea *area = CTX_wm_area(C);
1162 int type = RNA_enum_get(op->ptr, "type");
1163
1164 if (type == OB_SOLID) {
1165 if (v3d->shading.type != type) {
1166 v3d->shading.type = type;
1167 }
1168 else if (v3d->shading.type == OB_WIRE) {
1169 v3d->shading.type = OB_SOLID;
1170 }
1171 else {
1172 v3d->shading.type = OB_WIRE;
1173 }
1174 }
1175 else {
1176 char *prev_type = ((type == OB_WIRE) ? &v3d->shading.prev_type_wire : &v3d->shading.prev_type);
1177 if (v3d->shading.type == type) {
1178 if (*prev_type == type || !ELEM(*prev_type, OB_WIRE, OB_SOLID, OB_MATERIAL, OB_RENDER)) {
1179 *prev_type = OB_SOLID;
1180 }
1181 v3d->shading.type = *prev_type;
1182 }
1183 else {
1184 *prev_type = v3d->shading.type;
1185 v3d->shading.type = type;
1186 }
1187 }
1188
1189 ED_view3d_shade_update(bmain, v3d, area);
1191
1192 return OPERATOR_FINISHED;
1193}
1194
1196{
1197 PropertyRNA *prop;
1198
1199 /* identifiers */
1200 ot->name = "Toggle Shading Type";
1201 ot->description = "Toggle shading type in 3D viewport";
1202 ot->idname = "VIEW3D_OT_toggle_shading";
1203
1204 /* API callbacks. */
1205 ot->exec = toggle_shading_exec;
1207
1208 prop = RNA_def_enum(
1209 ot->srna, "type", prop_shading_type_items, 0, "Type", "Shading type to toggle");
1211}
1212
1214
1215/* -------------------------------------------------------------------- */
1218
1220{
1221 View3D *v3d = CTX_wm_view3d(C);
1222 ScrArea *area = CTX_wm_area(C);
1224
1225 if (obact && ((obact->mode & OB_MODE_POSE) ||
1227 {
1229 }
1230 else {
1231 const bool xray_active = ((obact && (obact->mode & OB_MODE_EDIT)) ||
1232 ELEM(v3d->shading.type, OB_WIRE, OB_SOLID));
1233
1234 if (v3d->shading.type == OB_WIRE) {
1236 }
1237 else {
1239 }
1240 if (!xray_active) {
1241 BKE_report(op->reports, RPT_INFO, "X-Ray not available in current mode");
1242 }
1243 }
1244
1245 ED_area_tag_redraw(area);
1247
1248 return OPERATOR_FINISHED;
1249}
1250
1252{
1253 /* identifiers */
1254 ot->name = "Toggle X-Ray";
1255 ot->idname = "VIEW3D_OT_toggle_xray";
1256 ot->description = "Transparent scene display. Allow selecting through items";
1257
1258 /* API callbacks. */
1259 ot->exec = toggle_xray_exec;
1261}
1262
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_active_if_bonecoll_visible(Object *ob) ATTR_WARN_UNUSED_RESULT
Camera data-block and utility functions.
struct CameraBGImage * BKE_camera_background_image_new(struct Camera *cam)
void BKE_camera_background_image_remove(struct Camera *cam, struct CameraBGImage *bgpic)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
void id_us_plus(ID *id)
Definition lib_id.cc:358
void id_us_min(ID *id)
Definition lib_id.cc:366
General operations, lookup, etc. for blender objects.
Object * BKE_object_pose_armature_get(Object *ob)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ RPT_INFO
Definition BKE_report.hh:35
@ RPT_WARNING
Definition BKE_report.hh:38
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
Definition scene.cc:2915
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
Definition screen.cc:1044
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:534
MINLINE float min_ff(float a, float b)
MINLINE int axis_dominant_v3_ortho_single(const float vec[3])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool is_negative_m4(const float mat[4][4])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
float angle_normalized_qt(const float q[4])
void quat_to_mat3(float m[3][3], const float q[4])
void mat3_to_quat(float q[4], const float mat[3][3])
void mul_qt_v3(const float q[4], float r[3])
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
void copy_qt_qt(float q[4], const float a[4])
void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
MINLINE bool equals_v4v4(const float v1[4], const float v2[4]) ATTR_WARN_UNUSED_RESULT
MINLINE void negate_v3(float r[3])
MINLINE void zero_v2(float r[2])
MINLINE float normalize_v3(float n[3])
#define FILE_MAX
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition BLI_rect.h:202
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition BLI_rect.h:206
#define STRNCPY_UTF8(dst, src)
#define CLAMP(a, b, c)
#define ELEM(...)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition DNA_ID.h:730
@ ID_IM
@ ID_WO
@ ROT_MODE_AXISANGLE
@ CAM_SHOW_BG_IMAGE
@ CAM_BGIMG_FLAG_OVERRIDE_LIBRARY_LOCAL
@ OB_WIRE
@ OB_SOLID
@ OB_RENDER
@ OB_MATERIAL
@ OB_MODE_EDIT
@ OB_MODE_WEIGHT_PAINT
@ OB_MODE_POSE
@ OB_CAMERA
@ OB_ARMATURE
@ R_BORDER
@ SCE_SNAP_TARGET_ALL
@ SCE_SNAP_TO_FACE
eViewNavigation_Method
@ VIEW_NAVIGATION_FLY
@ VIEW_NAVIGATION_WALK
@ USER_DEPTH_CURSOR
@ USER_LOCK_CURSOR_ADJUST
@ V3D_RENDER_BORDER
#define RV3D_VIEW_IS_AXIS(view)
@ V3D_SHADING_XRAY_WIREFRAME
@ V3D_SHADING_XRAY
#define RV3D_CAMZOOM_MAX
#define RV3D_LOCK_FLAGS(rv3d)
@ RV3D_WAS_CAMOB
@ RV3D_CLIPPING
@ RV3D_CAMOB
@ RV3D_PERSP
@ RV3D_ORTHO
#define RV3D_CAMZOOM_MIN
@ RV3D_LOCK_ANY_TRANSFORM
@ V3D_OVERLAY_BONE_SELECT
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_PASS_THROUGH
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:693
bool ED_operator_scene_editable(bContext *C)
bool ED_operator_view3d_active(bContext *C)
bool ED_operator_region_view3d_active(bContext *C)
bool ED_operator_camera_poll(bContext *C)
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:618
void ED_undo_push(bContext *C, const char *str)
Definition ed_undo.cc:98
void ED_view3d_calc_camera_border_size(const Scene *scene, Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const RegionView3D *rv3d, float r_size[2])
void ED_view3d_clipping_calc_from_boundbox(float clip[4][4], const BoundBox *bb, bool is_flip)
RegionView3D * ED_view3d_context_rv3d(bContext *C)
void ED_view3d_clipping_calc(BoundBox *bb, float planes[4][4], const ARegion *region, const Object *ob, const rcti *rect)
@ V3D_PROJ_TEST_NOP
Definition ED_view3d.hh:279
void ED_view3d_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, bool use_overlay, ViewDepths **r_depths)
void ED_view3d_win_to_3d_int(const View3D *v3d, const ARegion *region, const float depth_pt[3], const int mval[2], float r_out[3])
bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_region)
bool ED_view3d_offset_lock_check(const View3D *v3d, const RegionView3D *rv3d)
@ V3D_PROJ_RET_OK
Definition ED_view3d.hh:256
bool ED_view3d_autodist(ARegion *region, View3D *v3d, const int mval[2], float mouse_worldloc[3], const float fallback_depth_pt[3])
void ED_view3d_lock_clear(View3D *v3d)
float ED_view3d_calc_zfac_ex(const RegionView3D *rv3d, const float co[3], bool *r_flip)
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3])
@ V3D_DEPTH_ALL
Definition ED_view3d.hh:190
eV3DCursorOrient
Definition ED_view3d.hh:94
@ V3D_CURSOR_ORIENT_XFORM
Definition ED_view3d.hh:97
@ V3D_CURSOR_ORIENT_GEOM
Definition ED_view3d.hh:98
@ V3D_CURSOR_ORIENT_VIEW
Definition ED_view3d.hh:96
@ V3D_CURSOR_ORIENT_NONE
Definition ED_view3d.hh:95
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)
void view3d_operator_needs_gpu(const bContext *C)
void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *area)
bool ED_operator_rv3d_user_region_poll(bContext *C)
eV3DProjStatus ED_view3d_project_float_global(const ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
Definition RNA_types.hh:456
@ PROP_SKIP_SAVE
Definition RNA_types.hh:344
@ PROP_HIDDEN
Definition RNA_types.hh:338
@ PROP_FILEPATH
Definition RNA_types.hh:236
#define C
Definition RandGen.cpp:29
#define ND_WORLD
Definition WM_types.hh:452
#define ND_RENDER_OPTIONS
Definition WM_types.hh:435
#define NC_SCENE
Definition WM_types.hh:378
@ OPTYPE_INTERNAL
Definition WM_types.hh:202
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
#define NA_EDITED
Definition WM_types.hh:584
#define NC_CAMERA
Definition WM_types.hh:401
#define ND_SPACE_VIEW3D
Definition WM_types.hh:528
#define NS_VIEW3D_SHADING
Definition WM_types.hh:577
#define NC_SPACE
Definition WM_types.hh:392
#define ND_DRAW_RENDER_VIEWPORT
Definition WM_types.hh:470
#define U
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
nullptr float
static wmOperatorStatus render_border_exec(bContext *C, wmOperator *op)
static wmOperatorStatus clear_render_border_exec(bContext *C, wmOperator *)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
eSnapMode snap_object_project_view3d_ex(SnapObjectContext *sctx, Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const eSnapMode snap_to, const SnapObjectParams *params, const float init_co[3], const float mval[2], const float prev_co[3], float *dist_px, float r_loc[3], float r_no[3], int *r_index, const Object **r_ob, float r_obmat[4][4], float r_face_nor[3])
void snap_object_context_destroy(SnapObjectContext *sctx)
SnapObjectContext * snap_object_context_create(Scene *scene, int flag)
void calc_orientation_from_type(const bContext *C, float r_mat[3][3])
QuaternionBase< float > Quaternion
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
int RNA_int_get(PointerRNA *ptr, const char *name)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void * regiondata
float vec[8][3]
struct MovieClip * clip
struct Image * ima
struct ListBase bg_images
char name[64]
Definition DNA_ID.h:414
char name[258]
Definition DNA_ID.h:432
void * data
Definition RNA_types.hh:53
float clip[6][4]
float clip_local[6][4]
struct BoundBox * clipbb
struct RenderData r
View3DCursor cursor
struct World * world
float rotation_axis[3]
View3DOverlay overlay
rctf render_border
struct Object * camera
struct View3D * localvd
char ob_center_bone[64]
short ob_center_cursor
struct Object * ob_center
View3DShading shading
float xmax
float xmin
float ymax
float ymin
int ymin
int ymax
int xmin
int xmax
int mval[2]
Definition WM_types.hh:763
const char * name
Definition WM_types.hh:1033
struct ReportList * reports
struct wmOperatorType * type
struct PointerRNA * ptr
i
Definition text_draw.cc:230
void ED_view3d_cursor3d_update(bContext *C, const int mval[2], const bool use_depth, enum eV3DCursorOrient orientation)
static wmOperatorStatus toggle_xray_exec(bContext *C, wmOperator *op)
static wmOperatorStatus camera_background_image_add_exec(bContext *C, wmOperator *op)
static wmOperatorStatus view3d_clipping_exec(bContext *C, wmOperator *op)
static wmOperatorStatus view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *)
void VIEW3D_OT_view_persportho(wmOperatorType *ot)
static wmOperatorStatus view3d_center_lock_exec(bContext *C, wmOperator *)
static const EnumPropertyItem prop_shading_type_items[]
static bool view3d_camera_user_poll(bContext *C)
static wmOperatorStatus toggle_shading_exec(bContext *C, wmOperator *op)
void ED_view3d_cursor3d_position_rotation(bContext *C, const int mval[2], const bool use_depth, enum eV3DCursorOrient orientation, float r_cursor_co[3], float r_cursor_quat[4])
void VIEW3D_OT_toggle_xray(wmOperatorType *ot)
static wmOperatorStatus view3d_center_camera_exec(bContext *C, wmOperator *)
void VIEW3D_OT_view_center_camera(wmOperatorType *ot)
static bool camera_background_image_add_poll(bContext *C)
void VIEW3D_OT_view_center_lock(wmOperatorType *ot)
void VIEW3D_OT_zoom_camera_1_to_1(wmOperatorType *ot)
void VIEW3D_OT_clip_border(wmOperatorType *ot)
static wmOperatorStatus clear_render_border_exec(bContext *C, wmOperator *op)
static wmOperatorStatus viewpersportho_exec(bContext *C, wmOperator *)
void VIEW3D_OT_view_lock_to_active(wmOperatorType *ot)
static wmOperatorStatus drop_world_exec(bContext *C, wmOperator *op)
static void view3d_set_1_to_1_viewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, View3D *v3d)
void VIEW3D_OT_cursor3d(wmOperatorType *ot)
static wmOperatorStatus view3d_navigate_invoke(bContext *C, wmOperator *, const wmEvent *event)
void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
void VIEW3D_OT_clear_render_border(wmOperatorType *ot)
void VIEW3D_OT_view_lock_clear(wmOperatorType *ot)
static wmOperatorStatus view_lock_clear_exec(bContext *C, wmOperator *)
static wmOperatorStatus camera_background_image_remove_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_navigate(wmOperatorType *ot)
static wmOperatorStatus render_border_exec(bContext *C, wmOperator *op)
static void calc_local_clipping(float clip_local[6][4], const BoundBox *clipbb, const float mat[4][4])
static wmOperatorStatus view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static Camera * background_image_camera_from_context(bContext *C)
void VIEW3D_OT_camera_background_image_remove(wmOperatorType *ot)
void ED_view3d_cursor3d_position(bContext *C, const int mval[2], const bool use_depth, float r_cursor_co[3])
void VIEW3D_OT_render_border(wmOperatorType *ot)
static bool drop_world_poll(bContext *C)
static bool view3d_lock_poll(bContext *C)
void VIEW3D_OT_toggle_shading(wmOperatorType *ot)
static wmOperatorStatus view_lock_to_active_exec(bContext *C, wmOperator *)
void VIEW3D_OT_drop_world(wmOperatorType *ot)
static wmOperatorStatus view3d_cursor3d_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void VIEW3D_OT_camera_background_image_add(wmOperatorType *ot)
void ED_view3d_smooth_view_force_finish(bContext *C, View3D *v3d, ARegion *region)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, blender::wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
wmOperatorType * ot
Definition wm_files.cc:4237
void WM_gesture_box_cancel(bContext *C, wmOperator *op)
wmOperatorStatus WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_msg_publish_rna_params(wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params)
void WM_operator_properties_border_to_rcti(wmOperator *op, rcti *r_rect)
ID * WM_operator_properties_id_lookup_from_name_or_session_uid(Main *bmain, PointerRNA *ptr, const ID_Type type)
void WM_operator_properties_border(wmOperatorType *ot)
void WM_operator_properties_id_lookup(wmOperatorType *ot, const bool add_name_prop)
ID * WM_operator_drop_load_path(bContext *C, wmOperator *op, const short idcode)