mirror of
https://github.com/godotengine/godot.git
synced 2024-11-28 23:22:38 +00:00
Merge pull request #88081 from Calinou/editor-add-bottom-panel-shortcuts
Add editor shortcuts to toggle bottom panel visibility
This commit is contained in:
commit
4bb219321e
@ -409,9 +409,10 @@
|
||||
<return type="Button" />
|
||||
<param index="0" name="control" type="Control" />
|
||||
<param index="1" name="title" type="String" />
|
||||
<param index="2" name="shortcut" type="Shortcut" default="null" />
|
||||
<description>
|
||||
Adds a control to the bottom panel (together with [b]Output[/b], [b]Debug[/b], [b]Animation[/b], etc.). Returns the button added to the tab bar. It's up to you to manage the button's visibility as needed.
|
||||
When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_bottom_panel] and free it with [method Node.queue_free].
|
||||
Adds a control to the bottom panel (together with Output, Debug, Animation, etc). Returns a reference to the button added. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_bottom_panel] and free it with [method Node.queue_free].
|
||||
Optionally, you can specify a shortcut parameter. When pressed, this shortcut will toggle the bottom panel's visibility. See the default editor bottom panel shortcuts in the Editor Settings for inspiration. Per convention, they all use [kbd]Alt[/kbd] modifier.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_control_to_container">
|
||||
@ -428,10 +429,12 @@
|
||||
<return type="void" />
|
||||
<param index="0" name="slot" type="int" enum="EditorPlugin.DockSlot" />
|
||||
<param index="1" name="control" type="Control" />
|
||||
<param index="2" name="shortcut" type="Shortcut" default="null" />
|
||||
<description>
|
||||
Adds the control to a specific dock slot (see [enum DockSlot] for options).
|
||||
If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
|
||||
When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_docks] and free it with [method Node.queue_free].
|
||||
Optionally, you can specify a shortcut parameter. When pressed, this shortcut will toggle the dock's visibility once it's moved to the bottom panel (this shortcut does not affect the dock otherwise). See the default editor bottom panel shortcuts in the Editor Settings for inspiration. Per convention, they all use [kbd]Alt[/kbd] modifier.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_custom_type">
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "core/input/input.h"
|
||||
#include "core/io/resource_saver.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_string_names.h"
|
||||
@ -1041,7 +1042,7 @@ void EditorAudioBuses::_rebuild_buses() {
|
||||
|
||||
EditorAudioBuses *EditorAudioBuses::register_editor() {
|
||||
EditorAudioBuses *audio_buses = memnew(EditorAudioBuses);
|
||||
EditorNode::get_bottom_panel()->add_item(TTR("Audio"), audio_buses);
|
||||
EditorNode::get_bottom_panel()->add_item(TTR("Audio"), audio_buses, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_audio_bottom_panel", TTR("Toggle Audio Bottom Panel"), KeyModifierMask::ALT | Key::A));
|
||||
return audio_buses;
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "scene/gui/tab_container.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_string_names.h"
|
||||
@ -48,6 +49,8 @@
|
||||
|
||||
EditorDockManager *EditorDockManager::singleton = nullptr;
|
||||
|
||||
static const char *META_TOGGLE_SHORTCUT = "_toggle_shortcut";
|
||||
|
||||
void DockSplitContainer::_update_visibility() {
|
||||
if (is_updating) {
|
||||
return;
|
||||
@ -392,7 +395,10 @@ void EditorDockManager::_dock_move_selected_to_bottom() {
|
||||
dock->call("_set_dock_horizontal", true);
|
||||
|
||||
bottom_docks.push_back(dock);
|
||||
EditorNode::get_bottom_panel()->add_item(dock->get_name(), dock, true);
|
||||
|
||||
// Force docks moved to the bottom to appear first in the list, and give them their associated shortcut to toggle their bottom panel.
|
||||
EditorNode::get_bottom_panel()->add_item(dock->get_name(), dock, dock->get_meta(META_TOGGLE_SHORTCUT), true);
|
||||
|
||||
dock_select_popup->hide();
|
||||
update_dock_slots_visibility(true);
|
||||
_edit_current();
|
||||
@ -663,7 +669,8 @@ void EditorDockManager::load_docks_from_config(Ref<ConfigFile> p_layout, const S
|
||||
node->call("_set_dock_horizontal", true);
|
||||
|
||||
bottom_docks.push_back(node);
|
||||
EditorNode::get_bottom_panel()->add_item(node->get_name(), node, true);
|
||||
// Force docks moved to the bottom to appear first in the list, and give them their associated shortcut to toggle their bottom panel.
|
||||
EditorNode::get_bottom_panel()->add_item(node->get_name(), node, node->get_meta(META_TOGGLE_SHORTCUT), true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -730,8 +737,9 @@ void EditorDockManager::close_all_floating_docks() {
|
||||
}
|
||||
}
|
||||
|
||||
void EditorDockManager::add_control_to_dock(DockSlot p_slot, Control *p_control, const String &p_name) {
|
||||
void EditorDockManager::add_control_to_dock(DockSlot p_slot, Control *p_control, const String &p_name, const Ref<Shortcut> &p_shortcut) {
|
||||
ERR_FAIL_INDEX(p_slot, DOCK_SLOT_MAX);
|
||||
p_control->set_meta(META_TOGGLE_SHORTCUT, p_shortcut);
|
||||
dock_slot[p_slot]->add_child(p_control);
|
||||
if (!p_name.is_empty()) {
|
||||
dock_slot[p_slot]->set_tab_title(dock_slot[p_slot]->get_tab_idx_from_control(p_control), p_name);
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
void set_docks_visible(bool p_show);
|
||||
bool are_docks_visible() const;
|
||||
|
||||
void add_control_to_dock(DockSlot p_slot, Control *p_control, const String &p_name = "");
|
||||
void add_control_to_dock(DockSlot p_slot, Control *p_control, const String &p_name = "", const Ref<Shortcut> &p_shortcut = nullptr);
|
||||
void remove_control_from_dock(Control *p_control);
|
||||
|
||||
EditorDockManager();
|
||||
|
@ -338,6 +338,8 @@ void EditorNode::shortcut_input(const Ref<InputEvent> &p_event) {
|
||||
_editor_select_prev();
|
||||
} else if (ED_IS_SHORTCUT("editor/command_palette", p_event)) {
|
||||
_open_command_palette();
|
||||
} else if (ED_IS_SHORTCUT("editor/toggle_last_opened_bottom_panel", p_event)) {
|
||||
bottom_panel->toggle_last_opened_bottom_panel();
|
||||
} else {
|
||||
}
|
||||
|
||||
@ -6582,6 +6584,7 @@ EditorNode::EditorNode() {
|
||||
distraction_free->set_theme_type_variation("FlatMenuButton");
|
||||
ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KeyModifierMask::CTRL | KeyModifierMask::SHIFT | Key::F11);
|
||||
ED_SHORTCUT_OVERRIDE("editor/distraction_free_mode", "macos", KeyModifierMask::META | KeyModifierMask::CTRL | Key::D);
|
||||
ED_SHORTCUT_AND_COMMAND("editor/toggle_last_opened_bottom_panel", TTR("Toggle Last Opened Bottom Panel"), KeyModifierMask::CMD_OR_CTRL | Key::J);
|
||||
distraction_free->set_shortcut(ED_GET_SHORTCUT("editor/distraction_free_mode"));
|
||||
distraction_free->set_tooltip_text(TTR("Toggle distraction-free mode."));
|
||||
distraction_free->set_toggle_mode(true);
|
||||
@ -6993,7 +6996,7 @@ EditorNode::EditorNode() {
|
||||
editor_dock_manager->add_control_to_dock(EditorDockManager::DOCK_SLOT_LEFT_UR, ImportDock::get_singleton(), TTR("Import"));
|
||||
|
||||
// FileSystem: Bottom left.
|
||||
editor_dock_manager->add_control_to_dock(EditorDockManager::DOCK_SLOT_LEFT_BR, FileSystemDock::get_singleton(), TTR("FileSystem"));
|
||||
editor_dock_manager->add_control_to_dock(EditorDockManager::DOCK_SLOT_LEFT_BR, FileSystemDock::get_singleton(), TTR("FileSystem"), ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_filesystem_bottom_panel", TTR("Toggle FileSystem Bottom Panel"), KeyModifierMask::ALT | Key::F));
|
||||
|
||||
// Inspector: Full height right.
|
||||
editor_dock_manager->add_control_to_dock(EditorDockManager::DOCK_SLOT_RIGHT_UL, InspectorDock::get_singleton(), TTR("Inspector"));
|
||||
@ -7035,7 +7038,7 @@ EditorNode::EditorNode() {
|
||||
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
|
||||
|
||||
log = memnew(EditorLog);
|
||||
Button *output_button = bottom_panel->add_item(TTR("Output"), log);
|
||||
Button *output_button = bottom_panel->add_item(TTR("Output"), log, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_output_bottom_panel", TTR("Toggle Output Bottom Panel"), KeyModifierMask::ALT | Key::O));
|
||||
log->set_tool_button(output_button);
|
||||
|
||||
center_split->connect("resized", callable_mp(this, &EditorNode::_vp_resized));
|
||||
|
46
editor/editor_plugin.compat.inc
Normal file
46
editor/editor_plugin.compat.inc
Normal file
@ -0,0 +1,46 @@
|
||||
/**************************************************************************/
|
||||
/* editor_plugin.compat.inc */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
|
||||
Button *EditorPlugin::_add_control_to_bottom_panel_compat_88081(Control *p_control, const String &p_title) {
|
||||
return add_control_to_bottom_panel(p_control, p_title, nullptr);
|
||||
}
|
||||
|
||||
void EditorPlugin::_add_control_to_dock_compat_88081(DockSlot p_slot, Control *p_control) {
|
||||
return add_control_to_dock(p_slot, p_control, nullptr);
|
||||
}
|
||||
|
||||
void EditorPlugin::_bind_compatibility_methods() {
|
||||
ClassDB::bind_compatibility_method(D_METHOD("add_control_to_bottom_panel", "control", "title"), &EditorPlugin::_add_control_to_bottom_panel_compat_88081);
|
||||
ClassDB::bind_compatibility_method(D_METHOD("add_control_to_dock", "slot", "control"), &EditorPlugin::_add_control_to_dock_compat_88081);
|
||||
}
|
||||
|
||||
#endif
|
@ -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);
|
||||
|
@ -67,6 +67,40 @@ class EditorPlugin : public Node {
|
||||
void _editor_project_settings_changed();
|
||||
#endif
|
||||
|
||||
public:
|
||||
enum CustomControlContainer {
|
||||
CONTAINER_TOOLBAR,
|
||||
CONTAINER_SPATIAL_EDITOR_MENU,
|
||||
CONTAINER_SPATIAL_EDITOR_SIDE_LEFT,
|
||||
CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT,
|
||||
CONTAINER_SPATIAL_EDITOR_BOTTOM,
|
||||
CONTAINER_CANVAS_EDITOR_MENU,
|
||||
CONTAINER_CANVAS_EDITOR_SIDE_LEFT,
|
||||
CONTAINER_CANVAS_EDITOR_SIDE_RIGHT,
|
||||
CONTAINER_CANVAS_EDITOR_BOTTOM,
|
||||
CONTAINER_INSPECTOR_BOTTOM,
|
||||
CONTAINER_PROJECT_SETTING_TAB_LEFT,
|
||||
CONTAINER_PROJECT_SETTING_TAB_RIGHT,
|
||||
};
|
||||
|
||||
enum DockSlot {
|
||||
DOCK_SLOT_LEFT_UL,
|
||||
DOCK_SLOT_LEFT_BL,
|
||||
DOCK_SLOT_LEFT_UR,
|
||||
DOCK_SLOT_LEFT_BR,
|
||||
DOCK_SLOT_RIGHT_UL,
|
||||
DOCK_SLOT_RIGHT_BL,
|
||||
DOCK_SLOT_RIGHT_UR,
|
||||
DOCK_SLOT_RIGHT_BR,
|
||||
DOCK_SLOT_MAX
|
||||
};
|
||||
|
||||
enum AfterGUIInput {
|
||||
AFTER_GUI_INPUT_PASS,
|
||||
AFTER_GUI_INPUT_STOP,
|
||||
AFTER_GUI_INPUT_CUSTOM,
|
||||
};
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
@ -101,46 +135,19 @@ protected:
|
||||
GDVIRTUAL0(_enable_plugin)
|
||||
GDVIRTUAL0(_disable_plugin)
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
Button *_add_control_to_bottom_panel_compat_88081(Control *p_control, const String &p_title);
|
||||
void _add_control_to_dock_compat_88081(DockSlot p_slot, Control *p_control);
|
||||
static void _bind_compatibility_methods();
|
||||
#endif
|
||||
|
||||
public:
|
||||
enum CustomControlContainer {
|
||||
CONTAINER_TOOLBAR,
|
||||
CONTAINER_SPATIAL_EDITOR_MENU,
|
||||
CONTAINER_SPATIAL_EDITOR_SIDE_LEFT,
|
||||
CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT,
|
||||
CONTAINER_SPATIAL_EDITOR_BOTTOM,
|
||||
CONTAINER_CANVAS_EDITOR_MENU,
|
||||
CONTAINER_CANVAS_EDITOR_SIDE_LEFT,
|
||||
CONTAINER_CANVAS_EDITOR_SIDE_RIGHT,
|
||||
CONTAINER_CANVAS_EDITOR_BOTTOM,
|
||||
CONTAINER_INSPECTOR_BOTTOM,
|
||||
CONTAINER_PROJECT_SETTING_TAB_LEFT,
|
||||
CONTAINER_PROJECT_SETTING_TAB_RIGHT,
|
||||
};
|
||||
|
||||
enum DockSlot {
|
||||
DOCK_SLOT_LEFT_UL,
|
||||
DOCK_SLOT_LEFT_BL,
|
||||
DOCK_SLOT_LEFT_UR,
|
||||
DOCK_SLOT_LEFT_BR,
|
||||
DOCK_SLOT_RIGHT_UL,
|
||||
DOCK_SLOT_RIGHT_BL,
|
||||
DOCK_SLOT_RIGHT_UR,
|
||||
DOCK_SLOT_RIGHT_BR,
|
||||
DOCK_SLOT_MAX
|
||||
};
|
||||
|
||||
enum AfterGUIInput {
|
||||
AFTER_GUI_INPUT_PASS,
|
||||
AFTER_GUI_INPUT_STOP,
|
||||
AFTER_GUI_INPUT_CUSTOM
|
||||
};
|
||||
|
||||
//TODO: send a resource for editing to the editor node?
|
||||
|
||||
void add_control_to_container(CustomControlContainer p_location, Control *p_control);
|
||||
void remove_control_from_container(CustomControlContainer p_location, Control *p_control);
|
||||
Button *add_control_to_bottom_panel(Control *p_control, const String &p_title);
|
||||
void add_control_to_dock(DockSlot p_slot, Control *p_control);
|
||||
Button *add_control_to_bottom_panel(Control *p_control, const String &p_title, const Ref<Shortcut> &p_shortcut = nullptr);
|
||||
void add_control_to_dock(DockSlot p_slot, Control *p_control, const Ref<Shortcut> &p_shortcut = nullptr);
|
||||
void remove_control_from_docks(Control *p_control);
|
||||
void remove_control_from_bottom_panel(Control *p_control);
|
||||
|
||||
|
@ -105,6 +105,8 @@ void EditorBottomPanel::_switch_to_item(bool p_visible, int p_idx) {
|
||||
EditorNode::get_top_split()->show();
|
||||
}
|
||||
}
|
||||
|
||||
last_opened_control = items[p_idx].control;
|
||||
}
|
||||
|
||||
void EditorBottomPanel::_expand_button_toggled(bool p_pressed) {
|
||||
@ -156,12 +158,13 @@ void EditorBottomPanel::load_layout_from_config(Ref<ConfigFile> p_config_file, c
|
||||
}
|
||||
}
|
||||
|
||||
Button *EditorBottomPanel::add_item(String p_text, Control *p_item, bool p_at_front) {
|
||||
Button *EditorBottomPanel::add_item(String p_text, Control *p_item, const Ref<Shortcut> &p_shortcut, bool p_at_front) {
|
||||
Button *tb = memnew(Button);
|
||||
tb->set_theme_type_variation("FlatMenuButton");
|
||||
tb->connect("toggled", callable_mp(this, &EditorBottomPanel::_switch_by_control).bind(p_item));
|
||||
tb->set_drag_forwarding(Callable(), callable_mp(this, &EditorBottomPanel::_button_drag_hover).bind(tb, p_item), Callable());
|
||||
tb->set_text(p_text);
|
||||
tb->set_shortcut(p_shortcut);
|
||||
tb->set_toggle_mode(true);
|
||||
tb->set_focus_mode(Control::FOCUS_NONE);
|
||||
item_vbox->add_child(p_item);
|
||||
@ -221,6 +224,17 @@ void EditorBottomPanel::hide_bottom_panel() {
|
||||
}
|
||||
}
|
||||
|
||||
void EditorBottomPanel::toggle_last_opened_bottom_panel() {
|
||||
// Select by control instead of index, so that the last bottom panel is opened correctly
|
||||
// if it's been reordered since.
|
||||
if (last_opened_control) {
|
||||
_switch_by_control(!last_opened_control->is_visible(), last_opened_control);
|
||||
} else {
|
||||
// Open the first panel in the list if no panel was opened this session.
|
||||
_switch_to_item(true, 0);
|
||||
}
|
||||
}
|
||||
|
||||
EditorBottomPanel::EditorBottomPanel() {
|
||||
item_vbox = memnew(VBoxContainer);
|
||||
add_child(item_vbox);
|
||||
|
@ -57,6 +57,7 @@ class EditorBottomPanel : public PanelContainer {
|
||||
EditorToaster *editor_toaster = nullptr;
|
||||
LinkButton *version_btn = nullptr;
|
||||
Button *expand_button = nullptr;
|
||||
Control *last_opened_control = nullptr;
|
||||
|
||||
void _switch_by_control(bool p_visible, Control *p_control);
|
||||
void _switch_to_item(bool p_visible, int p_idx);
|
||||
@ -72,11 +73,12 @@ public:
|
||||
void save_layout_to_config(Ref<ConfigFile> p_config_file, const String &p_section) const;
|
||||
void load_layout_from_config(Ref<ConfigFile> p_config_file, const String &p_section);
|
||||
|
||||
Button *add_item(String p_text, Control *p_item, bool p_at_front = false);
|
||||
Button *add_item(String p_text, Control *p_item, const Ref<Shortcut> &p_shortcut = nullptr, bool p_at_front = false);
|
||||
void remove_item(Control *p_item);
|
||||
void make_item_visible(Control *p_item, bool p_visible = true);
|
||||
void move_item_to_end(Control *p_item);
|
||||
void hide_bottom_panel();
|
||||
void toggle_last_opened_bottom_panel();
|
||||
|
||||
EditorBottomPanel();
|
||||
};
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/io/resource_saver.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_undo_redo_manager.h"
|
||||
@ -2275,7 +2276,7 @@ void AnimationPlayerEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin() {
|
||||
anim_editor = memnew(AnimationPlayerEditor(this));
|
||||
EditorNode::get_bottom_panel()->add_item(TTR("Animation"), anim_editor);
|
||||
EditorNode::get_bottom_panel()->add_item(TTR("Animation"), anim_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_animation_bottom_panel", TTR("Toggle Animation Bottom Panel"), KeyModifierMask::ALT | Key::N));
|
||||
}
|
||||
|
||||
AnimationPlayerEditorPlugin::~AnimationPlayerEditorPlugin() {
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/math/delaunay_2d.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/gui/editor_bottom_panel.h"
|
||||
#include "editor/gui/editor_file_dialog.h"
|
||||
@ -316,7 +317,7 @@ AnimationTreeEditorPlugin::AnimationTreeEditorPlugin() {
|
||||
anim_tree_editor = memnew(AnimationTreeEditor);
|
||||
anim_tree_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);
|
||||
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("AnimationTree"), anim_tree_editor);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("AnimationTree"), anim_tree_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_animation_tree_bottom_panel", TTR("Toggle AnimationTree Bottom Panel")));
|
||||
button->hide();
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "editor/debugger/editor_debugger_node.h"
|
||||
#include "editor/debugger/editor_debugger_server.h"
|
||||
#include "editor/debugger/editor_file_server.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/gui/editor_bottom_panel.h"
|
||||
@ -55,7 +56,7 @@ DebuggerEditorPlugin::DebuggerEditorPlugin(PopupMenu *p_debug_menu) {
|
||||
file_server = memnew(EditorFileServer);
|
||||
|
||||
EditorDebuggerNode *debugger = memnew(EditorDebuggerNode);
|
||||
Button *db = EditorNode::get_bottom_panel()->add_item(TTR("Debugger"), debugger);
|
||||
Button *db = EditorNode::get_bottom_panel()->add_item(TTR("Debugger"), debugger, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_debugger_bottom_panel", TTR("Toggle Debugger Bottom Panel"), KeyModifierMask::ALT | Key::D));
|
||||
debugger->set_tool_button(db);
|
||||
|
||||
// Main editor debug menu.
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_interface.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
@ -423,7 +424,7 @@ ResourcePreloaderEditorPlugin::ResourcePreloaderEditorPlugin() {
|
||||
preloader_editor = memnew(ResourcePreloaderEditor);
|
||||
preloader_editor->set_custom_minimum_size(Size2(0, 250) * EDSCALE);
|
||||
|
||||
button = EditorNode::get_bottom_panel()->add_item("ResourcePreloader", preloader_editor);
|
||||
button = EditorNode::get_bottom_panel()->add_item("ResourcePreloader", preloader_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_resource_preloader_bottom_panel", TTR("Toggle ResourcePreloader Bottom Panel")));
|
||||
button->hide();
|
||||
}
|
||||
|
||||
|
@ -4197,7 +4197,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
|
||||
find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_REPLACE_REQUESTED, callable_mp(this, &ScriptEditor::_start_find_in_files).bind(true));
|
||||
add_child(find_in_files_dialog);
|
||||
find_in_files = memnew(FindInFilesPanel);
|
||||
find_in_files_button = EditorNode::get_bottom_panel()->add_item(TTR("Search Results"), find_in_files);
|
||||
find_in_files_button = EditorNode::get_bottom_panel()->add_item(TTR("Search Results"), find_in_files, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_search_results_bottom_panel", TTR("Toggle Search Results Bottom Panel")));
|
||||
find_in_files->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
|
||||
find_in_files->connect(FindInFilesPanel::SIGNAL_RESULT_SELECTED, callable_mp(this, &ScriptEditor::_on_find_in_files_result_selected));
|
||||
find_in_files->connect(FindInFilesPanel::SIGNAL_FILES_MODIFIED, callable_mp(this, &ScriptEditor::_on_find_in_files_modified_files));
|
||||
|
@ -728,7 +728,7 @@ ShaderEditorPlugin::ShaderEditorPlugin() {
|
||||
empty.instantiate();
|
||||
shader_tabs->add_theme_style_override("panel", empty);
|
||||
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("Shader Editor"), window_wrapper);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("Shader Editor"), window_wrapper, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_shader_editor_bottom_panel", TTR("Toggle Shader Editor Bottom Panel"), KeyModifierMask::ALT | Key::S));
|
||||
|
||||
shader_create_dialog = memnew(ShaderCreateDialog);
|
||||
vb->add_child(shader_create_dialog);
|
||||
|
@ -34,8 +34,8 @@
|
||||
#include "core/io/resource_saver.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/os/os.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_string_names.h"
|
||||
#include "editor/gui/editor_bottom_panel.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
@ -323,7 +323,7 @@ ShaderFileEditorPlugin::ShaderFileEditorPlugin() {
|
||||
shader_editor = memnew(ShaderFileEditor);
|
||||
|
||||
shader_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("ShaderFile"), shader_editor);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("ShaderFile"), shader_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_shader_file_bottom_panel", TTR("Toggle ShaderFile Bottom Panel")));
|
||||
button->hide();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_file_system.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
@ -2337,7 +2338,7 @@ void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
|
||||
SpriteFramesEditorPlugin::SpriteFramesEditorPlugin() {
|
||||
frames_editor = memnew(SpriteFramesEditor);
|
||||
frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("SpriteFrames"), frames_editor);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("SpriteFrames"), frames_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_sprite_frames_bottom_panel", TTR("Toggle SpriteFrames Bottom Panel")));
|
||||
button->hide();
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "theme_editor_plugin.h"
|
||||
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_help.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_resource_picker.h"
|
||||
@ -3844,6 +3845,6 @@ ThemeEditorPlugin::ThemeEditorPlugin() {
|
||||
theme_editor->plugin = this;
|
||||
theme_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
|
||||
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("Theme"), theme_editor);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("Theme"), theme_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_theme_bottom_panel", TTR("Toggle Theme Bottom Panel")));
|
||||
button->hide();
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "core/os/mutex.h"
|
||||
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_interface.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
@ -511,7 +512,7 @@ TileMapEditorPlugin::TileMapEditorPlugin() {
|
||||
editor->connect("change_selected_layer_request", callable_mp(this, &TileMapEditorPlugin::_select_layer));
|
||||
editor->hide();
|
||||
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("TileMap"), editor);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("TileMap"), editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_tile_map_bottom_panel", TTR("Toggle TileMap Bottom Panel")));
|
||||
button->hide();
|
||||
}
|
||||
|
||||
@ -562,7 +563,7 @@ TileSetEditorPlugin::TileSetEditorPlugin() {
|
||||
editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
|
||||
editor->hide();
|
||||
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("TileSet"), editor);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("TileSet"), editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_tile_set_bottom_panel", TTR("Toggle TileSet Bottom Panel")));
|
||||
button->hide();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/os/time.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_dock_manager.h"
|
||||
#include "editor/editor_file_system.h"
|
||||
#include "editor/editor_interface.h"
|
||||
@ -913,7 +914,7 @@ void VersionControlEditorPlugin::fetch_available_vcs_plugin_names() {
|
||||
void VersionControlEditorPlugin::register_editor() {
|
||||
EditorDockManager::get_singleton()->add_control_to_dock(EditorDockManager::DOCK_SLOT_RIGHT_UL, version_commit_dock);
|
||||
|
||||
version_control_dock_button = EditorNode::get_bottom_panel()->add_item(TTR("Version Control"), version_control_dock);
|
||||
version_control_dock_button = EditorNode::get_bottom_panel()->add_item(TTR("Version Control"), version_control_dock, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_version_control_bottom_panel", TTR("Toggle Version Control Bottom Panel")));
|
||||
|
||||
_set_vcs_ui_state(true);
|
||||
}
|
||||
|
@ -231,3 +231,12 @@ GH-89024
|
||||
Validate extension JSON: Error: Field 'classes/RichTextLabel/methods/push_meta/arguments': size changed value in new API, from 1 to 2.
|
||||
|
||||
Added optional argument. Compatibility method registered.
|
||||
|
||||
|
||||
GH-88081
|
||||
--------
|
||||
Validate extension JSON: Error: Field 'classes/EditorPlugin/methods/add_control_to_bottom_panel/arguments': size changed value in new API, from 2 to 3.
|
||||
Validate extension JSON: Error: Field 'classes/EditorPlugin/methods/add_control_to_dock/arguments': size changed value in new API, from 2 to 3.
|
||||
|
||||
Added optional argument to add_control_to_bottom_panel and add_control_to_dock to specify a shortcut that toggles the bottom panel/dock's visibility.
|
||||
Compatibility method registered.
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "editor_network_profiler.h"
|
||||
#include "replication_editor.h"
|
||||
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_interface.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/gui/editor_bottom_panel.h"
|
||||
@ -113,7 +114,7 @@ void MultiplayerEditorDebugger::setup_session(int p_session_id) {
|
||||
|
||||
MultiplayerEditorPlugin::MultiplayerEditorPlugin() {
|
||||
repl_editor = memnew(ReplicationEditor);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("Replication"), repl_editor);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTR("Replication"), repl_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_replication_bottom_panel", TTR("Toggle Replication Bottom Panel")));
|
||||
button->hide();
|
||||
repl_editor->get_pin()->connect("pressed", callable_mp(this, &MultiplayerEditorPlugin::_pinned));
|
||||
debugger.instantiate();
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "../action_map/openxr_action_map.h"
|
||||
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/gui/editor_bottom_panel.h"
|
||||
|
||||
@ -53,7 +54,7 @@ void OpenXREditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
OpenXREditorPlugin::OpenXREditorPlugin() {
|
||||
action_map_editor = memnew(OpenXRActionMapEditor);
|
||||
EditorNode::get_bottom_panel()->add_item(TTR("OpenXR Action Map"), action_map_editor);
|
||||
EditorNode::get_bottom_panel()->add_item(TTR("OpenXR Action Map"), action_map_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_openxr_action_map_bottom_panel", TTR("Toggle OpenXR Action Map Bottom Panel")));
|
||||
|
||||
#ifndef ANDROID_ENABLED
|
||||
select_runtime = memnew(OpenXRSelectRuntime);
|
||||
|
Loading…
Reference in New Issue
Block a user