From a3dda2df85bf3e3ef82dbe1c2377640b9f3fd9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilles=20Roudi=C3=A8re?= Date: Fri, 7 May 2021 15:41:39 +0200 Subject: Rework the TileSet resource and TileMap nodes: - Move most properties from TileMap to TileSet, - Make TileSet more flexible, supporting more feature (several collision layers, etc...), - Fusion both the TileMap and TileSet editor, - Implement TileSetSources, and thus a new way to index tiles in the TileSet, - Rework the TileSet and TileMap editors completely, - Implement an editor zoom widget (and use it in several places) --- doc/classes/TileData.xml | 245 +++++++++++++ doc/classes/TileMap.xml | 278 ++------------- doc/classes/TileSet.xml | 705 ++++++++----------------------------- doc/classes/TileSetAtlasSource.xml | 207 +++++++++++ doc/classes/TileSetSource.xml | 13 + 5 files changed, 636 insertions(+), 812 deletions(-) create mode 100644 doc/classes/TileData.xml create mode 100644 doc/classes/TileSetAtlasSource.xml create mode 100644 doc/classes/TileSetSource.xml (limited to 'doc') diff --git a/doc/classes/TileData.xml b/doc/classes/TileData.xml new file mode 100644 index 0000000000..e3bc910ab6 --- /dev/null +++ b/doc/classes/TileData.xml @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 205b342ba8..76d8f1840f 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -31,53 +31,46 @@ Clears cells that do not exist in the tileset. - + - - - + - Returns the tile index of the given cell. If no tile exists in the cell, returns [constant INVALID_CELL]. - - + + - - - + - Returns the coordinate (subtile column and row) of the autotile variation in the tileset. Returns a zero vector if the cell doesn't have autotiling. - + - + - Returns the tile index of the cell given by a Vector2. If no tile exists in the cell, returns [constant INVALID_CELL]. - - + + - + + + - Returns [code]true[/code] if the given collision layer bit is set. - - + + - + - Returns [code]true[/code] if the given collision mask bit is set. @@ -87,15 +80,6 @@ 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 an array of all cells with the given tile [code]index[/code]. - - @@ -103,155 +87,26 @@ Returns a rectangle enclosing the used (non-empty) tiles of the map. - - - - - - - - - Returns [code]true[/code] if the given cell is transposed, i.e. the X and Y axes are swapped. - - - - - - - - - - - Returns [code]true[/code] if the given cell is flipped in the X axis. - - - - - - - - - - - Returns [code]true[/code] if the given cell is flipped in the Y axis. - - - - - Returns the local position corresponding to the given tilemap (grid-based) coordinates. - Optionally, the tilemap's half offset can be ignored. - - - - - - - - - - - - - - - - Sets the tile index for the cell given by a Vector2. - An index of [code]-1[/code] clears the cell. - Optionally, the tile can also be flipped, transposed, or given autotile coordinates. The autotile coordinate refers to the column and row of the subtile. - [b]Note:[/b] Data such as navigation polygons and collision shapes are not immediately updated for performance reasons. - If you need these to be immediately updated, you can call [method update_dirty_quadrants]. - Overriding this method also overrides it internally, allowing custom logic to be implemented when tiles are placed/removed: - [codeblocks] - [gdscript] - func set_cell(x, y, tile, flip_x=false, flip_y=false, transpose=false, autotile_coord=Vector2()): - # Write your custom logic here. - # To call the default method: - .set_cell(x, y, tile, flip_x, flip_y, transpose, autotile_coord) - [/gdscript] - [csharp] - public void SetCell(int x, int y, int tile, bool flipX = false, bool flipY = false, bool transpose = false, Vector2 autotileCoord = new Vector2()) - { - // Write your custom logic here. - // To call the default method: - base.SetCell(x, y, tile, flipX, flipY, transpose, autotileCoord); - } - [/csharp] - [/codeblocks] - - - - - - - - - - - - - - - - - Sets the tile index for the given cell. - An index of [code]-1[/code] clears the cell. - Optionally, the tile can also be flipped or transposed. - [b]Note:[/b] Data such as navigation polygons and collision shapes are not immediately updated for performance reasons. - If you need these to be immediately updated, you can call [method update_dirty_quadrants]. - - - - - - - - - - - Sets the given collision layer bit. - - - - - - + - + - - Sets the given collision mask bit. - - - - - - - - - Applies autotiling rules to the cell (and its adjacent cells) referenced by its grid-based X and Y coordinates. - - - - - - + - + - Applies autotiling rules to the cells in the given region (specified by grid-based X and Y coordinates). - Calling with invalid (or missing) parameters applies autotiling rules for the entire tilemap. @@ -262,7 +117,7 @@ - + @@ -272,110 +127,19 @@ - - If [code]true[/code], this TileMap bakes a navigation region. - - - If [code]true[/code], the cell's UVs will be clipped. - - - The custom [Transform2D] to be applied to the TileMap's cells. - - - Amount to offset alternating tiles. See [enum HalfOffset] for possible values. - The TileMap's quadrant size. Optimizes drawing by batching, using chunks of this size. - - The TileMap's cell size. - - - Position for tile origin. See [enum TileOrigin] for possible values. - - - If [code]true[/code], the TileMap's direct children will be drawn in order of their Y coordinate. - - - If [code]true[/code], the textures will be centered in the middle of each tile. This is useful for certain isometric or top-down modes when textures are made larger or smaller than the tiles (e.g. to avoid flickering on tile edges). The offset is still applied, but from the center of the tile. If used, [member compatibility_mode] is ignored. - If [code]false[/code], the texture position start in the top-left corner unless [member compatibility_mode] is enabled. - - - Bounce value for static body collisions (see [code]collision_use_kinematic[/code]). - - - Friction value for static body collisions (see [code]collision_use_kinematic[/code]). - - - The collision layer(s) for all colliders in the TileMap. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information. - - - The collision mask(s) for all colliders in the TileMap. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information. - - - If [code]true[/code], TileMap collisions will be handled as a kinematic body. If [code]false[/code], collisions will be handled as static body. - - - If [code]true[/code], this tilemap's collision shape will be added to the collision shape of the parent. The parent has to be a [CollisionObject2D]. - - - If [code]true[/code], the compatibility with the tilemaps made in Godot 3.1 or earlier is maintained (textures move when the tile origin changes and rotate if the texture size is not homogeneous). This mode presents problems when doing [code]flip_h[/code], [code]flip_v[/code] and [code]transpose[/code] tile operations on non-homogeneous isometric tiles (e.g. 2:1), in which the texture could not coincide with the collision, thus it is not recommended for isometric or non-square tiles. - If [code]false[/code], the textures do not move when doing [code]flip_h[/code], [code]flip_v[/code] operations if no offset is used, nor when changing the tile origin. - The compatibility mode doesn't work with the [member centered_textures] option, because displacing textures with the [member cell_tile_origin] option or in irregular tiles is not relevant when centering those textures. - - - The TileMap orientation mode. See [enum Mode] for possible values. - - - The light mask assigned to all light occluders in the TileMap. The TileSet's light occluders will cast shadows only from Light2D(s) that have the same light mask(s). - The assigned [TileSet]. - + - Emitted when a tilemap setting has changed. - - Returned when a cell doesn't exist. - - - Orthogonal orientation mode. - - - Isometric orientation mode. - - - Custom orientation mode. - - - Half offset on the X coordinate. - - - Half offset on the Y coordinate. - - - Half offset disabled. - - - Half offset on the X coordinate (negative). - - - Half offset on the Y coordinate (negative). - - - Tile origin at its top-left corner. - - - Tile origin at its center. - - - Tile origin at its bottom-left corner. - diff --git a/doc/classes/TileSet.xml b/doc/classes/TileSet.xml index adc5880c71..13c6b9070a 100644 --- a/doc/classes/TileSet.xml +++ b/doc/classes/TileSet.xml @@ -17,752 +17,347 @@ https://godotengine.org/asset-library/asset/113 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Determines when the auto-tiler should consider two different auto-tile IDs to be bound together. - [b]Note:[/b] [code]neighbor_id[/code] will be [code]-1[/code] ([constant TileMap.INVALID_CELL]) when checking a tile against an empty neighbor tile. - - - - - - - - - Clears all bitmask information of the autotile. - - - + - - - + - - Returns the bitmask of the subtile from an autotile given its coordinates. - The value is the sum of the values in [enum AutotileBindings] present in the subtile (e.g. a value of 5 means the bitmask has bindings in both the top left and top right). - - - - - - + - Returns the [enum BitmaskMode] of the autotile. - - - - - - - Returns the subtile that's being used as an icon in an atlas/autotile given its coordinates. - The subtile defined as the icon will be used as a fallback when the atlas/autotile's bitmask information is incomplete. It will also be used to represent it in the TileSet editor. - - - - - - - - - - - Returns the light occluder of the subtile from an atlas/autotile given its coordinates. - - - - - - - - - - - Returns the navigation polygon of the subtile from an atlas/autotile given its coordinates. - - - - - - - - - Returns the size of the subtiles in an atlas/autotile. - - - + - + - Returns the spacing between subtiles of the atlas/autotile. - + - - - - - Returns the priority of the subtile from an autotile given its coordinates. - When more than one subtile has the same bitmask value, one of them will be picked randomly for drawing. Its priority will define how often it will be picked. - + - - - + - Returns the drawing index of the subtile from an atlas/autotile given its coordinates. - - - - - - - - - - - Sets the bitmask of the subtile from an autotile given its coordinates. - The value is the sum of the values in [enum AutotileBindings] present in the subtile (e.g. a value of 5 means the bitmask has bindings in both the top left and top right). - - - - - - - - - - - Sets the [enum BitmaskMode] of the autotile. - - - - - - - - - - - Sets the subtile that will be used as an icon in an atlas/autotile given its coordinates. - The subtile defined as the icon will be used as a fallback when the atlas/autotile's bitmask information is incomplete. It will also be used to represent it in the TileSet editor. - - - - - - - - - - - - - Sets the light occluder of the subtile from an atlas/autotile given its coordinates. - - - - - - - - - - - - - Sets the navigation polygon of the subtile from an atlas/autotile given its coordinates. - - - - + + - - - + - Sets the size of the subtiles in an atlas/autotile. - - + + - - - + - Sets the spacing between subtiles of the atlas/autotile. - - + + - - - - - + - Sets the priority of the subtile from an autotile given its coordinates. - When more than one subtile has the same bitmask value, one of them will be picked randomly for drawing. Its priority will define how often it will be picked. - - + + - - - - - + - Sets the drawing index of the subtile from an atlas/autotile given its coordinates. - - + + - - Clears all tiles. - - - - - - + - Creates a new tile with the given ID. - + - - - Returns the first tile matching the given name. - + - - Returns the ID following the last currently used ID, useful when creating a new tile. - - - - - - - Returns an array of all currently used tile IDs. - - - - - - + - Removes the given tile ID. - - - - - - - - - - - - - - - Adds a shape to the tile. - - - - - - - - - Returns the tile's light occluder. - - - - - - - - - Returns the tile's material. - - - + - - - - Returns the tile's modulation color. - - - - - - - - - Returns the tile's name. - - - - - - + - - Returns the navigation polygon of the tile. - - - - - - + - Returns the offset of the tile's navigation polygon. - - + + - + - - Returns the offset of the tile's light occluder. - - - - - - + - Returns the tile sub-region in the texture. - - + + - - - + - Returns a tile's given shape. - + - - - - Returns the number of shapes assigned to a tile. - - - - - - - - + - Returns the offset of a tile's shape. - + - - - - - - Returns the one-way collision value of a tile's shape. - - - - - - - - - - - - - - - - - - - - - Returns the [Transform2D] of a tile's shape. - - - - - - - - - Returns an array of dictionaries describing the tile's shapes. - [b]Dictionary structure in the array returned by this method:[/b] - [codeblock] - { - "autotile_coord": Vector2, - "one_way": bool, - "one_way_margin": int, - "shape": CollisionShape2D, - "shape_transform": Transform2D, - } - [/codeblock] - - - - - - - - - Returns the tile's texture. - - - - - - - - - Returns the texture offset of the tile. - - - - - - + - Returns the tile's [enum TileMode]. - - - - - - - Returns the tile's Z index (drawing layer). - - - - - - - - - - - Sets a light occluder for the tile. - - - - - - - - - - - Sets the tile's material. - - - - - - - - - - - Sets the tile's modulation color. - - - - - - - - - - - Sets the tile's name. - - - + - - - + - Sets the tile's navigation polygon. - + - + - + - Sets an offset for the tile's navigation polygon. - + - + - + - Sets an offset for the tile's light occluder. - + - + - + - Sets the tile's sub-region in the texture. This is common in texture atlases. - + - - - + - + - Sets a shape for the tile, enabling collision. - + - - - + - + - Sets the offset of a tile's shape. - + - + - - - + - Enables one-way collision on a tile's shape. - + - - - + - + - + - + - + - + - Sets a [Transform2D] on a tile's shape. - + - + - - - - Sets an array of shapes for the tile, enabling collision. - - - - - - - - - - - Sets the tile's texture. - - - - - - + - + - Sets the tile's texture offset. - + - + - + - Sets the tile's [enum TileMode]. - + - + - + - Sets the tile's drawing index. + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/doc/classes/TileSetAtlasSource.xml b/doc/classes/TileSetAtlasSource.xml new file mode 100644 index 0000000000..a7a304ca27 --- /dev/null +++ b/doc/classes/TileSetAtlasSource.xml @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/TileSetSource.xml b/doc/classes/TileSetSource.xml new file mode 100644 index 0000000000..6a3029bb3f --- /dev/null +++ b/doc/classes/TileSetSource.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + -- cgit v1.2.3