Blender  V2.93
space_node.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2008 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include "DNA_gpencil_types.h"
25 #include "DNA_light_types.h"
26 #include "DNA_material_types.h"
27 #include "DNA_node_types.h"
28 #include "DNA_world_types.h"
29 
30 #include "MEM_guardedalloc.h"
31 
32 #include "BLI_blenlib.h"
33 #include "BLI_math.h"
34 
35 #include "BKE_context.h"
36 #include "BKE_lib_id.h"
37 #include "BKE_node.h"
38 #include "BKE_screen.h"
39 
40 #include "ED_node.h"
41 #include "ED_render.h"
42 #include "ED_screen.h"
43 #include "ED_space_api.h"
44 
45 #include "UI_resources.h"
46 #include "UI_view2d.h"
47 
48 #include "RNA_access.h"
49 #include "RNA_define.h"
50 #include "RNA_enum_types.h"
51 
52 #include "WM_api.h"
53 #include "WM_types.h"
54 
55 #include "node_intern.h" /* own include */
56 
57 /* ******************** tree path ********************* */
58 
60 {
61  bNodeTreePath *path, *path_next;
62  for (path = snode->treepath.first; path; path = path_next) {
63  path_next = path->next;
64  MEM_freeN(path);
65  }
67 
68  if (ntree) {
69  path = MEM_callocN(sizeof(bNodeTreePath), "node tree path");
70  path->nodetree = ntree;
72 
73  /* copy initial offset from bNodeTree */
75 
76  if (id) {
77  BLI_strncpy(path->display_name, id->name + 2, sizeof(path->display_name));
78  }
79 
80  BLI_addtail(&snode->treepath, path);
81 
82  if (ntree->type != NTREE_GEOMETRY) {
83  /* This can probably be removed for all node tree types. It mainly exists because it was not
84  * possible to store id references in custom properties. Also see T36024. I don't want to
85  * remove it for all tree types in bcon3 though. */
87  }
88  }
89 
90  /* update current tree */
91  snode->nodetree = snode->edittree = ntree;
92  snode->id = id;
93  snode->from = from;
94 
96 
98 }
99 
101 {
102  bNodeTreePath *path = MEM_callocN(sizeof(bNodeTreePath), "node tree path");
103  bNodeTreePath *prev_path = snode->treepath.last;
104  path->nodetree = ntree;
105  if (gnode) {
106  if (prev_path) {
107  path->parent_key = BKE_node_instance_key(prev_path->parent_key, prev_path->nodetree, gnode);
108  }
109  else {
111  }
112 
113  BLI_strncpy(path->node_name, gnode->name, sizeof(path->node_name));
114  BLI_strncpy(path->display_name, gnode->name, sizeof(path->display_name));
115  }
116  else {
118  }
119 
120  /* copy initial offset from bNodeTree */
122 
123  BLI_addtail(&snode->treepath, path);
124 
126 
127  /* update current tree */
128  snode->edittree = ntree;
129 
131 
133 }
134 
136 {
137  bNodeTreePath *path = snode->treepath.last;
138 
139  /* don't remove root */
140  if (path == snode->treepath.first) {
141  return;
142  }
143 
144  BLI_remlink(&snode->treepath, path);
145  MEM_freeN(path);
146 
147  /* update current tree */
148  path = snode->treepath.last;
149  snode->edittree = path->nodetree;
150 
152 
153  /* listener updates the View2D center from edittree */
155 }
156 
158 {
159  return BLI_listbase_count(&snode->treepath);
160 }
161 
163 {
164  bNodeTreePath *path;
165  int i;
166  for (path = snode->treepath.last, i = 0; path; path = path->prev, i++) {
167  if (i == level) {
168  return path->nodetree;
169  }
170  }
171  return NULL;
172 }
173 
175 {
176  int length = 0;
177  int i = 0;
178  LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
179  length += strlen(path->display_name);
180  if (i > 0) {
181  length += 1; /* for separator char */
182  }
183  }
184  return length;
185 }
186 
187 void ED_node_tree_path_get(SpaceNode *snode, char *value)
188 {
189  int i = 0;
190 
191  value[0] = '\0';
192  LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
193  if (i == 0) {
194  strcpy(value, path->display_name);
195  value += strlen(path->display_name);
196  }
197  else {
198  sprintf(value, "/%s", path->display_name);
199  value += strlen(path->display_name) + 1;
200  }
201  }
202 }
203 
204 void ED_node_tree_path_get_fixedbuf(SpaceNode *snode, char *value, int max_length)
205 {
206  int size;
207 
208  value[0] = '\0';
209  int i = 0;
210  LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
211  if (i == 0) {
212  size = BLI_strncpy_rlen(value, path->display_name, max_length);
213  }
214  else {
215  size = BLI_snprintf_rlen(value, max_length, "/%s", path->display_name);
216  }
217  max_length -= size;
218  if (max_length <= 0) {
219  break;
220  }
221  value += size;
222  }
223 }
224 
226 {
227  bNodeTreePath *path = snode->treepath.last;
228  if (snode->nodetree && path) {
229  snode->nodetree->active_viewer_key = path->parent_key;
230  }
231 }
232 
233 void space_node_group_offset(SpaceNode *snode, float *x, float *y)
234 {
235  bNodeTreePath *path = snode->treepath.last;
236 
237  if (path && path->prev) {
238  float dcenter[2];
239  sub_v2_v2v2(dcenter, path->view_center, path->prev->view_center);
240  *x = dcenter[0];
241  *y = dcenter[1];
242  }
243  else {
244  *x = *y = 0.0f;
245  }
246 }
247 
248 /* ******************** default callbacks for node space ***************** */
249 
251 {
252  ARegion *region;
253  SpaceNode *snode;
254 
255  snode = MEM_callocN(sizeof(SpaceNode), "initnode");
256  snode->spacetype = SPACE_NODE;
257 
259 
260  /* backdrop */
261  snode->zoom = 1.0f;
262 
263  /* select the first tree type for valid type */
264  NODE_TREE_TYPES_BEGIN (treetype) {
265  strcpy(snode->tree_idname, treetype->idname);
266  break;
267  }
269 
270  /* header */
271  region = MEM_callocN(sizeof(ARegion), "header for node");
272 
273  BLI_addtail(&snode->regionbase, region);
274  region->regiontype = RGN_TYPE_HEADER;
276 
277  /* buttons/list view */
278  region = MEM_callocN(sizeof(ARegion), "buttons for node");
279 
280  BLI_addtail(&snode->regionbase, region);
281  region->regiontype = RGN_TYPE_UI;
282  region->alignment = RGN_ALIGN_RIGHT;
283 
284  /* toolbar */
285  region = MEM_callocN(sizeof(ARegion), "node tools");
286 
287  BLI_addtail(&snode->regionbase, region);
288  region->regiontype = RGN_TYPE_TOOLS;
289  region->alignment = RGN_ALIGN_LEFT;
290 
291  region->flag = RGN_FLAG_HIDDEN;
292 
293  /* main region */
294  region = MEM_callocN(sizeof(ARegion), "main region for node");
295 
296  BLI_addtail(&snode->regionbase, region);
297  region->regiontype = RGN_TYPE_WINDOW;
298 
299  region->v2d.tot.xmin = -12.8f * U.widget_unit;
300  region->v2d.tot.ymin = -12.8f * U.widget_unit;
301  region->v2d.tot.xmax = 38.4f * U.widget_unit;
302  region->v2d.tot.ymax = 38.4f * U.widget_unit;
303 
304  region->v2d.cur = region->v2d.tot;
305 
306  region->v2d.min[0] = 1.0f;
307  region->v2d.min[1] = 1.0f;
308 
309  region->v2d.max[0] = 32000.0f;
310  region->v2d.max[1] = 32000.0f;
311 
312  region->v2d.minzoom = 0.09f;
313  region->v2d.maxzoom = 2.31f;
314 
317  region->v2d.keeptot = 0;
318 
319  return (SpaceLink *)snode;
320 }
321 
322 static void node_free(SpaceLink *sl)
323 {
324  SpaceNode *snode = (SpaceNode *)sl;
325 
326  LISTBASE_FOREACH_MUTABLE (bNodeTreePath *, path, &snode->treepath) {
327  MEM_freeN(path);
328  }
329 
330  MEM_SAFE_FREE(snode->runtime);
331 }
332 
333 /* spacetype; init callback */
334 static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *area)
335 {
336  SpaceNode *snode = (SpaceNode *)area->spacedata.first;
337 
338  if (snode->runtime == NULL) {
339  snode->runtime = MEM_callocN(sizeof(SpaceNode_Runtime), __func__);
340  }
341 }
342 
344 {
345  ScrArea *area = params->area;
346  wmNotifier *wmn = params->notifier;
347 
348  /* note, ED_area_tag_refresh will re-execute compositor */
349  SpaceNode *snode = area->spacedata.first;
350  /* shaderfrom is only used for new shading nodes, otherwise all shaders are from objects */
351  short shader_type = snode->shaderfrom;
352 
353  /* preview renders */
354  switch (wmn->category) {
355  case NC_SCENE:
356  switch (wmn->data) {
357  case ND_NODES: {
359  bNodeTreePath *path = snode->treepath.last;
360  /* shift view to node tree center */
361  if (region && path) {
362  UI_view2d_center_set(&region->v2d, path->view_center[0], path->view_center[1]);
363  }
364 
366  break;
367  }
368  case ND_FRAME:
370  break;
371  case ND_COMPO_RESULT:
373  break;
374  case ND_TRANSFORM_DONE:
375  if (ED_node_is_compositor(snode)) {
376  if (snode->flag & SNODE_AUTO_RENDER) {
377  snode->runtime->recalc = true;
379  }
380  }
381  break;
382  case ND_LAYER_CONTENT:
384  break;
385  }
386  break;
387 
388  /* future: add ID checks? */
389  case NC_MATERIAL:
390  if (ED_node_is_shader(snode)) {
391  if (wmn->data == ND_SHADING) {
393  }
394  else if (wmn->data == ND_SHADING_DRAW) {
396  }
397  else if (wmn->data == ND_SHADING_LINKS) {
399  }
400  else if (wmn->action == NA_ADDED && snode->edittree) {
401  nodeSetActiveID(snode->edittree, ID_MA, wmn->reference);
402  }
403  }
404  break;
405  case NC_TEXTURE:
406  if (ED_node_is_shader(snode) || ED_node_is_texture(snode)) {
407  if (wmn->data == ND_NODES) {
409  }
410  }
411  break;
412  case NC_WORLD:
413  if (ED_node_is_shader(snode) && shader_type == SNODE_SHADER_WORLD) {
415  }
416  break;
417  case NC_OBJECT:
418  if (ED_node_is_shader(snode)) {
419  if (wmn->data == ND_OB_SHADING) {
421  }
422  }
423  else if (ED_node_is_geometry(snode)) {
424  /* Rather strict check: only redraw when the reference matches the current editor's ID. */
425  if (wmn->data == ND_MODIFIER) {
426  if (wmn->reference == snode->id || snode->id == NULL) {
428  }
429  }
430  }
431  break;
432  case NC_SPACE:
433  if (wmn->data == ND_SPACE_NODE) {
435  }
436  else if (wmn->data == ND_SPACE_NODE_VIEW) {
438  }
439  break;
440  case NC_NODE:
441  if (wmn->action == NA_EDITED) {
443  }
444  else if (wmn->action == NA_SELECTED) {
446  }
447  break;
448  case NC_SCREEN:
449  switch (wmn->data) {
450  case ND_ANIMPLAY:
452  break;
453  }
454  break;
455  case NC_MASK:
456  if (wmn->action == NA_EDITED) {
457  if (snode->nodetree && snode->nodetree->type == NTREE_COMPOSIT) {
459  }
460  }
461  break;
462 
463  case NC_IMAGE:
464  if (wmn->action == NA_EDITED) {
465  if (ED_node_is_compositor(snode)) {
466  /* note that nodeUpdateID is already called by BKE_image_signal() on all
467  * scenes so really this is just to know if the images is used in the compo else
468  * painting on images could become very slow when the compositor is open. */
469  if (nodeUpdateID(snode->nodetree, wmn->reference)) {
471  }
472  }
473  }
474  break;
475 
476  case NC_MOVIECLIP:
477  if (wmn->action == NA_EDITED) {
478  if (ED_node_is_compositor(snode)) {
479  if (nodeUpdateID(snode->nodetree, wmn->reference)) {
481  }
482  }
483  }
484  break;
485 
486  case NC_LINESTYLE:
487  if (ED_node_is_shader(snode) && shader_type == SNODE_SHADER_LINESTYLE) {
489  }
490  break;
491  case NC_WM:
492  if (wmn->data == ND_UNDO) {
494  }
495  break;
496  case NC_GPENCIL:
497  if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
499  }
500  break;
501  }
502 }
503 
504 static void node_area_refresh(const struct bContext *C, ScrArea *area)
505 {
506  /* default now: refresh node is starting preview */
507  SpaceNode *snode = area->spacedata.first;
508 
510 
511  if (snode->nodetree) {
512  if (snode->nodetree->type == NTREE_SHADER) {
513  if (GS(snode->id->name) == ID_MA) {
514  Material *ma = (Material *)snode->id;
515  if (ma->use_nodes) {
516  ED_preview_shader_job(C, area, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
517  }
518  }
519  else if (GS(snode->id->name) == ID_LA) {
520  Light *la = (Light *)snode->id;
521  if (la->use_nodes) {
522  ED_preview_shader_job(C, area, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
523  }
524  }
525  else if (GS(snode->id->name) == ID_WO) {
526  World *wo = (World *)snode->id;
527  if (wo->use_nodes) {
528  ED_preview_shader_job(C, area, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
529  }
530  }
531  }
532  else if (snode->nodetree->type == NTREE_COMPOSIT) {
533  Scene *scene = (Scene *)snode->id;
534  if (scene->use_nodes) {
535  /* recalc is set on 3d view changes for auto compo */
536  if (snode->runtime->recalc) {
537  snode->runtime->recalc = false;
539  }
540  else {
542  }
543  }
544  }
545  else if (snode->nodetree->type == NTREE_TEXTURE) {
546  Tex *tex = (Tex *)snode->id;
547  if (tex->use_nodes) {
548  ED_preview_shader_job(C, area, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
549  }
550  }
551  }
552 }
553 
555 {
556  SpaceNode *snode = (SpaceNode *)sl;
557  SpaceNode *snoden = MEM_dupallocN(snode);
558 
559  BLI_duplicatelist(&snoden->treepath, &snode->treepath);
560 
561  if (snode->runtime != NULL) {
562  snoden->runtime = MEM_dupallocN(snode->runtime);
564  }
565 
566  /* Note: no need to set node tree user counts,
567  * the editor only keeps at least 1 (id_us_ensure_real),
568  * which is already done by the original SpaceNode.
569  */
570 
571  return (SpaceLink *)snoden;
572 }
573 
574 /* add handlers, stuff you only do once or on area/region changes */
576 {
577  wmKeyMap *keymap;
578 
579  ED_region_panels_init(wm, region);
580 
581  keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
582  WM_event_add_keymap_handler(&region->handlers, keymap);
583 }
584 
585 static void node_buttons_region_draw(const bContext *C, ARegion *region)
586 {
587  ED_region_panels(C, region);
588 }
589 
590 /* add handlers, stuff you only do once or on area/region changes */
592 {
593  wmKeyMap *keymap;
594 
595  ED_region_panels_init(wm, region);
596 
597  keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
598  WM_event_add_keymap_handler(&region->handlers, keymap);
599 }
600 
601 static void node_toolbar_region_draw(const bContext *C, ARegion *region)
602 {
603  ED_region_panels(C, region);
604 }
605 
606 void ED_node_cursor_location_get(const SpaceNode *snode, float value[2])
607 {
608  copy_v2_v2(value, snode->runtime->cursor);
609 }
610 
611 void ED_node_cursor_location_set(SpaceNode *snode, const float value[2])
612 {
613  copy_v2_v2(snode->runtime->cursor, value);
614 }
615 
616 static void node_cursor(wmWindow *win, ScrArea *area, ARegion *region)
617 {
618  SpaceNode *snode = area->spacedata.first;
619 
620  /* convert mouse coordinates to v2d space */
621  UI_view2d_region_to_view(&region->v2d,
622  win->eventstate->x - region->winrct.xmin,
623  win->eventstate->y - region->winrct.ymin,
624  &snode->runtime->cursor[0],
625  &snode->runtime->cursor[1]);
626 
627  /* here snode->runtime->cursor is used to detect the node edge for sizing */
628  node_set_cursor(win, snode, snode->runtime->cursor);
629 
630  /* XXX snode->runtime->cursor is in placing new nodes space */
631  snode->runtime->cursor[0] /= UI_DPI_FAC;
632  snode->runtime->cursor[1] /= UI_DPI_FAC;
633 }
634 
635 /* Initialize main region, setting handlers. */
637 {
638  wmKeyMap *keymap;
639  ListBase *lb;
640 
641  UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
642 
643  /* own keymaps */
644  keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
645  WM_event_add_keymap_handler(&region->handlers, keymap);
646 
647  keymap = WM_keymap_ensure(wm->defaultconf, "Node Editor", SPACE_NODE, 0);
649 
650  /* add drop boxes */
651  lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
652 
654 }
655 
656 static void node_main_region_draw(const bContext *C, ARegion *region)
657 {
658  node_draw_space(C, region);
659 }
660 
661 /* ************* dropboxes ************* */
662 
664  wmDrag *drag,
665  const wmEvent *UNUSED(event),
666  const char **UNUSED(r_tooltip))
667 {
668  return WM_drag_is_ID_type(drag, ID_NT);
669 }
670 
672  wmDrag *drag,
673  const wmEvent *UNUSED(event),
674  const char **UNUSED(r_tooltip))
675 {
676  return WM_drag_is_ID_type(drag, ID_OB);
677 }
678 
680  wmDrag *drag,
681  const wmEvent *UNUSED(event),
682  const char **UNUSED(r_tooltip))
683 {
684  return WM_drag_is_ID_type(drag, ID_GR);
685 }
686 
688  wmDrag *drag,
689  const wmEvent *UNUSED(event),
690  const char **UNUSED(r_tooltip))
691 {
692  return WM_drag_is_ID_type(drag, ID_TE);
693 }
694 
696  wmDrag *drag,
697  const wmEvent *UNUSED(event),
698  const char **UNUSED(r_tooltip))
699 {
700  if (drag->type == WM_DRAG_PATH) {
701  /* rule might not work? */
702  return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE));
703  }
704  return WM_drag_is_ID_type(drag, ID_IM);
705 }
706 
708  wmDrag *drag,
709  const wmEvent *UNUSED(event),
710  const char **UNUSED(r_tooltip))
711 {
712  return WM_drag_is_ID_type(drag, ID_MSK);
713 }
714 
715 static void node_group_drop_copy(wmDrag *drag, wmDropBox *drop)
716 {
718 
719  RNA_string_set(drop->ptr, "name", id->name + 2);
720 }
721 
722 static void node_id_drop_copy(wmDrag *drag, wmDropBox *drop)
723 {
725 
726  RNA_string_set(drop->ptr, "name", id->name + 2);
727 }
728 
729 static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
730 {
732 
733  if (id) {
734  RNA_string_set(drop->ptr, "name", id->name + 2);
735  RNA_struct_property_unset(drop->ptr, "filepath");
736  }
737  else if (drag->path[0]) {
738  RNA_string_set(drop->ptr, "filepath", drag->path);
739  RNA_struct_property_unset(drop->ptr, "name");
740  }
741 }
742 
743 /* this region dropbox definition */
744 static void node_dropboxes(void)
745 {
746  ListBase *lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
747 
748  WM_dropbox_add(lb,
749  "NODE_OT_add_object",
753  WM_dropbox_add(lb,
754  "NODE_OT_add_collection",
758  WM_dropbox_add(lb,
759  "NODE_OT_add_texture",
763  WM_dropbox_add(lb,
764  "NODE_OT_add_group",
768  WM_dropbox_add(lb,
769  "NODE_OT_add_file",
773  WM_dropbox_add(lb,
774  "NODE_OT_add_mask",
778 }
779 
780 /* ************* end drop *********** */
781 
782 /* add handlers, stuff you only do once or on area/region changes */
784 {
785  ED_region_header_init(region);
786 }
787 
788 static void node_header_region_draw(const bContext *C, ARegion *region)
789 {
790  /* find and set the context */
792 
793  ED_region_header(C, region);
794 }
795 
796 /* used for header + main region */
798 {
799  ARegion *region = params->region;
800  wmNotifier *wmn = params->notifier;
801  wmGizmoMap *gzmap = region->gizmo_map;
802 
803  /* context changes */
804  switch (wmn->category) {
805  case NC_SPACE:
806  switch (wmn->data) {
807  case ND_SPACE_NODE:
808  ED_region_tag_redraw(region);
809  break;
810  case ND_SPACE_NODE_VIEW:
812  break;
813  }
814  break;
815  case NC_SCREEN:
816  if (wmn->data == ND_LAYOUTSET || wmn->action == NA_EDITED) {
818  }
819  switch (wmn->data) {
820  case ND_ANIMPLAY:
821  case ND_LAYER:
822  ED_region_tag_redraw(region);
823  break;
824  }
825  break;
826  case NC_WM:
827  if (wmn->data == ND_JOB) {
828  ED_region_tag_redraw(region);
829  }
830  break;
831  case NC_SCENE:
832  ED_region_tag_redraw(region);
833  if (wmn->data == ND_RENDER_RESULT) {
835  }
836  break;
837  case NC_NODE:
838  ED_region_tag_redraw(region);
839  if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
841  }
842  break;
843  case NC_MATERIAL:
844  case NC_TEXTURE:
845  case NC_WORLD:
846  case NC_LINESTYLE:
847  ED_region_tag_redraw(region);
848  break;
849  case NC_OBJECT:
850  if (wmn->data == ND_OB_SHADING) {
851  ED_region_tag_redraw(region);
852  }
853  break;
854  case NC_ID:
855  if (wmn->action == NA_RENAME) {
856  ED_region_tag_redraw(region);
857  }
858  break;
859  case NC_GPENCIL:
860  if (wmn->action == NA_EDITED) {
861  ED_region_tag_redraw(region);
862  }
863  else if (wmn->data & ND_GPENCIL_EDITMODE) {
864  ED_region_tag_redraw(region);
865  }
866  break;
867  }
868 }
869 
870 const char *node_context_dir[] = {
871  "selected_nodes", "active_node", "light", "material", "world", NULL};
872 static int /*eContextResult*/ node_context(const bContext *C,
873  const char *member,
875 {
876  SpaceNode *snode = CTX_wm_space_node(C);
877 
878  if (CTX_data_dir(member)) {
880  return CTX_RESULT_OK;
881  }
882  if (CTX_data_equals(member, "selected_nodes")) {
883  bNode *node;
884 
885  if (snode->edittree) {
886  for (node = snode->edittree->nodes.last; node; node = node->prev) {
887  if (node->flag & NODE_SELECT) {
889  }
890  }
891  }
893  return CTX_RESULT_OK;
894  }
895  if (CTX_data_equals(member, "active_node")) {
896  if (snode->edittree) {
897  bNode *node = nodeGetActive(snode->edittree);
899  }
900 
902  return CTX_RESULT_OK;
903  }
904  if (CTX_data_equals(member, "node_previews")) {
905  if (snode->nodetree) {
907  result, &snode->nodetree->id, &RNA_NodeInstanceHash, snode->nodetree->previews);
908  }
909 
911  return CTX_RESULT_OK;
912  }
913  if (CTX_data_equals(member, "material")) {
914  if (snode->id && GS(snode->id->name) == ID_MA) {
916  }
917  return CTX_RESULT_OK;
918  }
919  if (CTX_data_equals(member, "light")) {
920  if (snode->id && GS(snode->id->name) == ID_LA) {
922  }
923  return CTX_RESULT_OK;
924  }
925  if (CTX_data_equals(member, "world")) {
926  if (snode->id && GS(snode->id->name) == ID_WO) {
928  }
929  return CTX_RESULT_OK;
930  }
931 
933 }
934 
935 static void node_widgets(void)
936 {
937  /* create the widgetmap for the area here */
944 }
945 
946 static void node_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id, ID *new_id)
947 {
948  SpaceNode *snode = (SpaceNode *)slink;
949 
950  if (snode->id == old_id) {
951  /* nasty DNA logic for SpaceNode:
952  * ideally should be handled by editor code, but would be bad level call
953  */
954  BLI_freelistN(&snode->treepath);
955 
956  /* XXX Untested in case new_id != NULL... */
957  snode->id = new_id;
958  snode->from = NULL;
959  snode->nodetree = NULL;
960  snode->edittree = NULL;
961  }
962  else if (GS(old_id->name) == ID_OB) {
963  if (snode->from == old_id) {
964  if (new_id == NULL) {
965  snode->flag &= ~SNODE_PIN;
966  }
967  snode->from = new_id;
968  }
969  }
970  else if (GS(old_id->name) == ID_GD) {
971  if ((ID *)snode->gpd == old_id) {
972  snode->gpd = (bGPdata *)new_id;
973  id_us_min(old_id);
974  id_us_plus(new_id);
975  }
976  }
977  else if (GS(old_id->name) == ID_NT) {
978  bNodeTreePath *path, *path_next;
979 
980  for (path = snode->treepath.first; path; path = path->next) {
981  if ((ID *)path->nodetree == old_id) {
982  path->nodetree = (bNodeTree *)new_id;
983  id_us_ensure_real(new_id);
984  }
985  if (path == snode->treepath.first) {
986  /* first nodetree in path is same as snode->nodetree */
987  snode->nodetree = path->nodetree;
988  }
989  if (path->nodetree == NULL) {
990  break;
991  }
992  }
993 
994  /* remaining path entries are invalid, remove */
995  for (; path; path = path_next) {
996  path_next = path->next;
997 
998  BLI_remlink(&snode->treepath, path);
999  MEM_freeN(path);
1000  }
1001 
1002  /* edittree is just the last in the path,
1003  * set this directly since the path may have been shortened above */
1004  if (snode->treepath.last) {
1005  path = snode->treepath.last;
1006  snode->edittree = path->nodetree;
1007  }
1008  else {
1009  snode->edittree = NULL;
1010  }
1011  }
1012 }
1013 
1015 {
1016  SpaceNode *snode = area->spacedata.first;
1018 }
1019 
1020 static void node_space_subtype_set(ScrArea *area, int value)
1021 {
1022  SpaceNode *snode = area->spacedata.first;
1024 }
1025 
1026 static void node_space_subtype_item_extend(bContext *C, EnumPropertyItem **item, int *totitem)
1027 {
1028  bool free;
1030  RNA_enum_items_add(item, totitem, item_src);
1031  if (free) {
1032  MEM_freeN((void *)item_src);
1033  }
1034 }
1035 
1036 /* only called once, from space/spacetypes.c */
1038 {
1039  SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype node");
1040  ARegionType *art;
1041 
1042  st->spaceid = SPACE_NODE;
1043  strncpy(st->name, "Node", BKE_ST_MAXNAME);
1044 
1045  st->create = node_create;
1046  st->free = node_free;
1047  st->init = node_init;
1048  st->duplicate = node_duplicate;
1050  st->keymap = node_keymap;
1052  st->refresh = node_area_refresh;
1053  st->context = node_context;
1054  st->dropboxes = node_dropboxes;
1055  st->gizmos = node_widgets;
1056  st->id_remap = node_id_remap;
1060 
1061  /* regions: main window */
1062  art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
1063  art->regionid = RGN_TYPE_WINDOW;
1064  art->init = node_main_region_init;
1065  art->draw = node_main_region_draw;
1069  art->cursor = node_cursor;
1070  art->event_cursor = true;
1071  art->clip_gizmo_events_by_ui = true;
1072 
1073  BLI_addhead(&st->regiontypes, art);
1074 
1075  /* regions: header */
1076  art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
1077  art->regionid = RGN_TYPE_HEADER;
1078  art->prefsizey = HEADERY;
1083 
1084  BLI_addhead(&st->regiontypes, art);
1085 
1086  /* regions: listview/buttons */
1087  art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
1088  art->regionid = RGN_TYPE_UI;
1095  BLI_addhead(&st->regiontypes, art);
1096 
1097  node_buttons_register(art);
1098 
1099  /* regions: toolbar */
1100  art = MEM_callocN(sizeof(ARegionType), "spacetype view3d tools region");
1101  art->regionid = RGN_TYPE_TOOLS;
1102  art->prefsizex = 58; /* XXX */
1103  art->prefsizey = 50; /* XXX */
1110  BLI_addhead(&st->regiontypes, art);
1111 
1112  node_toolbar_register(art);
1113 
1115 }
void CTX_data_dir_set(bContextDataResult *result, const char **dir)
Definition: context.c:672
struct SpaceNode * CTX_wm_space_node(const bContext *C)
Definition: context.c:854
bool CTX_data_equals(const char *member, const char *str)
Definition: context.c:623
void CTX_data_pointer_set(bContextDataResult *result, struct ID *id, StructRNA *type, void *data)
Definition: context.c:638
void CTX_data_id_pointer_set(bContextDataResult *result, struct ID *id)
Definition: context.c:633
bool CTX_data_dir(const char *member)
Definition: context.c:628
@ CTX_DATA_TYPE_POINTER
Definition: BKE_context.h:220
@ CTX_DATA_TYPE_COLLECTION
Definition: BKE_context.h:221
@ CTX_RESULT_MEMBER_NOT_FOUND
Definition: BKE_context.h:86
@ CTX_RESULT_OK
Definition: BKE_context.h:83
void CTX_data_list_add(bContextDataResult *result, struct ID *id, StructRNA *type, void *data)
Definition: context.c:651
void CTX_data_type_set(struct bContextDataResult *result, short type)
Definition: context.c:677
void id_us_min(struct ID *id)
Definition: lib_id.c:297
void id_us_ensure_real(struct ID *id)
Definition: lib_id.c:238
void id_us_plus(struct ID *id)
Definition: lib_id.c:288
const bNodeInstanceKey NODE_INSTANCE_KEY_BASE
Definition: node.cc:3908
struct bNode * nodeGetActive(struct bNodeTree *ntree)
Definition: node.cc:3561
bool nodeUpdateID(struct bNodeTree *ntree, struct ID *id)
Definition: node.cc:4346
bool nodeSetActiveID(struct bNodeTree *ntree, short idtype, struct ID *id)
Definition: node.cc:3617
#define NODE_TREE_TYPES_BEGIN(ntype)
Definition: BKE_node.h:430
#define NODE_TREE_TYPES_END
Definition: BKE_node.h:437
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:68
void BKE_spacetype_register(struct SpaceType *st)
Definition: screen.c:420
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:116
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:87
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:188
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:128
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
Definition: BLI_listbase.h:180
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
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])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:187
size_t BLI_snprintf_rlen(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
#define UNUSED(x)
#define ELEM(...)
@ ID_TE
Definition: DNA_ID_enums.h:64
@ ID_IM
Definition: DNA_ID_enums.h:65
@ ID_NT
Definition: DNA_ID_enums.h:80
@ ID_LA
Definition: DNA_ID_enums.h:67
@ ID_MSK
Definition: DNA_ID_enums.h:86
@ ID_GD
Definition: DNA_ID_enums.h:83
@ ID_WO
Definition: DNA_ID_enums.h:71
@ ID_MA
Definition: DNA_ID_enums.h:63
@ ID_GR
Definition: DNA_ID_enums.h:77
@ ID_OB
Definition: DNA_ID_enums.h:59
#define NTREE_TEXTURE
#define NTREE_GEOMETRY
#define NTREE_COMPOSIT
#define NODE_SELECT
#define NTREE_SHADER
#define HEADERY
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_TOP
@ RGN_ALIGN_RIGHT
@ RGN_FLAG_HIDDEN
@ RGN_TYPE_UI
@ RGN_TYPE_WINDOW
@ RGN_TYPE_HEADER
@ RGN_TYPE_TOOLS
@ SNODE_PIN
@ SNODE_USE_ALPHA
@ SNODE_AUTO_RENDER
@ SNODE_SHOW_GPENCIL
@ SPACE_NODE
@ SNODE_SHADER_WORLD
@ SNODE_SHADER_LINESTYLE
@ USER_HEADER_BOTTOM
@ V2D_SCROLL_RIGHT
@ V2D_SCROLL_BOTTOM
@ V2D_LIMITZOOM
@ V2D_KEEPASPECT
bool ED_node_is_compositor(struct SpaceNode *snode)
Definition: node_edit.c:449
void ED_node_set_tree_type(struct SpaceNode *snode, struct bNodeTreeType *typeinfo)
Definition: node_edit.c:439
bool ED_node_is_texture(struct SpaceNode *snode)
Definition: node_edit.c:459
bool ED_node_is_geometry(struct SpaceNode *snode)
Definition: node_edit.c:464
bool ED_node_is_shader(struct SpaceNode *snode)
Definition: node_edit.c:454
void ED_node_composite_job(const struct bContext *C, struct bNodeTree *nodetree, struct Scene *scene_owner)
void ED_preview_shader_job(const struct bContext *C, void *owner, struct ID *id, struct ID *parent, struct MTex *slot, int sizex, int sizey, int method)
@ PR_NODE_RENDER
Definition: ED_render.h:79
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:745
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:3090
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:667
void ED_region_header_init(struct ARegion *region)
Definition: area.c:3358
void ED_area_tag_refresh(ScrArea *area)
Definition: area.c:774
@ ED_KEYMAP_UI
Definition: ED_screen.h:440
@ ED_KEYMAP_HEADER
Definition: ED_screen.h:446
@ ED_KEYMAP_TOOL
Definition: ED_screen.h:442
@ ED_KEYMAP_GPENCIL
Definition: ED_screen.h:448
@ ED_KEYMAP_GIZMO
Definition: ED_screen.h:441
@ ED_KEYMAP_VIEW2D
Definition: ED_screen.h:443
@ ED_KEYMAP_FRAMES
Definition: ED_screen.h:445
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
StructRNA RNA_Node
StructRNA RNA_NodeInstanceHash
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:39
#define UI_SIDEBAR_PANEL_WIDTH
Definition: UI_interface.h:245
#define UI_DPI_FAC
Definition: UI_interface.h:309
void UI_view2d_center_set(struct View2D *v2d, float x, float y)
Definition: view2d.c:1950
void UI_view2d_region_reinit(struct View2D *v2d, short type, int winx, int winy)
Definition: view2d.c:240
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:49
#define NC_WORLD
Definition: WM_types.h:288
#define ND_TRANSFORM_DONE
Definition: WM_types.h:352
#define ND_SHADING
Definition: WM_types.h:377
#define NC_ID
Definition: WM_types.h:296
#define NC_NODE
Definition: WM_types.h:295
#define ND_RENDER_RESULT
Definition: WM_types.h:346
#define ND_JOB
Definition: WM_types.h:315
#define NC_WM
Definition: WM_types.h:276
#define WM_DRAG_PATH
Definition: WM_types.h:876
#define ND_GPENCIL_EDITMODE
Definition: WM_types.h:403
#define NC_LINESTYLE
Definition: WM_types.h:301
#define ND_SPACE_NODE
Definition: WM_types.h:421
#define ND_COMPO_RESULT
Definition: WM_types.h:347
#define NC_SCREEN
Definition: WM_types.h:278
#define NC_MOVIECLIP
Definition: WM_types.h:298
#define ND_ANIMPLAY
Definition: WM_types.h:323
#define NC_SCENE
Definition: WM_types.h:279
#define ND_SPACE_NODE_VIEW
Definition: WM_types.h:431
#define NA_ADDED
Definition: WM_types.h:464
#define ND_LAYER_CONTENT
Definition: WM_types.h:354
#define ND_NODES
Definition: WM_types.h:336
#define ND_MODIFIER
Definition: WM_types.h:363
#define NA_EDITED
Definition: WM_types.h:462
#define NC_MATERIAL
Definition: WM_types.h:281
#define NC_IMAGE
Definition: WM_types.h:285
#define ND_UNDO
Definition: WM_types.h:316
#define ND_FRAME
Definition: WM_types.h:334
#define NC_GPENCIL
Definition: WM_types.h:300
#define NC_TEXTURE
Definition: WM_types.h:282
#define ND_LAYER
Definition: WM_types.h:350
#define NC_MASK
Definition: WM_types.h:299
#define NA_RENAME
Definition: WM_types.h:466
#define ND_OB_SHADING
Definition: WM_types.h:358
#define ND_LAYOUTSET
Definition: WM_types.h:326
#define NC_OBJECT
Definition: WM_types.h:280
#define ND_SHADING_LINKS
Definition: WM_types.h:379
#define ND_SHADING_DRAW
Definition: WM_types.h:378
#define NC_SPACE
Definition: WM_types.h:293
#define NA_SELECTED
Definition: WM_types.h:467
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
Definition: btQuaternion.h:895
OperationNode * node
StackEntry * from
Scene scene
bNodeTree * ntree
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define GS(x)
Definition: iris.c:241
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:42
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static void area(int d1, int d2, int e1, int e2, float weights[2])
void node_buttons_register(ARegionType *art)
Definition: node_buttons.c:189
void node_set_cursor(wmWindow *win, SpaceNode *snode, float cursor[2])
Definition: node_draw.cc:1718
void node_draw_space(const bContext *C, ARegion *region)
Definition: node_draw.cc:1939
void snode_set_context(const bContext *C)
Definition: node_edit.c:603
int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
Definition: node_edit.c:1449
void NODE_GGT_backdrop_corner_pin(wmGizmoGroupType *gzgt)
Definition: node_gizmo.c:632
void NODE_GGT_backdrop_sun_beams(wmGizmoGroupType *gzgt)
Definition: node_gizmo.c:510
void NODE_GGT_backdrop_transform(wmGizmoGroupType *gzgt)
Definition: node_gizmo.c:184
void NODE_GGT_backdrop_crop(wmGizmoGroupType *gzgt)
Definition: node_gizmo.c:405
void node_operatortypes(void)
Definition: node_ops.c:38
void node_keymap(struct wmKeyConfig *keyconf)
Definition: node_ops.c:204
void node_toolbar_register(struct ARegionType *art)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:6550
void RNA_struct_property_unset(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:6697
void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
Definition: rna_define.c:4448
static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *area)
Definition: space_node.c:334
static void node_space_subtype_item_extend(bContext *C, EnumPropertyItem **item, int *totitem)
Definition: space_node.c:1026
static bool node_texture_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(r_tooltip))
Definition: space_node.c:687
static void node_widgets(void)
Definition: space_node.c:935
static bool node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(r_tooltip))
Definition: space_node.c:707
static SpaceLink * node_duplicate(SpaceLink *sl)
Definition: space_node.c:554
static int node_context(const bContext *C, const char *member, bContextDataResult *result)
Definition: space_node.c:872
static void node_area_refresh(const struct bContext *C, ScrArea *area)
Definition: space_node.c:504
static void node_main_region_draw(const bContext *C, ARegion *region)
Definition: space_node.c:656
static void node_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
Definition: space_node.c:783
void ED_node_tree_push(SpaceNode *snode, bNodeTree *ntree, bNode *gnode)
Definition: space_node.c:100
void ED_node_cursor_location_set(SpaceNode *snode, const float value[2])
Definition: space_node.c:611
static void node_region_listener(const wmRegionListenerParams *params)
Definition: space_node.c:797
static void node_header_region_draw(const bContext *C, ARegion *region)
Definition: space_node.c:788
static void node_free(SpaceLink *sl)
Definition: space_node.c:322
void ED_node_tree_path_get(SpaceNode *snode, char *value)
Definition: space_node.c:187
static bool node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(r_tooltip))
Definition: space_node.c:695
int ED_node_tree_depth(SpaceNode *snode)
Definition: space_node.c:157
static bool node_object_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(r_tooltip))
Definition: space_node.c:671
void ED_node_set_active_viewer_key(SpaceNode *snode)
Definition: space_node.c:225
static void node_area_listener(const wmSpaceTypeListenerParams *params)
Definition: space_node.c:343
static void node_dropboxes(void)
Definition: space_node.c:744
static SpaceLink * node_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
Definition: space_node.c:250
void ED_node_tree_path_get_fixedbuf(SpaceNode *snode, char *value, int max_length)
Definition: space_node.c:204
static void node_toolbar_region_draw(const bContext *C, ARegion *region)
Definition: space_node.c:601
static void node_buttons_region_draw(const bContext *C, ARegion *region)
Definition: space_node.c:585
int ED_node_tree_path_length(SpaceNode *snode)
Definition: space_node.c:174
void ED_node_tree_pop(SpaceNode *snode)
Definition: space_node.c:135
bNodeTree * ED_node_tree_get(SpaceNode *snode, int level)
Definition: space_node.c:162
static void node_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id, ID *new_id)
Definition: space_node.c:946
void ED_spacetype_node(void)
Definition: space_node.c:1037
const char * node_context_dir[]
Definition: space_node.c:870
void space_node_group_offset(SpaceNode *snode, float *x, float *y)
Definition: space_node.c:233
static int node_space_subtype_get(ScrArea *area)
Definition: space_node.c:1014
void ED_node_cursor_location_get(const SpaceNode *snode, float value[2])
Definition: space_node.c:606
static void node_main_region_init(wmWindowManager *wm, ARegion *region)
Definition: space_node.c:636
static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
Definition: space_node.c:729
static void node_group_drop_copy(wmDrag *drag, wmDropBox *drop)
Definition: space_node.c:715
static void node_toolbar_region_init(wmWindowManager *wm, ARegion *region)
Definition: space_node.c:591
static bool node_group_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(r_tooltip))
Definition: space_node.c:663
void ED_node_tree_start(SpaceNode *snode, bNodeTree *ntree, ID *id, ID *from)
Definition: space_node.c:59
static void node_cursor(wmWindow *win, ScrArea *area, ARegion *region)
Definition: space_node.c:616
static bool node_collection_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(r_tooltip))
Definition: space_node.c:679
static void node_buttons_region_init(wmWindowManager *wm, ARegion *region)
Definition: space_node.c:575
static void node_id_drop_copy(wmDrag *drag, wmDropBox *drop)
Definition: space_node.c:722
static void node_space_subtype_set(ScrArea *area, int value)
Definition: space_node.c:1020
void(* draw)(const struct bContext *C, struct ARegion *region)
Definition: BKE_screen.h:169
bool clip_gizmo_events_by_ui
Definition: BKE_screen.h:231
void(* message_subscribe)(const wmRegionMessageSubscribeParams *params)
Definition: BKE_screen.h:185
void(* cursor)(struct wmWindow *win, struct ScrArea *area, struct ARegion *region)
Definition: BKE_screen.h:197
int(* snap_size)(const struct ARegion *region, int size, int axis)
Definition: BKE_screen.h:181
void(* listener)(const wmRegionListenerParams *params)
Definition: BKE_screen.h:183
int keymapflag
Definition: BKE_screen.h:226
short event_cursor
Definition: BKE_screen.h:233
void(* init)(struct wmWindowManager *wm, struct ARegion *region)
Definition: BKE_screen.h:165
ListBase handlers
short alignment
short regiontype
struct wmGizmoMap * gizmo_map
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
short use_nodes
void * last
Definition: DNA_listBase.h:47
void * first
Definition: DNA_listBase.h:47
char use_nodes
struct ListBase linkdrag
Definition: node_intern.h:79
char tree_idname[64]
SpaceNode_Runtime * runtime
struct ID * from
ListBase regionbase
struct bGPdata * gpd
ListBase treepath
struct bNodeTree * edittree
struct ID * id
struct bNodeTree * nodetree
struct SpaceLink *(* duplicate)(struct SpaceLink *sl)
Definition: BKE_screen.h:104
ListBase regiontypes
Definition: BKE_screen.h:130
void(* keymap)(struct wmKeyConfig *keyconf)
Definition: BKE_screen.h:109
void(* operatortypes)(void)
Definition: BKE_screen.h:107
void(* gizmos)(void)
Definition: BKE_screen.h:114
void(* free)(struct SpaceLink *sl)
Definition: BKE_screen.h:88
void(* space_subtype_item_extend)(struct bContext *C, EnumPropertyItem **item, int *totitem)
Definition: BKE_screen.h:127
struct SpaceLink *(* create)(const struct ScrArea *area, const struct Scene *scene)
Definition: BKE_screen.h:86
void(* refresh)(const struct bContext *C, struct ScrArea *area)
Definition: BKE_screen.h:101
void(* listener)(const wmSpaceTypeListenerParams *params)
Definition: BKE_screen.h:95
void(* init)(struct wmWindowManager *wm, struct ScrArea *area)
Definition: BKE_screen.h:91
int spaceid
Definition: BKE_screen.h:81
bContextDataCallback context
Definition: BKE_screen.h:117
void(* space_subtype_set)(struct ScrArea *area, int value)
Definition: BKE_screen.h:126
void(* id_remap)(struct ScrArea *area, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id)
Definition: BKE_screen.h:120
char name[BKE_ST_MAXNAME]
Definition: BKE_screen.h:80
void(* dropboxes)(void)
Definition: BKE_screen.h:111
int(* space_subtype_get)(struct ScrArea *area)
Definition: BKE_screen.h:125
char use_nodes
float minzoom
short keeptot
float max[2]
short keepzoom
float min[2]
short scroll
float maxzoom
short use_nodes
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]
float xmax
Definition: DNA_vec_types.h:85
float xmin
Definition: DNA_vec_types.h:85
float ymax
Definition: DNA_vec_types.h:86
float ymin
Definition: DNA_vec_types.h:86
int ymin
Definition: DNA_vec_types.h:80
int xmin
Definition: DNA_vec_types.h:79
char path[1024]
Definition: WM_types.h:909
int icon
Definition: WM_types.h:905
int type
Definition: WM_types.h:907
struct PointerRNA * ptr
Definition: WM_types.h:953
int y
Definition: WM_types.h:581
int x
Definition: WM_types.h:581
unsigned int data
Definition: WM_types.h:260
unsigned int action
Definition: WM_types.h:260
unsigned int category
Definition: WM_types.h:260
void * reference
Definition: WM_types.h:262
struct wmKeyConfig * defaultconf
struct wmEvent * eventstate
ID * WM_drag_get_local_ID_or_import_from_asset(const wmDrag *drag, int idcode)
Definition: wm_dragdrop.c:392
void WM_drag_free_imported_drag_ID(struct Main *bmain, wmDrag *drag, wmDropBox *drop)
Free asset ID imported for cancelled drop.
Definition: wm_dragdrop.c:419
wmDropBox * WM_dropbox_add(ListBase *lb, const char *idname, bool(*poll)(bContext *, wmDrag *, const wmEvent *, const char **), void(*copy)(wmDrag *, wmDropBox *), void(*cancel)(struct Main *, wmDrag *, wmDropBox *))
Definition: wm_dragdrop.c:96
bool WM_drag_is_ID_type(const wmDrag *drag, int idcode)
Definition: wm_dragdrop.c:363
ListBase * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
Definition: wm_dragdrop.c:77
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:323
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:852