Change GridMap and Replication to EditorDock
This commit is contained in:
parent
d5edd4a592
commit
fbcb94cf19
8 changed files with 47 additions and 50 deletions
|
|
@ -34,10 +34,9 @@
|
|||
#include "editor_network_profiler.h"
|
||||
#include "replication_editor.h"
|
||||
|
||||
#include "editor/docks/editor_dock_manager.h"
|
||||
#include "editor/editor_interface.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/gui/editor_bottom_panel.h"
|
||||
#include "editor/settings/editor_command_palette.h"
|
||||
|
||||
void MultiplayerEditorDebugger::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("open_request", PropertyInfo(Variant::STRING, "path")));
|
||||
|
|
@ -116,8 +115,8 @@ void MultiplayerEditorDebugger::setup_session(int p_session_id) {
|
|||
|
||||
MultiplayerEditorPlugin::MultiplayerEditorPlugin() {
|
||||
repl_editor = memnew(ReplicationEditor);
|
||||
button = EditorNode::get_bottom_panel()->add_item(TTRC("Replication"), repl_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_replication_bottom_panel", TTRC("Toggle Replication Bottom Panel")));
|
||||
button->hide();
|
||||
EditorDockManager::get_singleton()->add_dock(repl_editor);
|
||||
repl_editor->close();
|
||||
repl_editor->get_pin()->connect(SceneStringName(pressed), callable_mp(this, &MultiplayerEditorPlugin::_pinned));
|
||||
debugger.instantiate();
|
||||
debugger->connect("open_request", callable_mp(this, &MultiplayerEditorPlugin::_open_request));
|
||||
|
|
@ -142,20 +141,14 @@ void MultiplayerEditorPlugin::_notification(int p_what) {
|
|||
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_bottom_panel()->hide_bottom_panel();
|
||||
}
|
||||
button->hide();
|
||||
repl_editor->close();
|
||||
repl_editor->get_pin()->set_pressed(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiplayerEditorPlugin::_pinned() {
|
||||
if (!repl_editor->get_pin()->is_pressed() && repl_editor->get_current() == nullptr) {
|
||||
if (repl_editor->is_visible_in_tree()) {
|
||||
EditorNode::get_bottom_panel()->hide_bottom_panel();
|
||||
}
|
||||
button->hide();
|
||||
repl_editor->close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -169,12 +162,8 @@ bool MultiplayerEditorPlugin::handles(Object *p_object) const {
|
|||
|
||||
void MultiplayerEditorPlugin::make_visible(bool p_visible) {
|
||||
if (p_visible) {
|
||||
button->show();
|
||||
EditorNode::get_bottom_panel()->make_item_visible(repl_editor);
|
||||
repl_editor->make_visible();
|
||||
} else if (!repl_editor->get_pin()->is_pressed()) {
|
||||
if (repl_editor->is_visible_in_tree()) {
|
||||
EditorNode::get_bottom_panel()->hide_bottom_panel();
|
||||
}
|
||||
button->hide();
|
||||
repl_editor->close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ class MultiplayerEditorPlugin : public EditorPlugin {
|
|||
GDCLASS(MultiplayerEditorPlugin, EditorPlugin);
|
||||
|
||||
private:
|
||||
Button *button = nullptr;
|
||||
ReplicationEditor *repl_editor = nullptr;
|
||||
Ref<MultiplayerEditorDebugger> debugger;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include "editor/editor_undo_redo_manager.h"
|
||||
#include "editor/inspector/property_selector.h"
|
||||
#include "editor/scene/scene_tree_editor.h"
|
||||
#include "editor/settings/editor_command_palette.h"
|
||||
#include "editor/settings/editor_settings.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "editor/themes/editor_theme_manager.h"
|
||||
|
|
@ -152,6 +153,13 @@ void ReplicationEditor::_pick_node_property_selected(String p_name) {
|
|||
|
||||
/// ReplicationEditor
|
||||
ReplicationEditor::ReplicationEditor() {
|
||||
set_name(TTRC("Replication"));
|
||||
set_icon_name("ReplicationDock");
|
||||
set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_replication_bottom_panel", TTRC("Toggle Replication Dock")));
|
||||
set_default_slot(EditorDock::DOCK_SLOT_BOTTOM);
|
||||
set_available_layouts(EditorDock::DOCK_LAYOUT_HORIZONTAL | EditorDock::DOCK_LAYOUT_FLOATING);
|
||||
set_global(false);
|
||||
set_transient(true);
|
||||
set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
set_custom_minimum_size(Size2(0, 200) * EDSCALE);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
#include "../scene_replication_config.h"
|
||||
|
||||
#include "editor/docks/editor_dock.h"
|
||||
#include "editor/plugins/editor_plugin.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
|
||||
class ConfirmationDialog;
|
||||
class MultiplayerSynchronizer;
|
||||
|
|
@ -44,8 +44,8 @@ class TreeItem;
|
|||
class PropertySelector;
|
||||
class SceneTreeDialog;
|
||||
|
||||
class ReplicationEditor : public VBoxContainer {
|
||||
GDCLASS(ReplicationEditor, VBoxContainer);
|
||||
class ReplicationEditor : public EditorDock {
|
||||
GDCLASS(ReplicationEditor, EditorDock);
|
||||
|
||||
private:
|
||||
MultiplayerSynchronizer *current = nullptr;
|
||||
|
|
|
|||
1
modules/multiplayer/icons/ReplicationDock.svg
Normal file
1
modules/multiplayer/icons/ReplicationDock.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="m8 10-2 4-2-4ZM12 14l-2-4-2 4Z"/><path fill="none" stroke="#e0e0e0" stroke-linecap="round" stroke-width="2" d="M4.936 7.429a4 4 0 0 1 6.128 0M1.872 4.858a8 8 0 0 1 12.256 0"/></svg>
|
||||
|
After Width: | Height: | Size: 269 B |
Loading…
Add table
Add a link
Reference in a new issue