Merge pull request #57121 from KoBeWi/noddeganger

Add `DUPLICATE_INTERNAL_STATE` flag
This commit is contained in:
Thaddeus Crews
2025-11-13 17:42:47 -06:00
3 changed files with 18 additions and 3 deletions

View File

@ -282,6 +282,7 @@
<description>
Duplicates the node, returning a new node with all of its properties, signals, groups, and children copied from the original. The behavior can be tweaked through the [param flags] (see [enum DuplicateFlags]). Internal nodes are not duplicated.
[b]Note:[/b] For nodes with a [Script] attached, if [method Object._init] has been defined with required parameters, the duplicated node will not have a [Script].
[b]Note:[/b] By default, this method will duplicate only properties marked for serialization (i.e. using [constant @GlobalScope.PROPERTY_USAGE_STORAGE], or in GDScript, [annotation @GDScript.@export]). If you want to duplicate all properties, use [constant DUPLICATE_INTERNAL_STATE].
</description>
</method>
<method name="find_child" qualifiers="const">
@ -1381,6 +1382,16 @@
<constant name="DUPLICATE_USE_INSTANTIATION" value="8" enum="DuplicateFlags">
Duplicate using [method PackedScene.instantiate]. If the node comes from a scene saved on disk, reuses [method PackedScene.instantiate] as the base for the duplicated node and its children.
</constant>
<constant name="DUPLICATE_INTERNAL_STATE" value="16" enum="DuplicateFlags">
Duplicate also non-serializable variables (i.e. without [constant @GlobalScope.PROPERTY_USAGE_STORAGE]).
</constant>
<constant name="DUPLICATE_DEFAULT" value="15" enum="DuplicateFlags">
Duplicate using default flags. This constant is useful to add or remove a single flag.
[codeblock]
# Duplicate non-exported variables.
var dupe = duplicate(DUPLICATE_DEFAULT | DUPLICATE_INTERNAL_STATE)
[/codeblock]
</constant>
<constant name="INTERNAL_MODE_DISABLED" value="0" enum="InternalMode">
The node will not be internal.
</constant>