From 4b6dca07ea42b91b4ad6c58053db55ff52bf7901 Mon Sep 17 00:00:00 2001 From: tristan Date: Fri, 1 Jun 2018 19:29:04 +0200 Subject: [PATCH] UPBGE: Fix parenting. --- source/gameengine/Ketsji/KX_GameObject.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 2012e049456e..a72dbae21a32 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -346,7 +346,7 @@ void KX_GameObject::SetParent(KX_GameObject *obj, bool addToCompound, bool ghost KX_Scene *scene = GetScene(); // Not already parented to same object, no parenting loop, not the object itself - if (m_sgNode->GetParent() == parentSgNode || !m_sgNode->IsAncessor(parentSgNode) || this != obj) { + if (m_sgNode->GetParent() == parentSgNode || m_sgNode->IsAncessor(parentSgNode) || this == obj) { return; } @@ -408,8 +408,7 @@ void KX_GameObject::SetParent(KX_GameObject *obj, bool addToCompound, bool ghost void KX_GameObject::RemoveParent() { - // check on valid node in case a python controller holds a reference to a deleted object - if (m_sgNode->GetParent()) { + if (!m_sgNode->GetParent()) { return; }