Debian Codegraph @

doc/classes/TileSetScenesCollectionSource.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="TileSetScenesCollectionSource" inherits="TileSetSource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 Exposes a set of scenes as tiles for a [TileSet] resource.
5 </brief_description>
6 <description>
7 When placed on a [TileMapLayer], tiles from [TileSetScenesCollectionSource] will automatically instantiate an associated scene at the cell's position in the TileMapLayer.
8 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.
9 [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].
10 Use this code if you want to find the scene path at a given tile in [TileMapLayer]:
11 [codeblocks]
12 [gdscript]
13 var source_id = tile_map_layer.get_cell_source_id(Vector2i(x, y))
14 if source_id &gt; -1:
15 var scene_source = tile_map_layer.tile_set.get_source(source_id)
16 if scene_source is TileSetScenesCollectionSource:
17 var alt_id = tile_map_layer.get_cell_alternative_tile(Vector2i(x, y))
18 # The assigned PackedScene.
19 var scene = scene_source.get_scene_tile_scene(alt_id)
20 [/gdscript]
21 [csharp]
22 int sourceId = tileMapLayer.GetCellSourceId(new Vector2I(x, y));
23 if (sourceId &gt; -1)
24 {
25 TileSetSource source = tileMapLayer.TileSet.GetSource(sourceId);
26 if (source is TileSetScenesCollectionSource sceneSource)
27 {
28 int altId = tileMapLayer.GetCellAlternativeTile(new Vector2I(x, y));
29 // The assigned PackedScene.
30 PackedScene scene = sceneSource.GetSceneTileScene(altId);
31 }
32 }
33 [/csharp]
34 [/codeblocks]
35 </description>
36 <tutorials>
37 </tutorials>
38 <methods>
39 <method name="create_scene_tile">
40 <return type="int" />
41 <param index="0" name="packed_scene" type="PackedScene" />
42 <param index="1" name="id_override" type="int" default="-1" />
43 <description>
44 Creates a scene-based tile out of the given scene.
45 Returns a newly generated unique ID.
46 </description>
47 </method>
48 <method name="get_next_scene_tile_id" qualifiers="const">
49 <return type="int" />
50 <description>
51 Returns the scene ID a following call to [method create_scene_tile] would return.
52 </description>
53 </method>
54 <method name="get_scene_tile_display_placeholder" qualifiers="const">
55 <return type="bool" />
56 <param index="0" name="id" type="int" />
57 <description>
58 Returns whether the scene tile with [param id] displays a placeholder in the editor.
59 </description>
60 </method>
61 <method name="get_scene_tile_id">
62 <return type="int" />
63 <param index="0" name="index" type="int" />
64 <description>
65 Returns the scene tile ID of the scene tile at [param index].
66 </description>
67 </method>
68 <method name="get_scene_tile_scene" qualifiers="const">
69 <return type="PackedScene" />
70 <param index="0" name="id" type="int" />
71 <description>
72 Returns the [PackedScene] resource of scene tile with [param id].
73 </description>
74 </method>
75 <method name="get_scene_tiles_count">
76 <return type="int" />
77 <description>
78 Returns the number or scene tiles this TileSet source has.
79 </description>
80 </method>
81 <method name="has_scene_tile_id">
82 <return type="bool" />
83 <param index="0" name="id" type="int" />
84 <description>
85 Returns whether this TileSet source has a scene tile with [param id].
86 </description>
87 </method>
88 <method name="remove_scene_tile">
89 <return type="void" />
90 <param index="0" name="id" type="int" />
91 <description>
92 Remove the scene tile with [param id].
93 </description>
94 </method>
95 <method name="set_scene_tile_display_placeholder">
96 <return type="void" />
97 <param index="0" name="id" type="int" />
98 <param index="1" name="display_placeholder" type="bool" />
99 <description>
100 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.
101 </description>
102 </method>
103 <method name="set_scene_tile_id">
104 <return type="void" />
105 <param index="0" name="id" type="int" />
106 <param index="1" name="new_id" type="int" />
107 <description>
108 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].
109 </description>
110 </method>
111 <method name="set_scene_tile_scene">
112 <return type="void" />
113 <param index="0" name="id" type="int" />
114 <param index="1" name="packed_scene" type="PackedScene" />
115 <description>
116 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].
117 </description>
118 </method>
119 </methods>
120 </class>