MaterialBuilderUtils.h 2.6 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. namespace AZ
  11. {
  12. namespace RPI
  13. {
  14. class MaterialAsset;
  15. class MaterialTypeAsset;
  16. namespace MaterialBuilderUtils
  17. {
  18. //! @brief configure and register a job dependency with the job descriptor
  19. //! @param jobDescriptor job descriptor to which dependency will be added
  20. //! @param path path to the source file for the dependency
  21. //! @param jobKey job key for the builder processing the dependency
  22. //! @param platformId list of platform IDs to monitor for the job dependency
  23. //! @param subIds list of sub IDs that should be monitored for assets created by the job dependency
  24. //! @param updateFingerprint flag specifying if the job descriptor fingerprint should be updated with information from the
  25. //! dependency file
  26. //! @return reference to the new job dependency added to the job descriptor dependency container
  27. AssetBuilderSDK::JobDependency& AddJobDependency(
  28. AssetBuilderSDK::JobDescriptor& jobDescriptor,
  29. const AZStd::string& path,
  30. const AZStd::string& jobKey,
  31. const AZStd::string& platformId = {},
  32. const AZStd::vector<AZ::u32>& subIds = {},
  33. const bool updateFingerprint = true);
  34. //! Given a material asset that has been fully built and prepared,
  35. //! add any image dependencies as pre-load dependencies, to the job being emitted.
  36. //! This will cause them to auto preload as part of loading the material, as well as make sure
  37. //! they are included in any pak files shipped with the product.
  38. void AddImageAssetDependenciesToProduct(const AZ::RPI::MaterialAsset* materialAsset, AssetBuilderSDK::JobProduct& product);
  39. //! Same as the above overload, but for material TYPE assets.
  40. void AddImageAssetDependenciesToProduct(const AZ::RPI::MaterialTypeAsset* materialTypeAsset, AssetBuilderSDK::JobProduct& product);
  41. //! Append a fingerprint value to the job descriptor using the file modification time of the specified file path
  42. void AddFingerprintForDependency(const AZStd::string& path, AssetBuilderSDK::JobDescriptor& jobDescriptor);
  43. } // namespace MaterialBuilderUtils
  44. } // namespace RPI
  45. } // namespace AZ