Merge pull request #114348 from YeldhamDev/tile_bg_panels
Add background panels to the TileSet/Map editors
This commit is contained in:
commit
2bf354f8d4
5 changed files with 42 additions and 18 deletions
|
|
@ -158,14 +158,14 @@ Vector<TileMapLayerSubEditorPlugin::TabData> TileMapLayerEditorTilesPlugin::get_
|
|||
toolbar_controls.push_back(tools_settings);
|
||||
toolbar_controls.push_back(tools_settings_vsep);
|
||||
tabs.push_back({ toolbar_controls, wide_toolbar, tiles_bottom_panel });
|
||||
tabs.push_back({ toolbar_controls, wide_toolbar, patterns_bottom_panel });
|
||||
tabs.push_back({ toolbar_controls, wide_toolbar, patterns_mc });
|
||||
return tabs;
|
||||
}
|
||||
|
||||
void TileMapLayerEditorTilesPlugin::_tab_changed() {
|
||||
if (tiles_bottom_panel->is_visible_in_tree()) {
|
||||
_update_selection_pattern_from_tileset_tiles_selection();
|
||||
} else if (patterns_bottom_panel->is_visible_in_tree()) {
|
||||
} else if (patterns_mc->is_visible_in_tree()) {
|
||||
_update_selection_pattern_from_tileset_pattern_selection();
|
||||
}
|
||||
}
|
||||
|
|
@ -386,7 +386,7 @@ void TileMapLayerEditorTilesPlugin::_update_patterns_list() {
|
|||
// Added a new pattern, thus select the last one.
|
||||
if (select_last_pattern) {
|
||||
patterns_item_list->select(tile_set->get_patterns_count() - 1);
|
||||
patterns_item_list->grab_focus();
|
||||
patterns_item_list->grab_focus(true);
|
||||
_update_selection_pattern_from_tileset_pattern_selection();
|
||||
}
|
||||
select_last_pattern = false;
|
||||
|
|
@ -538,7 +538,7 @@ void TileMapLayerEditorTilesPlugin::_update_theme() {
|
|||
}
|
||||
|
||||
bool TileMapLayerEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p_event) {
|
||||
if (!(tiles_bottom_panel->is_visible_in_tree() || patterns_bottom_panel->is_visible_in_tree())) {
|
||||
if (!(tiles_bottom_panel->is_visible_in_tree() || patterns_mc->is_visible_in_tree())) {
|
||||
// If the bottom editor is not visible, we ignore inputs.
|
||||
return false;
|
||||
}
|
||||
|
|
@ -808,7 +808,7 @@ void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p
|
|||
bool drawing_rect = false;
|
||||
|
||||
// Draw the selection.
|
||||
if ((tiles_bottom_panel->is_visible_in_tree() || patterns_bottom_panel->is_visible_in_tree()) && tool_buttons_group->get_pressed_button() == select_tool_button) {
|
||||
if ((tiles_bottom_panel->is_visible_in_tree() || patterns_mc->is_visible_in_tree()) && tool_buttons_group->get_pressed_button() == select_tool_button) {
|
||||
// In select mode, we only draw the current selection if we are modifying it (pressing control or shift).
|
||||
if (drag_type == DRAG_TYPE_MOVE || (drag_type == DRAG_TYPE_SELECT && !Input::get_singleton()->is_key_pressed(Key::CMD_OR_CTRL) && !Input::get_singleton()->is_key_pressed(Key::SHIFT))) {
|
||||
// Do nothing.
|
||||
|
|
@ -820,7 +820,7 @@ void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p
|
|||
}
|
||||
|
||||
// Handle the preview of the tiles to be placed.
|
||||
if ((tiles_bottom_panel->is_visible_in_tree() || patterns_bottom_panel->is_visible_in_tree()) && CanvasItemEditor::get_singleton()->get_current_tool() == CanvasItemEditor::TOOL_SELECT && has_mouse) { // Only if the tilemap editor is opened and the viewport is hovered.
|
||||
if ((tiles_bottom_panel->is_visible_in_tree() || patterns_mc->is_visible_in_tree()) && CanvasItemEditor::get_singleton()->get_current_tool() == CanvasItemEditor::TOOL_SELECT && has_mouse) { // Only if the tilemap editor is opened and the viewport is hovered.
|
||||
HashMap<Vector2i, TileMapCell> preview;
|
||||
Rect2i drawn_grid_rect;
|
||||
|
||||
|
|
@ -2153,6 +2153,15 @@ void TileMapLayerEditorTilesPlugin::update_layout(EditorDock::DockLayout p_layou
|
|||
tools_settings->set_vertical(is_vertical);
|
||||
tools_settings_vsep->set_vertical(is_vertical);
|
||||
transform_separator->set_vertical(is_vertical);
|
||||
|
||||
if (p_layout == EditorDock::DockLayout::DOCK_LAYOUT_FLOATING) {
|
||||
patterns_mc->set_theme_type_variation("NoBorderHorizontalBottom");
|
||||
patterns_item_list->set_scroll_hint_mode(ItemList::SCROLL_HINT_MODE_TOP);
|
||||
} else {
|
||||
patterns_mc->set_theme_type_variation(is_vertical ? "" : "NoBorderBottomPanel");
|
||||
patterns_item_list->set_scroll_hint_mode(is_vertical ? ItemList::SCROLL_HINT_MODE_DISABLED : ItemList::SCROLL_HINT_MODE_BOTH);
|
||||
}
|
||||
patterns_item_list->set_theme_type_variation(is_vertical ? "ItemListSecondary" : "");
|
||||
}
|
||||
|
||||
TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
||||
|
|
@ -2438,9 +2447,9 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
atlas_sources_split_container->add_child(invalid_source_label);
|
||||
|
||||
// --- Bottom panel patterns ---
|
||||
patterns_bottom_panel = memnew(VBoxContainer);
|
||||
patterns_bottom_panel->set_name(TTR("Patterns"));
|
||||
patterns_bottom_panel->connect(SceneStringName(visibility_changed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_tab_changed));
|
||||
patterns_mc = memnew(MarginContainer);
|
||||
patterns_mc->set_name(TTR("Patterns"));
|
||||
patterns_mc->connect(SceneStringName(visibility_changed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_tab_changed));
|
||||
|
||||
int thumbnail_size = 64;
|
||||
patterns_item_list = memnew(ItemList);
|
||||
|
|
@ -2450,12 +2459,12 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
patterns_item_list->set_fixed_column_width(thumbnail_size * 3 / 2);
|
||||
patterns_item_list->set_max_text_lines(2);
|
||||
patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size));
|
||||
patterns_item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
patterns_item_list->set_scroll_hint_mode(ItemList::SCROLL_HINT_MODE_BOTH);
|
||||
patterns_item_list->connect(SceneStringName(gui_input), callable_mp(this, &TileMapLayerEditorTilesPlugin::_patterns_item_list_gui_input));
|
||||
patterns_item_list->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_selection_pattern_from_tileset_pattern_selection).unbind(1));
|
||||
patterns_item_list->connect("item_activated", callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_selection_pattern_from_tileset_pattern_selection).unbind(1));
|
||||
patterns_item_list->connect("empty_clicked", callable_mp(this, &TileMapLayerEditorTilesPlugin::patterns_item_list_empty_clicked));
|
||||
patterns_bottom_panel->add_child(patterns_item_list);
|
||||
patterns_mc->add_child(patterns_item_list);
|
||||
|
||||
patterns_help_label = memnew(Label);
|
||||
patterns_help_label->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
|
||||
|
|
@ -3499,7 +3508,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
|||
terrains_tree->set_custom_minimum_size(Size2(70, 0) * EDSCALE);
|
||||
terrains_tree->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST);
|
||||
terrains_tree->set_hide_root(true);
|
||||
terrains_tree->set_theme_type_variation("ItemListSecondary");
|
||||
terrains_tree->set_theme_type_variation("TreeSecondary");
|
||||
terrains_tree->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_tiles_list));
|
||||
tilemap_tab_terrains->add_child(terrains_tree);
|
||||
|
||||
|
|
@ -3511,6 +3520,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
|||
terrains_tile_list->set_same_column_width(true);
|
||||
terrains_tile_list->set_fixed_icon_size(Size2(32, 32) * EDSCALE);
|
||||
terrains_tile_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST);
|
||||
terrains_tile_list->set_theme_type_variation("ItemListSecondary");
|
||||
tilemap_tab_terrains->add_child(terrains_tile_list);
|
||||
|
||||
// --- Toolbar ---
|
||||
|
|
@ -4421,6 +4431,11 @@ void TileMapLayerEditor::update_layout(DockLayout p_layout) {
|
|||
tile_map_toolbar->set_v_size_flags(is_vertical ? SIZE_EXPAND_FILL : SIZE_SHRINK_BEGIN);
|
||||
|
||||
main_box_container->move_child(padding_control, is_vertical ? 0 : 2);
|
||||
if (is_vertical) {
|
||||
main_box_container->remove_theme_constant_override(SNAME("h_separation"));
|
||||
} else {
|
||||
main_box_container->add_theme_constant_override(SNAME("h_separation"), 0);
|
||||
}
|
||||
|
||||
if (is_vertical) {
|
||||
tile_map_wide_toolbar->add_child(tabs_panel);
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ private:
|
|||
void _scenes_list_lmb_empty_clicked(const Vector2 &p_pos, MouseButton p_mouse_button_index);
|
||||
|
||||
///// Bottom panel patterns ////
|
||||
VBoxContainer *patterns_bottom_panel = nullptr;
|
||||
MarginContainer *patterns_mc = nullptr;
|
||||
ItemList *patterns_item_list = nullptr;
|
||||
Label *patterns_help_label = nullptr;
|
||||
void _patterns_item_list_gui_input(const Ref<InputEvent> &p_event);
|
||||
|
|
@ -326,7 +326,7 @@ private:
|
|||
SELECTED_TYPE_PATH,
|
||||
SELECTED_TYPE_PATTERN,
|
||||
};
|
||||
SelectedType selected_type;
|
||||
SelectedType selected_type = SELECTED_TYPE_CONNECT;
|
||||
int selected_terrain_set = -1;
|
||||
int selected_terrain = -1;
|
||||
TileSet::TerrainsPattern selected_terrains_pattern;
|
||||
|
|
|
|||
|
|
@ -2576,6 +2576,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
|
|||
tile_inspector->set_show_categories(false, true);
|
||||
tile_inspector->set_use_doc_hints(true);
|
||||
tile_inspector->set_use_folding(true);
|
||||
tile_inspector->set_theme_type_variation("ScrollContainerSecondary");
|
||||
tile_inspector->connect("property_selected", callable_mp(this, &TileSetAtlasSourceEditor::_inspector_property_selected));
|
||||
middle_vbox_container->add_child(tile_inspector);
|
||||
|
||||
|
|
@ -2591,6 +2592,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
|
|||
tile_data_editors_scroll = memnew(ScrollContainer);
|
||||
tile_data_editors_scroll->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
|
||||
tile_data_editors_scroll->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tile_data_editors_scroll->set_theme_type_variation("ScrollContainerSecondary");
|
||||
middle_vbox_container->add_child(tile_data_editors_scroll);
|
||||
|
||||
VBoxContainer *tile_data_editors_vbox = memnew(VBoxContainer);
|
||||
|
|
@ -2630,6 +2632,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
|
|||
atlas_source_inspector->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
atlas_source_inspector->set_show_categories(false, true);
|
||||
atlas_source_inspector->set_use_doc_hints(true);
|
||||
atlas_source_inspector->set_theme_type_variation("ScrollContainerSecondary");
|
||||
middle_vbox_container->add_child(atlas_source_inspector);
|
||||
|
||||
// -- Right side --
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ void TileSetEditor::_tile_set_changed() {
|
|||
|
||||
void TileSetEditor::_tab_changed(int p_tab_changed) {
|
||||
split_container->set_visible(p_tab_changed == 0);
|
||||
patterns_item_list->set_visible(p_tab_changed == 1);
|
||||
patterns_mc->set_visible(p_tab_changed == 1);
|
||||
}
|
||||
|
||||
void TileSetEditor::_move_tile_set_array_element(Object *p_undo_redo, Object *p_edited, const String &p_array_prefix, int p_from_index, int p_to_pos) {
|
||||
|
|
@ -947,6 +947,12 @@ TileSetEditor::TileSetEditor() {
|
|||
split_container_right_side->add_child(tile_set_scenes_collection_source_editor);
|
||||
tile_set_scenes_collection_source_editor->hide();
|
||||
|
||||
patterns_mc = memnew(MarginContainer);
|
||||
patterns_mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
patterns_mc->set_theme_type_variation("NoBorderBottomPanel");
|
||||
main_vb->add_child(patterns_mc);
|
||||
patterns_mc->hide();
|
||||
|
||||
//// Patterns ////
|
||||
int thumbnail_size = 64;
|
||||
patterns_item_list = memnew(ItemList);
|
||||
|
|
@ -956,11 +962,10 @@ TileSetEditor::TileSetEditor() {
|
|||
patterns_item_list->set_fixed_column_width(thumbnail_size * 3 / 2);
|
||||
patterns_item_list->set_max_text_lines(2);
|
||||
patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size));
|
||||
patterns_item_list->set_scroll_hint_mode(ItemList::SCROLL_HINT_MODE_BOTH);
|
||||
patterns_item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
patterns_item_list->set_theme_type_variation("ItemListSecondary");
|
||||
patterns_item_list->connect(SceneStringName(gui_input), callable_mp(this, &TileSetEditor::_patterns_item_list_gui_input));
|
||||
main_vb->add_child(patterns_item_list);
|
||||
patterns_item_list->hide();
|
||||
patterns_mc->add_child(patterns_item_list);
|
||||
|
||||
patterns_help_label = memnew(Label);
|
||||
patterns_help_label->set_focus_mode(FOCUS_ACCESSIBILITY);
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ private:
|
|||
bool first_edit = true;
|
||||
|
||||
// Patterns.
|
||||
MarginContainer *patterns_mc = nullptr;
|
||||
ItemList *patterns_item_list = nullptr;
|
||||
Label *patterns_help_label = nullptr;
|
||||
void _patterns_item_list_gui_input(const Ref<InputEvent> &p_event);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue