2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								<?xml version="1.0" encoding="UTF-8" ?> 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-06 10:08:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								<class  name= "TileSetScenesCollectionSource"  inherits= "TileSetSource"  xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation= "../class.xsd" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									<brief_description > 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-06 11:56:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Exposes a set of scenes as tiles for a [TileSet] resource.
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									</brief_description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									<description > 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-07 18:36:47 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										When placed on a [TileMapLayer], tiles from [TileSetScenesCollectionSource] will automatically instantiate an associated scene at the cell's position in the TileMapLayer.
							 
						 
					
						
							
								
									
										
										
										
											2025-07-01 17:08:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Scenes are instantiated as children of the [TileMapLayer] after it enters the tree, at the end of the frame (their creation is deferred). If you add/remove a scene tile in the [TileMapLayer] that is already inside the tree, the [TileMapLayer] will automatically instantiate/free the scene accordingly.
							 
						 
					
						
							
								
									
										
										
										
											2024-07-13 22:38:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										[b]Note:[/b] Scene tiles all occupy one tile slot and instead use alternate tile ID to identify scene index. [method TileSetSource.get_tiles_count] will always return [code]1[/code]. Use [method get_scene_tiles_count] to get a number of scenes in a [TileSetScenesCollectionSource].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Use this code if you want to find the scene path at a given tile in [TileMapLayer]:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										[codeblocks]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										[gdscript]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var source_id = tile_map_layer.get_cell_source_id(Vector2i(x, y))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if source_id >  -1:
							 
						 
					
						
							
								
									
										
										
										
											2025-05-17 20:00:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											var scene_source = tile_map_layer.tile_set.get_source(source_id)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if scene_source is TileSetScenesCollectionSource:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												var alt_id = tile_map_layer.get_cell_alternative_tile(Vector2i(x, y))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												# The assigned PackedScene.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												var scene = scene_source.get_scene_tile_scene(alt_id)
							 
						 
					
						
							
								
									
										
										
										
											2024-07-13 22:38:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										[/gdscript]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										[csharp]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int sourceId = tileMapLayer.GetCellSourceId(new Vector2I(x, y));
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if (sourceId >  -1)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{
							 
						 
					
						
							
								
									
										
										
										
											2025-05-17 20:00:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											TileSetSource source = tileMapLayer.TileSet.GetSource(sourceId);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if (source is TileSetScenesCollectionSource sceneSource)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int altId = tileMapLayer.GetCellAlternativeTile(new Vector2I(x, y));
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// The assigned PackedScene.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												PackedScene scene = sceneSource.GetSceneTileScene(altId);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}
							 
						 
					
						
							
								
									
										
										
										
											2024-07-13 22:38:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										[/csharp]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										[/codeblocks]
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									<tutorials > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									</tutorials> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									<methods > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "create_scene_tile" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<param  index= "0"  name= "packed_scene"  type= "PackedScene"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											<param  index= "1"  name= "id_override"  type= "int"  default= "-1"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-06 11:56:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Creates a scene-based tile out of the given scene.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												Returns a newly generated unique ID.
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "get_next_scene_tile_id"  qualifiers= "const" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-06 11:56:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Returns the scene ID a following call to [method create_scene_tile] would return.
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "get_scene_tile_display_placeholder"  qualifiers= "const" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "bool"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<param  index= "0"  name= "id"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 11:19:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Returns whether the scene tile with [param id] displays a placeholder in the editor.
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "get_scene_tile_id" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<param  index= "0"  name= "index"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 11:19:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Returns the scene tile ID of the scene tile at [param index].
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "get_scene_tile_scene"  qualifiers= "const" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "PackedScene"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<param  index= "0"  name= "id"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 11:19:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Returns the [PackedScene] resource of scene tile with [param id].
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "get_scene_tiles_count" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-06 11:56:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Returns the number or scene tiles this TileSet source has.
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "has_scene_tile_id" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "bool"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<param  index= "0"  name= "id"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 11:19:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Returns whether this TileSet source has a scene tile with [param id].
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "remove_scene_tile" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<param  index= "0"  name= "id"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 11:19:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Remove the scene tile with [param id].
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "set_scene_tile_display_placeholder" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<param  index= "0"  name= "id"  type= "int"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											<param  index= "1"  name= "display_placeholder"  type= "bool"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 11:19:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Sets whether or not the scene tile with [param id] should display a placeholder in the editor. This might be useful for scenes that are not visible.
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "set_scene_tile_id" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<param  index= "0"  name= "id"  type= "int"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											<param  index= "1"  name= "new_id"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-01 18:09:49 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Changes a scene tile's ID from [param id] to [param new_id]. This will fail if there is already a tile with an ID equal to [param new_id].
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										<method  name= "set_scene_tile_scene" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											<param  index= "0"  name= "id"  type= "int"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											<param  index= "1"  name= "packed_scene"  type= "PackedScene"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-07 18:36:47 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Assigns a [PackedScene] resource to the scene tile with [param id]. This will fail if the scene does not extend [CanvasItem], as positioning properties are needed to place the scene on the [TileMapLayer].
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 15:40:52 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									</methods> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								</class>