diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index b08eb5c013f..695ffca1a3f 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -1,5 +1,5 @@ - + Node for 2D tile-based maps. @@ -488,9 +488,6 @@ The quadrant size does not apply on Y-sorted layers, as tiles are be grouped by Y position instead in that case. [b]Note:[/b] As quadrants are created according to the map's coordinate system, the quadrant's "square shape" might not look like square in the TileMap's local coordinate system. - - The assigned [TileSet]. - diff --git a/doc/classes/TileMapLayerGroup.xml b/doc/classes/TileMapLayerGroup.xml new file mode 100644 index 00000000000..3787d3bb17f --- /dev/null +++ b/doc/classes/TileMapLayerGroup.xml @@ -0,0 +1,17 @@ + + + + Groups a set of tile map layers together, allowing them to share a provided [TileSet]. + + + Groups together tile map layers as part or the same map, replacing the [TileMap] node. Child layers will use this node's [member tile_set]. + The editor also uses [TileMapLayerGroup] as a way to store which layers are selected in a given group. This allows highlighting the currently selected layers. + + + + + + The assigned [TileSet]. This TileSet will be applied to all child layers. + + + diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_layer_editor.cpp similarity index 76% rename from editor/plugins/tiles/tile_map_editor.cpp rename to editor/plugins/tiles/tile_map_layer_editor.cpp index c34878b54e3..1551fabc0cb 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_layer_editor.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* tile_map_editor.cpp */ +/* tile_map_layer_editor.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#include "tile_map_editor.h" +#include "tile_map_layer_editor.h" #include "tiles_editor_plugin.h" @@ -40,6 +40,7 @@ #include "editor/themes/editor_scale.h" #include "scene/2d/camera_2d.h" +#include "scene/2d/tile_map_layer.h" #include "scene/gui/center_container.h" #include "scene/gui/split_container.h" @@ -47,22 +48,26 @@ #include "core/math/geometry_2d.h" #include "core/os/keyboard.h" -void TileMapEditorTilesPlugin::tile_set_changed() { +TileMapLayer *TileMapLayerSubEditorPlugin::_get_edited_layer() const { + return Object::cast_to(ObjectDB::get_instance(edited_tile_map_layer_id)); +} + +void TileMapLayerEditorTilesPlugin::tile_set_changed() { _update_fix_selected_and_hovered(); _update_tile_set_sources_list(); _update_source_display(); _update_patterns_list(); } -void TileMapEditorTilesPlugin::_on_random_tile_checkbox_toggled(bool p_pressed) { +void TileMapLayerEditorTilesPlugin::_on_random_tile_checkbox_toggled(bool p_pressed) { scatter_controls_container->set_visible(p_pressed); } -void TileMapEditorTilesPlugin::_on_scattering_spinbox_changed(double p_value) { +void TileMapLayerEditorTilesPlugin::_on_scattering_spinbox_changed(double p_value) { scattering = p_value; } -void TileMapEditorTilesPlugin::_update_toolbar() { +void TileMapLayerEditorTilesPlugin::_update_toolbar() { // Stop draggig if needed. _stop_dragging(); @@ -96,13 +101,13 @@ void TileMapEditorTilesPlugin::_update_toolbar() { } } -void TileMapEditorTilesPlugin::_update_transform_buttons() { - TileMap *tile_map = Object::cast_to(ObjectDB::get_instance(tile_map_id)); - if (!tile_map) { +void TileMapLayerEditorTilesPlugin::_update_transform_buttons() { + TileMapLayer *edited_layer = _get_edited_layer(); + if (!edited_layer) { return; } - Ref tile_set = tile_map->get_tileset(); + Ref tile_set = edited_layer->get_effective_tile_set(); if (tile_set.is_null() || selection_pattern.is_null()) { return; } @@ -126,7 +131,7 @@ void TileMapEditorTilesPlugin::_update_transform_buttons() { } } -void TileMapEditorTilesPlugin::_set_transform_buttons_state(const Vector