Skip to content
Merged
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
1 change: 1 addition & 0 deletions editor/icons/TileMapDock.svg
Comment thread
lodetrick marked this conversation as resolved.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 14 additions & 3 deletions editor/scene/2d/tiles/tile_map_layer_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "editor/inspector/editor_resource_preview.h"
#include "editor/inspector/multi_node_edit.h"
#include "editor/scene/canvas_item_editor_plugin.h"
#include "editor/settings/editor_command_palette.h"
#include "editor/settings/editor_settings.h"
#include "editor/themes/editor_scale.h"
#include "scene/2d/tile_map.h"
Expand Down Expand Up @@ -4397,6 +4398,16 @@ void TileMapLayerEditor::set_show_layer_selector(bool p_show_layer_selector) {

TileMapLayerEditor::TileMapLayerEditor() {
set_process_internal(true);
set_name(TTRC("TileMap"));
set_icon_name("TileMapDock");
set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_tile_map_bottom_panel", TTRC("Open TileMap Dock")));
set_default_slot(DockConstants::DOCK_SLOT_BOTTOM);
set_available_layouts(EditorDock::DOCK_LAYOUT_HORIZONTAL | EditorDock::DOCK_LAYOUT_FLOATING);
set_global(false);
set_transient(true);

VBoxContainer *main_box_container = memnew(VBoxContainer);
add_child(main_box_container);

// Shortcuts.
ED_SHORTCUT("tiles_editor/select_next_layer", TTRC("Select Next Tile Map Layer"), Key::PAGEDOWN);
Expand All @@ -4422,7 +4433,7 @@ TileMapLayerEditor::TileMapLayerEditor() {
// --- TileMap toolbar ---
tile_map_toolbar = memnew(HFlowContainer);
tile_map_toolbar->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(tile_map_toolbar);
main_box_container->add_child(tile_map_toolbar);

// Tabs.
tile_map_toolbar->add_child(tabs_bar);
Expand Down Expand Up @@ -4509,10 +4520,10 @@ TileMapLayerEditor::TileMapLayerEditor() {
cant_edit_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
cant_edit_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
cant_edit_label->hide();
add_child(cant_edit_label);
main_box_container->add_child(cant_edit_label);

for (unsigned int tab_index = 0; tab_index < tabs_data.size(); tab_index++) {
add_child(tabs_data[tab_index].panel);
main_box_container->add_child(tabs_data[tab_index].panel);
tabs_data[tab_index].panel->set_v_size_flags(SIZE_EXPAND_FILL);
tabs_data[tab_index].panel->set_visible(tab_index == 0);
tabs_data[tab_index].panel->set_h_size_flags(SIZE_EXPAND_FILL);
Expand Down
5 changes: 3 additions & 2 deletions editor/scene/2d/tiles/tile_map_layer_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "tile_atlas_view.h"

#include "core/os/thread.h"
#include "editor/docks/editor_dock.h"
#include "scene/gui/box_container.h"
#include "scene/gui/check_box.h"
#include "scene/gui/flow_container.h"
Expand Down Expand Up @@ -337,8 +338,8 @@ class TileMapLayerEditorTerrainsPlugin : public TileMapLayerSubEditorPlugin {
TileMapLayerEditorTerrainsPlugin();
};

class TileMapLayerEditor : public VBoxContainer {
GDCLASS(TileMapLayerEditor, VBoxContainer);
class TileMapLayerEditor : public EditorDock {
GDCLASS(TileMapLayerEditor, EditorDock);

private:
bool tile_map_layer_changed_needs_update = false;
Expand Down
8 changes: 8 additions & 0 deletions editor/scene/2d/tiles/tile_set_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "editor/file_system/editor_file_system.h"
#include "editor/gui/editor_file_dialog.h"
#include "editor/inspector/editor_inspector.h"
#include "editor/settings/editor_command_palette.h"
#include "editor/settings/editor_settings.h"
#include "editor/themes/editor_scale.h"

Expand Down Expand Up @@ -807,6 +808,13 @@ void TileSetEditor::register_split(SplitContainer *p_split) {

TileSetEditor::TileSetEditor() {
singleton = this;
set_name(TTRC("TileSet"));
set_icon_name("TileSet");
set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_tile_set_bottom_panel", TTRC("Open TileSet Dock")));
set_default_slot(DockConstants::DOCK_SLOT_BOTTOM);
set_available_layouts(EditorDock::DOCK_LAYOUT_HORIZONTAL | EditorDock::DOCK_LAYOUT_FLOATING);
set_global(false);
set_transient(true);

set_process_internal(true);

Expand Down
5 changes: 3 additions & 2 deletions editor/scene/2d/tiles/tile_set_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#pragma once

#include "atlas_merging_dialog.h"
#include "editor/docks/editor_dock.h"
#include "scene/gui/tab_bar.h"
#include "scene/resources/2d/tile_set.h"
#include "tile_proxies_manager_dialog.h"
Expand All @@ -45,8 +46,8 @@ class EditorFileDialog;
class EditorInspectorPlugin;
class TileSetSourceItemList;

class TileSetEditor : public MarginContainer {
GDCLASS(TileSetEditor, MarginContainer);
class TileSetEditor : public EditorDock {
GDCLASS(TileSetEditor, EditorDock);

static TileSetEditor *singleton;

Expand Down
33 changes: 8 additions & 25 deletions editor/scene/2d/tiles/tiles_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ bool TilesEditorUtils::SourceNameComparator::operator()(const int &p_a, const in
}

void TilesEditorUtils::display_tile_set_editor_panel() {
tile_map_plugin_singleton->hide_editor();
tile_set_plugin_singleton->make_visible(true);
}

Expand Down Expand Up @@ -481,13 +480,9 @@ bool TileMapEditorPlugin::handles(Object *p_object) const {

void TileMapEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
button->show();
EditorNode::get_bottom_panel()->make_item_visible(editor);
editor->open();
} else {
button->hide();
if (editor->is_visible_in_tree()) {
EditorNode::get_bottom_panel()->hide_bottom_panel();
}
editor->close();
}
}

Expand All @@ -499,12 +494,6 @@ void TileMapEditorPlugin::forward_canvas_draw_over_viewport(Control *p_overlay)
editor->forward_canvas_draw_over_viewport(p_overlay);
}

void TileMapEditorPlugin::hide_editor() {
if (editor->is_visible_in_tree()) {
EditorNode::get_bottom_panel()->hide_bottom_panel();
}
}

bool TileMapEditorPlugin::is_editor_visible() const {
return editor->is_visible_in_tree();
}
Expand All @@ -521,8 +510,8 @@ TileMapEditorPlugin::TileMapEditorPlugin() {
editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
editor->hide();

button = EditorNode::get_bottom_panel()->add_item(TTRC("TileMap"), editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_tile_map_bottom_panel", TTRC("Toggle TileMap Bottom Panel")));
button->hide();
EditorDockManager::get_singleton()->add_dock(editor);
Comment thread
lodetrick marked this conversation as resolved.
editor->close();
}

TileMapEditorPlugin::~TileMapEditorPlugin() {
Expand All @@ -544,15 +533,9 @@ bool TileSetEditorPlugin::handles(Object *p_object) const {

void TileSetEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
button->show();
if (!tile_map_plugin_singleton->is_editor_visible()) {
EditorNode::get_bottom_panel()->make_item_visible(editor);
}
editor->open();
} else {
button->hide();
if (editor->is_visible_in_tree()) {
EditorNode::get_bottom_panel()->hide_bottom_panel();
}
editor->close();
}
}

Expand All @@ -572,8 +555,8 @@ TileSetEditorPlugin::TileSetEditorPlugin() {
editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
editor->hide();

button = EditorNode::get_bottom_panel()->add_item(TTRC("TileSet"), editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_tile_set_bottom_panel", TTRC("Toggle TileSet Bottom Panel")));
button->hide();
EditorDockManager::get_singleton()->add_dock(editor);
editor->close();
}

TileSetEditorPlugin::~TileSetEditorPlugin() {
Expand Down
3 changes: 0 additions & 3 deletions editor/scene/2d/tiles/tiles_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class TileMapEditorPlugin : public EditorPlugin {
GDCLASS(TileMapEditorPlugin, EditorPlugin);

TileMapLayerEditor *editor = nullptr;
Button *button = nullptr;
ObjectID tile_map_layer_id;
ObjectID tile_map_group_id; // Allow keeping the layer selector up to date.

Expand All @@ -148,7 +147,6 @@ class TileMapEditorPlugin : public EditorPlugin {
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) override;
virtual void forward_canvas_draw_over_viewport(Control *p_overlay) override;

void hide_editor();
bool is_editor_visible() const;

TileMapEditorPlugin();
Expand All @@ -159,7 +157,6 @@ class TileSetEditorPlugin : public EditorPlugin {
GDCLASS(TileSetEditorPlugin, EditorPlugin);

TileSetEditor *editor = nullptr;
Button *button = nullptr;

ObjectID edited_tileset;

Expand Down
Loading