[DOCS] Node & PackedScene (#17833)
* [DOCS] Node: SceneSaver -> PackedScene * [DOCS] PackedScene: Code example, resolve TODO
This commit is contained in:
parent
b59ae81538
commit
13d5ee01f9
2 changed files with 9 additions and 2 deletions
|
@ -746,7 +746,7 @@
|
||||||
The name of the node. This name is unique among the siblings (other child nodes from the same parent). When set to an existing name, the node will be automatically renamed
|
The name of the node. This name is unique among the siblings (other child nodes from the same parent). When set to an existing name, the node will be automatically renamed
|
||||||
</member>
|
</member>
|
||||||
<member name="owner" type="Node" setter="set_owner" getter="get_owner">
|
<member name="owner" type="Node" setter="set_owner" getter="get_owner">
|
||||||
The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using SceneSaver) all the nodes it owns will be saved with it. This allows for the creation of complex [SceneTree]s, with instancing and subinstancing.
|
The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using [PackedScene]) all the nodes it owns will be saved with it. This allows for the creation of complex [SceneTree]s, with instancing and subinstancing.
|
||||||
</member>
|
</member>
|
||||||
<member name="pause_mode" type="int" setter="set_pause_mode" getter="get_pause_mode" enum="Node.PauseMode">
|
<member name="pause_mode" type="int" setter="set_pause_mode" getter="get_pause_mode" enum="Node.PauseMode">
|
||||||
Pause mode. How the node will behave if the [SceneTree] is paused.
|
Pause mode. How the node will behave if the [SceneTree] is paused.
|
||||||
|
|
|
@ -5,7 +5,14 @@
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
A simplified interface to a scene file. Provides access to operations and checks that can be performed on the scene resource itself.
|
A simplified interface to a scene file. Provides access to operations and checks that can be performed on the scene resource itself.
|
||||||
TODO: explain ownership, and that node does not need to own itself
|
Can be used to save a node to a file. When saving, the node as well as all the node it owns get saved (see [code]owner[/code] property on [Node]). Note that the node doesn't need to own itself.
|
||||||
|
Example of saving a node:
|
||||||
|
[codeblock]
|
||||||
|
var scene = PackedScene.new()
|
||||||
|
var result = scene.pack(child)
|
||||||
|
if result == OK:
|
||||||
|
ResourceSaver.save("res://path/name.scn", scene) // or user://...
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
|
Loading…
Reference in a new issue