diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2024-02-08 00:08:07 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2024-03-05 15:53:15 +0100 |
commit | 8221e7546be7e260f59b716faf0094f43c0ade35 (patch) | |
tree | 699b2b7dd3e7639620de0850abaa40064e086445 /editor/editor_plugin.cpp | |
parent | 7d80635fce1d0c44fa69d4d8cf3da40fa998f9c7 (diff) | |
download | redot-engine-8221e7546be7e260f59b716faf0094f43c0ade35.tar.gz |
Add editor shortcuts to toggle bottom panel visibility
Default shortcuts use the first or second letter of each word.
This also adds a new shortcut to toggle the last opened bottom panel.
On editor startup, this defaults to the first panel in the list
(which is the Output panel).
Diffstat (limited to 'editor/editor_plugin.cpp')
-rw-r--r-- | editor/editor_plugin.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 7b5b084f09..67fe0c2e28 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -29,6 +29,7 @@ /**************************************************************************/ #include "editor_plugin.h" +#include "editor_plugin.compat.inc" #include "editor/debugger/editor_debugger_node.h" #include "editor/editor_dock_manager.h" @@ -79,14 +80,14 @@ void EditorPlugin::remove_autoload_singleton(const String &p_name) { EditorNode::get_singleton()->get_project_settings()->get_autoload_settings()->autoload_remove(p_name); } -Button *EditorPlugin::add_control_to_bottom_panel(Control *p_control, const String &p_title) { +Button *EditorPlugin::add_control_to_bottom_panel(Control *p_control, const String &p_title, const Ref<Shortcut> &p_shortcut) { ERR_FAIL_NULL_V(p_control, nullptr); - return EditorNode::get_bottom_panel()->add_item(p_title, p_control); + return EditorNode::get_bottom_panel()->add_item(p_title, p_control, p_shortcut); } -void EditorPlugin::add_control_to_dock(DockSlot p_slot, Control *p_control) { +void EditorPlugin::add_control_to_dock(DockSlot p_slot, Control *p_control, const Ref<Shortcut> &p_shortcut) { ERR_FAIL_NULL(p_control); - EditorDockManager::get_singleton()->add_control_to_dock(EditorDockManager::DockSlot(p_slot), p_control); + EditorDockManager::get_singleton()->add_control_to_dock(EditorDockManager::DockSlot(p_slot), p_control, String(), p_shortcut); } void EditorPlugin::remove_control_from_docks(Control *p_control) { @@ -559,8 +560,8 @@ void EditorPlugin::_notification(int p_what) { void EditorPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("add_control_to_container", "container", "control"), &EditorPlugin::add_control_to_container); - ClassDB::bind_method(D_METHOD("add_control_to_bottom_panel", "control", "title"), &EditorPlugin::add_control_to_bottom_panel); - ClassDB::bind_method(D_METHOD("add_control_to_dock", "slot", "control"), &EditorPlugin::add_control_to_dock); + ClassDB::bind_method(D_METHOD("add_control_to_bottom_panel", "control", "title", "shortcut"), &EditorPlugin::add_control_to_bottom_panel, DEFVAL(Ref<Shortcut>())); + ClassDB::bind_method(D_METHOD("add_control_to_dock", "slot", "control", "shortcut"), &EditorPlugin::add_control_to_dock, DEFVAL(Ref<Shortcut>())); ClassDB::bind_method(D_METHOD("remove_control_from_docks", "control"), &EditorPlugin::remove_control_from_docks); ClassDB::bind_method(D_METHOD("remove_control_from_bottom_panel", "control"), &EditorPlugin::remove_control_from_bottom_panel); ClassDB::bind_method(D_METHOD("remove_control_from_container", "container", "control"), &EditorPlugin::remove_control_from_container); |