2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2008 Blender Foundation. All rights reserved. */
|
2008-12-28 00:08:34 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spnode
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2008-12-28 00:08:34 +00:00
|
|
|
#include "DNA_node_types.h"
|
|
|
|
|
|
2013-04-05 17:56:54 +00:00
|
|
|
#include "BKE_context.h"
|
|
|
|
|
|
2012-08-02 23:03:16 +00:00
|
|
|
#include "ED_node.h" /* own include */
|
2008-12-28 00:08:34 +00:00
|
|
|
#include "ED_screen.h"
|
2009-01-02 23:58:03 +00:00
|
|
|
|
2008-12-28 00:08:34 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2021-11-12 12:12:27 -06:00
|
|
|
#include "node_intern.hh" /* own include */
|
2008-12-28 00:08:34 +00:00
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
namespace blender::ed::space_node {
|
|
|
|
|
|
2021-11-12 12:12:27 -06:00
|
|
|
void node_operatortypes()
|
2008-12-28 00:08:34 +00:00
|
|
|
{
|
|
|
|
|
WM_operatortype_append(NODE_OT_select);
|
2009-09-14 08:47:13 +00:00
|
|
|
WM_operatortype_append(NODE_OT_select_all);
|
|
|
|
|
WM_operatortype_append(NODE_OT_select_linked_to);
|
|
|
|
|
WM_operatortype_append(NODE_OT_select_linked_from);
|
2018-10-05 10:27:04 +10:00
|
|
|
WM_operatortype_append(NODE_OT_select_box);
|
2013-11-06 19:21:42 +00:00
|
|
|
WM_operatortype_append(NODE_OT_select_circle);
|
2012-08-22 13:34:06 +00:00
|
|
|
WM_operatortype_append(NODE_OT_select_lasso);
|
2014-07-04 14:17:54 +02:00
|
|
|
WM_operatortype_append(NODE_OT_select_grouped);
|
2013-03-27 18:28:25 +00:00
|
|
|
WM_operatortype_append(NODE_OT_select_same_type_step);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-04-01 15:07:22 +00:00
|
|
|
WM_operatortype_append(NODE_OT_find_node);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-11-20 06:31:49 +00:00
|
|
|
WM_operatortype_append(NODE_OT_view_all);
|
2012-08-07 16:30:34 +00:00
|
|
|
WM_operatortype_append(NODE_OT_view_selected);
|
2011-12-18 12:51:50 +00:00
|
|
|
|
2010-06-07 20:03:40 +00:00
|
|
|
WM_operatortype_append(NODE_OT_mute_toggle);
|
|
|
|
|
WM_operatortype_append(NODE_OT_hide_toggle);
|
|
|
|
|
WM_operatortype_append(NODE_OT_preview_toggle);
|
2011-12-18 12:51:50 +00:00
|
|
|
WM_operatortype_append(NODE_OT_options_toggle);
|
2010-06-07 20:03:40 +00:00
|
|
|
WM_operatortype_append(NODE_OT_hide_socket_toggle);
|
2012-05-22 14:13:33 +00:00
|
|
|
WM_operatortype_append(NODE_OT_node_copy_color);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-11-20 06:31:49 +00:00
|
|
|
WM_operatortype_append(NODE_OT_duplicate);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(NODE_OT_delete);
|
2011-07-12 18:59:54 +00:00
|
|
|
WM_operatortype_append(NODE_OT_delete_reconnect);
|
2009-04-15 15:40:31 +00:00
|
|
|
WM_operatortype_append(NODE_OT_resize);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-11-20 06:31:49 +00:00
|
|
|
WM_operatortype_append(NODE_OT_link);
|
|
|
|
|
WM_operatortype_append(NODE_OT_link_make);
|
2009-02-07 14:03:34 +00:00
|
|
|
WM_operatortype_append(NODE_OT_links_cut);
|
2012-02-27 17:38:16 +00:00
|
|
|
WM_operatortype_append(NODE_OT_links_detach);
|
2021-03-16 19:11:54 +00:00
|
|
|
WM_operatortype_append(NODE_OT_links_mute);
|
2012-06-01 12:38:03 +00:00
|
|
|
WM_operatortype_append(NODE_OT_add_reroute);
|
2011-07-12 18:59:54 +00:00
|
|
|
|
2009-09-15 11:35:10 +00:00
|
|
|
WM_operatortype_append(NODE_OT_group_make);
|
2013-03-18 16:34:57 +00:00
|
|
|
WM_operatortype_append(NODE_OT_group_insert);
|
2009-09-15 11:35:10 +00:00
|
|
|
WM_operatortype_append(NODE_OT_group_ungroup);
|
2012-06-12 08:44:46 +00:00
|
|
|
WM_operatortype_append(NODE_OT_group_separate);
|
2009-09-15 11:35:10 +00:00
|
|
|
WM_operatortype_append(NODE_OT_group_edit);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-04-05 18:34:18 +00:00
|
|
|
WM_operatortype_append(NODE_OT_link_viewer);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-08-01 17:39:48 +02:00
|
|
|
WM_operatortype_append(NODE_OT_insert_offset);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
WM_operatortype_append(NODE_OT_read_viewlayers);
|
2011-02-07 16:41:57 +00:00
|
|
|
WM_operatortype_append(NODE_OT_render_changed);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-04-07 17:06:22 +00:00
|
|
|
WM_operatortype_append(NODE_OT_backimage_move);
|
2010-04-08 16:36:50 +00:00
|
|
|
WM_operatortype_append(NODE_OT_backimage_zoom);
|
2013-09-01 09:50:56 +00:00
|
|
|
WM_operatortype_append(NODE_OT_backimage_fit);
|
2011-01-31 14:42:55 +00:00
|
|
|
WM_operatortype_append(NODE_OT_backimage_sample);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2021-02-15 19:35:24 +01:00
|
|
|
WM_operatortype_append(NODE_OT_add_group);
|
2021-03-15 14:57:00 +00:00
|
|
|
WM_operatortype_append(NODE_OT_add_object);
|
|
|
|
|
WM_operatortype_append(NODE_OT_add_collection);
|
2010-05-12 04:25:33 +00:00
|
|
|
WM_operatortype_append(NODE_OT_add_file);
|
2013-07-22 19:24:39 +00:00
|
|
|
WM_operatortype_append(NODE_OT_add_mask);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
WM_operatortype_append(NODE_OT_new_node_tree);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-01 07:56:15 +00:00
|
|
|
WM_operatortype_append(NODE_OT_output_file_add_socket);
|
|
|
|
|
WM_operatortype_append(NODE_OT_output_file_remove_active_socket);
|
2012-05-02 07:18:51 +00:00
|
|
|
WM_operatortype_append(NODE_OT_output_file_move_active_socket);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
WM_operatortype_append(NODE_OT_parent_set);
|
|
|
|
|
WM_operatortype_append(NODE_OT_join);
|
|
|
|
|
WM_operatortype_append(NODE_OT_attach);
|
|
|
|
|
WM_operatortype_append(NODE_OT_detach);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-08-02 09:52:37 +00:00
|
|
|
WM_operatortype_append(NODE_OT_clipboard_copy);
|
|
|
|
|
WM_operatortype_append(NODE_OT_clipboard_paste);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-11-03 14:32:26 +00:00
|
|
|
WM_operatortype_append(NODE_OT_shader_script_update);
|
2013-03-07 17:47:30 +00:00
|
|
|
|
|
|
|
|
WM_operatortype_append(NODE_OT_viewer_border);
|
2014-06-05 20:05:41 +06:00
|
|
|
WM_operatortype_append(NODE_OT_clear_viewer_border);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
WM_operatortype_append(NODE_OT_switch_view_update);
|
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
WM_operatortype_append(NODE_OT_tree_socket_add);
|
|
|
|
|
WM_operatortype_append(NODE_OT_tree_socket_remove);
|
2021-07-06 18:36:11 +01:00
|
|
|
WM_operatortype_append(NODE_OT_tree_socket_change_type);
|
2013-03-18 16:34:57 +00:00
|
|
|
WM_operatortype_append(NODE_OT_tree_socket_move);
|
2018-07-18 13:03:09 +02:00
|
|
|
|
|
|
|
|
WM_operatortype_append(NODE_OT_cryptomatte_layer_add);
|
|
|
|
|
WM_operatortype_append(NODE_OT_cryptomatte_layer_remove);
|
2008-12-28 00:08:34 +00:00
|
|
|
}
|
|
|
|
|
|
2022-09-05 17:24:52 +02:00
|
|
|
void node_keymap(wmKeyConfig *keyconf)
|
2022-01-20 10:36:56 -06:00
|
|
|
{
|
|
|
|
|
/* Entire Editor only ----------------- */
|
|
|
|
|
WM_keymap_ensure(keyconf, "Node Generic", SPACE_NODE, 0);
|
|
|
|
|
|
|
|
|
|
/* Main Region only ----------------- */
|
|
|
|
|
WM_keymap_ensure(keyconf, "Node Editor", SPACE_NODE, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace blender::ed::space_node
|
|
|
|
|
|
2021-12-08 00:31:20 -05:00
|
|
|
void ED_operatormacros_node()
|
2009-11-20 21:04:41 +00:00
|
|
|
{
|
|
|
|
|
wmOperatorType *ot;
|
2011-07-17 18:04:28 +00:00
|
|
|
wmOperatorTypeMacro *mot;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
ot = WM_operatortype_append_macro("NODE_OT_select_link_viewer",
|
|
|
|
|
"Link Viewer",
|
|
|
|
|
"Select node and link it to a viewer node",
|
|
|
|
|
OPTYPE_UNDO);
|
2019-03-22 17:03:02 +01:00
|
|
|
mot = WM_operatortype_macro_define(ot, "NODE_OT_select");
|
|
|
|
|
RNA_boolean_set(mot->ptr, "extend", false);
|
|
|
|
|
RNA_boolean_set(mot->ptr, "socket_select", true);
|
2012-05-22 14:13:33 +00:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_link_viewer");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
ot = WM_operatortype_append_macro("NODE_OT_translate_attach",
|
|
|
|
|
"Move and Attach",
|
|
|
|
|
"Move nodes and attach to frame",
|
2012-08-04 12:54:27 +00:00
|
|
|
OPTYPE_UNDO | OPTYPE_REGISTER);
|
2012-05-22 14:13:33 +00:00
|
|
|
mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
|
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_attach");
|
2015-08-01 17:39:48 +02:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_insert_offset");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-08-01 17:39:48 +02:00
|
|
|
/* NODE_OT_translate_attach with remove_on_canel set to true */
|
|
|
|
|
ot = WM_operatortype_append_macro("NODE_OT_translate_attach_remove_on_cancel",
|
|
|
|
|
"Move and Attach",
|
|
|
|
|
"Move nodes and attach to frame",
|
|
|
|
|
OPTYPE_UNDO | OPTYPE_REGISTER);
|
|
|
|
|
mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
|
|
|
|
RNA_boolean_set(mot->ptr, "remove_on_cancel", true);
|
2021-10-26 13:42:19 +02:00
|
|
|
RNA_boolean_set(mot->ptr, "view2d_edge_pan", true);
|
2015-08-01 17:39:48 +02:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_attach");
|
|
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_insert_offset");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-07-03 23:08:40 +10:00
|
|
|
/* NOTE: Currently not in a default keymap or menu due to messy keymaps
|
2014-11-05 11:35:48 +01:00
|
|
|
* and tricky invoke functionality.
|
|
|
|
|
* Kept around in case users want to make own shortcuts.
|
|
|
|
|
*/
|
2012-05-22 14:13:33 +00:00
|
|
|
ot = WM_operatortype_append_macro("NODE_OT_detach_translate_attach",
|
|
|
|
|
"Detach and Move",
|
|
|
|
|
"Detach nodes, move and attach to frame",
|
2012-08-04 12:54:27 +00:00
|
|
|
OPTYPE_UNDO | OPTYPE_REGISTER);
|
2012-05-22 14:13:33 +00:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_detach");
|
|
|
|
|
mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
|
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_attach");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
ot = WM_operatortype_append_macro("NODE_OT_duplicate_move",
|
|
|
|
|
"Duplicate",
|
|
|
|
|
"Duplicate selected nodes and move them",
|
2012-08-04 12:54:27 +00:00
|
|
|
OPTYPE_UNDO | OPTYPE_REGISTER);
|
2009-11-20 21:04:41 +00:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
|
2012-05-22 14:13:33 +00:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_translate_attach");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-07-17 18:04:28 +00:00
|
|
|
/* modified operator call for duplicating with input links */
|
2012-05-05 19:26:53 +00:00
|
|
|
ot = WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs",
|
|
|
|
|
"Duplicate",
|
|
|
|
|
"Duplicate selected nodes keeping input links and move them",
|
2012-08-04 12:54:27 +00:00
|
|
|
OPTYPE_UNDO | OPTYPE_REGISTER);
|
2011-07-17 18:04:28 +00:00
|
|
|
mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(mot->ptr, "keep_inputs", true);
|
2012-05-22 14:13:33 +00:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_translate_attach");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-05 19:26:53 +00:00
|
|
|
ot = WM_operatortype_append_macro("NODE_OT_move_detach_links",
|
|
|
|
|
"Detach",
|
|
|
|
|
"Move a node to detach links",
|
2012-08-04 12:54:27 +00:00
|
|
|
OPTYPE_UNDO | OPTYPE_REGISTER);
|
2012-02-27 17:38:16 +00:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_links_detach");
|
2012-05-01 08:19:11 +00:00
|
|
|
WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
2015-08-01 20:59:55 +02:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_insert_offset");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-05 19:26:53 +00:00
|
|
|
ot = WM_operatortype_append_macro("NODE_OT_move_detach_links_release",
|
|
|
|
|
"Detach",
|
|
|
|
|
"Move a node to detach links",
|
2012-08-04 12:54:27 +00:00
|
|
|
OPTYPE_UNDO | OPTYPE_REGISTER);
|
2012-05-01 08:19:11 +00:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_links_detach");
|
2012-10-01 15:27:50 +00:00
|
|
|
WM_operatortype_macro_define(ot, "NODE_OT_translate_attach");
|
2012-05-22 14:13:33 +00:00
|
|
|
}
|