Merge pull request #1198 from aws-lumberyard-dev/Prefab/RemoveFileSizeLimits
Remove file size limits when loading prefabs and prefab-based-levels
This commit is contained in:
@@ -113,7 +113,8 @@ namespace AZ
|
||||
//! Save a string to a file. Otherwise returns a failure with error message.
|
||||
AZ::Outcome<void, AZStd::string> WriteFile(AZStd::string_view content, AZStd::string_view filePath);
|
||||
|
||||
//! Read a file into a string. Returns a failure with error message if the content could not be loaded.
|
||||
//! Read a file into a string. Returns a failure with error message if the content could not be loaded or if
|
||||
//! the file size is larger than the max file size provided.
|
||||
template<typename Container = AZStd::string>
|
||||
AZ::Outcome<Container, AZStd::string> ReadFile(AZStd::string_view filePath, size_t maxFileSize = DefaultMaxFileSize);
|
||||
}
|
||||
|
||||
+1
-7
@@ -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::ReadFile(GetFullPath(filePath).Native(), AZStd::numeric_limits<size_t>::max());
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user