Blender  V2.93
node_ops.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_node_types.h"
25 
26 #include "BKE_context.h"
27 
28 #include "ED_node.h" /* own include */
29 #include "ED_screen.h"
30 
31 #include "RNA_access.h"
32 
33 #include "WM_api.h"
34 #include "WM_types.h"
35 
36 #include "node_intern.h" /* own include */
37 
39 {
49 
51 
54 
61 
66 
73 
79 
81 
83 
86 
91 
98 
100 
104 
109 
112 
114 
117 
119 
123 
126 }
127 
129 {
131  wmOperatorTypeMacro *mot;
132 
133  ot = WM_operatortype_append_macro("NODE_OT_select_link_viewer",
134  "Link Viewer",
135  "Select node and link it to a viewer node",
136  OPTYPE_UNDO);
137  mot = WM_operatortype_macro_define(ot, "NODE_OT_select");
138  RNA_boolean_set(mot->ptr, "extend", false);
139  RNA_boolean_set(mot->ptr, "socket_select", true);
140  WM_operatortype_macro_define(ot, "NODE_OT_link_viewer");
141 
142  ot = WM_operatortype_append_macro("NODE_OT_translate_attach",
143  "Move and Attach",
144  "Move nodes and attach to frame",
146  mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
147  WM_operatortype_macro_define(ot, "NODE_OT_attach");
148  WM_operatortype_macro_define(ot, "NODE_OT_insert_offset");
149 
150  /* NODE_OT_translate_attach with remove_on_canel set to true */
151  ot = WM_operatortype_append_macro("NODE_OT_translate_attach_remove_on_cancel",
152  "Move and Attach",
153  "Move nodes and attach to frame",
155  mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
156  RNA_boolean_set(mot->ptr, "remove_on_cancel", true);
157  WM_operatortype_macro_define(ot, "NODE_OT_attach");
158  WM_operatortype_macro_define(ot, "NODE_OT_insert_offset");
159 
160  /* Note: Currently not in a default keymap or menu due to messy keymaps
161  * and tricky invoke functionality.
162  * Kept around in case users want to make own shortcuts.
163  */
164  ot = WM_operatortype_append_macro("NODE_OT_detach_translate_attach",
165  "Detach and Move",
166  "Detach nodes, move and attach to frame",
168  WM_operatortype_macro_define(ot, "NODE_OT_detach");
169  mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
170  WM_operatortype_macro_define(ot, "NODE_OT_attach");
171 
172  ot = WM_operatortype_append_macro("NODE_OT_duplicate_move",
173  "Duplicate",
174  "Duplicate selected nodes and move them",
176  WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
177  WM_operatortype_macro_define(ot, "NODE_OT_translate_attach");
178 
179  /* modified operator call for duplicating with input links */
180  ot = WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs",
181  "Duplicate",
182  "Duplicate selected nodes keeping input links and move them",
184  mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
185  RNA_boolean_set(mot->ptr, "keep_inputs", true);
186  WM_operatortype_macro_define(ot, "NODE_OT_translate_attach");
187 
188  ot = WM_operatortype_append_macro("NODE_OT_move_detach_links",
189  "Detach",
190  "Move a node to detach links",
192  WM_operatortype_macro_define(ot, "NODE_OT_links_detach");
193  WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
194  WM_operatortype_macro_define(ot, "NODE_OT_insert_offset");
195 
196  ot = WM_operatortype_append_macro("NODE_OT_move_detach_links_release",
197  "Detach",
198  "Move a node to detach links",
200  WM_operatortype_macro_define(ot, "NODE_OT_links_detach");
201  WM_operatortype_macro_define(ot, "NODE_OT_translate_attach");
202 }
203 
204 void node_keymap(struct wmKeyConfig *keyconf)
205 {
206  /* Entire Editor only ----------------- */
207  WM_keymap_ensure(keyconf, "Node Generic", SPACE_NODE, 0);
208 
209  /* Main Region only ----------------- */
210  WM_keymap_ensure(keyconf, "Node Editor", SPACE_NODE, 0);
211 }
@ SPACE_NODE
@ OPTYPE_UNDO
Definition: WM_types.h:155
@ OPTYPE_REGISTER
Definition: WM_types.h:153
void NODE_OT_add_file(wmOperatorType *ot)
Definition: node_add.c:836
void NODE_OT_add_collection(wmOperatorType *ot)
Definition: node_add.c:730
void NODE_OT_add_group(wmOperatorType *ot)
Definition: node_add.c:422
void NODE_OT_add_reroute(wmOperatorType *ot)
Definition: node_add.c:301
void NODE_OT_add_texture(wmOperatorType *ot)
Definition: node_add.c:625
void NODE_OT_add_mask(wmOperatorType *ot)
Definition: node_add.c:909
void NODE_OT_add_object(wmOperatorType *ot)
Definition: node_add.c:526
void NODE_OT_new_node_tree(wmOperatorType *ot)
Definition: node_add.c:999
void NODE_OT_delete(wmOperatorType *ot)
Definition: node_edit.c:1770
void NODE_OT_hide_toggle(wmOperatorType *ot)
Definition: node_edit.c:1568
void NODE_OT_delete_reconnect(wmOperatorType *ot)
Definition: node_edit.c:1855
void NODE_OT_clipboard_paste(wmOperatorType *ot)
Definition: node_edit.c:2269
void NODE_OT_duplicate(wmOperatorType *ot)
Definition: node_edit.c:1341
void NODE_OT_preview_toggle(wmOperatorType *ot)
Definition: node_edit.c:1601
void NODE_OT_output_file_remove_active_socket(wmOperatorType *ot)
Definition: node_edit.c:1951
void NODE_OT_clipboard_copy(wmOperatorType *ot)
Definition: node_edit.c:2148
void NODE_OT_resize(wmOperatorType *ot)
Definition: node_edit.c:1068
void NODE_OT_output_file_add_socket(wmOperatorType *ot)
Definition: node_edit.c:1902
void NODE_OT_read_viewlayers(wmOperatorType *ot)
Definition: node_edit.c:1434
void NODE_OT_tree_socket_remove(wmOperatorType *ot)
Definition: node_edit.c:2390
void NODE_OT_mute_toggle(wmOperatorType *ot)
Definition: node_edit.c:1726
void NODE_OT_cryptomatte_layer_add(wmOperatorType *ot)
Definition: node_edit.c:2779
void NODE_OT_tree_socket_move(wmOperatorType *ot)
Definition: node_edit.c:2465
void NODE_OT_node_copy_color(wmOperatorType *ot)
Definition: node_edit.c:2071
void NODE_OT_switch_view_update(wmOperatorType *ot)
Definition: node_edit.c:1817
void NODE_OT_shader_script_update(wmOperatorType *ot)
Definition: node_edit.c:2613
void NODE_OT_options_toggle(wmOperatorType *ot)
Definition: node_edit.c:1632
void NODE_OT_output_file_move_active_socket(wmOperatorType *ot)
Definition: node_edit.c:2018
void NODE_OT_render_changed(wmOperatorType *ot)
Definition: node_edit.c:1487
void NODE_OT_hide_socket_toggle(wmOperatorType *ot)
Definition: node_edit.c:1682
void NODE_OT_cryptomatte_layer_remove(wmOperatorType *ot)
Definition: node_edit.c:2825
void NODE_OT_tree_socket_add(wmOperatorType *ot)
Definition: node_edit.c:2340
void NODE_OT_viewer_border(wmOperatorType *ot)
Definition: node_edit.c:2702
void NODE_OT_clear_viewer_border(wmOperatorType *ot)
Definition: node_edit.c:2735
void NODE_OT_group_insert(wmOperatorType *ot)
Definition: node_group.c:1117
void NODE_OT_group_make(wmOperatorType *ot)
Definition: node_group.c:1062
void NODE_OT_group_ungroup(wmOperatorType *ot)
Definition: node_group.c:426
void NODE_OT_group_separate(wmOperatorType *ot)
Definition: node_group.c:639
void NODE_OT_group_edit(wmOperatorType *ot)
Definition: node_group.c:173
void NODE_OT_link_make(struct wmOperatorType *ot)
void NODE_OT_select_grouped(struct wmOperatorType *ot)
Definition: node_select.c:416
void NODE_OT_select_box(struct wmOperatorType *ot)
Definition: node_select.c:722
void NODE_OT_select_circle(struct wmOperatorType *ot)
Definition: node_select.c:794
void NODE_OT_link(struct wmOperatorType *ot)
void NODE_OT_detach(struct wmOperatorType *ot)
void NODE_OT_select_all(struct wmOperatorType *ot)
Definition: node_select.c:947
void NODE_OT_view_selected(struct wmOperatorType *ot)
Definition: node_view.c:173
void NODE_OT_backimage_move(struct wmOperatorType *ot)
Definition: node_view.c:281
void NODE_OT_backimage_sample(struct wmOperatorType *ot)
Definition: node_view.c:683
void NODE_OT_select_same_type_step(struct wmOperatorType *ot)
Definition: node_select.c:1157
void NODE_OT_link_viewer(struct wmOperatorType *ot)
void NODE_OT_parent_set(struct wmOperatorType *ot)
void NODE_OT_select_lasso(struct wmOperatorType *ot)
Definition: node_select.c:899
void NODE_OT_select(struct wmOperatorType *ot)
Definition: node_select.c:639
void NODE_OT_insert_offset(struct wmOperatorType *ot)
void NODE_OT_select_linked_from(struct wmOperatorType *ot)
Definition: node_select.c:1053
void NODE_OT_backimage_zoom(struct wmOperatorType *ot)
Definition: node_view.c:318
void NODE_OT_join(struct wmOperatorType *ot)
void NODE_OT_links_mute(struct wmOperatorType *ot)
void NODE_OT_attach(struct wmOperatorType *ot)
void NODE_OT_links_detach(struct wmOperatorType *ot)
void NODE_OT_select_linked_to(struct wmOperatorType *ot)
Definition: node_select.c:1001
void NODE_OT_find_node(struct wmOperatorType *ot)
Definition: node_select.c:1295
void NODE_OT_backimage_fit(struct wmOperatorType *ot)
Definition: node_view.c:383
void NODE_OT_links_cut(struct wmOperatorType *ot)
void NODE_OT_view_all(struct wmOperatorType *ot)
Definition: node_view.c:140
void ED_operatormacros_node(void)
Definition: node_ops.c:128
void node_operatortypes(void)
Definition: node_ops.c:38
void node_keymap(struct wmKeyConfig *keyconf)
Definition: node_ops.c:204
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:6272
wmOperatorType * ot
Definition: wm_files.c:3156
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:852
wmOperatorType * WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag)
wmOperatorTypeMacro * WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))