2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2008 Blender Foundation.
19 * All rights reserved.
22 * Contributor(s): Blender Foundation
24 * ***** END GPL LICENSE BLOCK *****
27 /** \file blender/editors/space_node/node_intern.h
31 #ifndef __NODE_INTERN_H__
32 #define __NODE_INTERN_H__
34 #include <stddef.h> /* for size_t */
35 #include "UI_interface.h"
37 /* internal exports only */
44 struct wmWindowManager;
52 /* temp data to pass on to modal */
53 typedef struct bNodeLinkDrag {
54 struct bNodeLinkDrag *next, *prev;
56 /* List of links dragged by the operator.
57 * Note: This is a list of LinkData structs on top of the actual bNodeLinks.
58 * This way the links can be added to the node tree while being stored in this list.
65 ARegion *node_has_buttons_region(ScrArea *sa);
68 void node_menus_register(void);
71 int node_get_colorid(struct bNode *node);
72 void node_socket_circle_draw(struct bNodeTree *ntree, struct bNodeSocket *sock, float size, int highlight);
73 int node_get_resize_cursor(int directions);
74 void node_draw_shadow(struct SpaceNode *snode, struct bNode *node, float radius, float alpha);
75 void node_draw_default(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode, struct bNodeTree *ntree, struct bNode *node);
76 void node_update_default(const struct bContext *C, struct bNodeTree *ntree, struct bNode *node);
77 int node_select_area_default(struct bNode *node, int x, int y);
78 int node_tweak_area_default(struct bNode *node, int x, int y);
79 void node_update_nodetree(const struct bContext *C, struct bNodeTree *ntree, float offsetx, float offsety);
80 void node_draw_nodetree(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode, struct bNodeTree *ntree);
81 void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d);
83 void node_set_cursor(struct wmWindow *win, struct SpaceNode *snode);
86 void node_buttons_register(struct ARegionType *art);
87 void NODE_OT_properties(struct wmOperatorType *ot);
90 void node_operatortypes(void);
91 void node_keymap(wmKeyConfig *keyconf);
94 void node_select(struct bNode *node);
95 void node_deselect(struct bNode *node);
96 void node_deselect_all(struct SpaceNode *snode);
97 void node_socket_select(struct bNode *node, struct bNodeSocket *sock);
98 void node_socket_deselect(struct bNode *node, struct bNodeSocket *sock, int deselect_node);
99 void node_deselect_all_input_sockets(struct SpaceNode *snode, int deselect_nodes);
100 void node_deselect_all_output_sockets(struct SpaceNode *snode, int deselect_nodes);
101 int node_select_same_type(struct SpaceNode *snode);
102 int node_select_same_type_np(struct SpaceNode *snode, int dir);
103 void node_select_single(struct bContext *C, struct bNode *node);
105 void NODE_OT_select(struct wmOperatorType *ot);
106 void NODE_OT_select_all(wmOperatorType *ot);
107 void NODE_OT_select_linked_to(wmOperatorType *ot);
108 void NODE_OT_select_linked_from(wmOperatorType *ot);
109 void NODE_OT_select_border(struct wmOperatorType *ot);
110 void NODE_OT_select_same_type(struct wmOperatorType *ot);
111 void NODE_OT_select_same_type_next(wmOperatorType *ot);
112 void NODE_OT_select_same_type_prev(wmOperatorType *ot);
115 void NODE_OT_view_all(struct wmOperatorType *ot);
118 void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link);
119 void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 );
120 int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, float coord_array[][2], int resol);
121 // void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 );
122 void draw_nodespace_back_pix(const struct bContext *C, ARegion *ar, SpaceNode *snode);
125 void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype);
126 void snode_notify(bContext *C, SpaceNode *snode);
127 void snode_dag_update(bContext *C, SpaceNode *snode);
128 bNode *node_add_node(struct SpaceNode *snode, struct Main *bmain, struct Scene *scene, struct bNodeTemplate *ntemp, float locx, float locy);
129 void snode_set_context(SpaceNode *snode, Scene *scene);
130 void snode_make_group_editable(SpaceNode *snode, bNode *gnode);
131 void snode_composite_job(const struct bContext *C, ScrArea *sa);
132 bNode *node_tree_get_editgroup(bNodeTree *ntree);
133 void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace);
134 int node_has_hidden_sockets(bNode *node);
135 void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set);
136 int node_render_changed_exec(bContext *, wmOperator *);
137 int node_find_indicated_socket(struct SpaceNode *snode, struct bNode **nodep, struct bNodeSocket **sockp, int in_out);
139 void NODE_OT_duplicate(struct wmOperatorType *ot);
140 void NODE_OT_delete(struct wmOperatorType *ot);
141 void NODE_OT_delete_reconnect(struct wmOperatorType *ot);
142 void NODE_OT_resize(struct wmOperatorType *ot);
144 void NODE_OT_link(struct wmOperatorType *ot);
145 void NODE_OT_link_make(struct wmOperatorType *ot);
146 void NODE_OT_links_cut(struct wmOperatorType *ot);
147 void NODE_OT_links_detach(struct wmOperatorType *ot);
148 void NODE_OT_add_reroute(struct wmOperatorType *ot);
150 void NODE_OT_group_make(struct wmOperatorType *ot);
151 void NODE_OT_group_ungroup(struct wmOperatorType *ot);
152 void NODE_OT_group_separate(struct wmOperatorType *ot);
153 void NODE_OT_group_edit(struct wmOperatorType *ot);
154 void NODE_OT_group_socket_add(struct wmOperatorType *ot);
155 void NODE_OT_group_socket_remove(struct wmOperatorType *ot);
156 void NODE_OT_group_socket_move_up(struct wmOperatorType *ot);
157 void NODE_OT_group_socket_move_down(struct wmOperatorType *ot);
159 void NODE_OT_mute_toggle(struct wmOperatorType *ot);
160 void NODE_OT_hide_toggle(struct wmOperatorType *ot);
161 void NODE_OT_hide_socket_toggle(struct wmOperatorType *ot);
162 void NODE_OT_preview_toggle(struct wmOperatorType *ot);
163 void NODE_OT_options_toggle(struct wmOperatorType *ot);
164 void NODE_OT_node_copy_color(struct wmOperatorType *ot);
166 void NODE_OT_show_cyclic_dependencies(struct wmOperatorType *ot);
167 void NODE_OT_link_viewer(struct wmOperatorType *ot);
168 void NODE_OT_read_fullsamplelayers(struct wmOperatorType *ot);
169 void NODE_OT_read_renderlayers(struct wmOperatorType *ot);
170 void NODE_OT_render_changed(struct wmOperatorType *ot);
172 void NODE_OT_backimage_move(struct wmOperatorType *ot);
173 void NODE_OT_backimage_zoom(struct wmOperatorType *ot);
174 void NODE_OT_backimage_sample(wmOperatorType *ot);
176 void NODE_OT_add_file(struct wmOperatorType *ot);
178 void NODE_OT_new_node_tree(struct wmOperatorType *ot);
180 void NODE_OT_output_file_add_socket(struct wmOperatorType *ot);
181 void NODE_OT_output_file_remove_active_socket(struct wmOperatorType *ot);
182 void NODE_OT_output_file_move_active_socket(struct wmOperatorType *ot);
184 void NODE_OT_parent_set(struct wmOperatorType *ot);
185 void NODE_OT_parent_clear(struct wmOperatorType *ot);
186 void NODE_OT_join(struct wmOperatorType *ot);
187 void NODE_OT_attach(struct wmOperatorType *ot);
188 void NODE_OT_detach(struct wmOperatorType *ot);
190 extern const char *node_context_dir[];
194 // XXX from BSE_node.h
195 #define HIDDEN_RAD 15.0f
196 #define BASIS_RAD 8.0f
197 #define NODE_DYS (U.widget_unit/2)
198 #define NODE_DY U.widget_unit
199 #define NODE_MARGIN_X 15
200 #define NODE_SOCKSIZE 5
202 // XXX button events (butspace)
220 } eNodeSpace_ButEvents;
222 #endif /* __NODE_INTERN_H__ */