allow null parent to setParent
This commit is contained in:
@@ -81,20 +81,30 @@ extern "C"
|
||||
const auto child = Entity::import(childId);
|
||||
const auto parent = Entity::import(parentId);
|
||||
|
||||
const auto &parentInstance = tm->getInstance(parent);
|
||||
|
||||
const auto &childInstance = tm->getInstance(child);
|
||||
|
||||
if (!childInstance.isValid())
|
||||
{
|
||||
Log("Child instance is not valid");
|
||||
return;
|
||||
}
|
||||
|
||||
if(parent.isNull()) {
|
||||
Log("Unparenting child instance");
|
||||
tm->setParent(childInstance, TransformManager::Instance());
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &parentInstance = tm->getInstance(parent);
|
||||
|
||||
if (!parentInstance.isValid())
|
||||
{
|
||||
Log("Parent instance is not valid");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!childInstance.isValid())
|
||||
{
|
||||
Log("Child instance is not valid");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (preserveScaling)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user