mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Merge pull request #89003 from akien-mga/node3d-reparent-no-global-transform
Don't access Node3D/Node2D/Control global transform in `reparent` unless needed
This commit is contained in:
commit
5c38a9fe82
@ -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