Blender  V3.3
view3d_edit.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
10 #include "DNA_armature_types.h"
11 #include "DNA_camera_types.h"
12 #include "DNA_world_types.h"
13 
14 #include "MEM_guardedalloc.h"
15 
16 #include "BLI_blenlib.h"
17 #include "BLI_math.h"
18 
19 #include "BKE_action.h"
20 #include "BKE_armature.h"
21 #include "BKE_camera.h"
22 #include "BKE_lib_id.h"
23 #include "BKE_main.h"
24 #include "BKE_object.h"
25 #include "BKE_report.h"
26 #include "BKE_scene.h"
27 #include "BKE_screen.h"
28 
29 #include "DEG_depsgraph_query.h"
30 
31 #include "WM_api.h"
32 #include "WM_message.h"
33 
34 #include "RNA_access.h"
35 #include "RNA_define.h"
36 
37 #include "ED_screen.h"
38 #include "ED_transform.h"
40 
41 #include "view3d_intern.h" /* own include */
42 
43 /* test for unlocked camera view in quad view */
45 {
46  View3D *v3d;
47  ARegion *region;
48 
49  if (ED_view3d_context_user_region(C, &v3d, &region)) {
50  RegionView3D *rv3d = region->regiondata;
51  if ((rv3d->persp == RV3D_CAMOB) && !(RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ANY_TRANSFORM)) {
52  return 1;
53  }
54  }
55 
56  return 0;
57 }
58 
60 {
61  View3D *v3d = CTX_wm_view3d(C);
62  if (v3d) {
64  if (rv3d) {
65  return ED_view3d_offset_lock_check(v3d, rv3d);
66  }
67  }
68  return false;
69 }
70 
71 /* -------------------------------------------------------------------- */
76 {
77  View3D *v3d = CTX_wm_view3d(C);
78 
79  if (v3d) {
81 
83 
84  return OPERATOR_FINISHED;
85  }
86 
87  return OPERATOR_CANCELLED;
88 }
89 
91 {
92 
93  /* identifiers */
94  ot->name = "View Lock Clear";
95  ot->description = "Clear all view locking";
96  ot->idname = "VIEW3D_OT_view_lock_clear";
97 
98  /* api callbacks */
101 
102  /* flags */
103  ot->flag = 0;
104 }
105 
108 /* -------------------------------------------------------------------- */
113 {
114  View3D *v3d = CTX_wm_view3d(C);
115  Object *obact = CTX_data_active_object(C);
116 
117  if (v3d) {
119 
120  v3d->ob_center = obact; /* can be NULL */
121 
122  if (obact && obact->type == OB_ARMATURE) {
123  if (obact->mode & OB_MODE_POSE) {
125  Object *obact_eval = DEG_get_evaluated_object(depsgraph, obact);
127  if (pcham_act) {
128  BLI_strncpy(v3d->ob_center_bone, pcham_act->name, sizeof(v3d->ob_center_bone));
129  }
130  }
131  else {
132  EditBone *ebone_act = ((bArmature *)obact->data)->act_edbone;
133  if (ebone_act) {
134  BLI_strncpy(v3d->ob_center_bone, ebone_act->name, sizeof(v3d->ob_center_bone));
135  }
136  }
137  }
138 
140 
141  return OPERATOR_FINISHED;
142  }
143 
144  return OPERATOR_CANCELLED;
145 }
146 
148 {
149 
150  /* identifiers */
151  ot->name = "View Lock to Active";
152  ot->description = "Lock the view to the active object/bone";
153  ot->idname = "VIEW3D_OT_view_lock_to_active";
154 
155  /* api callbacks */
158 
159  /* flags */
160  ot->flag = 0;
161 }
162 
165 /* -------------------------------------------------------------------- */
170 {
173  float xfac, yfac;
174  float size[2];
175 
176  View3D *v3d;
177  ARegion *region;
178  RegionView3D *rv3d;
179 
180  /* no NULL check is needed, poll checks */
181  ED_view3d_context_user_region(C, &v3d, &region);
182  rv3d = region->regiondata;
183 
184  rv3d->camdx = rv3d->camdy = 0.0f;
185 
187 
188  /* 4px is just a little room from the edge of the area */
189  xfac = (float)region->winx / (float)(size[0] + 4);
190  yfac = (float)region->winy / (float)(size[1] + 4);
191 
192  rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(min_ff(xfac, yfac));
194 
196 
197  return OPERATOR_FINISHED;
198 }
199 
201 {
202  /* identifiers */
203  ot->name = "Frame Camera Bounds";
204  ot->description = "Center the camera view, resizing the view to fit its bounds";
205  ot->idname = "VIEW3D_OT_view_center_camera";
206 
207  /* api callbacks */
210 
211  /* flags */
212  ot->flag = 0;
213 }
214 
217 /* -------------------------------------------------------------------- */
222 {
224 
225  zero_v2(rv3d->ofs_lock);
226 
228 
229  return OPERATOR_FINISHED;
230 }
231 
233 {
234  /* identifiers */
235  ot->name = "View Lock Center";
236  ot->description = "Center the view lock offset";
237  ot->idname = "VIEW3D_OT_view_center_lock";
238 
239  /* api callbacks */
242 
243  /* flags */
244  ot->flag = 0;
245 }
246 
249 /* -------------------------------------------------------------------- */
254 {
255  View3D *v3d = CTX_wm_view3d(C);
256  ARegion *region = CTX_wm_region(C);
258 
260 
261  rcti rect;
262  rctf vb, border;
263 
264  /* get box select values using rna */
266 
267  /* calculate range */
268 
269  if (rv3d->persp == RV3D_CAMOB) {
271  ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &vb, false);
272  }
273  else {
274  vb.xmin = 0;
275  vb.ymin = 0;
276  vb.xmax = region->winx;
277  vb.ymax = region->winy;
278  }
279 
280  border.xmin = ((float)rect.xmin - vb.xmin) / BLI_rctf_size_x(&vb);
281  border.ymin = ((float)rect.ymin - vb.ymin) / BLI_rctf_size_y(&vb);
282  border.xmax = ((float)rect.xmax - vb.xmin) / BLI_rctf_size_x(&vb);
283  border.ymax = ((float)rect.ymax - vb.ymin) / BLI_rctf_size_y(&vb);
284 
285  /* actually set border */
286  CLAMP(border.xmin, 0.0f, 1.0f);
287  CLAMP(border.ymin, 0.0f, 1.0f);
288  CLAMP(border.xmax, 0.0f, 1.0f);
289  CLAMP(border.ymax, 0.0f, 1.0f);
290 
291  if (rv3d->persp == RV3D_CAMOB) {
292  scene->r.border = border;
293 
295  }
296  else {
297  v3d->render_border = border;
298 
300  }
301 
302  /* drawing a border outside the camera view switches off border rendering */
303  if ((border.xmin == border.xmax || border.ymin == border.ymax)) {
304  if (rv3d->persp == RV3D_CAMOB) {
305  scene->r.mode &= ~R_BORDER;
306  }
307  else {
308  v3d->flag2 &= ~V3D_RENDER_BORDER;
309  }
310  }
311  else {
312  if (rv3d->persp == RV3D_CAMOB) {
313  scene->r.mode |= R_BORDER;
314  }
315  else {
316  v3d->flag2 |= V3D_RENDER_BORDER;
317  }
318  }
319 
320  if (rv3d->persp == RV3D_CAMOB) {
322  }
323  return OPERATOR_FINISHED;
324 }
325 
327 {
328  /* identifiers */
329  ot->name = "Set Render Region";
330  ot->description = "Set the boundaries of the border render and enable border render";
331  ot->idname = "VIEW3D_OT_render_border";
332 
333  /* api callbacks */
338 
340 
341  /* flags */
343 
344  /* properties */
346 }
347 
350 /* -------------------------------------------------------------------- */
355 {
356  View3D *v3d = CTX_wm_view3d(C);
358 
360  rctf *border = NULL;
361 
362  if (rv3d->persp == RV3D_CAMOB) {
363  scene->r.mode &= ~R_BORDER;
364  border = &scene->r.border;
365 
367  }
368  else {
369  v3d->flag2 &= ~V3D_RENDER_BORDER;
370  border = &v3d->render_border;
371 
373  }
374 
375  border->xmin = 0.0f;
376  border->ymin = 0.0f;
377  border->xmax = 1.0f;
378  border->ymax = 1.0f;
379 
380  if (rv3d->persp == RV3D_CAMOB) {
382  }
383  return OPERATOR_FINISHED;
384 }
385 
387 {
388  /* identifiers */
389  ot->name = "Clear Render Region";
390  ot->description = "Clear the boundaries of the border render and disable border render";
391  ot->idname = "VIEW3D_OT_clear_render_border";
392 
393  /* api callbacks */
396 
397  /* flags */
399 }
400 
403 /* -------------------------------------------------------------------- */
411  ARegion *region,
412  View3D *v3d)
413 {
414  RegionView3D *rv3d = region->regiondata;
415  float size[2];
416 
417  int im_width, im_height;
418  BKE_render_resolution(&scene->r, false, &im_width, &im_height);
419 
421 
422  rv3d->camzoom = BKE_screen_view3d_zoom_from_fac((float)im_width / size[0]);
424 }
425 
427 {
430 
431  View3D *v3d;
432  ARegion *region;
433 
434  /* no NULL check is needed, poll checks */
435  ED_view3d_context_user_region(C, &v3d, &region);
436 
438 
440 
441  return OPERATOR_FINISHED;
442 }
443 
445 {
446  /* identifiers */
447  ot->name = "Zoom Camera 1:1";
448  ot->description = "Match the camera to 1:1 to the render output";
449  ot->idname = "VIEW3D_OT_zoom_camera_1_to_1";
450 
451  /* api callbacks */
454 
455  /* flags */
456  ot->flag = 0;
457 }
458 
461 /* -------------------------------------------------------------------- */
466 {
467  View3D *v3d_dummy;
468  ARegion *region;
469  RegionView3D *rv3d;
470 
471  /* no NULL check is needed, poll checks */
472  ED_view3d_context_user_region(C, &v3d_dummy, &region);
473  rv3d = region->regiondata;
474 
475  /* Could add a separate lock flag for locking persp. */
476  if ((RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ANY_TRANSFORM) == 0) {
477  if (rv3d->persp != RV3D_ORTHO) {
478  rv3d->persp = RV3D_ORTHO;
479  }
480  else {
481  rv3d->persp = RV3D_PERSP;
482  }
483  ED_region_tag_redraw(region);
484  }
485 
486  return OPERATOR_FINISHED;
487 }
488 
490 {
491  /* identifiers */
492  ot->name = "View Perspective/Orthographic";
493  ot->description = "Switch the current view from perspective/orthographic projection";
494  ot->idname = "VIEW3D_OT_view_persportho";
495 
496  /* api callbacks */
499 
500  /* flags */
501  ot->flag = 0;
502 }
503 
506 /* -------------------------------------------------------------------- */
512 static int view3d_navigate_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
513 {
514  eViewNavigation_Method mode = U.navigation_mode;
515 
516  switch (mode) {
517  case VIEW_NAVIGATION_FLY:
518  WM_operator_name_call(C, "VIEW3D_OT_fly", WM_OP_INVOKE_DEFAULT, NULL, event);
519  break;
521  default:
522  WM_operator_name_call(C, "VIEW3D_OT_walk", WM_OP_INVOKE_DEFAULT, NULL, event);
523  break;
524  }
525 
526  return OPERATOR_FINISHED;
527 }
528 
530 {
531  /* identifiers */
532  ot->name = "View Navigation (Walk/Fly)";
533  ot->description =
534  "Interactively navigate around the scene (uses the mode (walk/fly) preference)";
535  ot->idname = "VIEW3D_OT_navigate";
536 
537  /* api callbacks */
540 }
541 
544 /* -------------------------------------------------------------------- */
549 {
550  /* Needed to support drag-and-drop & camera buttons context. */
551  View3D *v3d = CTX_wm_view3d(C);
552  if (v3d != NULL) {
553  if (v3d->camera && v3d->camera->data && v3d->camera->type == OB_CAMERA) {
554  return v3d->camera->data;
555  }
556  return NULL;
557  }
558 
559  return CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data;
560 }
561 
563 {
566 
567  return OPERATOR_FINISHED;
568 }
569 
571 {
573  Image *ima;
574  CameraBGImage *bgpic;
575 
576  ima = (Image *)WM_operator_drop_load_path(C, op, ID_IM);
577  /* may be NULL, continue anyway */
578 
579  bgpic = BKE_camera_background_image_new(cam);
580  bgpic->ima = ima;
581 
582  cam->flag |= CAM_SHOW_BG_IMAGE;
583 
586 
587  return OPERATOR_FINISHED;
588 }
589 
591 {
593 }
594 
596 {
597  /* identifiers */
598  /* NOTE: having key shortcut here is bad practice,
599  * but for now keep because this displays when dragging an image over the 3D viewport */
600  ot->name = "Add Background Image";
601  ot->description = "Add a new background image";
602  ot->idname = "VIEW3D_OT_background_image_add";
603 
604  /* api callbacks */
608 
609  /* flags */
610  ot->flag = OPTYPE_UNDO;
611 
612  /* properties */
616  FILE_SPECIAL,
621 }
622 
625 /* -------------------------------------------------------------------- */
630 {
631  Camera *cam = CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data;
632  const int index = RNA_int_get(op->ptr, "index");
633  CameraBGImage *bgpic_rem = BLI_findlink(&cam->bg_images, index);
634 
635  if (bgpic_rem) {
636  if (ID_IS_OVERRIDE_LIBRARY(cam) &&
637  (bgpic_rem->flag & CAM_BGIMG_FLAG_OVERRIDE_LIBRARY_LOCAL) == 0) {
638  BKE_reportf(op->reports,
639  RPT_WARNING,
640  "Cannot remove background image %d from camera '%s', as it is from the linked "
641  "reference data",
642  index,
643  cam->id.name + 2);
644  return OPERATOR_CANCELLED;
645  }
646 
647  id_us_min((ID *)bgpic_rem->ima);
648  id_us_min((ID *)bgpic_rem->clip);
649 
650  BKE_camera_background_image_remove(cam, bgpic_rem);
651 
654 
655  return OPERATOR_FINISHED;
656  }
657  return OPERATOR_CANCELLED;
658 }
659 
661 {
662  /* identifiers */
663  ot->name = "Remove Background Image";
664  ot->description = "Remove a background image from the 3D view";
665  ot->idname = "VIEW3D_OT_background_image_remove";
666 
667  /* api callbacks */
670 
671  /* flags */
672  ot->flag = 0;
673 
674  /* properties */
675  RNA_def_int(
676  ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove", 0, INT_MAX);
677 }
678 
681 /* -------------------------------------------------------------------- */
686 {
687  Main *bmain = CTX_data_main(C);
689 
691  bmain, op->ptr, ID_WO);
692  if (world == NULL) {
693  return OPERATOR_CANCELLED;
694  }
695 
696  id_us_min((ID *)scene->world);
697  id_us_plus(&world->id);
698  scene->world = world;
699 
700  DEG_id_tag_update(&scene->id, 0);
702 
704 
705  return OPERATOR_FINISHED;
706 }
707 
709 {
711 }
712 
714 {
715  /* identifiers */
716  ot->name = "Drop World";
717  ot->description = "Drop a world into the scene";
718  ot->idname = "VIEW3D_OT_drop_world";
719 
720  /* api callbacks */
723 
724  /* flags */
726 
727  /* properties */
729 }
730 
733 /* -------------------------------------------------------------------- */
739 static void calc_local_clipping(float clip_local[6][4],
740  const BoundBox *clipbb,
741  const float mat[4][4])
742 {
743  BoundBox clipbb_local;
744  float imat[4][4];
745 
746  invert_m4_m4(imat, mat);
747 
748  for (int i = 0; i < 8; i++) {
749  mul_v3_m4v3(clipbb_local.vec[i], imat, clipbb->vec[i]);
750  }
751 
752  ED_view3d_clipping_calc_from_boundbox(clip_local, &clipbb_local, is_negative_m4(mat));
753 }
754 
755 void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
756 {
757  if (rv3d->rflag & RV3D_CLIPPING) {
758  calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);
759  }
760 }
761 
763 {
764  ARegion *region = CTX_wm_region(C);
766  rcti rect;
767 
769 
770  rv3d->rflag |= RV3D_CLIPPING;
771  rv3d->clipbb = MEM_callocN(sizeof(BoundBox), "clipbb");
772 
773  /* NULL object because we don't want it in object space */
774  ED_view3d_clipping_calc(rv3d->clipbb, rv3d->clip, region, NULL, &rect);
775 
776  return OPERATOR_FINISHED;
777 }
778 
779 static int view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *event)
780 {
782  ARegion *region = CTX_wm_region(C);
783 
784  if (rv3d->rflag & RV3D_CLIPPING) {
785  rv3d->rflag &= ~RV3D_CLIPPING;
786  ED_region_tag_redraw(region);
787  MEM_SAFE_FREE(rv3d->clipbb);
788  return OPERATOR_FINISHED;
789  }
790  return WM_gesture_box_invoke(C, op, event);
791 }
792 
794 {
795 
796  /* identifiers */
797  ot->name = "Clipping Region";
798  ot->description = "Set the view clipping region";
799  ot->idname = "VIEW3D_OT_clip_border";
800 
801  /* api callbacks */
806 
808 
809  /* flags */
810  ot->flag = 0;
811 
812  /* properties */
814 }
815 
818 /* -------------------------------------------------------------------- */
822 /* cursor position in vec, result in vec, mval in region coords */
824  const int mval[2],
825  const bool use_depth,
826  float cursor_co[3])
827 {
828  ARegion *region = CTX_wm_region(C);
829  View3D *v3d = CTX_wm_view3d(C);
830  RegionView3D *rv3d = region->regiondata;
831  bool flip;
832  bool depth_used = false;
833 
834  /* normally the caller should ensure this,
835  * but this is called from areas that aren't already dealing with the viewport */
836  if (rv3d == NULL) {
837  return;
838  }
839 
840  ED_view3d_calc_zfac_ex(rv3d, cursor_co, &flip);
841 
842  /* Reset the depth based on the view offset (we _know_ the offset is in front of us). */
843  if (flip) {
844  negate_v3_v3(cursor_co, rv3d->ofs);
845  /* re initialize, no need to check flip again */
846  ED_view3d_calc_zfac(rv3d, cursor_co);
847  }
848 
849  if (use_depth) { /* maybe this should be accessed some other way */
851 
853  if (ED_view3d_autodist(depsgraph, region, v3d, mval, cursor_co, true, NULL)) {
854  depth_used = true;
855  }
856  }
857 
858  if (depth_used == false) {
859  float depth_pt[3];
860  copy_v3_v3(depth_pt, cursor_co);
861  ED_view3d_win_to_3d_int(v3d, region, depth_pt, mval, cursor_co);
862  }
863 }
864 
866  const int mval[2],
867  const bool use_depth,
868  enum eV3DCursorOrient orientation,
869  float cursor_co[3],
870  float cursor_quat[4])
871 {
873  View3D *v3d = CTX_wm_view3d(C);
874  ARegion *region = CTX_wm_region(C);
875  RegionView3D *rv3d = region->regiondata;
876 
877  /* XXX, caller should check. */
878  if (rv3d == NULL) {
879  return;
880  }
881 
882  ED_view3d_cursor3d_position(C, mval, use_depth, cursor_co);
883 
884  if (orientation == V3D_CURSOR_ORIENT_NONE) {
885  /* pass */
886  }
887  else if (orientation == V3D_CURSOR_ORIENT_VIEW) {
888  copy_qt_qt(cursor_quat, rv3d->viewquat);
889  cursor_quat[0] *= -1.0f;
890  }
891  else if (orientation == V3D_CURSOR_ORIENT_XFORM) {
892  float mat[3][3];
894  mat3_to_quat(cursor_quat, mat);
895  }
896  else if (orientation == V3D_CURSOR_ORIENT_GEOM) {
897  copy_qt_qt(cursor_quat, rv3d->viewquat);
898  cursor_quat[0] *= -1.0f;
899 
900  const float mval_fl[2] = {UNPACK2(mval)};
901  float ray_no[3];
902  float ray_co[3];
903 
905 
906  float obmat[4][4];
907  Object *ob_dummy = NULL;
908  float dist_px = 0;
911  region,
912  v3d,
914  &(const struct SnapObjectParams){
915  .snap_target_select = SCE_SNAP_TARGET_ALL,
916  .edit_mode_type = SNAP_GEOM_FINAL,
917  .use_occlusion_test = true,
918  },
919  NULL,
920  mval_fl,
921  NULL,
922  &dist_px,
923  ray_co,
924  ray_no,
925  NULL,
926  &ob_dummy,
927  obmat,
928  NULL) != 0) {
929  if (use_depth) {
930  copy_v3_v3(cursor_co, ray_co);
931  }
932 
933  /* Math normal (Z). */
934  {
935  float tquat[4];
936  float z_src[3] = {0, 0, 1};
937  mul_qt_v3(cursor_quat, z_src);
938  rotation_between_vecs_to_quat(tquat, z_src, ray_no);
939  mul_qt_qtqt(cursor_quat, tquat, cursor_quat);
940  }
941 
942  /* Match object matrix (X). */
943  {
944  const float ortho_axis_dot[3] = {
945  dot_v3v3(ray_no, obmat[0]),
946  dot_v3v3(ray_no, obmat[1]),
947  dot_v3v3(ray_no, obmat[2]),
948  };
949  const int ortho_axis = axis_dominant_v3_ortho_single(ortho_axis_dot);
950 
951  float tquat_best[4];
952  float angle_best = -1.0f;
953 
954  float tan_dst[3];
955  project_plane_v3_v3v3(tan_dst, obmat[ortho_axis], ray_no);
956  normalize_v3(tan_dst);
957 
958  /* As the tangent is arbitrary from the users point of view,
959  * make the cursor 'roll' on the shortest angle.
960  * otherwise this can cause noticeable 'flipping', see T72419. */
961  for (int axis = 0; axis < 2; axis++) {
962  float tan_src[3] = {0, 0, 0};
963  tan_src[axis] = 1.0f;
964  mul_qt_v3(cursor_quat, tan_src);
965 
966  for (int axis_sign = 0; axis_sign < 2; axis_sign++) {
967  float tquat_test[4];
968  rotation_between_vecs_to_quat(tquat_test, tan_src, tan_dst);
969  const float angle_test = angle_normalized_qt(tquat_test);
970  if (angle_test < angle_best || angle_best == -1.0f) {
971  angle_best = angle_test;
972  copy_qt_qt(tquat_best, tquat_test);
973  }
974  negate_v3(tan_src);
975  }
976  }
977  mul_qt_qtqt(cursor_quat, tquat_best, cursor_quat);
978  }
979  }
981  }
982 }
983 
985  const int mval[2],
986  const bool use_depth,
987  enum eV3DCursorOrient orientation)
988 {
992  RegionView3D *rv3d = region->regiondata;
993 
994  View3DCursor *cursor_curr = &scene->cursor;
995  View3DCursor cursor_prev = *cursor_curr;
996 
997  {
998  float quat[4], quat_prev[4];
999  BKE_scene_cursor_rot_to_quat(cursor_curr, quat);
1000  copy_qt_qt(quat_prev, quat);
1002  C, mval, use_depth, orientation, cursor_curr->location, quat);
1003 
1004  if (!equals_v4v4(quat_prev, quat)) {
1005  if ((cursor_curr->rotation_mode == ROT_MODE_AXISANGLE) && RV3D_VIEW_IS_AXIS(rv3d->view)) {
1006  float tmat[3][3], cmat[3][3];
1007  quat_to_mat3(tmat, quat);
1008  negate_v3_v3(cursor_curr->rotation_axis, tmat[2]);
1009  axis_angle_to_mat3(cmat, cursor_curr->rotation_axis, 0.0f);
1011  cmat[0], tmat[0], cursor_curr->rotation_axis);
1012  }
1013  else {
1014  BKE_scene_cursor_quat_to_rot(cursor_curr, quat, true);
1015  }
1016  }
1017  }
1018 
1019  /* offset the cursor lock to avoid jumping to new offset */
1020  if (v3d->ob_center_cursor) {
1021  if (U.uiflag & USER_LOCK_CURSOR_ADJUST) {
1022 
1023  float co_2d_curr[2], co_2d_prev[2];
1024 
1026  region, cursor_prev.location, co_2d_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
1028  region, cursor_curr->location, co_2d_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK)) {
1029  rv3d->ofs_lock[0] += (co_2d_curr[0] - co_2d_prev[0]) / (region->winx * 0.5f);
1030  rv3d->ofs_lock[1] += (co_2d_curr[1] - co_2d_prev[1]) / (region->winy * 0.5f);
1031  }
1032  }
1033  else {
1034  /* Cursor may be outside of the view,
1035  * prevent it getting 'lost', see: T40353 & T45301 */
1036  zero_v2(rv3d->ofs_lock);
1037  }
1038  }
1039 
1040  if (v3d->localvd) {
1042  }
1043  else {
1045  }
1046 
1047  {
1048  struct wmMsgBus *mbus = CTX_wm_message_bus(C);
1049  wmMsgParams_RNA msg_key_params = {{0}};
1050  RNA_pointer_create(&scene->id, &RNA_View3DCursor, &scene->cursor, &msg_key_params.ptr);
1051  WM_msg_publish_rna_params(mbus, &msg_key_params);
1052  }
1053 
1055 }
1056 
1057 static int view3d_cursor3d_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1058 {
1059  bool use_depth = (U.uiflag & USER_DEPTH_CURSOR);
1060  {
1061  PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_depth");
1062  if (RNA_property_is_set(op->ptr, prop)) {
1063  use_depth = RNA_property_boolean_get(op->ptr, prop);
1064  }
1065  else {
1066  RNA_property_boolean_set(op->ptr, prop, use_depth);
1067  }
1068  }
1069  const enum eV3DCursorOrient orientation = RNA_enum_get(op->ptr, "orientation");
1070  ED_view3d_cursor3d_update(C, event->mval, use_depth, orientation);
1071 
1072  /* Use pass-through to allow click-drag to transform the cursor. */
1074 }
1075 
1077 {
1078 
1079  /* identifiers */
1080  ot->name = "Set 3D Cursor";
1081  ot->description = "Set the location of the 3D cursor";
1082  ot->idname = "VIEW3D_OT_cursor3d";
1083 
1084  /* api callbacks */
1086 
1088 
1089  /* flags */
1090  // ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1091 
1092  PropertyRNA *prop;
1093  static const EnumPropertyItem orientation_items[] = {
1094  {V3D_CURSOR_ORIENT_NONE, "NONE", 0, "None", "Leave orientation unchanged"},
1095  {V3D_CURSOR_ORIENT_VIEW, "VIEW", 0, "View", "Orient to the viewport"},
1097  "XFORM",
1098  0,
1099  "Transform",
1100  "Orient to the current transform setting"},
1101  {V3D_CURSOR_ORIENT_GEOM, "GEOM", 0, "Geometry", "Match the surface normal"},
1102  {0, NULL, 0, NULL, NULL},
1103  };
1104 
1105  prop = RNA_def_boolean(
1106  ot->srna, "use_depth", true, "Surface Project", "Project onto the surface");
1108 
1109  prop = RNA_def_enum(ot->srna,
1110  "orientation",
1111  orientation_items,
1113  "Orientation",
1114  "Preset viewpoint to use");
1116 }
1117 
1120 /* -------------------------------------------------------------------- */
1125  {OB_WIRE, "WIREFRAME", 0, "Wireframe", "Toggle wireframe shading"},
1126  {OB_SOLID, "SOLID", 0, "Solid", "Toggle solid shading"},
1127  {OB_MATERIAL, "MATERIAL", 0, "Material Preview", "Toggle material preview shading"},
1128  {OB_RENDER, "RENDERED", 0, "Rendered", "Toggle rendered shading"},
1129  {0, NULL, 0, NULL, NULL},
1130 };
1131 
1133 {
1134  Main *bmain = CTX_data_main(C);
1135  View3D *v3d = CTX_wm_view3d(C);
1136  ScrArea *area = CTX_wm_area(C);
1137  int type = RNA_enum_get(op->ptr, "type");
1138 
1139  if (type == OB_SOLID) {
1140  if (v3d->shading.type != type) {
1141  v3d->shading.type = type;
1142  }
1143  else if (v3d->shading.type == OB_WIRE) {
1144  v3d->shading.type = OB_SOLID;
1145  }
1146  else {
1147  v3d->shading.type = OB_WIRE;
1148  }
1149  }
1150  else {
1151  char *prev_type = ((type == OB_WIRE) ? &v3d->shading.prev_type_wire : &v3d->shading.prev_type);
1152  if (v3d->shading.type == type) {
1153  if (*prev_type == type || !ELEM(*prev_type, OB_WIRE, OB_SOLID, OB_MATERIAL, OB_RENDER)) {
1154  *prev_type = OB_SOLID;
1155  }
1156  v3d->shading.type = *prev_type;
1157  }
1158  else {
1159  *prev_type = v3d->shading.type;
1160  v3d->shading.type = type;
1161  }
1162  }
1163 
1164  ED_view3d_shade_update(bmain, v3d, area);
1166 
1167  return OPERATOR_FINISHED;
1168 }
1169 
1171 {
1172  PropertyRNA *prop;
1173 
1174  /* identifiers */
1175  ot->name = "Toggle Shading Type";
1176  ot->description = "Toggle shading type in 3D viewport";
1177  ot->idname = "VIEW3D_OT_toggle_shading";
1178 
1179  /* api callbacks */
1182 
1183  prop = RNA_def_enum(
1184  ot->srna, "type", prop_shading_type_items, 0, "Type", "Shading type to toggle");
1186 }
1187 
1190 /* -------------------------------------------------------------------- */
1195 {
1196  View3D *v3d = CTX_wm_view3d(C);
1197  ScrArea *area = CTX_wm_area(C);
1198  Object *obact = CTX_data_active_object(C);
1199 
1200  if (obact && ((obact->mode & OB_MODE_POSE) ||
1201  ((obact->mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(obact)))) {
1203  }
1204  else {
1205  const bool xray_active = ((obact && (obact->mode & OB_MODE_EDIT)) ||
1206  ELEM(v3d->shading.type, OB_WIRE, OB_SOLID));
1207 
1208  if (v3d->shading.type == OB_WIRE) {
1210  }
1211  else {
1212  v3d->shading.flag ^= V3D_SHADING_XRAY;
1213  }
1214  if (!xray_active) {
1215  BKE_report(op->reports, RPT_INFO, "X-Ray not available in current mode");
1216  }
1217  }
1218 
1221 
1222  return OPERATOR_FINISHED;
1223 }
1224 
1226 {
1227  /* identifiers */
1228  ot->name = "Toggle X-Ray";
1229  ot->idname = "VIEW3D_OT_toggle_xray";
1230  ot->description = "Transparent scene display. Allow selecting through items";
1231 
1232  /* api callbacks */
1235 }
1236 
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_active_if_layer_visible(struct Object *ob)
Definition: action.c:720
Camera data-block and utility functions.
struct CameraBGImage * BKE_camera_background_image_new(struct Camera *cam)
Definition: camera.c:1143
void BKE_camera_background_image_remove(struct Camera *cam, struct CameraBGImage *bgpic)
Definition: camera.c:1175
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Definition: context.c:473
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1528
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:784
struct wmMsgBus * CTX_wm_message_bus(const bContext *C)
Definition: context.c:770
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
Definition: context.c:793
void id_us_min(struct ID *id)
Definition: lib_id.c:313
void id_us_plus(struct ID *id)
Definition: lib_id.c:305
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_pose_armature_get(struct Object *ob)
Definition: object.cc:2511
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.c:83
void BKE_scene_cursor_quat_to_rot(struct View3DCursor *cursor, const float quat[4], bool use_compat)
Definition: scene.cc:3647
void BKE_render_resolution(const struct RenderData *r, const bool use_crop, int *r_width, int *r_height)
Definition: scene.cc:2960
void BKE_scene_cursor_rot_to_quat(const struct View3DCursor *cursor, float quat[4])
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
Definition: screen.c:1032
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])
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1287
bool is_negative_m4(const float mat[4][4])
Definition: math_matrix.c:2509
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
Definition: math_matrix.c:739
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 mat3_to_quat(float q[4], const float mat[3][3])
void mul_qt_v3(const float q[4], float r[3])
Definition: math_rotation.c:59
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
Definition: math_rotation.c:46
void copy_qt_qt(float q[4], const float a[4])
Definition: math_rotation.c:33
void quat_to_mat3(float mat[3][3], const float q[4])
void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle)
MINLINE bool equals_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
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])
Definition: math_vector.c:638
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
Definition: math_vector.c:488
MINLINE void negate_v3(float r[3])
MINLINE void zero_v2(float r[2])
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition: BLI_rect.h:194
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition: BLI_rect.h:198
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
#define UNPACK2(a)
#define UNUSED(x)
#define ELEM(...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:834
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition: DNA_ID.h:588
@ ID_IM
Definition: DNA_ID_enums.h:53
@ ID_WO
Definition: DNA_ID_enums.h:59
@ 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
#define R_BORDER
@ SCE_SNAP_TARGET_ALL
@ SCE_SNAP_MODE_FACE_RAYCAST
@ FILE_SORT_DEFAULT
@ FILE_SPECIAL
@ FILE_TYPE_MOVIE
@ FILE_TYPE_FOLDER
@ FILE_TYPE_IMAGE
@ FILE_DEFAULTDISPLAY
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
@ V3D_OVERLAY_BONE_SELECT
#define RV3D_LOCK_FLAGS(rv3d)
#define RV3D_CAMOB
@ RV3D_LOCK_ANY_TRANSFORM
#define RV3D_CLIPPING
@ V3D_SHADING_XRAY_WIREFRAME
@ V3D_SHADING_XRAY
#define V3D_RENDER_BORDER
#define RV3D_PERSP
#define RV3D_CAMZOOM_MIN
#define RV3D_ORTHO
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_PASS_THROUGH
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:729
bool ED_operator_camera_poll(struct bContext *C)
Definition: screen_ops.c:662
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:655
bool ED_operator_view3d_active(struct bContext *C)
Definition: screen_ops.c:225
bool ED_operator_scene_editable(struct bContext *C)
Definition: screen_ops.c:177
bool ED_operator_region_view3d_active(struct bContext *C)
Definition: screen_ops.c:230
void ED_transform_calc_orientation_from_type(const struct bContext *C, float r_mat[3][3])
SnapObjectContext * ED_transform_snap_object_context_create(struct Scene *scene, int flag)
void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx)
eSnapMode ED_transform_snap_object_project_view3d_ex(struct SnapObjectContext *sctx, struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const eSnapMode snap_to, const struct 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, struct Object **r_ob, float r_obmat[4][4], float r_face_nor[3])
void ED_view3d_calc_camera_border_size(const struct Scene *scene, struct Depsgraph *depsgraph, const struct ARegion *region, const struct View3D *v3d, const struct RegionView3D *rv3d, float r_size[2])
@ V3D_PROJ_TEST_NOP
Definition: ED_view3d.h:234
void ED_view3d_win_to_3d_int(const struct View3D *v3d, const struct ARegion *region, const float depth_pt[3], const int mval[2], float r_out[3])
eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
bool ED_operator_rv3d_user_region_poll(struct bContext *C)
Definition: view3d_view.c:277
@ V3D_PROJ_RET_OK
Definition: ED_view3d.h:217
bool ED_view3d_offset_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d)
eV3DCursorOrient
Definition: ED_view3d.h:85
@ V3D_CURSOR_ORIENT_XFORM
Definition: ED_view3d.h:88
@ V3D_CURSOR_ORIENT_GEOM
Definition: ED_view3d.h:89
@ V3D_CURSOR_ORIENT_VIEW
Definition: ED_view3d.h:87
@ V3D_CURSOR_ORIENT_NONE
Definition: ED_view3d.h:86
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3])
void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], const struct ARegion *region, const struct Object *ob, const struct rcti *rect)
void view3d_operator_needs_opengl(const struct bContext *C)
struct RegionView3D * ED_view3d_context_rv3d(struct bContext *C)
Definition: space_view3d.c:82
void ED_view3d_clipping_calc_from_boundbox(float clip[4][4], const struct BoundBox *clipbb, bool is_flip)
void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *area)
Definition: space_view3d.c:223
bool ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_region)
Definition: space_view3d.c:98
void ED_view3d_lock_clear(struct View3D *v3d)
Definition: view3d_utils.c:450
void ED_view3d_calc_camera_border(const struct Scene *scene, struct Depsgraph *depsgraph, const struct ARegion *region, const struct View3D *v3d, const struct RegionView3D *rv3d, struct rctf *r_viewborder, bool no_shift)
float ED_view3d_calc_zfac_ex(const struct RegionView3D *rv3d, const float co[3], bool *r_flip)
bool ED_view3d_autodist(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride, const float fallback_depth_pt[3])
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
#define C
Definition: RandGen.cpp:25
@ WM_FILESEL_RELPATH
Definition: WM_api.h:752
@ WM_FILESEL_FILEPATH
Definition: WM_api.h:755
@ FILE_OPENFILE
Definition: WM_api.h:764
#define ND_WORLD
Definition: WM_types.h:401
@ OPTYPE_INTERNAL
Definition: WM_types.h:168
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define ND_RENDER_OPTIONS
Definition: WM_types.h:383
#define NC_SCENE
Definition: WM_types.h:328
#define NA_EDITED
Definition: WM_types.h:523
#define NC_CAMERA
Definition: WM_types.h:351
@ WM_OP_INVOKE_DEFAULT
Definition: WM_types.h:201
#define ND_SPACE_VIEW3D
Definition: WM_types.h:471
#define NS_VIEW3D_SHADING
Definition: WM_types.h:516
#define NC_SPACE
Definition: WM_types.h:342
#define ND_DRAW_RENDER_VIEWPORT
Definition: WM_types.h:418
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
Scene scene
World world
const Depsgraph * depsgraph
IconTextureDrawCall border
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
static void area(int d1, int d2, int e1, int e2, float weights[2])
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:5271
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2153
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Definition: rna_access.c:2180
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
void * regiondata
float vec[8][3]
struct MovieClip * clip
struct Image * ima
struct ListBase bg_images
short flag
char name[64]
Definition: BKE_armature.h:43
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
Definition: BKE_main.h:121
void * data
void * data
Definition: RNA_types.h:38
float viewquat[4]
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
Definition: DNA_vec_types.h:69
float xmin
Definition: DNA_vec_types.h:69
float ymax
Definition: DNA_vec_types.h:70
float ymin
Definition: DNA_vec_types.h:70
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
int mval[2]
Definition: WM_types.h:684
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:935
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:927
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct ReportList * reports
struct PointerRNA * ptr
void ED_view3d_cursor3d_update(bContext *C, const int mval[2], const bool use_depth, enum eV3DCursorOrient orientation)
Definition: view3d_edit.c:984
static int toggle_xray_exec(bContext *C, wmOperator *op)
Definition: view3d_edit.c:1194
static int view3d_center_lock_exec(bContext *C, wmOperator *UNUSED(op))
Definition: view3d_edit.c:221
static int view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: view3d_edit.c:779
static int background_image_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: view3d_edit.c:570
static int view3d_clipping_exec(bContext *C, wmOperator *op)
Definition: view3d_edit.c:762
static int view3d_cursor3d_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: view3d_edit.c:1057
void ED_view3d_cursor3d_position_rotation(bContext *C, const int mval[2], const bool use_depth, enum eV3DCursorOrient orientation, float cursor_co[3], float cursor_quat[4])
Definition: view3d_edit.c:865
static int background_image_remove_exec(bContext *C, wmOperator *op)
Definition: view3d_edit.c:629
static int view3d_navigate_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
Definition: view3d_edit.c:512
void VIEW3D_OT_view_persportho(wmOperatorType *ot)
Definition: view3d_edit.c:489
static const EnumPropertyItem prop_shading_type_items[]
Definition: view3d_edit.c:1124
static Camera * background_image_camera_from_context(bContext *C)
Definition: view3d_edit.c:548
static int drop_world_exec(bContext *C, wmOperator *op)
Definition: view3d_edit.c:685
static bool view3d_camera_user_poll(bContext *C)
Definition: view3d_edit.c:44
static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
Definition: view3d_edit.c:465
static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op))
Definition: view3d_edit.c:169
void VIEW3D_OT_toggle_xray(wmOperatorType *ot)
Definition: view3d_edit.c:1225
static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op))
Definition: view3d_edit.c:426
void VIEW3D_OT_view_center_camera(wmOperatorType *ot)
Definition: view3d_edit.c:200
void VIEW3D_OT_view_center_lock(wmOperatorType *ot)
Definition: view3d_edit.c:232
void VIEW3D_OT_zoom_camera_1_to_1(wmOperatorType *ot)
Definition: view3d_edit.c:444
void VIEW3D_OT_clip_border(wmOperatorType *ot)
Definition: view3d_edit.c:793
static int view_lock_to_active_exec(bContext *C, wmOperator *UNUSED(op))
Definition: view3d_edit.c:112
static int background_image_add_exec(bContext *C, wmOperator *UNUSED(op))
Definition: view3d_edit.c:562
static int toggle_shading_exec(bContext *C, wmOperator *op)
Definition: view3d_edit.c:1132
void VIEW3D_OT_view_lock_to_active(wmOperatorType *ot)
Definition: view3d_edit.c:147
static void view3d_set_1_to_1_viewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, View3D *v3d)
Definition: view3d_edit.c:409
void VIEW3D_OT_cursor3d(wmOperatorType *ot)
Definition: view3d_edit.c:1076
void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
Definition: view3d_edit.c:755
void VIEW3D_OT_clear_render_border(wmOperatorType *ot)
Definition: view3d_edit.c:386
void VIEW3D_OT_background_image_add(wmOperatorType *ot)
Definition: view3d_edit.c:595
void VIEW3D_OT_view_lock_clear(wmOperatorType *ot)
Definition: view3d_edit.c:90
void VIEW3D_OT_navigate(wmOperatorType *ot)
Definition: view3d_edit.c:529
static bool background_image_add_poll(bContext *C)
Definition: view3d_edit.c:590
static void calc_local_clipping(float clip_local[6][4], const BoundBox *clipbb, const float mat[4][4])
Definition: view3d_edit.c:739
static int view_lock_clear_exec(bContext *C, wmOperator *UNUSED(op))
Definition: view3d_edit.c:75
static int render_border_exec(bContext *C, wmOperator *op)
Definition: view3d_edit.c:253
void ED_view3d_cursor3d_position(bContext *C, const int mval[2], const bool use_depth, float cursor_co[3])
Definition: view3d_edit.c:823
static int clear_render_border_exec(bContext *C, wmOperator *UNUSED(op))
Definition: view3d_edit.c:354
void VIEW3D_OT_render_border(wmOperatorType *ot)
Definition: view3d_edit.c:326
static bool drop_world_poll(bContext *C)
Definition: view3d_edit.c:708
static bool view3d_lock_poll(bContext *C)
Definition: view3d_edit.c:59
void VIEW3D_OT_background_image_remove(wmOperatorType *ot)
Definition: view3d_edit.c:660
void VIEW3D_OT_toggle_shading(wmOperatorType *ot)
Definition: view3d_edit.c:1170
void VIEW3D_OT_drop_world(wmOperatorType *ot)
Definition: view3d_edit.c:713
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.c:3479
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(struct wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params)
void WM_operator_properties_border_to_rcti(struct wmOperator *op, rcti *rect)
ID * WM_operator_properties_id_lookup_from_name_or_session_uuid(Main *bmain, PointerRNA *ptr, const ID_Type type)
void WM_operator_properties_border(wmOperatorType *ot)
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
void WM_operator_properties_id_lookup(wmOperatorType *ot, const bool add_name_prop)
ID * WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short idcode)