MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / shortcut_input

Method shortcut_input

editor/script/script_editor_plugin.cpp:3454–3497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3452}
3453
3454void ScriptEditor::shortcut_input(const Ref<InputEvent> &p_event) {
3455 ERR_FAIL_COND(p_event.is_null());
3456
3457 if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) {
3458 return;
3459 }
3460 if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) {
3461 if (script_list->get_item_count() > 1) {
3462 int next_tab = script_list->get_current() + 1;
3463 next_tab %= script_list->get_item_count();
3464 _go_to_tab(script_list->get_item_metadata(next_tab));
3465 _update_script_names();
3466 }
3467 accept_event();
3468 }
3469 if (ED_IS_SHORTCUT("script_editor/prev_script", p_event)) {
3470 if (script_list->get_item_count() > 1) {
3471 int next_tab = script_list->get_current() - 1;
3472 next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1;
3473 _go_to_tab(script_list->get_item_metadata(next_tab));
3474 _update_script_names();
3475 }
3476 accept_event();
3477 }
3478 if (ED_IS_SHORTCUT("script_editor/window_move_up", p_event)) {
3479 _menu_option(FILE_MENU_MOVE_UP);
3480 accept_event();
3481 }
3482 if (ED_IS_SHORTCUT("script_editor/window_move_down", p_event)) {
3483 _menu_option(FILE_MENU_MOVE_DOWN);
3484 accept_event();
3485 }
3486
3487 Callable custom_callback = EditorContextMenuPluginManager::get_singleton()->match_custom_shortcut(EditorContextMenuPlugin::CONTEXT_SLOT_SCRIPT_EDITOR, p_event);
3488 if (custom_callback.is_valid()) {
3489 Ref<Resource> resource;
3490 ScriptEditorBase *current = _get_current_editor();
3491 if (current) {
3492 resource = current->get_edited_resource();
3493 }
3494 EditorContextMenuPluginManager::get_singleton()->invoke_callback(custom_callback, resource);
3495 accept_event();
3496 }
3497}
3498
3499void ScriptEditor::_script_list_clicked(int p_item, Vector2 p_local_mouse_pos, MouseButton p_mouse_button_index) {
3500 if (p_mouse_button_index == MouseButton::MIDDLE) {

Callers

nothing calls this directly

Calls 10

is_echoMethod · 0.80
match_custom_shortcutMethod · 0.80
invoke_callbackMethod · 0.80
is_nullMethod · 0.45
is_pressedMethod · 0.45
get_item_countMethod · 0.45
get_currentMethod · 0.45
get_item_metadataMethod · 0.45
is_validMethod · 0.45
get_edited_resourceMethod · 0.45

Tested by

no test coverage detected