mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Don't access Node3D/Node2D/Control global transform in reparent
unless needed
Fixes #89002. Co-authored-by: Tamás Gálffy <ezittgtx@gmail.com>
This commit is contained in:
parent
b5d30f9efe
commit
810a0dbff1
@ -143,10 +143,12 @@ void Node2D::_update_transform() {
|
||||
|
||||
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) {
|
||||
Transform2D temp = get_global_transform();
|
||||
Node::reparent(p_parent);
|
||||
set_global_transform(temp);
|
||||
} else {
|
||||
Node::reparent(p_parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,10 +719,12 @@ void Node3D::set_disable_gizmos(bool p_enabled) {
|
||||
|
||||
void Node3D::reparent(Node *p_parent, bool p_keep_global_transform) {
|
||||
ERR_THREAD_GUARD;
|
||||
Transform3D temp = get_global_transform();
|
||||
Node::reparent(p_parent);
|
||||
if (p_keep_global_transform) {
|
||||
Transform3D temp = get_global_transform();
|
||||
Node::reparent(p_parent);
|
||||
set_global_transform(temp);
|
||||
} else {
|
||||
Node::reparent(p_parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,10 +188,12 @@ Size2 Control::_edit_get_minimum_size() const {
|
||||
|
||||
void Control::reparent(Node *p_parent, bool p_keep_global_transform) {
|
||||
ERR_MAIN_THREAD_GUARD;
|
||||
Transform2D temp = get_global_transform();
|
||||
Node::reparent(p_parent);
|
||||
if (p_keep_global_transform) {
|
||||
Transform2D temp = get_global_transform();
|
||||
Node::reparent(p_parent);
|
||||
set_global_position(temp.get_origin());
|
||||
} else {
|
||||
Node::reparent(p_parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user