Bugfixes to enable slice-to-prefab conversion to run with less warnings/errors/crashes (#768)
While trying to process all slices and levels in Automated Testing, a few bugs came up that needed to be addressed: - [LYN-3832] TransformComponent had a field removed without updating the version number and converter, which caused a lot of excessive warnings - SliceComponent would crash in debug builds on instantiation failures due to a null dereference that was guarded against in most but not all places - SliceConverter now detects when nested slices exist and gracefully warns about it. - InstanceUpdateExecutor / TemplateInstanceMapper will now immediately remove instances that are unregistered, so that any in the queue don't get processed on a subsequent tick. This was causing crashes when the instance was destroyed before the processing occurred. It also has a side benefit of preventing the same instance from executing multiple times. - Minor logic bugfix to the pack close warning, the boolean check was flipped. Also added an early-out on SetTemplateId, since this was causing some unnecessary instance queue entries.
This commit is contained in:
@@ -143,7 +143,7 @@ namespace AZ
|
||||
if (packOpened)
|
||||
{
|
||||
[[maybe_unused]] bool closeResult = archiveInterface->ClosePack(filePath);
|
||||
AZ_Warning("Convert-Slice", !closeResult, "Failed to close '%s'.", filePath.c_str());
|
||||
AZ_Warning("Convert-Slice", closeResult, "Failed to close '%s'.", filePath.c_str());
|
||||
}
|
||||
|
||||
AZ_Printf("Convert-Slice", "Finished converting '%s' to '%s'\n", filePath.c_str(), outputPath.c_str());
|
||||
@@ -166,14 +166,16 @@ namespace AZ
|
||||
}
|
||||
|
||||
// Get all of the entities from the slice.
|
||||
SliceComponent::EntityList sliceEntities;
|
||||
bool getEntitiesResult = sliceComponent->GetEntities(sliceEntities);
|
||||
if ((!getEntitiesResult) || (sliceEntities.empty()))
|
||||
SliceComponent::EntityList sliceEntities = sliceComponent->GetNewEntities();
|
||||
if (sliceEntities.empty())
|
||||
{
|
||||
AZ_Printf("Convert-Slice", " File not converted: Slice entities could not be retrieved.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
const SliceComponent::SliceList& sliceList = sliceComponent->GetSlices();
|
||||
AZ_Warning("Convert-Slice", sliceList.empty(), " Slice depends on other slices, this conversion will lose data.\n");
|
||||
|
||||
// Create the Prefab with the entities from the slice
|
||||
AZStd::unique_ptr<AzToolsFramework::Prefab::Instance> sourceInstance(
|
||||
prefabSystemComponent->CreatePrefab(sliceEntities, {}, outputPath));
|
||||
|
||||
Reference in New Issue
Block a user