Blender V4.3
node_ops.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "DNA_node_types.h"
10
11#include "ED_node.hh" /* own include */
12#include "ED_screen.hh"
13
14#include "RNA_access.hh"
15
16#include "WM_api.hh"
17#include "WM_types.hh"
18
19#include "node_intern.hh" /* own include */
20
22
24{
34
36
39
47
52
59
65
67
69
71
74
79
87
89
93
98
101
103
106
109
110 NODE_TYPES_BEGIN (ntype) {
111 if (ntype->register_operators) {
112 ntype->register_operators();
113 }
114 }
116}
117
119{
120 /* Entire Editor only ----------------- */
121 WM_keymap_ensure(keyconf, "Node Generic", SPACE_NODE, RGN_TYPE_WINDOW);
122
123 /* Main Region only ----------------- */
124 WM_keymap_ensure(keyconf, "Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
125
126 node_link_modal_keymap(keyconf);
127}
128
129} // namespace blender::ed::space_node
130
132{
135
136 ot = WM_operatortype_append_macro("NODE_OT_select_link_viewer",
137 "Link Viewer",
138 "Select node and link it to a viewer node",
140 mot = WM_operatortype_macro_define(ot, "NODE_OT_select");
141 RNA_boolean_set(mot->ptr, "extend", false);
142 RNA_boolean_set(mot->ptr, "socket_select", true);
143 RNA_boolean_set(mot->ptr, "clear_viewer", true);
144 WM_operatortype_macro_define(ot, "NODE_OT_link_viewer");
145
146 ot = WM_operatortype_append_macro("NODE_OT_translate_attach",
147 "Move and Attach",
148 "Move nodes and attach to frame",
150 mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
151 WM_operatortype_macro_define(ot, "NODE_OT_attach");
152
153 /* NODE_OT_translate_attach with remove_on_cancel set to true. */
154 ot = WM_operatortype_append_macro("NODE_OT_translate_attach_remove_on_cancel",
155 "Move and Attach",
156 "Move nodes and attach to frame",
158 mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
159 RNA_boolean_set(mot->ptr, "remove_on_cancel", true);
160 RNA_boolean_set(mot->ptr, "view2d_edge_pan", true);
161 WM_operatortype_macro_define(ot, "NODE_OT_attach");
162
163 /* NOTE: Currently not in a default keymap or menu due to messy keymaps
164 * and tricky invoke functionality.
165 * Kept around in case users want to make own shortcuts.
166 */
167 ot = WM_operatortype_append_macro("NODE_OT_detach_translate_attach",
168 "Detach and Move",
169 "Detach nodes, move and attach to frame",
171 WM_operatortype_macro_define(ot, "NODE_OT_detach");
172 mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
173 WM_operatortype_macro_define(ot, "NODE_OT_attach");
174
175 ot = WM_operatortype_append_macro("NODE_OT_duplicate_move",
176 "Duplicate",
177 "Duplicate selected nodes and move them",
179 mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
180 RNA_boolean_set(mot->ptr, "linked", false);
181 WM_operatortype_macro_define(ot, "NODE_OT_translate_attach");
182
184 "NODE_OT_duplicate_move_linked",
185 "Duplicate Linked",
186 "Duplicate selected nodes, but not their node trees, and move them",
188 mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
189 RNA_boolean_set(mot->ptr, "linked", true);
190 WM_operatortype_macro_define(ot, "NODE_OT_translate_attach");
191
192 /* modified operator call for duplicating with input links */
193 ot = WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs",
194 "Duplicate",
195 "Duplicate selected nodes keeping input links and move them",
197 mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
198 RNA_boolean_set(mot->ptr, "keep_inputs", true);
199 WM_operatortype_macro_define(ot, "NODE_OT_translate_attach");
200
201 ot = WM_operatortype_append_macro("NODE_OT_move_detach_links",
202 "Detach",
203 "Move a node to detach links",
205 WM_operatortype_macro_define(ot, "NODE_OT_links_detach");
206 WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
207
208 ot = WM_operatortype_append_macro("NODE_OT_move_detach_links_release",
209 "Detach",
210 "Move a node to detach links",
212 WM_operatortype_macro_define(ot, "NODE_OT_links_detach");
213 WM_operatortype_macro_define(ot, "NODE_OT_translate_attach");
214}
#define NODE_TYPES_BEGIN(ntype)
Definition BKE_node.hh:597
#define NODE_TYPES_END
Definition BKE_node.hh:605
@ RGN_TYPE_WINDOW
@ SPACE_NODE
@ OPTYPE_UNDO
Definition WM_types.hh:162
@ OPTYPE_REGISTER
Definition WM_types.hh:160
void NODE_OT_parent_set(wmOperatorType *ot)
void NODE_OT_delete(wmOperatorType *ot)
void NODE_OT_cryptomatte_layer_add(wmOperatorType *ot)
void NODE_OT_add_object(wmOperatorType *ot)
Definition node_add.cc:575
void NODE_OT_read_viewlayers(wmOperatorType *ot)
void NODE_OT_clipboard_copy(wmOperatorType *ot)
Definition clipboard.cc:329
void NODE_OT_select_circle(wmOperatorType *ot)
void NODE_OT_add_mask(wmOperatorType *ot)
Definition node_add.cc:931
void NODE_OT_backimage_sample(wmOperatorType *ot)
Definition node_view.cc:700
void NODE_OT_add_reroute(wmOperatorType *ot)
Definition node_add.cc:230
void NODE_OT_node_copy_color(wmOperatorType *ot)
void NODE_OT_detach(wmOperatorType *ot)
void NODE_OT_viewer_border(wmOperatorType *ot)
void NODE_OT_find_node(wmOperatorType *ot)
void NODE_OT_select_lasso(wmOperatorType *ot)
void NODE_OT_add_collection(wmOperatorType *ot)
Definition node_add.cc:661
void NODE_OT_backimage_zoom(wmOperatorType *ot)
Definition node_view.cc:347
void NODE_OT_select(wmOperatorType *ot)
void NODE_OT_insert_offset(wmOperatorType *ot)
void NODE_OT_group_make(wmOperatorType *ot)
void NODE_OT_deactivate_viewer(wmOperatorType *ot)
void NODE_OT_add_group_asset(wmOperatorType *ot)
Definition node_add.cc:492
void NODE_OT_resize(wmOperatorType *ot)
void NODE_OT_backimage_move(wmOperatorType *ot)
Definition node_view.cc:310
void NODE_OT_clipboard_paste(wmOperatorType *ot)
Definition clipboard.cc:492
void NODE_OT_render_changed(wmOperatorType *ot)
void NODE_OT_links_detach(wmOperatorType *ot)
void NODE_OT_group_insert(wmOperatorType *ot)
void NODE_OT_delete_reconnect(wmOperatorType *ot)
void NODE_OT_shader_script_update(wmOperatorType *ot)
void NODE_OT_links_cut(wmOperatorType *ot)
void NODE_OT_hide_socket_toggle(wmOperatorType *ot)
void NODE_OT_select_grouped(wmOperatorType *ot)
void NODE_OT_output_file_remove_active_socket(wmOperatorType *ot)
void NODE_OT_join(wmOperatorType *ot)
void NODE_OT_attach(wmOperatorType *ot)
void NODE_OT_view_selected(wmOperatorType *ot)
Definition node_view.cc:186
void NODE_OT_link_viewer(wmOperatorType *ot)
void NODE_OT_select_linked_from(wmOperatorType *ot)
void NODE_OT_select_same_type_step(wmOperatorType *ot)
void NODE_OT_preview_toggle(wmOperatorType *ot)
void NODE_OT_clear_viewer_border(wmOperatorType *ot)
void NODE_OT_select_linked_to(wmOperatorType *ot)
void NODE_OT_link_make(wmOperatorType *ot)
void NODE_OT_view_all(wmOperatorType *ot)
Definition node_view.cc:153
wmKeyMap * node_link_modal_keymap(wmKeyConfig *keyconf)
void NODE_OT_group_edit(wmOperatorType *ot)
void NODE_OT_group_separate(wmOperatorType *ot)
void NODE_OT_duplicate(wmOperatorType *ot)
void NODE_OT_output_file_add_socket(wmOperatorType *ot)
void NODE_OT_options_toggle(wmOperatorType *ot)
void node_keymap(wmKeyConfig *keyconf)
Definition node_ops.cc:118
void NODE_OT_add_group(wmOperatorType *ot)
Definition node_add.cc:370
void NODE_OT_add_file(wmOperatorType *ot)
Definition node_add.cc:863
void NODE_OT_link(wmOperatorType *ot)
void NODE_OT_links_mute(wmOperatorType *ot)
void NODE_OT_default_group_width_set(wmOperatorType *ot)
void NODE_OT_hide_toggle(wmOperatorType *ot)
void NODE_OT_add_material(wmOperatorType *ot)
Definition node_add.cc:1008
void NODE_OT_select_box(wmOperatorType *ot)
void NODE_OT_select_all(wmOperatorType *ot)
void NODE_OT_group_ungroup(wmOperatorType *ot)
void NODE_OT_new_node_tree(wmOperatorType *ot)
Definition node_add.cc:1105
void NODE_OT_cryptomatte_layer_remove(wmOperatorType *ot)
void NODE_OT_backimage_fit(wmOperatorType *ot)
Definition node_view.cc:412
void NODE_OT_output_file_move_active_socket(wmOperatorType *ot)
void NODE_OT_mute_toggle(wmOperatorType *ot)
void ED_operatormacros_node()
Definition node_ops.cc:131
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
wmOperatorType * ot
Definition wm_files.cc:4125
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition wm_keymap.cc:897
wmOperatorTypeMacro * WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
wmOperatorType * WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag)