mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-03 23:21:15 +00:00 
			
		
		
		
	Added ability to override shortcut definitions for OSX (remove preprocessor defines)
This commit is contained in:
		
							parent
							
								
									b458feba24
								
							
						
					
					
						commit
						6b65092c57
					
				
					 4 changed files with 84 additions and 95 deletions
				
			
		| 
						 | 
					@ -6203,11 +6203,9 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	tabbar_container->add_child(scene_tabs);
 | 
						tabbar_container->add_child(scene_tabs);
 | 
				
			||||||
	distraction_free = memnew(Button);
 | 
						distraction_free = memnew(Button);
 | 
				
			||||||
	distraction_free->set_flat(true);
 | 
						distraction_free->set_flat(true);
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
						ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11);
 | 
				
			||||||
	distraction_free->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_D));
 | 
						ED_SHORTCUT_OVERRIDE("editor/distraction_free_mode", "macos", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_D);
 | 
				
			||||||
#else
 | 
						distraction_free->set_shortcut(ED_GET_SHORTCUT("editor/distraction_free_mode"));
 | 
				
			||||||
	distraction_free->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11));
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	distraction_free->set_tooltip(TTR("Toggle distraction-free mode."));
 | 
						distraction_free->set_tooltip(TTR("Toggle distraction-free mode."));
 | 
				
			||||||
	distraction_free->connect("pressed", callable_mp(this, &EditorNode::_toggle_distraction_free_mode));
 | 
						distraction_free->connect("pressed", callable_mp(this, &EditorNode::_toggle_distraction_free_mode));
 | 
				
			||||||
	distraction_free->set_icon(gui_base->get_theme_icon(SNAME("DistractionFree"), SNAME("EditorIcons")));
 | 
						distraction_free->set_icon(gui_base->get_theme_icon(SNAME("DistractionFree"), SNAME("EditorIcons")));
 | 
				
			||||||
| 
						 | 
					@ -6395,11 +6393,9 @@ EditorNode::EditorNode() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p->add_separator();
 | 
						p->add_separator();
 | 
				
			||||||
	p->add_shortcut(ED_SHORTCUT("editor/reload_current_project", TTR("Reload Current Project")), RUN_RELOAD_CURRENT_PROJECT);
 | 
						p->add_shortcut(ED_SHORTCUT("editor/reload_current_project", TTR("Reload Current Project")), RUN_RELOAD_CURRENT_PROJECT);
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
						ED_SHORTCUT_AND_COMMAND("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_Q);
 | 
				
			||||||
	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q), RUN_PROJECT_MANAGER, true);
 | 
						ED_SHORTCUT_OVERRIDE("editor/quit_to_project_list", "macos", KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q);
 | 
				
			||||||
#else
 | 
						p->add_shortcut(ED_GET_SHORTCUT("editor/quit_to_project_list"), RUN_PROJECT_MANAGER, true);
 | 
				
			||||||
	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_Q), RUN_PROJECT_MANAGER, true);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	menu_hb->add_spacer();
 | 
						menu_hb->add_spacer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6424,11 +6420,10 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	left_menu_hb->add_child(settings_menu);
 | 
						left_menu_hb->add_child(settings_menu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p = settings_menu->get_popup();
 | 
						p = settings_menu->get_popup();
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					
 | 
				
			||||||
	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/editor_settings", TTR("Editor Settings..."), KEY_MASK_CMD + KEY_COMMA), SETTINGS_PREFERENCES);
 | 
						ED_SHORTCUT_AND_COMMAND("editor/editor_settings", TTR("Editor Settings..."));
 | 
				
			||||||
#else
 | 
						ED_SHORTCUT_OVERRIDE("editor/editor_settings", "macos", KEY_MASK_CMD + KEY_COMMA);
 | 
				
			||||||
	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/editor_settings", TTR("Editor Settings...")), SETTINGS_PREFERENCES);
 | 
						p->add_shortcut(ED_GET_SHORTCUT("editor/editor_settings"), SETTINGS_PREFERENCES);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	p->add_shortcut(ED_SHORTCUT("editor/command_palette", TTR("Command Palette..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_P), HELP_COMMAND_PALETTE);
 | 
						p->add_shortcut(ED_SHORTCUT("editor/command_palette", TTR("Command Palette..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_P), HELP_COMMAND_PALETTE);
 | 
				
			||||||
	p->add_separator();
 | 
						p->add_separator();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6438,17 +6433,17 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	editor_layouts->connect("id_pressed", callable_mp(this, &EditorNode::_layout_menu_option));
 | 
						editor_layouts->connect("id_pressed", callable_mp(this, &EditorNode::_layout_menu_option));
 | 
				
			||||||
	p->add_submenu_item(TTR("Editor Layout"), "Layouts");
 | 
						p->add_submenu_item(TTR("Editor Layout"), "Layouts");
 | 
				
			||||||
	p->add_separator();
 | 
						p->add_separator();
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					
 | 
				
			||||||
	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/take_screenshot", TTR("Take Screenshot"), KEY_MASK_CMD | KEY_F12), EDITOR_SCREENSHOT);
 | 
						ED_SHORTCUT_AND_COMMAND("editor/take_screenshot", TTR("Take Screenshot"), KEY_MASK_CTRL | KEY_F12);
 | 
				
			||||||
#else
 | 
						ED_SHORTCUT_OVERRIDE("editor/take_screenshot", "macos", KEY_MASK_CMD | KEY_F12);
 | 
				
			||||||
	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/take_screenshot", TTR("Take Screenshot"), KEY_MASK_CTRL | KEY_F12), EDITOR_SCREENSHOT);
 | 
						p->add_shortcut(ED_GET_SHORTCUT("editor/take_screenshot"), EDITOR_SCREENSHOT);
 | 
				
			||||||
#endif
 | 
					
 | 
				
			||||||
	p->set_item_tooltip(p->get_item_count() - 1, TTR("Screenshots are stored in the Editor Data/Settings Folder."));
 | 
						p->set_item_tooltip(p->get_item_count() - 1, TTR("Screenshots are stored in the Editor Data/Settings Folder."));
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					
 | 
				
			||||||
	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_F), SETTINGS_TOGGLE_FULLSCREEN);
 | 
						ED_SHORTCUT_AND_COMMAND("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11);
 | 
				
			||||||
#else
 | 
						ED_SHORTCUT_OVERRIDE("editor/fullscreen_mode", "macos", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_F);
 | 
				
			||||||
	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREEN);
 | 
						p->add_shortcut(ED_GET_SHORTCUT("editor/fullscreen_mode"), SETTINGS_TOGGLE_FULLSCREEN);
 | 
				
			||||||
#endif
 | 
					
 | 
				
			||||||
#if defined(WINDOWS_ENABLED) && defined(WINDOWS_SUBSYSTEM_CONSOLE)
 | 
					#if defined(WINDOWS_ENABLED) && defined(WINDOWS_SUBSYSTEM_CONSOLE)
 | 
				
			||||||
	// The console can only be toggled if the application was built for the console subsystem,
 | 
						// The console can only be toggled if the application was built for the console subsystem,
 | 
				
			||||||
	// not the GUI subsystem.
 | 
						// not the GUI subsystem.
 | 
				
			||||||
| 
						 | 
					@ -6457,7 +6452,7 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	p->add_separator();
 | 
						p->add_separator();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (OS::get_singleton()->get_data_path() == OS::get_singleton()->get_config_path()) {
 | 
						if (OS::get_singleton()->get_data_path() == OS::get_singleton()->get_config_path()) {
 | 
				
			||||||
		// Configuration and data folders are located in the same place (Windows/macOS)
 | 
							// Configuration and data folders are located in the same place (Windows/macos)
 | 
				
			||||||
		p->add_item(TTR("Open Editor Data/Settings Folder"), SETTINGS_EDITOR_DATA_FOLDER);
 | 
							p->add_item(TTR("Open Editor Data/Settings Folder"), SETTINGS_EDITOR_DATA_FOLDER);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// Separate configuration and data folders (Linux)
 | 
							// Separate configuration and data folders (Linux)
 | 
				
			||||||
| 
						 | 
					@ -6479,11 +6474,10 @@ EditorNode::EditorNode() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p = help_menu->get_popup();
 | 
						p = help_menu->get_popup();
 | 
				
			||||||
	p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
 | 
						p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					
 | 
				
			||||||
	p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/editor_help", TTR("Search Help"), KEY_MASK_ALT | KEY_SPACE), HELP_SEARCH);
 | 
						ED_SHORTCUT_AND_COMMAND("editor/editor_help", TTR("Search Help"), KEY_F1);
 | 
				
			||||||
#else
 | 
						ED_SHORTCUT_OVERRIDE("editor/editor_help", "macos", KEY_MASK_ALT | KEY_SPACE);
 | 
				
			||||||
	p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/editor_help", TTR("Search Help"), KEY_F1), HELP_SEARCH);
 | 
						p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")), ED_GET_SHORTCUT("editor/editor_help"), HELP_SEARCH);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	p->add_separator();
 | 
						p->add_separator();
 | 
				
			||||||
	p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/online_docs", TTR("Online Documentation")), HELP_DOCS);
 | 
						p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/online_docs", TTR("Online Documentation")), HELP_DOCS);
 | 
				
			||||||
	p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/q&a", TTR("Questions & Answers")), HELP_QA);
 | 
						p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/q&a", TTR("Questions & Answers")), HELP_QA);
 | 
				
			||||||
| 
						 | 
					@ -6506,11 +6500,10 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	play_button->set_focus_mode(Control::FOCUS_NONE);
 | 
						play_button->set_focus_mode(Control::FOCUS_NONE);
 | 
				
			||||||
	play_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY));
 | 
						play_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY));
 | 
				
			||||||
	play_button->set_tooltip(TTR("Play the project."));
 | 
						play_button->set_tooltip(TTR("Play the project."));
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					
 | 
				
			||||||
	play_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play", TTR("Play"), KEY_MASK_CMD | KEY_B));
 | 
						ED_SHORTCUT_AND_COMMAND("editor/play", TTR("Play"), KEY_F5);
 | 
				
			||||||
#else
 | 
						ED_SHORTCUT_OVERRIDE("editor/play", "macos", KEY_MASK_CMD | KEY_B);
 | 
				
			||||||
	play_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play", TTR("Play"), KEY_F5));
 | 
						play_button->set_shortcut(ED_GET_SHORTCUT("editor/play"));
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pause_button = memnew(Button);
 | 
						pause_button = memnew(Button);
 | 
				
			||||||
	pause_button->set_flat(true);
 | 
						pause_button->set_flat(true);
 | 
				
			||||||
| 
						 | 
					@ -6520,11 +6513,10 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	pause_button->set_tooltip(TTR("Pause the scene execution for debugging."));
 | 
						pause_button->set_tooltip(TTR("Pause the scene execution for debugging."));
 | 
				
			||||||
	pause_button->set_disabled(true);
 | 
						pause_button->set_disabled(true);
 | 
				
			||||||
	play_hb->add_child(pause_button);
 | 
						play_hb->add_child(pause_button);
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					
 | 
				
			||||||
	pause_button->set_shortcut(ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_Y));
 | 
						ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), KEY_F7);
 | 
				
			||||||
#else
 | 
						ED_SHORTCUT_OVERRIDE("editor/pause_scene", "macos", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_Y);
 | 
				
			||||||
	pause_button->set_shortcut(ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), KEY_F7));
 | 
						pause_button->set_shortcut(ED_GET_SHORTCUT("editor/pause_scene"));
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	stop_button = memnew(Button);
 | 
						stop_button = memnew(Button);
 | 
				
			||||||
	stop_button->set_flat(true);
 | 
						stop_button->set_flat(true);
 | 
				
			||||||
| 
						 | 
					@ -6534,11 +6526,10 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	stop_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_STOP));
 | 
						stop_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_STOP));
 | 
				
			||||||
	stop_button->set_tooltip(TTR("Stop the scene."));
 | 
						stop_button->set_tooltip(TTR("Stop the scene."));
 | 
				
			||||||
	stop_button->set_disabled(true);
 | 
						stop_button->set_disabled(true);
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					
 | 
				
			||||||
	stop_button->set_shortcut(ED_SHORTCUT("editor/stop", TTR("Stop"), KEY_MASK_CMD | KEY_PERIOD));
 | 
						ED_SHORTCUT("editor/stop", TTR("Stop"), KEY_F8);
 | 
				
			||||||
#else
 | 
						ED_SHORTCUT_OVERRIDE("editor/stop", "macos", KEY_MASK_CMD | KEY_PERIOD);
 | 
				
			||||||
	stop_button->set_shortcut(ED_SHORTCUT("editor/stop", TTR("Stop"), KEY_F8));
 | 
						stop_button->set_shortcut(ED_GET_SHORTCUT("editor/stop"));
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	run_native = memnew(EditorRunNative);
 | 
						run_native = memnew(EditorRunNative);
 | 
				
			||||||
	play_hb->add_child(run_native);
 | 
						play_hb->add_child(run_native);
 | 
				
			||||||
| 
						 | 
					@ -6552,11 +6543,10 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons")));
 | 
						play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons")));
 | 
				
			||||||
	play_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_SCENE));
 | 
						play_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_SCENE));
 | 
				
			||||||
	play_scene_button->set_tooltip(TTR("Play the edited scene."));
 | 
						play_scene_button->set_tooltip(TTR("Play the edited scene."));
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					
 | 
				
			||||||
	play_scene_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play_scene", TTR("Play Scene"), KEY_MASK_CMD | KEY_R));
 | 
						ED_SHORTCUT_AND_COMMAND("editor/play_scene", TTR("Play Scene"), KEY_F6);
 | 
				
			||||||
#else
 | 
						ED_SHORTCUT_OVERRIDE("editor/play_scene", "macos", KEY_MASK_CMD | KEY_R);
 | 
				
			||||||
	play_scene_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play_scene", TTR("Play Scene"), KEY_F6));
 | 
						play_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/play_scene"));
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	play_custom_scene_button = memnew(Button);
 | 
						play_custom_scene_button = memnew(Button);
 | 
				
			||||||
	play_custom_scene_button->set_flat(true);
 | 
						play_custom_scene_button->set_flat(true);
 | 
				
			||||||
| 
						 | 
					@ -6566,11 +6556,10 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons")));
 | 
						play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons")));
 | 
				
			||||||
	play_custom_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_CUSTOM_SCENE));
 | 
						play_custom_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_CUSTOM_SCENE));
 | 
				
			||||||
	play_custom_scene_button->set_tooltip(TTR("Play custom scene"));
 | 
						play_custom_scene_button->set_tooltip(TTR("Play custom scene"));
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					
 | 
				
			||||||
	play_custom_scene_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R));
 | 
						ED_SHORTCUT_AND_COMMAND("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5);
 | 
				
			||||||
#else
 | 
						ED_SHORTCUT_OVERRIDE("editor/play_custom_scene", "macos", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R);
 | 
				
			||||||
	play_custom_scene_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5));
 | 
						play_custom_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/play_custom_scene"));
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	HBoxContainer *right_menu_hb = memnew(HBoxContainer);
 | 
						HBoxContainer *right_menu_hb = memnew(HBoxContainer);
 | 
				
			||||||
	menu_hb->add_child(right_menu_hb);
 | 
						menu_hb->add_child(right_menu_hb);
 | 
				
			||||||
| 
						 | 
					@ -7106,20 +7095,19 @@ EditorNode::EditorNode() {
 | 
				
			||||||
	ResourceSaver::set_save_callback(_resource_saved);
 | 
						ResourceSaver::set_save_callback(_resource_saved);
 | 
				
			||||||
	ResourceLoader::set_load_callback(_resource_loaded);
 | 
						ResourceLoader::set_load_callback(_resource_loaded);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("editor/editor_2d", TTR("Open 2D Editor"), KEY_MASK_ALT | KEY_1);
 | 
					 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_ALT | KEY_2);
 | 
					 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("editor/editor_script", TTR("Open Script Editor"), KEY_MASK_ALT | KEY_3);
 | 
					 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("editor/editor_assetlib", TTR("Open Asset Library"), KEY_MASK_ALT | KEY_4);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
	// Use the Ctrl modifier so F2 can be used to rename nodes in the scene tree dock.
 | 
						// Use the Ctrl modifier so F2 can be used to rename nodes in the scene tree dock.
 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("editor/editor_2d", TTR("Open 2D Editor"), KEY_MASK_CTRL | KEY_F1);
 | 
						ED_SHORTCUT_AND_COMMAND("editor/editor_2d", TTR("Open 2D Editor"), KEY_MASK_CTRL | KEY_F1);
 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_CTRL | KEY_F2);
 | 
						ED_SHORTCUT_AND_COMMAND("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_CTRL | KEY_F2);
 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("editor/editor_script", TTR("Open Script Editor"), KEY_MASK_CTRL | KEY_F3);
 | 
						ED_SHORTCUT_AND_COMMAND("editor/editor_script", TTR("Open Script Editor"), KEY_MASK_CTRL | KEY_F3);
 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("editor/editor_assetlib", TTR("Open Asset Library"), KEY_MASK_CTRL | KEY_F4);
 | 
						ED_SHORTCUT_AND_COMMAND("editor/editor_assetlib", TTR("Open Asset Library"), KEY_MASK_CTRL | KEY_F4);
 | 
				
			||||||
#endif
 | 
					
 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("editor/editor_next", TTR("Next Editor Tab"));
 | 
						ED_SHORTCUT_OVERRIDE("editor/editor_2d", "macos", KEY_MASK_ALT | KEY_1);
 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("editor/editor_prev", TTR("Previous Editor Tab"));
 | 
						ED_SHORTCUT_OVERRIDE("editor/editor_3d", "macos", KEY_MASK_ALT | KEY_2);
 | 
				
			||||||
 | 
						ED_SHORTCUT_OVERRIDE("editor/editor_script", "macos", KEY_MASK_ALT | KEY_3);
 | 
				
			||||||
 | 
						ED_SHORTCUT_OVERRIDE("editor/editor_assetlib", "macos", KEY_MASK_ALT | KEY_4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ED_SHORTCUT_AND_COMMAND("editor/editor_next", TTR("Open the next Editor"));
 | 
				
			||||||
 | 
						ED_SHORTCUT_AND_COMMAND("editor/editor_prev", TTR("Open the previous Editor"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	screenshot_timer = memnew(Timer);
 | 
						screenshot_timer = memnew(Timer);
 | 
				
			||||||
	screenshot_timer->set_one_shot(true);
 | 
						screenshot_timer->set_one_shot(true);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1444,6 +1444,23 @@ Ref<Shortcut> ED_GET_SHORTCUT(const String &p_path) {
 | 
				
			||||||
	return sc;
 | 
						return sc;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_keycode) {
 | 
				
			||||||
 | 
						Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
 | 
				
			||||||
 | 
						ERR_FAIL_COND_MSG(!sc.is_valid(), "Used ED_SHORTCUT_OVERRIDE with invalid shortcut: " + p_path + ".");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Only add the override if the OS supports the provided feature.
 | 
				
			||||||
 | 
						if (OS::get_singleton()->has_feature(p_feature)) {
 | 
				
			||||||
 | 
							Ref<InputEventKey> ie;
 | 
				
			||||||
 | 
							if (p_keycode) {
 | 
				
			||||||
 | 
								ie = InputEventKey::create_reference(p_keycode);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Directly override the existing shortcut.
 | 
				
			||||||
 | 
							sc->set_event(ie);
 | 
				
			||||||
 | 
							sc->set_meta("original", ie);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, Key p_keycode) {
 | 
					Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, Key p_keycode) {
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					#ifdef OSX_ENABLED
 | 
				
			||||||
	// Use Cmd+Backspace as a general replacement for Delete shortcuts on macOS
 | 
						// Use Cmd+Backspace as a general replacement for Delete shortcuts on macOS
 | 
				
			||||||
| 
						 | 
					@ -1454,14 +1471,7 @@ Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, Key p_keyc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Ref<InputEventKey> ie;
 | 
						Ref<InputEventKey> ie;
 | 
				
			||||||
	if (p_keycode) {
 | 
						if (p_keycode) {
 | 
				
			||||||
		ie.instantiate();
 | 
							ie = InputEventKey::create_reference(p_keycode);
 | 
				
			||||||
 | 
					 | 
				
			||||||
		ie->set_unicode(p_keycode & KEY_CODE_MASK);
 | 
					 | 
				
			||||||
		ie->set_keycode(p_keycode & KEY_CODE_MASK);
 | 
					 | 
				
			||||||
		ie->set_shift_pressed(bool(p_keycode & KEY_MASK_SHIFT));
 | 
					 | 
				
			||||||
		ie->set_alt_pressed(bool(p_keycode & KEY_MASK_ALT));
 | 
					 | 
				
			||||||
		ie->set_ctrl_pressed(bool(p_keycode & KEY_MASK_CTRL));
 | 
					 | 
				
			||||||
		ie->set_meta_pressed(bool(p_keycode & KEY_MASK_META));
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!EditorSettings::get_singleton()) {
 | 
						if (!EditorSettings::get_singleton()) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -201,6 +201,7 @@ Variant _EDITOR_GET(const String &p_setting);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ED_IS_SHORTCUT(p_name, p_ev) (EditorSettings::get_singleton()->is_shortcut(p_name, p_ev))
 | 
					#define ED_IS_SHORTCUT(p_name, p_ev) (EditorSettings::get_singleton()->is_shortcut(p_name, p_ev))
 | 
				
			||||||
Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, Key p_keycode = KEY_NONE);
 | 
					Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, Key p_keycode = KEY_NONE);
 | 
				
			||||||
 | 
					void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_keycode = KEY_NONE);
 | 
				
			||||||
Ref<Shortcut> ED_GET_SHORTCUT(const String &p_path);
 | 
					Ref<Shortcut> ED_GET_SHORTCUT(const String &p_path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // EDITOR_SETTINGS_H
 | 
					#endif // EDITOR_SETTINGS_H
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1961,11 +1961,8 @@ void ScriptTextEditor::register_editor() {
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/toggle_fold_line", TTR("Fold/Unfold Line"), KEY_MASK_ALT | KEY_F);
 | 
						ED_SHORTCUT("script_text_editor/toggle_fold_line", TTR("Fold/Unfold Line"), KEY_MASK_ALT | KEY_F);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/fold_all_lines", TTR("Fold All Lines"), KEY_NONE);
 | 
						ED_SHORTCUT("script_text_editor/fold_all_lines", TTR("Fold All Lines"), KEY_NONE);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/unfold_all_lines", TTR("Unfold All Lines"), KEY_NONE);
 | 
						ED_SHORTCUT("script_text_editor/unfold_all_lines", TTR("Unfold All Lines"), KEY_NONE);
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_C);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_D);
 | 
						ED_SHORTCUT("script_text_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_D);
 | 
				
			||||||
#endif
 | 
						ED_SHORTCUT_OVERRIDE("script_text_editor/duplicate_selection", "macos", KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_C);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/evaluate_selection", TTR("Evaluate Selection"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_E);
 | 
						ED_SHORTCUT("script_text_editor/evaluate_selection", TTR("Evaluate Selection"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_E);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
 | 
						ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent to Spaces"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Y);
 | 
						ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent to Spaces"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Y);
 | 
				
			||||||
| 
						 | 
					@ -1973,42 +1970,35 @@ void ScriptTextEditor::register_editor() {
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/auto_indent", TTR("Auto Indent"), KEY_MASK_CMD | KEY_I);
 | 
						ED_SHORTCUT("script_text_editor/auto_indent", TTR("Auto Indent"), KEY_MASK_CMD | KEY_I);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("script_text_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F);
 | 
						ED_SHORTCUT_AND_COMMAND("script_text_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F);
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/find_next", TTR("Find Next"), KEY_MASK_CMD | KEY_G);
 | 
					 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/find_previous", TTR("Find Previous"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G);
 | 
					 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("script_text_editor/replace", TTR("Replace..."), KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/find_next", TTR("Find Next"), KEY_F3);
 | 
						ED_SHORTCUT("script_text_editor/find_next", TTR("Find Next"), KEY_F3);
 | 
				
			||||||
 | 
						ED_SHORTCUT_OVERRIDE("script_text_editor/find_next", "macos", KEY_MASK_CMD | KEY_G);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT | KEY_F3);
 | 
						ED_SHORTCUT("script_text_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT | KEY_F3);
 | 
				
			||||||
 | 
						ED_SHORTCUT_OVERRIDE("script_text_editor/find_previous", "macos", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ED_SHORTCUT_AND_COMMAND("script_text_editor/replace", TTR("Replace..."), KEY_MASK_CMD | KEY_R);
 | 
						ED_SHORTCUT_AND_COMMAND("script_text_editor/replace", TTR("Replace..."), KEY_MASK_CMD | KEY_R);
 | 
				
			||||||
#endif
 | 
						ED_SHORTCUT_OVERRIDE("script_text_editor/replace", "macos", KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/find_in_files", TTR("Find in Files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F);
 | 
						ED_SHORTCUT("script_text_editor/find_in_files", TTR("Find in Files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/replace_in_files", TTR("Replace in Files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R);
 | 
						ED_SHORTCUT("script_text_editor/replace_in_files", TTR("Replace in Files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_ALT | KEY_MASK_SHIFT | KEY_SPACE);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_ALT | KEY_F1);
 | 
						ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_ALT | KEY_F1);
 | 
				
			||||||
#endif
 | 
						ED_SHORTCUT_OVERRIDE("script_text_editor/contextual_help", "macos", KEY_MASK_ALT | KEY_MASK_SHIFT | KEY_SPACE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/toggle_bookmark", TTR("Toggle Bookmark"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_B);
 | 
						ED_SHORTCUT("script_text_editor/toggle_bookmark", TTR("Toggle Bookmark"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_B);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/goto_next_bookmark", TTR("Go to Next Bookmark"), KEY_MASK_CMD | KEY_B);
 | 
						ED_SHORTCUT("script_text_editor/goto_next_bookmark", TTR("Go to Next Bookmark"), KEY_MASK_CMD | KEY_B);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/goto_previous_bookmark", TTR("Go to Previous Bookmark"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B);
 | 
						ED_SHORTCUT("script_text_editor/goto_previous_bookmark", TTR("Go to Previous Bookmark"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/remove_all_bookmarks", TTR("Remove All Bookmarks"), KEY_NONE);
 | 
						ED_SHORTCUT("script_text_editor/remove_all_bookmarks", TTR("Remove All Bookmarks"), KEY_NONE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/goto_function", TTR("Go to Function..."), KEY_MASK_CTRL | KEY_MASK_CMD | KEY_J);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/goto_function", TTR("Go to Function..."), KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
 | 
						ED_SHORTCUT("script_text_editor/goto_function", TTR("Go to Function..."), KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
 | 
				
			||||||
#endif
 | 
						ED_SHORTCUT_OVERRIDE("script_text_editor/goto_function", "macos", KEY_MASK_CTRL | KEY_MASK_CMD | KEY_J);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/goto_line", TTR("Go to Line..."), KEY_MASK_CMD | KEY_L);
 | 
						ED_SHORTCUT("script_text_editor/goto_line", TTR("Go to Line..."), KEY_MASK_CMD | KEY_L);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OSX_ENABLED
 | 
					 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9);
 | 
						ED_SHORTCUT("script_text_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9);
 | 
				
			||||||
#endif
 | 
						ED_SHORTCUT_OVERRIDE("script_text_editor/toggle_breakpoint", "macos", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/remove_all_breakpoints", TTR("Remove All Breakpoints"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F9);
 | 
						ED_SHORTCUT("script_text_editor/remove_all_breakpoints", TTR("Remove All Breakpoints"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F9);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/goto_next_breakpoint", TTR("Go to Next Breakpoint"), KEY_MASK_CMD | KEY_PERIOD);
 | 
						ED_SHORTCUT("script_text_editor/goto_next_breakpoint", TTR("Go to Next Breakpoint"), KEY_MASK_CMD | KEY_PERIOD);
 | 
				
			||||||
	ED_SHORTCUT("script_text_editor/goto_previous_breakpoint", TTR("Go to Previous Breakpoint"), KEY_MASK_CMD | KEY_COMMA);
 | 
						ED_SHORTCUT("script_text_editor/goto_previous_breakpoint", TTR("Go to Previous Breakpoint"), KEY_MASK_CMD | KEY_COMMA);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue