summaryrefslogtreecommitdiff
path: root/modules/csg
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-06-11 09:19:06 +0200
committerGitHub <noreply@github.com>2018-06-11 09:19:06 +0200
commit1319f3852d3f407360d7ef6893face43a3deb44a (patch)
tree4a6ebe50cfcb714d710d17cbf87d4df68f634df7 /modules/csg
parentacd9646ede45f8c34f423e392e60bf128c953bd1 (diff)
parent1535ffab06dcc6d7ad19eccc1b7b49c3d82bd5de (diff)
Merge pull request #19489 from Nallebeorn/csg-reparent
Fix CSG issues when reparenting shape nodes.
Diffstat (limited to 'modules/csg')
-rw-r--r--modules/csg/csg_shape.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 82db1871da..ba27d6839d 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -162,6 +162,10 @@ CSGBrush *CSGShape::_get_brush() {
void CSGShape::_update_shape() {
//print_line("updating shape for " + String(get_path()));
+
+ if (parent)
+ return;
+
set_base(RID());
root_mesh.unref(); //byebye root mesh
@@ -349,6 +353,10 @@ void CSGShape::_notification(int p_what) {
Node *parentn = get_parent();
if (parentn) {
parent = Object::cast_to<CSGShape>(parentn);
+ if (parent) {
+ set_base(RID());
+ root_mesh.unref();
+ }
}
if (use_collision && is_root_shape()) {
@@ -371,6 +379,7 @@ void CSGShape::_notification(int p_what) {
}
if (p_what == NOTIFICATION_EXIT_TREE) {
+
if (parent)
parent->_make_dirty();
parent = NULL;