Skip to content

Commit

Permalink
Extract BottomPanel from EditorNode
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbdev committed Feb 20, 2024
1 parent 1aab6e9 commit eb6ca91
Show file tree
Hide file tree
Showing 22 changed files with 438 additions and 315 deletions.
7 changes: 4 additions & 3 deletions editor/debugger/editor_debugger_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/gui/editor_bottom_panel.h"
#include "editor/gui/editor_run_bar.h"
#include "editor/inspector_dock.h"
#include "editor/plugins/editor_debugger_plugin.h"
Expand Down Expand Up @@ -268,9 +269,9 @@ Error EditorDebuggerNode::start(const String &p_uri) {
stop(true);
current_uri = p_uri;
if (EDITOR_GET("run/output/always_open_output_on_play")) {
EditorNode::get_singleton()->make_bottom_panel_item_visible(EditorNode::get_log());
EditorNode::get_bottom_panel()->make_item_visible(EditorNode::get_log());
} else {
EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
EditorNode::get_bottom_panel()->make_item_visible(this);
}
server = Ref<EditorDebuggerServer>(EditorDebuggerServer::create(p_uri.substr(0, p_uri.find("://") + 3)));
const Error err = server->start(p_uri);
Expand Down Expand Up @@ -502,7 +503,7 @@ void EditorDebuggerNode::_break_state_changed() {
const bool breaked = get_current_debugger()->is_breaked();
const bool can_debug = get_current_debugger()->is_debuggable();
if (breaked) { // Show debugger.
EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
EditorNode::get_bottom_panel()->make_item_visible(this);
}

// Update script menu.
Expand Down
5 changes: 3 additions & 2 deletions editor/editor_audio_buses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/filesystem_dock.h"
#include "editor/gui/editor_bottom_panel.h"
#include "editor/gui/editor_file_dialog.h"
#include "editor/themes/editor_scale.h"
#include "editor/themes/editor_theme_manager.h"
Expand Down Expand Up @@ -1040,7 +1041,7 @@ void EditorAudioBuses::_rebuild_buses() {

EditorAudioBuses *EditorAudioBuses::register_editor() {
EditorAudioBuses *audio_buses = memnew(EditorAudioBuses);
EditorNode::get_singleton()->add_bottom_panel_item(TTR("Audio"), audio_buses);
EditorNode::get_bottom_panel()->add_item(TTR("Audio"), audio_buses);
return audio_buses;
}

Expand Down Expand Up @@ -1357,7 +1358,7 @@ EditorAudioBuses::EditorAudioBuses() {
}

void EditorAudioBuses::open_layout(const String &p_path) {
EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
EditorNode::get_bottom_panel()->make_item_visible(this);

Ref<AudioBusLayout> state = ResourceLoader::load(p_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE);
if (state.is_null()) {
Expand Down
11 changes: 6 additions & 5 deletions editor/editor_dock_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/filesystem_dock.h"
#include "editor/gui/editor_bottom_panel.h"
#include "editor/themes/editor_scale.h"
#include "editor/window_wrapper.h"

Expand Down Expand Up @@ -196,7 +197,7 @@ void EditorDockManager::_dock_select_input(const Ref<InputEvent> &p_input) {

if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
if (dock_bottom_selected_idx != -1) {
EditorNode::get_singleton()->remove_bottom_panel_item(bottom_docks[dock_bottom_selected_idx]);
EditorNode::get_bottom_panel()->remove_item(bottom_docks[dock_bottom_selected_idx]);

bottom_docks[dock_bottom_selected_idx]->call("_set_dock_horizontal", false);

Expand Down Expand Up @@ -391,13 +392,13 @@ void EditorDockManager::_dock_move_selected_to_bottom() {
dock->call("_set_dock_horizontal", true);

bottom_docks.push_back(dock);
EditorNode::get_singleton()->add_bottom_panel_item(dock->get_name(), dock, true);
EditorNode::get_bottom_panel()->add_item(dock->get_name(), dock, true);
dock_select_popup->hide();
update_dock_slots_visibility(true);
_edit_current();
emit_signal(SNAME("layout_changed"));

EditorNode::get_singleton()->make_bottom_panel_item_visible(dock);
EditorNode::get_bottom_panel()->make_item_visible(dock);
}

void EditorDockManager::_dock_make_float(Control *p_dock, int p_slot_index, bool p_show_window) {
Expand Down Expand Up @@ -601,7 +602,7 @@ void EditorDockManager::load_docks_from_config(Ref<ConfigFile> p_layout, const S
dock_slot[atidx]->set_block_signals(false);
} else if (bottom_idx != -1) {
bottom_docks.erase(node);
EditorNode::get_singleton()->remove_bottom_panel_item(node);
EditorNode::get_bottom_panel()->remove_item(node);
dock_slot[i]->add_child(node);
node->call("_set_dock_horizontal", false);
}
Expand Down Expand Up @@ -662,7 +663,7 @@ 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_singleton()->add_bottom_panel_item(node->get_name(), node, true);
EditorNode::get_bottom_panel()->add_item(node->get_name(), node, true);
}
}

Expand Down
Loading

0 comments on commit eb6ca91

Please sign in to comment.