Remove file size limits when loading prefabs and prefab-based-levels

This commit is contained in:
srikappa
2021-06-08 17:28:23 -07:00
parent 5f82e5a111
commit 9dec723e33
5 changed files with 39 additions and 11 deletions
@@ -185,13 +185,7 @@ namespace AzToolsFramework
bool PrefabEditorEntityOwnershipService::LoadFromStream(AZ::IO::GenericStream& stream, AZStd::string_view filename)
{
Reset();
// Make loading from stream to behave the same in terms of filesize as regular loading of prefabs
// This may need to be revisited in the future for supporting higher sizes along with prefab loading
if (stream.GetLength() > Prefab::MaxPrefabFileSize)
{
AZ_Error("Prefab", false, "'%.*s' prefab content is bigger than the max supported size (%f MB)", AZ_STRING_ARG(filename), Prefab::MaxPrefabFileSize / (1024.f * 1024.f));
return false;
}
const size_t bufSize = stream.GetLength();
AZStd::unique_ptr<char[]> buf(new char[bufSize]);
AZ::IO::SizeType bytes = stream.Read(bufSize, buf.get());
@@ -74,7 +74,7 @@ namespace AzToolsFramework
return InvalidTemplateId;
}
auto readResult = AZ::Utils::ReadFile(GetFullPath(filePath).Native(), MaxPrefabFileSize);
auto readResult = AZ::Utils::ReadFileWithNoSizeLimit(GetFullPath(filePath).Native());
if (!readResult.IsSuccess())
{
AZ_Error(
@@ -21,8 +21,6 @@ namespace AzToolsFramework
{
namespace Prefab
{
constexpr size_t MaxPrefabFileSize = 1024 * 1024;
/*!
* PrefabLoaderInterface
* Interface for saving/loading Prefab files.