summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/TileData.xml33
-rw-r--r--doc/classes/TileMap.xml47
-rw-r--r--doc/classes/TileSet.xml149
-rw-r--r--doc/classes/TileSetAtlasSource.xml74
-rw-r--r--doc/classes/TileSetScenesCollectionSource.xml52
-rw-r--r--doc/classes/TileSetSource.xml51
-rw-r--r--scene/2d/tile_map.cpp12
-rw-r--r--scene/resources/tile_set.cpp65
-rw-r--r--scene/resources/tile_set.h8
9 files changed, 336 insertions, 155 deletions
diff --git a/doc/classes/TileData.xml b/doc/classes/TileData.xml
index b5031cfc63..b18ca29a8c 100644
--- a/doc/classes/TileData.xml
+++ b/doc/classes/TileData.xml
@@ -11,6 +11,7 @@
<return type="void" />
<argument index="0" name="layer_id" type="int" />
<description>
+ Adds a collision polygon to the tile on the given TileSet physics layer.
</description>
</method>
<method name="get_collision_polygon_one_way_margin" qualifiers="const">
@@ -18,6 +19,7 @@
<argument index="0" name="layer_id" type="int" />
<argument index="1" name="polygon_index" type="int" />
<description>
+ Returns the one-way margin (for one-way platforms) of the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code].
</description>
</method>
<method name="get_collision_polygon_points" qualifiers="const">
@@ -25,42 +27,49 @@
<argument index="0" name="layer_id" type="int" />
<argument index="1" name="polygon_index" type="int" />
<description>
+ Returns the points of the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code].
</description>
</method>
<method name="get_collision_polygons_count" qualifiers="const">
<return type="int" />
<argument index="0" name="layer_id" type="int" />
<description>
+ Returns how many polygons the tile has for TileSet physics layer with index [code]layer_id[/code].
</description>
</method>
<method name="get_custom_data" qualifiers="const">
<return type="Variant" />
<argument index="0" name="layer_name" type="String" />
<description>
+ Returns the custom data value for custom data layer named [code]layer_name[/code].
</description>
</method>
<method name="get_custom_data_by_layer_id" qualifiers="const">
<return type="Variant" />
<argument index="0" name="layer_id" type="int" />
<description>
+ Returns the custom data value for custom data layer with index [code]layer_id[/code].
</description>
</method>
<method name="get_navigation_polygon" qualifiers="const">
<return type="NavigationPolygon" />
<argument index="0" name="layer_id" type="int" />
<description>
+ Returns the navigation polygon of the tile for the TileSet navigation layer with index [code]layer_id[/code].
</description>
</method>
<method name="get_occluder" qualifiers="const">
<return type="OccluderPolygon2D" />
<argument index="0" name="layer_id" type="int" />
<description>
+ Returns the occluder polygon of the tile for the TileSet occlusion layer with index [code]layer_id[/code].
</description>
</method>
<method name="get_peering_bit_terrain" qualifiers="const">
<return type="int" />
<argument index="0" name="peering_bit" type="int" enum="TileSet.CellNeighbor" />
<description>
+ Returns the tile's terrain bit for the given [code]peering_bit[/code] direction.
</description>
</method>
<method name="is_collision_polygon_one_way" qualifiers="const">
@@ -68,6 +77,7 @@
<argument index="0" name="layer_id" type="int" />
<argument index="1" name="polygon_index" type="int" />
<description>
+ Returns whether one-way collisions are enabled for the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code].
</description>
</method>
<method name="remove_collision_polygon">
@@ -75,6 +85,7 @@
<argument index="0" name="layer_id" type="int" />
<argument index="1" name="polygon_index" type="int" />
<description>
+ Removes the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code].
</description>
</method>
<method name="set_collision_polygon_one_way">
@@ -83,6 +94,7 @@
<argument index="1" name="polygon_index" type="int" />
<argument index="2" name="one_way" type="bool" />
<description>
+ Enables/disables one-way collisions on the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code].
</description>
</method>
<method name="set_collision_polygon_one_way_margin">
@@ -91,6 +103,7 @@
<argument index="1" name="polygon_index" type="int" />
<argument index="2" name="one_way_margin" type="float" />
<description>
+ Enables/disables one-way collisions on the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code].
</description>
</method>
<method name="set_collision_polygon_points">
@@ -99,6 +112,7 @@
<argument index="1" name="polygon_index" type="int" />
<argument index="2" name="polygon" type="PackedVector2Array" />
<description>
+ Sets the points of the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code].
</description>
</method>
<method name="set_collision_polygons_count">
@@ -106,6 +120,7 @@
<argument index="0" name="layer_id" type="int" />
<argument index="1" name="polygons_count" type="int" />
<description>
+ Sets the polygons count for TileSet physics layer with index [code]layer_id[/code].
</description>
</method>
<method name="set_custom_data">
@@ -113,6 +128,7 @@
<argument index="0" name="layer_name" type="String" />
<argument index="1" name="value" type="Variant" />
<description>
+ Sets the tile's custom data value for the TileSet custom data layer with name [code]layer_name[/code].
</description>
</method>
<method name="set_custom_data_by_layer_id">
@@ -120,6 +136,7 @@
<argument index="0" name="layer_id" type="int" />
<argument index="1" name="value" type="Variant" />
<description>
+ Sets the tile's custom data value for the TileSet custom data layer with index [code]layer_id[/code].
</description>
</method>
<method name="set_navigation_polygon">
@@ -127,6 +144,7 @@
<argument index="0" name="layer_id" type="int" />
<argument index="1" name="navigation_polygon" type="NavigationPolygon" />
<description>
+ Sets the navigation polygon for the TileSet navigation layer with index [code]layer_id[/code].
</description>
</method>
<method name="set_occluder">
@@ -134,6 +152,7 @@
<argument index="0" name="layer_id" type="int" />
<argument index="1" name="occluder_polygon" type="OccluderPolygon2D" />
<description>
+ Sets the occluder for the TileSet occlusion layer with index [code]layer_id[/code].
</description>
</method>
<method name="set_peering_bit_terrain">
@@ -141,17 +160,7 @@
<argument index="0" name="peering_bit" type="int" enum="TileSet.CellNeighbor" />
<argument index="1" name="terrain" type="int" />
<description>
- </description>
- </method>
- <method name="tile_get_material" qualifiers="const">
- <return type="ShaderMaterial" />
- <description>
- </description>
- </method>
- <method name="tile_set_material">
- <return type="void" />
- <argument index="0" name="material" type="ShaderMaterial" />
- <description>
+ Sets the tile's terrain bit for the given [code]peering_bit[/code] direction.
</description>
</method>
</methods>
@@ -160,6 +169,8 @@
</member>
<member name="flip_v" type="bool" setter="set_flip_v" getter="get_flip_v" default="false">
</member>
+ <member name="material" type="ShaderMaterial" setter="set_material" getter="get_material">
+ </member>
<member name="modulate" type="Color" setter="set_modulate" getter="get_modulate" default="Color(1, 1, 1, 1)">
</member>
<member name="probability" type="float" setter="set_probability" getter="get_probability" default="1.0">
diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml
index e92a7331e6..4621d138ac 100644
--- a/doc/classes/TileMap.xml
+++ b/doc/classes/TileMap.xml
@@ -4,8 +4,7 @@
Node for 2D tile-based maps.
</brief_description>
<description>
- Node for 2D tile-based maps. Tilemaps use a [TileSet] which contain a list of tiles (textures plus optional collision, navigation, and/or occluder shapes) which are used to create grid-based maps.
- When doing physics queries against the tilemap, the cell coordinates are encoded as [code]metadata[/code] for each detected collision shape returned by methods such as [method PhysicsDirectSpaceState2D.intersect_shape], [method PhysicsDirectBodyState2D.get_contact_collider_shape_metadata] etc.
+ 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.
</description>
<tutorials>
<link title="Using Tilemaps">https://docs.godotengine.org/en/latest/tutorials/2d/using_tilemaps.html</link>
@@ -19,8 +18,9 @@
<methods>
<method name="add_layer">
<return type="void" />
- <argument index="0" name="arg0" type="int" />
+ <argument index="0" name="to_position" type="int" />
<description>
+ Adds a layer at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
</description>
</method>
<method name="clear">
@@ -41,6 +41,7 @@
<argument index="1" name="coords" type="Vector2i" />
<argument index="2" name="use_proxies" type="bool" />
<description>
+ Returns the tile alternative ID of the cell on layer [code]layer[/code] at [code]coords[/code]. If [code]use_proxies[/code] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy].
</description>
</method>
<method name="get_cell_atlas_coords" qualifiers="const">
@@ -49,6 +50,7 @@
<argument index="1" name="coords" type="Vector2i" />
<argument index="2" name="use_proxies" type="bool" />
<description>
+ Returns the tile atlas coordinates ID of the cell on layer [code]layer[/code] at coordinates [code]coords[/code]. If [code]use_proxies[/code] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy].
</description>
</method>
<method name="get_cell_source_id" qualifiers="const">
@@ -57,24 +59,28 @@
<argument index="1" name="coords" type="Vector2i" />
<argument index="2" name="use_proxies" type="bool" />
<description>
+ Returns the tile source ID of the cell on layer [code]layer[/code] at coordinates [code]coords[/code]. If [code]use_proxies[/code] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy].
</description>
</method>
<method name="get_layer_name" qualifiers="const">
<return type="String" />
<argument index="0" name="layer" type="int" />
<description>
+ Returns a TileMap layer's name.
</description>
</method>
<method name="get_layer_y_sort_origin" qualifiers="const">
<return type="int" />
<argument index="0" name="layer" type="int" />
<description>
+ Returns a TileMap layer's Y sort origin.
</description>
</method>
- <method name="get_layer_z_indexd" qualifiers="const">
+ <method name="get_layer_z_index" qualifiers="const">
<return type="int" />
<argument index="0" name="layer" type="int" />
<description>
+ Returns a TileMap layer's Z-index value.
</description>
</method>
<method name="get_layers_count" qualifiers="const">
@@ -87,37 +93,41 @@
<argument index="0" name="coords" type="Vector2i" />
<argument index="1" name="neighbor" type="int" enum="TileSet.CellNeighbor" />
<description>
+ Returns the neighboring cell to the one at coordinates [code]coords[/code], indentified by the [code]neighbor[/code] direction. This method takes into account the different layouts a TileMap can take.
</description>
</method>
<method name="get_surrounding_tiles">
<return type="Vector2i[]" />
<argument index="0" name="coords" type="Vector2i" />
<description>
+ Returns the list of all neighbourings cells to the one at [code]coords[/code]
</description>
</method>
<method name="get_used_cells" qualifiers="const">
<return type="Vector2i[]" />
<argument index="0" name="layer" type="int" />
<description>
- Returns a [Vector2] array with the positions of all cells containing a tile from the tileset (i.e. a tile index different from [code]-1[/code]).
+ Returns a [Vector2] array with the positions of all cells containing a tile in the given layer. A cell is considered empty if its source identifier equals -1, its atlas coordinates identifiers is [code]Vector2(-1, -1)[/code] and its alternative identifier is -1.
</description>
</method>
<method name="get_used_rect">
<return type="Rect2" />
<description>
- Returns a rectangle enclosing the used (non-empty) tiles of the map.
+ Returns a rectangle enclosing the used (non-empty) tiles of the map, including all layers.
</description>
</method>
<method name="is_layer_enabled" qualifiers="const">
<return type="bool" />
<argument index="0" name="layer" type="int" />
<description>
+ Returns if a layer is enabled.
</description>
</method>
<method name="is_layer_y_sort_enabled" qualifiers="const">
<return type="bool" />
<argument index="0" name="layer" type="int" />
<description>
+ Returns if a layer Y-sorts its tiles.
</description>
</method>
<method name="map_to_world" qualifiers="const">
@@ -129,15 +139,17 @@
</method>
<method name="move_layer">
<return type="void" />
- <argument index="0" name="arg0" type="int" />
- <argument index="1" name="arg1" type="int" />
+ <argument index="0" name="layer" type="int" />
+ <argument index="1" name="to_position" type="int" />
<description>
+ Moves the layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array.
</description>
</method>
<method name="remove_layer">
<return type="void" />
- <argument index="0" name="arg0" type="int" />
+ <argument index="0" name="layer" type="int" />
<description>
+ Moves the layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array.
</description>
</method>
<method name="set_cell">
@@ -148,7 +160,10 @@
<argument index="3" name="atlas_coords" type="Vector2i" default="Vector2i(-1, -1)" />
<argument index="4" name="alternative_tile" type="int" default="-1" />
<description>
- Sets the tile index for the cell given by a Vector2i.
+ Sets the tile indentifiers for the cell on layer [code]layer[/code] at coordinates [code]coords[/code]. Each tile of the [TileSet] is identified using three parts:
+ - The source indentifier [code]source_id[/code] identifies a [TileSetSource] identifier. See [method TileSet.set_source_id],
+ - The atlas coordinates identifier [code]atlas_coords[/code] identifies a tile coordinates in the atlas (if the source is a [TileSetAtlasSource]. For [TileSetScenesCollectionSource] it should be 0),
+ - The alternative tile identifier [code]alternative_tile[/code] identifies a tile alternative the source is a [TileSetAtlasSource], and the scene for a [TileSetScenesCollectionSource].
</description>
</method>
<method name="set_layer_enabled">
@@ -156,6 +171,7 @@
<argument index="0" name="layer" type="int" />
<argument index="1" name="enabled" type="bool" />
<description>
+ Enables or disables the layer [code]layer[/code]. A disabled layer is not processed at all (no rendering, no physics, etc...).
</description>
</method>
<method name="set_layer_name">
@@ -163,6 +179,7 @@
<argument index="0" name="layer" type="int" />
<argument index="1" name="name" type="String" />
<description>
+ Sets a layer's name. This is mostly useful in the editor.
</description>
</method>
<method name="set_layer_y_sort_enabled">
@@ -170,6 +187,8 @@
<argument index="0" name="layer" type="int" />
<argument index="1" name="y_sort_enabled" type="bool" />
<description>
+ Enables or disables a layer's Y-sorting. If a layer is Y-sorted, the layer will behave as a CanvasItem node where each of its tile gets Y-sorted.
+ Y-sorted layers should usually be on different Z-index values than not Y-sorted layers, otherwise, each of those layer will be Y-sorted as whole with the Y-sorted one. This is usually an undesired behvaior.
</description>
</method>
<method name="set_layer_y_sort_origin">
@@ -177,6 +196,8 @@
<argument index="0" name="layer" type="int" />
<argument index="1" name="y_sort_origin" type="int" />
<description>
+ Sets a layer's Y-sort origin value. This Y-sort origin value is added to each tile's Y-sort origin value.
+ This allows, for example, to fake a different height level on each layer. This can be useful for top-down view games.
</description>
</method>
<method name="set_layer_z_index">
@@ -184,6 +205,7 @@
<argument index="0" name="layer" type="int" />
<argument index="1" name="z_index" type="int" />
<description>
+ Sets a layers Z-index value. This Z-index is added to each tile's Z-index value.
</description>
</method>
<method name="world_to_map" qualifiers="const">
@@ -199,8 +221,10 @@
The TileMap's quadrant size. Optimizes drawing by batching, using chunks of this size.
</member>
<member name="collision_visibility_mode" type="int" setter="set_collision_visibility_mode" getter="get_collision_visibility_mode" enum="TileMap.VisibilityMode" default="0">
+ Show or hide the TileMap's collision shapes. If set to [code]VISIBILITY_MODE_DEFAULT[/code], this depends on the show collision debug settings.
</member>
<member name="navigation_visibility_mode" type="int" setter="set_navigation_visibility_mode" getter="get_navigation_visibility_mode" enum="TileMap.VisibilityMode" default="0">
+ Show or hide the TileMap's collision shapes. If set to [code]VISIBILITY_MODE_DEFAULT[/code], this depends on the show navigation debug settings.
</member>
<member name="tile_set" type="TileSet" setter="set_tileset" getter="get_tileset">
The assigned [TileSet].
@@ -215,10 +239,13 @@
</signals>
<constants>
<constant name="VISIBILITY_MODE_DEFAULT" value="0" enum="VisibilityMode">
+ Use the debug settings to determine visibility.
</constant>
<constant name="VISIBILITY_MODE_FORCE_HIDE" value="2" enum="VisibilityMode">
+ Always hide.
</constant>
<constant name="VISIBILITY_MODE_FORCE_SHOW" value="1" enum="VisibilityMode">
+ Always show.
</constant>
</constants>
</class>
diff --git a/doc/classes/TileSet.xml b/doc/classes/TileSet.xml
index 3e0ab87383..02baded019 100644
--- a/doc/classes/TileSet.xml
+++ b/doc/classes/TileSet.xml
@@ -4,8 +4,13 @@
Tile library for tilemaps.
</brief_description>
<description>
- A TileSet is a library of tiles for a [TileMap]. It contains a list of tiles, each consisting of a sprite and optional collision shapes.
- Tiles are referenced by a unique integer ID.
+ 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], that render tiles out of a texture with support for physics, navigation, etc... or from a [TileSetScenesCollectionSource] 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 less properties. To do so, the TileSet resources uses property layers, that you can add or remove depending on your needs.
+ For example, adding a physics layer allows giving collision shapes to your tiles. Each layer having dedicated properties (physics layer an mask), you may add several TileSet physics layers for each type of collision you need.
+ See the functions to add new layers for more information.
</description>
<tutorials>
<link title="Using Tilemaps">https://docs.godotengine.org/en/latest/tutorials/2d/using_tilemaps.html</link>
@@ -21,31 +26,41 @@
<return type="void" />
<argument index="0" name="to_position" type="int" default="-1" />
<description>
+ Adds a custom data layer to the TileSet at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
+ Custom data layers allow assigning custom properties to atlas tiles.
</description>
</method>
<method name="add_navigation_layer">
<return type="void" />
<argument index="0" name="to_position" type="int" default="-1" />
<description>
+ Adds a navigation layer to the TileSet at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
+ Navigation layers allow assigning a navigable area to atlas tiles.
</description>
</method>
<method name="add_occlusion_layer">
<return type="void" />
<argument index="0" name="to_position" type="int" default="-1" />
<description>
+ Adds an occlusion layer to the TileSet at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
+ Occlusion layers allow assigning occlusion polygons to atlas tiles.
</description>
</method>
<method name="add_physics_layer">
<return type="void" />
<argument index="0" name="to_position" type="int" default="-1" />
<description>
+ Adds a physics layer to the TileSet at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
+ Physics layers allow assigning collision polygons to atlas tiles.
</description>
</method>
<method name="add_source">
<return type="int" />
- <argument index="0" name="atlas_source_id_override" type="TileSetSource" />
- <argument index="1" name="arg1" type="int" default="-1" />
+ <argument index="0" name="source" type="TileSetSource" />
+ <argument index="1" name="atlas_source_id_override" type="int" default="-1" />
<description>
+ Adds a [TileSetSource] to the TileSet. If [code]atlas_source_id_override[/code] is not -1, also set its source ID. Otherwise, a unique identifier is automatically generated.
+ The function returns the added source source ID or -1 if the source could not be added.
</description>
</method>
<method name="add_terrain">
@@ -53,22 +68,26 @@
<argument index="0" name="terrain_set" type="int" />
<argument index="1" name="to_position" type="int" default="-1" />
<description>
+ Adds a new terrain to the given terrain set [code]terrain_set[/code] at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
</description>
</method>
<method name="add_terrain_set">
<return type="void" />
<argument index="0" name="to_position" type="int" default="-1" />
<description>
+ Adds a new terrain set at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
</description>
</method>
<method name="cleanup_invalid_tile_proxies">
<return type="void" />
<description>
+ Clears tile proxies pointing to invalid tiles.
</description>
</method>
<method name="clear_tile_proxies">
<return type="void" />
<description>
+ Clears all tile proxies.
</description>
</method>
<method name="get_alternative_level_tile_proxy">
@@ -77,6 +96,8 @@
<argument index="1" name="coords_from" type="Vector2i" />
<argument index="2" name="alternative_from" type="int" />
<description>
+ 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.
</description>
</method>
<method name="get_coords_level_tile_proxy">
@@ -84,90 +105,108 @@
<argument index="0" name="source_from" type="int" />
<argument index="1" name="coords_from" type="Vector2i" />
<description>
+ Returns the coodinate-level proxy for the given identifiers. The returned array contains the two proxie's target identifiers (source ID and atlas coords ID).
+ If the TileSet has no proxy for the given identifiers, returns an empty Array.
</description>
</method>
<method name="get_custom_data_layers_count" qualifiers="const">
<return type="int" />
<description>
+ Returns the custom data layers count.
</description>
</method>
<method name="get_navigation_layer_layers" qualifiers="const">
<return type="int" />
<argument index="0" name="layer_index" type="int" />
<description>
+ Returns the navigation layers (as in the Navigation server) of the gives TileSet navigation layer.
</description>
</method>
<method name="get_navigation_layers_count" qualifiers="const">
<return type="int" />
<description>
+ Returns the navigation layers count.
</description>
</method>
<method name="get_next_source_id" qualifiers="const">
<return type="int" />
<description>
+ Returns a new unused source ID. This generated ID is the same that a call to [code]add_source[/code] would return.
</description>
</method>
<method name="get_occlusion_layer_light_mask" qualifiers="const">
<return type="int" />
- <argument index="0" name="arg0" type="int" />
+ <argument index="0" name="layer_index" type="int" />
<description>
+ Returns the light mask of the occlusion layer.
</description>
</method>
<method name="get_occlusion_layer_sdf_collision" qualifiers="const">
<return type="bool" />
- <argument index="0" name="arg0" type="int" />
+ <argument index="0" name="layer_index" type="int" />
<description>
+ Returns if the occluders from this layer use [code]sdf_collision[/code].
</description>
</method>
<method name="get_occlusion_layers_count" qualifiers="const">
<return type="int" />
<description>
+ Returns the occlusion layers count.
</description>
</method>
<method name="get_physics_layer_collision_layer" qualifiers="const">
<return type="int" />
<argument index="0" name="layer_index" type="int" />
<description>
+ Returns the collision layer (as in the physics server) bodies on the given TileSet's physics layer are in.
</description>
</method>
<method name="get_physics_layer_collision_mask" qualifiers="const">
<return type="int" />
<argument index="0" name="layer_index" type="int" />
<description>
+ Returns the collision mask of bodies on the given TileSet's physics layer.
</description>
</method>
<method name="get_physics_layer_physics_material" qualifiers="const">
<return type="PhysicsMaterial" />
<argument index="0" name="layer_index" type="int" />
<description>
+ Returns the physics material of bodies on the given TileSet's physics layer.
</description>
</method>
<method name="get_physics_layers_count" qualifiers="const">
<return type="int" />
<description>
+ Returns the physics layers count.
</description>
</method>
<method name="get_source" qualifiers="const">
<return type="TileSetSource" />
- <argument index="0" name="index" type="int" />
+ <argument index="0" name="source_id" type="int" />
<description>
+ Returns the [TileSetSource] with ID [code]source_id[/code].
</description>
</method>
<method name="get_source_count" qualifiers="const">
<return type="int" />
<description>
+ Returns the number of [TileSetSource] in this TileSet.
</description>
</method>
<method name="get_source_id" qualifiers="const">
<return type="int" />
<argument index="0" name="index" type="int" />
<description>
+ Returns the source ID for source with index [code]index[/code].
</description>
</method>
<method name="get_source_level_tile_proxy">
<return type="int" />
<argument index="0" name="source_from" type="int" />
<description>
+ Returns the source-level proxy for the given source identifier.
+ If the TileSet has no proxy for the given identifier, returns -1.
</description>
</method>
<method name="get_terrain_color" qualifiers="const">
@@ -175,6 +214,7 @@
<argument index="0" name="terrain_set" type="int" />
<argument index="1" name="terrain_index" type="int" />
<description>
+ Returns a terrain's color.
</description>
</method>
<method name="get_terrain_name" qualifiers="const">
@@ -182,23 +222,27 @@
<argument index="0" name="terrain_set" type="int" />
<argument index="1" name="terrain_index" type="int" />
<description>
+ Returns a terrain's name.
</description>
</method>
<method name="get_terrain_set_mode" qualifiers="const">
<return type="int" enum="TileSet.TerrainMode" />
<argument index="0" name="terrain_set" type="int" />
<description>
+ Returns a terrain set mode.
</description>
</method>
<method name="get_terrain_sets_count" qualifiers="const">
<return type="int" />
<description>
+ Returns the terrain sets count.
</description>
</method>
<method name="get_terrains_count" qualifiers="const">
<return type="int" />
<argument index="0" name="terrain_set" type="int" />
<description>
+ Returns the number of terrains in the given terrain set.
</description>
</method>
<method name="has_alternative_level_tile_proxy">
@@ -207,6 +251,7 @@
<argument index="1" name="coords_from" type="Vector2i" />
<argument index="2" name="alternative_from" type="int" />
<description>
+ Returns if there is and alternative-level proxy for the given identifiers.
</description>
</method>
<method name="has_coords_level_tile_proxy">
@@ -214,18 +259,21 @@
<argument index="0" name="source_from" type="int" />
<argument index="1" name="coords_from" type="Vector2i" />
<description>
+ Returns if there is a coodinates-level proxy for the given identifiers.
</description>
</method>
<method name="has_source" qualifiers="const">
<return type="bool" />
- <argument index="0" name="index" type="int" />
+ <argument index="0" name="source_id" type="int" />
<description>
+ Returns if this TileSet has a source for the given source ID.
</description>
</method>
<method name="has_source_level_tile_proxy">
<return type="bool" />
<argument index="0" name="source_from" type="int" />
<description>
+ Returns if there is a source-level proxy for the given source ID.
</description>
</method>
<method name="map_tile_proxy" qualifiers="const">
@@ -234,6 +282,9 @@
<argument index="1" name="coords_from" type="Vector2i" />
<argument index="2" name="alternative_from" type="int" />
<description>
+ According to the configured proxies, maps the provided indentifiers to a new set of identifiers. The source ID, atlas coordinates ID and alternative tile ID are returned as a 3 elements Array.
+ This function first look for matching alternative-level proxies, then coordinates-level proxies, then source-level proxies.
+ If no proxy corresponding to provided identifiers are found, returns the same values the ones used as arguments.
</description>
</method>
<method name="move_custom_data_layer">
@@ -241,6 +292,7 @@
<argument index="0" name="layer_index" type="int" />
<argument index="1" name="to_position" type="int" />
<description>
+ Moves the custom data layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="move_navigation_layer">
@@ -248,6 +300,7 @@
<argument index="0" name="layer_index" type="int" />
<argument index="1" name="to_position" type="int" />
<description>
+ Moves the navigation layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="move_occlusion_layer">
@@ -255,6 +308,7 @@
<argument index="0" name="layer_index" type="int" />
<argument index="1" name="to_position" type="int" />
<description>
+ Moves the occlusion layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="move_physics_layer">
@@ -262,6 +316,7 @@
<argument index="0" name="layer_index" type="int" />
<argument index="1" name="to_position" type="int" />
<description>
+ Moves the physics layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="move_terrain">
@@ -270,13 +325,15 @@
<argument index="1" name="terrain_index" type="int" />
<argument index="2" name="to_position" type="int" />
<description>
+ Moves the terrain at index [code]terrain_index[/code] for terrain set [code]terrain_set[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="move_terrain_set">
<return type="void" />
- <argument index="0" name="layer_index" type="int" />
+ <argument index="0" name="terrain_set" type="int" />
<argument index="1" name="to_position" type="int" />
<description>
+ Moves the terrain set at index [code]terrain_set[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_alternative_level_tile_proxy">
@@ -285,6 +342,7 @@
<argument index="1" name="coords_from" type="Vector2i" />
<argument index="2" name="alternative_from" type="int" />
<description>
+ Removes an alternative-level proxy for the given identifiers.
</description>
</method>
<method name="remove_coords_level_tile_proxy">
@@ -292,42 +350,49 @@
<argument index="0" name="source_from" type="int" />
<argument index="1" name="coords_from" type="Vector2i" />
<description>
+ Removes a coordinates-level proxy for the given identifiers.
</description>
</method>
<method name="remove_custom_data_layer">
<return type="void" />
<argument index="0" name="layer_index" type="int" />
<description>
+ Removes the custom data layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_navigation_layer">
<return type="void" />
<argument index="0" name="layer_index" type="int" />
<description>
+ Removes the navigation layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_occlusion_layer">
<return type="void" />
<argument index="0" name="layer_index" type="int" />
<description>
+ Removes the occlusion layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_physics_layer">
<return type="void" />
<argument index="0" name="layer_index" type="int" />
<description>
+ Removes the physics layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_source">
<return type="void" />
<argument index="0" name="source_id" type="int" />
<description>
+ Removes the source with the given source ID.
</description>
</method>
<method name="remove_source_level_tile_proxy">
<return type="void" />
<argument index="0" name="source_from" type="int" />
<description>
+ Removes a source-level tile proxy.
</description>
</method>
<method name="remove_terrain">
@@ -335,12 +400,14 @@
<argument index="0" name="terrain_set" type="int" />
<argument index="1" name="terrain_index" type="int" />
<description>
+ Removes the terrain at index [code]terrain_index[/code] in the given terrain set [code]terrain_set[/code]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_terrain_set">
<return type="void" />
- <argument index="0" name="layer_index" type="int" />
+ <argument index="0" name="terrain_set" type="int" />
<description>
+ Removes the terrain set at index [code]terrain_set[/code]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="set_alternative_level_tile_proxy">
@@ -352,6 +419,9 @@
<argument index="4" name="coords_to" type="Vector2i" />
<argument index="5" name="alternative_to" type="int" />
<description>
+ 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.
</description>
</method>
<method name="set_coords_level_tile_proxy">
@@ -361,6 +431,9 @@
<argument index="2" name="source_to" type="int" />
<argument index="3" name="coords_to" type="Vector2i" />
<description>
+ 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.
</description>
</method>
<method name="set_navigation_layer_layers">
@@ -368,6 +441,7 @@
<argument index="0" name="layer_index" type="int" />
<argument index="1" name="layers" type="int" />
<description>
+ Sets the navigation layers (as in the navigation server) for navigation regions is the given TileSet navigation layer.
</description>
</method>
<method name="set_occlusion_layer_light_mask">
@@ -375,13 +449,15 @@
<argument index="0" name="layer_index" type="int" />
<argument index="1" name="light_mask" type="int" />
<description>
+ Sets the occlusion layer (as in the rendering server) for occluders in the given TileSet occlusion layer.
</description>
</method>
<method name="set_occlusion_layer_sdf_collision">
<return type="void" />
<argument index="0" name="layer_index" type="int" />
- <argument index="1" name="sdf_collision" type="int" />
+ <argument index="1" name="sdf_collision" type="bool" />
<description>
+ Enables or disables sdf collision for occluders in the given TileSet occlusion layer.
</description>
</method>
<method name="set_physics_layer_collision_layer">
@@ -389,6 +465,7 @@
<argument index="0" name="layer_index" type="int" />
<argument index="1" name="layer" type="int" />
<description>
+ Sets the physics layer (as in the physics server) for bodies in the given TileSet physics layer.
</description>
</method>
<method name="set_physics_layer_collision_mask">
@@ -396,6 +473,7 @@
<argument index="0" name="layer_index" type="int" />
<argument index="1" name="mask" type="int" />
<description>
+ Sets the physics layer (as in the physics server) for bodies in the given TileSet physics layer.
</description>
</method>
<method name="set_physics_layer_physics_material">
@@ -403,13 +481,15 @@
<argument index="0" name="layer_index" type="int" />
<argument index="1" name="physics_material" type="PhysicsMaterial" />
<description>
+ Sets the physics material for bodies in the given TileSet physics layer.
</description>
</method>
<method name="set_source_id">
<return type="void" />
<argument index="0" name="source_id" type="int" />
- <argument index="1" name="arg1" type="int" />
+ <argument index="1" name="new_source_id" type="int" />
<description>
+ Changes a source's ID.
</description>
</method>
<method name="set_source_level_tile_proxy">
@@ -417,6 +497,9 @@
<argument index="0" name="source_from" type="int" />
<argument index="1" name="source_to" type="int" />
<description>
+ 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 atlac 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.
</description>
</method>
<method name="set_terrain_color">
@@ -425,6 +508,7 @@
<argument index="1" name="terrain_index" type="int" />
<argument index="2" name="color" type="Color" />
<description>
+ Sets a terrain's color. This color is used for identifying the different terrains in the TileSet editor.
</description>
</method>
<method name="set_terrain_name">
@@ -433,6 +517,7 @@
<argument index="1" name="terrain_index" type="int" />
<argument index="2" name="name" type="String" />
<description>
+ Sets a terrain's name.
</description>
</method>
<method name="set_terrain_set_mode">
@@ -440,86 +525,120 @@
<argument index="0" name="terrain_set" type="int" />
<argument index="1" name="mode" type="int" enum="TileSet.TerrainMode" />
<description>
+ Sets a terrain mode. Each mode determines which bits of a tile shape is used to match the neighbouring tiles' terrains.
</description>
</method>
</methods>
<members>
<member name="tile_layout" type="int" setter="set_tile_layout" getter="get_tile_layout" enum="TileSet.TileLayout" default="0">
+ For all half-offset shapes (Isometric, Hexagonal and Half-Offset square), changes the way tiles are indexed in the TileMap grid.
</member>
<member name="tile_offset_axis" type="int" setter="set_tile_offset_axis" getter="get_tile_offset_axis" enum="TileSet.TileOffsetAxis" default="0">
+ For all half-offset shapes (Isometric, Hexagonal and Half-Offset square), determines the offset axis.
</member>
<member name="tile_shape" type="int" setter="set_tile_shape" getter="get_tile_shape" enum="TileSet.TileShape" default="0">
+ The tile shape.
</member>
<member name="tile_size" type="Vector2i" setter="set_tile_size" getter="get_tile_size" default="Vector2i(16, 16)">
+ The tile size, in pixels. For all tile shapes, this size corresponds to the encompassing rectangle of the tile shape. This is thus the minimal cell size required in an atlas.
</member>
<member name="uv_clipping" type="bool" setter="set_uv_clipping" getter="is_uv_clipping" default="false">
+ Enables/Disable uv clipping when rendering the tiles.
</member>
</members>
<constants>
<constant name="TILE_SHAPE_SQUARE" value="0" enum="TileShape">
- Orthogonal orientation mode.
+ Rectangular tile shape.
</constant>
<constant name="TILE_SHAPE_ISOMETRIC" value="1" enum="TileShape">
- Isometric orientation mode.
+ Diamond tile shape (for isometric look).
</constant>
<constant name="TILE_SHAPE_HALF_OFFSET_SQUARE" value="2" enum="TileShape">
+ Rectangular tile shape with one row/colum out of two offset by half a tile.
</constant>
<constant name="TILE_SHAPE_HEXAGON" value="3" enum="TileShape">
- Hexagon orientation mode.
+ Hexagonal tile shape.
</constant>
<constant name="TILE_LAYOUT_STACKED" value="0" enum="TileLayout">
+ Tile coordinates layout where both axis stay consistent with their respective local horizontal and vertical axis.
</constant>
<constant name="TILE_LAYOUT_STACKED_OFFSET" value="1" enum="TileLayout">
+ Same as [code]TILE_LAYOUT_STAKED[/code], but the first half-offset is negative instead of positive.
</constant>
<constant name="TILE_LAYOUT_STAIRS_RIGHT" value="2" enum="TileLayout">
+ Tile coordinates layout where the horizontal axis stay horizontal, and the vertical one goes down-right.
</constant>
<constant name="TILE_LAYOUT_STAIRS_DOWN" value="3" enum="TileLayout">
+ Tile coordinates layout where the vertical axis stay vertical, and the horizontal one goes down-right.
</constant>
<constant name="TILE_LAYOUT_DIAMOND_RIGHT" value="4" enum="TileLayout">
+ Tile coordinates layout where the horizontal axis goes up-right, and the vertical one goes down-right.
</constant>
<constant name="TILE_LAYOUT_DIAMOND_DOWN" value="5" enum="TileLayout">
+ Tile coordinates layout where the horizontal axis goes down-right, and the vertical one goes down-left.
</constant>
<constant name="TILE_OFFSET_AXIS_HORIZONTAL" value="0" enum="TileOffsetAxis">
+ Horizontal half-offset.
</constant>
<constant name="TILE_OFFSET_AXIS_VERTICAL" value="1" enum="TileOffsetAxis">
+ Vertical half-offset.
</constant>
<constant name="CELL_NEIGHBOR_RIGHT_SIDE" value="0" enum="CellNeighbor">
+ Neighbor on the right side.
</constant>
<constant name="CELL_NEIGHBOR_RIGHT_CORNER" value="1" enum="CellNeighbor">
+ Neighbor in the right corner.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_RIGHT_SIDE" value="2" enum="CellNeighbor">
+ Neighbor on the bottom right side.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_RIGHT_CORNER" value="3" enum="CellNeighbor">
+ Neighbor in the bottom right corner.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_SIDE" value="4" enum="CellNeighbor">
+ Neighbor on the bottom side.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_CORNER" value="5" enum="CellNeighbor">
+ Neighbor in the bottom corner.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_LEFT_SIDE" value="6" enum="CellNeighbor">
+ Neighbor on the bottom left side.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_LEFT_CORNER" value="7" enum="CellNeighbor">
+ Neighbor in the bottom left corner.
</constant>
<constant name="CELL_NEIGHBOR_LEFT_SIDE" value="8" enum="CellNeighbor">
+ Neighbor on the left side.
</constant>
<constant name="CELL_NEIGHBOR_LEFT_CORNER" value="9" enum="CellNeighbor">
+ Neighbor in the left corner.
</constant>
<constant name="CELL_NEIGHBOR_TOP_LEFT_SIDE" value="10" enum="CellNeighbor">
+ Neighbor on the top left side.
</constant>
<constant name="CELL_NEIGHBOR_TOP_LEFT_CORNER" value="11" enum="CellNeighbor">
+ Neighbor in the top left corner.
</constant>
<constant name="CELL_NEIGHBOR_TOP_SIDE" value="12" enum="CellNeighbor">
+ Neighbor on the top side.
</constant>
<constant name="CELL_NEIGHBOR_TOP_CORNER" value="13" enum="CellNeighbor">
+ Neighbor in the top corner.
</constant>
<constant name="CELL_NEIGHBOR_TOP_RIGHT_SIDE" value="14" enum="CellNeighbor">
+ Neighbor on the top right side.
</constant>
<constant name="CELL_NEIGHBOR_TOP_RIGHT_CORNER" value="15" enum="CellNeighbor">
+ Neighbor in the top right corner.
</constant>
<constant name="TERRAIN_MODE_MATCH_CORNERS_AND_SIDES" value="0" enum="TerrainMode">
+ Requires both corners and side to match with neighboring tiles' terrains.
</constant>
<constant name="TERRAIN_MODE_MATCH_CORNERS" value="1" enum="TerrainMode">
+ Requires corners to match with neighboring tiles' terrains.
</constant>
<constant name="TERRAIN_MODE_MATCH_SIDES" value="2" enum="TerrainMode">
+ Requires sides to match with neighboring tiles' terrains.
</constant>
</constants>
</class>
diff --git a/doc/classes/TileSetAtlasSource.xml b/doc/classes/TileSetAtlasSource.xml
index 8caa3a7c39..fd3dbd1e4d 100644
--- a/doc/classes/TileSetAtlasSource.xml
+++ b/doc/classes/TileSetAtlasSource.xml
@@ -1,8 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileSetAtlasSource" inherits="TileSetSource" version="4.0">
<brief_description>
+ Exposes a 2D atlas texture as a set of tiles for a [TileSet] resource.
</brief_description>
<description>
+ 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("&lt;coords_x&gt;:&lt;coords_y&gt;/&lt;alternative_id&gt;/&lt;tile_data_property&gt;")[/code].
</description>
<tutorials>
</tutorials>
@@ -13,11 +21,14 @@
<argument index="1" name="new_atlas_coords" type="Vector2i" default="Vector2i(-1, -1)" />
<argument index="2" name="new_size" type="Vector2i" default="Vector2i(-1, -1)" />
<description>
+ Returns true if the tile at the [code]atlas_coords[/code] coordinates can be moved to the [code]new_atlas_coords[/code] coordinates with the [code]new_size[/code] size. This functions returns false if a tile is already present in the given area, or if this area is outside the atlas boundaries.
+ If [code]new_atlas_coords[/code] is [code]Vector2i(-1, -1)[/code], keeps the tile's coordinates. If [code]new_size[/code] is [code]Vector2i(-1, -1)[/code], keeps the tile's size.
</description>
</method>
<method name="clear_tiles_outside_texture">
<return type="void" />
<description>
+ Clears all tiles that are defined outside the texture boundaries.
</description>
</method>
<method name="create_alternative_tile">
@@ -25,6 +36,8 @@
<argument index="0" name="atlas_coords" type="Vector2i" />
<argument index="1" name="alternative_id_override" type="int" default="-1" />
<description>
+ Creates an alternative tile for the tile at coords [code]atlas_coords[/code]. If [code]alternative_id_override[/code] is -1, give it an automatically generated unique ID, or assigns it the given ID otherwise.
+ Returns the new alternative identifier, or -1 if the alternative could not be created with a provided [code]alternative_id_override[/code].
</description>
</method>
<method name="create_tile">
@@ -32,84 +45,55 @@
<argument index="0" name="atlas_coords" type="Vector2i" />
<argument index="1" name="size" type="Vector2i" default="Vector2i(1, 1)" />
<description>
- </description>
- </method>
- <method name="get_alternative_tile_id" qualifiers="const">
- <return type="int" />
- <argument index="0" name="atlas_coords" type="Vector2i" />
- <argument index="1" name="index" type="int" />
- <description>
- </description>
- </method>
- <method name="get_alternative_tiles_count" qualifiers="const">
- <return type="int" />
- <argument index="0" name="atlas_coords" type="Vector2i" />
- <description>
+ Creates a new tile at coords [code]atlas_coords[/code] with size [code]size[/code].
</description>
</method>
<method name="get_atlas_grid_size" qualifiers="const">
<return type="Vector2i" />
<description>
+ Returns the atlas grid size, which depends on how many tiles can fit in the texture. It thus depends on the Texture's size, the atlas [code]margins[/code] the tiles' [code]texture_region_size[/code].
</description>
</method>
<method name="get_next_alternative_tile_id" qualifiers="const">
<return type="int" />
<argument index="0" name="atlas_coords" type="Vector2i" />
<description>
+ Returns the alternative ID a following call to [method create_alternative_tile] would return.
</description>
</method>
<method name="get_tile_at_coords" qualifiers="const">
<return type="Vector2i" />
<argument index="0" name="atlas_coords" type="Vector2i" />
<description>
+ If there is a tile covering the [code]atlas_coords[/code] coordinates, returns the top-left coordinates of the tile (thus its coordinate ID). Returns [code]Vector2i(-1, -1)[/code] otherwise.
</description>
</method>
<method name="get_tile_data" qualifiers="const">
<return type="Object" />
<argument index="0" name="atlas_coords" type="Vector2i" />
- <argument index="1" name="index" type="int" />
- <description>
- </description>
- </method>
- <method name="get_tile_id" qualifiers="const">
- <return type="Vector2i" />
- <argument index="0" name="index" type="int" />
+ <argument index="1" name="alternative_tile" type="int" />
<description>
+ Returns the [TileData] object for the given atlas coordinates and alternative ID.
</description>
</method>
<method name="get_tile_size_in_atlas" qualifiers="const">
<return type="Vector2i" />
<argument index="0" name="atlas_coords" type="Vector2i" />
<description>
+ Returns the size of the tile (in the grid coordinates system) at coordinates [code]atlas_coords[/code].
</description>
</method>
<method name="get_tile_texture_region" qualifiers="const">
<return type="Rect2i" />
<argument index="0" name="atlas_coords" type="Vector2i" />
<description>
- </description>
- </method>
- <method name="get_tiles_count" qualifiers="const">
- <return type="int" />
- <description>
- </description>
- </method>
- <method name="has_alternative_tile" qualifiers="const">
- <return type="bool" />
- <argument index="0" name="atlas_coords" type="Vector2i" />
- <argument index="1" name="alternative_tile" type="int" />
- <description>
- </description>
- </method>
- <method name="has_tile" qualifiers="const">
- <return type="bool" />
- <argument index="0" name="atlas_coords" type="Vector2i" />
- <description>
+ Returns a tile's texture region in the atlas texture.
</description>
</method>
<method name="has_tiles_outside_texture">
<return type="bool" />
<description>
+ Returns if this atlas has tiles outside of its texture.
</description>
</method>
<method name="move_tile_in_atlas">
@@ -118,6 +102,9 @@
<argument index="1" name="new_atlas_coords" type="Vector2i" default="Vector2i(-1, -1)" />
<argument index="2" name="new_size" type="Vector2i" default="Vector2i(-1, -1)" />
<description>
+ Move the tile and its alternatives at the [code]atlas_coords[/code] coordinates to the [code]new_atlas_coords[/code] coordinates with the [code]new_size[/code] size. This functions will fail if a tile is already present in the given area.
+ If [code]new_atlas_coords[/code] is [code]Vector2i(-1, -1)[/code], keeps the tile's coordinates. If [code]new_size[/code] is [code]Vector2i(-1, -1)[/code], keeps the tile's size.
+ To avoid an error, first check if a move is possible using [method can_move_tile_in_atlas].
</description>
</method>
<method name="remove_alternative_tile">
@@ -125,12 +112,15 @@
<argument index="0" name="atlas_coords" type="Vector2i" />
<argument index="1" name="alternative_tile" type="int" />
<description>
+ Remove a tile's alternative with alternative ID [code]alternative_tile[/code].
+ Calling this function with [code]alternative_tile[/code] equals to 0 will fail, as the base tile alternative cannot be removed.
</description>
</method>
<method name="remove_tile">
<return type="void" />
<argument index="0" name="atlas_coords" type="Vector2i" />
<description>
+ Remove a tile and its alternative at coordinates [code]atlas_coords[/code].
</description>
</method>
<method name="set_alternative_tile_id">
@@ -139,17 +129,23 @@
<argument index="1" name="alternative_tile" type="int" />
<argument index="2" name="new_id" type="int" />
<description>
+ Change a tile's alternative ID from [code]alternative_tile[/code] to [code]new_id[/code].
+ Calling this function with [code]alternative_id[/code] equals to 0 will fail, as the base tile alternative cannot be moved.
</description>
</method>
</methods>
<members>
<member name="margins" type="Vector2i" setter="set_margins" getter="get_margins" default="Vector2i(0, 0)">
+ Margins, in pixels, to offset the origin of the grid in the texture.
</member>
<member name="separation" type="Vector2i" setter="set_separation" getter="get_separation" default="Vector2i(0, 0)">
+ Separation, in pixels, between each tile texture region of the grid.
</member>
<member name="texture" type="Texture2D" setter="set_texture" getter="get_texture">
+ The atlas texture.
</member>
- <member name="tile_size" type="Vector2i" setter="set_texture_region_size" getter="get_texture_region_size" default="Vector2i(16, 16)">
+ <member name="texture_region_size" type="Vector2i" setter="set_texture_region_size" getter="get_texture_region_size" default="Vector2i(16, 16)">
+ The base tile size in the texture (in pixel). This size must be bigger than the TileSet's [code]tile_size[/code] value.
</member>
</members>
<constants>
diff --git a/doc/classes/TileSetScenesCollectionSource.xml b/doc/classes/TileSetScenesCollectionSource.xml
index a44f519a4c..119a04c25f 100644
--- a/doc/classes/TileSetScenesCollectionSource.xml
+++ b/doc/classes/TileSetScenesCollectionSource.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileSetScenesCollectionSource" inherits="TileSetSource" version="4.0">
<brief_description>
+ Exposes a set of scenes as tiles for a [TileSet] resource.
</brief_description>
<description>
+ When placed on a [TileMap], tiles from [TileSetScenesCollectionSource] will automatically instanciate an assiciated scene at the cell's position in the TileMap.
+ Scenes are instanciated 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 instanciate/free the scene accordingly.
</description>
<tutorials>
</tutorials>
@@ -12,83 +15,55 @@
<argument index="0" name="packed_scene" type="PackedScene" />
<argument index="1" name="id_override" type="int" default="-1" />
<description>
- </description>
- </method>
- <method name="get_alternative_tile_id" qualifiers="const">
- <return type="int" />
- <argument index="0" name="atlas_coords" type="Vector2i" />
- <argument index="1" name="index" type="int" />
- <description>
- </description>
- </method>
- <method name="get_alternative_tiles_count" qualifiers="const">
- <return type="int" />
- <argument index="0" name="atlas_coords" type="Vector2i" />
- <description>
+ Creates a scene-based tile out of the given scene.
+ Returns a newly generated unique ID.
</description>
</method>
<method name="get_next_scene_tile_id" qualifiers="const">
<return type="int" />
<description>
+ Returns the scene ID a following call to [method create_scene_tile] would return.
</description>
</method>
<method name="get_scene_tile_display_placeholder" qualifiers="const">
<return type="bool" />
<argument index="0" name="id" type="int" />
<description>
+ Returns whether the scene tile with id [code]id[/code] displays a placeholder in the editor.
</description>
</method>
<method name="get_scene_tile_id">
<return type="int" />
<argument index="0" name="index" type="int" />
<description>
+ Returns the scene tile ID of the scene tile at index [code]index[/code].
</description>
</method>
<method name="get_scene_tile_scene" qualifiers="const">
<return type="PackedScene" />
<argument index="0" name="id" type="int" />
<description>
+ Returns the [PackedScene] resource of scene tile with id [code]id[/code].
</description>
</method>
<method name="get_scene_tiles_count">
<return type="int" />
<description>
- </description>
- </method>
- <method name="get_tile_id" qualifiers="const">
- <return type="Vector2i" />
- <argument index="0" name="index" type="int" />
- <description>
- </description>
- </method>
- <method name="get_tiles_count" qualifiers="const">
- <return type="int" />
- <description>
- </description>
- </method>
- <method name="has_alternative_tile" qualifiers="const">
- <return type="bool" />
- <argument index="0" name="atlas_coords" type="Vector2i" />
- <argument index="1" name="alternative_tile" type="int" />
- <description>
+ Returns the number or scene tiles this TileSet source has.
</description>
</method>
<method name="has_scene_tile_id">
<return type="bool" />
<argument index="0" name="id" type="int" />
<description>
- </description>
- </method>
- <method name="has_tile" qualifiers="const">
- <return type="bool" />
- <argument index="0" name="atlas_coords" type="Vector2i" />
- <description>
+ Returns whether this TileSet source has a scene tile with id [code]id[/code].
</description>
</method>
<method name="remove_scene_tile">
<return type="void" />
<argument index="0" name="id" type="int" />
<description>
+ Remove the scene tile with id [code]id[/code].
</description>
</method>
<method name="set_scene_tile_display_placeholder">
@@ -96,6 +71,7 @@
<argument index="0" name="id" type="int" />
<argument index="1" name="display_placeholder" type="bool" />
<description>
+ Sets whether or not the scene tile with id [code]id[/code] should display a placeholder in the editor. This might be useful for scenes that are not visible.
</description>
</method>
<method name="set_scene_tile_id">
@@ -103,6 +79,7 @@
<argument index="0" name="id" type="int" />
<argument index="1" name="new_id" type="int" />
<description>
+ Changes a scene tile's ID from [code]id[/code] to [code]new_id[/code]. This will fail if there is already a tile with a ID equal to [code]new_id[/code].
</description>
</method>
<method name="set_scene_tile_scene">
@@ -110,6 +87,7 @@
<argument index="0" name="id" type="int" />
<argument index="1" name="packed_scene" type="PackedScene" />
<description>
+ Assigns a [PackedScene] resource to the scene tile with id [code]id[/code]. This will fail if the scene does not extend CanvasItem, as positionning properties are needed to place the scene on the TileMap.
</description>
</method>
</methods>
diff --git a/doc/classes/TileSetSource.xml b/doc/classes/TileSetSource.xml
index 6a3029bb3f..442d845f6c 100644
--- a/doc/classes/TileSetSource.xml
+++ b/doc/classes/TileSetSource.xml
@@ -1,12 +1,63 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileSetSource" inherits="Resource" version="4.0">
<brief_description>
+ Exposes a set of tiles for a [TileSet] resource.
</brief_description>
<description>
+ 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].
</description>
<tutorials>
</tutorials>
<methods>
+ <method name="get_alternative_tile_id" qualifiers="const">
+ <return type="int" />
+ <argument index="0" name="atlas_coords" type="Vector2i" />
+ <argument index="1" name="index" type="int" />
+ <description>
+ Returns the alternative ID for the tile with coordinates ID [code]atlas_coords[/code] at index [code]index[/code].
+ </description>
+ </method>
+ <method name="get_alternative_tiles_count" qualifiers="const">
+ <return type="int" />
+ <argument index="0" name="atlas_coords" type="Vector2i" />
+ <description>
+ Returns the number of alternatives tiles for the coordinates ID [code]atlas_coords[/code].
+ For [TileSetAtlasSource], 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.
+ </description>
+ </method>
+ <method name="get_tile_id" qualifiers="const">
+ <return type="Vector2i" />
+ <argument index="0" name="index" type="int" />
+ <description>
+ Returns the tile coordinates ID of the tile with index [code]index[/code].
+ </description>
+ </method>
+ <method name="get_tiles_count" qualifiers="const">
+ <return type="int" />
+ <description>
+ Returns how many tiles this atlas source defines (not including alternative tiles).
+ </description>
+ </method>
+ <method name="has_alternative_tile" qualifiers="const">
+ <return type="bool" />
+ <argument index="0" name="atlas_coords" type="Vector2i" />
+ <argument index="1" name="alternative_tile" type="int" />
+ <description>
+ Returns if the base tile at coordinates [code]atlas_coords[/code] has an alternative with ID [code]alternative_tile[/code].
+ </description>
+ </method>
+ <method name="has_tile" qualifiers="const">
+ <return type="bool" />
+ <argument index="0" name="atlas_coords" type="Vector2i" />
+ <description>
+ Returns if this atlas has a tile with coordinates ID [code]atlas_coordinates[/code].
+ </description>
+ </method>
</methods>
<constants>
</constants>
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index e1552b3b60..0eb424b32c 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -236,6 +236,8 @@ Vector2i TileMap::transform_coords_layout(Vector2i p_coords, TileSet::TileOffset
}
int TileMap::get_effective_quadrant_size(int p_layer) const {
+ ERR_FAIL_INDEX_V(p_layer, (int)layers.size(), 1);
+
// When using YSort, the quadrant size is reduced to 1 to have one CanvasItem per quadrant
if (is_y_sort_enabled() && layers[p_layer].y_sort_enabled) {
return 1;
@@ -815,7 +817,7 @@ void TileMap::_rendering_update_dirty_quadrants(SelfList<TileMapQuadrant>::List
if (atlas_source) {
// Get the tile data.
TileData *tile_data = Object::cast_to<TileData>(atlas_source->get_tile_data(c.get_atlas_coords(), c.alternative_tile));
- Ref<ShaderMaterial> mat = tile_data->tile_get_material();
+ Ref<ShaderMaterial> mat = tile_data->get_material();
int z_index = tile_data->get_z_index();
// Quandrant pos.
@@ -2931,9 +2933,9 @@ void TileMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_quadrant_size"), &TileMap::get_quadrant_size);
ClassDB::bind_method(D_METHOD("get_layers_count"), &TileMap::get_layers_count);
- ClassDB::bind_method(D_METHOD("add_layer"), &TileMap::add_layer);
- ClassDB::bind_method(D_METHOD("move_layer"), &TileMap::move_layer);
- ClassDB::bind_method(D_METHOD("remove_layer"), &TileMap::remove_layer);
+ ClassDB::bind_method(D_METHOD("add_layer", "to_position"), &TileMap::add_layer);
+ ClassDB::bind_method(D_METHOD("move_layer", "layer", "to_position"), &TileMap::move_layer);
+ ClassDB::bind_method(D_METHOD("remove_layer", "layer"), &TileMap::remove_layer);
ClassDB::bind_method(D_METHOD("set_layer_name", "layer", "name"), &TileMap::set_layer_name);
ClassDB::bind_method(D_METHOD("get_layer_name", "layer"), &TileMap::get_layer_name);
ClassDB::bind_method(D_METHOD("set_layer_enabled", "layer", "enabled"), &TileMap::set_layer_enabled);
@@ -2943,7 +2945,7 @@ void TileMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_layer_y_sort_origin", "layer", "y_sort_origin"), &TileMap::set_layer_y_sort_origin);
ClassDB::bind_method(D_METHOD("get_layer_y_sort_origin", "layer"), &TileMap::get_layer_y_sort_origin);
ClassDB::bind_method(D_METHOD("set_layer_z_index", "layer", "z_index"), &TileMap::set_layer_z_index);
- ClassDB::bind_method(D_METHOD("get_layer_z_indexd", "layer"), &TileMap::get_layer_z_index);
+ ClassDB::bind_method(D_METHOD("get_layer_z_index", "layer"), &TileMap::get_layer_z_index);
ClassDB::bind_method(D_METHOD("set_collision_visibility_mode", "collision_visibility_mode"), &TileMap::set_collision_visibility_mode);
ClassDB::bind_method(D_METHOD("get_collision_visibility_mode"), &TileMap::get_collision_visibility_mode);
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index d383961d87..e288e18f33 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -257,7 +257,7 @@ int TileSet::get_occlusion_layer_light_mask(int p_layer_index) const {
return occlusion_layers[p_layer_index].light_mask;
}
-void TileSet::set_occlusion_layer_sdf_collision(int p_layer_index, int p_sdf_collision) {
+void TileSet::set_occlusion_layer_sdf_collision(int p_layer_index, bool p_sdf_collision) {
ERR_FAIL_INDEX(p_layer_index, occlusion_layers.size());
occlusion_layers.write[p_layer_index].sdf_collision = p_sdf_collision;
emit_changed();
@@ -1966,7 +1966,7 @@ void TileSet::_compatibility_conversion() {
tile_data->set_flip_h(flip_h);
tile_data->set_flip_v(flip_v);
tile_data->set_transpose(transpose);
- tile_data->tile_set_material(ctd->material);
+ tile_data->set_material(ctd->material);
tile_data->set_modulate(ctd->modulate);
tile_data->set_z_index(ctd->z_index);
@@ -2058,7 +2058,7 @@ void TileSet::_compatibility_conversion() {
tile_data->set_flip_h(flip_h);
tile_data->set_flip_v(flip_v);
tile_data->set_transpose(transpose);
- tile_data->tile_set_material(ctd->material);
+ tile_data->set_material(ctd->material);
tile_data->set_modulate(ctd->modulate);
tile_data->set_z_index(ctd->z_index);
if (ctd->autotile_occluder_map.has(coords)) {
@@ -2693,13 +2693,13 @@ void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
void TileSet::_bind_methods() {
// Sources management.
ClassDB::bind_method(D_METHOD("get_next_source_id"), &TileSet::get_next_source_id);
- ClassDB::bind_method(D_METHOD("add_source", "atlas_source_id_override"), &TileSet::add_source, DEFVAL(TileSet::INVALID_SOURCE));
+ ClassDB::bind_method(D_METHOD("add_source", "source", "atlas_source_id_override"), &TileSet::add_source, DEFVAL(TileSet::INVALID_SOURCE));
ClassDB::bind_method(D_METHOD("remove_source", "source_id"), &TileSet::remove_source);
- ClassDB::bind_method(D_METHOD("set_source_id", "source_id"), &TileSet::set_source_id);
+ ClassDB::bind_method(D_METHOD("set_source_id", "source_id", "new_source_id"), &TileSet::set_source_id);
ClassDB::bind_method(D_METHOD("get_source_count"), &TileSet::get_source_count);
ClassDB::bind_method(D_METHOD("get_source_id", "index"), &TileSet::get_source_id);
- ClassDB::bind_method(D_METHOD("has_source", "index"), &TileSet::has_source);
- ClassDB::bind_method(D_METHOD("get_source", "index"), &TileSet::get_source);
+ ClassDB::bind_method(D_METHOD("has_source", "source_id"), &TileSet::has_source);
+ ClassDB::bind_method(D_METHOD("get_source", "source_id"), &TileSet::get_source);
// Shape and layout.
ClassDB::bind_method(D_METHOD("set_tile_shape", "shape"), &TileSet::set_tile_shape);
@@ -2725,9 +2725,9 @@ void TileSet::_bind_methods() {
ClassDB::bind_method(D_METHOD("move_occlusion_layer", "layer_index", "to_position"), &TileSet::move_occlusion_layer);
ClassDB::bind_method(D_METHOD("remove_occlusion_layer", "layer_index"), &TileSet::remove_occlusion_layer);
ClassDB::bind_method(D_METHOD("set_occlusion_layer_light_mask", "layer_index", "light_mask"), &TileSet::set_occlusion_layer_light_mask);
- ClassDB::bind_method(D_METHOD("get_occlusion_layer_light_mask"), &TileSet::get_occlusion_layer_light_mask);
+ ClassDB::bind_method(D_METHOD("get_occlusion_layer_light_mask", "layer_index"), &TileSet::get_occlusion_layer_light_mask);
ClassDB::bind_method(D_METHOD("set_occlusion_layer_sdf_collision", "layer_index", "sdf_collision"), &TileSet::set_occlusion_layer_sdf_collision);
- ClassDB::bind_method(D_METHOD("get_occlusion_layer_sdf_collision"), &TileSet::get_occlusion_layer_sdf_collision);
+ ClassDB::bind_method(D_METHOD("get_occlusion_layer_sdf_collision", "layer_index"), &TileSet::get_occlusion_layer_sdf_collision);
// Physics
ClassDB::bind_method(D_METHOD("get_physics_layers_count"), &TileSet::get_physics_layers_count);
@@ -2744,8 +2744,8 @@ void TileSet::_bind_methods() {
// Terrains
ClassDB::bind_method(D_METHOD("get_terrain_sets_count"), &TileSet::get_terrain_sets_count);
ClassDB::bind_method(D_METHOD("add_terrain_set", "to_position"), &TileSet::add_terrain_set, DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("move_terrain_set", "layer_index", "to_position"), &TileSet::move_terrain_set);
- ClassDB::bind_method(D_METHOD("remove_terrain_set", "layer_index"), &TileSet::remove_terrain_set);
+ ClassDB::bind_method(D_METHOD("move_terrain_set", "terrain_set", "to_position"), &TileSet::move_terrain_set);
+ ClassDB::bind_method(D_METHOD("remove_terrain_set", "terrain_set"), &TileSet::remove_terrain_set);
ClassDB::bind_method(D_METHOD("set_terrain_set_mode", "terrain_set", "mode"), &TileSet::set_terrain_set_mode);
ClassDB::bind_method(D_METHOD("get_terrain_set_mode", "terrain_set"), &TileSet::get_terrain_set_mode);
@@ -2870,6 +2870,18 @@ void TileSetSource::set_tile_set(const TileSet *p_tile_set) {
tile_set = p_tile_set;
}
+void TileSetSource::_bind_methods() {
+ // Base tiles
+ ClassDB::bind_method(D_METHOD("get_tiles_count"), &TileSetSource::get_tiles_count);
+ ClassDB::bind_method(D_METHOD("get_tile_id", "index"), &TileSetSource::get_tile_id);
+ ClassDB::bind_method(D_METHOD("has_tile", "atlas_coords"), &TileSetSource::has_tile);
+
+ // Alternative tiles
+ ClassDB::bind_method(D_METHOD("get_alternative_tiles_count", "atlas_coords"), &TileSetSource::get_alternative_tiles_count);
+ ClassDB::bind_method(D_METHOD("get_alternative_tile_id", "atlas_coords", "index"), &TileSetSource::get_alternative_tile_id);
+ ClassDB::bind_method(D_METHOD("has_alternative_tile", "atlas_coords", "alternative_tile"), &TileSetSource::has_alternative_tile);
+}
+
/////////////////////////////// TileSetAtlasSource //////////////////////////////////////
void TileSetAtlasSource::set_tile_set(const TileSet *p_tile_set) {
@@ -3559,32 +3571,24 @@ void TileSetAtlasSource::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_NOEDITOR), "set_texture", "get_texture");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "margins", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_margins", "get_margins");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "separation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_separation", "get_separation");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "tile_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_texture_region_size", "get_texture_region_size");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "texture_region_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_texture_region_size", "get_texture_region_size");
// Base tiles
ClassDB::bind_method(D_METHOD("create_tile", "atlas_coords", "size"), &TileSetAtlasSource::create_tile, DEFVAL(Vector2i(1, 1)));
ClassDB::bind_method(D_METHOD("remove_tile", "atlas_coords"), &TileSetAtlasSource::remove_tile); // Remove a tile. If p_tile_key.alternative_tile if different from 0, remove the alternative
- ClassDB::bind_method(D_METHOD("has_tile", "atlas_coords"), &TileSetAtlasSource::has_tile);
ClassDB::bind_method(D_METHOD("can_move_tile_in_atlas", "atlas_coords", "new_atlas_coords", "new_size"), &TileSetAtlasSource::can_move_tile_in_atlas, DEFVAL(INVALID_ATLAS_COORDS), DEFVAL(Vector2i(-1, -1)));
ClassDB::bind_method(D_METHOD("move_tile_in_atlas", "atlas_coords", "new_atlas_coords", "new_size"), &TileSetAtlasSource::move_tile_in_atlas, DEFVAL(INVALID_ATLAS_COORDS), DEFVAL(Vector2i(-1, -1)));
ClassDB::bind_method(D_METHOD("get_tile_size_in_atlas", "atlas_coords"), &TileSetAtlasSource::get_tile_size_in_atlas);
- ClassDB::bind_method(D_METHOD("get_tiles_count"), &TileSetAtlasSource::get_tiles_count);
- ClassDB::bind_method(D_METHOD("get_tile_id", "index"), &TileSetAtlasSource::get_tile_id);
-
ClassDB::bind_method(D_METHOD("get_tile_at_coords", "atlas_coords"), &TileSetAtlasSource::get_tile_at_coords);
// Alternative tiles
ClassDB::bind_method(D_METHOD("create_alternative_tile", "atlas_coords", "alternative_id_override"), &TileSetAtlasSource::create_alternative_tile, DEFVAL(INVALID_TILE_ALTERNATIVE));
ClassDB::bind_method(D_METHOD("remove_alternative_tile", "atlas_coords", "alternative_tile"), &TileSetAtlasSource::remove_alternative_tile);
ClassDB::bind_method(D_METHOD("set_alternative_tile_id", "atlas_coords", "alternative_tile", "new_id"), &TileSetAtlasSource::set_alternative_tile_id);
- ClassDB::bind_method(D_METHOD("has_alternative_tile", "atlas_coords", "alternative_tile"), &TileSetAtlasSource::has_alternative_tile);
ClassDB::bind_method(D_METHOD("get_next_alternative_tile_id", "atlas_coords"), &TileSetAtlasSource::get_next_alternative_tile_id);
- ClassDB::bind_method(D_METHOD("get_alternative_tiles_count", "atlas_coords"), &TileSetAtlasSource::get_alternative_tiles_count);
- ClassDB::bind_method(D_METHOD("get_alternative_tile_id", "atlas_coords", "index"), &TileSetAtlasSource::get_alternative_tile_id);
-
- ClassDB::bind_method(D_METHOD("get_tile_data", "atlas_coords", "index"), &TileSetAtlasSource::get_tile_data);
+ ClassDB::bind_method(D_METHOD("get_tile_data", "atlas_coords", "alternative_tile"), &TileSetAtlasSource::get_tile_data);
// Helpers.
ClassDB::bind_method(D_METHOD("get_atlas_grid_size"), &TileSetAtlasSource::get_atlas_grid_size);
@@ -3797,16 +3801,6 @@ void TileSetScenesCollectionSource::_get_property_list(List<PropertyInfo> *p_lis
}
void TileSetScenesCollectionSource::_bind_methods() {
- // Base tiles
- ClassDB::bind_method(D_METHOD("get_tiles_count"), &TileSetScenesCollectionSource::get_tiles_count);
- ClassDB::bind_method(D_METHOD("get_tile_id", "index"), &TileSetScenesCollectionSource::get_tile_id);
- ClassDB::bind_method(D_METHOD("has_tile", "atlas_coords"), &TileSetScenesCollectionSource::has_tile);
-
- // Alternative tiles
- ClassDB::bind_method(D_METHOD("get_alternative_tiles_count", "atlas_coords"), &TileSetScenesCollectionSource::get_alternative_tiles_count);
- ClassDB::bind_method(D_METHOD("get_alternative_tile_id", "atlas_coords", "index"), &TileSetScenesCollectionSource::get_alternative_tile_id);
- ClassDB::bind_method(D_METHOD("has_alternative_tile", "atlas_coords", "alternative_tile"), &TileSetScenesCollectionSource::has_alternative_tile);
-
ClassDB::bind_method(D_METHOD("get_scene_tiles_count"), &TileSetScenesCollectionSource::get_scene_tiles_count);
ClassDB::bind_method(D_METHOD("get_scene_tile_id", "index"), &TileSetScenesCollectionSource::get_scene_tile_id);
ClassDB::bind_method(D_METHOD("has_scene_tile_id", "id"), &TileSetScenesCollectionSource::has_scene_tile_id);
@@ -4063,11 +4057,11 @@ Vector2i TileData::get_texture_offset() const {
return tex_offset;
}
-void TileData::tile_set_material(Ref<ShaderMaterial> p_material) {
+void TileData::set_material(Ref<ShaderMaterial> p_material) {
material = p_material;
emit_signal(SNAME("changed"));
}
-Ref<ShaderMaterial> TileData::tile_get_material() const {
+Ref<ShaderMaterial> TileData::get_material() const {
return material;
}
@@ -4583,8 +4577,8 @@ void TileData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_flip_v"), &TileData::get_flip_v);
ClassDB::bind_method(D_METHOD("set_transpose", "transpose"), &TileData::set_transpose);
ClassDB::bind_method(D_METHOD("get_transpose"), &TileData::get_transpose);
- ClassDB::bind_method(D_METHOD("tile_set_material", "material"), &TileData::tile_set_material);
- ClassDB::bind_method(D_METHOD("tile_get_material"), &TileData::tile_get_material);
+ ClassDB::bind_method(D_METHOD("set_material", "material"), &TileData::set_material);
+ ClassDB::bind_method(D_METHOD("get_material"), &TileData::get_material);
ClassDB::bind_method(D_METHOD("set_texture_offset", "texture_offset"), &TileData::set_texture_offset);
ClassDB::bind_method(D_METHOD("get_texture_offset"), &TileData::get_texture_offset);
ClassDB::bind_method(D_METHOD("set_modulate", "modulate"), &TileData::set_modulate);
@@ -4635,6 +4629,7 @@ void TileData::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transpose"), "set_transpose", "get_transpose");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "texture_offset"), "set_texture_offset", "get_texture_offset");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "modulate"), "set_modulate", "get_modulate");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial"), "set_material", "get_material");
ADD_PROPERTY(PropertyInfo(Variant::INT, "z_index"), "set_z_index", "get_z_index");
ADD_PROPERTY(PropertyInfo(Variant::INT, "y_sort_origin"), "set_y_sort_origin", "get_y_sort_origin");
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index 29a71d31d2..3baf022dc0 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -304,7 +304,7 @@ public:
void remove_occlusion_layer(int p_index);
void set_occlusion_layer_light_mask(int p_layer_index, int p_light_mask);
int get_occlusion_layer_light_mask(int p_layer_index) const;
- void set_occlusion_layer_sdf_collision(int p_layer_index, int p_sdf_collision);
+ void set_occlusion_layer_sdf_collision(int p_layer_index, bool p_sdf_collision);
bool get_occlusion_layer_sdf_collision(int p_layer_index) const;
// Physics
@@ -404,6 +404,8 @@ class TileSetSource : public Resource {
protected:
const TileSet *tile_set = nullptr;
+ static void _bind_methods();
+
public:
static const Vector2i INVALID_ATLAS_COORDS; // Vector2i(-1, -1);
static const int INVALID_TILE_ALTERNATIVE; // -1;
@@ -679,8 +681,8 @@ public:
void set_texture_offset(Vector2i p_texture_offset);
Vector2i get_texture_offset() const;
- void tile_set_material(Ref<ShaderMaterial> p_material);
- Ref<ShaderMaterial> tile_get_material() const;
+ void set_material(Ref<ShaderMaterial> p_material);
+ Ref<ShaderMaterial> get_material() const;
void set_modulate(Color p_modulate);
Color get_modulate() const;
void set_z_index(int p_z_index);