Skip to content

Latest commit

 

History

History
368 lines (308 loc) · 49.3 KB

Reference_4.2.x.md

File metadata and controls

368 lines (308 loc) · 49.3 KB

YATI Reference

Contents

Options

Use Tilemap Layers

Default: Off

In Godot 4 a tilemap can have layers. So it's possible to generate one tilemap with several layers instead of several tilemaps.
Whoever prefers this behaviour (I don't) can switch on this option.
Only adjacent tilemaps are combined into one with layers.
Please note: Godot tilemap layers don't have offsets so if you have tile layers with offsets combining them into one Godot tilemap will end up looking wrong.

Use Default Filter

Default: Off

To ensure that looks are the same as in Tiled, all layer texture filters are set to "nearest". Setting this option to On leaves all texture filters as they are by default ('inherited').

Add Class as Metadata

(new since version 1.5.0)

Default: Off

If enabled the content of the Tiled class field is added to the metadata of the corresponding Godot elment.

Add Id as Metadata

(new since version 1.6.2)

Default: Off

If enabled the Tiled object id is added to the metadata of the corresponding Godot elment.

No Alternative Tiles

(new since version 1.6.5)

Default: Off

If enabled any flipped/rotated tiles are no longer created as alternative tiles.
An enhancement in Godot 4.2 makes this possible.
Please note: Rotated non-square tiles may appear wrongly placed if this option is On.
This currently can't be avoided due to Godot specifics.

Map Wangset to Terrain

(new since version 1.4.0)

Default: Off

Switch on the 'old' (prior to version 1.4.0) mapping where Tiled wangsets ('terrain sets') were mapped to Godot terrains to keep the terrain set names.

Tiled Project File

(new since version 1.6.0)

Default: None

Enable the use of Tiled's Custom Types by specifying the Tiled project file (.tiled-project).

Post Processor

Default: None

After import you can manipulate the genereted map by a post processor script. The script must have a method "_post_process" with a parameter of type Node2D (the base node of the generated map) and return the changed map as Node2D.
Please note: only owned nodes are saved to the final imported scene.

Further GDScript requirements: "extends Node"

Mini Example (manipulating the Material setting on element with name 'Area2'):

extends Node

func _post_process(base_node: Node2D):
	var area = base_node.find_child("Area2")
	var mat = CanvasItemMaterial.new()
	mat.blend_mode = CanvasItemMaterial.BLEND_MODE_MUL
	area.material = mat
	return base_node
	

Further C# Script requirements: Class name like .cs filename and inherit from Node.

Equivalent mini example (Post processor file is named 'PostProcessor.cs'):

using Godot;

public partial class PostProcessor: Node
{
    public Node2D _PostProcess(Node2D baseNode)
    {
        var area = (Area2D)baseNode.FindChild("Area2");
        var mat = new CanvasItemMaterial();
        mat.BlendMode = CanvasItemMaterial.BlendModeEnum.Mul;
        area.Material = mat;
        return baseNode;
    }
}
	

Save Tileset To

Default: None

Every map generated by the importer gets a Godot TileSet. This TileSet can be exported to a .tres file to use it otherwise.

Mapping from Tiled elements to Godot elements

Where applicable the mapping is controlled by an entry in the Tiled class field.
New since version 1.5.0: Mapping can alternatively be controlled by a custom property 'godot_node_type'.
Probably this new way is preferable if you want to keep open the use of Tiled's Custom Types.

Tile collision elements are controlled by custom properties of type 'int'.
Property value is the assigned layer number.

Names: The Tiled element name entry is mapped to the Godot element name.
If the Tiled name entry is empty a default Godot element name is created to avoid cryptic looking names.

Tiled Element Class or
godot_node_type
Property (type) Godot Element
Tile layer TileMap
Object layer Node2D
Group layer (Parent) Node2D
Image layer TextureRect
Tileset (tileset image) Atlas
Tileset (image collection) One atlas per image
Terrain Set ("wangset") Terrain Set
Terrain ("color") Terrain
Tile Collision polygon physics_layer (int) Physics layer polygon
navigation_layer (int) Navigation layer polygon
occlusion_layer (int) Occlusion layer polygon
Tile Collision rectangle physics_layer (int) Physics layer polygon
navigation_layer (int) Navigation layer polygon
occlusion_layer (int) Occlusion layer polygon
Tile collision ellipse n/a
Tile animation Tile animation (limited)
Tile object Sprite2D
area Area2D + Sprite2d + Coll.(*)
staticbody StaticBody2D + Sprite2D + Coll.(*)
characterbody CharacterBody2D + Sprite2D + Coll.(*)
rigidbody RigidBody2D + Sprite2D + Coll.(*)
instance res_path (file) Instantiated scene
Polygon object (staticbody) StaticBody2D + CollisionPolygon2D
area Area2D + CollisionPolygon2D
navigation NavigationRegion2D
occluder LightOccluder2D + OcclusionPolygon2D
polygon Polygon2D
instance res_path (file) Instantiated scene
Rectangle object (staticbody) StaticBody2D + Rectangle CollisionShape2D
area Area2D + Rectangle CollisionShape2D
navigation NavigationRegion2D
occluder LightOccluder2D + OcclusionPolygon2D
instance res_path (file) Instantiated scene
Ellipse object (staticbody) StaticBody2D + Capsule CollisionShape2D
area Area2D + Capsule CollisionShape2D
instance res_path (file) Instantiated scene
Polyline object (staticbody) StaticBody2D + Segment CollisionShape2D
area Area2D + Segment CollisionShape2D
line Line2D
path Path2D
Point object Marker2D
instance res_path (file) Instantiated scene
Text object Label

Coll.(*): All tile collision objects (except point), ellipse is approximated by capsule

Custom properties reference

Setting these properties affects the Godot settings accordingly.
Custom properties which are not in this list or not fitting to the element are added as Meta Data or - if assigned to a tile - as Custom Data.

Tile custom properties: The property name and type will refer to a layer in the Godot TileMap's Custom Data Layer array,
the property value is assigend to the tile's Custom Data entry which conists only of the layer number and the value.

New since v1.5.4: A special custom property godot_group to specify the Godot Group to which the imported element is assigned.
You can assign more than one group by passing the group names as a comma-separated list.

New since v1.6.0: You can download this file containing several Godot enums and import it using the Custom Type Editor

New since v1.6.6: A special custom property godot_script to specify a node script.

New since v1.6.8: A special custom property godot_atlas_id to force special atlas id values.
The property is either a tileset property or in case of an image collection tileset a tile property.
Please use this property only if you know what you're doing and why!

Remarks:

  • (*) refers to a string consisting of comma separated values, each value representing an element number to enable.
    Example for a collision layer property (name+value), where layers 1,3,5,6,7 on physics layer 0 are to enable:
    collision_layer_0 = 1,3,5-7 (you can set ranges like 5-7 in this example)
  • (col) refers to a string consisting of an # followed by hex (RGB) values. Example: #4e4aff
  • (enum) refers to an int, value can be taken from the list

Properties with "n is layer number": if number appendix is missing, layer 0 is assumed
i.e. "collision_layer" is equivalent to "collision_layer_0"

Properties of type 'file' refer to previously saved Godot resources e.g. 'material' or a script file.
By specifing the property and setting its value to the resource file path the resource will be loaded.
Please note: The numerous resource-specific properties, e.g. for materials, can only be set by loading previously saved resources.
This seems to be convenient as providing all of these properties would greatly inflate the already extensive list.

Godot Element Godot property Tiled Element (to set property) Custom property Type Enum value
Node Group(s) Layer / Object godot_group string (*)
Node Script Layer / Object godot_script file
TileSet Physics Layer n / Collision Layer Tileset collision_layer_n (n is layer number) string (*)
Physics Layer n / Collision Mask collision_mask_n (n is layer number) string (*)
Navigation Layer n / Layers layers_n (n is layer number) string (*)
UV Clipping uv_clipping bool
Occlusion Layer n / Light Mask light_mask_n (n is layer number) string (*)
Occlusion Layer n / SDF Collision sdf_collision_n (n is layer number) bool
Base Tile Texture Origin Tile texture_origin_x int
texture_origin_y int
Modulate modulate string (col)
Material material file
Z Index z_index int
Y Sort Origin y_sort_origin int
Physics Layer n / Linear Velocity linear_velocity_x_n (n is layer number) float
linear_velocity_y_n (n is layer number) float
Physics Layer n / Angular Velocity angular_velocity_n (n is layer number) float
Occlusion Layer Polygon Collision Polygon or Rectangle occlusion_layer int
Physics Layer Polygon Collision Polygon or Rectangle physics_layer int
One Way Collision Polygon or Rectangle one_way bool
One Way Margin Collision Polygon or Rectangle one_way_margin int
Navigation Layer Polygon Collision Polygon or Rectangle navigation_layer int
CanvasItem Modulate Layer / Object modulate string (col)
Self Modulate self_modulate string (col)
Show Behind Parent show_behind_parent bool
Top Level top_level bool
Clip Children clip_children int (enum) 0: Disabled, 1: Clip Only, 2: Clip+Draw
Light Mask light_mask string (*)
Visibility Layer visibility_layer string (*)
Z Index z_index or canvas_z_index int
Z As Relative z_as_relative bool
Y Sort Enabled y_sort_enabled bool
Texture Filter texture_filter int (enum) 0: Inherit, 1: Nearest, 2: Linear, 3: Nearest Mipmap, 4: Linear Mipmap, 5: Nearest Mipmap Anisotropic, 6: Linear Mipmap Anisotropic
Texture Repeat texture_repeat int (enum) 0: Inherit, 1: Nearest, 2: Linear, 3: Nearest Mipmap, 4: Linear Mipmap, 5: Nearest Mipmap Anisotropic, 6: Linear Mipmap Anisotropic
Material material file
Use Parent Material use_parent_material bool
TileMap Rendering Quadrant Size Tile layer rendering_quadrant_size int
Collision Animatable collision_animatable bool
Collision Visibility Mode collision_visibility_mode int (enum) 0: Default, 1: Force Show, 2: Force Hide
Navigation Visibility Mode navigation_visibility_mode int (enum) 0: Default, 1: Force Show, 2: Force Hide
TileMap Layer Z Index Tile layer z_index or layer_z_index int
Y Sort Origin y_sort_origin int
CollisionObject2D Disable Mode Objects with class "area" or "<.. >body" disable_mode int (enum) 0: Remove, 1: Make Static, 2: Keep Active
Collision Layer collision_layer string (*)
Collision Mask collision_mask string (*)
Collision Priority collision_priority float
Input Pickable input_pickable bool
CollisionPolygon2D Build Mode Polygon with class "staticbody" or "area" build_mode int (enum) 0: Solids, 1: Segments
(both Polgon+Shape) Disabled Objects with class "staticbody" or "area" disabled bool
(both Polgon+Shape) One Way Collision one_way_collision bool
(both Polgon+Shape) One Way Collision Margin one_way_collision_margin float
CollisionShape2D Debug Color debug_color string (col)
StaticBody2D Physics Material Override Objects with class "staticbody" physics_material_override file
Constant Linear Velocity constant_linear_velocity_x float
constant_linear_velocity_y float
Constant Angular Velocity constant_angular_velocity float
Area2D Monitoring Objects with class "area" monitoring bool
Monitorable monitorable bool
Priority priority float
Gravity Space Override gravity_space_override int (enum) 0: Disabled, 1: Combine, 2: Combine-Replace, 3: Replace, 4: Replace-Combine
Gravity Point Remark: if space_override not disabled gravity_point bool
Gravity Point Unit Distance Remark: if gravity_point on gravity_point_unit_distance float
Gravity Point Center gravity_point_center_x float
gravity_point_center_y float
Gravity Direction Remark: if gravity_point off gravity_direction_x float
gravity_direction_y float
Gravity gravity float
Linear Damp Space Override linear_damp_space_override int (enum) 0: Disabled, 1: Combine, 2: Combine-Replace, 3: Replace, 4: Replace-Combine
Linear Damp Remark: if space_override not disabled gravity float
Angular Damp Space Override angular_damp_space_override int (enum) 0: Disabled, 1: Combine, 2: Combine-Replace, 3: Replace, 4: Replace-Combine
Angular Damp Remark: if space_override not disabled gravity float
CharacterBody2D Motion Mode Tile objects with class "characterbody" motion_mode int (enum) 0: Grounded, 1: Floating
Up Direction Remark: if motion mode 'Grounded' up_direction_x float
up_direction_y float
Slide on Ceiling Remark: if motion mode 'Grounded' slide_on_ceiling bool
Wall Min Slide Angle Remark: if motion mode 'Floating' wall_min_slide_angle float
(Floor) Stop on Slope floor_stop_on_slope bool
(Floor) Constant Speed floor_constant_speed bool
(Floor) Block on Wall floor_block_on_wall bool
(Floor) Max Angle Remark: value in radians floor_max_angle float
(Floor) Snap Length floor_snap_length float
(Platform) On Leave platform_on_leave int (enum) 0: Add Velocity, 1: Add Upward Velocity, 2: Do Nothing
(Platform) Floor Layers platform_floor_layers string (*)
(Platform) Wall Layers platform_wall_layers string (*)
(Collision) Safe Margin safe_margin float
(Collision) Collision Layer collision_layer string (*)
(Collision) Collision Mask collision_mask string (*)
(Collision) Priority collision_priority float
RigidBody2D Mass Tile objects with class "rigidbody" mass float
Inertia inertia float
Center of Mass Mode center_of_mass_mode int (enum) 0: Auto, 1: Custom
Physics Material Override physics_material_override file
Gravity Scale gravity_scale float
Custom Integrator custom_integrator bool
Continuous CD continuous_cd int (enum) 0: Disabled, 1: Cast Ray, 2: Cast Shape
Max Contacts Reported max_contacts_reported int
Contact Monitor contact_monitor bool
Sleeping sleeping bool
Can Sleep can_sleep bool
Lock Rotation lock_rotation bool
Freeze freeze bool
Freeze Mode freeze_mode int (enum) 0: Static, 1: Kinematic
Linear Velocity linear_velocity_x float
linear_velocity_y float
(Linear) Damp Mode linear_damp_mode int (enum) 0: Combine, 1: Replace
(Linear) Damp linear_damp float
Angular Velocity angular_velocity float
(Angular) Damp Mode angular_damp_mode int (enum) 0: Combine, 1: Replace
(Angular) Damp angular_damp float
Constant Force constant_force_x float
constant_force_y float
Constant Torque constant_torque float
NavigationRegion2D Enabled Objects with class "navigation" enabled bool
Navigation Layers navigation_layers string (*)
Enter Cost enter_cost float
Travel Cost travel_cost float
LightOccluder2D SDF Collision Objects with class "occluder" sdf_collision bool
Occluder Light Mask occluder_light_mask string (*)
Polygon2D Color Objects with class "polygon" color string (col)
Line2D Width Objects with class "line" width float
Default Color default_color string (col)
Marker2D Gizmo Extents Point object gizmo_extents float

Specialities

  • For some custom properties e.g. 'use_parent_material' there's a catch that this can be ambiguous.
    Example: A rectangle with class 'staticbody' is mapped to a StaticBody2D (parent) + a CollisionShape2D (child).
    Both elements do have a 'use_parent_material' property. Which one of them should the property affect?
    By default the property affects the parent.
    If you want the property to affect the child, prefix the name with two underscores e.g. '__use_parent_material'
  • If linear texture filters are in effect, on tile objects (which are mapped to a Sprite2D) it may happen that the sprite shows artifacts on the border.
    This can be overcome by adding a special property to the object named 'clip_artifacts' and setting it to On.
  • Skip Tiled layers by adding a custom property 'no_import' (type bool) and set it to 'true' (new in v1.2).
  • The TileMap property 'Z Index' is ambiguous, as this property exists for the CanvasItem as well as for each TileMap layer.
    Which one is set is determined by the 'Use tilemap layers' setting. If enabled the layer's 'z_index' is set, otherwise the canvas item's.
    You can be explicit about this by naming the properties 'canvas_z_index' or 'layer_z_index'.