Fix preserving objects order in prefab instances on apply (based on the prefab)

Fixes #346
This commit is contained in:
Wojtek Figat
2021-03-17 00:24:29 +01:00
parent 691df4cb80
commit a479f1daf6
3 changed files with 37 additions and 0 deletions

View File

@@ -257,6 +257,16 @@ void SceneObjectsFactory::SynchronizePrefabInstances(Array<SceneObject*>& sceneO
// Reparent
obj->SetParent(actualParent, false);
}
// Preserve order in parent (values from prefab are used)
if (i != 0)
{
const auto defaultInstance = prefab ? prefab->GetDefaultInstance(obj->GetPrefabObjectID()) : nullptr;
if (defaultInstance)
{
obj->SetOrderInParent(defaultInstance->GetOrderInParent());
}
}
}
// Check all actors with prefab linkage for adding missing objects