Blender V4.5
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.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(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(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 ED_region_tag_redraw(region);
502 }
503
504 return OPERATOR_FINISHED;
505}
506
508{
509 /* identifiers */
510 ot->name = "View Perspective/Orthographic";
511 ot->description = "Switch the current view from perspective/orthographic projection";
512 ot->idname = "VIEW3D_OT_view_persportho";
513
514 /* API callbacks. */
515 ot->exec = viewpersportho_exec;
517
518 /* flags */
519 ot->flag = 0;
520}
521
523
524/* -------------------------------------------------------------------- */
529
531 wmOperator * /*op*/,
532 const wmEvent *event)
533{
534 eViewNavigation_Method mode = eViewNavigation_Method(U.navigation_mode);
535
536 switch (mode) {
538 WM_operator_name_call(C, "VIEW3D_OT_fly", WM_OP_INVOKE_DEFAULT, nullptr, event);
539 break;
541 default:
542 WM_operator_name_call(C, "VIEW3D_OT_walk", WM_OP_INVOKE_DEFAULT, nullptr, event);
543 break;
544 }
545
546 return OPERATOR_FINISHED;
547}
548
550{
551 /* identifiers */
552 ot->name = "View Navigation (Walk/Fly)";
553 ot->description =
554 "Interactively navigate around the scene (uses the mode (walk/fly) preference)";
555 ot->idname = "VIEW3D_OT_navigate";
556
557 /* API callbacks. */
558 ot->invoke = view3d_navigate_invoke;
560}
561
563
564/* -------------------------------------------------------------------- */
567
569{
570 /* Needed to support drag-and-drop & camera buttons context. */
571 View3D *v3d = CTX_wm_view3d(C);
572 if (v3d != nullptr) {
573 if (v3d->camera && v3d->camera->data && v3d->camera->type == OB_CAMERA) {
574 return static_cast<Camera *>(v3d->camera->data);
575 }
576 return nullptr;
577 }
578
579 return static_cast<Camera *>(CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data);
580}
581
583{
585 Image *ima;
586 CameraBGImage *bgpic;
587
589 /* may be nullptr, continue anyway */
590
592 bgpic->ima = ima;
593
594 cam->flag |= CAM_SHOW_BG_IMAGE;
595
598
599 return OPERATOR_FINISHED;
600}
601
606
608{
609 /* identifiers */
610 ot->name = "Add Camera Background Image";
611 ot->description = "Add a new background image to the active camera";
612 ot->idname = "VIEW3D_OT_camera_background_image_add";
613
614 /* API callbacks. */
617
618 /* flags */
620
621 /* properties */
623 ot->srna, "filepath", nullptr, FILE_MAX, "Filepath", "Path to image file");
626 prop = RNA_def_boolean(ot->srna,
627 "relative_path",
628 true,
629 "Relative Path",
630 "Select the file relative to the blend file");
632
634}
635
637
638/* -------------------------------------------------------------------- */
641
643{
644 Camera *cam = static_cast<Camera *>(CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data);
645 const int index = RNA_int_get(op->ptr, "index");
646 CameraBGImage *bgpic_rem = static_cast<CameraBGImage *>(BLI_findlink(&cam->bg_images, index));
647
648 if (bgpic_rem) {
649 if (ID_IS_OVERRIDE_LIBRARY(cam) &&
651 {
654 "Cannot remove background image %d from camera '%s', as it is from the linked "
655 "reference data",
656 index,
657 cam->id.name + 2);
658 return OPERATOR_CANCELLED;
659 }
660
661 id_us_min((ID *)bgpic_rem->ima);
662 id_us_min((ID *)bgpic_rem->clip);
663
665
668
669 return OPERATOR_FINISHED;
670 }
671 return OPERATOR_CANCELLED;
672}
673
675{
676 /* identifiers */
677 ot->name = "Remove Camera Background Image";
678 ot->description = "Remove a background image from the camera";
679 ot->idname = "VIEW3D_OT_camera_background_image_remove";
680
681 /* API callbacks. */
684
685 /* flags */
686 ot->flag = 0;
687
688 /* properties */
690 ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove", 0, INT_MAX);
691}
692
694
695/* -------------------------------------------------------------------- */
698
700{
701 Main *bmain = CTX_data_main(C);
702 Scene *scene = CTX_data_scene(C);
703
705 bmain, op->ptr, ID_WO);
706 if (world == nullptr) {
707 return OPERATOR_CANCELLED;
708 }
709
710 id_us_min((ID *)scene->world);
711 id_us_plus(&world->id);
712 scene->world = world;
713
716
718
719 return OPERATOR_FINISHED;
720}
721
723{
725}
726
728{
729 /* identifiers */
730 ot->name = "Drop World";
731 ot->description = "Drop a world into the scene";
732 ot->idname = "VIEW3D_OT_drop_world";
733
734 /* API callbacks. */
735 ot->exec = drop_world_exec;
736 ot->poll = drop_world_poll;
737
738 /* flags */
740
741 /* properties */
743}
744
746
747/* -------------------------------------------------------------------- */
752
753static void calc_local_clipping(float clip_local[6][4],
754 const BoundBox *clipbb,
755 const float mat[4][4])
756{
757 BoundBox clipbb_local;
758 float imat[4][4];
759
760 invert_m4_m4(imat, mat);
761
762 for (int i = 0; i < 8; i++) {
763 mul_v3_m4v3(clipbb_local.vec[i], imat, clipbb->vec[i]);
764 }
765
766 ED_view3d_clipping_calc_from_boundbox(clip_local, &clipbb_local, is_negative_m4(mat));
767}
768
769void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
770{
771 if (rv3d->rflag & RV3D_CLIPPING) {
772 calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);
773 }
774}
775
777{
778 ARegion *region = CTX_wm_region(C);
780 rcti rect;
781
783
784 rv3d->rflag |= RV3D_CLIPPING;
785 rv3d->clipbb = MEM_callocN<BoundBox>("clipbb");
786
787 /* nullptr object because we don't want it in object space */
788 ED_view3d_clipping_calc(rv3d->clipbb, rv3d->clip, region, nullptr, &rect);
789
790 return OPERATOR_FINISHED;
791}
792
794{
796 ARegion *region = CTX_wm_region(C);
797
798 if (rv3d->rflag & RV3D_CLIPPING) {
799 rv3d->rflag &= ~RV3D_CLIPPING;
800 ED_region_tag_redraw(region);
801 MEM_SAFE_FREE(rv3d->clipbb);
802 return OPERATOR_FINISHED;
803 }
804 return WM_gesture_box_invoke(C, op, event);
805}
806
808{
809
810 /* identifiers */
811 ot->name = "Clipping Region";
812 ot->description = "Set the view clipping region";
813 ot->idname = "VIEW3D_OT_clip_border";
814
815 /* API callbacks. */
816 ot->invoke = view3d_clipping_invoke;
817 ot->exec = view3d_clipping_exec;
818 ot->modal = WM_gesture_box_modal;
819 ot->cancel = WM_gesture_box_cancel;
820
822
823 /* flags */
824 ot->flag = 0;
825
826 /* properties */
828}
829
831
832/* -------------------------------------------------------------------- */
835
837 const int mval[2],
838 const bool use_depth,
839 float r_cursor_co[3])
840{
841 ARegion *region = CTX_wm_region(C);
842 View3D *v3d = CTX_wm_view3d(C);
843 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
844 bool flip;
845 bool depth_used = false;
846
847 /* normally the caller should ensure this,
848 * but this is called from areas that aren't already dealing with the viewport */
849 if (rv3d == nullptr) {
850 return;
851 }
852
853 ED_view3d_calc_zfac_ex(rv3d, r_cursor_co, &flip);
854
855 /* Reset the depth based on the view offset (we _know_ the offset is in front of us). */
856 if (flip) {
857 negate_v3_v3(r_cursor_co, rv3d->ofs);
858 /* re initialize, no need to check flip again */
859 ED_view3d_calc_zfac(rv3d, r_cursor_co);
860 }
861
862 if (use_depth) { /* maybe this should be accessed some other way */
864
866
867 /* Ensure the depth buffer is updated for #ED_view3d_autodist. */
868 ED_view3d_depth_override(depsgraph, region, v3d, nullptr, V3D_DEPTH_ALL, false, nullptr);
869
870 if (ED_view3d_autodist(region, v3d, mval, r_cursor_co, nullptr)) {
871 depth_used = true;
872 }
873 }
874
875 if (depth_used == false) {
876 float depth_pt[3];
877 copy_v3_v3(depth_pt, r_cursor_co);
878 ED_view3d_win_to_3d_int(v3d, region, depth_pt, mval, r_cursor_co);
879 }
880}
881
883 const int mval[2],
884 const bool use_depth,
885 enum eV3DCursorOrient orientation,
886 float r_cursor_co[3],
887 float r_cursor_quat[4])
888{
889 Scene *scene = CTX_data_scene(C);
890 View3D *v3d = CTX_wm_view3d(C);
891 ARegion *region = CTX_wm_region(C);
892 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
893
894 /* XXX, caller should check. */
895 if (rv3d == nullptr) {
896 return;
897 }
898
899 ED_view3d_cursor3d_position(C, mval, use_depth, r_cursor_co);
900
901 if (orientation == V3D_CURSOR_ORIENT_NONE) {
902 /* pass */
903 }
904 else if (orientation == V3D_CURSOR_ORIENT_VIEW) {
905 copy_qt_qt(r_cursor_quat, rv3d->viewquat);
906 r_cursor_quat[0] *= -1.0f;
907 }
908 else if (orientation == V3D_CURSOR_ORIENT_XFORM) {
909 float mat[3][3];
911 mat3_to_quat(r_cursor_quat, mat);
912 }
913 else if (orientation == V3D_CURSOR_ORIENT_GEOM) {
914 copy_qt_qt(r_cursor_quat, rv3d->viewquat);
915 r_cursor_quat[0] *= -1.0f;
916
917 const float mval_fl[2] = {float(mval[0]), float(mval[1])};
918 float ray_no[3];
919 float ray_co[3];
920
923
924 float obmat[4][4];
925 const Object *ob_dummy = nullptr;
926 float dist_px = 0;
928 params.snap_target_select = SCE_SNAP_TARGET_ALL;
932 snap_context,
934 region,
935 v3d,
937 &params,
938 nullptr,
939 mval_fl,
940 nullptr,
941 &dist_px,
942 ray_co,
943 ray_no,
944 nullptr,
945 &ob_dummy,
946 obmat,
947 nullptr) != 0)
948 {
949 if (use_depth) {
950 copy_v3_v3(r_cursor_co, ray_co);
951 }
952
953 /* Math normal (Z). */
954 {
955 float tquat[4];
956 float z_src[3] = {0, 0, 1};
957 mul_qt_v3(r_cursor_quat, z_src);
958 rotation_between_vecs_to_quat(tquat, z_src, ray_no);
959 mul_qt_qtqt(r_cursor_quat, tquat, r_cursor_quat);
960 }
961
962 /* Match object matrix (X). */
963 {
964 const float ortho_axis_dot[3] = {
965 dot_v3v3(ray_no, obmat[0]),
966 dot_v3v3(ray_no, obmat[1]),
967 dot_v3v3(ray_no, obmat[2]),
968 };
969 const int ortho_axis = axis_dominant_v3_ortho_single(ortho_axis_dot);
970
971 float tquat_best[4];
972 float angle_best = -1.0f;
973
974 float tan_dst[3];
975 project_plane_v3_v3v3(tan_dst, obmat[ortho_axis], ray_no);
976 normalize_v3(tan_dst);
977
978 /* As the tangent is arbitrary from the users point of view,
979 * make the cursor 'roll' on the shortest angle.
980 * otherwise this can cause noticeable 'flipping', see #72419. */
981 for (int axis = 0; axis < 2; axis++) {
982 float tan_src[3] = {0, 0, 0};
983 tan_src[axis] = 1.0f;
984 mul_qt_v3(r_cursor_quat, tan_src);
985
986 for (int axis_sign = 0; axis_sign < 2; axis_sign++) {
987 float tquat_test[4];
988 rotation_between_vecs_to_quat(tquat_test, tan_src, tan_dst);
989 const float angle_test = angle_normalized_qt(tquat_test);
990 if (angle_test < angle_best || angle_best == -1.0f) {
991 angle_best = angle_test;
992 copy_qt_qt(tquat_best, tquat_test);
993 }
994 negate_v3(tan_src);
995 }
996 }
997 mul_qt_qtqt(r_cursor_quat, tquat_best, r_cursor_quat);
998 }
999 }
1001 }
1002}
1003
1005 const int mval[2],
1006 const bool use_depth,
1007 enum eV3DCursorOrient orientation)
1008{
1009 Scene *scene = CTX_data_scene(C);
1010 View3D *v3d = CTX_wm_view3d(C);
1011 ARegion *region = CTX_wm_region(C);
1012 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
1013
1014 View3DCursor *cursor_curr = &scene->cursor;
1015 View3DCursor cursor_prev = *cursor_curr;
1016
1017 {
1018 blender::math::Quaternion quat, quat_prev;
1019 quat = cursor_curr->rotation();
1020 copy_qt_qt(&quat_prev.w, &quat.w);
1022 C, mval, use_depth, orientation, cursor_curr->location, &quat.w);
1023
1024 if (!equals_v4v4(&quat_prev.w, &quat.w)) {
1025 if ((cursor_curr->rotation_mode == ROT_MODE_AXISANGLE) && RV3D_VIEW_IS_AXIS(rv3d->view)) {
1026 float tmat[3][3], cmat[3][3];
1027 quat_to_mat3(tmat, &quat.w);
1028 negate_v3_v3(cursor_curr->rotation_axis, tmat[2]);
1029 axis_angle_to_mat3(cmat, cursor_curr->rotation_axis, 0.0f);
1031 cmat[0], tmat[0], cursor_curr->rotation_axis);
1032 }
1033 else {
1034 cursor_curr->set_rotation(quat, true);
1035 }
1036 }
1037 }
1038
1039 /* offset the cursor lock to avoid jumping to new offset */
1040 if (v3d->ob_center_cursor) {
1041 if (U.uiflag & USER_LOCK_CURSOR_ADJUST) {
1042
1043 float co_2d_curr[2], co_2d_prev[2];
1044
1046 region, cursor_prev.location, co_2d_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
1048 region, cursor_curr->location, co_2d_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK))
1049 {
1050 rv3d->ofs_lock[0] += (co_2d_curr[0] - co_2d_prev[0]) / (region->winx * 0.5f);
1051 rv3d->ofs_lock[1] += (co_2d_curr[1] - co_2d_prev[1]) / (region->winy * 0.5f);
1052 }
1053 }
1054 else {
1055 /* Cursor may be outside of the view,
1056 * prevent it getting 'lost', see: #40353 & #45301 */
1057 zero_v2(rv3d->ofs_lock);
1058 }
1059 }
1060
1061 if (v3d->localvd) {
1063 }
1064 else {
1066 }
1067
1068 {
1069 wmMsgBus *mbus = CTX_wm_message_bus(C);
1070 wmMsgParams_RNA msg_key_params = {{}};
1071 msg_key_params.ptr = RNA_pointer_create_discrete(
1072 &scene->id, &RNA_View3DCursor, &scene->cursor);
1073 WM_msg_publish_rna_params(mbus, &msg_key_params);
1074 }
1075
1077}
1078
1080{
1081 bool use_depth = (U.uiflag & USER_DEPTH_CURSOR);
1082 {
1083 PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_depth");
1084 if (RNA_property_is_set(op->ptr, prop)) {
1085 use_depth = RNA_property_boolean_get(op->ptr, prop);
1086 }
1087 else {
1088 RNA_property_boolean_set(op->ptr, prop, use_depth);
1089 }
1090 }
1091 const enum eV3DCursorOrient orientation = eV3DCursorOrient(RNA_enum_get(op->ptr, "orientation"));
1092 ED_view3d_cursor3d_update(C, event->mval, use_depth, orientation);
1093
1094 /* Use pass-through to allow click-drag to transform the cursor. */
1096}
1097
1099{
1100
1101 /* identifiers */
1102 ot->name = "Set 3D Cursor";
1103 ot->description = "Set the location of the 3D cursor";
1104 ot->idname = "VIEW3D_OT_cursor3d";
1105
1106 /* API callbacks. */
1107 ot->invoke = view3d_cursor3d_invoke;
1108
1110
1111 /* flags */
1112 // ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1113
1114 PropertyRNA *prop;
1115 static const EnumPropertyItem orientation_items[] = {
1116 {V3D_CURSOR_ORIENT_NONE, "NONE", 0, "None", "Leave orientation unchanged"},
1117 {V3D_CURSOR_ORIENT_VIEW, "VIEW", 0, "View", "Orient to the viewport"},
1119 "XFORM",
1120 0,
1121 "Transform",
1122 "Orient to the current transform setting"},
1123 {V3D_CURSOR_ORIENT_GEOM, "GEOM", 0, "Geometry", "Match the surface normal"},
1124 {0, nullptr, 0, nullptr, nullptr},
1125 };
1126
1127 prop = RNA_def_boolean(
1128 ot->srna, "use_depth", true, "Surface Project", "Project onto the surface");
1130
1131 prop = RNA_def_enum(ot->srna,
1132 "orientation",
1133 orientation_items,
1135 "Orientation",
1136 "Preset viewpoint to use");
1138}
1139
1141
1142/* -------------------------------------------------------------------- */
1145
1147 {OB_WIRE, "WIREFRAME", 0, "Wireframe", "Toggle wireframe shading"},
1148 {OB_SOLID, "SOLID", 0, "Solid", "Toggle solid shading"},
1149 {OB_MATERIAL, "MATERIAL", 0, "Material Preview", "Toggle material preview shading"},
1150 {OB_RENDER, "RENDERED", 0, "Rendered", "Toggle rendered shading"},
1151 {0, nullptr, 0, nullptr, nullptr},
1152};
1153
1155{
1156 Main *bmain = CTX_data_main(C);
1157 View3D *v3d = CTX_wm_view3d(C);
1158 ScrArea *area = CTX_wm_area(C);
1159 int type = RNA_enum_get(op->ptr, "type");
1160
1161 if (type == OB_SOLID) {
1162 if (v3d->shading.type != type) {
1163 v3d->shading.type = type;
1164 }
1165 else if (v3d->shading.type == OB_WIRE) {
1166 v3d->shading.type = OB_SOLID;
1167 }
1168 else {
1169 v3d->shading.type = OB_WIRE;
1170 }
1171 }
1172 else {
1173 char *prev_type = ((type == OB_WIRE) ? &v3d->shading.prev_type_wire : &v3d->shading.prev_type);
1174 if (v3d->shading.type == type) {
1175 if (*prev_type == type || !ELEM(*prev_type, OB_WIRE, OB_SOLID, OB_MATERIAL, OB_RENDER)) {
1176 *prev_type = OB_SOLID;
1177 }
1178 v3d->shading.type = *prev_type;
1179 }
1180 else {
1181 *prev_type = v3d->shading.type;
1182 v3d->shading.type = type;
1183 }
1184 }
1185
1186 ED_view3d_shade_update(bmain, v3d, area);
1188
1189 return OPERATOR_FINISHED;
1190}
1191
1193{
1194 PropertyRNA *prop;
1195
1196 /* identifiers */
1197 ot->name = "Toggle Shading Type";
1198 ot->description = "Toggle shading type in 3D viewport";
1199 ot->idname = "VIEW3D_OT_toggle_shading";
1200
1201 /* API callbacks. */
1202 ot->exec = toggle_shading_exec;
1204
1205 prop = RNA_def_enum(
1206 ot->srna, "type", prop_shading_type_items, 0, "Type", "Shading type to toggle");
1208}
1209
1211
1212/* -------------------------------------------------------------------- */
1215
1217{
1218 View3D *v3d = CTX_wm_view3d(C);
1219 ScrArea *area = CTX_wm_area(C);
1221
1222 if (obact && ((obact->mode & OB_MODE_POSE) ||
1224 {
1226 }
1227 else {
1228 const bool xray_active = ((obact && (obact->mode & OB_MODE_EDIT)) ||
1229 ELEM(v3d->shading.type, OB_WIRE, OB_SOLID));
1230
1231 if (v3d->shading.type == OB_WIRE) {
1233 }
1234 else {
1236 }
1237 if (!xray_active) {
1238 BKE_report(op->reports, RPT_INFO, "X-Ray not available in current mode");
1239 }
1240 }
1241
1242 ED_area_tag_redraw(area);
1244
1245 return OPERATOR_FINISHED;
1246}
1247
1249{
1250 /* identifiers */
1251 ot->name = "Toggle X-Ray";
1252 ot->idname = "VIEW3D_OT_toggle_xray";
1253 ot->description = "Transparent scene display. Allow selecting through items";
1254
1255 /* API callbacks. */
1256 ot->exec = toggle_xray_exec;
1258}
1259
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:353
void id_us_min(ID *id)
Definition lib_id.cc:361
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
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
Definition scene.cc:2927
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
Definition screen.cc:1038
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
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:688
#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:1026
@ ID_IM
@ ID_WO
@ ROT_MODE_AXISANGLE
@ CAM_BGIMG_FLAG_OVERRIDE_LIBRARY_LOCAL
@ CAM_SHOW_BG_IMAGE
@ 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
#define RV3D_VIEW_IS_AXIS(view)
#define RV3D_CAMZOOM_MAX
@ RV3D_LOCK_ANY_TRANSFORM
#define RV3D_LOCK_FLAGS(rv3d)
@ V3D_RENDER_BORDER
@ RV3D_CAMOB
@ RV3D_PERSP
@ RV3D_ORTHO
@ V3D_SHADING_XRAY_WIREFRAME
@ V3D_SHADING_XRAY
@ RV3D_CLIPPING
@ V3D_OVERLAY_BONE_SELECT
#define RV3D_CAMZOOM_MIN
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_PASS_THROUGH
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:714
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:639
void ED_undo_push(bContext *C, const char *str)
Definition ed_undo.cc:99
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.
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
Definition RNA_types.hh:430
@ PROP_SKIP_SAVE
Definition RNA_types.hh:330
@ PROP_HIDDEN
Definition RNA_types.hh:324
@ PROP_FILEPATH
Definition RNA_types.hh:224
#define C
Definition RandGen.cpp:29
#define ND_WORLD
Definition WM_types.hh:449
#define ND_RENDER_OPTIONS
Definition WM_types.hh:432
#define NC_SCENE
Definition WM_types.hh:375
#define NA_EDITED
Definition WM_types.hh:581
#define NC_CAMERA
Definition WM_types.hh:398
@ WM_OP_INVOKE_DEFAULT
Definition WM_types.hh:238
#define ND_SPACE_VIEW3D
Definition WM_types.hh:525
#define NS_VIEW3D_SHADING
Definition WM_types.hh:574
@ OPTYPE_INTERNAL
Definition WM_types.hh:202
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
#define NC_SPACE
Definition WM_types.hh:389
#define ND_DRAW_RENDER_VIEWPORT
Definition WM_types.hh:467
#define U
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
#define MEM_SAFE_FREE(v)
#define ID_IS_OVERRIDE_LIBRARY(_id)
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:404
char name[66]
Definition DNA_ID.h:415
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:760
const char * name
Definition WM_types.hh:1030
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)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition wm_files.cc:4226
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)