From 0c85f3acc1ac18ded5faaa35f0cef87781801ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilles=20Roudi=C3=A8re?= Date: Mon, 6 Sep 2021 11:56:31 +0200 Subject: Tiles renames/bugfixing and documentation --- doc/classes/TileData.xml | 33 ++++-- doc/classes/TileMap.xml | 47 ++++++-- doc/classes/TileSet.xml | 149 +++++++++++++++++++++++--- doc/classes/TileSetAtlasSource.xml | 74 ++++++------- doc/classes/TileSetScenesCollectionSource.xml | 52 +++------ doc/classes/TileSetSource.xml | 51 +++++++++ 6 files changed, 294 insertions(+), 112 deletions(-) (limited to 'doc/classes') 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 @@ + Adds a collision polygon to the tile on the given TileSet physics layer. @@ -18,6 +19,7 @@ + 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]. @@ -25,42 +27,49 @@ + Returns the points of the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code]. + Returns how many polygons the tile has for TileSet physics layer with index [code]layer_id[/code]. + Returns the custom data value for custom data layer named [code]layer_name[/code]. + Returns the custom data value for custom data layer with index [code]layer_id[/code]. + Returns the navigation polygon of the tile for the TileSet navigation layer with index [code]layer_id[/code]. + Returns the occluder polygon of the tile for the TileSet occlusion layer with index [code]layer_id[/code]. + Returns the tile's terrain bit for the given [code]peering_bit[/code] direction. @@ -68,6 +77,7 @@ + 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]. @@ -75,6 +85,7 @@ + Removes the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code]. @@ -83,6 +94,7 @@ + Enables/disables one-way collisions on the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code]. @@ -91,6 +103,7 @@ + Enables/disables one-way collisions on the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code]. @@ -99,6 +112,7 @@ + Sets the points of the polygon at index [code]polygon_index[/code] for TileSet physics layer with index [code]layer_id[/code]. @@ -106,6 +120,7 @@ + Sets the polygons count for TileSet physics layer with index [code]layer_id[/code]. @@ -113,6 +128,7 @@ + Sets the tile's custom data value for the TileSet custom data layer with name [code]layer_name[/code]. @@ -120,6 +136,7 @@ + Sets the tile's custom data value for the TileSet custom data layer with index [code]layer_id[/code]. @@ -127,6 +144,7 @@ + Sets the navigation polygon for the TileSet navigation layer with index [code]layer_id[/code]. @@ -134,6 +152,7 @@ + Sets the occluder for the TileSet occlusion layer with index [code]layer_id[/code]. @@ -141,17 +160,7 @@ - - - - - - - - - - - + Sets the tile's terrain bit for the given [code]peering_bit[/code] direction. @@ -160,6 +169,8 @@ + + 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. - 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. https://docs.godotengine.org/en/latest/tutorials/2d/using_tilemaps.html @@ -19,8 +18,9 @@ - + + 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. @@ -41,6 +41,7 @@ + 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]. @@ -49,6 +50,7 @@ + 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]. @@ -57,24 +59,28 @@ + 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]. + Returns a TileMap layer's name. + Returns a TileMap layer's Y sort origin. - + + Returns a TileMap layer's Z-index value. @@ -87,37 +93,41 @@ + 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. + Returns the list of all neighbourings cells to the one at [code]coords[/code] - 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. - 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. + Returns if a layer is enabled. + Returns if a layer Y-sorts its tiles. @@ -129,15 +139,17 @@ - - + + + Moves the layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array. - + + Moves the layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array. @@ -148,7 +160,10 @@ - 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]. @@ -156,6 +171,7 @@ + Enables or disables the layer [code]layer[/code]. A disabled layer is not processed at all (no rendering, no physics, etc...). @@ -163,6 +179,7 @@ + Sets a layer's name. This is mostly useful in the editor. @@ -170,6 +187,8 @@ + 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. @@ -177,6 +196,8 @@ + 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. @@ -184,6 +205,7 @@ + Sets a layers Z-index value. This Z-index is added to each tile's Z-index value. @@ -199,8 +221,10 @@ The TileMap's quadrant size. Optimizes drawing by batching, using chunks of this size. + Show or hide the TileMap's collision shapes. If set to [code]VISIBILITY_MODE_DEFAULT[/code], this depends on the show collision debug settings. + Show or hide the TileMap's collision shapes. If set to [code]VISIBILITY_MODE_DEFAULT[/code], this depends on the show navigation debug settings. The assigned [TileSet]. @@ -215,10 +239,13 @@ + Use the debug settings to determine visibility. + Always hide. + Always show. 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. - 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. https://docs.godotengine.org/en/latest/tutorials/2d/using_tilemaps.html @@ -21,31 +26,41 @@ + 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. + 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. + 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. + 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. - - + + + 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. @@ -53,22 +68,26 @@ + 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. + 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. + Clears tile proxies pointing to invalid tiles. + Clears all tile proxies. @@ -77,6 +96,8 @@ + 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. @@ -84,90 +105,108 @@ + 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. + Returns the custom data layers count. + Returns the navigation layers (as in the Navigation server) of the gives TileSet navigation layer. + Returns the navigation layers count. + Returns a new unused source ID. This generated ID is the same that a call to [code]add_source[/code] would return. - + + Returns the light mask of the occlusion layer. - + + Returns if the occluders from this layer use [code]sdf_collision[/code]. + Returns the occlusion layers count. + Returns the collision layer (as in the physics server) bodies on the given TileSet's physics layer are in. + Returns the collision mask of bodies on the given TileSet's physics layer. + Returns the physics material of bodies on the given TileSet's physics layer. + Returns the physics layers count. - + + Returns the [TileSetSource] with ID [code]source_id[/code]. + Returns the number of [TileSetSource] in this TileSet. + Returns the source ID for source with index [code]index[/code]. + Returns the source-level proxy for the given source identifier. + If the TileSet has no proxy for the given identifier, returns -1. @@ -175,6 +214,7 @@ + Returns a terrain's color. @@ -182,23 +222,27 @@ + Returns a terrain's name. + Returns a terrain set mode. + Returns the terrain sets count. + Returns the number of terrains in the given terrain set. @@ -207,6 +251,7 @@ + Returns if there is and alternative-level proxy for the given identifiers. @@ -214,18 +259,21 @@ + Returns if there is a coodinates-level proxy for the given identifiers. - + + Returns if this TileSet has a source for the given source ID. + Returns if there is a source-level proxy for the given source ID. @@ -234,6 +282,9 @@ + 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. @@ -241,6 +292,7 @@ + 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. @@ -248,6 +300,7 @@ + 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. @@ -255,6 +308,7 @@ + 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. @@ -262,6 +316,7 @@ + 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. @@ -270,13 +325,15 @@ + 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. - + + 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. @@ -285,6 +342,7 @@ + Removes an alternative-level proxy for the given identifiers. @@ -292,42 +350,49 @@ + Removes a coordinates-level proxy for the given identifiers. + Removes the custom data layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly. + Removes the navigation layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly. + Removes the occlusion layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly. + Removes the physics layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly. + Removes the source with the given source ID. + Removes a source-level tile proxy. @@ -335,12 +400,14 @@ + Removes the terrain at index [code]terrain_index[/code] in the given terrain set [code]terrain_set[/code]. Also updates the atlas tiles accordingly. - + + Removes the terrain set at index [code]terrain_set[/code]. Also updates the atlas tiles accordingly. @@ -352,6 +419,9 @@ + 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. @@ -361,6 +431,9 @@ + 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. @@ -368,6 +441,7 @@ + Sets the navigation layers (as in the navigation server) for navigation regions is the given TileSet navigation layer. @@ -375,13 +449,15 @@ + Sets the occlusion layer (as in the rendering server) for occluders in the given TileSet occlusion layer. - + + Enables or disables sdf collision for occluders in the given TileSet occlusion layer. @@ -389,6 +465,7 @@ + Sets the physics layer (as in the physics server) for bodies in the given TileSet physics layer. @@ -396,6 +473,7 @@ + Sets the physics layer (as in the physics server) for bodies in the given TileSet physics layer. @@ -403,13 +481,15 @@ + Sets the physics material for bodies in the given TileSet physics layer. - + + Changes a source's ID. @@ -417,6 +497,9 @@ + 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. @@ -425,6 +508,7 @@ + Sets a terrain's color. This color is used for identifying the different terrains in the TileSet editor. @@ -433,6 +517,7 @@ + Sets a terrain's name. @@ -440,86 +525,120 @@ + Sets a terrain mode. Each mode determines which bits of a tile shape is used to match the neighbouring 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), determines the offset axis. + The tile shape. + 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. + Enables/Disable uv clipping when rendering the tiles. - Orthogonal orientation mode. + Rectangular tile shape. - Isometric orientation mode. + Diamond tile shape (for isometric look). + Rectangular tile shape with one row/colum out of two offset by half a tile. - Hexagon orientation mode. + Hexagonal tile shape. + Tile coordinates layout where both axis stay consistent with their respective local horizontal and vertical axis. + Same as [code]TILE_LAYOUT_STAKED[/code], but the first half-offset is negative instead of positive. + Tile coordinates layout where the horizontal axis stay horizontal, and the vertical one goes down-right. + Tile coordinates layout where the vertical axis stay vertical, and the horizontal one goes down-right. + Tile coordinates layout where the horizontal axis goes up-right, and the vertical one goes down-right. + Tile coordinates layout where the horizontal axis goes down-right, and the vertical one goes down-left. + Horizontal half-offset. + Vertical half-offset. + Neighbor on the right side. + Neighbor in the right corner. + Neighbor on the bottom right side. + Neighbor in the bottom right corner. + Neighbor on the bottom side. + Neighbor in the bottom corner. + Neighbor on the bottom left side. + Neighbor in the bottom left corner. + Neighbor on the left side. + Neighbor in the left corner. + Neighbor on the top left side. + Neighbor in the top left corner. + Neighbor on the top side. + Neighbor in the top corner. + Neighbor on the top right side. + Neighbor in the top right corner. + Requires both corners and side to match with neighboring tiles' terrains. + Requires corners to match with neighboring tiles' terrains. + Requires sides to match with neighboring tiles' terrains. 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 @@ + Exposes a 2D atlas texture as a set of tiles for a [TileSet] 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]. @@ -13,11 +21,14 @@ + 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. + Clears all tiles that are defined outside the texture boundaries. @@ -25,6 +36,8 @@ + 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]. @@ -32,84 +45,55 @@ - - - - - - - - - - - - - + Creates a new tile at coords [code]atlas_coords[/code] with size [code]size[/code]. + 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]. + Returns the alternative ID a following call to [method create_alternative_tile] would return. + 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. - - - - - - - + + Returns the [TileData] object for the given atlas coordinates and alternative ID. + Returns the size of the tile (in the grid coordinates system) at coordinates [code]atlas_coords[/code]. - - - - - - - - - - - - - - - - - - + Returns a tile's texture region in the atlas texture. + Returns if this atlas has tiles outside of its texture. @@ -118,6 +102,9 @@ + 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]. @@ -125,12 +112,15 @@ + 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. + Remove a tile and its alternative at coordinates [code]atlas_coords[/code]. @@ -139,17 +129,23 @@ + 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. + Margins, in pixels, to offset the origin of the grid in the texture. + Separation, in pixels, between each tile texture region of the grid. + 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. 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 @@ + Exposes a set of scenes as tiles for a [TileSet] resource. + 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. @@ -12,83 +15,55 @@ - - - - - - - - - - - - - + Creates a scene-based tile out of the given scene. + Returns a newly generated unique ID. + Returns the scene ID a following call to [method create_scene_tile] would return. + Returns whether the scene tile with id [code]id[/code] displays a placeholder in the editor. + Returns the scene tile ID of the scene tile at index [code]index[/code]. + Returns the [PackedScene] resource of scene tile with id [code]id[/code]. - - - - - - - - - - - - - - - - - - + Returns the number or scene tiles this TileSet source has. - - - - - - + Returns whether this TileSet source has a scene tile with id [code]id[/code]. + Remove the scene tile with id [code]id[/code]. @@ -96,6 +71,7 @@ + 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. @@ -103,6 +79,7 @@ + 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]. @@ -110,6 +87,7 @@ + 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. 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 @@ + Exposes a set of tiles for a [TileSet] 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]. + + + + + + Returns the alternative ID for the tile with coordinates ID [code]atlas_coords[/code] at index [code]index[/code]. + + + + + + + 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. + + + + + + + Returns the tile coordinates ID of the tile with index [code]index[/code]. + + + + + + Returns how many tiles this atlas source defines (not including alternative tiles). + + + + + + + + Returns if the base tile at coordinates [code]atlas_coords[/code] has an alternative with ID [code]alternative_tile[/code]. + + + + + + + Returns if this atlas has a tile with coordinates ID [code]atlas_coordinates[/code]. + + -- cgit v1.2.3