Blender V4.3
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_blenlib.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
23#include "BKE_action.hh"
24#include "BKE_armature.hh"
25#include "BKE_camera.h"
26#include "BKE_lib_id.hh"
27#include "BKE_object.hh"
28#include "BKE_report.hh"
29#include "BKE_scene.hh"
30#include "BKE_screen.hh"
31
33
34#include "WM_api.hh"
35#include "WM_message.hh"
36
37#include "RNA_access.hh"
38#include "RNA_define.hh"
39
40#include "ED_screen.hh"
41#include "ED_transform.hh"
43#include "ED_undo.hh"
44
45#include "view3d_intern.hh" /* own include */
46
47/* test for unlocked camera view in quad view */
49{
50 View3D *v3d;
51 ARegion *region;
52
53 if (ED_view3d_context_user_region(C, &v3d, &region)) {
54 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
55 if ((rv3d->persp == RV3D_CAMOB) && !(RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ANY_TRANSFORM)) {
56 return true;
57 }
58 }
59
60 return false;
61}
62
64{
65 View3D *v3d = CTX_wm_view3d(C);
66 if (v3d) {
68 if (rv3d) {
69 return ED_view3d_offset_lock_check(v3d, rv3d);
70 }
71 }
72 return false;
73}
74
75/* -------------------------------------------------------------------- */
78
80{
81 View3D *v3d = CTX_wm_view3d(C);
82
83 if (v3d) {
85
87
88 return OPERATOR_FINISHED;
89 }
90
91 return OPERATOR_CANCELLED;
92}
93
95{
96
97 /* identifiers */
98 ot->name = "View Lock Clear";
99 ot->description = "Clear all view locking";
100 ot->idname = "VIEW3D_OT_view_lock_clear";
101
102 /* api callbacks */
103 ot->exec = view_lock_clear_exec;
105
106 /* flags */
107 ot->flag = 0;
108}
109
111
112/* -------------------------------------------------------------------- */
115
117{
118 View3D *v3d = CTX_wm_view3d(C);
120
121 if (v3d) {
123
124 v3d->ob_center = obact; /* can be nullptr */
125
126 if (obact && obact->type == OB_ARMATURE) {
127 if (obact->mode & OB_MODE_POSE) {
129 Object *obact_eval = DEG_get_evaluated_object(depsgraph, obact);
131 if (pcham_act) {
132 STRNCPY(v3d->ob_center_bone, pcham_act->name);
133 }
134 }
135 else {
136 EditBone *ebone_act = ((bArmature *)obact->data)->act_edbone;
137 if (ebone_act) {
138 STRNCPY(v3d->ob_center_bone, ebone_act->name);
139 }
140 }
141 }
142
144
145 return OPERATOR_FINISHED;
146 }
147
148 return OPERATOR_CANCELLED;
149}
150
152{
153
154 /* identifiers */
155 ot->name = "View Lock to Active";
156 ot->description = "Lock the view to the active object/bone";
157 ot->idname = "VIEW3D_OT_view_lock_to_active";
158
159 /* api callbacks */
162
163 /* flags */
164 ot->flag = 0;
165}
166
168
169/* -------------------------------------------------------------------- */
172
174{
176 Scene *scene = CTX_data_scene(C);
177 float xfac, yfac;
178 float size[2];
179
180 View3D *v3d;
181 ARegion *region;
182 RegionView3D *rv3d;
183
184 /* no nullptr check is needed, poll checks */
185 ED_view3d_context_user_region(C, &v3d, &region);
186 rv3d = static_cast<RegionView3D *>(region->regiondata);
187
188 rv3d->camdx = rv3d->camdy = 0.0f;
189
190 ED_view3d_calc_camera_border_size(scene, depsgraph, region, v3d, rv3d, size);
191
192 /* 4px is just a little room from the edge of the area */
193 xfac = float(region->winx) / float(size[0] + 4);
194 yfac = float(region->winy) / float(size[1] + 4);
195
198
200
201 return OPERATOR_FINISHED;
202}
203
205{
206 /* identifiers */
207 ot->name = "Frame Camera Bounds";
208 ot->description = "Center the camera view, resizing the view to fit its bounds";
209 ot->idname = "VIEW3D_OT_view_center_camera";
210
211 /* api callbacks */
214
215 /* flags */
216 ot->flag = 0;
217}
218
220
221/* -------------------------------------------------------------------- */
224
235
237{
238 /* identifiers */
239 ot->name = "View Lock Center";
240 ot->description = "Center the view lock offset";
241 ot->idname = "VIEW3D_OT_view_center_lock";
242
243 /* api callbacks */
245 ot->poll = view3d_lock_poll;
246
247 /* flags */
248 ot->flag = 0;
249}
250
252
253/* -------------------------------------------------------------------- */
256
258{
259 View3D *v3d = CTX_wm_view3d(C);
260 ARegion *region = CTX_wm_region(C);
262
263 Scene *scene = CTX_data_scene(C);
264
265 rcti rect;
266 rctf vb, border;
267
268 /* get box select values using rna */
270
271 /* calculate range */
272
273 if (rv3d->persp == RV3D_CAMOB) {
275 ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, false, &vb);
276 }
277 else {
278 vb.xmin = 0;
279 vb.ymin = 0;
280 vb.xmax = region->winx;
281 vb.ymax = region->winy;
282 }
283
284 border.xmin = (float(rect.xmin) - vb.xmin) / BLI_rctf_size_x(&vb);
285 border.ymin = (float(rect.ymin) - vb.ymin) / BLI_rctf_size_y(&vb);
286 border.xmax = (float(rect.xmax) - vb.xmin) / BLI_rctf_size_x(&vb);
287 border.ymax = (float(rect.ymax) - vb.ymin) / BLI_rctf_size_y(&vb);
288
289 /* actually set border */
290 CLAMP(border.xmin, 0.0f, 1.0f);
291 CLAMP(border.ymin, 0.0f, 1.0f);
292 CLAMP(border.xmax, 0.0f, 1.0f);
293 CLAMP(border.ymax, 0.0f, 1.0f);
294
295 if (rv3d->persp == RV3D_CAMOB) {
296 scene->r.border = border;
297
299 }
300 else {
301 v3d->render_border = border;
302
304 }
305
306 /* drawing a border outside the camera view switches off border rendering */
307 if (border.xmin == border.xmax || border.ymin == border.ymax) {
308 if (rv3d->persp == RV3D_CAMOB) {
309 scene->r.mode &= ~R_BORDER;
310 }
311 else {
313 }
314 }
315 else {
316 if (rv3d->persp == RV3D_CAMOB) {
317 scene->r.mode |= R_BORDER;
318 }
319 else {
320 v3d->flag2 |= V3D_RENDER_BORDER;
321 }
322 }
323
324 if (rv3d->persp == RV3D_CAMOB) {
326 ED_undo_push(C, op->type->name);
327 }
328 return OPERATOR_FINISHED;
329}
330
332{
333 /* identifiers */
334 ot->name = "Set Render Region";
335 ot->description = "Set the boundaries of the border render and enable border render";
336 ot->idname = "VIEW3D_OT_render_border";
337
338 /* api callbacks */
339 ot->invoke = WM_gesture_box_invoke;
340 ot->exec = render_border_exec;
341 ot->modal = WM_gesture_box_modal;
342 ot->cancel = WM_gesture_box_cancel;
343
345
346 /* flags */
347 /* No undo, edited data is usually not undo-able, otherwise (camera view),
348 * a manual undo push is done. */
349 ot->flag = OPTYPE_REGISTER;
350
351 /* properties */
353}
354
356
357/* -------------------------------------------------------------------- */
360
362{
363 View3D *v3d = CTX_wm_view3d(C);
365
366 Scene *scene = CTX_data_scene(C);
367 rctf *border = nullptr;
368
369 if (rv3d->persp == RV3D_CAMOB) {
370 scene->r.mode &= ~R_BORDER;
371 border = &scene->r.border;
372
374 }
375 else {
377 border = &v3d->render_border;
378
380 }
381
382 border->xmin = 0.0f;
383 border->ymin = 0.0f;
384 border->xmax = 1.0f;
385 border->ymax = 1.0f;
386
387 if (rv3d->persp == RV3D_CAMOB) {
389 ED_undo_push(C, op->type->name);
390 }
391 return OPERATOR_FINISHED;
392}
393
395{
396 /* identifiers */
397 ot->name = "Clear Render Region";
398 ot->description = "Clear the boundaries of the border render and disable border render";
399 ot->idname = "VIEW3D_OT_clear_render_border";
400
401 /* api callbacks */
404
405 /* flags */
406 /* No undo, edited data is usually not undo-able, otherwise (camera view),
407 * a manual undo push is done. */
408 ot->flag = OPTYPE_REGISTER;
409}
410
412
413/* -------------------------------------------------------------------- */
418
420 Depsgraph *depsgraph,
421 ARegion *region,
422 View3D *v3d)
423{
424 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
425 float size[2];
426
427 int im_width, im_height;
428 BKE_render_resolution(&scene->r, false, &im_width, &im_height);
429
430 ED_view3d_calc_camera_border_size(scene, depsgraph, region, v3d, rv3d, size);
431
432 rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(float(im_width) / size[0]);
434}
435
437{
439 Scene *scene = CTX_data_scene(C);
440
441 View3D *v3d;
442 ARegion *region;
443
444 /* no nullptr check is needed, poll checks */
445 ED_view3d_context_user_region(C, &v3d, &region);
446
447 view3d_set_1_to_1_viewborder(scene, depsgraph, region, v3d);
448
450
451 return OPERATOR_FINISHED;
452}
453
455{
456 /* identifiers */
457 ot->name = "Zoom Camera 1:1";
458 ot->description = "Match the camera to 1:1 to the render output";
459 ot->idname = "VIEW3D_OT_zoom_camera_1_to_1";
460
461 /* api callbacks */
464
465 /* flags */
466 ot->flag = 0;
467}
468
470
471/* -------------------------------------------------------------------- */
474
476{
477 View3D *v3d_dummy;
478 ARegion *region;
479 RegionView3D *rv3d;
480
481 /* no nullptr check is needed, poll checks */
482 ED_view3d_context_user_region(C, &v3d_dummy, &region);
483 rv3d = static_cast<RegionView3D *>(region->regiondata);
484
485 /* Could add a separate lock flag for locking persp. */
486 if ((RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ANY_TRANSFORM) == 0) {
487 if (rv3d->persp != RV3D_ORTHO) {
488 rv3d->persp = RV3D_ORTHO;
489 }
490 else {
491 rv3d->persp = RV3D_PERSP;
492 }
493 ED_region_tag_redraw(region);
494 }
495
496 return OPERATOR_FINISHED;
497}
498
500{
501 /* identifiers */
502 ot->name = "View Perspective/Orthographic";
503 ot->description = "Switch the current view from perspective/orthographic projection";
504 ot->idname = "VIEW3D_OT_view_persportho";
505
506 /* api callbacks */
507 ot->exec = viewpersportho_exec;
509
510 /* flags */
511 ot->flag = 0;
512}
513
515
516/* -------------------------------------------------------------------- */
521
522static int view3d_navigate_invoke(bContext *C, wmOperator * /*op*/, const wmEvent *event)
523{
524 eViewNavigation_Method mode = eViewNavigation_Method(U.navigation_mode);
525
526 switch (mode) {
528 WM_operator_name_call(C, "VIEW3D_OT_fly", WM_OP_INVOKE_DEFAULT, nullptr, event);
529 break;
531 default:
532 WM_operator_name_call(C, "VIEW3D_OT_walk", WM_OP_INVOKE_DEFAULT, nullptr, event);
533 break;
534 }
535
536 return OPERATOR_FINISHED;
537}
538
540{
541 /* identifiers */
542 ot->name = "View Navigation (Walk/Fly)";
543 ot->description =
544 "Interactively navigate around the scene (uses the mode (walk/fly) preference)";
545 ot->idname = "VIEW3D_OT_navigate";
546
547 /* api callbacks */
548 ot->invoke = view3d_navigate_invoke;
550}
551
553
554/* -------------------------------------------------------------------- */
557
559{
560 /* Needed to support drag-and-drop & camera buttons context. */
561 View3D *v3d = CTX_wm_view3d(C);
562 if (v3d != nullptr) {
563 if (v3d->camera && v3d->camera->data && v3d->camera->type == OB_CAMERA) {
564 return static_cast<Camera *>(v3d->camera->data);
565 }
566 return nullptr;
567 }
568
569 return static_cast<Camera *>(CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data);
570}
571
573{
575 Image *ima;
576 CameraBGImage *bgpic;
577
579 /* may be nullptr, continue anyway */
580
582 bgpic->ima = ima;
583
584 cam->flag |= CAM_SHOW_BG_IMAGE;
585
588
589 return OPERATOR_FINISHED;
590}
591
596
598{
599 /* identifiers */
600 ot->name = "Add Camera Background Image";
601 ot->description = "Add a new background image to the active camera";
602 ot->idname = "VIEW3D_OT_camera_background_image_add";
603
604 /* api callbacks */
607
608 /* flags */
610
611 /* properties */
613 ot->srna, "filepath", nullptr, FILE_MAX, "Filepath", "Path to image file");
615 prop = RNA_def_boolean(ot->srna,
616 "relative_path",
617 true,
618 "Relative Path",
619 "Select the file relative to the blend file");
621
623}
624
626
627/* -------------------------------------------------------------------- */
630
632{
633 Camera *cam = static_cast<Camera *>(CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data);
634 const int index = RNA_int_get(op->ptr, "index");
635 CameraBGImage *bgpic_rem = static_cast<CameraBGImage *>(BLI_findlink(&cam->bg_images, index));
636
637 if (bgpic_rem) {
638 if (ID_IS_OVERRIDE_LIBRARY(cam) &&
640 {
643 "Cannot remove background image %d from camera '%s', as it is from the linked "
644 "reference data",
645 index,
646 cam->id.name + 2);
647 return OPERATOR_CANCELLED;
648 }
649
650 id_us_min((ID *)bgpic_rem->ima);
651 id_us_min((ID *)bgpic_rem->clip);
652
654
657
658 return OPERATOR_FINISHED;
659 }
660 return OPERATOR_CANCELLED;
661}
662
664{
665 /* identifiers */
666 ot->name = "Remove Camera Background Image";
667 ot->description = "Remove a background image from the camera";
668 ot->idname = "VIEW3D_OT_camera_background_image_remove";
669
670 /* api callbacks */
673
674 /* flags */
675 ot->flag = 0;
676
677 /* properties */
679 ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove", 0, INT_MAX);
680}
681
683
684/* -------------------------------------------------------------------- */
687
689{
690 Main *bmain = CTX_data_main(C);
691 Scene *scene = CTX_data_scene(C);
692
694 bmain, op->ptr, ID_WO);
695 if (world == nullptr) {
696 return OPERATOR_CANCELLED;
697 }
698
699 id_us_min((ID *)scene->world);
700 id_us_plus(&world->id);
701 scene->world = world;
702
705
707
708 return OPERATOR_FINISHED;
709}
710
712{
714}
715
717{
718 /* identifiers */
719 ot->name = "Drop World";
720 ot->description = "Drop a world into the scene";
721 ot->idname = "VIEW3D_OT_drop_world";
722
723 /* api callbacks */
724 ot->exec = drop_world_exec;
725 ot->poll = drop_world_poll;
726
727 /* flags */
729
730 /* properties */
732}
733
735
736/* -------------------------------------------------------------------- */
741
742static void calc_local_clipping(float clip_local[6][4],
743 const BoundBox *clipbb,
744 const float mat[4][4])
745{
746 BoundBox clipbb_local;
747 float imat[4][4];
748
749 invert_m4_m4(imat, mat);
750
751 for (int i = 0; i < 8; i++) {
752 mul_v3_m4v3(clipbb_local.vec[i], imat, clipbb->vec[i]);
753 }
754
755 ED_view3d_clipping_calc_from_boundbox(clip_local, &clipbb_local, is_negative_m4(mat));
756}
757
758void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
759{
760 if (rv3d->rflag & RV3D_CLIPPING) {
761 calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);
762 }
763}
764
766{
767 ARegion *region = CTX_wm_region(C);
769 rcti rect;
770
772
773 rv3d->rflag |= RV3D_CLIPPING;
774 rv3d->clipbb = static_cast<BoundBox *>(MEM_callocN(sizeof(BoundBox), "clipbb"));
775
776 /* nullptr object because we don't want it in object space */
777 ED_view3d_clipping_calc(rv3d->clipbb, rv3d->clip, region, nullptr, &rect);
778
779 return OPERATOR_FINISHED;
780}
781
782static int view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *event)
783{
785 ARegion *region = CTX_wm_region(C);
786
787 if (rv3d->rflag & RV3D_CLIPPING) {
788 rv3d->rflag &= ~RV3D_CLIPPING;
789 ED_region_tag_redraw(region);
790 MEM_SAFE_FREE(rv3d->clipbb);
791 return OPERATOR_FINISHED;
792 }
793 return WM_gesture_box_invoke(C, op, event);
794}
795
797{
798
799 /* identifiers */
800 ot->name = "Clipping Region";
801 ot->description = "Set the view clipping region";
802 ot->idname = "VIEW3D_OT_clip_border";
803
804 /* api callbacks */
805 ot->invoke = view3d_clipping_invoke;
806 ot->exec = view3d_clipping_exec;
807 ot->modal = WM_gesture_box_modal;
808 ot->cancel = WM_gesture_box_cancel;
809
811
812 /* flags */
813 ot->flag = 0;
814
815 /* properties */
817}
818
820
821/* -------------------------------------------------------------------- */
824
826 const int mval[2],
827 const bool use_depth,
828 float r_cursor_co[3])
829{
830 ARegion *region = CTX_wm_region(C);
831 View3D *v3d = CTX_wm_view3d(C);
832 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
833 bool flip;
834 bool depth_used = false;
835
836 /* normally the caller should ensure this,
837 * but this is called from areas that aren't already dealing with the viewport */
838 if (rv3d == nullptr) {
839 return;
840 }
841
842 ED_view3d_calc_zfac_ex(rv3d, r_cursor_co, &flip);
843
844 /* Reset the depth based on the view offset (we _know_ the offset is in front of us). */
845 if (flip) {
846 negate_v3_v3(r_cursor_co, rv3d->ofs);
847 /* re initialize, no need to check flip again */
848 ED_view3d_calc_zfac(rv3d, r_cursor_co);
849 }
850
851 if (use_depth) { /* maybe this should be accessed some other way */
853
855
856 /* Ensure the depth buffer is updated for #ED_view3d_autodist. */
857 ED_view3d_depth_override(depsgraph, region, v3d, nullptr, V3D_DEPTH_ALL, false, nullptr);
858
859 if (ED_view3d_autodist(region, v3d, mval, r_cursor_co, nullptr)) {
860 depth_used = true;
861 }
862 }
863
864 if (depth_used == false) {
865 float depth_pt[3];
866 copy_v3_v3(depth_pt, r_cursor_co);
867 ED_view3d_win_to_3d_int(v3d, region, depth_pt, mval, r_cursor_co);
868 }
869}
870
872 const int mval[2],
873 const bool use_depth,
874 enum eV3DCursorOrient orientation,
875 float r_cursor_co[3],
876 float r_cursor_quat[4])
877{
878 Scene *scene = CTX_data_scene(C);
879 View3D *v3d = CTX_wm_view3d(C);
880 ARegion *region = CTX_wm_region(C);
881 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
882
883 /* XXX, caller should check. */
884 if (rv3d == nullptr) {
885 return;
886 }
887
888 ED_view3d_cursor3d_position(C, mval, use_depth, r_cursor_co);
889
890 if (orientation == V3D_CURSOR_ORIENT_NONE) {
891 /* pass */
892 }
893 else if (orientation == V3D_CURSOR_ORIENT_VIEW) {
894 copy_qt_qt(r_cursor_quat, rv3d->viewquat);
895 r_cursor_quat[0] *= -1.0f;
896 }
897 else if (orientation == V3D_CURSOR_ORIENT_XFORM) {
898 float mat[3][3];
900 mat3_to_quat(r_cursor_quat, mat);
901 }
902 else if (orientation == V3D_CURSOR_ORIENT_GEOM) {
903 copy_qt_qt(r_cursor_quat, rv3d->viewquat);
904 r_cursor_quat[0] *= -1.0f;
905
906 const float mval_fl[2] = {float(mval[0]), float(mval[1])};
907 float ray_no[3];
908 float ray_co[3];
909
911
912 float obmat[4][4];
913 const Object *ob_dummy = nullptr;
914 float dist_px = 0;
916 params.snap_target_select = SCE_SNAP_TARGET_ALL;
917 params.edit_mode_type = SNAP_GEOM_FINAL;
918 params.occlusion_test = SNAP_OCCLUSION_AS_SEEM;
921 region,
922 v3d,
924 &params,
925 nullptr,
926 mval_fl,
927 nullptr,
928 &dist_px,
929 ray_co,
930 ray_no,
931 nullptr,
932 &ob_dummy,
933 obmat,
934 nullptr) != 0)
935 {
936 if (use_depth) {
937 copy_v3_v3(r_cursor_co, ray_co);
938 }
939
940 /* Math normal (Z). */
941 {
942 float tquat[4];
943 float z_src[3] = {0, 0, 1};
944 mul_qt_v3(r_cursor_quat, z_src);
945 rotation_between_vecs_to_quat(tquat, z_src, ray_no);
946 mul_qt_qtqt(r_cursor_quat, tquat, r_cursor_quat);
947 }
948
949 /* Match object matrix (X). */
950 {
951 const float ortho_axis_dot[3] = {
952 dot_v3v3(ray_no, obmat[0]),
953 dot_v3v3(ray_no, obmat[1]),
954 dot_v3v3(ray_no, obmat[2]),
955 };
956 const int ortho_axis = axis_dominant_v3_ortho_single(ortho_axis_dot);
957
958 float tquat_best[4];
959 float angle_best = -1.0f;
960
961 float tan_dst[3];
962 project_plane_v3_v3v3(tan_dst, obmat[ortho_axis], ray_no);
963 normalize_v3(tan_dst);
964
965 /* As the tangent is arbitrary from the users point of view,
966 * make the cursor 'roll' on the shortest angle.
967 * otherwise this can cause noticeable 'flipping', see #72419. */
968 for (int axis = 0; axis < 2; axis++) {
969 float tan_src[3] = {0, 0, 0};
970 tan_src[axis] = 1.0f;
971 mul_qt_v3(r_cursor_quat, tan_src);
972
973 for (int axis_sign = 0; axis_sign < 2; axis_sign++) {
974 float tquat_test[4];
975 rotation_between_vecs_to_quat(tquat_test, tan_src, tan_dst);
976 const float angle_test = angle_normalized_qt(tquat_test);
977 if (angle_test < angle_best || angle_best == -1.0f) {
978 angle_best = angle_test;
979 copy_qt_qt(tquat_best, tquat_test);
980 }
981 negate_v3(tan_src);
982 }
983 }
984 mul_qt_qtqt(r_cursor_quat, tquat_best, r_cursor_quat);
985 }
986 }
988 }
989}
990
992 const int mval[2],
993 const bool use_depth,
994 enum eV3DCursorOrient orientation)
995{
996 Scene *scene = CTX_data_scene(C);
997 View3D *v3d = CTX_wm_view3d(C);
998 ARegion *region = CTX_wm_region(C);
999 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
1000
1001 View3DCursor *cursor_curr = &scene->cursor;
1002 View3DCursor cursor_prev = *cursor_curr;
1003
1004 {
1005 blender::math::Quaternion quat, quat_prev;
1006 quat = cursor_curr->rotation();
1007 copy_qt_qt(&quat_prev.w, &quat.w);
1009 C, mval, use_depth, orientation, cursor_curr->location, &quat.w);
1010
1011 if (!equals_v4v4(&quat_prev.w, &quat.w)) {
1012 if ((cursor_curr->rotation_mode == ROT_MODE_AXISANGLE) && RV3D_VIEW_IS_AXIS(rv3d->view)) {
1013 float tmat[3][3], cmat[3][3];
1014 quat_to_mat3(tmat, &quat.w);
1015 negate_v3_v3(cursor_curr->rotation_axis, tmat[2]);
1016 axis_angle_to_mat3(cmat, cursor_curr->rotation_axis, 0.0f);
1018 cmat[0], tmat[0], cursor_curr->rotation_axis);
1019 }
1020 else {
1021 cursor_curr->set_rotation(quat, true);
1022 }
1023 }
1024 }
1025
1026 /* offset the cursor lock to avoid jumping to new offset */
1027 if (v3d->ob_center_cursor) {
1028 if (U.uiflag & USER_LOCK_CURSOR_ADJUST) {
1029
1030 float co_2d_curr[2], co_2d_prev[2];
1031
1033 region, cursor_prev.location, co_2d_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
1035 region, cursor_curr->location, co_2d_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK))
1036 {
1037 rv3d->ofs_lock[0] += (co_2d_curr[0] - co_2d_prev[0]) / (region->winx * 0.5f);
1038 rv3d->ofs_lock[1] += (co_2d_curr[1] - co_2d_prev[1]) / (region->winy * 0.5f);
1039 }
1040 }
1041 else {
1042 /* Cursor may be outside of the view,
1043 * prevent it getting 'lost', see: #40353 & #45301 */
1044 zero_v2(rv3d->ofs_lock);
1045 }
1046 }
1047
1048 if (v3d->localvd) {
1050 }
1051 else {
1053 }
1054
1055 {
1056 wmMsgBus *mbus = CTX_wm_message_bus(C);
1057 wmMsgParams_RNA msg_key_params = {{nullptr}};
1058 msg_key_params.ptr = RNA_pointer_create(&scene->id, &RNA_View3DCursor, &scene->cursor);
1059 WM_msg_publish_rna_params(mbus, &msg_key_params);
1060 }
1061
1063}
1064
1065static int view3d_cursor3d_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1066{
1067 bool use_depth = (U.uiflag & USER_DEPTH_CURSOR);
1068 {
1069 PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_depth");
1070 if (RNA_property_is_set(op->ptr, prop)) {
1071 use_depth = RNA_property_boolean_get(op->ptr, prop);
1072 }
1073 else {
1074 RNA_property_boolean_set(op->ptr, prop, use_depth);
1075 }
1076 }
1077 const enum eV3DCursorOrient orientation = eV3DCursorOrient(RNA_enum_get(op->ptr, "orientation"));
1078 ED_view3d_cursor3d_update(C, event->mval, use_depth, orientation);
1079
1080 /* Use pass-through to allow click-drag to transform the cursor. */
1082}
1083
1085{
1086
1087 /* identifiers */
1088 ot->name = "Set 3D Cursor";
1089 ot->description = "Set the location of the 3D cursor";
1090 ot->idname = "VIEW3D_OT_cursor3d";
1091
1092 /* api callbacks */
1093 ot->invoke = view3d_cursor3d_invoke;
1094
1096
1097 /* flags */
1098 // ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1099
1100 PropertyRNA *prop;
1101 static const EnumPropertyItem orientation_items[] = {
1102 {V3D_CURSOR_ORIENT_NONE, "NONE", 0, "None", "Leave orientation unchanged"},
1103 {V3D_CURSOR_ORIENT_VIEW, "VIEW", 0, "View", "Orient to the viewport"},
1105 "XFORM",
1106 0,
1107 "Transform",
1108 "Orient to the current transform setting"},
1109 {V3D_CURSOR_ORIENT_GEOM, "GEOM", 0, "Geometry", "Match the surface normal"},
1110 {0, nullptr, 0, nullptr, nullptr},
1111 };
1112
1113 prop = RNA_def_boolean(
1114 ot->srna, "use_depth", true, "Surface Project", "Project onto the surface");
1116
1117 prop = RNA_def_enum(ot->srna,
1118 "orientation",
1119 orientation_items,
1121 "Orientation",
1122 "Preset viewpoint to use");
1124}
1125
1127
1128/* -------------------------------------------------------------------- */
1131
1133 {OB_WIRE, "WIREFRAME", 0, "Wireframe", "Toggle wireframe shading"},
1134 {OB_SOLID, "SOLID", 0, "Solid", "Toggle solid shading"},
1135 {OB_MATERIAL, "MATERIAL", 0, "Material Preview", "Toggle material preview shading"},
1136 {OB_RENDER, "RENDERED", 0, "Rendered", "Toggle rendered shading"},
1137 {0, nullptr, 0, nullptr, nullptr},
1138};
1139
1141{
1142 Main *bmain = CTX_data_main(C);
1143 View3D *v3d = CTX_wm_view3d(C);
1144 ScrArea *area = CTX_wm_area(C);
1145 int type = RNA_enum_get(op->ptr, "type");
1146
1147 if (type == OB_SOLID) {
1148 if (v3d->shading.type != type) {
1149 v3d->shading.type = type;
1150 }
1151 else if (v3d->shading.type == OB_WIRE) {
1152 v3d->shading.type = OB_SOLID;
1153 }
1154 else {
1155 v3d->shading.type = OB_WIRE;
1156 }
1157 }
1158 else {
1159 char *prev_type = ((type == OB_WIRE) ? &v3d->shading.prev_type_wire : &v3d->shading.prev_type);
1160 if (v3d->shading.type == type) {
1161 if (*prev_type == type || !ELEM(*prev_type, OB_WIRE, OB_SOLID, OB_MATERIAL, OB_RENDER)) {
1162 *prev_type = OB_SOLID;
1163 }
1164 v3d->shading.type = *prev_type;
1165 }
1166 else {
1167 *prev_type = v3d->shading.type;
1168 v3d->shading.type = type;
1169 }
1170 }
1171
1172 ED_view3d_shade_update(bmain, v3d, area);
1174
1175 return OPERATOR_FINISHED;
1176}
1177
1179{
1180 PropertyRNA *prop;
1181
1182 /* identifiers */
1183 ot->name = "Toggle Shading Type";
1184 ot->description = "Toggle shading type in 3D viewport";
1185 ot->idname = "VIEW3D_OT_toggle_shading";
1186
1187 /* api callbacks */
1188 ot->exec = toggle_shading_exec;
1190
1191 prop = RNA_def_enum(
1192 ot->srna, "type", prop_shading_type_items, 0, "Type", "Shading type to toggle");
1194}
1195
1197
1198/* -------------------------------------------------------------------- */
1201
1203{
1204 View3D *v3d = CTX_wm_view3d(C);
1205 ScrArea *area = CTX_wm_area(C);
1207
1208 if (obact && ((obact->mode & OB_MODE_POSE) ||
1210 {
1212 }
1213 else {
1214 const bool xray_active = ((obact && (obact->mode & OB_MODE_EDIT)) ||
1215 ELEM(v3d->shading.type, OB_WIRE, OB_SOLID));
1216
1217 if (v3d->shading.type == OB_WIRE) {
1219 }
1220 else {
1222 }
1223 if (!xray_active) {
1224 BKE_report(op->reports, RPT_INFO, "X-Ray not available in current mode");
1225 }
1226 }
1227
1228 ED_area_tag_redraw(area);
1230
1231 return OPERATOR_FINISHED;
1232}
1233
1235{
1236 /* identifiers */
1237 ot->name = "Toggle X-Ray";
1238 ot->idname = "VIEW3D_OT_toggle_xray";
1239 ot->description = "Transparent scene display. Allow selecting through items";
1240
1241 /* api callbacks */
1242 ot->exec = toggle_xray_exec;
1244}
1245
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:351
void id_us_min(ID *id)
Definition lib_id.cc:359
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:125
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
Definition scene.cc:2877
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
Definition screen.cc:1003
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
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:197
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition BLI_rect.h:201
#define STRNCPY(dst, src)
Definition BLI_string.h:593
#define CLAMP(a, b, c)
#define ELEM(...)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1085
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition DNA_ID.h:683
@ 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
#define RV3D_VIEW_IS_AXIS(view)
#define RV3D_CAMZOOM_MAX
#define RV3D_LOCK_FLAGS(rv3d)
@ V3D_SHADING_XRAY_WIREFRAME
@ V3D_SHADING_XRAY
@ RV3D_CLIPPING
@ V3D_OVERLAY_BONE_SELECT
@ V3D_RENDER_BORDER
@ RV3D_CAMOB
@ RV3D_PERSP
@ RV3D_ORTHO
#define RV3D_CAMZOOM_MIN
@ RV3D_LOCK_ANY_TRANSFORM
@ OPERATOR_PASS_THROUGH
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:708
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:634
void ED_transform_calc_orientation_from_type(const bContext *C, float r_mat[3][3])
eSnapMode ED_transform_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])
SnapObjectContext * ED_transform_snap_object_context_create(Scene *scene, int flag)
void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx)
void ED_undo_push(bContext *C, const char *str)
Definition ed_undo.cc:104
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:275
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:252
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)
void view3d_operator_needs_opengl(const bContext *C)
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:186
eV3DCursorOrient
Definition ED_view3d.hh:90
@ V3D_CURSOR_ORIENT_XFORM
Definition ED_view3d.hh:93
@ V3D_CURSOR_ORIENT_GEOM
Definition ED_view3d.hh:94
@ V3D_CURSOR_ORIENT_VIEW
Definition ED_view3d.hh:92
@ V3D_CURSOR_ORIENT_NONE
Definition ED_view3d.hh:91
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 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)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between world
PropertyFlag
Definition RNA_types.hh:201
@ PROP_SKIP_SAVE
Definition RNA_types.hh:245
@ PROP_HIDDEN
Definition RNA_types.hh:239
#define C
Definition RandGen.cpp:29
#define ND_WORLD
Definition WM_types.hh:419
@ OPTYPE_INTERNAL
Definition WM_types.hh:182
@ OPTYPE_UNDO
Definition WM_types.hh:162
@ OPTYPE_REGISTER
Definition WM_types.hh:160
#define ND_RENDER_OPTIONS
Definition WM_types.hh:402
#define NC_SCENE
Definition WM_types.hh:345
#define NA_EDITED
Definition WM_types.hh:550
#define NC_CAMERA
Definition WM_types.hh:368
@ WM_OP_INVOKE_DEFAULT
Definition WM_types.hh:218
#define ND_SPACE_VIEW3D
Definition WM_types.hh:494
#define NS_VIEW3D_SHADING
Definition WM_types.hh:543
#define NC_SPACE
Definition WM_types.hh:359
#define ND_DRAW_RENDER_VIEWPORT
Definition WM_types.hh:437
#define U
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
draw_view in_light_buf[] float
static int clear_render_border_exec(bContext *C, wmOperator *)
static int render_border_exec(bContext *C, wmOperator *op)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void *(* MEM_callocN)(size_t len, const char *str)
Definition mallocn.cc:42
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(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)
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:413
char name[66]
Definition DNA_ID.h:425
void * data
Definition RNA_types.hh:42
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:728
const char * name
Definition WM_types.hh:990
struct ReportList * reports
struct wmOperatorType * type
struct PointerRNA * ptr
void ED_view3d_cursor3d_update(bContext *C, const int mval[2], const bool use_depth, enum eV3DCursorOrient orientation)
static int toggle_xray_exec(bContext *C, wmOperator *op)
static int view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int view3d_center_camera_exec(bContext *C, wmOperator *)
static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *)
static int camera_background_image_remove_exec(bContext *C, wmOperator *op)
static int view3d_clipping_exec(bContext *C, wmOperator *op)
static int view_lock_to_active_exec(bContext *C, wmOperator *)
static int view3d_cursor3d_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void VIEW3D_OT_view_persportho(wmOperatorType *ot)
static const EnumPropertyItem prop_shading_type_items[]
static int drop_world_exec(bContext *C, wmOperator *op)
static bool view3d_camera_user_poll(bContext *C)
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 int viewpersportho_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 int toggle_shading_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_view_lock_to_active(wmOperatorType *ot)
static void view3d_set_1_to_1_viewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, View3D *v3d)
static int camera_background_image_add_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_cursor3d(wmOperatorType *ot)
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 int view_lock_clear_exec(bContext *C, wmOperator *)
void VIEW3D_OT_navigate(wmOperatorType *ot)
static void calc_local_clipping(float clip_local[6][4], const BoundBox *clipbb, const float mat[4][4])
static int render_border_exec(bContext *C, wmOperator *op)
static int view3d_center_lock_exec(bContext *C, wmOperator *)
static int view3d_navigate_invoke(bContext *C, wmOperator *, const wmEvent *event)
static Camera * background_image_camera_from_context(bContext *C)
void VIEW3D_OT_camera_background_image_remove(wmOperatorType *ot)
static int clear_render_border_exec(bContext *C, wmOperator *op)
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)
void VIEW3D_OT_drop_world(wmOperatorType *ot)
void VIEW3D_OT_camera_background_image_add(wmOperatorType *ot)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_name_call(bContext *C, const char *opstring, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
wmOperatorType * ot
Definition wm_files.cc:4125
void WM_gesture_box_cancel(bContext *C, wmOperator *op)
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_box_modal(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)