Blender  V3.3
space_node.cc
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 "DNA_gpencil_types.h"
9 #include "DNA_light_types.h"
10 #include "DNA_material_types.h"
11 #include "DNA_node_types.h"
12 #include "DNA_world_types.h"
13 
14 #include "MEM_guardedalloc.h"
15 
16 #include "BKE_context.h"
17 #include "BKE_lib_id.h"
18 #include "BKE_lib_remap.h"
19 #include "BKE_node.h"
20 #include "BKE_screen.h"
21 
22 #include "ED_node.h"
23 #include "ED_render.h"
24 #include "ED_screen.h"
25 #include "ED_space_api.h"
26 
27 #include "UI_resources.h"
28 #include "UI_view2d.h"
29 
30 #include "RNA_access.h"
31 #include "RNA_define.h"
32 #include "RNA_enum_types.h"
33 #include "RNA_prototypes.h"
34 
35 #include "WM_api.h"
36 #include "WM_types.h"
37 
38 #include "node_intern.hh" /* own include */
39 
40 using blender::float2;
41 
42 /* ******************** tree path ********************* */
43 
45 {
47  MEM_freeN(path);
48  }
50 
51  if (ntree) {
52  bNodeTreePath *path = MEM_cnew<bNodeTreePath>("node tree path");
53  path->nodetree = ntree;
55 
56  /* copy initial offset from bNodeTree */
58 
59  if (id) {
60  BLI_strncpy(path->display_name, id->name + 2, sizeof(path->display_name));
61  }
62 
63  BLI_addtail(&snode->treepath, path);
64 
65  if (ntree->type != NTREE_GEOMETRY) {
66  /* This can probably be removed for all node tree types. It mainly exists because it was not
67  * possible to store id references in custom properties. Also see T36024. I don't want to
68  * remove it for all tree types in bcon3 though. */
70  }
71  }
72 
73  /* update current tree */
74  snode->nodetree = snode->edittree = ntree;
75  snode->id = id;
76  snode->from = from;
77 
79 
81 }
82 
84 {
85  bNodeTreePath *path = MEM_cnew<bNodeTreePath>("node tree path");
86  bNodeTreePath *prev_path = (bNodeTreePath *)snode->treepath.last;
87  path->nodetree = ntree;
88  if (gnode) {
89  if (prev_path) {
90  path->parent_key = BKE_node_instance_key(prev_path->parent_key, prev_path->nodetree, gnode);
91  }
92  else {
94  }
95 
96  BLI_strncpy(path->node_name, gnode->name, sizeof(path->node_name));
97  BLI_strncpy(path->display_name, gnode->name, sizeof(path->display_name));
98  }
99  else {
101  }
102 
103  /* copy initial offset from bNodeTree */
105 
106  BLI_addtail(&snode->treepath, path);
107 
109 
110  /* update current tree */
111  snode->edittree = ntree;
112 
114 
116 }
117 
119 {
120  bNodeTreePath *path = (bNodeTreePath *)snode->treepath.last;
121 
122  /* don't remove root */
123  if (path == snode->treepath.first) {
124  return;
125  }
126 
127  BLI_remlink(&snode->treepath, path);
128  MEM_freeN(path);
129 
130  /* update current tree */
131  path = (bNodeTreePath *)snode->treepath.last;
132  snode->edittree = path->nodetree;
133 
135 
136  /* listener updates the View2D center from edittree */
138 }
139 
141 {
142  return BLI_listbase_count(&snode->treepath);
143 }
144 
146 {
147  bNodeTreePath *path;
148  int i;
149  for (path = (bNodeTreePath *)snode->treepath.last, i = 0; path; path = path->prev, i++) {
150  if (i == level) {
151  return path->nodetree;
152  }
153  }
154  return nullptr;
155 }
156 
158 {
159  int length = 0;
160  int i = 0;
161  LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
162  length += strlen(path->display_name);
163  if (i > 0) {
164  length += 1; /* for separator char */
165  }
166  }
167  return length;
168 }
169 
170 void ED_node_tree_path_get(SpaceNode *snode, char *value)
171 {
172  int i = 0;
173 
174  value[0] = '\0';
175  LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
176  if (i == 0) {
177  strcpy(value, path->display_name);
178  value += strlen(path->display_name);
179  }
180  else {
181  sprintf(value, "/%s", path->display_name);
182  value += strlen(path->display_name) + 1;
183  }
184  }
185 }
186 
188 {
189  bNodeTreePath *path = (bNodeTreePath *)snode->treepath.last;
190  if (snode->nodetree && path) {
191  snode->nodetree->active_viewer_key = path->parent_key;
192  }
193 }
194 
195 void ED_node_cursor_location_get(const SpaceNode *snode, float value[2])
196 {
197  copy_v2_v2(value, snode->runtime->cursor);
198 }
199 
200 void ED_node_cursor_location_set(SpaceNode *snode, const float value[2])
201 {
202  copy_v2_v2(snode->runtime->cursor, value);
203 }
204 
205 namespace blender::ed::space_node {
206 
208 {
209  const bNodeTreePath *path = (bNodeTreePath *)snode.treepath.last;
210 
211  if (path && path->prev) {
212  return float2(path->view_center) - float2(path->prev->view_center);
213  }
214  return float2(0);
215 }
216 
217 /* ******************** default callbacks for node space ***************** */
218 
220 {
221  SpaceNode *snode = MEM_cnew<SpaceNode>("initnode");
222  snode->spacetype = SPACE_NODE;
223 
227 
228  /* backdrop */
229  snode->zoom = 1.0f;
230 
231  /* select the first tree type for valid type */
232  NODE_TREE_TYPES_BEGIN (treetype) {
233  strcpy(snode->tree_idname, treetype->idname);
234  break;
235  }
237 
238  /* header */
239  ARegion *region = MEM_cnew<ARegion>("header for node");
240 
241  BLI_addtail(&snode->regionbase, region);
242  region->regiontype = RGN_TYPE_HEADER;
244 
245  /* buttons/list view */
246  region = MEM_cnew<ARegion>("buttons for node");
247 
248  BLI_addtail(&snode->regionbase, region);
249  region->regiontype = RGN_TYPE_UI;
250  region->alignment = RGN_ALIGN_RIGHT;
251 
252  /* toolbar */
253  region = MEM_cnew<ARegion>("node tools");
254 
255  BLI_addtail(&snode->regionbase, region);
256  region->regiontype = RGN_TYPE_TOOLS;
257  region->alignment = RGN_ALIGN_LEFT;
258 
259  region->flag = RGN_FLAG_HIDDEN;
260 
261  /* main region */
262  region = MEM_cnew<ARegion>("main region for node");
263 
264  BLI_addtail(&snode->regionbase, region);
265  region->regiontype = RGN_TYPE_WINDOW;
266 
267  region->v2d.tot.xmin = -12.8f * U.widget_unit;
268  region->v2d.tot.ymin = -12.8f * U.widget_unit;
269  region->v2d.tot.xmax = 38.4f * U.widget_unit;
270  region->v2d.tot.ymax = 38.4f * U.widget_unit;
271 
272  region->v2d.cur = region->v2d.tot;
273 
274  region->v2d.min[0] = 1.0f;
275  region->v2d.min[1] = 1.0f;
276 
277  region->v2d.max[0] = 32000.0f;
278  region->v2d.max[1] = 32000.0f;
279 
280  region->v2d.minzoom = 0.05f;
281  region->v2d.maxzoom = 2.31f;
282 
285  region->v2d.keeptot = 0;
286 
287  return (SpaceLink *)snode;
288 }
289 
290 static void node_free(SpaceLink *sl)
291 {
292  SpaceNode *snode = (SpaceNode *)sl;
293 
294  LISTBASE_FOREACH_MUTABLE (bNodeTreePath *, path, &snode->treepath) {
295  MEM_freeN(path);
296  }
297 
298  if (snode->runtime) {
299  snode->runtime->linkdrag.reset();
300  MEM_freeN(snode->runtime);
301  }
302 }
303 
304 /* spacetype; init callback */
305 static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *area)
306 {
307  SpaceNode *snode = (SpaceNode *)area->spacedata.first;
308 
309  if (snode->runtime == nullptr) {
310  snode->runtime = MEM_new<SpaceNode_Runtime>(__func__);
311  }
312 }
313 
314 static bool any_node_uses_id(const bNodeTree *ntree, const ID *id)
315 {
316  if (ELEM(nullptr, ntree, id)) {
317  return false;
318  }
320  if (node->id == id) {
321  return true;
322  }
323  }
324  return false;
325 }
326 
334 {
335  if (!ED_node_is_compositor(snode)) {
336  return;
337  }
338 
339  if (snode->flag & SNODE_AUTO_RENDER) {
340  snode->runtime->recalc_auto_compositing = true;
342  }
343 }
344 
354 {
355  if (ED_node_is_compositor(snode)) {
356  snode->runtime->recalc_regular_compositing = true;
357  }
358 
360 }
361 
363 {
364  ScrArea *area = params->area;
365  wmNotifier *wmn = params->notifier;
366 
367  /* NOTE: #ED_area_tag_refresh will re-execute compositor. */
368  SpaceNode *snode = (SpaceNode *)area->spacedata.first;
369  /* shaderfrom is only used for new shading nodes, otherwise all shaders are from objects */
370  short shader_type = snode->shaderfrom;
371 
372  /* preview renders */
373  switch (wmn->category) {
374  case NC_SCENE:
375  switch (wmn->data) {
376  case ND_NODES: {
378  bNodeTreePath *path = (bNodeTreePath *)snode->treepath.last;
379  /* shift view to node tree center */
380  if (region && path) {
381  UI_view2d_center_set(&region->v2d, path->view_center[0], path->view_center[1]);
382  }
383 
385  break;
386  }
387  case ND_FRAME:
389  break;
390  case ND_COMPO_RESULT:
392  break;
393  case ND_TRANSFORM_DONE:
395  break;
396  case ND_LAYER_CONTENT:
398  break;
399  }
400  break;
401 
402  /* future: add ID checks? */
403  case NC_MATERIAL:
404  if (ED_node_is_shader(snode)) {
405  if (wmn->data == ND_SHADING) {
407  }
408  else if (wmn->data == ND_SHADING_DRAW) {
410  }
411  else if (wmn->data == ND_SHADING_LINKS) {
413  }
414  }
415  break;
416  case NC_TEXTURE:
417  if (ED_node_is_shader(snode) || ED_node_is_texture(snode)) {
418  if (wmn->data == ND_NODES) {
420  }
421  }
422  break;
423  case NC_WORLD:
424  if (ED_node_is_shader(snode) && shader_type == SNODE_SHADER_WORLD) {
426  }
427  break;
428  case NC_OBJECT:
429  if (ED_node_is_shader(snode)) {
430  if (wmn->data == ND_OB_SHADING) {
432  }
433  }
434  else if (ED_node_is_geometry(snode)) {
435  /* Rather strict check: only redraw when the reference matches the current editor's ID. */
436  if (wmn->data == ND_MODIFIER) {
437  if (wmn->reference == snode->id || snode->id == nullptr) {
439  }
440  }
441  }
442  break;
443  case NC_SPACE:
444  if (wmn->data == ND_SPACE_NODE) {
446  }
447  else if (wmn->data == ND_SPACE_NODE_VIEW) {
449  }
450  break;
451  case NC_NODE:
452  if (wmn->action == NA_EDITED) {
454  }
455  else if (wmn->action == NA_SELECTED) {
457  }
458  break;
459  case NC_SCREEN:
460  switch (wmn->data) {
461  case ND_ANIMPLAY:
463  break;
464  }
465  break;
466  case NC_MASK:
467  if (wmn->action == NA_EDITED) {
468  if (snode->nodetree && snode->nodetree->type == NTREE_COMPOSIT) {
470  }
471  }
472  break;
473 
474  case NC_IMAGE:
475  if (wmn->action == NA_EDITED) {
476  if (ED_node_is_compositor(snode)) {
477  /* Without this check drawing on an image could become very slow when the compositor is
478  * open. */
479  if (any_node_uses_id(snode->nodetree, (ID *)wmn->reference)) {
481  }
482  }
483  }
484  break;
485 
486  case NC_MOVIECLIP:
487  if (wmn->action == NA_EDITED) {
488  if (ED_node_is_compositor(snode)) {
489  if (any_node_uses_id(snode->nodetree, (ID *)wmn->reference)) {
491  }
492  }
493  }
494  break;
495 
496  case NC_LINESTYLE:
497  if (ED_node_is_shader(snode) && shader_type == SNODE_SHADER_LINESTYLE) {
499  }
500  break;
501  case NC_WM:
502  if (wmn->data == ND_UNDO) {
504  }
505  break;
506  case NC_GPENCIL:
507  if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
509  }
510  break;
511  }
512 }
513 
514 static void node_area_refresh(const struct bContext *C, ScrArea *area)
515 {
516  /* default now: refresh node is starting preview */
517  SpaceNode *snode = (SpaceNode *)area->spacedata.first;
518 
520 
521  if (snode->nodetree) {
522  if (snode->nodetree->type == NTREE_COMPOSIT) {
523  Scene *scene = (Scene *)snode->id;
524  if (scene->use_nodes) {
525  /* recalc is set on 3d view changes for auto compo */
526  if (snode->runtime->recalc_auto_compositing) {
527  snode->runtime->recalc_auto_compositing = false;
528  snode->runtime->recalc_regular_compositing = false;
529  node_render_changed_exec((struct bContext *)C, nullptr);
530  }
531  else if (snode->runtime->recalc_regular_compositing) {
532  snode->runtime->recalc_regular_compositing = false;
534  }
535  }
536  }
537  }
538 }
539 
541 {
542  SpaceNode *snode = (SpaceNode *)sl;
543  SpaceNode *snoden = (SpaceNode *)MEM_dupallocN(snode);
544 
545  BLI_duplicatelist(&snoden->treepath, &snode->treepath);
546 
547  snoden->runtime = nullptr;
548 
549  /* NOTE: no need to set node tree user counts,
550  * the editor only keeps at least 1 (id_us_ensure_real),
551  * which is already done by the original SpaceNode.
552  */
553 
554  return (SpaceLink *)snoden;
555 }
556 
557 /* add handlers, stuff you only do once or on area/region changes */
559 {
560  wmKeyMap *keymap;
561 
562  ED_region_panels_init(wm, region);
563 
564  keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
565  WM_event_add_keymap_handler(&region->handlers, keymap);
566 }
567 
568 static void node_buttons_region_draw(const bContext *C, ARegion *region)
569 {
570  ED_region_panels(C, region);
571 }
572 
573 /* add handlers, stuff you only do once or on area/region changes */
575 {
576  wmKeyMap *keymap;
577 
578  ED_region_panels_init(wm, region);
579 
580  keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
581  WM_event_add_keymap_handler(&region->handlers, keymap);
582 }
583 
584 static void node_toolbar_region_draw(const bContext *C, ARegion *region)
585 {
586  ED_region_panels(C, region);
587 }
588 
589 static void node_cursor(wmWindow *win, ScrArea *area, ARegion *region)
590 {
591  SpaceNode *snode = (SpaceNode *)area->spacedata.first;
592 
593  /* convert mouse coordinates to v2d space */
594  UI_view2d_region_to_view(&region->v2d,
595  win->eventstate->xy[0] - region->winrct.xmin,
596  win->eventstate->xy[1] - region->winrct.ymin,
597  &snode->runtime->cursor[0],
598  &snode->runtime->cursor[1]);
599 
600  /* here snode->runtime->cursor is used to detect the node edge for sizing */
601  node_set_cursor(*win, *snode, snode->runtime->cursor);
602 
603  /* XXX snode->runtime->cursor is in placing new nodes space */
604  snode->runtime->cursor[0] /= UI_DPI_FAC;
605  snode->runtime->cursor[1] /= UI_DPI_FAC;
606 }
607 
608 /* Initialize main region, setting handlers. */
610 {
611  wmKeyMap *keymap;
612  ListBase *lb;
613 
614  UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
615 
616  /* own keymaps */
617  keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
618  WM_event_add_keymap_handler(&region->handlers, keymap);
619 
620  keymap = WM_keymap_ensure(wm->defaultconf, "Node Editor", SPACE_NODE, 0);
622 
623  /* add drop boxes */
624  lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
625 
627 
628  /* The backdrop image gizmo needs to change together with the view. So always refresh gizmos on
629  * region size changes. */
631 }
632 
633 static void node_main_region_draw(const bContext *C, ARegion *region)
634 {
635  node_draw_space(*C, *region);
636 }
637 
638 /* ************* dropboxes ************* */
639 
640 static bool node_group_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
641 {
642  return WM_drag_is_ID_type(drag, ID_NT);
643 }
644 
645 static bool node_object_drop_poll(bContext *C, wmDrag *drag, const wmEvent *UNUSED(event))
646 {
648 }
649 
650 static bool node_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *UNUSED(event))
651 {
653 }
654 
655 static bool node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
656 {
657  if (drag->type == WM_DRAG_PATH) {
658  /* rule might not work? */
659  return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE));
660  }
661  return WM_drag_is_ID_type(drag, ID_IM);
662 }
663 
664 static bool node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
665 {
666  return WM_drag_is_ID_type(drag, ID_MSK);
667 }
668 
669 static void node_group_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
670 {
672 
673  RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
674 }
675 
676 static void node_id_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
677 {
679 
680  RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
681 }
682 
683 static void node_id_path_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
684 {
686 
687  if (id) {
688  RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
689  RNA_struct_property_unset(drop->ptr, "filepath");
690  }
691  else if (drag->path[0]) {
692  RNA_string_set(drop->ptr, "filepath", drag->path);
693  RNA_struct_property_unset(drop->ptr, "name");
694  }
695 }
696 
697 /* this region dropbox definition */
698 static void node_dropboxes()
699 {
700  ListBase *lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
701 
702  WM_dropbox_add(lb,
703  "NODE_OT_add_object",
707  nullptr);
708  WM_dropbox_add(lb,
709  "NODE_OT_add_collection",
713  nullptr);
714  WM_dropbox_add(lb,
715  "NODE_OT_add_group",
719  nullptr);
720  WM_dropbox_add(lb,
721  "NODE_OT_add_file",
725  nullptr);
726  WM_dropbox_add(lb,
727  "NODE_OT_add_mask",
731  nullptr);
732 }
733 
734 /* ************* end drop *********** */
735 
736 /* add handlers, stuff you only do once or on area/region changes */
738 {
739  ED_region_header_init(region);
740 }
741 
742 static void node_header_region_draw(const bContext *C, ARegion *region)
743 {
744  /* find and set the context */
746 
747  ED_region_header(C, region);
748 }
749 
750 /* used for header + main region */
752 {
753  ARegion *region = params->region;
754  wmNotifier *wmn = params->notifier;
755  wmGizmoMap *gzmap = region->gizmo_map;
756 
757  /* context changes */
758  switch (wmn->category) {
759  case NC_SPACE:
760  switch (wmn->data) {
761  case ND_SPACE_NODE:
762  ED_region_tag_redraw(region);
763  break;
764  case ND_SPACE_NODE_VIEW:
766  break;
767  }
768  break;
769  case NC_SCREEN:
770  if (wmn->data == ND_LAYOUTSET || wmn->action == NA_EDITED) {
772  }
773  switch (wmn->data) {
774  case ND_ANIMPLAY:
775  case ND_LAYER:
776  ED_region_tag_redraw(region);
777  break;
778  }
779  break;
780  case NC_WM:
781  if (wmn->data == ND_JOB) {
782  ED_region_tag_redraw(region);
783  }
784  break;
785  case NC_SCENE:
786  ED_region_tag_redraw(region);
787  if (wmn->data == ND_RENDER_RESULT) {
789  }
790  break;
791  case NC_NODE:
792  ED_region_tag_redraw(region);
793  if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
795  }
796  break;
797  case NC_MATERIAL:
798  case NC_TEXTURE:
799  case NC_WORLD:
800  case NC_LINESTYLE:
801  ED_region_tag_redraw(region);
802  break;
803  case NC_OBJECT:
804  if (wmn->data == ND_OB_SHADING) {
805  ED_region_tag_redraw(region);
806  }
807  break;
808  case NC_ID:
809  if (wmn->action == NA_RENAME) {
810  ED_region_tag_redraw(region);
811  }
812  break;
813  case NC_GPENCIL:
814  if (wmn->action == NA_EDITED) {
815  ED_region_tag_redraw(region);
816  }
817  else if (wmn->data & ND_GPENCIL_EDITMODE) {
818  ED_region_tag_redraw(region);
819  }
820  break;
821  }
822 }
823 
824 } // namespace blender::ed::space_node
825 
826 /* Outside of blender namespace to avoid Python documentation build error with `ctypes`. */
827 extern "C" {
828 const char *node_context_dir[] = {
829  "selected_nodes", "active_node", "light", "material", "world", nullptr};
830 };
831 
832 namespace blender::ed::space_node {
833 
834 static int /*eContextResult*/ node_context(const bContext *C,
835  const char *member,
837 {
838  SpaceNode *snode = CTX_wm_space_node(C);
839 
840  if (CTX_data_dir(member)) {
842  return CTX_RESULT_OK;
843  }
844  if (CTX_data_equals(member, "selected_nodes")) {
845  if (snode->edittree) {
847  if (node->flag & NODE_SELECT) {
848  CTX_data_list_add(result, &snode->edittree->id, &RNA_Node, node);
849  }
850  }
851  }
853  return CTX_RESULT_OK;
854  }
855  if (CTX_data_equals(member, "active_node")) {
856  if (snode->edittree) {
857  bNode *node = nodeGetActive(snode->edittree);
858  CTX_data_pointer_set(result, &snode->edittree->id, &RNA_Node, node);
859  }
860 
862  return CTX_RESULT_OK;
863  }
864  if (CTX_data_equals(member, "node_previews")) {
865  if (snode->nodetree) {
867  result, &snode->nodetree->id, &RNA_NodeInstanceHash, snode->nodetree->previews);
868  }
869 
871  return CTX_RESULT_OK;
872  }
873  if (CTX_data_equals(member, "material")) {
874  if (snode->id && GS(snode->id->name) == ID_MA) {
876  }
877  return CTX_RESULT_OK;
878  }
879  if (CTX_data_equals(member, "light")) {
880  if (snode->id && GS(snode->id->name) == ID_LA) {
882  }
883  return CTX_RESULT_OK;
884  }
885  if (CTX_data_equals(member, "world")) {
886  if (snode->id && GS(snode->id->name) == ID_WO) {
888  }
889  return CTX_RESULT_OK;
890  }
891 
893 }
894 
895 static void node_widgets()
896 {
897  /* Create the widget-map for the area here. */
904 }
905 
906 static void node_id_remap_cb(ID *old_id, ID *new_id, void *user_data)
907 {
908  SpaceNode *snode = static_cast<SpaceNode *>(user_data);
909 
910  if (snode->id == old_id) {
911  /* nasty DNA logic for SpaceNode:
912  * ideally should be handled by editor code, but would be bad level call
913  */
914  BLI_freelistN(&snode->treepath);
915 
916  /* XXX Untested in case new_id != nullptr... */
917  snode->id = new_id;
918  snode->from = nullptr;
919  snode->nodetree = nullptr;
920  snode->edittree = nullptr;
921  }
922  else if (GS(old_id->name) == ID_OB) {
923  if (snode->from == old_id) {
924  if (new_id == nullptr) {
925  snode->flag &= ~SNODE_PIN;
926  }
927  snode->from = new_id;
928  }
929  }
930  else if (GS(old_id->name) == ID_GD) {
931  if ((ID *)snode->gpd == old_id) {
932  snode->gpd = (bGPdata *)new_id;
933  id_us_min(old_id);
934  id_us_plus(new_id);
935  }
936  }
937  else if (GS(old_id->name) == ID_NT) {
938  bNodeTreePath *path, *path_next;
939 
940  for (path = (bNodeTreePath *)snode->treepath.first; path; path = path->next) {
941  if ((ID *)path->nodetree == old_id) {
942  path->nodetree = (bNodeTree *)new_id;
943  id_us_ensure_real(new_id);
944  }
945  if (path == snode->treepath.first) {
946  /* first nodetree in path is same as snode->nodetree */
947  snode->nodetree = path->nodetree;
948  }
949  if (path->nodetree == nullptr) {
950  break;
951  }
952  }
953 
954  /* remaining path entries are invalid, remove */
955  for (; path; path = path_next) {
956  path_next = path->next;
957 
958  BLI_remlink(&snode->treepath, path);
959  MEM_freeN(path);
960  }
961 
962  /* edittree is just the last in the path,
963  * set this directly since the path may have been shortened above */
964  if (snode->treepath.last) {
965  path = (bNodeTreePath *)snode->treepath.last;
966  snode->edittree = path->nodetree;
967  }
968  else {
969  snode->edittree = nullptr;
970  }
971  }
972 }
973 
975  SpaceLink *slink,
976  const struct IDRemapper *mappings)
977 {
978  /* Although we should be able to perform all the mappings in a single go this lead to issues when
979  * running the python test cases. Somehow the nodetree/edittree weren't updated to the new
980  * pointers that generated a SEGFAULT.
981  *
982  * To move forward we should perhaps remove snode->edittree and snode->nodetree as they are just
983  * copies of pointers. All usages should be calling a function that will receive the appropriate
984  * instance.
985  *
986  * We could also move a remap address at a time to use the IDRemapper as that should get closer
987  * to cleaner code. See {D13615} for more information about this topic.
988  */
989  BKE_id_remapper_iter(mappings, node_id_remap_cb, slink);
990 }
991 
993 {
994  SpaceNode *snode = (SpaceNode *)area->spacedata.first;
996 }
997 
998 static void node_space_subtype_set(ScrArea *area, int value)
999 {
1000  SpaceNode *snode = (SpaceNode *)area->spacedata.first;
1002 }
1003 
1004 static void node_space_subtype_item_extend(bContext *C, EnumPropertyItem **item, int *totitem)
1005 {
1006  bool free;
1008  RNA_enum_items_add(item, totitem, item_src);
1009  if (free) {
1010  MEM_freeN((void *)item_src);
1011  }
1012 }
1013 
1014 } // namespace blender::ed::space_node
1015 
1017 {
1018  using namespace blender::ed::space_node;
1019 
1020  SpaceType *st = MEM_cnew<SpaceType>("spacetype node");
1021  ARegionType *art;
1022 
1023  st->spaceid = SPACE_NODE;
1024  strncpy(st->name, "Node", BKE_ST_MAXNAME);
1025 
1026  st->create = node_create;
1027  st->free = node_free;
1028  st->init = node_init;
1029  st->duplicate = node_duplicate;
1030  st->operatortypes = node_operatortypes;
1031  st->keymap = node_keymap;
1032  st->listener = node_area_listener;
1033  st->refresh = node_area_refresh;
1034  st->context = node_context;
1035  st->dropboxes = node_dropboxes;
1036  st->gizmos = node_widgets;
1037  st->id_remap = node_id_remap;
1038  st->space_subtype_item_extend = node_space_subtype_item_extend;
1039  st->space_subtype_get = node_space_subtype_get;
1040  st->space_subtype_set = node_space_subtype_set;
1041 
1042  /* regions: main window */
1043  art = MEM_cnew<ARegionType>("spacetype node region");
1044  art->regionid = RGN_TYPE_WINDOW;
1045  art->init = node_main_region_init;
1046  art->draw = node_main_region_draw;
1050  art->cursor = node_cursor;
1051  art->event_cursor = true;
1052  art->clip_gizmo_events_by_ui = true;
1053 
1054  BLI_addhead(&st->regiontypes, art);
1055 
1056  /* regions: header */
1057  art = MEM_cnew<ARegionType>("spacetype node region");
1058  art->regionid = RGN_TYPE_HEADER;
1059  art->prefsizey = HEADERY;
1064 
1065  BLI_addhead(&st->regiontypes, art);
1066 
1067  /* regions: listview/buttons */
1068  art = MEM_cnew<ARegionType>("spacetype node region");
1069  art->regionid = RGN_TYPE_UI;
1076  BLI_addhead(&st->regiontypes, art);
1077 
1078  /* regions: toolbar */
1079  art = MEM_cnew<ARegionType>("spacetype view3d tools region");
1080  art->regionid = RGN_TYPE_TOOLS;
1081  art->prefsizex = 58; /* XXX */
1082  art->prefsizey = 50; /* XXX */
1089  BLI_addhead(&st->regiontypes, art);
1090 
1092 }
void CTX_data_dir_set(bContextDataResult *result, const char **dir)
Definition: context.c:696
struct SpaceNode * CTX_wm_space_node(const bContext *C)
Definition: context.c:878
bool CTX_data_equals(const char *member, const char *str)
Definition: context.c:634
void CTX_data_pointer_set(bContextDataResult *result, struct ID *id, StructRNA *type, void *data)
Definition: context.c:649
void CTX_data_id_pointer_set(bContextDataResult *result, struct ID *id)
Definition: context.c:644
bool CTX_data_dir(const char *member)
Definition: context.c:639
@ CTX_DATA_TYPE_POINTER
Definition: BKE_context.h:232
@ CTX_DATA_TYPE_COLLECTION
Definition: BKE_context.h:233
@ CTX_RESULT_MEMBER_NOT_FOUND
Definition: BKE_context.h:75
@ CTX_RESULT_OK
Definition: BKE_context.h:72
void CTX_data_list_add(bContextDataResult *result, struct ID *id, StructRNA *type, void *data)
Definition: context.c:667
void CTX_data_type_set(struct bContextDataResult *result, short type)
Definition: context.c:701
void id_us_min(struct ID *id)
Definition: lib_id.c:313
void id_us_ensure_real(struct ID *id)
Definition: lib_id.c:260
void id_us_plus(struct ID *id)
Definition: lib_id.c:305
void BKE_id_remapper_iter(const struct IDRemapper *id_remapper, IDRemapperIterFunction func, void *user_data)
const bNodeInstanceKey NODE_INSTANCE_KEY_BASE
Definition: node.cc:3896
struct bNode * nodeGetActive(struct bNodeTree *ntree)
Definition: node.cc:3601
#define NODE_TREE_TYPES_BEGIN(ntype)
Definition: BKE_node.h:426
#define NODE_TREE_TYPES_END
Definition: BKE_node.h:433
bNodeInstanceKey BKE_node_instance_key(bNodeInstanceKey parent_key, const struct bNodeTree *ntree, const struct bNode *node)
struct ARegion * BKE_area_find_region_type(const struct ScrArea *area, int type)
#define BKE_ST_MAXNAME
Definition: BKE_screen.h:53
void BKE_spacetype_register(struct SpaceType *st)
Definition: screen.c:391
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:102
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 void void void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
Definition: BLI_listbase.h:348
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:273
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
Definition: BLI_listbase.h:344
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
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:100
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void copy_v2_v2(float r[2], const float a[2])
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
#define UNUSED(x)
#define ELEM(...)
@ ID_IM
Definition: DNA_ID_enums.h:53
@ ID_NT
Definition: DNA_ID_enums.h:68
@ ID_LA
Definition: DNA_ID_enums.h:55
@ ID_MSK
Definition: DNA_ID_enums.h:74
@ ID_GD
Definition: DNA_ID_enums.h:71
@ 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
#define NTREE_GEOMETRY
#define NTREE_COMPOSIT
#define NODE_SELECT
#define HEADERY
@ RGN_FLAG_HIDDEN
@ RGN_TYPE_UI
@ RGN_TYPE_WINDOW
@ RGN_TYPE_HEADER
@ RGN_TYPE_TOOLS
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_TOP
@ RGN_ALIGN_RIGHT
@ SN_OVERLAY_SHOW_PATH
@ SN_OVERLAY_SHOW_WIRE_COLORS
@ SN_OVERLAY_SHOW_OVERLAYS
@ SNODE_PIN
@ SNODE_USE_ALPHA
@ SNODE_AUTO_RENDER
@ SNODE_SHOW_GPENCIL
@ SPACE_NODE
@ SNODE_SHADER_WORLD
@ SNODE_SHADER_LINESTYLE
@ USER_HEADER_BOTTOM
@ V2D_LIMITZOOM
@ V2D_KEEPASPECT
@ V2D_SCROLL_RIGHT
@ V2D_SCROLL_BOTTOM
bool ED_node_is_compositor(struct SpaceNode *snode)
Definition: node_edit.cc:466
void ED_node_set_tree_type(struct SpaceNode *snode, struct bNodeTreeType *typeinfo)
Definition: node_edit.cc:456
bool ED_node_is_texture(struct SpaceNode *snode)
Definition: node_edit.cc:476
bool ED_node_is_geometry(struct SpaceNode *snode)
Definition: node_edit.cc:481
bool ED_node_is_shader(struct SpaceNode *snode)
Definition: node_edit.cc:471
void ED_node_composite_job(const struct bContext *C, struct bNodeTree *nodetree, struct Scene *scene_owner)
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:729
@ 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_area_do_mgs_subscribe_for_tool_ui(const struct wmRegionMessageSubscribeParams *params)
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(const struct bContext *C, struct ARegion *region)
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
Read Guarded memory(de)allocation.
struct bNodeTreeType * rna_node_tree_type_from_enum(int value)
int rna_node_tree_idname_to_enum(const char *idname)
const EnumPropertyItem * RNA_enum_node_tree_types_itemf_impl(struct bContext *C, bool *r_free)
#define C
Definition: RandGen.cpp:25
#define UI_SIDEBAR_PANEL_WIDTH
Definition: UI_interface.h:242
bool UI_but_active_drop_name(const struct bContext *C)
#define UI_DPI_FAC
Definition: UI_interface.h:305
void UI_view2d_center_set(struct View2D *v2d, float x, float y)
Definition: view2d.cc:1946
void UI_view2d_region_reinit(struct View2D *v2d, short type, int winx, int winy)
Definition: view2d.cc:217
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
@ V2D_COMMONVIEW_CUSTOM
Definition: UI_view2d.h:34
#define NC_WORLD
Definition: WM_types.h:337
#define ND_TRANSFORM_DONE
Definition: WM_types.h:400
#define ND_SHADING
Definition: WM_types.h:425
#define NC_ID
Definition: WM_types.h:345
#define NC_NODE
Definition: WM_types.h:344
#define ND_RENDER_RESULT
Definition: WM_types.h:394
#define ND_JOB
Definition: WM_types.h:364
#define NC_WM
Definition: WM_types.h:324
#define WM_DRAG_PATH
Definition: WM_types.h:1050
#define ND_GPENCIL_EDITMODE
Definition: WM_types.h:451
#define NC_LINESTYLE
Definition: WM_types.h:350
#define ND_SPACE_NODE
Definition: WM_types.h:469
#define ND_COMPO_RESULT
Definition: WM_types.h:395
#define NC_SCREEN
Definition: WM_types.h:327
#define NC_MOVIECLIP
Definition: WM_types.h:347
#define ND_ANIMPLAY
Definition: WM_types.h:372
#define NC_SCENE
Definition: WM_types.h:328
#define ND_SPACE_NODE_VIEW
Definition: WM_types.h:479
#define ND_LAYER_CONTENT
Definition: WM_types.h:402
#define ND_NODES
Definition: WM_types.h:384
#define ND_MODIFIER
Definition: WM_types.h:411
#define NA_EDITED
Definition: WM_types.h:523
#define NC_MATERIAL
Definition: WM_types.h:330
#define NC_IMAGE
Definition: WM_types.h:334
#define ND_UNDO
Definition: WM_types.h:365
#define ND_FRAME
Definition: WM_types.h:382
#define NC_GPENCIL
Definition: WM_types.h:349
#define NC_TEXTURE
Definition: WM_types.h:331
#define ND_LAYER
Definition: WM_types.h:398
#define NC_MASK
Definition: WM_types.h:348
#define NA_RENAME
Definition: WM_types.h:527
#define ND_OB_SHADING
Definition: WM_types.h:406
#define ND_LAYOUTSET
Definition: WM_types.h:374
#define NC_OBJECT
Definition: WM_types.h:329
#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
unsigned int U
Definition: btGjkEpa3.h:78
OperationNode * node
StackEntry * from
Scene scene
void * user_data
bNodeTree * ntree
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define GS(x)
Definition: iris.c:225
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:28
static void area(int d1, int d2, int e1, int e2, float weights[2])
static void node_widgets()
Definition: space_node.cc:895
static void node_space_subtype_item_extend(bContext *C, EnumPropertyItem **item, int *totitem)
Definition: space_node.cc:1004
void node_set_cursor(wmWindow &win, SpaceNode &snode, const float2 &cursor)
Definition: node_draw.cc:2522
static void node_id_path_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: space_node.cc:683
static void node_area_refresh(const struct bContext *C, ScrArea *area)
Definition: space_node.cc:514
static void node_toolbar_region_draw(const bContext *C, ARegion *region)
Definition: space_node.cc:584
static void node_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
Definition: space_node.cc:737
static void node_header_region_draw(const bContext *C, ARegion *region)
Definition: space_node.cc:742
static void node_main_region_init(wmWindowManager *wm, ARegion *region)
Definition: space_node.cc:609
static void node_id_remap_cb(ID *old_id, ID *new_id, void *user_data)
Definition: space_node.cc:906
static SpaceLink * node_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
Definition: space_node.cc:219
static void node_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, const struct IDRemapper *mappings)
Definition: space_node.cc:974
void NODE_GGT_backdrop_corner_pin(wmGizmoGroupType *gzgt)
Definition: node_gizmo.cc:613
static bool node_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *UNUSED(event))
Definition: space_node.cc:650
static bool node_group_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
Definition: space_node.cc:640
static bool node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
Definition: space_node.cc:655
static int node_space_subtype_get(ScrArea *area)
Definition: space_node.cc:992
void NODE_GGT_backdrop_crop(wmGizmoGroupType *gzgt)
Definition: node_gizmo.cc:386
static SpaceLink * node_duplicate(SpaceLink *sl)
Definition: space_node.cc:540
static bool node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
Definition: space_node.cc:664
static void node_region_listener(const wmRegionListenerParams *params)
Definition: space_node.cc:751
float2 space_node_group_offset(const SpaceNode &snode)
Definition: space_node.cc:207
static void node_area_tag_recalc_auto_compositing(SpaceNode *snode, ScrArea *area)
Definition: space_node.cc:333
static void node_free(SpaceLink *sl)
Definition: space_node.cc:290
static void node_id_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: space_node.cc:676
static void node_dropboxes()
Definition: space_node.cc:698
void NODE_GGT_backdrop_transform(wmGizmoGroupType *gzgt)
Definition: node_gizmo.cc:170
void snode_set_context(const bContext &C)
Definition: node_edit.cc:618
void NODE_GGT_backdrop_sun_beams(wmGizmoGroupType *gzgt)
Definition: node_gizmo.cc:491
static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *area)
Definition: space_node.cc:305
static void node_area_listener(const wmSpaceTypeListenerParams *params)
Definition: space_node.cc:362
void node_keymap(wmKeyConfig *keyconf)
Definition: node_ops.cc:114
static int node_context(const bContext *C, const char *member, bContextDataResult *result)
Definition: space_node.cc:834
void node_draw_space(const bContext &C, ARegion &region)
Definition: node_draw.cc:3054
static void node_cursor(wmWindow *win, ScrArea *area, ARegion *region)
Definition: space_node.cc:589
static void node_buttons_region_draw(const bContext *C, ARegion *region)
Definition: space_node.cc:568
int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
Definition: node_edit.cc:1565
static void node_toolbar_region_init(wmWindowManager *wm, ARegion *region)
Definition: space_node.cc:574
static bool node_object_drop_poll(bContext *C, wmDrag *drag, const wmEvent *UNUSED(event))
Definition: space_node.cc:645
static void node_main_region_draw(const bContext *C, ARegion *region)
Definition: space_node.cc:633
static bool any_node_uses_id(const bNodeTree *ntree, const ID *id)
Definition: space_node.cc:314
static void node_group_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: space_node.cc:669
static void node_buttons_region_init(wmWindowManager *wm, ARegion *region)
Definition: space_node.cc:558
static void node_area_tag_tree_recalc(SpaceNode *snode, ScrArea *area)
Definition: space_node.cc:353
static void node_space_subtype_set(ScrArea *area, int value)
Definition: space_node.cc:998
T length(const vec_base< T, Size > &a)
vec_base< float, 2 > float2
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_struct_property_unset(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5313
void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
Definition: rna_define.c:4465
void ED_node_tree_push(SpaceNode *snode, bNodeTree *ntree, bNode *gnode)
Definition: space_node.cc:83
void ED_node_cursor_location_set(SpaceNode *snode, const float value[2])
Definition: space_node.cc:200
void ED_node_tree_path_get(SpaceNode *snode, char *value)
Definition: space_node.cc:170
int ED_node_tree_depth(SpaceNode *snode)
Definition: space_node.cc:140
void ED_node_set_active_viewer_key(SpaceNode *snode)
Definition: space_node.cc:187
int ED_node_tree_path_length(SpaceNode *snode)
Definition: space_node.cc:157
void ED_node_tree_pop(SpaceNode *snode)
Definition: space_node.cc:118
bNodeTree * ED_node_tree_get(SpaceNode *snode, int level)
Definition: space_node.cc:145
const char * node_context_dir[]
Definition: space_node.cc:828
void ED_node_cursor_location_get(const SpaceNode *snode, float value[2])
Definition: space_node.cc:195
void ED_spacetype_node()
Definition: space_node.cc:1016
void ED_node_tree_start(SpaceNode *snode, bNodeTree *ntree, ID *id, ID *from)
Definition: space_node.cc:44
void(* draw)(const struct bContext *C, struct ARegion *region)
Definition: BKE_screen.h:151
bool clip_gizmo_events_by_ui
Definition: BKE_screen.h:213
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
void(* listener)(const wmRegionListenerParams *params)
Definition: BKE_screen.h:165
int keymapflag
Definition: BKE_screen.h:208
short event_cursor
Definition: BKE_screen.h:215
void(* init)(struct wmWindowManager *wm, struct ARegion *region)
Definition: BKE_screen.h:147
ListBase handlers
short alignment
short regiontype
struct wmGizmoMap * gizmo_map
Definition: DNA_ID.h:368
unsigned int session_uuid
Definition: DNA_ID.h:407
char name[66]
Definition: DNA_ID.h:378
void * last
Definition: DNA_listBase.h:31
void * first
Definition: DNA_listBase.h:31
char use_nodes
char tree_idname[64]
SpaceNode_Runtime * runtime
struct ID * from
ListBase regionbase
struct bGPdata * gpd
ListBase treepath
struct bNodeTree * edittree
struct ID * id
SpaceNodeOverlay overlay
struct bNodeTree * nodetree
float minzoom
short keeptot
float max[2]
short keepzoom
float min[2]
short scroll
float maxzoom
struct bNodeTree * nodetree
struct bNodeTreePath * next
struct bNodeTreePath * prev
bNodeInstanceKey parent_key
float view_center[2]
char display_name[64]
float view_center[2]
struct bNodeInstanceHash * previews
ListBase nodes
bNodeInstanceKey active_viewer_key
char name[64]
std::unique_ptr< bNodeLinkDrag > linkdrag
Definition: node_intern.hh:93
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 xmin
Definition: DNA_vec_types.h:63
char path[1024]
Definition: WM_types.h:1150
int icon
Definition: WM_types.h:1146
int type
Definition: WM_types.h:1148
struct PointerRNA * ptr
Definition: WM_types.h:1237
int xy[2]
Definition: WM_types.h:682
unsigned int data
Definition: WM_types.h:308
unsigned int action
Definition: WM_types.h:308
unsigned int category
Definition: WM_types.h:308
void * reference
Definition: WM_types.h:310
struct wmKeyConfig * defaultconf
struct wmEvent * eventstate
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_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
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
wmEventHandler_Dropbox * WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
void WM_main_add_notifier(unsigned int type, void *reference)
wmEventHandler_Keymap * WM_event_add_keymap_handler_v2d_mask(ListBase *handlers, wmKeyMap *keymap)
wmEventHandler_Keymap * WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
wmGizmoGroupTypeRef * WM_gizmogrouptype_append_and_link(wmGizmoMapType *gzmap_type, 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
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:852