Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicated callings set() from SceneTreeDock #87834

Merged

Conversation

TokageItLab
Copy link
Member

@TokageItLab TokageItLab commented Feb 1, 2024

Fixes #77866

SceneTreeDock modifies the value of NodePath when there is a change in the tree, but it duplicates a direct set() call, even though the modification is executed in the UndoRedo::add_do_property() method.

This duplicated calling is problematic because it indicates an invalid NodePath, since it is actually called before the Node path change is complete. This is also problematic because unlike applying internal properties it calls the actual setter. Basically, setters should not be called if NodePath points to the same thing.

For example, when setting the ExternalSkeleton in BoneAttachment, the ObjectID of the Node is cached, but it does not indicate the correct Node at the time of the first call when the BoneAttachment change the nest in the SceneTree, then the error is caused. (But the UndoRedo::add_do_property() is fired immediately after the first call, so the error is resolved immediately afterwards).

This PR remove these unneeded callings set().

@TokageItLab TokageItLab added this to the 4.3 milestone Feb 1, 2024
@TokageItLab TokageItLab requested a review from a team February 1, 2024 19:57
@TokageItLab TokageItLab requested a review from a team as a code owner February 1, 2024 19:57
@TokageItLab TokageItLab changed the title Remove duplicated set() methods from SceneTreeDock Remove duplicated set() callings from SceneTreeDock Feb 1, 2024
@TokageItLab TokageItLab changed the title Remove duplicated set() callings from SceneTreeDock Remove duplicated callings set() from SceneTreeDock Feb 1, 2024
@akien-mga akien-mga merged commit 45e9d20 into godotengine:master Feb 5, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@TokageItLab TokageItLab deleted the remove-dupecall-scene-tree-dock branch February 14, 2024 05:38
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.

NodePath property setter triggers twice when reparenting the node
3 participants