ProductAsset.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #pragma once
  9. #include <AssetBuilderSDK/AssetBuilderSDK.h>
  10. #include <AssetDatabase/AssetDatabaseConnection.h>
  11. #include <AzCore/IO/SystemFile.h>
  12. #include <AzCore/IO/Path/Path.h>
  13. #include <native/utilities/assetUtils.h>
  14. namespace AssetProcessor
  15. {
  16. //! Represents a single product asset file, either in the cache or the intermediate directory
  17. class ProductAsset
  18. {
  19. public:
  20. ProductAsset(AZ::IO::Path absolutePath);
  21. bool IsValid() const;
  22. bool ExistsOnDisk(bool printErrorMessage) const;
  23. bool DeleteFile(bool sendNotification) const;
  24. AZ::u64 ComputeHash() const;
  25. protected:
  26. const AZ::IO::Path m_absolutePath;
  27. };
  28. //! Represents a single job output, which itself can be either a cache product, intermediate product, or both
  29. class ProductAssetWrapper
  30. {
  31. public:
  32. ProductAssetWrapper(const AssetBuilderSDK::JobProduct& jobProduct, const AssetUtilities::ProductPath& productPath);
  33. ProductAssetWrapper(const AzToolsFramework::AssetDatabase::ProductDatabaseEntry& product, const AssetUtilities::ProductPath& productPath);
  34. bool IsValid() const;
  35. bool ExistOnDisk(bool printErrorMessage) const;
  36. bool DeleteFiles(bool sendNotification) const;
  37. AZ::u64 ComputeHash() const;
  38. bool HasCacheProduct() const;
  39. bool HasIntermediateProduct() const;
  40. protected:
  41. AZStd::fixed_vector<AZStd::unique_ptr<ProductAsset>, 2> m_products;
  42. bool m_cacheProduct = false;
  43. bool m_intermediateProduct = false;
  44. };
  45. }