Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/classes/EditorSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,9 @@
<member name="interface/editor/bottom_dock_tab_style" type="int" setter="" getter="">
Tab style of editor docks located at the bottom.
</member>
<member name="interface/editor/bottom_dock_tabs_allow_individual_heights" type="bool" setter="" getter="">
Allow the editor docks located at the bottom to have individual heights.
</member>
<member name="interface/editor/code_font" type="String" setter="" getter="">
The font to use for the script editor. Must be a resource of a [Font] type such as a [code].ttf[/code] or [code].otf[/code] font file.
</member>
Expand Down
8 changes: 8 additions & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,9 @@ void EditorNode::_notification(int p_what) {
theme->set_constant("dragging_unfold_wait_msec", "Tree", (float)EDITOR_GET("interface/editor/dragging_hover_wait_seconds") * 1000);
theme->set_constant("hover_switch_wait_msec", "TabBar", (float)EDITOR_GET("interface/editor/dragging_hover_wait_seconds") * 1000);
editor_dock_manager->update_tab_styles();

bottom_dock_tabs_allow_individual_heights = EDITOR_GET("interface/editor/bottom_dock_tabs_allow_individual_heights");
get_bottom_panel()->_editor_settings_changed();
}

if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/scene_tabs")) {
Expand Down Expand Up @@ -6356,6 +6359,10 @@ bool EditorNode::is_cmdline_mode() {
return singleton->cmdline_mode;
}

bool EditorNode::is_bottom_dock_tabs_allow_individual_heights() {
return singleton->bottom_dock_tabs_allow_individual_heights;
}

void EditorNode::cleanup() {
_init_callbacks.clear();
}
Expand Down Expand Up @@ -8778,6 +8785,7 @@ EditorNode::EditorNode() {
Dictionary offsets;
offsets["Audio"] = -450;
default_layout->set_value(EDITOR_NODE_CONFIG_SECTION, "bottom_panel_offsets", offsets);
default_layout->set_value(EDITOR_NODE_CONFIG_SECTION, "bottom_panel_offset", -450);
}

_update_layouts_menu();
Expand Down
3 changes: 3 additions & 0 deletions editor/editor_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ class EditorNode : public Node {
Callable palette_file_selected_callback;

EditorBottomPanel *bottom_panel = nullptr;
bool bottom_dock_tabs_allow_individual_heights = false;

Tree *disk_changed_list = nullptr;
LocalVector<String> disk_changed_scenes;
Expand Down Expand Up @@ -776,6 +777,8 @@ class EditorNode : public Node {

static bool is_cmdline_mode();

static bool is_bottom_dock_tabs_allow_individual_heights();

static HashMap<String, Variant> get_initial_settings();

static void cleanup();
Expand Down
71 changes: 63 additions & 8 deletions editor/gui/editor_bottom_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,61 @@ void EditorBottomPanel::_theme_changed() {
}
}

void EditorBottomPanel::_editor_settings_changed() {
// If the editor settings were changed to disable individual tabs, then set the
// unified tab height to be equal to the currently active tab height
if (!EditorNode::get_singleton()->is_bottom_dock_tabs_allow_individual_heights()) {
EditorDock *current_tab = Object::cast_to<EditorDock>(get_current_tab_control());
if (current_tab) {
dock_offset = dock_offsets[current_tab->get_effective_layout_key()];
}
}

// If the editor settings were changed to enable individual tabs, then set the
// individual tab heights to be equal to the current unified height and set
else {
for (int tab_idx = 0; tab_idx < get_tab_count(); tab_idx++) {
EditorDock *tab = Object::cast_to<EditorDock>(get_tab_control(tab_idx));
if (tab) {
dock_offsets[tab->get_effective_layout_key()] = dock_offset;
}
}
}

_update_center_split_offset();
}

void EditorBottomPanel::set_bottom_panel_offset(int p_offset) {
EditorDock *current_tab = Object::cast_to<EditorDock>(get_current_tab_control());
if (current_tab) {
dock_offsets[current_tab->get_effective_layout_key()] = p_offset;
// Store the individual offsets
if (EditorNode::get_singleton()->is_bottom_dock_tabs_allow_individual_heights()) {
EditorDock *current_tab = Object::cast_to<EditorDock>(get_current_tab_control());
if (current_tab) {
dock_offsets[current_tab->get_effective_layout_key()] = p_offset;
}
return;
}

// Store the unified offset and update all individual offsets to match
dock_offset = p_offset;
for (const KeyValue<String, int> &E : dock_offsets) {
dock_offsets[E.key] = p_offset;
}
}

int EditorBottomPanel::get_bottom_panel_offset() {
// Handle the null case
EditorDock *current_tab = Object::cast_to<EditorDock>(get_current_tab_control());
if (current_tab) {
if (!current_tab) {
return 0;
}

// Return the individual offsets
if (EditorNode::get_singleton()->is_bottom_dock_tabs_allow_individual_heights()) {
return dock_offsets[current_tab->get_effective_layout_key()];
}
return 0;

// Return the unified offset
return dock_offset;
}

void EditorBottomPanel::_repaint() {
Expand Down Expand Up @@ -129,19 +171,32 @@ void EditorBottomPanel::_repaint() {

void EditorBottomPanel::save_layout_to_config(Ref<ConfigFile> p_config_file, const String &p_section) const {
Dictionary offsets;
for (const KeyValue<String, int> &E : dock_offsets) {
offsets[E.key] = E.value;
if (EditorNode::get_singleton()->is_bottom_dock_tabs_allow_individual_heights()) {
// Store the individual offsets as themselves
for (const KeyValue<String, int> &E : dock_offsets) {
offsets[E.key] = E.value;
}
} else {
// Store the individual offsets as the unified offset
for (const KeyValue<String, int> &E : dock_offsets) {
offsets[E.key] = dock_offset;
}
}
p_config_file->set_value(p_section, "bottom_panel_offsets", offsets);
p_config_file->set_value(p_section, "bottom_panel_offset", dock_offset);
}

void EditorBottomPanel::load_layout_from_config(Ref<ConfigFile> p_config_file, const String &p_section) {
// Load the unified offset
dock_offset = p_config_file->get_value(p_section, "bottom_panel_offset", int());

// Load the individual offsets
const Dictionary offsets = p_config_file->get_value(p_section, "bottom_panel_offsets", Dictionary());
const LocalVector<Variant> offset_list = offsets.get_key_list();

for (const Variant &v : offset_list) {
dock_offsets[v] = offsets[v];
}

_update_center_split_offset();
}

Expand Down
3 changes: 3 additions & 0 deletions editor/gui/editor_bottom_panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class EditorBottomPanel : public TabContainer {
int previous_tab = -1;
bool lock_panel_switching = false;
LocalVector<EditorDock *> bottom_docks;
LocalVector<Ref<Shortcut>> dock_shortcuts;
int dock_offset = -450;
HashMap<String, int> dock_offsets;

LocalVector<Button *> legacy_buttons;
Expand All @@ -77,6 +79,7 @@ class EditorBottomPanel : public TabContainer {
void toggle_last_opened_bottom_panel();
void set_expanded(bool p_expanded);
void _theme_changed();
void _editor_settings_changed();
bool is_locked() const { return lock_panel_switching; }

void set_bottom_panel_offset(int p_offset);
Expand Down
1 change: 1 addition & 0 deletions editor/settings/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/editor/localize_settings", true, "")
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/dock_tab_style", 0, "Text Only,Icon Only,Text and Icon")
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/bottom_dock_tab_style", 0, "Text Only,Icon Only,Text and Icon")
EDITOR_SETTING_BASIC(Variant::BOOL, PROPERTY_HINT_NONE, "interface/editor/bottom_dock_tabs_allow_individual_heights", false, "");
EDITOR_SETTING_USAGE(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/ui_layout_direction", 0, "Based on Application Locale,Left-to-Right,Right-to-Left,Based on System Locale", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)

// Display what the Auto display scale setting effectively corresponds to.
Expand Down