summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/node_3d.cpp8
-rw-r--r--scene/3d/node_3d.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index a0382b73dc..66e8831d15 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -623,6 +623,14 @@ void Node3D::set_disable_gizmos(bool p_enabled) {
#endif
}
+void Node3D::reparent(Node *p_parent, bool p_keep_global_transform) {
+ Transform3D temp = get_global_transform();
+ Node::reparent(p_parent);
+ if (p_keep_global_transform) {
+ set_global_transform(temp);
+ }
+}
+
void Node3D::set_disable_scale(bool p_enabled) {
data.disable_scale = p_enabled;
}
diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h
index 0901ab331b..98bcab5fd4 100644
--- a/scene/3d/node_3d.h
+++ b/scene/3d/node_3d.h
@@ -206,6 +206,7 @@ public:
virtual void set_transform_gizmo_visible(bool p_enabled) { data.transform_gizmo_visible = p_enabled; };
virtual bool is_transform_gizmo_visible() const { return data.transform_gizmo_visible; };
#endif
+ virtual void reparent(Node *p_parent, bool p_keep_global_transform = true) override;
void set_disable_gizmos(bool p_enabled);
void update_gizmos();