Skip to content

Add DUPLICATE_INTERNAL_STATE flag#57121

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
KoBeWi:noddeganger
Nov 13, 2025
Merged

Add DUPLICATE_INTERNAL_STATE flag#57121
Repiteo merged 1 commit into
godotengine:masterfrom
KoBeWi:noddeganger

Conversation

@KoBeWi
Copy link
Copy Markdown
Member

@KoBeWi KoBeWi commented Jan 24, 2022

Resolves #3393

@KoBeWi KoBeWi added this to the 4.0 milestone Jan 24, 2022
@KoBeWi KoBeWi requested review from a team as code owners January 24, 2022 13:54
@KoBeWi KoBeWi force-pushed the noddeganger branch 2 times, most recently from 5677b59 to 13f8e72 Compare January 24, 2022 16:30
@YuriSizov YuriSizov modified the milestones: 4.0, 4.x Aug 16, 2022
@YuriSizov
Copy link
Copy Markdown
Contributor

Is this still needed? @kubecz3k doesn't seem to recall if it is 🙃

@KoBeWi
Copy link
Copy Markdown
Member Author

KoBeWi commented Aug 16, 2022

Well, internal (non-exported) properties are still not duplicated, soo...

@kubecz3k
Copy link
Copy Markdown
Contributor

kubecz3k commented Aug 17, 2022

So I updated the original issue by converting reproduction project from Godot (1.x?) to Godot 4. I can confirm the issue is still the same.

Also to clarify: the issue is about usage of Object.duplicate() method and the fact that variables of returned object (even simple types) are different from the object from which it has been duplicated

Leaved some additional comment in the issue #3393 (comment)

@KoBeWi KoBeWi force-pushed the noddeganger branch 2 times, most recently from 53d397e to d040f0d Compare March 12, 2024 19:22
@KoBeWi KoBeWi requested review from a team as code owners March 12, 2024 19:22
@KoBeWi KoBeWi force-pushed the noddeganger branch 5 times, most recently from 2784e61 to 406e926 Compare March 12, 2024 20:50
@KoBeWi KoBeWi requested a review from a team as a code owner May 6, 2025 18:41
@akien-mga akien-mga changed the title Add DUPLICATE_INTERNAL_STATE flag Add DUPLICATE_INTERNAL_STATE flag May 7, 2025
Comment thread scene/main/node.compat.inc Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why validation still fails:

Validate extension JSON: Error: Hash changed for 'classes/Node/methods/duplicate', from D14E1583 to A4AD8DB9. This means that the function has changed and no compatibility function was provided.

The compat binding seems correct to me.

Maybe because you didn't change the C++ prototype of Node::duplicate itself to add the new default flag? Though I don't see why it would be involved here.

@KoBeWi
Copy link
Copy Markdown
Member Author

KoBeWi commented Jul 12, 2025

Ok I reworked the changes a bit. The PR no longer breaks compatibility, but the new flag is not enabled by default. Instead I improved the documentation and added a new DUPLICATE_DEFAULT flag to make the new flag easier to use.

@Ivorforce Ivorforce requested a review from RandomShaper July 14, 2025 11:24
@KoBeWi KoBeWi modified the milestones: 4.x, 4.6 Sep 23, 2025
@Repiteo Repiteo merged commit 6a3d1f1 into godotengine:master Nov 13, 2025
20 checks passed
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented Nov 13, 2025

Thanks!

@KoBeWi KoBeWi deleted the noddeganger branch November 13, 2025 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Node duplicate() doesn't copy internal variables values

7 participants