| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="InstancePlaceholder" inherits="Node" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Placeholder for the root [Node] of a [PackedScene]. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | Turning on the option [b]Load As Placeholder[/b] for an instantiated scene in the editor causes it to be replaced by an [InstancePlaceholder] when running the game, this will not replace the node in the editor. This makes it possible to delay actually loading the scene until calling [method create_instance]. This is useful to avoid loading large scenes all at once by loading parts of it selectively. |
| 8 | [b]Note:[/b] Like [Node], [InstancePlaceholder] does not have a transform. This causes any child nodes to be positioned relatively to the [Viewport] origin, rather than their parent as displayed in the editor. Replacing the placeholder with a scene with a transform will transform children relatively to their parent again. |
| 9 | </description> |
| 10 | <tutorials> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="create_instance"> |
| 14 | <return type="Node" /> |
| 15 | <param index="0" name="replace" type="bool" default="false" /> |
| 16 | <param index="1" name="custom_scene" type="PackedScene" default="null" /> |
| 17 | <description> |
| 18 | Call this method to actually load in the node. The created node will be placed as a sibling [i]above[/i] the [InstancePlaceholder] in the scene tree. The [Node]'s reference is also returned for convenience. |
| 19 | [b]Note:[/b] [method create_instance] is not thread-safe. Use [method Object.call_deferred] if calling from a thread. |
| 20 | </description> |
| 21 | </method> |
| 22 | <method name="get_instance_path" qualifiers="const"> |
| 23 | <return type="String" /> |
| 24 | <description> |
| 25 | Gets the path to the [PackedScene] resource file that is loaded by default when calling [method create_instance]. Not thread-safe. Use [method Object.call_deferred] if calling from a thread. |
| 26 | </description> |
| 27 | </method> |
| 28 | <method name="get_stored_values"> |
| 29 | <return type="Dictionary" /> |
| 30 | <param index="0" name="with_order" type="bool" default="false" /> |
| 31 | <description> |
| 32 | Returns the list of properties that will be applied to the node when [method create_instance] is called. |
| 33 | If [param with_order] is [code]true[/code], a key named [code].order[/code] (note the leading period) is added to the dictionary. This [code].order[/code] key is an [Array] of [String] property names specifying the order in which properties will be applied (with index 0 being the first). |
| 34 | </description> |
| 35 | </method> |
| 36 | </methods> |
| 37 | </class> |