diff options
author | Chaosus <chaosus89@gmail.com> | 2019-07-12 20:36:33 +0300 |
---|---|---|
committer | Chaosus <chaosus89@gmail.com> | 2019-07-31 12:43:29 +0300 |
commit | f70450680728c3e7b986b4f63733605b6f8cb3f6 (patch) | |
tree | a362e25b22d29760f8ffc7095edf3c8d9f7c1655 /scene | |
parent | dfa324eb8ea4a1f9a53dd6e29e9016b7f5dcd232 (diff) |
Implement copy/paste in visual shaders
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/graph_edit.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index f238aeb392..38005f1322 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1030,14 +1030,28 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { } Ref<InputEventKey> k = p_ev; - if (k.is_valid() && k->get_scancode() == KEY_D && k->is_pressed() && k->get_command()) { - emit_signal("duplicate_nodes_request"); - accept_event(); - } - if (k.is_valid() && k->get_scancode() == KEY_DELETE && k->is_pressed()) { - emit_signal("delete_nodes_request"); - accept_event(); + if (k.is_valid()) { + + if (k->get_scancode() == KEY_D && k->is_pressed() && k->get_command()) { + emit_signal("duplicate_nodes_request"); + accept_event(); + } + + if (k->get_scancode() == KEY_C && k->is_pressed() && k->get_command()) { + emit_signal("copy_nodes_request"); + accept_event(); + } + + if (k->get_scancode() == KEY_V && k->is_pressed() && k->get_command()) { + emit_signal("paste_nodes_request"); + accept_event(); + } + + if (k->get_scancode() == KEY_DELETE && k->is_pressed()) { + emit_signal("delete_nodes_request"); + accept_event(); + } } Ref<InputEventMagnifyGesture> magnify_gesture = p_ev; @@ -1297,6 +1311,8 @@ void GraphEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("disconnection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot"))); ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2, "position"))); ADD_SIGNAL(MethodInfo("duplicate_nodes_request")); + ADD_SIGNAL(MethodInfo("copy_nodes_request")); + ADD_SIGNAL(MethodInfo("paste_nodes_request")); ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::VECTOR2, "release_position"))); ADD_SIGNAL(MethodInfo("connection_from_empty", PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot"), PropertyInfo(Variant::VECTOR2, "release_position"))); |