3
0

AssetAliases.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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/System/AssetAliases.h>
  9. #include <AzCore/RTTI/ReflectContext.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. namespace AZ
  12. {
  13. namespace RPI
  14. {
  15. void AssetAliases::Reflect(ReflectContext* context)
  16. {
  17. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  18. {
  19. serializeContext->Class<AssetAliases>()
  20. ->Version(0)
  21. ->Field("AssetMapping", &AssetAliases::m_assetMapping)
  22. ;
  23. }
  24. }
  25. Data::AssetId AssetAliases::FindAssetId(const Name& alias) const
  26. {
  27. auto foundAsset = m_assetMapping.find(alias.GetCStr());
  28. if (foundAsset != m_assetMapping.end())
  29. {
  30. return foundAsset->second;
  31. }
  32. else
  33. {
  34. return Data::AssetId();
  35. }
  36. }
  37. const AZStd::unordered_map<AZStd::string, Data::AssetId>& AssetAliases::GetAssetMapping() const
  38. {
  39. return m_assetMapping;
  40. }
  41. } // namespace RPI
  42. } // namespace AZ