MeshComponent.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <Mesh/MeshComponent.h>
  9. #include <AzCore/RTTI/BehaviorContext.h>
  10. namespace AZ
  11. {
  12. namespace Render
  13. {
  14. MeshComponent::MeshComponent(const MeshComponentConfig& config)
  15. : BaseClass(config)
  16. {
  17. }
  18. void MeshComponent::Reflect(AZ::ReflectContext* context)
  19. {
  20. BaseClass::Reflect(context);
  21. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  22. {
  23. serializeContext->Class<MeshComponent, BaseClass>()
  24. ->Version(0)
  25. ;
  26. }
  27. if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
  28. {
  29. behaviorContext->Class<MeshComponent>()->RequestBus("RenderMeshComponentRequestBus");
  30. behaviorContext->ConstantProperty("MeshComponentTypeId", BehaviorConstant(Uuid(MeshComponentTypeId)))
  31. ->Attribute(AZ::Script::Attributes::Module, "render")
  32. ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
  33. }
  34. }
  35. } // namespace Render
  36. } // namespace AZ