Blender  V3.3
space_view3d.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 
8 #include <stdio.h>
9 #include <string.h>
10 
11 #include "DNA_collection_types.h"
12 #include "DNA_defaults.h"
13 #include "DNA_gpencil_types.h"
14 #include "DNA_lightprobe_types.h"
15 #include "DNA_material_types.h"
16 #include "DNA_object_types.h"
17 #include "DNA_scene_types.h"
18 #include "DNA_view3d_types.h"
19 
20 #include "MEM_guardedalloc.h"
21 
22 #include "BLI_blenlib.h"
23 #include "BLI_math.h"
24 #include "BLI_utildefines.h"
25 
26 #include "BLT_translation.h"
27 
28 #include "BKE_asset.h"
29 #include "BKE_context.h"
30 #include "BKE_curve.h"
31 #include "BKE_global.h"
32 #include "BKE_icons.h"
33 #include "BKE_idprop.h"
34 #include "BKE_lattice.h"
35 #include "BKE_layer.h"
36 #include "BKE_lib_remap.h"
37 #include "BKE_main.h"
38 #include "BKE_mball.h"
39 #include "BKE_mesh.h"
40 #include "BKE_object.h"
41 #include "BKE_scene.h"
42 #include "BKE_screen.h"
43 #include "BKE_workspace.h"
44 
45 #include "ED_object.h"
46 #include "ED_outliner.h"
47 #include "ED_render.h"
48 #include "ED_screen.h"
49 #include "ED_space_api.h"
50 #include "ED_transform.h"
51 #include "ED_undo.h"
52 
53 #include "GPU_matrix.h"
54 
55 #include "DRW_engine.h"
56 
57 #include "WM_api.h"
58 #include "WM_message.h"
59 #include "WM_toolsystem.h"
60 #include "WM_types.h"
61 
62 #include "RE_engine.h"
63 #include "RE_pipeline.h"
64 
65 #include "RNA_access.h"
66 
67 #include "UI_interface.h"
68 #include "UI_resources.h"
69 
70 #ifdef WITH_PYTHON
71 # include "BPY_extern.h"
72 #endif
73 
74 #include "DEG_depsgraph.h"
75 #include "DEG_depsgraph_build.h"
76 
77 #include "view3d_intern.h" /* own include */
78 #include "view3d_navigate.h"
79 
80 /* ******************** manage regions ********************* */
81 
83 {
85 
86  if (rv3d == NULL) {
88  if (area && area->spacetype == SPACE_VIEW3D) {
90  if (region) {
91  rv3d = region->regiondata;
92  }
93  }
94  }
95  return rv3d;
96 }
97 
99 {
101 
102  *r_v3d = NULL;
103  *r_region = NULL;
104 
105  if (area && area->spacetype == SPACE_VIEW3D) {
106  ARegion *region = CTX_wm_region(C);
107  View3D *v3d = (View3D *)area->spacedata.first;
108 
109  if (region) {
110  RegionView3D *rv3d;
111  if ((region->regiontype == RGN_TYPE_WINDOW) && (rv3d = region->regiondata) &&
112  (rv3d->viewlock & RV3D_LOCK_ROTATION) == 0) {
113  *r_v3d = v3d;
114  *r_region = region;
115  return true;
116  }
117 
118  if (ED_view3d_area_user_region(area, v3d, r_region)) {
119  *r_v3d = v3d;
120  return true;
121  }
122  }
123  }
124 
125  return false;
126 }
127 
128 bool ED_view3d_area_user_region(const ScrArea *area, const View3D *v3d, ARegion **r_region)
129 {
130  RegionView3D *rv3d = NULL;
131  ARegion *region_unlock_user = NULL;
132  ARegion *region_unlock = NULL;
133  const ListBase *region_list = (v3d == area->spacedata.first) ? &area->regionbase :
134  &v3d->regionbase;
135 
137 
138  LISTBASE_FOREACH (ARegion *, region, region_list) {
139  /* find the first unlocked rv3d */
140  if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) {
141  rv3d = region->regiondata;
142  if ((rv3d->viewlock & RV3D_LOCK_ROTATION) == 0) {
143  region_unlock = region;
144  if (ELEM(rv3d->persp, RV3D_PERSP, RV3D_CAMOB)) {
145  region_unlock_user = region;
146  break;
147  }
148  }
149  }
150  }
151 
152  /* camera/perspective view get priority when the active region is locked */
153  if (region_unlock_user) {
154  *r_region = region_unlock_user;
155  return true;
156  }
157 
158  if (region_unlock) {
159  *r_region = region_unlock;
160  return true;
161  }
162 
163  return false;
164 }
165 
166 void ED_view3d_init_mats_rv3d(const struct Object *ob, struct RegionView3D *rv3d)
167 {
168  /* local viewmat and persmat, to calculate projections */
169  mul_m4_m4m4(rv3d->viewmatob, rv3d->viewmat, ob->obmat);
170  mul_m4_m4m4(rv3d->persmatob, rv3d->persmat, ob->obmat);
171 
172  /* initializes object space clipping, speeds up clip tests */
173  ED_view3d_clipping_local(rv3d, ob->obmat);
174 }
175 
176 void ED_view3d_init_mats_rv3d_gl(const struct Object *ob, struct RegionView3D *rv3d)
177 {
178  ED_view3d_init_mats_rv3d(ob, rv3d);
179 
180  /* we have to multiply instead of loading viewmatob to make
181  * it work with duplis using displists, otherwise it will
182  * override the dupli-matrix */
183  GPU_matrix_mul(ob->obmat);
184 }
185 
186 #ifdef DEBUG
187 void ED_view3d_clear_mats_rv3d(struct RegionView3D *rv3d)
188 {
189  zero_m4(rv3d->viewmatob);
190  zero_m4(rv3d->persmatob);
191 }
192 
193 void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d)
194 {
197 }
198 #endif
199 
201 {
202  RegionView3D *rv3d = region->regiondata;
203 
204  if (rv3d->render_engine) {
205 #ifdef WITH_PYTHON
207 #endif
208 
210 
211 #ifdef WITH_PYTHON
213 #endif
214 
216  rv3d->render_engine = NULL;
217  }
218 
219  /* A bit overkill but this make sure the viewport is reset completely. (fclem) */
220  WM_draw_region_free(region, false);
221 }
222 
224 {
225  wmWindowManager *wm = bmain->wm.first;
226 
227  if (v3d->shading.type != OB_RENDER) {
228  ARegion *region;
229 
230  for (region = area->regionbase.first; region; region = region->next) {
231  if ((region->regiontype == RGN_TYPE_WINDOW) && region->regiondata) {
232  ED_view3d_stop_render_preview(wm, region);
233  }
234  }
235  }
236 }
237 
238 /* ******************** default callbacks for view3d space ***************** */
239 
241 {
242  ARegion *region;
243  View3D *v3d;
244  RegionView3D *rv3d;
245 
247 
248  if (scene) {
249  v3d->camera = scene->camera;
250  }
251 
252  /* header */
253  region = MEM_callocN(sizeof(ARegion), "header for view3d");
254 
255  BLI_addtail(&v3d->regionbase, region);
256  region->regiontype = RGN_TYPE_HEADER;
258 
259  /* tool header */
260  region = MEM_callocN(sizeof(ARegion), "tool header for view3d");
261 
262  BLI_addtail(&v3d->regionbase, region);
266 
267  /* tool shelf */
268  region = MEM_callocN(sizeof(ARegion), "toolshelf for view3d");
269 
270  BLI_addtail(&v3d->regionbase, region);
271  region->regiontype = RGN_TYPE_TOOLS;
272  region->alignment = RGN_ALIGN_LEFT;
273  region->flag = RGN_FLAG_HIDDEN;
274 
275  /* buttons/list view */
276  region = MEM_callocN(sizeof(ARegion), "buttons for view3d");
277 
278  BLI_addtail(&v3d->regionbase, region);
279  region->regiontype = RGN_TYPE_UI;
280  region->alignment = RGN_ALIGN_RIGHT;
281  region->flag = RGN_FLAG_HIDDEN;
282 
283  /* main region */
284  region = MEM_callocN(sizeof(ARegion), "main region for view3d");
285 
286  BLI_addtail(&v3d->regionbase, region);
287  region->regiontype = RGN_TYPE_WINDOW;
288 
289  region->regiondata = MEM_callocN(sizeof(RegionView3D), "region view3d");
290  rv3d = region->regiondata;
291  rv3d->viewquat[0] = 1.0f;
292  rv3d->persp = RV3D_PERSP;
293  rv3d->view = RV3D_VIEW_USER;
294  rv3d->dist = 10.0;
295 
296  return (SpaceLink *)v3d;
297 }
298 
299 /* not spacelink itself */
300 static void view3d_free(SpaceLink *sl)
301 {
302  View3D *vd = (View3D *)sl;
303 
304  if (vd->localvd) {
305  MEM_freeN(vd->localvd);
306  }
307 
309 
310  if (vd->runtime.properties_storage) {
312  }
313 
314  if (vd->shading.prop) {
316  vd->shading.prop = NULL;
317  }
318 }
319 
320 /* spacetype; init callback */
322 {
323 }
324 
326 {
327  BLI_assert(area->spacetype == SPACE_VIEW3D);
328  View3D *v3d = area->spacedata.first;
330 }
331 
333 {
334  View3D *v3do = (View3D *)sl;
335  View3D *v3dn = MEM_dupallocN(sl);
336 
337  memset(&v3dn->runtime, 0x0, sizeof(v3dn->runtime));
338 
339  /* clear or remove stuff from old */
340 
341  if (v3dn->localvd) {
342  v3dn->localvd = NULL;
343  }
344 
345  v3dn->local_collections_uuid = 0;
347 
348  if (v3dn->shading.type == OB_RENDER) {
349  v3dn->shading.type = OB_SOLID;
350  }
351 
352  if (v3dn->shading.prop) {
353  v3dn->shading.prop = IDP_CopyProperty(v3do->shading.prop);
354  }
355 
356  /* copy or clear inside new stuff */
357 
358  return (SpaceLink *)v3dn;
359 }
360 
361 /* add handlers, stuff you only do once or on area/region changes */
363 {
364  ListBase *lb;
365  wmKeyMap *keymap;
366 
367  /* object ops. */
368 
369  /* important to be before Pose keymap since they can both be enabled at once */
370  keymap = WM_keymap_ensure(wm->defaultconf, "Paint Face Mask (Weight, Vertex, Texture)", 0, 0);
371  WM_event_add_keymap_handler(&region->handlers, keymap);
372 
373  keymap = WM_keymap_ensure(wm->defaultconf, "Paint Vertex Selection (Weight, Vertex)", 0, 0);
374  WM_event_add_keymap_handler(&region->handlers, keymap);
375 
376  /* Before 'Weight/Vertex Paint' so adding curve points is not overridden. */
377  keymap = WM_keymap_ensure(wm->defaultconf, "Paint Curve", 0, 0);
378  WM_event_add_keymap_handler(&region->handlers, keymap);
379 
380  /* Before 'Pose' so weight paint menus aren't overridden by pose menus. */
381  keymap = WM_keymap_ensure(wm->defaultconf, "Weight Paint", 0, 0);
382  WM_event_add_keymap_handler(&region->handlers, keymap);
383 
384  keymap = WM_keymap_ensure(wm->defaultconf, "Vertex Paint", 0, 0);
385  WM_event_add_keymap_handler(&region->handlers, keymap);
386 
387  /* pose is not modal, operator poll checks for this */
388  keymap = WM_keymap_ensure(wm->defaultconf, "Pose", 0, 0);
389  WM_event_add_keymap_handler(&region->handlers, keymap);
390 
391  keymap = WM_keymap_ensure(wm->defaultconf, "Object Mode", 0, 0);
392  WM_event_add_keymap_handler(&region->handlers, keymap);
393 
394  keymap = WM_keymap_ensure(wm->defaultconf, "Curve", 0, 0);
395  WM_event_add_keymap_handler(&region->handlers, keymap);
396 
397  keymap = WM_keymap_ensure(wm->defaultconf, "Image Paint", 0, 0);
398  WM_event_add_keymap_handler(&region->handlers, keymap);
399 
400  keymap = WM_keymap_ensure(wm->defaultconf, "Sculpt", 0, 0);
401  WM_event_add_keymap_handler(&region->handlers, keymap);
402 
403  keymap = WM_keymap_ensure(wm->defaultconf, "Mesh", 0, 0);
404  WM_event_add_keymap_handler(&region->handlers, keymap);
405 
406  keymap = WM_keymap_ensure(wm->defaultconf, "Armature", 0, 0);
407  WM_event_add_keymap_handler(&region->handlers, keymap);
408 
409  keymap = WM_keymap_ensure(wm->defaultconf, "Metaball", 0, 0);
410  WM_event_add_keymap_handler(&region->handlers, keymap);
411 
412  keymap = WM_keymap_ensure(wm->defaultconf, "Lattice", 0, 0);
413  WM_event_add_keymap_handler(&region->handlers, keymap);
414 
415  keymap = WM_keymap_ensure(wm->defaultconf, "Particle", 0, 0);
416  WM_event_add_keymap_handler(&region->handlers, keymap);
417 
418  keymap = WM_keymap_ensure(wm->defaultconf, "Sculpt Curves", 0, 0);
419  WM_event_add_keymap_handler(&region->handlers, keymap);
420 
421  /* editfont keymap swallows all... */
422  keymap = WM_keymap_ensure(wm->defaultconf, "Font", 0, 0);
423  WM_event_add_keymap_handler(&region->handlers, keymap);
424 
425  keymap = WM_keymap_ensure(wm->defaultconf, "Object Non-modal", 0, 0);
426  WM_event_add_keymap_handler(&region->handlers, keymap);
427 
428  keymap = WM_keymap_ensure(wm->defaultconf, "Frames", 0, 0);
429  WM_event_add_keymap_handler(&region->handlers, keymap);
430 
431  /* own keymap, last so modes can override it */
432  keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
433  WM_event_add_keymap_handler(&region->handlers, keymap);
434 
435  keymap = WM_keymap_ensure(wm->defaultconf, "3D View", SPACE_VIEW3D, 0);
436  WM_event_add_keymap_handler(&region->handlers, keymap);
437 
438  /* add drop boxes */
440 
442 }
443 
445 {
446  ED_view3d_stop_render_preview(wm, region);
447 }
448 
450 {
452  return ED_region_overlap_isect_any_xy(area, event->xy) == false;
453 }
454 
456  wmDrag *drag,
457  const wmEvent *event)
458 {
459  const ScrArea *area = CTX_wm_area(C);
460 
461  if (ED_region_overlap_isect_any_xy(area, event->xy)) {
462  return 0;
463  }
464  if (!view3d_drop_in_main_region_poll(C, event)) {
465  return 0;
466  }
467 
468  ID *local_id = WM_drag_get_local_ID(drag, 0);
469  if (local_id) {
470  return GS(local_id->name);
471  }
472 
473  wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
474  if (asset_drag) {
475  return asset_drag->id_type;
476  }
477 
478  return 0;
479 }
480 
482  wmDrag *drag,
483  const wmEvent *event,
484  ID_Type id_type)
485 {
486  if (!view3d_drop_in_main_region_poll(C, event)) {
487  return false;
488  }
489 
490  return WM_drag_is_ID_type(drag, id_type);
491 }
492 
493 static void view3d_ob_drop_draw_activate(struct wmDropBox *drop, wmDrag *drag)
494 {
496  if (state) {
497  return;
498  }
499 
500  /* Don't use the snap cursor when linking the object. Object transform isn't editable then and
501  * would be reset on reload. */
503  return;
504  }
505 
507  state->draw_plane = true;
508 
509  float dimensions[3] = {0.0f};
510  if (drag->type == WM_DRAG_ID) {
511  Object *ob = (Object *)WM_drag_get_local_ID(drag, ID_OB);
512  BKE_object_dimensions_get(ob, dimensions);
513  }
514  else {
515  struct AssetMetaData *meta_data = WM_drag_get_asset_meta_data(drag, ID_OB);
516  IDProperty *dimensions_prop = BKE_asset_metadata_idprop_find(meta_data, "dimensions");
517  if (dimensions_prop) {
518  copy_v3_v3(dimensions, IDP_Array(dimensions_prop));
519  }
520  }
521 
522  if (!is_zero_v3(dimensions)) {
523  mul_v3_v3fl(state->box_dimensions, dimensions, 0.5f);
525  state->draw_box = true;
526  }
527 }
528 
529 static void view3d_ob_drop_draw_deactivate(struct wmDropBox *drop, wmDrag *UNUSED(drag))
530 {
532  if (state) {
534  drop->draw_data = NULL;
535  }
536 }
537 
538 static bool view3d_ob_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
539 {
540  return view3d_drop_id_in_main_region_poll(C, drag, event, ID_OB);
541 }
542 static bool view3d_ob_drop_poll_external_asset(bContext *C, wmDrag *drag, const wmEvent *event)
543 {
544  if (!view3d_ob_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ASSET)) {
545  return false;
546  }
547  return true;
548 }
549 
554 static bool view3d_ob_drop_poll_local_id(bContext *C, wmDrag *drag, const wmEvent *event)
555 {
556  if (!view3d_ob_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ID)) {
557  return false;
558  }
559  return true;
560 }
561 
562 static bool view3d_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
563 {
564  return view3d_drop_id_in_main_region_poll(C, drag, event, ID_GR);
565 }
566 
568 {
569  if (!view3d_collection_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ID)) {
570  return false;
571  }
572  return true;
573 }
574 
576  wmDrag *drag,
577  const wmEvent *event)
578 {
579  if (!view3d_collection_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ASSET)) {
580  return false;
581  }
582  return true;
583 }
584 
585 static bool view3d_mat_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
586 {
587  return view3d_drop_id_in_main_region_poll(C, drag, event, ID_MA);
588 }
589 
591  wmDrag *drag,
592  const int xy[2],
593  wmDropBox *UNUSED(drop))
594 {
595  const char *name = WM_drag_get_item_name(drag);
596  ARegion *region = CTX_wm_region(C);
597  const int mval[2] = {
598  xy[0] - region->winrct.xmin,
599  xy[1] - region->winrct.ymin,
600  };
601  return ED_object_ot_drop_named_material_tooltip(C, name, mval);
602 }
603 
604 static bool view3d_world_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
605 {
606  return view3d_drop_id_in_main_region_poll(C, drag, event, ID_WO);
607 }
608 
609 static bool view3d_object_data_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
610 {
612  if (id_type && OB_DATA_SUPPORT_ID(id_type)) {
613  return true;
614  }
615  return false;
616 }
617 
619  wmDrag *UNUSED(drag),
620  const int UNUSED(xy[2]),
621  wmDropBox *UNUSED(drop))
622 {
623  return BLI_strdup(TIP_("Create object instance from object-data"));
624 }
625 
626 static bool view3d_ima_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
627 {
629  return false;
630  }
631  if (drag->type == WM_DRAG_PATH) {
632  /* rule might not work? */
633  return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE));
634  }
635 
636  return WM_drag_is_ID_type(drag, ID_IM);
637 }
638 
640 {
642  if ((rv3d && (rv3d->persp == RV3D_CAMOB))) {
643  View3D *v3d = CTX_wm_view3d(C);
644  if (v3d && v3d->camera && v3d->camera->type == OB_CAMERA) {
645  return true;
646  }
647  }
648  return false;
649 }
650 
651 static bool view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
652 {
653  if (!view3d_ima_drop_poll(C, drag, event)) {
654  return false;
655  }
656 
657  if (ED_view3d_is_object_under_cursor(C, event->mval)) {
658  return false;
659  }
660 
662 }
663 
664 static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
665 {
666  if (!view3d_ima_drop_poll(C, drag, event)) {
667  return false;
668  }
669 
671 
672  if (ob == NULL) {
673  return true;
674  }
675 
676  if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) {
677  return true;
678  }
679 
680  return false;
681 }
682 
684  wmDrag *drag,
685  const wmEvent *UNUSED(event))
686 {
687  return (drag->type == WM_DRAG_PATH) && (drag->icon == ICON_FILE_VOLUME);
688 }
689 
691  Object *ob,
692  float obmat_final[4][4])
693 {
695  BLI_assert(snap_state->draw_box || snap_state->draw_plane);
696  UNUSED_VARS_NDEBUG(snap_state);
697  copy_m4_m3(obmat_final, snap_data->plane_omat);
698  copy_v3_v3(obmat_final[3], snap_data->loc);
699 
700  float scale[3];
701  mat4_to_size(scale, ob->obmat);
702  rescale_m4(obmat_final, scale);
703 
704  const BoundBox *bb = BKE_object_boundbox_get(ob);
705  if (bb) {
706  float offset[3];
708  offset[2] = bb->vec[0][2];
709  mul_mat3_m4_v3(obmat_final, offset);
710  sub_v3_v3(obmat_final[3], offset);
711  }
712 }
713 
715 {
716  ID *id = WM_drag_get_local_ID(drag, ID_OB);
717 
718  RNA_int_set(drop->ptr, "session_uuid", id->session_uuid);
719  /* Don't duplicate ID's which were just imported. Only do that for existing, local IDs. */
720  BLI_assert(drag->type != WM_DRAG_ASSET);
721 
723  float obmat_final[4][4];
724 
725  view3d_ob_drop_matrix_from_snap(snap_state, (Object *)id, obmat_final);
726 
727  RNA_float_set_array(drop->ptr, "matrix", &obmat_final[0][0]);
728 }
729 
730 /* Mostly the same logic as #view3d_collection_drop_copy_external_asset(), just different enough to
731  * make sharing code a bit difficult. */
733 {
734  /* NOTE(@campbellbarton): Selection is handled here, de-selecting objects before append,
735  * using auto-select to ensure the new objects are selected.
736  * This is done so #OBJECT_OT_transform_to_mouse (which runs after this drop handler)
737  * can use the context setup here to place the objects. */
738  BLI_assert(drag->type == WM_DRAG_ASSET);
739 
740  wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
741  bContext *C = asset_drag->evil_C;
743  ViewLayer *view_layer = CTX_data_view_layer(C);
744 
746 
747  ID *id = WM_drag_asset_id_import(asset_drag, FILE_AUTOSELECT);
748 
749  /* TODO(sergey): Only update relations for the current scene. */
752 
753  RNA_int_set(drop->ptr, "session_uuid", id->session_uuid);
754 
755  Base *base = BKE_view_layer_base_find(view_layer, (Object *)id);
756  if (base != NULL) {
759  }
762 
763  V3DSnapCursorState *snap_state = drop->draw_data;
764  if (snap_state) {
765  float obmat_final[4][4];
766 
767  view3d_ob_drop_matrix_from_snap(snap_state, (Object *)id, obmat_final);
768 
769  RNA_float_set_array(drop->ptr, "matrix", &obmat_final[0][0]);
770  }
771 }
772 
774  wmDrag *drag,
775  wmDropBox *drop)
776 {
777  ID *id = WM_drag_get_local_ID(drag, ID_GR);
778  RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
779 }
780 
781 /* Mostly the same logic as #view3d_ob_drop_copy_external_asset(), just different enough to make
782  * sharing code a bit difficult. */
784  wmDrag *drag,
785  wmDropBox *drop)
786 {
787  BLI_assert(drag->type == WM_DRAG_ASSET);
788 
789  wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
790  bContext *C = asset_drag->evil_C;
792  ViewLayer *view_layer = CTX_data_view_layer(C);
793 
795 
796  ID *id = WM_drag_asset_id_import(asset_drag, FILE_AUTOSELECT);
797  Collection *collection = (Collection *)id;
798 
799  /* TODO(sergey): Only update relations for the current scene. */
802 
803  RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
804 
805  /* Make an object active, just use the first one in the collection. */
806  CollectionObject *cobject = collection->gobject.first;
807  Base *base = cobject ? BKE_view_layer_base_find(view_layer, cobject->ob) : NULL;
808  if (base) {
809  BLI_assert((base->flag & BASE_SELECTABLE) && (base->flag & BASE_ENABLED_VIEWPORT));
812  }
815 
816  /* XXX Without an undo push here, there will be a crash when the user modifies operator
817  * properties. The stuff we do in these drop callbacks just isn't safe over undo/redo. */
818  ED_undo_push(C, "Collection_Drop");
819 }
820 
821 static void view3d_id_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
822 {
824 
826 }
827 
829 {
831 
832  RNA_enum_set(drop->ptr, "type", GS(id->name));
834 }
835 
837 {
839 
840  if (id) {
842  RNA_struct_property_unset(drop->ptr, "filepath");
843  }
844  else if (drag->path[0]) {
845  RNA_string_set(drop->ptr, "filepath", drag->path);
846  RNA_struct_property_unset(drop->ptr, "image");
847  }
848 }
849 
851 {
852  PointerRNA op_ptr;
853 
855 
857  /* Only do auto bake if eevee is the active engine */
858  return;
859  }
860 
861  wmOperatorType *ot = WM_operatortype_find("SCENE_OT_light_cache_bake", true);
863  RNA_int_set(&op_ptr, "delay", 200);
864  RNA_enum_set_identifier(C, &op_ptr, "subset", "DIRTY");
865 
867 
869 }
870 
871 /* region dropbox definition */
872 static void view3d_dropboxes(void)
873 {
875 
876  struct wmDropBox *drop;
877  drop = WM_dropbox_add(lb,
878  "OBJECT_OT_add_named",
882  NULL);
883 
887 
888  drop = WM_dropbox_add(lb,
889  "OBJECT_OT_transform_to_mouse",
893  NULL);
894 
898 
899  WM_dropbox_add(lb,
900  "OBJECT_OT_collection_external_asset_drop",
904  NULL);
905  WM_dropbox_add(lb,
906  "OBJECT_OT_collection_instance_add",
910  NULL);
911 
912  WM_dropbox_add(lb,
913  "OBJECT_OT_drop_named_material",
918  WM_dropbox_add(lb,
919  "VIEW3D_OT_background_image_add",
923  NULL);
924  WM_dropbox_add(lb,
925  "OBJECT_OT_drop_named_image",
929  NULL);
930  WM_dropbox_add(lb,
931  "OBJECT_OT_volume_import",
935  NULL);
936  WM_dropbox_add(lb,
937  "OBJECT_OT_data_instance_add",
942  WM_dropbox_add(lb,
943  "VIEW3D_OT_drop_world",
947  NULL);
948 }
949 
950 static void view3d_widgets(void)
951 {
954 
963  /* TODO(campbell): Not working well enough, disable for now. */
964 #if 0
966 #endif
967 
976 
979 
981 
984 }
985 
986 /* type callback, not region itself */
987 static void view3d_main_region_free(ARegion *region)
988 {
989  RegionView3D *rv3d = region->regiondata;
990 
991  if (rv3d) {
992  if (rv3d->localvd) {
993  MEM_freeN(rv3d->localvd);
994  }
995  if (rv3d->clipbb) {
996  MEM_freeN(rv3d->clipbb);
997  }
998 
999  if (rv3d->render_engine) {
1001  }
1002 
1003  if (rv3d->sms) {
1004  MEM_freeN(rv3d->sms);
1005  }
1006 
1007  MEM_freeN(rv3d);
1008  region->regiondata = NULL;
1009  }
1010 }
1011 
1012 /* copy regiondata */
1013 static void *view3d_main_region_duplicate(void *poin)
1014 {
1015  if (poin) {
1016  RegionView3D *rv3d = poin, *new;
1017 
1018  new = MEM_dupallocN(rv3d);
1019  if (rv3d->localvd) {
1020  new->localvd = MEM_dupallocN(rv3d->localvd);
1021  }
1022  if (rv3d->clipbb) {
1023  new->clipbb = MEM_dupallocN(rv3d->clipbb);
1024  }
1025 
1026  new->render_engine = NULL;
1027  new->sms = NULL;
1028  new->smooth_timer = NULL;
1029 
1030  return new;
1031  }
1032  return NULL;
1033 }
1034 
1036 {
1037  wmWindow *window = params->window;
1038  ScrArea *area = params->area;
1039  ARegion *region = params->region;
1040  wmNotifier *wmn = params->notifier;
1041  const Scene *scene = params->scene;
1042  View3D *v3d = area->spacedata.first;
1043  RegionView3D *rv3d = region->regiondata;
1044  wmGizmoMap *gzmap = region->gizmo_map;
1045 
1046  /* context changes */
1047  switch (wmn->category) {
1048  case NC_WM:
1049  if (ELEM(wmn->data, ND_UNDO)) {
1050  WM_gizmomap_tag_refresh(gzmap);
1051  }
1052  else if (ELEM(wmn->data, ND_XR_DATA_CHANGED)) {
1053  /* Only cause a redraw if this a VR session mirror. Should more features be added that
1054  * require redraws, we could pass something to wmn->reference, e.g. the flag value. */
1055  if (v3d->flag & V3D_XR_SESSION_MIRROR) {
1056  ED_region_tag_redraw(region);
1057  }
1058  }
1059  break;
1060  case NC_ANIMATION:
1061  switch (wmn->data) {
1062  case ND_KEYFRAME_PROP:
1063  case ND_NLA_ACTCHANGE:
1064  ED_region_tag_redraw(region);
1065  break;
1066  case ND_NLA:
1067  case ND_KEYFRAME:
1068  if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) {
1069  ED_region_tag_redraw(region);
1070  }
1071  break;
1072  case ND_ANIMCHAN:
1074  ED_region_tag_redraw(region);
1075  }
1076  break;
1077  }
1078  break;
1079  case NC_SCENE:
1080  switch (wmn->data) {
1081  case ND_SCENEBROWSE:
1082  case ND_LAYER_CONTENT:
1083  ED_region_tag_redraw(region);
1084  WM_gizmomap_tag_refresh(gzmap);
1085  break;
1086  case ND_LAYER:
1087  if (wmn->reference) {
1088  BKE_screen_view3d_sync(v3d, wmn->reference);
1089  }
1090  ED_region_tag_redraw(region);
1091  WM_gizmomap_tag_refresh(gzmap);
1092  break;
1093  case ND_OB_ACTIVE:
1094  case ND_OB_SELECT:
1096  case ND_FRAME:
1097  case ND_TRANSFORM:
1098  case ND_OB_VISIBLE:
1099  case ND_RENDER_OPTIONS:
1100  case ND_MARKERS:
1101  case ND_MODE:
1102  ED_region_tag_redraw(region);
1103  WM_gizmomap_tag_refresh(gzmap);
1104  break;
1105  case ND_WORLD:
1106  /* handled by space_view3d_listener() for v3d access */
1107  break;
1108  case ND_DRAW_RENDER_VIEWPORT: {
1109  if (v3d->camera && (scene == wmn->reference)) {
1110  if (rv3d->persp == RV3D_CAMOB) {
1111  ED_region_tag_redraw(region);
1112  }
1113  }
1114  break;
1115  }
1116  }
1117  if (wmn->action == NA_EDITED) {
1118  ED_region_tag_redraw(region);
1119  }
1120  break;
1121  case NC_OBJECT:
1122  switch (wmn->data) {
1123  case ND_BONE_ACTIVE:
1124  case ND_BONE_SELECT:
1125  case ND_TRANSFORM:
1126  case ND_POSE:
1127  case ND_DRAW:
1128  case ND_MODIFIER:
1129  case ND_SHADERFX:
1130  case ND_CONSTRAINT:
1131  case ND_KEYS:
1132  case ND_PARTICLE:
1133  case ND_POINTCACHE:
1134  case ND_LOD:
1135  ED_region_tag_redraw(region);
1136  WM_gizmomap_tag_refresh(gzmap);
1137  break;
1138  case ND_DRAW_ANIMVIZ:
1139  ED_region_tag_redraw(region);
1140  break;
1141  }
1142  switch (wmn->action) {
1143  case NA_ADDED:
1144  ED_region_tag_redraw(region);
1145  break;
1146  }
1147  break;
1148  case NC_GEOM:
1149  switch (wmn->data) {
1150  case ND_SELECT: {
1151  WM_gizmomap_tag_refresh(gzmap);
1153  }
1154  case ND_DATA:
1155  ED_region_tag_redraw(region);
1156  WM_gizmomap_tag_refresh(gzmap);
1157  break;
1158  case ND_VERTEX_GROUP:
1159  ED_region_tag_redraw(region);
1160  break;
1161  }
1162  switch (wmn->action) {
1163  case NA_EDITED:
1164  ED_region_tag_redraw(region);
1165  break;
1166  }
1167  break;
1168  case NC_CAMERA:
1169  switch (wmn->data) {
1170  case ND_DRAW_RENDER_VIEWPORT: {
1171  if (v3d->camera && (v3d->camera->data == wmn->reference)) {
1172  if (rv3d->persp == RV3D_CAMOB) {
1173  ED_region_tag_redraw(region);
1174  }
1175  }
1176  break;
1177  }
1178  }
1179  break;
1180  case NC_GROUP:
1181  /* all group ops for now */
1182  ED_region_tag_redraw(region);
1183  break;
1184  case NC_BRUSH:
1185  switch (wmn->action) {
1186  case NA_EDITED:
1188  break;
1189  case NA_SELECTED:
1190  /* used on brush changes - needed because 3d cursor
1191  * has to be drawn if clone brush is selected */
1192  ED_region_tag_redraw(region);
1193  break;
1194  }
1195  break;
1196  case NC_MATERIAL:
1197  switch (wmn->data) {
1198  case ND_SHADING:
1199  case ND_NODES:
1200  /* TODO(sergey): This is a bit too much updates, but needed to
1201  * have proper material drivers update in the viewport.
1202  *
1203  * How to solve?
1204  */
1205  ED_region_tag_redraw(region);
1206  break;
1207  case ND_SHADING_DRAW:
1208  case ND_SHADING_LINKS:
1209  ED_region_tag_redraw(region);
1210  break;
1211  }
1212  break;
1213  case NC_WORLD:
1214  switch (wmn->data) {
1215  case ND_WORLD_DRAW:
1216  /* handled by space_view3d_listener() for v3d access */
1217  break;
1218  case ND_WORLD:
1219  /* Needed for updating world materials */
1220  ED_region_tag_redraw(region);
1221  break;
1222  }
1223  break;
1224  case NC_LAMP:
1225  switch (wmn->data) {
1226  case ND_LIGHTING:
1227  /* TODO(sergey): This is a bit too much, but needed to
1228  * handle updates from new depsgraph.
1229  */
1230  ED_region_tag_redraw(region);
1231  break;
1232  case ND_LIGHTING_DRAW:
1233  ED_region_tag_redraw(region);
1234  WM_gizmomap_tag_refresh(gzmap);
1235  break;
1236  }
1237  break;
1238  case NC_LIGHTPROBE:
1240  break;
1241  case NC_IMAGE:
1242  /* this could be more fine grained checks if we had
1243  * more context than just the region */
1244  ED_region_tag_redraw(region);
1245  break;
1246  case NC_TEXTURE:
1247  /* same as above */
1248  ED_region_tag_redraw(region);
1249  break;
1250  case NC_MOVIECLIP:
1251  if (wmn->data == ND_DISPLAY || wmn->action == NA_EDITED) {
1252  ED_region_tag_redraw(region);
1253  }
1254  break;
1255  case NC_SPACE:
1256  if (wmn->data == ND_SPACE_VIEW3D) {
1257  if (wmn->subtype == NS_VIEW3D_GPU) {
1258  rv3d->rflag |= RV3D_GPULIGHT_UPDATE;
1259  }
1260  else if (wmn->subtype == NS_VIEW3D_SHADING) {
1261 #ifdef WITH_XR_OPENXR
1262  ED_view3d_xr_shading_update(G_MAIN->wm.first, v3d, scene);
1263 #endif
1264 
1265  ViewLayer *view_layer = WM_window_get_active_view_layer(window);
1267  if (depsgraph) {
1268  ED_render_view3d_update(depsgraph, window, area, true);
1269  }
1270  }
1271  ED_region_tag_redraw(region);
1272  WM_gizmomap_tag_refresh(gzmap);
1273  }
1274  break;
1275  case NC_ID:
1277  ED_region_tag_redraw(region);
1278  }
1279  break;
1280  case NC_SCREEN:
1281  switch (wmn->data) {
1282  case ND_ANIMPLAY:
1283  case ND_SKETCH:
1284  ED_region_tag_redraw(region);
1285  break;
1286  case ND_LAYOUTBROWSE:
1287  case ND_LAYOUTDELETE:
1288  case ND_LAYOUTSET:
1289  WM_gizmomap_tag_refresh(gzmap);
1290  ED_region_tag_redraw(region);
1291  break;
1292  case ND_LAYER:
1293  ED_region_tag_redraw(region);
1294  break;
1295  }
1296 
1297  break;
1298  case NC_GPENCIL:
1299  if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
1300  ED_region_tag_redraw(region);
1301  }
1302  break;
1303  case NC_WORKSPACE:
1304  /* In case the region displays workspace settings. */
1305  ED_region_tag_redraw(region);
1306  break;
1307  }
1308 }
1309 
1311  struct wmMsgSubscribeKey *UNUSED(msg_key),
1312  struct wmMsgSubscribeValue *msg_val)
1313 {
1315  ScrArea *area = (ScrArea *)msg_val->user_data;
1316  View3D *v3d = (View3D *)area->spacedata.first;
1317  if (v3d->shading.type == OB_SOLID) {
1318  RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type);
1319  DRWUpdateContext drw_context = {NULL};
1320  drw_context.bmain = CTX_data_main(C);
1321  drw_context.depsgraph = CTX_data_depsgraph_pointer(C);
1322  drw_context.scene = scene;
1323  drw_context.view_layer = CTX_data_view_layer(C);
1324  drw_context.region = (ARegion *)(msg_val->owner);
1325  drw_context.v3d = v3d;
1326  drw_context.engine_type = engine_type;
1327  DRW_notify_view_update(&drw_context);
1328  }
1329 }
1330 
1332 {
1333  struct wmMsgBus *mbus = params->message_bus;
1334  const bContext *C = params->context;
1335  ScrArea *area = params->area;
1336  ARegion *region = params->region;
1337 
1338  /* Developer NOTE: there are many properties that impact 3D view drawing,
1339  * so instead of subscribing to individual properties, just subscribe to types
1340  * accepting some redundant redraws.
1341  *
1342  * For other space types we might try avoid this, keep the 3D view as an exceptional case! */
1343  wmMsgParams_RNA msg_key_params = {{0}};
1344 
1345  /* Only subscribe to types. */
1346  StructRNA *type_array[] = {
1347  &RNA_Window,
1348 
1349  /* These object have properties that impact drawing. */
1350  &RNA_AreaLight,
1351  &RNA_Camera,
1352  &RNA_Light,
1353  &RNA_Speaker,
1354  &RNA_SunLight,
1355 
1356  /* General types the 3D view depends on. */
1357  &RNA_Object,
1358  &RNA_UnitSettings, /* grid-floor */
1359 
1360  &RNA_View3DCursor,
1361  &RNA_View3DOverlay,
1362  &RNA_View3DShading,
1363  &RNA_World,
1364  };
1365 
1366  wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
1367  .owner = region,
1368  .user_data = region,
1370  };
1371 
1372  wmMsgSubscribeValue msg_sub_value_workbench_view_update = {
1373  .owner = region,
1374  .user_data = area,
1376  };
1377 
1378  for (int i = 0; i < ARRAY_SIZE(type_array); i++) {
1379  msg_key_params.ptr.type = type_array[i];
1380  WM_msg_subscribe_rna_params(mbus, &msg_key_params, &msg_sub_value_region_tag_redraw, __func__);
1381  }
1382 
1383  /* Subscribe to a handful of other properties. */
1384  RegionView3D *rv3d = region->regiondata;
1385 
1386  WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, engine, &msg_sub_value_region_tag_redraw);
1388  mbus, RenderSettings, resolution_x, &msg_sub_value_region_tag_redraw);
1390  mbus, RenderSettings, resolution_y, &msg_sub_value_region_tag_redraw);
1392  mbus, RenderSettings, pixel_aspect_x, &msg_sub_value_region_tag_redraw);
1394  mbus, RenderSettings, pixel_aspect_y, &msg_sub_value_region_tag_redraw);
1395  if (rv3d->persp == RV3D_CAMOB) {
1397  mbus, RenderSettings, use_border, &msg_sub_value_region_tag_redraw);
1398  }
1399 
1400  WM_msg_subscribe_rna_anon_type(mbus, SceneEEVEE, &msg_sub_value_region_tag_redraw);
1401  WM_msg_subscribe_rna_anon_type(mbus, SceneDisplay, &msg_sub_value_region_tag_redraw);
1402  WM_msg_subscribe_rna_anon_type(mbus, ObjectDisplay, &msg_sub_value_region_tag_redraw);
1403 
1404  ViewLayer *view_layer = CTX_data_view_layer(C);
1405  Object *obact = OBACT(view_layer);
1406  if (obact != NULL) {
1407  switch (obact->mode) {
1408  case OB_MODE_PARTICLE_EDIT:
1409  WM_msg_subscribe_rna_anon_type(mbus, ParticleEdit, &msg_sub_value_region_tag_redraw);
1410  break;
1411 
1412  case OB_MODE_SCULPT:
1414  mbus, WorkSpace, tools, &msg_sub_value_workbench_view_update);
1415  break;
1416  default:
1417  break;
1418  }
1419  }
1420 
1421  {
1422  wmMsgSubscribeValue msg_sub_value_region_tag_refresh = {
1423  .owner = region,
1424  .user_data = area,
1426  };
1427  WM_msg_subscribe_rna_anon_prop(mbus, Object, mode, &msg_sub_value_region_tag_refresh);
1428  WM_msg_subscribe_rna_anon_prop(mbus, LayerObjects, active, &msg_sub_value_region_tag_refresh);
1429  }
1430 }
1431 
1432 /* concept is to retrieve cursor type context-less */
1434 {
1435  if (WM_cursor_set_from_tool(win, area, region)) {
1436  return;
1437  }
1438 
1439  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
1440  Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
1441  if (obedit) {
1443  }
1444  else {
1446  }
1447 }
1448 
1449 /* add handlers, stuff you only do once or on area/region changes */
1451 {
1452  wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
1453 
1454  WM_event_add_keymap_handler(&region->handlers, keymap);
1455 
1456  ED_region_header_init(region);
1457 }
1458 
1459 static void view3d_header_region_draw(const bContext *C, ARegion *region)
1460 {
1461  ED_region_header(C, region);
1462 }
1463 
1465 {
1466  ARegion *region = params->region;
1467  wmNotifier *wmn = params->notifier;
1468 
1469  /* context changes */
1470  switch (wmn->category) {
1471  case NC_SCENE:
1472  switch (wmn->data) {
1473  case ND_FRAME:
1474  case ND_OB_ACTIVE:
1475  case ND_OB_SELECT:
1476  case ND_OB_VISIBLE:
1477  case ND_MODE:
1478  case ND_LAYER:
1479  case ND_TOOLSETTINGS:
1480  case ND_LAYER_CONTENT:
1481  case ND_RENDER_OPTIONS:
1482  ED_region_tag_redraw(region);
1483  break;
1484  }
1485  break;
1486  case NC_SPACE:
1487  if (wmn->data == ND_SPACE_VIEW3D) {
1488  ED_region_tag_redraw(region);
1489  }
1490  break;
1491  case NC_GPENCIL:
1492  if (wmn->data & ND_GPENCIL_EDITMODE) {
1493  ED_region_tag_redraw(region);
1494  }
1495  else if (wmn->action == NA_EDITED) {
1496  ED_region_tag_redraw(region);
1497  }
1498  break;
1499  case NC_BRUSH:
1500  ED_region_tag_redraw(region);
1501  break;
1502  case NC_GEOM:
1503  if (wmn->data == ND_DATA) {
1504  ED_region_tag_redraw(region);
1505  }
1506  break;
1507  }
1508 
1509  /* From topbar, which ones are needed? split per header? */
1510  /* Disable for now, re-enable if needed, or remove - campbell. */
1511 #if 0
1512  /* context changes */
1513  switch (wmn->category) {
1514  case NC_WM:
1515  if (wmn->data == ND_HISTORY) {
1516  ED_region_tag_redraw(region);
1517  }
1518  break;
1519  case NC_SCENE:
1520  if (wmn->data == ND_MODE) {
1521  ED_region_tag_redraw(region);
1522  }
1523  break;
1524  case NC_SPACE:
1525  if (wmn->data == ND_SPACE_VIEW3D) {
1526  ED_region_tag_redraw(region);
1527  }
1528  break;
1529  case NC_GPENCIL:
1530  if (wmn->data == ND_DATA) {
1531  ED_region_tag_redraw(region);
1532  }
1533  break;
1534  }
1535 #endif
1536 }
1537 
1539 {
1540  struct wmMsgBus *mbus = params->message_bus;
1541  ARegion *region = params->region;
1542 
1543  wmMsgParams_RNA msg_key_params = {{0}};
1544 
1545  /* Only subscribe to types. */
1546  StructRNA *type_array[] = {
1547  &RNA_View3DShading,
1548  };
1549 
1550  wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
1551  .owner = region,
1552  .user_data = region,
1554  };
1555 
1556  for (int i = 0; i < ARRAY_SIZE(type_array); i++) {
1557  msg_key_params.ptr.type = type_array[i];
1558  WM_msg_subscribe_rna_params(mbus, &msg_key_params, &msg_sub_value_region_tag_redraw, __func__);
1559  }
1560 }
1561 
1562 /* add handlers, stuff you only do once or on area/region changes */
1564 {
1565  wmKeyMap *keymap;
1566 
1567  ED_region_panels_init(wm, region);
1568 
1569  keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
1570  WM_event_add_keymap_handler(&region->handlers, keymap);
1571 }
1572 
1574  ARegion *region,
1575  const char *category_override)
1576 {
1577  const enum eContextObjectMode mode = CTX_data_mode_enum(C);
1578 
1579  const char *contexts_base[4] = {NULL};
1580  contexts_base[0] = CTX_data_mode_string(C);
1581 
1582  const char **contexts = &contexts_base[1];
1583 
1584  switch (mode) {
1585  case CTX_MODE_EDIT_MESH:
1586  ARRAY_SET_ITEMS(contexts, ".mesh_edit");
1587  break;
1588  case CTX_MODE_EDIT_CURVE:
1589  ARRAY_SET_ITEMS(contexts, ".curve_edit");
1590  break;
1591  case CTX_MODE_EDIT_CURVES:
1592  ARRAY_SET_ITEMS(contexts, ".curves_edit");
1593  break;
1594  case CTX_MODE_EDIT_SURFACE:
1595  ARRAY_SET_ITEMS(contexts, ".curve_edit");
1596  break;
1597  case CTX_MODE_EDIT_TEXT:
1598  ARRAY_SET_ITEMS(contexts, ".text_edit");
1599  break;
1601  ARRAY_SET_ITEMS(contexts, ".armature_edit");
1602  break;
1604  ARRAY_SET_ITEMS(contexts, ".mball_edit");
1605  break;
1606  case CTX_MODE_EDIT_LATTICE:
1607  ARRAY_SET_ITEMS(contexts, ".lattice_edit");
1608  break;
1609  case CTX_MODE_POSE:
1610  ARRAY_SET_ITEMS(contexts, ".posemode");
1611  break;
1612  case CTX_MODE_SCULPT:
1613  ARRAY_SET_ITEMS(contexts, ".paint_common", ".sculpt_mode");
1614  break;
1615  case CTX_MODE_PAINT_WEIGHT:
1616  ARRAY_SET_ITEMS(contexts, ".paint_common", ".weightpaint");
1617  break;
1618  case CTX_MODE_PAINT_VERTEX:
1619  ARRAY_SET_ITEMS(contexts, ".paint_common", ".vertexpaint");
1620  break;
1622  ARRAY_SET_ITEMS(contexts, ".paint_common", ".imagepaint");
1623  break;
1624  case CTX_MODE_PARTICLE:
1625  ARRAY_SET_ITEMS(contexts, ".paint_common", ".particlemode");
1626  break;
1627  case CTX_MODE_OBJECT:
1628  ARRAY_SET_ITEMS(contexts, ".objectmode");
1629  break;
1631  ARRAY_SET_ITEMS(contexts, ".greasepencil_paint");
1632  break;
1634  ARRAY_SET_ITEMS(contexts, ".greasepencil_sculpt");
1635  break;
1637  ARRAY_SET_ITEMS(contexts, ".greasepencil_weight");
1638  break;
1640  ARRAY_SET_ITEMS(contexts, ".greasepencil_vertex");
1641  break;
1643  ARRAY_SET_ITEMS(contexts, ".paint_common", ".curves_sculpt");
1644  break;
1645  default:
1646  break;
1647  }
1648 
1649  switch (mode) {
1651  ARRAY_SET_ITEMS(contexts, ".greasepencil_paint");
1652  break;
1654  ARRAY_SET_ITEMS(contexts, ".greasepencil_sculpt");
1655  break;
1657  ARRAY_SET_ITEMS(contexts, ".greasepencil_weight");
1658  break;
1659  case CTX_MODE_EDIT_GPENCIL:
1660  ARRAY_SET_ITEMS(contexts, ".greasepencil_edit");
1661  break;
1663  ARRAY_SET_ITEMS(contexts, ".greasepencil_vertex");
1664  break;
1665  default:
1666  break;
1667  }
1668 
1669  ListBase *paneltypes = &region->type->paneltypes;
1670 
1671  /* Allow drawing 3D view toolbar from non 3D view space type. */
1672  if (category_override != NULL) {
1675  paneltypes = &art->paneltypes;
1676  }
1677 
1678  ED_region_panels_layout_ex(C, region, paneltypes, contexts_base, category_override);
1679 }
1680 
1681 static void view3d_buttons_region_layout(const bContext *C, ARegion *region)
1682 {
1684 }
1685 
1687 {
1688  ARegion *region = params->region;
1689  wmNotifier *wmn = params->notifier;
1690 
1691  /* context changes */
1692  switch (wmn->category) {
1693  case NC_ANIMATION:
1694  switch (wmn->data) {
1695  case ND_KEYFRAME_PROP:
1696  case ND_NLA_ACTCHANGE:
1697  ED_region_tag_redraw(region);
1698  break;
1699  case ND_NLA:
1700  case ND_KEYFRAME:
1701  if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) {
1702  ED_region_tag_redraw(region);
1703  }
1704  break;
1705  }
1706  break;
1707  case NC_SCENE:
1708  switch (wmn->data) {
1709  case ND_FRAME:
1710  case ND_OB_ACTIVE:
1711  case ND_OB_SELECT:
1712  case ND_OB_VISIBLE:
1713  case ND_MODE:
1714  case ND_LAYER:
1715  case ND_LAYER_CONTENT:
1716  case ND_TOOLSETTINGS:
1717  ED_region_tag_redraw(region);
1718  break;
1719  }
1720  switch (wmn->action) {
1721  case NA_EDITED:
1722  ED_region_tag_redraw(region);
1723  break;
1724  }
1725  break;
1726  case NC_OBJECT:
1727  switch (wmn->data) {
1728  case ND_BONE_ACTIVE:
1729  case ND_BONE_SELECT:
1730  case ND_TRANSFORM:
1731  case ND_POSE:
1732  case ND_DRAW:
1733  case ND_KEYS:
1734  case ND_MODIFIER:
1735  case ND_SHADERFX:
1736  ED_region_tag_redraw(region);
1737  break;
1738  }
1739  break;
1740  case NC_GEOM:
1741  switch (wmn->data) {
1742  case ND_DATA:
1743  case ND_VERTEX_GROUP:
1744  case ND_SELECT:
1745  ED_region_tag_redraw(region);
1746  break;
1747  }
1748  if (wmn->action == NA_EDITED) {
1749  ED_region_tag_redraw(region);
1750  }
1751  break;
1752  case NC_TEXTURE:
1753  case NC_MATERIAL:
1754  /* for brush textures */
1755  ED_region_tag_redraw(region);
1756  break;
1757  case NC_BRUSH:
1758  /* NA_SELECTED is used on brush changes */
1759  if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
1760  ED_region_tag_redraw(region);
1761  }
1762  break;
1763  case NC_SPACE:
1764  if (wmn->data == ND_SPACE_VIEW3D) {
1765  ED_region_tag_redraw(region);
1766  }
1767  break;
1768  case NC_ID:
1769  if (wmn->action == NA_RENAME) {
1770  ED_region_tag_redraw(region);
1771  }
1772  break;
1773  case NC_GPENCIL:
1774  if ((wmn->data & (ND_DATA | ND_GPENCIL_EDITMODE)) || (wmn->action == NA_EDITED)) {
1775  ED_region_tag_redraw(region);
1776  }
1777  break;
1778  case NC_IMAGE:
1779  /* Update for the image layers in texture paint. */
1780  if (wmn->action == NA_EDITED) {
1781  ED_region_tag_redraw(region);
1782  }
1783  break;
1784  case NC_WM:
1785  if (wmn->data == ND_XR_DATA_CHANGED) {
1786  ED_region_tag_redraw(region);
1787  }
1788  break;
1789  }
1790 }
1791 
1792 /* add handlers, stuff you only do once or on area/region changes */
1794 {
1795  wmKeyMap *keymap;
1796 
1797  ED_region_panels_init(wm, region);
1798 
1799  keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
1800  WM_event_add_keymap_handler(&region->handlers, keymap);
1801 }
1802 
1803 static void view3d_tools_region_draw(const bContext *C, ARegion *region)
1804 {
1805  ED_region_panels_ex(C, region, (const char *[]){CTX_data_mode_string(C), NULL});
1806 }
1807 
1808 /* area (not region) level listener */
1810 {
1811  ScrArea *area = params->area;
1812  wmNotifier *wmn = params->notifier;
1813  View3D *v3d = area->spacedata.first;
1814 
1815  /* context changes */
1816  switch (wmn->category) {
1817  case NC_SCENE:
1818  switch (wmn->data) {
1819  case ND_WORLD: {
1820  const bool use_scene_world = V3D_USES_SCENE_WORLD(v3d);
1821  if (v3d->flag2 & V3D_HIDE_OVERLAYS || use_scene_world) {
1823  }
1824  break;
1825  }
1826  }
1827  break;
1828  case NC_WORLD:
1829  switch (wmn->data) {
1830  case ND_WORLD_DRAW:
1831  case ND_WORLD:
1834  }
1835  break;
1836  }
1837  break;
1838  case NC_MATERIAL:
1839  switch (wmn->data) {
1840  case ND_NODES:
1841  if (v3d->shading.type == OB_TEXTURE) {
1843  }
1844  break;
1845  }
1846  break;
1847  }
1848 }
1849 
1851 {
1854 
1855  if (lcache && (lcache->flag & LIGHTCACHE_UPDATE_AUTO) != 0) {
1856  lcache->flag &= ~LIGHTCACHE_UPDATE_AUTO;
1858  }
1859 
1860  View3D *v3d = (View3D *)area->spacedata.first;
1862 }
1863 
1864 const char *view3d_context_dir[] = {
1865  "active_object",
1866  "selected_ids",
1867  NULL,
1868 };
1869 
1870 static int view3d_context(const bContext *C, const char *member, bContextDataResult *result)
1871 {
1872  /* fallback to the scene layer,
1873  * allows duplicate and other object operators to run outside the 3d view */
1874 
1875  if (CTX_data_dir(member)) {
1877  return CTX_RESULT_OK;
1878  }
1879  if (CTX_data_equals(member, "active_object")) {
1880  /* In most cases the active object is the `view_layer->basact->object`.
1881  * For the 3D view however it can be NULL when hidden.
1882  *
1883  * This is ignored in the case the object is in any mode (besides object-mode),
1884  * since the object's mode impacts the current tool, cursor, gizmos etc.
1885  * If we didn't have this exception, changing visibility would need to perform
1886  * many of the same updates as changing the objects mode.
1887  *
1888  * Further, there are multiple ways to hide objects - by collection, by object type, etc.
1889  * it's simplest if all these methods behave consistently - respecting the object-mode
1890  * without showing the object.
1891  *
1892  * See T85532 for alternatives that were considered. */
1893  ViewLayer *view_layer = CTX_data_view_layer(C);
1894  if (view_layer->basact) {
1895  Object *ob = view_layer->basact->object;
1896  /* if hidden but in edit mode, we still display, can happen with animation */
1897  if ((view_layer->basact->flag & BASE_VISIBLE_DEPSGRAPH) != 0 ||
1898  (ob->mode != OB_MODE_OBJECT)) {
1900  }
1901  }
1902 
1903  return CTX_RESULT_OK;
1904  }
1905  if (CTX_data_equals(member, "selected_ids")) {
1906  ListBase selected_objects;
1907  CTX_data_selected_objects(C, &selected_objects);
1908  LISTBASE_FOREACH (CollectionPointerLink *, object_ptr_link, &selected_objects) {
1909  ID *selected_id = object_ptr_link->ptr.owner_id;
1910  CTX_data_id_list_add(result, selected_id);
1911  }
1912  BLI_freelistN(&selected_objects);
1914  return CTX_RESULT_OK;
1915  }
1916 
1918 }
1919 
1920 static void view3d_id_remap_v3d_ob_centers(View3D *v3d, const struct IDRemapper *mappings)
1921 {
1922  if (BKE_id_remapper_apply(mappings, (ID **)&v3d->ob_center, ID_REMAP_APPLY_DEFAULT) ==
1924  /* Otherwise, bonename may remain valid...
1925  * We could be smart and check this, too? */
1926  v3d->ob_center_bone[0] = '\0';
1927  }
1928 }
1929 
1931  SpaceLink *slink,
1932  View3D *v3d,
1933  const struct IDRemapper *mappings,
1934  const bool is_local)
1935 {
1936  ARegion *region;
1937  if (BKE_id_remapper_apply(mappings, (ID **)&v3d->camera, ID_REMAP_APPLY_DEFAULT) ==
1939  /* 3D view might be inactive, in that case needs to use slink->regionbase */
1940  ListBase *regionbase = (slink == area->spacedata.first) ? &area->regionbase :
1941  &slink->regionbase;
1942  for (region = regionbase->first; region; region = region->next) {
1943  if (region->regiontype == RGN_TYPE_WINDOW) {
1944  RegionView3D *rv3d = is_local ? ((RegionView3D *)region->regiondata)->localvd :
1945  region->regiondata;
1946  if (rv3d && (rv3d->persp == RV3D_CAMOB)) {
1947  rv3d->persp = RV3D_PERSP;
1948  }
1949  }
1950  }
1951  }
1952 }
1953 
1954 static void view3d_id_remap(ScrArea *area, SpaceLink *slink, const struct IDRemapper *mappings)
1955 {
1956 
1959  return;
1960  }
1961 
1962  View3D *view3d = (View3D *)slink;
1963  view3d_id_remap_v3d(area, slink, view3d, mappings, false);
1964  view3d_id_remap_v3d_ob_centers(view3d, mappings);
1965  if (view3d->localvd != NULL) {
1966  /* Object centers in local-view aren't used, see: T52663 */
1967  view3d_id_remap_v3d(area, slink, view3d->localvd, mappings, true);
1968  }
1969 }
1970 
1972 {
1973  SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype view3d");
1974  ARegionType *art;
1975 
1976  st->spaceid = SPACE_VIEW3D;
1977  strncpy(st->name, "View3D", BKE_ST_MAXNAME);
1978 
1979  st->create = view3d_create;
1980  st->free = view3d_free;
1981  st->init = view3d_init;
1982  st->exit = view3d_exit;
1983  st->listener = space_view3d_listener;
1984  st->refresh = space_view3d_refresh;
1985  st->duplicate = view3d_duplicate;
1986  st->operatortypes = view3d_operatortypes;
1987  st->keymap = view3d_keymap;
1988  st->dropboxes = view3d_dropboxes;
1989  st->gizmos = view3d_widgets;
1990  st->context = view3d_context;
1991  st->id_remap = view3d_id_remap;
1992 
1993  /* regions: main window */
1994  art = MEM_callocN(sizeof(ARegionType), "spacetype view3d main region");
1995  art->regionid = RGN_TYPE_WINDOW;
2005  art->lock = 1; /* can become flag, see BKE_spacedata_draw_locks */
2006  BLI_addhead(&st->regiontypes, art);
2007 
2008  /* regions: listview/buttons */
2009  art = MEM_callocN(sizeof(ARegionType), "spacetype view3d buttons region");
2010  art->regionid = RGN_TYPE_UI;
2017  art->draw = ED_region_panels_draw;
2018  BLI_addhead(&st->regiontypes, art);
2019 
2021 
2022  /* regions: tool(bar) */
2023  art = MEM_callocN(sizeof(ARegionType), "spacetype view3d tools region");
2024  art->regionid = RGN_TYPE_TOOLS;
2025  art->prefsizex = 58; /* XXX */
2026  art->prefsizey = 50; /* XXX */
2033  BLI_addhead(&st->regiontypes, art);
2034 
2035  /* regions: tool header */
2036  art = MEM_callocN(sizeof(ARegionType), "spacetype view3d tool header region");
2038  art->prefsizey = HEADERY;
2044  BLI_addhead(&st->regiontypes, art);
2045 
2046  /* regions: header */
2047  art = MEM_callocN(sizeof(ARegionType), "spacetype view3d header region");
2048  art->regionid = RGN_TYPE_HEADER;
2049  art->prefsizey = HEADERY;
2055  BLI_addhead(&st->regiontypes, art);
2056 
2057  /* regions: hud */
2058  art = ED_area_type_hud(st->spaceid);
2059  BLI_addhead(&st->regiontypes, art);
2060 
2061  /* regions: xr */
2062  art = MEM_callocN(sizeof(ARegionType), "spacetype view3d xr region");
2063  art->regionid = RGN_TYPE_XR;
2064  BLI_addhead(&st->regiontypes, art);
2065 
2067 }
struct IDProperty * BKE_asset_metadata_idprop_find(const struct AssetMetaData *asset_data, const char *name) ATTR_WARN_UNUSED_RESULT
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
void CTX_data_dir_set(bContextDataResult *result, const char **dir)
Definition: context.c:696
bool CTX_data_equals(const char *member, const char *str)
Definition: context.c:634
void CTX_data_id_pointer_set(bContextDataResult *result, struct ID *id)
Definition: context.c:644
int CTX_data_selected_objects(const bContext *C, ListBase *list)
Definition: context.c:1323
bool CTX_data_dir(const char *member)
Definition: context.c:639
void CTX_data_id_list_add(bContextDataResult *result, struct ID *id)
Definition: context.c:659
@ CTX_DATA_TYPE_COLLECTION
Definition: BKE_context.h:233
eContextObjectMode
Definition: BKE_context.h:103
@ CTX_MODE_EDIT_GPENCIL
Definition: BKE_context.h:120
@ CTX_MODE_EDIT_CURVE
Definition: BKE_context.h:105
@ CTX_MODE_PAINT_TEXTURE
Definition: BKE_context.h:116
@ CTX_MODE_EDIT_SURFACE
Definition: BKE_context.h:106
@ CTX_MODE_WEIGHT_GPENCIL
Definition: BKE_context.h:122
@ CTX_MODE_PARTICLE
Definition: BKE_context.h:117
@ CTX_MODE_SCULPT
Definition: BKE_context.h:113
@ CTX_MODE_VERTEX_GPENCIL
Definition: BKE_context.h:123
@ CTX_MODE_OBJECT
Definition: BKE_context.h:118
@ CTX_MODE_EDIT_MESH
Definition: BKE_context.h:104
@ CTX_MODE_SCULPT_CURVES
Definition: BKE_context.h:124
@ CTX_MODE_EDIT_TEXT
Definition: BKE_context.h:107
@ CTX_MODE_EDIT_CURVES
Definition: BKE_context.h:111
@ CTX_MODE_EDIT_ARMATURE
Definition: BKE_context.h:108
@ CTX_MODE_SCULPT_GPENCIL
Definition: BKE_context.h:121
@ CTX_MODE_EDIT_LATTICE
Definition: BKE_context.h:110
@ CTX_MODE_PAINT_GPENCIL
Definition: BKE_context.h:119
@ CTX_MODE_PAINT_VERTEX
Definition: BKE_context.h:115
@ CTX_MODE_EDIT_METABALL
Definition: BKE_context.h:109
@ CTX_MODE_PAINT_WEIGHT
Definition: BKE_context.h:114
@ CTX_MODE_POSE
Definition: BKE_context.h:112
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1100
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:784
const char * CTX_data_mode_string(const bContext *C)
@ CTX_RESULT_MEMBER_NOT_FOUND
Definition: BKE_context.h:75
@ CTX_RESULT_OK
Definition: BKE_context.h:72
void CTX_data_type_set(struct bContextDataResult *result, short type)
Definition: context.c:701
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Definition: context.c:1505
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
enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
Definition: context.c:1228
#define G_MAIN
Definition: BKE_global.h:267
void IDP_FreeProperty(struct IDProperty *prop)
Definition: idprop.c:1093
#define IDP_Array(prop)
Definition: BKE_idprop.h:245
struct IDProperty * IDP_CopyProperty(const struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BKE_view_layer_base_deselect_all(struct ViewLayer *view_layer)
Definition: layer.c:388
struct Base * BKE_view_layer_base_find(struct ViewLayer *view_layer, struct Object *ob)
Definition: layer.c:379
void BKE_view_layer_base_select_and_set_active(struct ViewLayer *view_layer, struct Base *selbase)
Definition: layer.c:397
@ ID_REMAP_RESULT_SOURCE_UNASSIGNED
bool BKE_id_remapper_has_mapping_for(const struct IDRemapper *id_remapper, uint64_t type_filter)
@ ID_REMAP_APPLY_DEFAULT
IDRemapperApplyResult BKE_id_remapper_apply(const struct IDRemapper *id_remapper, struct ID **r_id_ptr, IDRemapperApplyOptions options)
General operations, lookup, etc. for blender objects.
void BKE_object_dimensions_get(struct Object *ob, float r_vec[3])
Definition: object.cc:3786
void BKE_boundbox_calc_center_aabb(const struct BoundBox *bb, float r_cent[3])
const struct BoundBox * BKE_object_boundbox_get(struct Object *ob)
Definition: object.cc:3684
struct Depsgraph * BKE_scene_get_depsgraph(const struct Scene *scene, const struct ViewLayer *view_layer)
bool BKE_scene_uses_blender_eevee(const struct Scene *scene)
void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene)
Definition: screen.c:976
#define BKE_ST_MAXNAME
Definition: BKE_screen.h:53
struct ARegion * BKE_area_find_region_active_win(struct ScrArea *area)
Definition: screen.c:883
void BKE_spacetype_register(struct SpaceType *st)
Definition: screen.c:391
struct SpaceType * BKE_spacetype_from_id(int spaceid)
Definition: screen.c:353
struct ARegionType * BKE_regiontype_from_id(const struct SpaceType *st, int regionid)
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define ATTR_FALLTHROUGH
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:60
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:466
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
#define BLI_ASSERT_ZERO_M4(m)
void zero_m4(float m[4][4])
Definition: math_matrix.c:28
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:259
void copy_m4_m3(float m1[4][4], const float m2[3][3])
Definition: math_matrix.c:102
void mul_mat3_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:790
void rescale_m4(float mat[4][4], const float scale[3])
Definition: math_matrix.c:2362
void mat4_to_size(float size[3], const float M[4][4])
Definition: math_matrix.c:2138
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:42
#define ARRAY_SIZE(arr)
#define ARRAY_SET_ITEMS(...)
#define UNUSED_VARS_NDEBUG(...)
#define UNUSED(x)
#define ELEM(...)
#define TIP_(msgid)
#define BPy_BEGIN_ALLOW_THREADS
Definition: BPY_extern.h:54
#define BPy_END_ALLOW_THREADS
Definition: BPY_extern.h:58
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)
#define FILTER_ID_OB
Definition: DNA_ID.h:916
#define FILTER_ID_MC
Definition: DNA_ID.h:912
@ ID_RECALC_SELECT
Definition: DNA_ID.h:818
#define FILTER_ID_MA
Definition: DNA_ID.h:910
#define FILTER_ID_IM
Definition: DNA_ID.h:906
ID_Type
Definition: DNA_ID_enums.h:44
@ ID_IM
Definition: DNA_ID_enums.h:53
@ ID_WO
Definition: DNA_ID_enums.h:59
@ ID_MA
Definition: DNA_ID_enums.h:51
@ ID_GR
Definition: DNA_ID_enums.h:65
@ ID_OB
Definition: DNA_ID_enums.h:47
Object groups, one object can be in many groups at once.
#define DNA_struct_default_alloc(struct_name)
Definition: DNA_defaults.h:32
@ BASE_SELECTABLE
@ BASE_VISIBLE_DEPSGRAPH
@ BASE_ENABLED_VIEWPORT
@ LIGHTCACHE_UPDATE_AUTO
@ OB_TEXTURE
@ OB_SOLID
@ OB_RENDER
@ OB_MODE_PARTICLE_EDIT
@ OB_MODE_SCULPT
@ OB_MODE_OBJECT
Object is a sort of wrapper for general info.
#define OB_DATA_SUPPORT_ID(_id_type)
@ OB_EMPTY_IMAGE
@ OB_EMPTY
@ OB_CAMERA
#define OBEDIT_FROM_VIEW_LAYER(view_layer)
#define OBACT(_view_layer)
#define HEADERY
@ RGN_FLAG_HIDDEN
@ RGN_FLAG_HIDDEN_BY_USER
@ RGN_TYPE_TOOL_HEADER
@ RGN_TYPE_UI
@ RGN_TYPE_WINDOW
@ RGN_TYPE_HEADER
@ RGN_TYPE_XR
@ RGN_TYPE_TOOLS
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_TOP
@ RGN_ALIGN_RIGHT
@ SPACE_VIEW3D
@ FILE_AUTOSELECT
@ USER_HEADER_BOTTOM
@ V3D_SHADING_BACKGROUND_WORLD
#define RV3D_GPULIGHT_UPDATE
#define V3D_USES_SCENE_WORLD(v3d)
#define RV3D_CAMOB
@ RV3D_LOCK_ROTATION
#define V3D_XR_SESSION_MIRROR
#define RV3D_PERSP
#define V3D_HIDE_OVERLAYS
#define V3D_LOCAL_COLLECTIONS
#define RV3D_VIEW_USER
void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
char * ED_object_ot_drop_named_material_tooltip(struct bContext *C, const char *name, const int mval[2])
void ED_outliner_select_sync_from_object_tag(struct bContext *C)
void ED_render_view3d_update(struct Depsgraph *depsgraph, struct wmWindow *window, struct ScrArea *area, bool updated)
@ ED_KEYMAP_UI
Definition: ED_screen.h:691
@ ED_KEYMAP_HEADER
Definition: ED_screen.h:697
@ ED_KEYMAP_TOOL
Definition: ED_screen.h:693
@ ED_KEYMAP_GPENCIL
Definition: ED_screen.h:699
@ ED_KEYMAP_GIZMO
Definition: ED_screen.h:692
@ ED_KEYMAP_VIEW2D
Definition: ED_screen.h:694
@ ED_KEYMAP_FRAMES
Definition: ED_screen.h:696
void ED_region_header(const struct bContext *C, struct ARegion *region)
void ED_region_tag_redraw_cursor(struct ARegion *region)
Definition: area.c:667
void ED_region_do_msg_notify_tag_redraw(struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val)
void ED_area_do_mgs_subscribe_for_tool_ui(const struct wmRegionMessageSubscribeParams *params)
bool ED_region_overlap_isect_any_xy(const ScrArea *area, const int event_xy[2])
Definition: area_query.c:50
int ED_region_generic_tools_region_snap_size(const struct ARegion *region, int size, int axis)
void ED_region_generic_tools_region_message_subscribe(const struct wmRegionMessageSubscribeParams *params)
void ED_region_panels_ex(const struct bContext *C, struct ARegion *region, const char *contexts[])
void ED_region_panels_draw(const struct bContext *C, struct ARegion *region)
void ED_area_do_mgs_subscribe_for_tool_header(const struct wmRegionMessageSubscribeParams *params)
struct ARegionType * ED_area_type_hud(int space_type)
void ED_area_tag_redraw_regiontype(ScrArea *area, int type)
Definition: area.c:747
void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *region)
Definition: area.c:3153
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:655
void ED_region_header_init(struct ARegion *region)
Definition: area.c:3417
void ED_area_tag_refresh(ScrArea *area)
Definition: area.c:758
void ED_region_panels_layout_ex(const struct bContext *C, struct ARegion *region, struct ListBase *paneltypes, const char *contexts[], const char *category_override)
void VIEW3D_GGT_xform_gizmo_context(struct wmGizmoGroupType *gzgt)
void VIEW3D_GGT_xform_gizmo(struct wmGizmoGroupType *gzgt)
void VIEW3D_GGT_xform_shear(struct wmGizmoGroupType *gzgt)
void VIEW3D_GGT_xform_extrude(struct wmGizmoGroupType *gzgt)
void VIEW3D_GGT_xform_cage(struct wmGizmoGroupType *gzgt)
void ED_undo_push(struct bContext *C, const char *str)
Definition: ed_undo.c:100
struct RenderEngineType * ED_view3d_engine_type(const struct Scene *scene, int drawtype)
#define ED_view3d_clear_mats_rv3d(rv3d)
Definition: ED_view3d.h:1030
V3DSnapCursorData * ED_view3d_cursor_snap_data_get(void)
bool ED_view3d_is_object_under_cursor(struct bContext *C, const int mval[2])
void ED_view3d_cursor_snap_deactive(V3DSnapCursorState *state)
V3DSnapCursorState * ED_view3d_cursor_snap_active(void)
void ED_view3d_clipping_local(struct RegionView3D *rv3d, const float mat[4][4])
Definition: view3d_edit.c:755
V3DSnapCursorState * ED_view3d_cursor_snap_state_get(void)
#define ED_view3d_check_mats_rv3d(rv3d)
Definition: ED_view3d.h:1031
struct Object * ED_view3d_give_object_under_cursor(struct bContext *C, const int mval[2])
#define GPU_matrix_mul(x)
Definition: GPU_matrix.h:224
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
#define C
Definition: RandGen.cpp:25
#define UI_SIDEBAR_PANEL_WIDTH
Definition: UI_interface.h:242
@ TH_GIZMO_PRIMARY
Definition: UI_resources.h:305
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
Definition: resources.c:1352
@ WM_JOB_TYPE_RENDER_PREVIEW
Definition: WM_api.h:1350
#define NC_WORLD
Definition: WM_types.h:337
#define ND_SHADING
Definition: WM_types.h:425
#define ND_WORLD
Definition: WM_types.h:401
#define NC_ID
Definition: WM_types.h:345
#define NC_GEOM
Definition: WM_types.h:343
#define ND_NLA_ACTCHANGE
Definition: WM_types.h:446
#define ND_DRAW
Definition: WM_types.h:410
#define NC_BRUSH
Definition: WM_types.h:335
#define ND_OB_ACTIVE
Definition: WM_types.h:388
#define NC_WM
Definition: WM_types.h:324
#define ND_DATA
Definition: WM_types.h:456
#define WM_DRAG_PATH
Definition: WM_types.h:1050
#define ND_GPENCIL_EDITMODE
Definition: WM_types.h:451
#define ND_LIGHTING_DRAW
Definition: WM_types.h:432
#define ND_RENDER_OPTIONS
Definition: WM_types.h:383
#define NC_ANIMATION
Definition: WM_types.h:338
#define ND_VERTEX_GROUP
Definition: WM_types.h:457
#define ND_DISPLAY
Definition: WM_types.h:439
#define ND_LOD
Definition: WM_types.h:417
#define NC_SCREEN
Definition: WM_types.h:327
#define NC_MOVIECLIP
Definition: WM_types.h:347
#define ND_SKETCH
Definition: WM_types.h:375
#define ND_MODE
Definition: WM_types.h:393
#define ND_OB_SELECT
Definition: WM_types.h:390
#define ND_ANIMPLAY
Definition: WM_types.h:372
#define NC_SCENE
Definition: WM_types.h:328
#define NA_ADDED
Definition: WM_types.h:525
#define ND_OB_VISIBLE
Definition: WM_types.h:391
#define ND_LAYER_CONTENT
Definition: WM_types.h:402
#define NC_GROUP
Definition: WM_types.h:333
#define ND_NODES
Definition: WM_types.h:384
#define ND_TOOLSETTINGS
Definition: WM_types.h:397
#define ND_MODIFIER
Definition: WM_types.h:411
#define ND_POSE
Definition: WM_types.h:407
#define NA_EDITED
Definition: WM_types.h:523
#define ND_PARTICLE
Definition: WM_types.h:414
#define ND_KEYFRAME_PROP
Definition: WM_types.h:443
#define NC_MATERIAL
Definition: WM_types.h:330
#define NC_LAMP
Definition: WM_types.h:332
#define NC_IMAGE
Definition: WM_types.h:334
#define ND_CONSTRAINT
Definition: WM_types.h:413
#define NC_WORKSPACE
Definition: WM_types.h:326
#define ND_UNDO
Definition: WM_types.h:365
#define ND_MARKERS
Definition: WM_types.h:381
#define NC_CAMERA
Definition: WM_types.h:351
#define ND_FRAME
Definition: WM_types.h:382
#define NA_REMOVED
Definition: WM_types.h:526
#define ND_SELECT
Definition: WM_types.h:455
#define NC_GPENCIL
Definition: WM_types.h:349
#define ND_NLA
Definition: WM_types.h:445
#define NC_TEXTURE
Definition: WM_types.h:331
#define NS_VIEW3D_GPU
Definition: WM_types.h:515
#define ND_LIGHTING
Definition: WM_types.h:431
#define ND_BONE_ACTIVE
Definition: WM_types.h:408
#define ND_TRANSFORM
Definition: WM_types.h:405
#define ND_LAYER
Definition: WM_types.h:398
@ WM_OP_INVOKE_DEFAULT
Definition: WM_types.h:201
#define WM_DRAG_ASSET
Definition: WM_types.h:1044
#define ND_KEYS
Definition: WM_types.h:412
#define NA_RENAME
Definition: WM_types.h:527
#define ND_HISTORY
Definition: WM_types.h:363
#define NC_LIGHTPROBE
Definition: WM_types.h:352
#define ND_POINTCACHE
Definition: WM_types.h:415
#define ND_XR_DATA_CHANGED
Definition: WM_types.h:366
#define ND_SHADERFX
Definition: WM_types.h:420
#define ND_WORLD_DRAW
Definition: WM_types.h:435
#define ND_LAYOUTBROWSE
Definition: WM_types.h:370
#define ND_DRAW_ANIMVIZ
Definition: WM_types.h:422
#define ND_BONE_SELECT
Definition: WM_types.h:409
#define ND_SPACE_VIEW3D
Definition: WM_types.h:471
#define WM_DRAG_ID
Definition: WM_types.h:1043
#define ND_KEYFRAME
Definition: WM_types.h:442
#define ND_LAYOUTSET
Definition: WM_types.h:374
#define NC_OBJECT
Definition: WM_types.h:329
#define ND_SCENEBROWSE
Definition: WM_types.h:380
#define NS_VIEW3D_SHADING
Definition: WM_types.h:516
#define ND_LAYOUTDELETE
Definition: WM_types.h:371
#define ND_ANIMCHAN
Definition: WM_types.h:444
#define ND_SHADING_LINKS
Definition: WM_types.h:427
#define ND_SHADING_DRAW
Definition: WM_types.h:426
#define NC_SPACE
Definition: WM_types.h:342
#define NA_SELECTED
Definition: WM_types.h:528
#define ND_DRAW_RENDER_VIEWPORT
Definition: WM_types.h:418
unsigned int U
Definition: btGjkEpa3.h:78
Scene scene
const Depsgraph * depsgraph
void RE_engine_free(RenderEngine *engine)
Definition: engine.c:164
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define GS(x)
Definition: iris.c:225
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
const int state
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:28
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])
bool active
all scheduled work for the GPU.
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:5155
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:4921
void RNA_enum_set_identifier(bContext *C, PointerRNA *ptr, const char *name, const char *id)
Definition: rna_access.c:5027
void RNA_struct_property_unset(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5313
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:5015
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
Definition: rna_access.c:4992
static void view3d_main_region_init(wmWindowManager *wm, ARegion *region)
Definition: space_view3d.c:362
static bool view3d_world_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:604
static bool view3d_ob_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:538
static SpaceLink * view3d_duplicate(SpaceLink *sl)
Definition: space_view3d.c:332
static bool view3d_collection_drop_poll_local_id(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:567
static bool view3d_object_data_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:609
static int view3d_context(const bContext *C, const char *member, bContextDataResult *result)
static void view3d_id_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: space_view3d.c:821
static void view3d_id_remap(ScrArea *area, SpaceLink *slink, const struct IDRemapper *mappings)
static void view3d_free(SpaceLink *sl)
Definition: space_view3d.c:300
static void space_view3d_listener(const wmSpaceTypeListenerParams *params)
static void view3d_collection_drop_copy_external_asset(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: space_view3d.c:783
static SpaceLink * view3d_create(const ScrArea *UNUSED(area), const Scene *scene)
Definition: space_view3d.c:240
static bool view3d_ima_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:626
static bool view3d_ima_bg_is_camera_view(bContext *C)
Definition: space_view3d.c:639
bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_region)
Definition: space_view3d.c:98
static void view3d_id_path_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: space_view3d.c:836
static void view3d_do_msg_notify_workbench_view_update(struct bContext *C, struct wmMsgSubscribeKey *UNUSED(msg_key), struct wmMsgSubscribeValue *msg_val)
static bool view3d_collection_drop_poll_external_asset(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:575
static void view3d_ob_drop_copy_external_asset(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: space_view3d.c:732
void ED_view3d_init_mats_rv3d_gl(const struct Object *ob, struct RegionView3D *rv3d)
Definition: space_view3d.c:176
static void view3d_ob_drop_matrix_from_snap(V3DSnapCursorState *snap_state, Object *ob, float obmat_final[4][4])
Definition: space_view3d.c:690
static void view3d_main_region_listener(const wmRegionListenerParams *params)
static bool view3d_volume_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
Definition: space_view3d.c:683
static void view3d_widgets(void)
Definition: space_view3d.c:950
void ED_view3d_stop_render_preview(wmWindowManager *wm, ARegion *region)
Definition: space_view3d.c:200
static void view3d_header_region_draw(const bContext *C, ARegion *region)
static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:664
static bool view3d_ob_drop_poll_local_id(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:554
static void view3d_collection_drop_copy_local_id(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: space_view3d.c:773
static void view3d_tools_region_draw(const bContext *C, ARegion *region)
static void view3d_header_region_init(wmWindowManager *wm, ARegion *region)
static void view3d_main_region_exit(wmWindowManager *wm, ARegion *region)
Definition: space_view3d.c:444
static void view3d_id_remap_v3d(ScrArea *area, SpaceLink *slink, View3D *v3d, const struct IDRemapper *mappings, const bool is_local)
static void view3d_lightcache_update(bContext *C)
Definition: space_view3d.c:850
static bool view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:651
static void view3d_header_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
static void view3d_main_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
static void view3d_buttons_region_layout(const bContext *C, ARegion *region)
static void view3d_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(area))
Definition: space_view3d.c:321
static bool view3d_ob_drop_poll_external_asset(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:542
static void view3d_tools_region_init(wmWindowManager *wm, ARegion *region)
static char * view3d_object_data_drop_tooltip(bContext *UNUSED(C), wmDrag *UNUSED(drag), const int UNUSED(xy[2]), wmDropBox *UNUSED(drop))
Definition: space_view3d.c:618
static void view3d_id_remap_v3d_ob_centers(View3D *v3d, const struct IDRemapper *mappings)
static bool view3d_drop_in_main_region_poll(bContext *C, const wmEvent *event)
Definition: space_view3d.c:449
const char * view3d_context_dir[]
void ED_spacetype_view3d(void)
static char * view3d_mat_drop_tooltip(bContext *C, wmDrag *drag, const int xy[2], wmDropBox *UNUSED(drop))
Definition: space_view3d.c:590
static void view3d_main_region_cursor(wmWindow *win, ScrArea *area, ARegion *region)
static void view3d_buttons_region_listener(const wmRegionListenerParams *params)
static void view3d_main_region_free(ARegion *region)
Definition: space_view3d.c:987
static void view3d_ob_drop_draw_deactivate(struct wmDropBox *drop, wmDrag *UNUSED(drag))
Definition: space_view3d.c:529
static bool view3d_drop_id_in_main_region_poll(bContext *C, wmDrag *drag, const wmEvent *event, ID_Type id_type)
Definition: space_view3d.c:481
static void view3d_ob_drop_draw_activate(struct wmDropBox *drop, wmDrag *drag)
Definition: space_view3d.c:493
void ED_view3d_init_mats_rv3d(const struct Object *ob, struct RegionView3D *rv3d)
Definition: space_view3d.c:166
static void view3d_exit(wmWindowManager *UNUSED(wm), ScrArea *area)
Definition: space_view3d.c:325
static void view3d_ob_drop_copy_local_id(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: space_view3d.c:714
static bool view3d_mat_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:585
void ED_view3d_buttons_region_layout_ex(const bContext *C, ARegion *region, const char *category_override)
static void view3d_header_region_listener(const wmRegionListenerParams *params)
static void view3d_id_drop_copy_with_type(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: space_view3d.c:828
RegionView3D * ED_view3d_context_rv3d(bContext *C)
Definition: space_view3d.c:82
static void * view3d_main_region_duplicate(void *poin)
static void view3d_buttons_region_init(wmWindowManager *wm, ARegion *region)
static void view3d_dropboxes(void)
Definition: space_view3d.c:872
void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *area)
Definition: space_view3d.c:223
static bool view3d_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:562
bool ED_view3d_area_user_region(const ScrArea *area, const View3D *v3d, ARegion **r_region)
Definition: space_view3d.c:128
static void space_view3d_refresh(const bContext *C, ScrArea *area)
static ID_Type view3d_drop_id_in_main_region_poll_get_id_type(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: space_view3d.c:455
void(* draw)(const struct bContext *C, struct ARegion *region)
Definition: BKE_screen.h:151
void(* exit)(struct wmWindowManager *wm, struct ARegion *region)
Definition: BKE_screen.h:149
void(* message_subscribe)(const wmRegionMessageSubscribeParams *params)
Definition: BKE_screen.h:167
void(* cursor)(struct wmWindow *win, struct ScrArea *area, struct ARegion *region)
Definition: BKE_screen.h:179
int(* snap_size)(const struct ARegion *region, int size, int axis)
Definition: BKE_screen.h:163
short lock
Definition: BKE_screen.h:211
void(* listener)(const wmRegionListenerParams *params)
Definition: BKE_screen.h:165
int keymapflag
Definition: BKE_screen.h:208
void(* free)(struct ARegion *)
Definition: BKE_screen.h:169
void *(* duplicate)(void *poin)
Definition: BKE_screen.h:172
void(* layout)(const struct bContext *C, struct ARegion *region)
Definition: BKE_screen.h:161
void(* init)(struct wmWindowManager *wm, struct ARegion *region)
Definition: BKE_screen.h:147
ListBase paneltypes
Definition: BKE_screen.h:198
void * regiondata
struct ARegion * next
ListBase handlers
short alignment
short regiontype
struct wmGizmoMap * gizmo_map
struct ARegionType * type
The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data),...
short flag
struct Object * object
float vec[8][3]
struct Object * ob
struct Scene * scene
Definition: DRW_engine.h:52
struct View3D * v3d
Definition: DRW_engine.h:55
struct ARegion * region
Definition: DRW_engine.h:54
struct RenderEngineType * engine_type
Definition: DRW_engine.h:56
struct ViewLayer * view_layer
Definition: DRW_engine.h:53
struct Main * bmain
Definition: DRW_engine.h:50
struct Depsgraph * depsgraph
Definition: DRW_engine.h:51
Definition: DNA_ID.h:368
unsigned int session_uuid
Definition: DNA_ID.h:407
char name[66]
Definition: DNA_ID.h:378
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase wm
Definition: BKE_main.h:197
char empty_drawtype
float obmat[4][4]
void * data
struct StructRNA * type
Definition: RNA_types.h:37
float viewmatob[4][4]
struct RenderEngine * render_engine
struct SmoothView3DStore * sms
float viewquat[4]
float persmat[4][4]
struct RegionView3D * localvd
float viewmat[4][4]
float persmatob[4][4]
struct BoundBox * clipbb
struct LightCache * light_cache_data
struct Object * camera
struct SceneEEVEE eevee
float plane_omat[3][3]
Definition: ED_view3d.h:308
struct IDProperty * prop
struct SceneStats * local_stats
View3D_Runtime runtime
struct Object * camera
struct View3D * localvd
char ob_center_bone[64]
char spacetype
unsigned short local_collections_uuid
struct Object * ob_center
ListBase regionbase
View3DShading shading
struct Base * basact
int ymin
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
struct bContext * evil_C
Definition: WM_types.h:1087
char path[1024]
Definition: WM_types.h:1150
int icon
Definition: WM_types.h:1146
int type
Definition: WM_types.h:1148
void(* draw_deactivate)(struct wmDropBox *drop, struct wmDrag *drag)
Definition: WM_types.h:1220
void * draw_data
Definition: WM_types.h:1223
void(* draw_droptip)(struct bContext *C, struct wmWindow *win, struct wmDrag *drag, const int xy[2])
Definition: WM_types.h:1200
void(* draw_activate)(struct wmDropBox *drop, struct wmDrag *drag)
Definition: WM_types.h:1217
struct PointerRNA * ptr
Definition: WM_types.h:1237
int xy[2]
Definition: WM_types.h:682
int mval[2]
Definition: WM_types.h:684
unsigned int data
Definition: WM_types.h:308
unsigned int action
Definition: WM_types.h:308
unsigned int category
Definition: WM_types.h:308
unsigned int subtype
Definition: WM_types.h:308
void * reference
Definition: WM_types.h:310
struct wmKeyConfig * defaultconf
void view3d_buttons_register(ARegionType *art)
void view3d_main_region_draw(const bContext *C, ARegion *region)
Definition: view3d_draw.c:1557
void VIEW3D_GGT_armature_spline(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_camera(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_camera_view(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_empty_image(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_force_field(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_light_spot(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_light_area(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_light_target(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_navigate(wmGizmoGroupType *gzgt)
void VIEW3D_GT_navigate_rotate(wmGizmoType *gzt)
void VIEW3D_GGT_mesh_preselect_edgering(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_mesh_preselect_elem(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_ruler(wmGizmoGroupType *gzgt)
void VIEW3D_GT_ruler_item(wmGizmoType *gzt)
void VIEW3D_GGT_tool_generic_handle_free(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_tool_generic_handle_normal(wmGizmoGroupType *gzgt)
void VIEW3D_GGT_placement(struct wmGizmoGroupType *gzgt)
void view3d_operatortypes(void)
Definition: view3d_ops.c:135
void view3d_keymap(struct wmKeyConfig *keyconf)
Definition: view3d_ops.c:210
void WM_cursor_set(wmWindow *win, int curs)
Definition: wm_cursors.c:126
bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *area, const ARegion *region)
Definition: wm_cursors.c:174
@ WM_CURSOR_DEFAULT
Definition: wm_cursors.h:18
@ WM_CURSOR_EDIT
Definition: wm_cursors.h:22
ID * WM_drag_get_local_ID_or_import_from_asset(const wmDrag *drag, int idcode)
Definition: wm_dragdrop.cc:667
void WM_drag_free_imported_drag_ID(Main *bmain, wmDrag *drag, wmDropBox *drop)
Free asset ID imported for canceled drop.
Definition: wm_dragdrop.cc:686
bool WM_drag_asset_will_import_linked(const wmDrag *drag)
Definition: wm_dragdrop.cc:657
AssetMetaData * WM_drag_get_asset_meta_data(const wmDrag *drag, int idcode)
Definition: wm_dragdrop.cc:593
ID * WM_drag_get_local_ID(const wmDrag *drag, short idcode)
Definition: wm_dragdrop.cc:531
bool WM_drag_is_ID_type(const wmDrag *drag, int idcode)
Definition: wm_dragdrop.cc:556
ListBase * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
Definition: wm_dragdrop.cc:76
wmDragAsset * WM_drag_get_asset_data(const wmDrag *drag, int idcode)
Definition: wm_dragdrop.cc:583
ID * WM_drag_asset_id_import(wmDragAsset *asset_drag, const int flag_extra)
Definition: wm_dragdrop.cc:608
const char * WM_drag_get_item_name(wmDrag *drag)
Definition: wm_dragdrop.cc:787
wmDropBox * WM_dropbox_add(ListBase *lb, const char *idname, bool(*poll)(bContext *, wmDrag *, const wmEvent *), void(*copy)(bContext *, wmDrag *, wmDropBox *), void(*cancel)(Main *, wmDrag *, wmDropBox *), WMDropboxTooltipFunc tooltip)
Definition: wm_dragdrop.cc:95
void WM_drag_draw_item_name_fn(bContext *UNUSED(C), wmWindow *UNUSED(win), wmDrag *drag, const int xy[2])
Definition: wm_dragdrop.cc:872
void WM_draw_region_free(ARegion *region, bool hide)
Definition: wm_draw.c:1360
int xy[2]
Definition: wm_draw.c:135
wmEventHandler_Dropbox * WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
void WM_main_add_notifier(unsigned int type, void *reference)
int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmEventHandler_Keymap * WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
wmOperatorType * ot
Definition: wm_files.c:3479
wmGizmoGroupTypeRef * WM_gizmogrouptype_append_and_link(wmGizmoMapType *gzmap_type, void(*wtfunc)(struct wmGizmoGroupType *))
wmGizmoGroupType * WM_gizmogrouptype_append(void(*wtfunc)(struct wmGizmoGroupType *))
wmGizmoMapType * WM_gizmomaptype_ensure(const struct wmGizmoMapType_Params *gzmap_params)
void WM_gizmomap_tag_refresh(wmGizmoMap *gzmap)
Definition: wm_gizmo_map.c:308
void WM_gizmotype_append(void(*gtfunc)(struct wmGizmoType *))
Definition: wm_gizmo_type.c:93
void WM_jobs_kill_type(struct wmWindowManager *wm, const void *owner, int job_type)
Definition: wm_jobs.c:572
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:852
#define WM_msg_subscribe_rna_anon_prop(mbus, type_, prop_, value)
#define WM_msg_subscribe_rna_anon_type(mbus, type_, value)
void WM_msg_subscribe_rna_params(struct wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
void WM_operator_properties_id_lookup_set_from_id(PointerRNA *ptr, const ID *id)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
Definition: wm_operators.c:661
void WM_operator_properties_free(PointerRNA *ptr)
Definition: wm_operators.c:783
void WM_toolsystem_do_msg_notify_tag_refresh(bContext *C, wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val)
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2217