ResourcePoolAssetCreator.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Atom/RPI.Reflect/ResourcePoolAssetCreator.h>
  9. #include <AzCore/std/smart_ptr/make_shared.h>
  10. namespace AZ
  11. {
  12. namespace RPI
  13. {
  14. void ResourcePoolAssetCreator::Begin(const Data::AssetId& assetId)
  15. {
  16. BeginCommon(assetId);
  17. }
  18. void ResourcePoolAssetCreator::SetPoolDescriptor(AZStd::unique_ptr<RHI::ResourcePoolDescriptor> poolDescriptor)
  19. {
  20. if (ValidateIsReady())
  21. {
  22. m_asset->m_poolDescriptor = AZStd::move(poolDescriptor);
  23. }
  24. }
  25. void ResourcePoolAssetCreator::SetPoolName(AZStd::string_view poolName)
  26. {
  27. if (ValidateIsReady())
  28. {
  29. m_asset->m_poolName = poolName;
  30. }
  31. }
  32. bool ResourcePoolAssetCreator::End(Data::Asset<ResourcePoolAsset>& result)
  33. {
  34. if (!ValidateIsReady())
  35. {
  36. return false;
  37. }
  38. if (!m_asset->m_poolDescriptor)
  39. {
  40. ReportError("The asset doesn't have valid pool descriptor");
  41. return false;
  42. }
  43. m_asset->SetReady();
  44. return EndCommon(result);
  45. }
  46. } // namespace RPI
  47. } // namespace AZ