-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Don't access Node3D/Node2D/Control global transform in reparent
unless needed
#89003
Don't access Node3D/Node2D/Control global transform in reparent
unless needed
#89003
Conversation
Changes are looking good. An alternative solution for the referenced bug report would be to make Lines 345 to 346 in df78c06
|
This has significant implications though, see #70443 and #74659. But more importantly, there is no reason to request the global transform if we're not going to use it when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the links to the other PRs - I was not aware of them.
I agree that this solution is correct .
Perhaps the same change should also be done for Node2D
Lines 144 to 151 in df78c06
void Node2D::reparent(Node *p_parent, bool p_keep_global_transform) { | |
ERR_THREAD_GUARD; | |
Transform2D temp = get_global_transform(); | |
Node::reparent(p_parent); | |
if (p_keep_global_transform) { | |
set_global_transform(temp); | |
} | |
} |
Edit: ... and Control::reparent
…ess needed Fixes godotengine#89002. Co-authored-by: Tamás Gálffy <ezittgtx@gmail.com>
005b2fb
to
810a0db
Compare
reparent
unless enabledreparent
unless needed
Good catch! Done. |
Cherry-picked for 4.2.2. |
Fixes #89002.
Marked as co-authored by @elementbound who found what the problem was. The solution needs to be slightly different to the one suggested in #89002, as the global transform needs to be fetched before reparenting, otherwise it won't work.