AssetBuilderStatic.cpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 <AssetBuilderStatic.h>
  9. #include <AzCore/Component/ComponentApplicationBus.h>
  10. namespace AssetBuilder
  11. {
  12. void Reflect(AZ::ReflectContext* context)
  13. {
  14. BuilderRegistrationRequest::Reflect(context);
  15. BuilderHelloRequest::Reflect(context);
  16. BuilderHelloResponse::Reflect(context);
  17. CreateJobsNetRequest::Reflect(context);
  18. CreateJobsNetResponse::Reflect(context);
  19. ProcessJobNetRequest::Reflect(context);
  20. ProcessJobNetResponse::Reflect(context);
  21. }
  22. void InitializeSerializationContext()
  23. {
  24. AZ::SerializeContext* serializeContext = nullptr;
  25. AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
  26. AZ_Assert(serializeContext, "Unable to retrieve serialize context.");
  27. Reflect(serializeContext);
  28. }
  29. void BuilderHelloRequest::Reflect(AZ::ReflectContext* context)
  30. {
  31. auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
  32. if (serialize)
  33. {
  34. serialize->Class<BuilderHelloRequest>()->Version(1)->Field("UUID", &BuilderHelloRequest::m_uuid);
  35. }
  36. }
  37. unsigned int BuilderHelloRequest::MessageType()
  38. {
  39. static unsigned int messageType = AZ_CRC_CE("AssetBuilderSDK::BuilderHelloRequest");
  40. return messageType;
  41. }
  42. unsigned int BuilderHelloRequest::GetMessageType() const
  43. {
  44. return MessageType();
  45. }
  46. void BuilderHelloResponse::Reflect(AZ::ReflectContext* context)
  47. {
  48. auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
  49. if (serialize)
  50. {
  51. serialize->Class<BuilderHelloResponse>()
  52. ->Version(1)
  53. ->Field("Accepted", &BuilderHelloResponse::m_accepted)
  54. ->Field("UUID", &BuilderHelloResponse::m_uuid);
  55. }
  56. }
  57. unsigned int BuilderHelloResponse::GetMessageType() const
  58. {
  59. return BuilderHelloRequest::MessageType();
  60. }
  61. //////////////////////////////////////////////////////////////////////////
  62. void CreateJobsNetRequest::Reflect(AZ::ReflectContext* context)
  63. {
  64. auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
  65. if (serialize)
  66. {
  67. serialize->Class<CreateJobsNetRequest>()->Version(1)->Field("Request", &CreateJobsNetRequest::m_request);
  68. }
  69. }
  70. unsigned int CreateJobsNetRequest::MessageType()
  71. {
  72. static unsigned int messageType = AZ_CRC_CE("AssetBuilderSDK::CreateJobsNetRequest");
  73. return messageType;
  74. }
  75. unsigned int CreateJobsNetRequest::GetMessageType() const
  76. {
  77. return MessageType();
  78. }
  79. void CreateJobsNetResponse::Reflect(AZ::ReflectContext* context)
  80. {
  81. auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
  82. if (serialize)
  83. {
  84. serialize->Class<CreateJobsNetResponse>()->Version(1)->Field("Response", &CreateJobsNetResponse::m_response);
  85. }
  86. }
  87. unsigned int CreateJobsNetResponse::GetMessageType() const
  88. {
  89. return CreateJobsNetRequest::MessageType();
  90. }
  91. void ProcessJobNetRequest::Reflect(AZ::ReflectContext* context)
  92. {
  93. auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
  94. if (serialize)
  95. {
  96. serialize->Class<ProcessJobNetRequest>()->Version(1)->Field("Request", &ProcessJobNetRequest::m_request);
  97. }
  98. }
  99. unsigned int ProcessJobNetRequest::MessageType()
  100. {
  101. static unsigned int messageType = AZ_CRC_CE("AssetBuilderSDK::ProcessJobNetRequest");
  102. return messageType;
  103. }
  104. unsigned int ProcessJobNetRequest::GetMessageType() const
  105. {
  106. return MessageType();
  107. }
  108. void ProcessJobNetResponse::Reflect(AZ::ReflectContext* context)
  109. {
  110. auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
  111. if (serialize)
  112. {
  113. serialize->Class<ProcessJobNetResponse>()->Version(1)->Field("Response", &ProcessJobNetResponse::m_response);
  114. }
  115. }
  116. unsigned int ProcessJobNetResponse::GetMessageType() const
  117. {
  118. return ProcessJobNetRequest::MessageType();
  119. }
  120. //---------------------------------------------------------------------
  121. void BuilderRegistration::Reflect(AZ::ReflectContext* context)
  122. {
  123. auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
  124. if (serialize)
  125. {
  126. serialize->Class<BuilderRegistration>()
  127. ->Version(1)
  128. ->Field("Name", &BuilderRegistration::m_name)
  129. ->Field("Patterns", &BuilderRegistration::m_patterns)
  130. ->Field("BusId", &BuilderRegistration::m_busId)
  131. ->Field("Version", &BuilderRegistration::m_version)
  132. ->Field("AnalysisFingerprint", &BuilderRegistration::m_analysisFingerprint)
  133. ->Field("Flags", &BuilderRegistration::m_flags)
  134. ->Field("FlagsByJobKey", &BuilderRegistration::m_flagsByJobKey)
  135. ->Field("ProductsToKeepOnFailure", &BuilderRegistration::m_productsToKeepOnFailure);
  136. }
  137. }
  138. void BuilderRegistrationRequest::Reflect(AZ::ReflectContext* context)
  139. {
  140. BuilderRegistration::Reflect(context);
  141. auto serialize = azrtti_cast<AZ::SerializeContext*>(context);
  142. if (serialize)
  143. {
  144. serialize->Class<BuilderRegistrationRequest, BaseAssetProcessorMessage>()->Version(1)->Field(
  145. "Builders", &BuilderRegistrationRequest::m_builders);
  146. }
  147. }
  148. unsigned int BuilderRegistrationRequest::GetMessageType() const
  149. {
  150. return BuilderRegistrationRequest::MessageType;
  151. }
  152. } // namespace AssetBuilder