Merge pull request #87760 from kitbdev/extract-bottom-dock

Extract BottomPanel from EditorNode
This commit is contained in:
Rémi Verschelde
2024-02-23 22:18:50 +01:00
22 changed files with 438 additions and 315 deletions

View File

@ -36,6 +36,7 @@
#include "editor/editor_interface.h"
#include "editor/editor_node.h"
#include "editor/gui/editor_bottom_panel.h"
void MultiplayerEditorDebugger::_bind_methods() {
ADD_SIGNAL(MethodInfo("open_request", PropertyInfo(Variant::STRING, "path")));
@ -112,7 +113,7 @@ void MultiplayerEditorDebugger::setup_session(int p_session_id) {
MultiplayerEditorPlugin::MultiplayerEditorPlugin() {
repl_editor = memnew(ReplicationEditor);
button = EditorNode::get_singleton()->add_bottom_panel_item(TTR("Replication"), repl_editor);
button = EditorNode::get_bottom_panel()->add_item(TTR("Replication"), repl_editor);
button->hide();
repl_editor->get_pin()->connect("pressed", callable_mp(this, &MultiplayerEditorPlugin::_pinned));
debugger.instantiate();
@ -139,7 +140,7 @@ void MultiplayerEditorPlugin::_node_removed(Node *p_node) {
if (p_node && p_node == repl_editor->get_current()) {
repl_editor->edit(nullptr);
if (repl_editor->is_visible_in_tree()) {
EditorNode::get_singleton()->hide_bottom_panel();
EditorNode::get_bottom_panel()->hide_bottom_panel();
}
button->hide();
repl_editor->get_pin()->set_pressed(false);
@ -149,7 +150,7 @@ void MultiplayerEditorPlugin::_node_removed(Node *p_node) {
void MultiplayerEditorPlugin::_pinned() {
if (!repl_editor->get_pin()->is_pressed()) {
if (repl_editor->is_visible_in_tree()) {
EditorNode::get_singleton()->hide_bottom_panel();
EditorNode::get_bottom_panel()->hide_bottom_panel();
}
button->hide();
}
@ -166,10 +167,10 @@ bool MultiplayerEditorPlugin::handles(Object *p_object) const {
void MultiplayerEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
button->show();
EditorNode::get_singleton()->make_bottom_panel_item_visible(repl_editor);
EditorNode::get_bottom_panel()->make_item_visible(repl_editor);
} else if (!repl_editor->get_pin()->is_pressed()) {
if (repl_editor->is_visible_in_tree()) {
EditorNode::get_singleton()->hide_bottom_panel();
EditorNode::get_bottom_panel()->hide_bottom_panel();
}
button->hide();
}