AssetBuilderStatic.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 <AzFramework/Asset/AssetProcessorMessages.h>
  10. #include <AssetBuilderSDK/AssetBuilderSDK.h>
  11. namespace AssetBuilder
  12. {
  13. void Reflect(AZ::ReflectContext* context);
  14. void InitializeSerializationContext();
  15. //! BuilderHelloRequest is sent by an AssetBuilder that is attempting to connect to the AssetProcessor to register itself as a worker
  16. class BuilderHelloRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
  17. {
  18. public:
  19. AZ_CLASS_ALLOCATOR(BuilderHelloRequest, AZ::OSAllocator);
  20. AZ_RTTI(BuilderHelloRequest, "{5fab5962-a1d8-42a5-bf7a-fb1a8c5a9588}", BaseAssetProcessorMessage);
  21. static void Reflect(AZ::ReflectContext* context);
  22. static unsigned int MessageType();
  23. unsigned int GetMessageType() const override;
  24. //! Unique ID assigned to this builder to identify it
  25. AZ::Uuid m_uuid = AZ::Uuid::CreateNull();
  26. };
  27. //! BuilderHelloResponse contains the AssetProcessor's response to a builder connection attempt, indicating if it is accepted and the ID
  28. //! that it was assigned
  29. class BuilderHelloResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
  30. {
  31. public:
  32. AZ_CLASS_ALLOCATOR(BuilderHelloResponse, AZ::OSAllocator);
  33. AZ_RTTI(BuilderHelloResponse, "{5f3d7c11-6639-4c6f-980a-32be546903c2}", BaseAssetProcessorMessage);
  34. static void Reflect(AZ::ReflectContext* context);
  35. unsigned int GetMessageType() const override;
  36. //! Indicates if the builder was accepted by the AP
  37. bool m_accepted = false;
  38. //! Unique ID assigned to the builder. If the builder isn't a local process, this is the ID assigned by the AP
  39. AZ::Uuid m_uuid = AZ::Uuid::CreateNull();
  40. };
  41. class CreateJobsNetRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
  42. {
  43. public:
  44. AZ_CLASS_ALLOCATOR(CreateJobsNetRequest, AZ::OSAllocator);
  45. AZ_RTTI(CreateJobsNetRequest, "{97fa717d-3a09-4d21-95c6-b2eafd773f1c}", BaseAssetProcessorMessage);
  46. static void Reflect(AZ::ReflectContext* context);
  47. static unsigned int MessageType();
  48. unsigned int GetMessageType() const override;
  49. AssetBuilderSDK::CreateJobsRequest m_request;
  50. };
  51. class CreateJobsNetResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
  52. {
  53. public:
  54. AZ_CLASS_ALLOCATOR(CreateJobsNetResponse, AZ::OSAllocator);
  55. AZ_RTTI(CreateJobsNetResponse, "{b2c7c2d3-b60e-4b27-b699-43e0ba991c33}", BaseAssetProcessorMessage);
  56. static void Reflect(AZ::ReflectContext* context);
  57. unsigned int GetMessageType() const override;
  58. AssetBuilderSDK::CreateJobsResponse m_response;
  59. };
  60. class ProcessJobNetRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
  61. {
  62. public:
  63. AZ_CLASS_ALLOCATOR(ProcessJobNetRequest, AZ::OSAllocator);
  64. AZ_RTTI(ProcessJobNetRequest, "{05288de1-020b-48db-b9de-715f17284efa}", BaseAssetProcessorMessage);
  65. static void Reflect(AZ::ReflectContext* context);
  66. static unsigned int MessageType();
  67. unsigned int GetMessageType() const override;
  68. AssetBuilderSDK::ProcessJobRequest m_request;
  69. };
  70. class ProcessJobNetResponse : public AzFramework::AssetSystem::BaseAssetProcessorMessage
  71. {
  72. public:
  73. AZ_CLASS_ALLOCATOR(ProcessJobNetResponse, AZ::OSAllocator);
  74. AZ_RTTI(ProcessJobNetResponse, "{26ddf882-246c-4cfb-912f-9b8e389df4f6}", BaseAssetProcessorMessage);
  75. static void Reflect(AZ::ReflectContext* context);
  76. unsigned int GetMessageType() const override;
  77. AssetBuilderSDK::ProcessJobResponse m_response;
  78. };
  79. //////////////////////////////////////////////////////////////////////////
  80. struct BuilderRegistration
  81. {
  82. AZ_CLASS_ALLOCATOR(BuilderRegistration, AZ::OSAllocator);
  83. AZ_TYPE_INFO(BuilderRegistration, "{36E785C3-5046-4568-870A-336C8249E453}");
  84. static void Reflect(AZ::ReflectContext* context);
  85. AZStd::string m_name;
  86. AZStd::vector<AssetBuilderSDK::AssetBuilderPattern> m_patterns;
  87. AZ::Uuid m_busId;
  88. int m_version = 0;
  89. AZStd::string m_analysisFingerprint;
  90. AZ::u8 m_flags = 0;
  91. AZStd::unordered_map<AZStd::string, AZ::u8> m_flagsByJobKey;
  92. AZStd::unordered_map<AZStd::string, AZStd::unordered_set<AZ::u32>> m_productsToKeepOnFailure;
  93. };
  94. class BuilderRegistrationRequest : public AzFramework::AssetSystem::BaseAssetProcessorMessage
  95. {
  96. public:
  97. AZ_CLASS_ALLOCATOR(BuilderRegistrationRequest, AZ::OSAllocator);
  98. AZ_RTTI(BuilderRegistrationRequest, "{FA9CF2D5-C847-47F3-979D-6C3AE061715C}", BaseAssetProcessorMessage);
  99. static void Reflect(AZ::ReflectContext* context);
  100. static constexpr unsigned int MessageType = AZ_CRC_CE("AssetSystem::BuilderRegistrationRequest");
  101. BuilderRegistrationRequest() = default;
  102. unsigned int GetMessageType() const override;
  103. AZStd::vector<BuilderRegistration> m_builders;
  104. };
  105. } // namespace AssetBuilder