From ea5845c3cdc3c36da353f0fef999cc9640597bd5 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 1 Mar 2024 15:36:53 +0100 Subject: [PATCH] Update class names in the layered tilemap module. --- modules/layered_tile_map/config.py | 4 +- .../doc_classes/LayeredTileData.xml | 42 +- .../doc_classes/LayeredTileMap.xml | 116 +- .../doc_classes/LayeredTileMapLayerGroup.xml | 12 +- .../doc_classes/LayeredTileMapPattern.xml | 8 +- .../doc_classes/LayeredTileSet.xml | 102 +- .../doc_classes/LayeredTileSetAtlasSource.xml | 24 +- .../LayeredTileSetScenesCollectionSource.xml | 14 +- .../doc_classes/LayeredTileSetSource.xml | 16 +- .../editor/atlas_merging_dialog.cpp | 22 +- .../editor/atlas_merging_dialog.h | 8 +- .../editor/layered_tile_atlas_view.cpp | 110 +- .../editor/layered_tile_atlas_view.h | 16 +- .../editor/layered_tile_data_editors.cpp | 354 +-- .../editor/layered_tile_data_editors.h | 100 +- .../editor/layered_tile_map_layer_editor.cpp | 1144 ++++----- .../editor/layered_tile_map_layer_editor.h | 86 +- .../layered_tile_proxies_manager_dialog.cpp | 80 +- .../layered_tile_proxies_manager_dialog.h | 14 +- .../layered_tile_set_atlas_source_editor.cpp | 404 +-- .../layered_tile_set_atlas_source_editor.h | 80 +- .../editor/layered_tile_set_editor.cpp | 190 +- .../editor/layered_tile_set_editor.h | 26 +- ...le_set_scenes_collection_source_editor.cpp | 108 +- ...tile_set_scenes_collection_source_editor.h | 40 +- .../editor/layered_tiles_editor_plugin.cpp | 186 +- .../editor/layered_tiles_editor_plugin.h | 48 +- ..._tilemap_navigation_geometry_parser_2d.cpp | 20 +- ...ed_tilemap_navigation_geometry_parser_2d.h | 2 +- modules/layered_tile_map/layered_tile_map.cpp | 384 +-- modules/layered_tile_map/layered_tile_map.h | 52 +- .../layered_tile_map_layer.cpp | 860 +++---- .../layered_tile_map/layered_tile_map_layer.h | 56 +- .../layered_tile_map_layer_group.cpp | 52 +- .../layered_tile_map_layer_group.h | 14 +- modules/layered_tile_map/layered_tile_set.cpp | 2164 ++++++++--------- modules/layered_tile_map/layered_tile_set.h | 168 +- modules/layered_tile_map/register_types.cpp | 10 +- 38 files changed, 3568 insertions(+), 3568 deletions(-) diff --git a/modules/layered_tile_map/config.py b/modules/layered_tile_map/config.py index a79391993..66fbdd210 100644 --- a/modules/layered_tile_map/config.py +++ b/modules/layered_tile_map/config.py @@ -7,8 +7,8 @@ def configure(env): def get_doc_classes(): return [ - "TileMap", - "TileSet" + "LayeredTileMap", + "LayeredTileSet" ] def get_doc_path(): diff --git a/modules/layered_tile_map/doc_classes/LayeredTileData.xml b/modules/layered_tile_map/doc_classes/LayeredTileData.xml index c5b86f079..eed24b537 100644 --- a/modules/layered_tile_map/doc_classes/LayeredTileData.xml +++ b/modules/layered_tile_map/doc_classes/LayeredTileData.xml @@ -1,10 +1,10 @@ - Settings for a single tile in a [TileSet]. + Settings for a single tile in a [LayeredTileSet]. - [TileData] object represents a single tile in a [TileSet]. It is usually edited using the tileset editor, but it can be modified at runtime using [method TileMap._tile_data_runtime_update]. + [TileData] object represents a single tile in a [LayeredTileSet]. It is usually edited using the tileset editor, but it can be modified at runtime using [method LayeredTileMap._tile_data_runtime_update]. @@ -13,7 +13,7 @@ - Adds a collision polygon to the tile on the given TileSet physics layer. + Adds a collision polygon to the tile on the given LayeredTileSet physics layer. @@ -21,7 +21,7 @@ - Returns the one-way margin (for one-way platforms) of the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id]. + Returns the one-way margin (for one-way platforms) of the polygon at index [param polygon_index] for LayeredTileSet physics layer with index [param layer_id]. @@ -29,14 +29,14 @@ - Returns the points of the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id]. + Returns the points of the polygon at index [param polygon_index] for LayeredTileSet physics layer with index [param layer_id]. - Returns how many polygons the tile has for TileSet physics layer with index [param layer_id]. + Returns how many polygons the tile has for LayeredTileSet physics layer with index [param layer_id]. @@ -74,7 +74,7 @@ - Returns the navigation polygon of the tile for the TileSet navigation layer with index [param layer_id]. + Returns the navigation polygon of the tile for the LayeredTileSet navigation layer with index [param layer_id]. [param flip_h], [param flip_v], and [param transpose] allow transforming the returned polygon. @@ -85,13 +85,13 @@ - Returns the occluder polygon of the tile for the TileSet occlusion layer with index [param layer_id]. + Returns the occluder polygon of the tile for the LayeredTileSet occlusion layer with index [param layer_id]. [param flip_h], [param flip_v], and [param transpose] allow transforming the returned polygon. - + Returns the tile's terrain bit for the given [param peering_bit] direction. @@ -101,7 +101,7 @@ - Returns whether one-way collisions are enabled for the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id]. + Returns whether one-way collisions are enabled for the polygon at index [param polygon_index] for LayeredTileSet physics layer with index [param layer_id]. @@ -109,7 +109,7 @@ - Removes the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id]. + Removes the polygon at index [param polygon_index] for LayeredTileSet physics layer with index [param layer_id]. @@ -118,7 +118,7 @@ - Enables/disables one-way collisions on the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id]. + Enables/disables one-way collisions on the polygon at index [param polygon_index] for LayeredTileSet physics layer with index [param layer_id]. @@ -127,7 +127,7 @@ - Enables/disables one-way collisions on the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id]. + Enables/disables one-way collisions on the polygon at index [param polygon_index] for LayeredTileSet physics layer with index [param layer_id]. @@ -136,7 +136,7 @@ - Sets the points of the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id]. + Sets the points of the polygon at index [param polygon_index] for LayeredTileSet physics layer with index [param layer_id]. @@ -144,7 +144,7 @@ - Sets the polygons count for TileSet physics layer with index [param layer_id]. + Sets the polygons count for LayeredTileSet physics layer with index [param layer_id]. @@ -168,7 +168,7 @@ - Sets the tile's custom data value for the TileSet custom data layer with name [param layer_name]. + Sets the tile's custom data value for the LayeredTileSet custom data layer with name [param layer_name]. @@ -176,7 +176,7 @@ - Sets the tile's custom data value for the TileSet custom data layer with index [param layer_id]. + Sets the tile's custom data value for the LayeredTileSet custom data layer with index [param layer_id]. @@ -184,7 +184,7 @@ - Sets the navigation polygon for the TileSet navigation layer with index [param layer_id]. + Sets the navigation polygon for the LayeredTileSet navigation layer with index [param layer_id]. @@ -192,12 +192,12 @@ - Sets the occluder for the TileSet occlusion layer with index [param layer_id]. + Sets the occluder for the LayeredTileSet occlusion layer with index [param layer_id]. - + Sets the tile's terrain bit for the given [param peering_bit] direction. @@ -236,7 +236,7 @@ Vertical point of the tile used for determining y-sorted order. - Ordering index of this tile, relative to [TileMap]. + Ordering index of this tile, relative to [LayeredTileMap]. diff --git a/modules/layered_tile_map/doc_classes/LayeredTileMap.xml b/modules/layered_tile_map/doc_classes/LayeredTileMap.xml index 5731c1065..0b9946c36 100644 --- a/modules/layered_tile_map/doc_classes/LayeredTileMap.xml +++ b/modules/layered_tile_map/doc_classes/LayeredTileMap.xml @@ -1,11 +1,11 @@ - + Node for 2D tile-based maps. - Node for 2D tile-based maps. Tilemaps use a [TileSet] which contain a list of tiles which are used to create grid-based maps. A TileMap may have several layers, layouting tiles on top of each other. - For performance reasons, all TileMap updates are batched at the end of a frame. Notably, this means that scene tiles from a [TileSetScenesCollectionSource] may be initialized after their parent. This is only queued when inside the scene tree. + Node for 2D tile-based maps. Tilemaps use a [LayeredTileSet] which contain a list of tiles which are used to create grid-based maps. A LayeredTileMap may have several layers, layouting tiles on top of each other. + For performance reasons, all LayeredTileMap updates are batched at the end of a frame. Notably, this means that scene tiles from a [LayeredTileSetScenesCollectionSource] may be initialized after their parent. This is only queued when inside the scene tree. To force an update earlier on, call [method update_internals]. @@ -24,10 +24,10 @@ - Called with a TileData object about to be used internally by the TileMap, allowing its modification at runtime. + Called with a TileData object about to be used internally by the LayeredTileMap, allowing its modification at runtime. This method is only called if [method _use_tile_data_runtime_update] is implemented and returns [code]true[/code] for the given tile [param coords] and [param layer]. - [b]Warning:[/b] The [param tile_data] object's sub-resources are the same as the one in the TileSet. Modifying them might impact the whole TileSet. Instead, make sure to duplicate those resources. - [b]Note:[/b] If the properties of [param tile_data] object should change over time, use [method notify_runtime_tile_data_update] to notify the TileMap it needs an update. + [b]Warning:[/b] The [param tile_data] object's sub-resources are the same as the one in the LayeredTileSet. Modifying them might impact the whole LayeredTileSet. Instead, make sure to duplicate those resources. + [b]Note:[/b] If the properties of [param tile_data] object should change over time, use [method notify_runtime_tile_data_update] to notify the LayeredTileMap it needs an update. @@ -37,7 +37,7 @@ Should return [code]true[/code] if the tile at coordinates [param coords] on layer [param layer] requires a runtime update. [b]Warning:[/b] Make sure this function only return [code]true[/code] when needed. Any tile processed at runtime without a need for it will imply a significant performance penalty. - [b]Note:[/b] If the result of this function should changed, use [method notify_runtime_tile_data_update] to notify the TileMap it needs an update. + [b]Note:[/b] If the result of this function should changed, use [method notify_runtime_tile_data_update] to notify the LayeredTileMap it needs an update. @@ -80,7 +80,7 @@ - Forces the TileMap and the layer [param layer] to update. + Forces the LayeredTileMap and the layer [param layer] to update. @@ -89,7 +89,7 @@ - Returns the tile alternative ID of the cell on layer [param layer] at [param coords]. If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy]. + Returns the tile alternative ID of the cell on layer [param layer] at [param coords]. If [param use_proxies] is [code]false[/code], ignores the [LayeredTileSet]'s tile proxies, returning the raw alternative identifier. See [method LayeredTileSet.map_tile_proxy]. If [param layer] is negative, the layers are accessed from the last one. @@ -99,7 +99,7 @@ - Returns the tile atlas coordinates ID of the cell on layer [param layer] at coordinates [param coords]. If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy]. + Returns the tile atlas coordinates ID of the cell on layer [param layer] at coordinates [param coords]. If [param use_proxies] is [code]false[/code], ignores the [LayeredTileSet]'s tile proxies, returning the raw alternative identifier. See [method LayeredTileSet.map_tile_proxy]. If [param layer] is negative, the layers are accessed from the last one. @@ -110,7 +110,7 @@ Returns the tile source ID of the cell on layer [param layer] at coordinates [param coords]. Returns [code]-1[/code] if the cell does not exist. - If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy]. + If [param use_proxies] is [code]false[/code], ignores the [LayeredTileSet]'s tile proxies, returning the raw alternative identifier. See [method LayeredTileSet.map_tile_proxy]. If [param layer] is negative, the layers are accessed from the last one. @@ -120,9 +120,9 @@ - Returns the [TileData] object associated with the given cell, or [code]null[/code] if the cell does not exist or is not a [TileSetAtlasSource]. + Returns the [TileData] object associated with the given cell, or [code]null[/code] if the cell does not exist or is not a [LayeredTileSetAtlasSource]. If [param layer] is negative, the layers are accessed from the last one. - If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy]. + If [param use_proxies] is [code]false[/code], ignores the [LayeredTileSet]'s tile proxies, returning the raw alternative identifier. See [method LayeredTileSet.map_tile_proxy]. [codeblock] func get_clicked_tile_power(): var clicked_cell = tile_map.local_to_map(tile_map.get_local_mouse_position()) @@ -152,7 +152,7 @@ - Returns a TileMap layer's modulate. + Returns a LayeredTileMap layer's modulate. If [param layer] is negative, the layers are accessed from the last one. @@ -160,7 +160,7 @@ - Returns a TileMap layer's name. + Returns a LayeredTileMap layer's name. If [param layer] is negative, the layers are accessed from the last one. @@ -168,9 +168,9 @@ - Returns the [RID] of the [NavigationServer2D] navigation map assigned to the specified TileMap layer [param layer]. - By default the TileMap uses the default [World2D] navigation map for the first TileMap layer. For each additional TileMap layer a new navigation map is created for the additional layer. - In order to make [NavigationAgent2D] switch between TileMap layer navigation maps use [method NavigationAgent2D.set_navigation_map] with the navigation map received from [method get_layer_navigation_map]. + Returns the [RID] of the [NavigationServer2D] navigation map assigned to the specified LayeredTileMap layer [param layer]. + By default the LayeredTileMap uses the default [World2D] navigation map for the first LayeredTileMap layer. For each additional LayeredTileMap layer a new navigation map is created for the additional layer. + In order to make [NavigationAgent2D] switch between LayeredTileMap layer navigation maps use [method NavigationAgent2D.set_navigation_map] with the navigation map received from [method get_layer_navigation_map]. If [param layer] is negative, the layers are accessed from the last one. @@ -178,7 +178,7 @@ - Returns a TileMap layer's Y sort origin. + Returns a LayeredTileMap layer's Y sort origin. If [param layer] is negative, the layers are accessed from the last one. @@ -186,37 +186,37 @@ - Returns a TileMap layer's Z-index value. + Returns a LayeredTileMap layer's Z-index value. If [param layer] is negative, the layers are accessed from the last one. - Returns the number of layers in the TileMap. + Returns the number of layers in the LayeredTileMap. - Returns the [RID] of the [NavigationServer2D] navigation map assigned to the specified TileMap layer [param layer]. + Returns the [RID] of the [NavigationServer2D] navigation map assigned to the specified LayeredTileMap layer [param layer]. - + - Returns the neighboring cell to the one at coordinates [param coords], identified by the [param neighbor] direction. This method takes into account the different layouts a TileMap can take. + Returns the neighboring cell to the one at coordinates [param coords], identified by the [param neighbor] direction. This method takes into account the different layouts a LayeredTileMap can take. - + - Creates a new [TileMapPattern] from the given layer and set of cells. + Creates a new [LayeredTileMapPattern] from the given layer and set of cells. If [param layer] is negative, the layers are accessed from the last one. @@ -288,16 +288,16 @@ - + - Returns for the given coordinate [param coords_in_pattern] in a [TileMapPattern] the corresponding cell coordinates if the pattern was pasted at the [param position_in_tilemap] coordinates (see [method set_pattern]). This mapping is required as in half-offset tile shapes, the mapping might not work by calculating [code]position_in_tile_map + coords_in_pattern[/code]. + Returns for the given coordinate [param coords_in_pattern] in a [LayeredTileMapPattern] the corresponding cell coordinates if the pattern was pasted at the [param position_in_tilemap] coordinates (see [method set_pattern]). This mapping is required as in half-offset tile shapes, the mapping might not work by calculating [code]position_in_tile_map + coords_in_pattern[/code]. - Returns the centered position of a cell in the TileMap's local coordinate space. To convert the returned value into global coordinates, use [method Node2D.to_global]. See also [method local_to_map]. + Returns the centered position of a cell in the LayeredTileMap's local coordinate space. To convert the returned value into global coordinates, use [method Node2D.to_global]. See also [method local_to_map]. [b]Note:[/b] This may not correspond to the visual position of the tile, i.e. it ignores the [member TileData.texture_origin] property of individual tiles. @@ -313,10 +313,10 @@ - Notifies the TileMap node that calls to [method _use_tile_data_runtime_update] or [method _tile_data_runtime_update] will lead to different results. This will thus trigger a TileMap update. + Notifies the LayeredTileMap node that calls to [method _use_tile_data_runtime_update] or [method _tile_data_runtime_update] will lead to different results. This will thus trigger a LayeredTileMap update. If [param layer] is provided, only notifies changes for the given layer. Providing the [param layer] argument (when applicable) is usually preferred for performance reasons. - [b]Warning:[/b] Updating the TileMap is computationally expensive and may impact performance. Try to limit the number of calls to this function to avoid unnecessary update. - [b]Note:[/b] This does not trigger a direct update of the TileMap, the update will be done at the end of the frame as usual (unless you call [method update_internals]). + [b]Warning:[/b] Updating the LayeredTileMap is computationally expensive and may impact performance. Try to limit the number of calls to this function to avoid unnecessary update. + [b]Note:[/b] This does not trigger a direct update of the LayeredTileMap, the update will be done at the end of the frame as usual (unless you call [method update_internals]). @@ -334,10 +334,10 @@ - Sets the tile identifiers for the cell on layer [param layer] at coordinates [param coords]. Each tile of the [TileSet] is identified using three parts: - - The source identifier [param source_id] identifies a [TileSetSource] identifier. See [method TileSet.set_source_id], - - The atlas coordinates identifier [param atlas_coords] identifies a tile coordinates in the atlas (if the source is a [TileSetAtlasSource]). For [TileSetScenesCollectionSource] it should always be [code]Vector2i(0, 0)[/code]), - - The alternative tile identifier [param alternative_tile] identifies a tile alternative in the atlas (if the source is a [TileSetAtlasSource]), and the scene for a [TileSetScenesCollectionSource]. + Sets the tile identifiers for the cell on layer [param layer] at coordinates [param coords]. Each tile of the [LayeredTileSet] is identified using three parts: + - The source identifier [param source_id] identifies a [LayeredTileSetSource] identifier. See [method LayeredTileSet.set_source_id], + - The atlas coordinates identifier [param atlas_coords] identifies a tile coordinates in the atlas (if the source is a [LayeredTileSetAtlasSource]). For [LayeredTileSetScenesCollectionSource] it should always be [code]Vector2i(0, 0)[/code]), + - The alternative tile identifier [param alternative_tile] identifies a tile alternative in the atlas (if the source is a [LayeredTileSetAtlasSource]), and the scene for a [LayeredTileSetScenesCollectionSource]. If [param source_id] is set to [code]-1[/code], [param atlas_coords] to [code]Vector2i(-1, -1)[/code] or [param alternative_tile] to [code]-1[/code], the cell will be erased. An erased cell gets [b]all[/b] its identifiers automatically set to their respective invalid values, namely [code]-1[/code], [code]Vector2i(-1, -1)[/code] and [code]-1[/code]. If [param layer] is negative, the layers are accessed from the last one. @@ -353,7 +353,7 @@ Update all the cells in the [param cells] coordinates array so that they use the given [param terrain] for the given [param terrain_set]. If an updated cell has the same terrain as one of its neighboring cells, this function tries to join the two. This function might update neighboring tiles if needed to create correct terrain transitions. If [param ignore_empty_terrains] is true, empty terrains will be ignored when trying to find the best fitting tile for the given terrain constraints. If [param layer] is negative, the layers are accessed from the last one. - [b]Note:[/b] To work correctly, this method requires the TileMap's TileSet to have terrains set up with all required terrain combinations. Otherwise, it may produce unexpected results. + [b]Note:[/b] To work correctly, this method requires the LayeredTileMap's LayeredTileSet to have terrains set up with all required terrain combinations. Otherwise, it may produce unexpected results. @@ -367,7 +367,7 @@ Update all the cells in the [param path] coordinates array so that they use the given [param terrain] for the given [param terrain_set]. The function will also connect two successive cell in the path with the same terrain. This function might update neighboring tiles if needed to create correct terrain transitions. If [param ignore_empty_terrains] is true, empty terrains will be ignored when trying to find the best fitting tile for the given terrain constraints. If [param layer] is negative, the layers are accessed from the last one. - [b]Note:[/b] To work correctly, this method requires the TileMap's TileSet to have terrains set up with all required terrain combinations. Otherwise, it may produce unexpected results. + [b]Note:[/b] To work correctly, this method requires the LayeredTileMap's LayeredTileSet to have terrains set up with all required terrain combinations. Otherwise, it may produce unexpected results. @@ -384,7 +384,7 @@ - Sets a layer's color. It will be multiplied by tile's color and TileMap's modulate. + Sets a layer's color. It will be multiplied by tile's color and LayeredTileMap's modulate. If [param layer] is negative, the layers are accessed from the last one. @@ -402,7 +402,7 @@ - Enables or disables a layer's built-in navigation regions generation. Disable this if you need to bake navigation regions from a TileMap using a [NavigationRegion2D] node. + Enables or disables a layer's built-in navigation regions generation. Disable this if you need to bake navigation regions from a LayeredTileMap using a [NavigationRegion2D] node. @@ -410,9 +410,9 @@ - Assigns [param map] as a [NavigationServer2D] navigation map for the specified TileMap layer [param layer]. - By default the TileMap uses the default [World2D] navigation map for the first TileMap layer. For each additional TileMap layer a new navigation map is created for the additional layer. - In order to make [NavigationAgent2D] switch between TileMap layer navigation maps use [method NavigationAgent2D.set_navigation_map] with the navigation map received from [method get_layer_navigation_map]. + Assigns [param map] as a [NavigationServer2D] navigation map for the specified LayeredTileMap layer [param layer]. + By default the LayeredTileMap uses the default [World2D] navigation map for the first LayeredTileMap layer. For each additional LayeredTileMap layer a new navigation map is created for the additional layer. + In order to make [NavigationAgent2D] switch between LayeredTileMap layer navigation maps use [method NavigationAgent2D.set_navigation_map] with the navigation map received from [method get_layer_navigation_map]. If [param layer] is negative, the layers are accessed from the last one. @@ -450,49 +450,49 @@ - Assigns [param map] as a [NavigationServer2D] navigation map for the specified TileMap layer [param layer]. + Assigns [param map] as a [NavigationServer2D] navigation map for the specified LayeredTileMap layer [param layer]. - + - Paste the given [TileMapPattern] at the given [param position] and [param layer] in the tile map. + Paste the given [LayeredTileMapPattern] at the given [param position] and [param layer] in the tile map. If [param layer] is negative, the layers are accessed from the last one. - Triggers a direct update of the TileMap. Usually, calling this function is not needed, as TileMap node updates automatically when one of its properties or cells is modified. - However, for performance reasons, those updates are batched and delayed to the end of the frame. Calling this function will force the TileMap to update right away instead. - [b]Warning:[/b] Updating the TileMap is computationally expensive and may impact performance. Try to limit the number of updates and how many tiles they impact. + Triggers a direct update of the LayeredTileMap. Usually, calling this function is not needed, as LayeredTileMap node updates automatically when one of its properties or cells is modified. + However, for performance reasons, those updates are batched and delayed to the end of the frame. Calling this function will force the LayeredTileMap to update right away instead. + [b]Warning:[/b] Updating the LayeredTileMap is computationally expensive and may impact performance. Try to limit the number of updates and how many tiles they impact. - If enabled, the TileMap will see its collisions synced to the physics tick and change its collision type from static to kinematic. This is required to create TileMap-based moving platform. - [b]Note:[/b] Enabling [member collision_animatable] may have a small performance impact, only do it if the TileMap is moving and has colliding tiles. + If enabled, the LayeredTileMap will see its collisions synced to the physics tick and change its collision type from static to kinematic. This is required to create LayeredTileMap-based moving platform. + [b]Note:[/b] Enabling [member collision_animatable] may have a small performance impact, only do it if the LayeredTileMap is moving and has colliding tiles. - - Show or hide the TileMap's collision shapes. If set to [constant VISIBILITY_MODE_DEFAULT], this depends on the show collision debug settings. + + Show or hide the LayeredTileMap's collision shapes. If set to [constant VISIBILITY_MODE_DEFAULT], this depends on the show collision debug settings. - - Show or hide the TileMap's navigation meshes. If set to [constant VISIBILITY_MODE_DEFAULT], this depends on the show navigation debug settings. + + Show or hide the LayeredTileMap's navigation meshes. If set to [constant VISIBILITY_MODE_DEFAULT], this depends on the show navigation debug settings. - The TileMap's quadrant size. A quadrant is a group of tiles to be drawn together on a single canvas item, for optimization purposes. [member rendering_quadrant_size] defines the length of a square's side, in the map's coordinate system, that forms the quadrant. Thus, the default quandrant size groups together [code]16 * 16 = 256[/code] tiles. + The LayeredTileMap's quadrant size. A quadrant is a group of tiles to be drawn together on a single canvas item, for optimization purposes. [member rendering_quadrant_size] defines the length of a square's side, in the map's coordinate system, that forms the quadrant. Thus, the default quandrant size groups together [code]16 * 16 = 256[/code] tiles. 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. + [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 LayeredTileMap's local coordinate system. - Emitted when the [TileSet] of this TileMap changes. + Emitted when the [LayeredTileSet] of this LayeredTileMap changes. diff --git a/modules/layered_tile_map/doc_classes/LayeredTileMapLayerGroup.xml b/modules/layered_tile_map/doc_classes/LayeredTileMapLayerGroup.xml index 3787d3bb1..518826098 100644 --- a/modules/layered_tile_map/doc_classes/LayeredTileMapLayerGroup.xml +++ b/modules/layered_tile_map/doc_classes/LayeredTileMapLayerGroup.xml @@ -1,17 +1,17 @@ - + - Groups a set of tile map layers together, allowing them to share a provided [TileSet]. + Groups a set of tile map layers together, allowing them to share a provided [LayeredTileSet]. - 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. + Groups together tile map layers as part or the same map, replacing the [LayeredTileMap] node. Child layers will use this node's [member tile_set]. + The editor also uses [LayeredTileMapLayerGroup] 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. + + The assigned [LayeredTileSet]. This LayeredTileSet will be applied to all child layers. diff --git a/modules/layered_tile_map/doc_classes/LayeredTileMapPattern.xml b/modules/layered_tile_map/doc_classes/LayeredTileMapPattern.xml index 1733ecf59..56d977032 100644 --- a/modules/layered_tile_map/doc_classes/LayeredTileMapPattern.xml +++ b/modules/layered_tile_map/doc_classes/LayeredTileMapPattern.xml @@ -1,10 +1,10 @@ - + - Holds a pattern to be copied from or pasted into [TileMap]s. + Holds a pattern to be copied from or pasted into [LayeredTileMap]s. - This resource holds a set of cells to help bulk manipulations of [TileMap]. + This resource holds a set of cells to help bulk manipulations of [LayeredTileMap]. A pattern always start at the [code](0,0)[/code] coordinates and cannot have cells with negative coordinates. @@ -71,7 +71,7 @@ - Sets the tile identifiers for the cell at coordinates [param coords]. See [method TileMap.set_cell]. + Sets the tile identifiers for the cell at coordinates [param coords]. See [method LayeredTileMap.set_cell]. diff --git a/modules/layered_tile_map/doc_classes/LayeredTileSet.xml b/modules/layered_tile_map/doc_classes/LayeredTileSet.xml index 37f4cc5c0..f6bad9644 100644 --- a/modules/layered_tile_map/doc_classes/LayeredTileSet.xml +++ b/modules/layered_tile_map/doc_classes/LayeredTileSet.xml @@ -1,14 +1,14 @@ - + Tile library for tilemaps. - A TileSet is a library of tiles for a [TileMap]. A TileSet handles a list of [TileSetSource], each of them storing a set of tiles. - Tiles can either be from a [TileSetAtlasSource], which renders tiles out of a texture with support for physics, navigation, etc., or from a [TileSetScenesCollectionSource], which exposes scene-based tiles. + A LayeredTileSet is a library of tiles for a [LayeredTileMap]. A LayeredTileSet handles a list of [LayeredTileSetSource], each of them storing a set of tiles. + Tiles can either be from a [LayeredTileSetAtlasSource], which renders tiles out of a texture with support for physics, navigation, etc., or from a [LayeredTileSetScenesCollectionSource], which exposes scene-based tiles. Tiles are referenced by using three IDs: their source ID, their atlas coordinates ID, and their alternative tile ID. - A TileSet can be configured so that its tiles expose more or fewer properties. To do so, the TileSet resources use property layers, which you can add or remove depending on your needs. - For example, adding a physics layer allows giving collision shapes to your tiles. Each layer has dedicated properties (physics layer and mask), so you may add several TileSet physics layers for each type of collision you need. + A LayeredTileSet can be configured so that its tiles expose more or fewer properties. To do so, the LayeredTileSet resources use property layers, which you can add or remove depending on your needs. + For example, adding a physics layer allows giving collision shapes to your tiles. Each layer has dedicated properties (physics layer and mask), so you may add several LayeredTileSet physics layers for each type of collision you need. See the functions to add new layers for more information. @@ -25,7 +25,7 @@ - Adds a custom data layer to the TileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array. + Adds a custom data layer to the LayeredTileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array. Custom data layers allow assigning custom properties to atlas tiles. @@ -33,7 +33,7 @@ - Adds a navigation layer to the TileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array. + Adds a navigation layer to the LayeredTileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array. Navigation layers allow assigning a navigable area to atlas tiles. @@ -41,34 +41,34 @@ - Adds an occlusion layer to the TileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array. + Adds an occlusion layer to the LayeredTileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array. Occlusion layers allow assigning occlusion polygons to atlas tiles. - + - Adds a [TileMapPattern] to be stored in the TileSet resource. If provided, insert it at the given [param index]. + Adds a [LayeredTileMapPattern] to be stored in the LayeredTileSet resource. If provided, insert it at the given [param index]. - Adds a physics layer to the TileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array. + Adds a physics layer to the LayeredTileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array. Physics layers allow assigning collision polygons to atlas tiles. - + - Adds a [TileSetSource] to the TileSet. If [param atlas_source_id_override] is not -1, also set its source ID. Otherwise, a unique identifier is automatically generated. + Adds a [LayeredTileSetSource] to the LayeredTileSet. If [param atlas_source_id_override] is not -1, also set its source ID. Otherwise, a unique identifier is automatically generated. The function returns the added source ID or -1 if the source could not be added. - [b]Warning:[/b] A source cannot belong to two TileSets at the same time. If the added source was attached to another [TileSet], it will be removed from that one. + [b]Warning:[/b] A source cannot belong to two LayeredTileSets at the same time. If the added source was attached to another [LayeredTileSet], it will be removed from that one. @@ -105,7 +105,7 @@ Returns the alternative-level proxy for the given identifiers. The returned array contains the three proxie's target identifiers (source ID, atlas coords ID and alternative tile ID). - If the TileSet has no proxy for the given identifiers, returns an empty Array. + If the LayeredTileSet has no proxy for the given identifiers, returns an empty Array. @@ -114,7 +114,7 @@ Returns the coordinate-level proxy for the given identifiers. The returned array contains the two target identifiers of the proxy (source ID and atlas coordinates ID). - If the TileSet has no proxy for the given identifiers, returns an empty Array. + If the LayeredTileSet has no proxy for the given identifiers, returns an empty Array. @@ -149,14 +149,14 @@ - Returns whether or not the specified navigation layer of the TileSet navigation data layer identified by the given [param layer_index] is enabled, given a navigation_layers [param layer_number] between 1 and 32. + Returns whether or not the specified navigation layer of the LayeredTileSet navigation data layer identified by the given [param layer_index] is enabled, given a navigation_layers [param layer_number] between 1 and 32. - Returns the navigation layers (as in the Navigation server) of the given TileSet navigation layer. + Returns the navigation layers (as in the Navigation server) of the given LayeredTileSet navigation layer. @@ -192,37 +192,37 @@ - + - Returns the [TileMapPattern] at the given [param index]. + Returns the [LayeredTileMapPattern] at the given [param index]. - Returns the number of [TileMapPattern] this tile set handles. + Returns the number of [LayeredTileMapPattern] this tile set handles. - Returns the collision layer (as in the physics server) bodies on the given TileSet's physics layer are in. + Returns the collision layer (as in the physics server) bodies on the given LayeredTileSet's physics layer are in. - Returns the collision mask of bodies on the given TileSet's physics layer. + Returns the collision mask of bodies on the given LayeredTileSet's physics layer. - Returns the physics material of bodies on the given TileSet's physics layer. + Returns the physics material of bodies on the given LayeredTileSet's physics layer. @@ -232,16 +232,16 @@ - + - Returns the [TileSetSource] with ID [param source_id]. + Returns the [LayeredTileSetSource] with ID [param source_id]. - Returns the number of [TileSetSource] in this TileSet. + Returns the number of [LayeredTileSetSource] in this LayeredTileSet. @@ -256,7 +256,7 @@ Returns the source-level proxy for the given source identifier. - If the TileSet has no proxy for the given identifier, returns -1. + If the LayeredTileSet has no proxy for the given identifier, returns -1. @@ -276,7 +276,7 @@ - + Returns a terrain set mode. @@ -316,7 +316,7 @@ - Returns if this TileSet has a source for the given source ID. + Returns if this LayeredTileSet has a source for the given source ID. @@ -428,7 +428,7 @@ - Remove the [TileMapPattern] at the given index. + Remove the [LayeredTileMapPattern] at the given index. @@ -477,8 +477,8 @@ Create an alternative-level proxy for the given identifiers. A proxy will map set of tile identifiers to another set of identifiers. - This can be used to replace a tile in all TileMaps using this TileSet, as TileMap nodes will find and use the proxy's target tile when one is available. - Proxied tiles can be automatically replaced in TileMap nodes using the editor. + This can be used to replace a tile in all LayeredTileMaps using this LayeredTileSet, as LayeredTileMap nodes will find and use the proxy's target tile when one is available. + Proxied tiles can be automatically replaced in LayeredTileMap nodes using the editor. @@ -489,8 +489,8 @@ Creates a coordinates-level proxy for the given identifiers. A proxy will map set of tile identifiers to another set of identifiers. The alternative tile ID is kept the same when using coordinates-level proxies. - This can be used to replace a tile in all TileMaps using this TileSet, as TileMap nodes will find and use the proxy's target tile when one is available. - Proxied tiles can be automatically replaced in TileMap nodes using the editor. + This can be used to replace a tile in all LayeredTileMaps using this LayeredTileSet, as LayeredTileMap nodes will find and use the proxy's target tile when one is available. + Proxied tiles can be automatically replaced in LayeredTileMap nodes using the editor. @@ -515,7 +515,7 @@ - Based on [param value], enables or disables the specified navigation layer of the TileSet navigation data layer identified by the given [param layer_index], given a navigation_layers [param layer_number] between 1 and 32. + Based on [param value], enables or disables the specified navigation layer of the LayeredTileSet navigation data layer identified by the given [param layer_index], given a navigation_layers [param layer_number] between 1 and 32. @@ -523,7 +523,7 @@ - Sets the navigation layers (as in the navigation server) for navigation regions in the given TileSet navigation layer. + Sets the navigation layers (as in the navigation server) for navigation regions in the given LayeredTileSet navigation layer. @@ -531,7 +531,7 @@ - Sets the occlusion layer (as in the rendering server) for occluders in the given TileSet occlusion layer. + Sets the occlusion layer (as in the rendering server) for occluders in the given LayeredTileSet occlusion layer. @@ -539,7 +539,7 @@ - Enables or disables SDF collision for occluders in the given TileSet occlusion layer. + Enables or disables SDF collision for occluders in the given LayeredTileSet occlusion layer. @@ -547,7 +547,7 @@ - Sets the physics layer (as in the physics server) for bodies in the given TileSet physics layer. + Sets the physics layer (as in the physics server) for bodies in the given LayeredTileSet physics layer. @@ -555,7 +555,7 @@ - Sets the physics layer (as in the physics server) for bodies in the given TileSet physics layer. + Sets the physics layer (as in the physics server) for bodies in the given LayeredTileSet physics layer. @@ -563,7 +563,7 @@ - Sets the physics material for bodies in the given TileSet physics layer. + Sets the physics material for bodies in the given LayeredTileSet physics layer. @@ -580,8 +580,8 @@ Creates a source-level proxy for the given source ID. A proxy will map set of tile identifiers to another set of identifiers. Both the atlas coordinates ID and the alternative tile ID are kept the same when using source-level proxies. - This can be used to replace a source in all TileMaps using this TileSet, as TileMap nodes will find and use the proxy's target source when one is available. - Proxied tiles can be automatically replaced in TileMap nodes using the editor. + This can be used to replace a source in all LayeredTileMaps using this LayeredTileSet, as LayeredTileMap nodes will find and use the proxy's target source when one is available. + Proxied tiles can be automatically replaced in LayeredTileMap nodes using the editor. @@ -590,7 +590,7 @@ - Sets a terrain's color. This color is used for identifying the different terrains in the TileSet editor. + Sets a terrain's color. This color is used for identifying the different terrains in the LayeredTileSet editor. @@ -605,20 +605,20 @@ - + Sets a terrain mode. Each mode determines which bits of a tile shape is used to match the neighboring tiles' terrains. - - For all half-offset shapes (Isometric, Hexagonal and Half-Offset square), changes the way tiles are indexed in the TileMap grid. + + For all half-offset shapes (Isometric, Hexagonal and Half-Offset square), changes the way tiles are indexed in the LayeredTileMap grid. - + For all half-offset shapes (Isometric, Hexagonal and Half-Offset square), determines the offset axis. - + The tile shape. @@ -634,7 +634,7 @@ Diamond tile shape (for isometric look). - [b]Note:[/b] Isometric [TileSet] works best if [TileMap] and all its layers have Y-sort enabled. + [b]Note:[/b] Isometric [LayeredTileSet] works best if [LayeredTileMap] and all its layers have Y-sort enabled. Rectangular tile shape with one row/column out of two offset by half a tile. diff --git a/modules/layered_tile_map/doc_classes/LayeredTileSetAtlasSource.xml b/modules/layered_tile_map/doc_classes/LayeredTileSetAtlasSource.xml index 6f212274f..d6fee6be4 100644 --- a/modules/layered_tile_map/doc_classes/LayeredTileSetAtlasSource.xml +++ b/modules/layered_tile_map/doc_classes/LayeredTileSetAtlasSource.xml @@ -1,14 +1,14 @@ - + - Exposes a 2D atlas texture as a set of tiles for a [TileSet] resource. + Exposes a 2D atlas texture as a set of tiles for a [LayeredTileSet] resource. An atlas is a grid of tiles laid out on a texture. Each tile in the grid must be exposed using [method create_tile]. Those tiles are then indexed using their coordinates in the grid. Each tile can also have a size in the grid coordinates, making it more or less cells in the atlas. Alternatives version of a tile can be created using [method create_alternative_tile], which are then indexed using an alternative ID. The main tile (the one in the grid), is accessed with an alternative ID equal to 0. - Each tile alternate has a set of properties that is defined by the source's [TileSet] layers. Those properties are stored in a TileData object that can be accessed and modified using [method get_tile_data]. - As TileData properties are stored directly in the TileSetAtlasSource resource, their properties might also be set using [code]TileSetAtlasSource.set("<coords_x>:<coords_y>/<alternative_id>/<tile_data_property>")[/code]. + Each tile alternate has a set of properties that is defined by the source's [LayeredTileSet] layers. Those properties are stored in a TileData object that can be accessed and modified using [method get_tile_data]. + As TileData properties are stored directly in the LayeredTileSetAtlasSource resource, their properties might also be set using [code]LayeredTileSetAtlasSource.set("<coords_x>:<coords_y>/<alternative_id>/<tile_data_property>")[/code]. @@ -87,7 +87,7 @@ - + Returns the tile animation mode of the tile at [param atlas_coords]. See also [method set_tile_animation_mode]. @@ -237,7 +237,7 @@ - + Sets the tile animation mode of the tile at [param atlas_coords] to [param mode]. See also [method get_tile_animation_mode]. @@ -270,11 +270,11 @@ The atlas texture. - The base tile size in the texture (in pixel). This size must be bigger than the TileSet's [code]tile_size[/code] value. + The base tile size in the texture (in pixel). This size must be bigger than the LayeredTileSet's [code]tile_size[/code] value. If [code]true[/code], generates an internal texture with an additional one pixel padding around each tile. Texture padding avoids a common artifact where lines appear between tiles. - Disabling this setting might lead a small performance improvement, as generating the internal texture requires both memory and processing time when the TileSetAtlasSource resource is modified. + Disabling this setting might lead a small performance improvement, as generating the internal texture requires both memory and processing time when the LayeredTileSetAtlasSource resource is modified. @@ -288,12 +288,12 @@ Represents the size of the [enum TileAnimationMode] enum. - Represents cell's horizontal flip flag. Should be used directly with [TileMap] to flip placed tiles by altering their alternative IDs. + Represents cell's horizontal flip flag. Should be used directly with [LayeredTileMap] to flip placed tiles by altering their alternative IDs. [codeblock] - var alternate_id = $TileMap.get_cell_alternative_tile(0, Vector2i(2, 2)) - if not alternate_id & TileSetAtlasSource.TRANSFORM_FLIP_H: + var alternate_id = $LayeredTileMap.get_cell_alternative_tile(0, Vector2i(2, 2)) + if not alternate_id & LayeredTileSetAtlasSource.TRANSFORM_FLIP_H: # If tile is not already flipped, flip it. - $TileMap.set_cell(0, Vector2i(2, 2), source_id, atlas_coords, alternate_id | TileSetAtlasSource.TRANSFORM_FLIP_H) + $LayeredTileMap.set_cell(0, Vector2i(2, 2), source_id, atlas_coords, alternate_id | LayeredTileSetAtlasSource.TRANSFORM_FLIP_H) [/codeblock] diff --git a/modules/layered_tile_map/doc_classes/LayeredTileSetScenesCollectionSource.xml b/modules/layered_tile_map/doc_classes/LayeredTileSetScenesCollectionSource.xml index 9d2742b84..f6c56c10f 100644 --- a/modules/layered_tile_map/doc_classes/LayeredTileSetScenesCollectionSource.xml +++ b/modules/layered_tile_map/doc_classes/LayeredTileSetScenesCollectionSource.xml @@ -1,11 +1,11 @@ - + - Exposes a set of scenes as tiles for a [TileSet] resource. + Exposes a set of scenes as tiles for a [LayeredTileSet] resource. - When placed on a [TileMap], tiles from [TileSetScenesCollectionSource] will automatically instantiate an associated scene at the cell's position in the TileMap. - Scenes are instantiated as children of the [TileMap] when it enters the tree. If you add/remove a scene tile in the [TileMap] that is already inside the tree, the [TileMap] will automatically instantiate/free the scene accordingly. + When placed on a [LayeredTileMap], tiles from [LayeredTileSetScenesCollectionSource] will automatically instantiate an associated scene at the cell's position in the LayeredTileMap. + Scenes are instantiated as children of the [LayeredTileMap] when it enters the tree. If you add/remove a scene tile in the [LayeredTileMap] that is already inside the tree, the [LayeredTileMap] will automatically instantiate/free the scene accordingly. @@ -49,14 +49,14 @@ - Returns the number or scene tiles this TileSet source has. + Returns the number or scene tiles this LayeredTileSet source has. - Returns whether this TileSet source has a scene tile with [param id]. + Returns whether this LayeredTileSet source has a scene tile with [param id]. @@ -87,7 +87,7 @@ - Assigns a [PackedScene] resource to the scene tile with [param id]. This will fail if the scene does not extend CanvasItem, as positioning properties are needed to place the scene on the TileMap. + Assigns a [PackedScene] resource to the scene tile with [param id]. This will fail if the scene does not extend CanvasItem, as positioning properties are needed to place the scene on the LayeredTileMap. diff --git a/modules/layered_tile_map/doc_classes/LayeredTileSetSource.xml b/modules/layered_tile_map/doc_classes/LayeredTileSetSource.xml index 70df23324..10b431937 100644 --- a/modules/layered_tile_map/doc_classes/LayeredTileSetSource.xml +++ b/modules/layered_tile_map/doc_classes/LayeredTileSetSource.xml @@ -1,14 +1,14 @@ - + - Exposes a set of tiles for a [TileSet] resource. + Exposes a set of tiles for a [LayeredTileSet] resource. - Exposes a set of tiles for a [TileSet] resource. - Tiles in a source are indexed with two IDs, coordinates ID (of type Vector2i) and an alternative ID (of type int), named according to their use in the [TileSetAtlasSource] class. - Depending on the TileSet source type, those IDs might have restrictions on their values, this is why the base [TileSetSource] class only exposes getters for them. - You can iterate over all tiles exposed by a TileSetSource by first iterating over coordinates IDs using [method get_tiles_count] and [method get_tile_id], then over alternative IDs using [method get_alternative_tiles_count] and [method get_alternative_tile_id]. - [b]Warning:[/b] [TileSetSource] can only be added to one TileSet at the same time. Calling [method TileSet.add_source] on a second [TileSet] will remove the source from the first one. + Exposes a set of tiles for a [LayeredTileSet] resource. + Tiles in a source are indexed with two IDs, coordinates ID (of type Vector2i) and an alternative ID (of type int), named according to their use in the [LayeredTileSetAtlasSource] class. + Depending on the LayeredTileSet source type, those IDs might have restrictions on their values, this is why the base [LayeredTileSetSource] class only exposes getters for them. + You can iterate over all tiles exposed by a LayeredTileSetSource by first iterating over coordinates IDs using [method get_tiles_count] and [method get_tile_id], then over alternative IDs using [method get_alternative_tiles_count] and [method get_alternative_tile_id]. + [b]Warning:[/b] [LayeredTileSetSource] can only be added to one LayeredTileSet at the same time. Calling [method LayeredTileSet.add_source] on a second [LayeredTileSet] will remove the source from the first one. @@ -26,7 +26,7 @@ Returns the number of alternatives tiles for the coordinates ID [param atlas_coords]. - For [TileSetAtlasSource], this always return at least 1, as the base tile with ID 0 is always part of the alternatives list. + For [LayeredTileSetAtlasSource], this always return at least 1, as the base tile with ID 0 is always part of the alternatives list. Returns -1 if there is not tile at the given coords. diff --git a/modules/layered_tile_map/editor/atlas_merging_dialog.cpp b/modules/layered_tile_map/editor/atlas_merging_dialog.cpp index 0504ecd60..e20a1a6f6 100644 --- a/modules/layered_tile_map/editor/atlas_merging_dialog.cpp +++ b/modules/layered_tile_map/editor/atlas_merging_dialog.cpp @@ -43,7 +43,7 @@ void AtlasMergingDialog::_property_changed(const StringName &p_property, const V _set(p_property, p_value); } -void AtlasMergingDialog::_generate_merged(const Vector> &p_atlas_sources, int p_max_columns) { +void AtlasMergingDialog::_generate_merged(const Vector> &p_atlas_sources, int p_max_columns) { merged.instantiate(); merged_mapping.clear(); @@ -53,7 +53,7 @@ void AtlasMergingDialog::_generate_merged(const Vector> // Compute the new texture region size. Vector2i new_texture_region_size; for (int source_index = 0; source_index < p_atlas_sources.size(); source_index++) { - const Ref &atlas_source = p_atlas_sources[source_index]; + const Ref &atlas_source = p_atlas_sources[source_index]; new_texture_region_size = new_texture_region_size.max(atlas_source->get_texture_region_size()); } @@ -61,7 +61,7 @@ void AtlasMergingDialog::_generate_merged(const Vector> Vector2i atlas_offset; int line_height = 0; for (int source_index = 0; source_index < p_atlas_sources.size(); source_index++) { - const Ref &atlas_source = p_atlas_sources[source_index]; + const Ref &atlas_source = p_atlas_sources[source_index]; Ref input_image = atlas_source->get_texture()->get_image(); if (input_image->get_format() != Image::FORMAT_RGBA8) { input_image->convert(Image::FORMAT_RGBA8); @@ -110,9 +110,9 @@ void AtlasMergingDialog::_generate_merged(const Vector> merged->set_texture(ImageTexture::create_from_image(output_image)); merged->set_texture_region_size(new_texture_region_size); - // Copy the tiles to the merged TileSetAtlasSource. + // Copy the tiles to the merged LayeredTileSetAtlasSource. for (int source_index = 0; source_index < p_atlas_sources.size(); source_index++) { - const Ref &atlas_source = p_atlas_sources[source_index]; + const Ref &atlas_source = p_atlas_sources[source_index]; for (KeyValue tile_mapping : merged_mapping[source_index]) { // Create tiles and alternatives, then copy their properties. for (int alternative_index = 0; alternative_index < atlas_source->get_alternative_tiles_count(tile_mapping.key); alternative_index++) { @@ -157,7 +157,7 @@ void AtlasMergingDialog::_generate_merged(const Vector> void AtlasMergingDialog::_update_texture() { Vector selected = atlas_merging_atlases_list->get_selected_items(); if (selected.size() >= 2) { - Vector> to_merge; + Vector> to_merge; for (int i = 0; i < selected.size(); i++) { int source_id = atlas_merging_atlases_list->get_item_metadata(selected[i]); to_merge.push_back(tile_set->get_source(source_id)); @@ -169,7 +169,7 @@ void AtlasMergingDialog::_update_texture() { get_ok_button()->set_disabled(false); merge_button->set_disabled(false); } else { - _generate_merged(Vector>(), next_line_after_column); + _generate_merged(Vector>(), next_line_after_column); preview->set_texture(Ref()); preview->hide(); select_2_atlases_label->show(); @@ -190,7 +190,7 @@ void AtlasMergingDialog::_merge_confirmed(const String &p_path) { merged->set_texture(new_texture_resource); EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); - undo_redo->create_action(TTR("Merge TileSetAtlasSource")); + undo_redo->create_action(TTR("Merge LayeredTileSetAtlasSource")); int next_id = tile_set->get_next_source_id(); undo_redo->add_do_method(*tile_set, "add_source", merged, next_id); undo_redo->add_undo_method(*tile_set, "remove_source", next_id); @@ -200,7 +200,7 @@ void AtlasMergingDialog::_merge_confirmed(const String &p_path) { Vector selected = atlas_merging_atlases_list->get_selected_items(); for (int i = 0; i < selected.size(); i++) { int source_id = atlas_merging_atlases_list->get_item_metadata(selected[i]); - Ref tas = tile_set->get_source(source_id); + Ref tas = tile_set->get_source(source_id); undo_redo->add_do_method(*tile_set, "remove_source", source_id); undo_redo->add_undo_method(*tile_set, "add_source", tas, source_id); @@ -270,14 +270,14 @@ void AtlasMergingDialog::_notification(int p_what) { } } -void AtlasMergingDialog::update_tile_set(Ref p_tile_set) { +void AtlasMergingDialog::update_tile_set(Ref p_tile_set) { ERR_FAIL_COND(!p_tile_set.is_valid()); tile_set = p_tile_set; atlas_merging_atlases_list->clear(); for (int i = 0; i < p_tile_set->get_source_count(); i++) { int source_id = p_tile_set->get_source_id(i); - Ref atlas_source = p_tile_set->get_source(source_id); + Ref atlas_source = p_tile_set->get_source(source_id); if (atlas_source.is_valid()) { Ref texture = atlas_source->get_texture(); if (texture.is_valid()) { diff --git a/modules/layered_tile_map/editor/atlas_merging_dialog.h b/modules/layered_tile_map/editor/atlas_merging_dialog.h index 6d61008a2..b4a71fe19 100644 --- a/modules/layered_tile_map/editor/atlas_merging_dialog.h +++ b/modules/layered_tile_map/editor/atlas_merging_dialog.h @@ -47,9 +47,9 @@ class AtlasMergingDialog : public ConfirmationDialog { private: int commited_actions_count = 0; bool delete_original_atlases = true; - Ref merged; + Ref merged; LocalVector> merged_mapping; - Ref tile_set; + Ref tile_set; // Settings. int next_line_after_column = 30; @@ -65,7 +65,7 @@ private: void _property_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing); - void _generate_merged(const Vector> &p_atlas_sources, int p_max_columns); + void _generate_merged(const Vector> &p_atlas_sources, int p_max_columns); void _update_texture(); void _merge_confirmed(const String &p_path); @@ -80,7 +80,7 @@ protected: void _notification(int p_what); public: - void update_tile_set(Ref p_tile_set); + void update_tile_set(Ref p_tile_set); AtlasMergingDialog(); }; diff --git a/modules/layered_tile_map/editor/layered_tile_atlas_view.cpp b/modules/layered_tile_map/editor/layered_tile_atlas_view.cpp index 0b14e3909..32d379d50 100644 --- a/modules/layered_tile_map/editor/layered_tile_atlas_view.cpp +++ b/modules/layered_tile_map/editor/layered_tile_atlas_view.cpp @@ -41,25 +41,25 @@ #include "scene/gui/panel.h" #include "scene/gui/view_panner.h" -void TileAtlasView::gui_input(const Ref &p_event) { +void LayeredTileAtlasView::gui_input(const Ref &p_event) { if (panner->gui_input(p_event)) { accept_event(); } } -void TileAtlasView::_pan_callback(Vector2 p_scroll_vec, Ref p_event) { +void LayeredTileAtlasView::_pan_callback(Vector2 p_scroll_vec, Ref p_event) { panning += p_scroll_vec; _update_zoom_and_panning(true); emit_signal(SNAME("transform_changed"), zoom_widget->get_zoom(), panning); } -void TileAtlasView::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref p_event) { +void LayeredTileAtlasView::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref p_event) { zoom_widget->set_zoom(zoom_widget->get_zoom() * p_zoom_factor); _update_zoom_and_panning(true); emit_signal(SNAME("transform_changed"), zoom_widget->get_zoom(), panning); } -Size2i TileAtlasView::_compute_base_tiles_control_size() { +Size2i LayeredTileAtlasView::_compute_base_tiles_control_size() { // Update the texture. Vector2i size; Ref texture = tile_set_atlas_source->get_texture(); @@ -69,7 +69,7 @@ Size2i TileAtlasView::_compute_base_tiles_control_size() { return size; } -Size2i TileAtlasView::_compute_alternative_tiles_control_size() { +Size2i LayeredTileAtlasView::_compute_alternative_tiles_control_size() { Vector2i size; for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) { Vector2i tile_id = tile_set_atlas_source->get_tile_id(i); @@ -89,7 +89,7 @@ Size2i TileAtlasView::_compute_alternative_tiles_control_size() { return size; } -void TileAtlasView::_update_zoom_and_panning(bool p_zoom_on_mouse_pos) { +void LayeredTileAtlasView::_update_zoom_and_panning(bool p_zoom_on_mouse_pos) { float zoom = zoom_widget->get_zoom(); // Compute the minimum sizes. @@ -141,35 +141,35 @@ void TileAtlasView::_update_zoom_and_panning(bool p_zoom_on_mouse_pos) { center_container->set_size(center_container->get_minimum_size()); } -void TileAtlasView::_zoom_widget_changed() { +void LayeredTileAtlasView::_zoom_widget_changed() { _update_zoom_and_panning(); emit_signal(SNAME("transform_changed"), zoom_widget->get_zoom(), panning); } -void TileAtlasView::_center_view() { +void LayeredTileAtlasView::_center_view() { panning = Vector2(); button_center_view->set_disabled(true); _update_zoom_and_panning(); emit_signal(SNAME("transform_changed"), zoom_widget->get_zoom(), panning); } -void TileAtlasView::_base_tiles_root_control_gui_input(const Ref &p_event) { +void LayeredTileAtlasView::_base_tiles_root_control_gui_input(const Ref &p_event) { base_tiles_root_control->set_tooltip_text(""); Ref mm = p_event; if (mm.is_valid()) { Transform2D xform = base_tiles_drawing_root->get_transform().affine_inverse(); Vector2i coords = get_atlas_tile_coords_at_pos(xform.xform(mm->get_position())); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { coords = tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { base_tiles_root_control->set_tooltip_text(vformat(TTR("Source: %d\nAtlas coordinates: %s\nAlternative: 0"), source_id, coords)); } } } } -void TileAtlasView::_draw_base_tiles() { +void LayeredTileAtlasView::_draw_base_tiles() { Ref texture = tile_set_atlas_source->get_texture(); if (texture.is_valid()) { Vector2i margins = tile_set_atlas_source->get_margins(); @@ -181,7 +181,7 @@ void TileAtlasView::_draw_base_tiles() { for (int x = 0; x < grid_size.x; x++) { for (int y = 0; y < grid_size.y; y++) { Vector2i coords = Vector2i(x, y); - if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { + if (tile_set_atlas_source->get_tile_at_coords(coords) == LayeredTileSetSource::INVALID_ATLAS_COORDS) { Rect2i rect = Rect2i((texture_region_size + separation) * coords + margins, texture_region_size + separation); rect = rect.intersection(Rect2i(Vector2(), texture->get_size())); if (rect.size.x > 0 && rect.size.y > 0) { @@ -195,7 +195,7 @@ void TileAtlasView::_draw_base_tiles() { for (int x = 0; x < grid_size.x; x++) { for (int y = 0; y < grid_size.y; y++) { Vector2i coords = Vector2i(x, y); - if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { + if (tile_set_atlas_source->get_tile_at_coords(coords) == LayeredTileSetSource::INVALID_ATLAS_COORDS) { Rect2i rect = Rect2i((texture_region_size + separation) * coords + margins, texture_region_size + separation); rect = rect.intersection(Rect2i(Vector2(), texture->get_size())); if (rect.size.x > 0 && rect.size.y > 0) { @@ -251,7 +251,7 @@ void TileAtlasView::_draw_base_tiles() { Vector2 offset_pos = Rect2(base_frame_rect).get_center() + Vector2(tile_set_atlas_source->get_tile_data(atlas_coords, 0)->get_texture_origin()); // Draw the tile. - TileMap::draw_tile(ci_rid, offset_pos, tile_set, source_id, atlas_coords, 0, frame); + LayeredTileMap::draw_tile(ci_rid, offset_pos, tile_set, source_id, atlas_coords, 0, frame); } } @@ -287,7 +287,7 @@ void TileAtlasView::_draw_base_tiles() { } } -RID TileAtlasView::_get_canvas_item_to_draw(const TileData *p_for_data, const CanvasItem *p_base_item, HashMap, RID> &p_material_map) { +RID LayeredTileAtlasView::_get_canvas_item_to_draw(const TileData *p_for_data, const CanvasItem *p_base_item, HashMap, RID> &p_material_map) { Ref mat = p_for_data->get_material(); if (mat.is_null()) { return p_base_item->get_canvas_item(); @@ -302,7 +302,7 @@ RID TileAtlasView::_get_canvas_item_to_draw(const TileData *p_for_data, const Ca } } -void TileAtlasView::_clear_material_canvas_items() { +void LayeredTileAtlasView::_clear_material_canvas_items() { for (KeyValue, RID> kv : material_tiles_draw) { RS::get_singleton()->free(kv.value); } @@ -314,7 +314,7 @@ void TileAtlasView::_clear_material_canvas_items() { material_alternatives_draw.clear(); } -void TileAtlasView::_draw_base_tiles_texture_grid() { +void LayeredTileAtlasView::_draw_base_tiles_texture_grid() { Ref texture = tile_set_atlas_source->get_texture(); if (texture.is_valid()) { Vector2i margins = tile_set_atlas_source->get_margins(); @@ -328,7 +328,7 @@ void TileAtlasView::_draw_base_tiles_texture_grid() { for (int y = 0; y < grid_size.y; y++) { Vector2i origin = margins + (Vector2i(x, y) * (texture_region_size + separation)); Vector2i base_tile_coords = tile_set_atlas_source->get_tile_at_coords(Vector2i(x, y)); - if (base_tile_coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (base_tile_coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { if (base_tile_coords == Vector2i(x, y)) { // Draw existing tile. Vector2i size_in_atlas = tile_set_atlas_source->get_tile_size_in_atlas(base_tile_coords); @@ -344,7 +344,7 @@ void TileAtlasView::_draw_base_tiles_texture_grid() { } } -void TileAtlasView::_draw_base_tiles_shape_grid() { +void LayeredTileAtlasView::_draw_base_tiles_shape_grid() { // Draw the shapes. Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Vector2i tile_shape_size = tile_set->get_tile_size(); @@ -367,7 +367,7 @@ void TileAtlasView::_draw_base_tiles_shape_grid() { } } -void TileAtlasView::_alternative_tiles_root_control_gui_input(const Ref &p_event) { +void LayeredTileAtlasView::_alternative_tiles_root_control_gui_input(const Ref &p_event) { alternative_tiles_root_control->set_tooltip_text(""); Ref mm = p_event; @@ -376,13 +376,13 @@ void TileAtlasView::_alternative_tiles_root_control_gui_input(const Refget_position())); Vector2i coords = Vector2i(coords3.x, coords3.y); int alternative_id = coords3.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS && alternative_id != TileSetSource::INVALID_TILE_ALTERNATIVE) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS && alternative_id != LayeredTileSetSource::INVALID_TILE_ALTERNATIVE) { alternative_tiles_root_control->set_tooltip_text(vformat(TTR("Source: %d\nAtlas coordinates: %s\nAlternative: %d"), source_id, coords, alternative_id)); } } } -void TileAtlasView::_draw_alternatives() { +void LayeredTileAtlasView::_draw_alternatives() { // Draw the alternative tiles. Ref texture = tile_set_atlas_source->get_texture(); if (texture.is_valid()) { @@ -412,7 +412,7 @@ void TileAtlasView::_draw_alternatives() { } // Draw the tile. - TileMap::draw_tile(ci_rid, offset_pos, tile_set, source_id, atlas_coords, alternative_id); + LayeredTileMap::draw_tile(ci_rid, offset_pos, tile_set, source_id, atlas_coords, alternative_id); // Increment the x position. current_pos.x += transposed ? texture_region_size.y : texture_region_size.x; @@ -424,15 +424,15 @@ void TileAtlasView::_draw_alternatives() { } } -void TileAtlasView::_draw_background_left() { +void LayeredTileAtlasView::_draw_background_left() { background_left->draw_texture_rect(theme_cache.checkerboard, Rect2(Vector2(), background_left->get_size()), true); } -void TileAtlasView::_draw_background_right() { +void LayeredTileAtlasView::_draw_background_right() { background_right->draw_texture_rect(theme_cache.checkerboard, Rect2(Vector2(), background_right->get_size()), true); } -void TileAtlasView::set_atlas_source(TileSet *p_tile_set, TileSetAtlasSource *p_tile_set_atlas_source, int p_source_id) { +void LayeredTileAtlasView::set_atlas_source(LayeredTileSet *p_tile_set, LayeredTileSetAtlasSource *p_tile_set_atlas_source, int p_source_id) { tile_set = p_tile_set; tile_set_atlas_source = p_tile_set_atlas_source; @@ -470,25 +470,25 @@ void TileAtlasView::set_atlas_source(TileSet *p_tile_set, TileSetAtlasSource *p_ background_right->queue_redraw(); } -float TileAtlasView::get_zoom() const { +float LayeredTileAtlasView::get_zoom() const { return zoom_widget->get_zoom(); }; -void TileAtlasView::set_transform(float p_zoom, Vector2i p_panning) { +void LayeredTileAtlasView::set_transform(float p_zoom, Vector2i p_panning) { zoom_widget->set_zoom(p_zoom); panning = p_panning; _update_zoom_and_panning(); }; -void TileAtlasView::set_padding(Side p_side, int p_padding) { +void LayeredTileAtlasView::set_padding(Side p_side, int p_padding) { ERR_FAIL_COND(p_padding < 0); margin_container_paddings[p_side] = p_padding; } -Vector2i TileAtlasView::get_atlas_tile_coords_at_pos(const Vector2 p_pos, bool p_clamp) const { +Vector2i LayeredTileAtlasView::get_atlas_tile_coords_at_pos(const Vector2 p_pos, bool p_clamp) const { Ref texture = tile_set_atlas_source->get_texture(); if (!texture.is_valid()) { - return TileSetSource::INVALID_ATLAS_COORDS; + return LayeredTileSetSource::INVALID_ATLAS_COORDS; } Vector2i margins = tile_set_atlas_source->get_margins(); @@ -509,7 +509,7 @@ Vector2i TileAtlasView::get_atlas_tile_coords_at_pos(const Vector2 p_pos, bool p return ret; } -void TileAtlasView::_update_alternative_tiles_rect_cache() { +void LayeredTileAtlasView::_update_alternative_tiles_rect_cache() { alternative_tiles_rect_cache.clear(); Rect2i current; @@ -539,7 +539,7 @@ void TileAtlasView::_update_alternative_tiles_rect_cache() { } } -Vector3i TileAtlasView::get_alternative_tile_at_pos(const Vector2 p_pos) const { +Vector3i LayeredTileAtlasView::get_alternative_tile_at_pos(const Vector2 p_pos) const { for (const KeyValue> &E_coords : alternative_tiles_rect_cache) { for (const KeyValue &E_alternative : E_coords.value) { if (E_alternative.value.has_point(p_pos)) { @@ -548,17 +548,17 @@ Vector3i TileAtlasView::get_alternative_tile_at_pos(const Vector2 p_pos) const { } } - return Vector3i(TileSetSource::INVALID_ATLAS_COORDS.x, TileSetSource::INVALID_ATLAS_COORDS.y, TileSetSource::INVALID_TILE_ALTERNATIVE); + return Vector3i(LayeredTileSetSource::INVALID_ATLAS_COORDS.x, LayeredTileSetSource::INVALID_ATLAS_COORDS.y, LayeredTileSetSource::INVALID_TILE_ALTERNATIVE); } -Rect2i TileAtlasView::get_alternative_tile_rect(const Vector2i p_coords, int p_alternative_tile) { +Rect2i LayeredTileAtlasView::get_alternative_tile_rect(const Vector2i p_coords, int p_alternative_tile) { ERR_FAIL_COND_V_MSG(!alternative_tiles_rect_cache.has(p_coords), Rect2i(), vformat("No cached rect for tile coords:%s", p_coords)); ERR_FAIL_COND_V_MSG(!alternative_tiles_rect_cache[p_coords].has(p_alternative_tile), Rect2i(), vformat("No cached rect for tile coords:%s alternative_id:%d", p_coords, p_alternative_tile)); return alternative_tiles_rect_cache[p_coords][p_alternative_tile]; } -void TileAtlasView::queue_redraw() { +void LayeredTileAtlasView::queue_redraw() { base_tiles_draw->queue_redraw(); base_tiles_texture_grid->queue_redraw(); base_tiles_shape_grid->queue_redraw(); @@ -567,14 +567,14 @@ void TileAtlasView::queue_redraw() { background_right->queue_redraw(); } -void TileAtlasView::_update_theme_item_cache() { +void LayeredTileAtlasView::_update_theme_item_cache() { Control::_update_theme_item_cache(); theme_cache.center_view_icon = get_editor_theme_icon(SNAME("CenterView")); theme_cache.checkerboard = get_editor_theme_icon(SNAME("Checkerboard")); } -void TileAtlasView::_notification(int p_what) { +void LayeredTileAtlasView::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { if (!EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { @@ -592,11 +592,11 @@ void TileAtlasView::_notification(int p_what) { } } -void TileAtlasView::_bind_methods() { +void LayeredTileAtlasView::_bind_methods() { ADD_SIGNAL(MethodInfo("transform_changed", PropertyInfo(Variant::FLOAT, "zoom"), PropertyInfo(Variant::VECTOR2, "scroll"))); } -TileAtlasView::TileAtlasView() { +LayeredTileAtlasView::LayeredTileAtlasView() { set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); Panel *panel = memnew(Panel); @@ -610,32 +610,32 @@ TileAtlasView::TileAtlasView() { zoom_widget = memnew(EditorZoomWidget); add_child(zoom_widget); zoom_widget->set_anchors_and_offsets_preset(Control::PRESET_TOP_LEFT, Control::PRESET_MODE_MINSIZE, 2 * EDSCALE); - zoom_widget->connect("zoom_changed", callable_mp(this, &TileAtlasView::_zoom_widget_changed).unbind(1)); + zoom_widget->connect("zoom_changed", callable_mp(this, &LayeredTileAtlasView::_zoom_widget_changed).unbind(1)); zoom_widget->set_shortcut_context(this); button_center_view = memnew(Button); button_center_view->set_anchors_and_offsets_preset(Control::PRESET_TOP_RIGHT, Control::PRESET_MODE_MINSIZE, 5); button_center_view->set_grow_direction_preset(Control::PRESET_TOP_RIGHT); - button_center_view->connect("pressed", callable_mp(this, &TileAtlasView::_center_view)); + button_center_view->connect("pressed", callable_mp(this, &LayeredTileAtlasView::_center_view)); button_center_view->set_flat(true); button_center_view->set_disabled(true); button_center_view->set_tooltip_text(TTR("Center View")); add_child(button_center_view); panner.instantiate(); - panner->set_callbacks(callable_mp(this, &TileAtlasView::_pan_callback), callable_mp(this, &TileAtlasView::_zoom_callback)); + panner->set_callbacks(callable_mp(this, &LayeredTileAtlasView::_pan_callback), callable_mp(this, &LayeredTileAtlasView::_zoom_callback)); panner->set_enable_rmb(true); center_container = memnew(CenterContainer); center_container->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); center_container->set_anchors_preset(Control::PRESET_CENTER); - center_container->connect("gui_input", callable_mp(this, &TileAtlasView::gui_input)); + center_container->connect("gui_input", callable_mp(this, &LayeredTileAtlasView::gui_input)); center_container->connect("focus_exited", callable_mp(panner.ptr(), &ViewPanner::release_pan_key)); center_container->set_focus_mode(FOCUS_CLICK); panel->add_child(center_container); missing_source_label = memnew(Label); - missing_source_label->set_text(TTR("The selected atlas source has no valid texture. Assign a texture in the TileSet bottom tab.")); + missing_source_label->set_text(TTR("The selected atlas source has no valid texture. Assign a texture in the LayeredTileSet bottom tab.")); center_container->add_child(missing_source_label); margin_container = memnew(MarginContainer); @@ -666,14 +666,14 @@ TileAtlasView::TileAtlasView() { base_tiles_root_control = memnew(Control); base_tiles_root_control->set_mouse_filter(Control::MOUSE_FILTER_PASS); base_tiles_root_control->set_v_size_flags(Control::SIZE_EXPAND_FILL); - base_tiles_root_control->connect("gui_input", callable_mp(this, &TileAtlasView::_base_tiles_root_control_gui_input)); + base_tiles_root_control->connect("gui_input", callable_mp(this, &LayeredTileAtlasView::_base_tiles_root_control_gui_input)); left_vbox->add_child(base_tiles_root_control); background_left = memnew(Control); background_left->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); background_left->set_anchors_and_offsets_preset(Control::PRESET_TOP_LEFT); background_left->set_texture_repeat(TextureRepeat::TEXTURE_REPEAT_ENABLED); - background_left->connect("draw", callable_mp(this, &TileAtlasView::_draw_background_left)); + background_left->connect("draw", callable_mp(this, &LayeredTileAtlasView::_draw_background_left)); base_tiles_root_control->add_child(background_left); base_tiles_drawing_root = memnew(Control); @@ -684,19 +684,19 @@ TileAtlasView::TileAtlasView() { base_tiles_draw = memnew(Control); base_tiles_draw->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); base_tiles_draw->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT); - base_tiles_draw->connect("draw", callable_mp(this, &TileAtlasView::_draw_base_tiles)); + base_tiles_draw->connect("draw", callable_mp(this, &LayeredTileAtlasView::_draw_base_tiles)); base_tiles_drawing_root->add_child(base_tiles_draw); base_tiles_texture_grid = memnew(Control); base_tiles_texture_grid->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); base_tiles_texture_grid->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT); - base_tiles_texture_grid->connect("draw", callable_mp(this, &TileAtlasView::_draw_base_tiles_texture_grid)); + base_tiles_texture_grid->connect("draw", callable_mp(this, &LayeredTileAtlasView::_draw_base_tiles_texture_grid)); base_tiles_drawing_root->add_child(base_tiles_texture_grid); base_tiles_shape_grid = memnew(Control); base_tiles_shape_grid->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); base_tiles_shape_grid->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT); - base_tiles_shape_grid->connect("draw", callable_mp(this, &TileAtlasView::_draw_base_tiles_shape_grid)); + base_tiles_shape_grid->connect("draw", callable_mp(this, &LayeredTileAtlasView::_draw_base_tiles_shape_grid)); base_tiles_drawing_root->add_child(base_tiles_shape_grid); // Alternative tiles. @@ -709,14 +709,14 @@ TileAtlasView::TileAtlasView() { alternative_tiles_root_control = memnew(Control); alternative_tiles_root_control->set_mouse_filter(Control::MOUSE_FILTER_PASS); alternative_tiles_root_control->set_v_size_flags(Control::SIZE_EXPAND_FILL); - alternative_tiles_root_control->connect("gui_input", callable_mp(this, &TileAtlasView::_alternative_tiles_root_control_gui_input)); + alternative_tiles_root_control->connect("gui_input", callable_mp(this, &LayeredTileAtlasView::_alternative_tiles_root_control_gui_input)); right_vbox->add_child(alternative_tiles_root_control); background_right = memnew(Control); background_right->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); background_right->set_anchors_and_offsets_preset(Control::PRESET_TOP_LEFT); background_right->set_texture_repeat(TextureRepeat::TEXTURE_REPEAT_ENABLED); - background_right->connect("draw", callable_mp(this, &TileAtlasView::_draw_background_right)); + background_right->connect("draw", callable_mp(this, &LayeredTileAtlasView::_draw_background_right)); alternative_tiles_root_control->add_child(background_right); alternative_tiles_drawing_root = memnew(Control); @@ -727,10 +727,10 @@ TileAtlasView::TileAtlasView() { alternatives_draw = memnew(Control); alternatives_draw->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); alternatives_draw->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT); - alternatives_draw->connect("draw", callable_mp(this, &TileAtlasView::_draw_alternatives)); + alternatives_draw->connect("draw", callable_mp(this, &LayeredTileAtlasView::_draw_alternatives)); alternative_tiles_drawing_root->add_child(alternatives_draw); } -TileAtlasView::~TileAtlasView() { +LayeredTileAtlasView::~LayeredTileAtlasView() { _clear_material_canvas_items(); } diff --git a/modules/layered_tile_map/editor/layered_tile_atlas_view.h b/modules/layered_tile_map/editor/layered_tile_atlas_view.h index abe74118a..9ebe71632 100644 --- a/modules/layered_tile_map/editor/layered_tile_atlas_view.h +++ b/modules/layered_tile_map/editor/layered_tile_atlas_view.h @@ -42,13 +42,13 @@ class ViewPanner; -class TileAtlasView : public Control { - GDCLASS(TileAtlasView, Control); +class LayeredTileAtlasView : public Control { + GDCLASS(LayeredTileAtlasView, Control); private: - TileSet *tile_set = nullptr; - TileSetAtlasSource *tile_set_atlas_source = nullptr; - int source_id = TileSet::INVALID_SOURCE; + LayeredTileSet *tile_set = nullptr; + LayeredTileSetAtlasSource *tile_set_atlas_source = nullptr; + int source_id = LayeredTileSet::INVALID_SOURCE; enum DragType { DRAG_TYPE_NONE, @@ -128,7 +128,7 @@ protected: public: // Global. - void set_atlas_source(TileSet *p_tile_set, TileSetAtlasSource *p_tile_set_atlas_source, int p_source_id); + void set_atlas_source(LayeredTileSet *p_tile_set, LayeredTileSetAtlasSource *p_tile_set_atlas_source, int p_source_id); float get_zoom() const; void set_transform(float p_zoom, Vector2i p_panning); @@ -168,8 +168,8 @@ public: // Redraw everything. void queue_redraw(); - TileAtlasView(); - ~TileAtlasView(); + LayeredTileAtlasView(); + ~LayeredTileAtlasView(); }; #endif // TILE_ATLAS_VIEW_H diff --git a/modules/layered_tile_map/editor/layered_tile_data_editors.cpp b/modules/layered_tile_map/editor/layered_tile_data_editors.cpp index 4d1e96eb9..685581979 100644 --- a/modules/layered_tile_map/editor/layered_tile_data_editors.cpp +++ b/modules/layered_tile_map/editor/layered_tile_data_editors.cpp @@ -52,25 +52,25 @@ #include "servers/navigation_server_2d.h" -void TileDataEditor::_tile_set_changed_plan_update() { +void LayeredTileDataEditor::_tile_set_changed_plan_update() { _tile_set_changed_update_needed = true; - callable_mp(this, &TileDataEditor::_tile_set_changed_deferred_update).call_deferred(); + callable_mp(this, &LayeredTileDataEditor::_tile_set_changed_deferred_update).call_deferred(); } -void TileDataEditor::_tile_set_changed_deferred_update() { +void LayeredTileDataEditor::_tile_set_changed_deferred_update() { if (_tile_set_changed_update_needed) { _tile_set_changed(); _tile_set_changed_update_needed = false; } } -TileData *TileDataEditor::_get_tile_data(TileMapCell p_cell) { +TileData *LayeredTileDataEditor::_get_tile_data(LayeredTileMapCell p_cell) { ERR_FAIL_COND_V(!tile_set.is_valid(), nullptr); ERR_FAIL_COND_V(!tile_set->has_source(p_cell.source_id), nullptr); TileData *td = nullptr; - TileSetSource *source = *tile_set->get_source(p_cell.source_id); - TileSetAtlasSource *atlas_source = Object::cast_to(source); + LayeredTileSetSource *source = *tile_set->get_source(p_cell.source_id); + LayeredTileSetAtlasSource *atlas_source = Object::cast_to(source); if (atlas_source) { ERR_FAIL_COND_V(!atlas_source->has_tile(p_cell.get_atlas_coords()), nullptr); ERR_FAIL_COND_V(!atlas_source->has_alternative_tile(p_cell.get_atlas_coords(), p_cell.alternative_tile), nullptr); @@ -80,17 +80,17 @@ TileData *TileDataEditor::_get_tile_data(TileMapCell p_cell) { return td; } -void TileDataEditor::_bind_methods() { +void LayeredTileDataEditor::_bind_methods() { ADD_SIGNAL(MethodInfo("needs_redraw")); } -void TileDataEditor::set_tile_set(Ref p_tile_set) { +void LayeredTileDataEditor::set_tile_set(Ref p_tile_set) { if (tile_set.is_valid()) { - tile_set->disconnect_changed(callable_mp(this, &TileDataEditor::_tile_set_changed_plan_update)); + tile_set->disconnect_changed(callable_mp(this, &LayeredTileDataEditor::_tile_set_changed_plan_update)); } tile_set = p_tile_set; if (tile_set.is_valid()) { - tile_set->connect_changed(callable_mp(this, &TileDataEditor::_tile_set_changed_plan_update)); + tile_set->connect_changed(callable_mp(this, &LayeredTileDataEditor::_tile_set_changed_plan_update)); } _tile_set_changed_plan_update(); } @@ -686,9 +686,9 @@ void GenericTilePolygonEditor::_store_snap_options() { void GenericTilePolygonEditor::_toggle_expand(bool p_expand) { if (p_expand) { - TileSetEditor::get_singleton()->add_expanded_editor(this); + LayeredTileSetEditor::get_singleton()->add_expanded_editor(this); } else { - TileSetEditor::get_singleton()->remove_expanded_editor(); + LayeredTileSetEditor::get_singleton()->remove_expanded_editor(); } } @@ -696,7 +696,7 @@ void GenericTilePolygonEditor::set_use_undo_redo(bool p_use_undo_redo) { use_undo_redo = p_use_undo_redo; } -void GenericTilePolygonEditor::set_tile_set(Ref p_tile_set) { +void GenericTilePolygonEditor::set_tile_set(Ref p_tile_set) { ERR_FAIL_COND(!p_tile_set.is_valid()); if (tile_set == p_tile_set) { return; @@ -967,7 +967,7 @@ Variant TileDataDefaultEditor::_get_painted_value() { return dummy_object->get(property); } -void TileDataDefaultEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { +void TileDataDefaultEditor::_set_painted_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL(tile_data); Variant value = tile_data->get(property); @@ -977,28 +977,28 @@ void TileDataDefaultEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_at } } -void TileDataDefaultEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { +void TileDataDefaultEditor::_set_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL(tile_data); tile_data->set(property, p_value); } -Variant TileDataDefaultEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { +Variant TileDataDefaultEditor::_get_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL_V(tile_data, Variant()); return tile_data->get(property); } -void TileDataDefaultEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) { +void TileDataDefaultEditor::_setup_undo_redo_action(LayeredTileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) { EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); - for (const KeyValue &E : p_previous_values) { + for (const KeyValue &E : p_previous_values) { Vector2i coords = E.key.get_atlas_coords(); undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/%s", coords.x, coords.y, E.key.alternative_tile, property), E.value); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/%s", coords.x, coords.y, E.key.alternative_tile, property), p_new_value); } } -void TileDataDefaultEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { +void TileDataDefaultEditor::forward_draw_over_atlas(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { if (drag_type == DRAG_TYPE_PAINT_RECT) { Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); @@ -1010,13 +1010,13 @@ void TileDataDefaultEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_ rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position()), true)); rect = rect.abs(); - RBSet edited; + RBSet edited; for (int x = rect.get_position().x; x <= rect.get_end().x; x++) { for (int y = rect.get_position().y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -1025,7 +1025,7 @@ void TileDataDefaultEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_ } } - for (const TileMapCell &E : edited) { + for (const LayeredTileMapCell &E : edited) { Vector2i coords = E.get_atlas_coords(); p_canvas_item->draw_rect(p_tile_set_atlas_source->get_tile_texture_region(coords), selection_color, false); } @@ -1033,19 +1033,19 @@ void TileDataDefaultEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_ } }; -void TileDataDefaultEditor::forward_draw_over_alternatives(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform){ +void TileDataDefaultEditor::forward_draw_over_alternatives(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform){ }; -void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { +void TileDataDefaultEditor::forward_painting_atlas_gui_input(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { Ref mm = p_event; if (mm.is_valid()) { if (drag_type == DRAG_TYPE_PAINT) { Vector line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos, true), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position(), true)); for (int i = 0; i < line.size(); i++) { Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -1067,7 +1067,7 @@ void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_ti if (picker_button->is_pressed() || (mb->is_command_or_control_pressed() && !mb->is_shift_pressed())) { Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position(), true); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { _set_painted_value(p_tile_set_atlas_source, coords, 0); picker_button->set_pressed(false); } @@ -1082,8 +1082,8 @@ void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_ti drag_painted_value = _get_painted_value(); Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position(), true); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -1104,8 +1104,8 @@ void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_ti for (int y = rect.get_position().y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -1128,7 +1128,7 @@ void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_ti } } -void TileDataDefaultEditor::forward_painting_alternatives_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { +void TileDataDefaultEditor::forward_painting_alternatives_gui_input(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { Ref mm = p_event; if (mm.is_valid()) { if (drag_type == DRAG_TYPE_PAINT) { @@ -1136,8 +1136,8 @@ void TileDataDefaultEditor::forward_painting_alternatives_gui_input(TileAtlasVie Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = alternative_tile; @@ -1159,7 +1159,7 @@ void TileDataDefaultEditor::forward_painting_alternatives_gui_input(TileAtlasVie Vector3i tile = p_tile_atlas_view->get_alternative_tile_at_pos(mb->get_position()); Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { _set_painted_value(p_tile_set_atlas_source, coords, alternative_tile); picker_button->set_pressed(false); } @@ -1172,8 +1172,8 @@ void TileDataDefaultEditor::forward_painting_alternatives_gui_input(TileAtlasVie Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = alternative_tile; @@ -1193,7 +1193,7 @@ void TileDataDefaultEditor::forward_painting_alternatives_gui_input(TileAtlasVie } } -void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { +void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected) { TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_NULL(tile_data); @@ -1214,8 +1214,8 @@ void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2 Rect2 rect = p_transform.xform(Rect2(Vector2(-size / 2, -size / 2) - texture_origin, Vector2(size, size))); p_canvas_item->draw_rect(rect, value); } else { - Ref font = TileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); - int font_size = TileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); + Ref font = LayeredTileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); + int font_size = LayeredTileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); String text; // Round floating point precision to 2 digits, as tiles don't have that much space. switch (value.get_type()) { @@ -1322,7 +1322,7 @@ TileDataDefaultEditor::~TileDataDefaultEditor() { memdelete(dummy_object); } -void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { +void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected) { TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_NULL(tile_data); @@ -1334,8 +1334,8 @@ void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Tran color = selection_color; } - TileSetSource *source = *(tile_set->get_source(p_cell.source_id)); - TileSetAtlasSource *atlas_source = Object::cast_to(source); + LayeredTileSetSource *source = *(tile_set->get_source(p_cell.source_id)); + LayeredTileSetAtlasSource *atlas_source = Object::cast_to(source); if (atlas_source->is_position_in_tile_texture_region(p_cell.get_atlas_coords(), p_cell.alternative_tile, -tile_set_tile_size / 2) && atlas_source->is_position_in_tile_texture_region(p_cell.get_atlas_coords(), p_cell.alternative_tile, tile_set_tile_size / 2 - Vector2(1, 1))) { Transform2D tile_xform; tile_xform.set_scale(tile_set_tile_size); @@ -1343,11 +1343,11 @@ void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Tran } if (atlas_source->is_position_in_tile_texture_region(p_cell.get_atlas_coords(), p_cell.alternative_tile, Vector2())) { - Ref position_icon = TileSetEditor::get_singleton()->get_editor_theme_icon(SNAME("EditorPosition")); + Ref position_icon = LayeredTileSetEditor::get_singleton()->get_editor_theme_icon(SNAME("EditorPosition")); p_canvas_item->draw_texture(position_icon, p_transform.xform(Vector2()) - (position_icon->get_size() / 2), color); } else { - Ref font = TileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); - int font_size = TileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); + Ref font = LayeredTileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); + int font_size = LayeredTileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); Vector2 texture_origin = tile_data->get_texture_origin(); String text = vformat("%s", texture_origin); Vector2 string_size = font->get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size); @@ -1356,7 +1356,7 @@ void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Tran } } -void TileDataPositionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { +void TileDataPositionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected) { TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_NULL(tile_data); @@ -1373,11 +1373,11 @@ void TileDataPositionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); color = selection_color; } - Ref position_icon = TileSetEditor::get_singleton()->get_editor_theme_icon(SNAME("EditorPosition")); + Ref position_icon = LayeredTileSetEditor::get_singleton()->get_editor_theme_icon(SNAME("EditorPosition")); p_canvas_item->draw_texture(position_icon, p_transform.xform(Vector2(value)) - position_icon->get_size() / 2, color); } -void TileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { +void TileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected) { TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_NULL(tile_data); @@ -1388,14 +1388,14 @@ void TileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D color = selection_color; } Vector2 texture_origin = tile_data->get_texture_origin(); - TileSetSource *source = *(tile_set->get_source(p_cell.source_id)); - TileSetAtlasSource *atlas_source = Object::cast_to(source); + LayeredTileSetSource *source = *(tile_set->get_source(p_cell.source_id)); + LayeredTileSetAtlasSource *atlas_source = Object::cast_to(source); if (atlas_source->is_position_in_tile_texture_region(p_cell.get_atlas_coords(), p_cell.alternative_tile, Vector2(0, tile_data->get_y_sort_origin()))) { - Ref position_icon = TileSetEditor::get_singleton()->get_editor_theme_icon(SNAME("EditorPosition")); + Ref position_icon = LayeredTileSetEditor::get_singleton()->get_editor_theme_icon(SNAME("EditorPosition")); p_canvas_item->draw_texture(position_icon, p_transform.xform(Vector2(0, tile_data->get_y_sort_origin())) - position_icon->get_size() / 2, color); } else { - Ref font = TileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); - int font_size = TileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); + Ref font = LayeredTileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); + int font_size = LayeredTileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); String text = vformat("%s", tile_data->get_y_sort_origin()); Vector2 string_size = font->get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size); @@ -1404,7 +1404,7 @@ void TileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D } } -void TileDataOcclusionShapeEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { +void TileDataOcclusionShapeEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected) { TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_NULL(tile_data); @@ -1436,7 +1436,7 @@ Variant TileDataOcclusionShapeEditor::_get_painted_value() { return occluder_polygon; } -void TileDataOcclusionShapeEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { +void TileDataOcclusionShapeEditor::_set_painted_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL(tile_data); @@ -1448,7 +1448,7 @@ void TileDataOcclusionShapeEditor::_set_painted_value(TileSetAtlasSource *p_tile polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate()); } -void TileDataOcclusionShapeEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { +void TileDataOcclusionShapeEditor::_set_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL(tile_data); Ref occluder_polygon = p_value; @@ -1457,15 +1457,15 @@ void TileDataOcclusionShapeEditor::_set_value(TileSetAtlasSource *p_tile_set_atl polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate()); } -Variant TileDataOcclusionShapeEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { +Variant TileDataOcclusionShapeEditor::_get_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL_V(tile_data, Variant()); return tile_data->get_occluder(occlusion_layer); } -void TileDataOcclusionShapeEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) { +void TileDataOcclusionShapeEditor::_setup_undo_redo_action(LayeredTileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) { EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); - for (const KeyValue &E : p_previous_values) { + for (const KeyValue &E : p_previous_values) { Vector2i coords = E.key.get_atlas_coords(); undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/occlusion_layer_%d/polygon", coords.x, coords.y, E.key.alternative_tile, occlusion_layer), E.value); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/occlusion_layer_%d/polygon", coords.x, coords.y, E.key.alternative_tile, occlusion_layer), p_new_value); @@ -1578,7 +1578,7 @@ Variant TileDataCollisionEditor::_get_painted_value() { return dict; } -void TileDataCollisionEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { +void TileDataCollisionEditor::_set_painted_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL(tile_data); @@ -1604,7 +1604,7 @@ void TileDataCollisionEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_ polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate()); } -void TileDataCollisionEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { +void TileDataCollisionEditor::_set_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL(tile_data); @@ -1623,7 +1623,7 @@ void TileDataCollisionEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_so polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate()); } -Variant TileDataCollisionEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { +Variant TileDataCollisionEditor::_get_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL_V(tile_data, Variant()); @@ -1642,10 +1642,10 @@ Variant TileDataCollisionEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas return dict; } -void TileDataCollisionEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) { +void TileDataCollisionEditor::_setup_undo_redo_action(LayeredTileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) { Dictionary new_dict = p_new_value; EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); - for (const KeyValue &E : p_previous_values) { + for (const KeyValue &E : p_previous_values) { Vector2i coords = E.key.get_atlas_coords(); Dictionary old_dict = E.value; @@ -1724,7 +1724,7 @@ TileDataCollisionEditor::~TileDataCollisionEditor() { memdelete(dummy_object); } -void TileDataCollisionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { +void TileDataCollisionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected) { TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_NULL(tile_data); @@ -1840,16 +1840,16 @@ void TileDataTerrainsEditor::_tile_set_changed() { _update_terrain_selector(); } -void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { +void TileDataTerrainsEditor::forward_draw_over_atlas(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { ERR_FAIL_COND(!tile_set.is_valid()); // Draw the hovered terrain bit, or the whole tile if it has the wrong terrain set. - Vector2i hovered_coords = TileSetSource::INVALID_ATLAS_COORDS; + Vector2i hovered_coords = LayeredTileSetSource::INVALID_ATLAS_COORDS; if (drag_type == DRAG_TYPE_NONE) { Vector2i mouse_pos = p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position()); hovered_coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mouse_pos); hovered_coords = p_tile_set_atlas_source->get_tile_at_coords(hovered_coords); - if (hovered_coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (hovered_coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(hovered_coords, 0); int terrain_set = tile_data->get_terrain_set(); Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(hovered_coords); @@ -1868,8 +1868,8 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas p_canvas_item->draw_set_transform_matrix(p_transform * xform); p_canvas_item->draw_polygon(polygon, color); } - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) { polygon = tile_set->get_terrain_peering_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(xform.affine_inverse().xform(mouse_pos), polygon)) { @@ -1889,8 +1889,8 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas } // Dim terrains with wrong terrain set. - Ref font = TileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); - int font_size = TileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); + Ref font = LayeredTileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); + int font_size = LayeredTileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); for (int i = 0; i < p_tile_set_atlas_source->get_tiles_count(); i++) { Vector2i coords = p_tile_set_atlas_source->get_tile_id(i); if (coords != hovered_coords) { @@ -1933,13 +1933,13 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position()), true)); rect = rect.abs(); - RBSet edited; + RBSet edited; for (int x = rect.get_position().x; x <= rect.get_end().x; x++) { for (int y = rect.get_position().y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -1948,7 +1948,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas } } - for (const TileMapCell &E : edited) { + for (const LayeredTileMapCell &E : edited) { Vector2i coords = E.get_atlas_coords(); p_canvas_item->draw_rect(p_tile_set_atlas_source->get_tile_texture_region(coords), selection_color, false); } @@ -1963,15 +1963,15 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position()), true)); rect = rect.abs(); - RBSet edited; + RBSet edited; for (int x = rect.get_position().x; x <= rect.get_end().x; x++) { for (int y = rect.get_position().y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0); if (tile_data->get_terrain_set() == terrain_set) { - TileMapCell cell; + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -1993,7 +1993,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas p_canvas_item->draw_set_transform_matrix(p_transform); - for (const TileMapCell &E : edited) { + for (const LayeredTileMapCell &E : edited) { Vector2i coords = E.get_atlas_coords(); Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords); @@ -2008,8 +2008,8 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas p_canvas_item->draw_polygon(polygon, color); } - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) { polygon = tile_set->get_terrain_peering_bit_polygon(terrain_set, bit); for (int j = 0; j < polygon.size(); j++) { @@ -2027,18 +2027,18 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas } } -void TileDataTerrainsEditor::forward_draw_over_alternatives(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { +void TileDataTerrainsEditor::forward_draw_over_alternatives(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { ERR_FAIL_COND(!tile_set.is_valid()); // Draw the hovered terrain bit, or the whole tile if it has the wrong terrain set. - Vector2i hovered_coords = TileSetSource::INVALID_ATLAS_COORDS; - int hovered_alternative = TileSetSource::INVALID_TILE_ALTERNATIVE; + Vector2i hovered_coords = LayeredTileSetSource::INVALID_ATLAS_COORDS; + int hovered_alternative = LayeredTileSetSource::INVALID_TILE_ALTERNATIVE; if (drag_type == DRAG_TYPE_NONE) { Vector2i mouse_pos = p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position()); Vector3i hovered = p_tile_atlas_view->get_alternative_tile_at_pos(mouse_pos); hovered_coords = Vector2i(hovered.x, hovered.y); hovered_alternative = hovered.z; - if (hovered_coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (hovered_coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(hovered_coords, hovered_alternative); int terrain_set = tile_data->get_terrain_set(); Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(hovered_coords, hovered_alternative); @@ -2058,8 +2058,8 @@ void TileDataTerrainsEditor::forward_draw_over_alternatives(TileAtlasView *p_til p_canvas_item->draw_polygon(polygon, color); } - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) { polygon = tile_set->get_terrain_peering_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(xform.affine_inverse().xform(mouse_pos), polygon)) { @@ -2079,8 +2079,8 @@ void TileDataTerrainsEditor::forward_draw_over_alternatives(TileAtlasView *p_til } // Dim terrains with wrong terrain set. - Ref font = TileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); - int font_size = TileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); + Ref font = LayeredTileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); + int font_size = LayeredTileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); for (int i = 0; i < p_tile_set_atlas_source->get_tiles_count(); i++) { Vector2i coords = p_tile_set_atlas_source->get_tile_id(i); for (int j = 1; j < p_tile_set_atlas_source->get_alternative_tiles_count(coords); j++) { @@ -2116,16 +2116,16 @@ void TileDataTerrainsEditor::forward_draw_over_alternatives(TileAtlasView *p_til p_canvas_item->draw_set_transform_matrix(Transform2D()); } -void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { +void TileDataTerrainsEditor::forward_painting_atlas_gui_input(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { Ref mm = p_event; if (mm.is_valid()) { if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET) { Vector line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos, true), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position(), true)); for (int i = 0; i < line.size(); i++) { Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { int terrain_set = drag_painted_value; - TileMapCell cell; + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -2137,8 +2137,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t dict["terrain_set"] = tile_data->get_terrain_set(); dict["terrain"] = tile_data->get_terrain(); Array array; - for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + for (int j = 0; j < LayeredTileSet::CELL_NEIGHBOR_MAX; j++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(j); array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2157,8 +2157,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t Vector line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos, true), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position(), true)); for (int i = 0; i < line.size(); i++) { Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -2171,8 +2171,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t dict["terrain_set"] = tile_data->get_terrain_set(); dict["terrain"] = tile_data->get_terrain(); Array array; - for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + for (int j = 0; j < LayeredTileSet::CELL_NEIGHBOR_MAX; j++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(j); array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2187,8 +2187,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t if (Geometry2D::is_segment_intersecting_polygon(mm->get_position() - position, drag_last_pos - position, polygon)) { tile_data->set_terrain(terrain); } - for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + for (int j = 0; j < LayeredTileSet::CELL_NEIGHBOR_MAX; j++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(j); if (tile_data->is_valid_terrain_peering_bit(bit)) { polygon = tile_set->get_terrain_peering_bit_polygon(tile_data->get_terrain_set(), bit); if (Geometry2D::is_segment_intersecting_polygon(mm->get_position() - position, drag_last_pos - position, polygon)) { @@ -2211,7 +2211,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t if (picker_button->is_pressed() || (mb->is_command_or_control_pressed() && !mb->is_shift_pressed())) { Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0); int terrain_set = tile_data->get_terrain_set(); Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords); @@ -2223,8 +2223,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { dummy_object->set("terrain", tile_data->get_terrain()); } - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) { polygon = tile_set->get_terrain_peering_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { @@ -2241,7 +2241,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); TileData *tile_data = nullptr; - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetAtlasSource::INVALID_ATLAS_COORDS) { tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0); } int terrain_set = int(dummy_object->get("terrain_set")); @@ -2263,8 +2263,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t drag_modified.clear(); drag_painted_value = terrain_set; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -2274,8 +2274,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t dict["terrain_set"] = tile_data->get_terrain_set(); dict["terrain"] = tile_data->get_terrain(); Array array; - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2310,8 +2310,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t painted_dict["terrain"] = terrain; drag_painted_value = painted_dict; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -2321,8 +2321,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t dict["terrain_set"] = tile_data->get_terrain_set(); dict["terrain"] = tile_data->get_terrain(); Array array; - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2336,8 +2336,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { tile_data->set_terrain(terrain); } - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) { polygon = tile_set->get_terrain_peering_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { @@ -2359,13 +2359,13 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position(), true)); rect = rect.abs(); - RBSet edited; + RBSet edited; for (int x = rect.get_position().x; x <= rect.get_end().x; x++) { for (int y = rect.get_position().y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -2374,17 +2374,17 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t } } undo_redo->create_action(TTR("Painting Terrain Set")); - for (const TileMapCell &E : edited) { + for (const LayeredTileMapCell &E : edited) { Vector2i coords = E.get_atlas_coords(); TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.alternative_tile), drag_painted_value); undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.alternative_tile), tile_data->get_terrain_set()); if (tile_data->get_terrain_set() >= 0) { undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.alternative_tile), tile_data->get_terrain()); - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_data->is_valid_terrain_peering_bit(bit)) { - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), tile_data->get_terrain_peering_bit(bit)); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(LayeredTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), tile_data->get_terrain_peering_bit(bit)); } } } @@ -2394,7 +2394,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t accept_event(); } else if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET) { undo_redo->create_action(TTR("Painting Terrain Set")); - for (KeyValue &E : drag_modified) { + for (KeyValue &E : drag_modified) { Dictionary dict = E.value; Vector2i coords = E.key.get_atlas_coords(); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.key.alternative_tile), drag_painted_value); @@ -2403,9 +2403,9 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.key.alternative_tile), dict["terrain"]); Array array = dict["terrain_peering_bits"]; for (int i = 0; i < array.size(); i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(dict["terrain_set"], bit)) { - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(LayeredTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); } } } @@ -2418,19 +2418,19 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t int terrain_set = int(painted["terrain_set"]); int terrain = int(painted["terrain"]); undo_redo->create_action(TTR("Painting Terrain")); - for (KeyValue &E : drag_modified) { + for (KeyValue &E : drag_modified) { Dictionary dict = E.value; Vector2i coords = E.key.get_atlas_coords(); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.key.alternative_tile), terrain); undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.key.alternative_tile), dict["terrain"]); Array array = dict["terrain_peering_bits"]; for (int i = 0; i < array.size(); i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) { - undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), terrain); + undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(LayeredTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), terrain); } if (tile_set->is_valid_terrain_peering_bit(dict["terrain_set"], bit)) { - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(LayeredTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); } } } @@ -2447,15 +2447,15 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position(), true)); rect = rect.abs(); - RBSet edited; + RBSet edited; for (int x = rect.get_position().x; x <= rect.get_end().x; x++) { for (int y = rect.get_position().y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0); if (tile_data->get_terrain_set() == terrain_set) { - TileMapCell cell; + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -2472,7 +2472,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t mouse_pos_rect_polygon.push_back(Vector2(drag_start_pos.x, mb->get_position().y)); undo_redo->create_action(TTR("Painting Terrain")); - for (const TileMapCell &E : edited) { + for (const LayeredTileMapCell &E : edited) { Vector2i coords = E.get_atlas_coords(); TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0); @@ -2489,8 +2489,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.alternative_tile), tile_data->get_terrain()); } - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) { polygon = tile_set->get_terrain_peering_bit_polygon(terrain_set, bit); for (int j = 0; j < polygon.size(); j++) { @@ -2498,8 +2498,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t } if (!Geometry2D::intersect_polygons(polygon, mouse_pos_rect_polygon).is_empty()) { // Draw bit. - undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), terrain); - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), tile_data->get_terrain_peering_bit(bit)); + undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(LayeredTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), terrain); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(LayeredTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.alternative_tile), tile_data->get_terrain_peering_bit(bit)); } } } @@ -2513,7 +2513,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t } } -void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { +void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { Ref mm = p_event; if (mm.is_valid()) { if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET) { @@ -2521,8 +2521,8 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = alternative_tile; @@ -2532,8 +2532,8 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi dict["terrain_set"] = tile_data->get_terrain_set(); dict["terrain"] = tile_data->get_terrain(); Array array; - for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + for (int j = 0; j < LayeredTileSet::CELL_NEIGHBOR_MAX; j++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(j); array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2553,8 +2553,8 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = alternative_tile; @@ -2567,8 +2567,8 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi dict["terrain_set"] = tile_data->get_terrain_set(); dict["terrain"] = tile_data->get_terrain(); Array array; - for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + for (int j = 0; j < LayeredTileSet::CELL_NEIGHBOR_MAX; j++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(j); array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2584,8 +2584,8 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi tile_data->set_terrain(terrain); } - for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + for (int j = 0; j < LayeredTileSet::CELL_NEIGHBOR_MAX; j++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(j); if (tile_data->is_valid_terrain_peering_bit(bit)) { polygon = tile_set->get_terrain_peering_bit_polygon(tile_data->get_terrain_set(), bit); if (Geometry2D::is_segment_intersecting_polygon(mm->get_position() - position, drag_last_pos - position, polygon)) { @@ -2609,7 +2609,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, alternative_tile); int terrain_set = tile_data->get_terrain_set(); Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile); @@ -2622,8 +2622,8 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi dummy_object->set("terrain", tile_data->get_terrain()); } - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) { polygon = tile_set->get_terrain_peering_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { @@ -2644,7 +2644,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, alternative_tile); if (terrain_set == -1 || !tile_data || tile_data->get_terrain_set() != terrain_set) { @@ -2652,16 +2652,16 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi drag_type = DRAG_TYPE_PAINT_TERRAIN_SET; drag_modified.clear(); drag_painted_value = int(dummy_object->get("terrain_set")); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = alternative_tile; Dictionary dict; dict["terrain_set"] = tile_data->get_terrain_set(); Array array; - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2683,8 +2683,8 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi painted_dict["terrain"] = terrain; drag_painted_value = painted_dict; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != LayeredTileSetSource::INVALID_ATLAS_COORDS) { + LayeredTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = alternative_tile; @@ -2694,8 +2694,8 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi dict["terrain_set"] = tile_data->get_terrain_set(); dict["terrain"] = tile_data->get_terrain(); Array array; - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); array.push_back(tile_data->is_valid_terrain_peering_bit(bit) ? tile_data->get_terrain_peering_bit(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2709,8 +2709,8 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { tile_data->set_terrain(terrain); } - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < LayeredTileSet::CELL_NEIGHBOR_MAX; i++) { + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) { polygon = tile_set->get_terrain_peering_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { @@ -2728,7 +2728,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET) { undo_redo->create_action(TTR("Painting Tiles Property")); - for (KeyValue &E : drag_modified) { + for (KeyValue &E : drag_modified) { Dictionary dict = E.value; Vector2i coords = E.key.get_atlas_coords(); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.key.alternative_tile), drag_painted_value); @@ -2737,7 +2737,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.key.alternative_tile), dict["terrain"]); Array array = dict["terrain_peering_bits"]; for (int i = 0; i < array.size(); i++) { - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(LayeredTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); } } } @@ -2749,19 +2749,19 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi int terrain_set = int(painted["terrain_set"]); int terrain = int(painted["terrain"]); undo_redo->create_action(TTR("Painting Terrain")); - for (KeyValue &E : drag_modified) { + for (KeyValue &E : drag_modified) { Dictionary dict = E.value; Vector2i coords = E.key.get_atlas_coords(); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.key.alternative_tile), terrain); undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain", coords.x, coords.y, E.key.alternative_tile), dict["terrain"]); Array array = dict["terrain_peering_bits"]; for (int i = 0; i < array.size(); i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + LayeredTileSet::CellNeighbor bit = LayeredTileSet::CellNeighbor(i); if (tile_set->is_valid_terrain_peering_bit(terrain_set, bit)) { - undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), terrain); + undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(LayeredTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), terrain); } if (tile_set->is_valid_terrain_peering_bit(dict["terrain_set"], bit)) { - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(LayeredTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); } } } @@ -2774,7 +2774,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi } } -void TileDataTerrainsEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { +void TileDataTerrainsEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected) { TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_NULL(tile_data); @@ -2850,7 +2850,7 @@ Variant TileDataNavigationEditor::_get_painted_value() { return nav_polygon; } -void TileDataNavigationEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { +void TileDataNavigationEditor::_set_painted_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL(tile_data); @@ -2864,7 +2864,7 @@ void TileDataNavigationEditor::_set_painted_value(TileSetAtlasSource *p_tile_set polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate()); } -void TileDataNavigationEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { +void TileDataNavigationEditor::_set_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL(tile_data); Ref nav_polygon = p_value; @@ -2873,15 +2873,15 @@ void TileDataNavigationEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_s polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate()); } -Variant TileDataNavigationEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { +Variant TileDataNavigationEditor::_get_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { TileData *tile_data = p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile); ERR_FAIL_NULL_V(tile_data, Variant()); return tile_data->get_navigation_polygon(navigation_layer); } -void TileDataNavigationEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) { +void TileDataNavigationEditor::_setup_undo_redo_action(LayeredTileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) { EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); - for (const KeyValue &E : p_previous_values) { + for (const KeyValue &E : p_previous_values) { Vector2i coords = E.key.get_atlas_coords(); undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/navigation_layer_%d/polygon", coords.x, coords.y, E.key.alternative_tile, navigation_layer), E.value); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/navigation_layer_%d/polygon", coords.x, coords.y, E.key.alternative_tile, navigation_layer), p_new_value); @@ -2908,7 +2908,7 @@ TileDataNavigationEditor::TileDataNavigationEditor() { add_child(polygon_editor); } -void TileDataNavigationEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { +void TileDataNavigationEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected) { TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_NULL(tile_data); diff --git a/modules/layered_tile_map/editor/layered_tile_data_editors.h b/modules/layered_tile_map/editor/layered_tile_data_editors.h index fce3bfc2a..701340844 100644 --- a/modules/layered_tile_map/editor/layered_tile_data_editors.h +++ b/modules/layered_tile_map/editor/layered_tile_data_editors.h @@ -44,8 +44,8 @@ class MenuButton; class SpinBox; class EditorUndoRedoManager; -class TileDataEditor : public VBoxContainer { - GDCLASS(TileDataEditor, VBoxContainer); +class LayeredTileDataEditor : public VBoxContainer { + GDCLASS(LayeredTileDataEditor, VBoxContainer); private: bool _tile_set_changed_update_needed = false; @@ -53,24 +53,24 @@ private: void _tile_set_changed_deferred_update(); protected: - Ref tile_set; - TileData *_get_tile_data(TileMapCell p_cell); + Ref tile_set; + TileData *_get_tile_data(LayeredTileMapCell p_cell); virtual void _tile_set_changed(){}; static void _bind_methods(); public: - void set_tile_set(Ref p_tile_set); + void set_tile_set(Ref p_tile_set); // Input to handle painting. virtual Control *get_toolbar() { return nullptr; }; - virtual void forward_draw_over_atlas(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform){}; - virtual void forward_draw_over_alternatives(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform){}; - virtual void forward_painting_atlas_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, const Ref &p_event){}; - virtual void forward_painting_alternatives_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, const Ref &p_event){}; + virtual void forward_draw_over_atlas(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform){}; + virtual void forward_draw_over_alternatives(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform){}; + virtual void forward_painting_atlas_gui_input(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, const Ref &p_event){}; + virtual void forward_painting_alternatives_gui_input(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, const Ref &p_event){}; // Used to draw the tile data property value over a tile. - virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected = false){}; + virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected = false){}; }; class DummyObject : public Object { @@ -93,7 +93,7 @@ class GenericTilePolygonEditor : public VBoxContainer { GDCLASS(GenericTilePolygonEditor, VBoxContainer); private: - Ref tile_set; + Ref tile_set; LocalVector> polygons; bool multiple_polygon_mode = false; @@ -182,7 +182,7 @@ protected: public: void set_use_undo_redo(bool p_use_undo_redo); - void set_tile_set(Ref p_tile_set); + void set_tile_set(Ref p_tile_set); void set_background(Ref p_texture, Rect2 p_region = Rect2(), Vector2 p_offset = Vector2(), bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false, Color p_modulate = Color(1.0, 1.0, 1.0, 0.0)); int get_polygon_count(); @@ -198,8 +198,8 @@ public: GenericTilePolygonEditor(); }; -class TileDataDefaultEditor : public TileDataEditor { - GDCLASS(TileDataDefaultEditor, TileDataEditor); +class TileDataDefaultEditor : public LayeredTileDataEditor { + GDCLASS(TileDataDefaultEditor, LayeredTileDataEditor); private: // Toolbar @@ -222,7 +222,7 @@ private: DragType drag_type = DRAG_TYPE_NONE; Vector2 drag_start_pos; Vector2 drag_last_pos; - HashMap drag_modified; + HashMap drag_modified; Variant drag_painted_value; void _property_value_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field); @@ -236,18 +236,18 @@ protected: void _notification(int p_what); virtual Variant _get_painted_value(); - virtual void _set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile); - virtual void _set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value); - virtual Variant _get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile); - virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value); + virtual void _set_painted_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile); + virtual void _set_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value); + virtual Variant _get_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile); + virtual void _setup_undo_redo_action(LayeredTileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value); public: virtual Control *get_toolbar() override { return toolbar; }; - virtual void forward_draw_over_atlas(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) override; - virtual void forward_draw_over_alternatives(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) override; - virtual void forward_painting_atlas_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, const Ref &p_event) override; - virtual void forward_painting_alternatives_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, const Ref &p_event) override; - virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected = false) override; + virtual void forward_draw_over_atlas(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) override; + virtual void forward_draw_over_alternatives(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) override; + virtual void forward_painting_atlas_gui_input(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, const Ref &p_event) override; + virtual void forward_painting_alternatives_gui_input(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, const Ref &p_event) override; + virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected = false) override; void setup_property_editor(Variant::Type p_type, const String &p_property, const String &p_label = "", const Variant &p_default_value = Variant()); Variant::Type get_property_type(); @@ -260,21 +260,21 @@ class TileDataTextureOriginEditor : public TileDataDefaultEditor { GDCLASS(TileDataTextureOriginEditor, TileDataDefaultEditor); public: - virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected = false) override; + virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected = false) override; }; class TileDataPositionEditor : public TileDataDefaultEditor { GDCLASS(TileDataPositionEditor, TileDataDefaultEditor); public: - virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected = false) override; + virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected = false) override; }; class TileDataYSortEditor : public TileDataDefaultEditor { GDCLASS(TileDataYSortEditor, TileDataDefaultEditor); public: - virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected = false) override; + virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected = false) override; }; class TileDataOcclusionShapeEditor : public TileDataDefaultEditor { @@ -289,10 +289,10 @@ private: void _polygon_changed(const PackedVector2Array &p_polygon); virtual Variant _get_painted_value() override; - virtual void _set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; - virtual void _set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) override; - virtual Variant _get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; - virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) override; + virtual void _set_painted_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; + virtual void _set_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) override; + virtual Variant _get_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; + virtual void _setup_undo_redo_action(LayeredTileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) override; protected: virtual void _tile_set_changed() override; @@ -300,7 +300,7 @@ protected: void _notification(int p_what); public: - virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected = false) override; + virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected = false) override; void set_occlusion_layer(int p_occlusion_layer) { occlusion_layer = p_occlusion_layer; } @@ -322,10 +322,10 @@ class TileDataCollisionEditor : public TileDataDefaultEditor { void _polygons_changed(); virtual Variant _get_painted_value() override; - virtual void _set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; - virtual void _set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) override; - virtual Variant _get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; - virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) override; + virtual void _set_painted_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; + virtual void _set_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) override; + virtual Variant _get_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; + virtual void _setup_undo_redo_action(LayeredTileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) override; protected: virtual void _tile_set_changed() override; @@ -333,7 +333,7 @@ protected: void _notification(int p_what); public: - virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected = false) override; + virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected = false) override; void set_physics_layer(int p_physics_layer) { physics_layer = p_physics_layer; } @@ -341,8 +341,8 @@ public: ~TileDataCollisionEditor(); }; -class TileDataTerrainsEditor : public TileDataEditor { - GDCLASS(TileDataTerrainsEditor, TileDataEditor); +class TileDataTerrainsEditor : public LayeredTileDataEditor { + GDCLASS(TileDataTerrainsEditor, LayeredTileDataEditor); private: // Toolbar @@ -360,7 +360,7 @@ private: DragType drag_type = DRAG_TYPE_NONE; Vector2 drag_start_pos; Vector2 drag_last_pos; - HashMap drag_modified; + HashMap drag_modified; Variant drag_painted_value; // UI @@ -380,11 +380,11 @@ protected: public: virtual Control *get_toolbar() override { return toolbar; }; - virtual void forward_draw_over_atlas(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) override; - virtual void forward_draw_over_alternatives(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) override; - virtual void forward_painting_atlas_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, const Ref &p_event) override; - virtual void forward_painting_alternatives_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_atlas_source, const Ref &p_event) override; - virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected = false) override; + virtual void forward_draw_over_atlas(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) override; + virtual void forward_draw_over_alternatives(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) override; + virtual void forward_painting_atlas_gui_input(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, const Ref &p_event) override; + virtual void forward_painting_alternatives_gui_input(LayeredTileAtlasView *p_tile_atlas_view, LayeredTileSetAtlasSource *p_tile_atlas_source, const Ref &p_event) override; + virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected = false) override; TileDataTerrainsEditor(); ~TileDataTerrainsEditor(); @@ -403,10 +403,10 @@ private: void _polygon_changed(const PackedVector2Array &p_polygon); virtual Variant _get_painted_value() override; - virtual void _set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; - virtual void _set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) override; - virtual Variant _get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; - virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) override; + virtual void _set_painted_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; + virtual void _set_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) override; + virtual Variant _get_value(LayeredTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; + virtual void _setup_undo_redo_action(LayeredTileSetAtlasSource *p_tile_set_atlas_source, const HashMap &p_previous_values, const Variant &p_new_value) override; protected: virtual void _tile_set_changed() override; @@ -414,7 +414,7 @@ protected: void _notification(int p_what); public: - virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected = false) override; + virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, LayeredTileMapCell p_cell, bool p_selected = false) override; void set_navigation_layer(int p_navigation_layer) { navigation_layer = p_navigation_layer; } diff --git a/modules/layered_tile_map/editor/layered_tile_map_layer_editor.cpp b/modules/layered_tile_map/editor/layered_tile_map_layer_editor.cpp index 085985ebe..64e460c88 100644 --- a/modules/layered_tile_map/editor/layered_tile_map_layer_editor.cpp +++ b/modules/layered_tile_map/editor/layered_tile_map_layer_editor.cpp @@ -49,26 +49,26 @@ #include "core/math/geometry_2d.h" #include "core/os/keyboard.h" -TileMapLayer *TileMapLayerSubEditorPlugin::_get_edited_layer() const { - return Object::cast_to(ObjectDB::get_instance(edited_tile_map_layer_id)); +LayeredTileMapLayer *LayeredTileMapLayerSubEditorPlugin::_get_edited_layer() const { + return Object::cast_to(ObjectDB::get_instance(edited_tile_map_layer_id)); } -void TileMapLayerEditorTilesPlugin::tile_set_changed() { +void LayeredTileMapLayerEditorTilesPlugin::tile_set_changed() { _update_fix_selected_and_hovered(); _update_tile_set_sources_list(); _update_source_display(); _update_patterns_list(); } -void TileMapLayerEditorTilesPlugin::_on_random_tile_checkbox_toggled(bool p_pressed) { +void LayeredTileMapLayerEditorTilesPlugin::_on_random_tile_checkbox_toggled(bool p_pressed) { scatter_controls_container->set_visible(p_pressed); } -void TileMapLayerEditorTilesPlugin::_on_scattering_spinbox_changed(double p_value) { +void LayeredTileMapLayerEditorTilesPlugin::_on_scattering_spinbox_changed(double p_value) { scattering = p_value; } -void TileMapLayerEditorTilesPlugin::_update_toolbar() { +void LayeredTileMapLayerEditorTilesPlugin::_update_toolbar() { // Stop draggig if needed. _stop_dragging(); @@ -102,20 +102,20 @@ void TileMapLayerEditorTilesPlugin::_update_toolbar() { } } -void TileMapLayerEditorTilesPlugin::_update_transform_buttons() { - TileMapLayer *edited_layer = _get_edited_layer(); +void LayeredTileMapLayerEditorTilesPlugin::_update_transform_buttons() { + LayeredTileMapLayer *edited_layer = _get_edited_layer(); if (!edited_layer) { return; } - Ref tile_set = edited_layer->get_effective_tile_set(); + Ref tile_set = edited_layer->get_effective_tile_set(); if (tile_set.is_null() || selection_pattern.is_null()) { return; } bool has_scene_tile = false; - for (const KeyValue &E : selection_pattern->get_pattern()) { - if (Object::cast_to(tile_set->get_source(E.value.source_id).ptr())) { + for (const KeyValue &E : selection_pattern->get_pattern()) { + if (Object::cast_to(tile_set->get_source(E.value.source_id).ptr())) { has_scene_tile = true; break; } @@ -124,7 +124,7 @@ void TileMapLayerEditorTilesPlugin::_update_transform_buttons() { if (has_scene_tile) { _set_transform_buttons_state({}, { transform_button_rotate_left, transform_button_rotate_right, transform_button_flip_h, transform_button_flip_v }, TTR("Can't transform scene tiles.")); - } else if (tile_set->get_tile_shape() != TileSet::TILE_SHAPE_SQUARE && selection_pattern->get_size() != Vector2i(1, 1)) { + } else if (tile_set->get_tile_shape() != LayeredTileSet::TILE_SHAPE_SQUARE && selection_pattern->get_size() != Vector2i(1, 1)) { _set_transform_buttons_state({ transform_button_flip_h, transform_button_flip_v }, { transform_button_rotate_left, transform_button_rotate_right }, TTR("Can't rotate patterns when using non-square tile grid.")); } else { @@ -132,7 +132,7 @@ void TileMapLayerEditorTilesPlugin::_update_transform_buttons() { } } -void TileMapLayerEditorTilesPlugin::_set_transform_buttons_state(const Vector