EditorPythonBindingsModule.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 <AzCore/Memory/SystemAllocator.h>
  9. #include <AzCore/Module/Module.h>
  10. #include <AzToolsFramework/API/PythonLoader.h>
  11. #include <PythonSystemComponent.h>
  12. #include <PythonReflectionComponent.h>
  13. #include <PythonMarshalComponent.h>
  14. #include <PythonLogSymbolsComponent.h>
  15. namespace EditorPythonBindings
  16. {
  17. class EditorPythonBindingsModule
  18. : public AZ::Module
  19. , public AzToolsFramework::EmbeddedPython::PythonLoader
  20. {
  21. public:
  22. AZ_RTTI(EditorPythonBindingsModule, "{851B9E35-4FD5-49B1-8207-E40D4BBA36CC}", AZ::Module);
  23. AZ_CLASS_ALLOCATOR(EditorPythonBindingsModule, AZ::SystemAllocator);
  24. EditorPythonBindingsModule()
  25. : AZ::Module()
  26. {
  27. m_descriptors.insert(m_descriptors.end(),
  28. {
  29. PythonSystemComponent::CreateDescriptor(),
  30. PythonReflectionComponent::CreateDescriptor(),
  31. PythonMarshalComponent::CreateDescriptor(),
  32. PythonLogSymbolsComponent::CreateDescriptor(),
  33. });
  34. }
  35. /**
  36. * Add required SystemComponents to the SystemEntity.
  37. */
  38. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  39. {
  40. return AZ::ComponentTypeList
  41. {
  42. azrtti_typeid<PythonSystemComponent>(),
  43. azrtti_typeid<PythonReflectionComponent>(),
  44. azrtti_typeid<PythonMarshalComponent>(),
  45. azrtti_typeid<PythonLogSymbolsComponent>()
  46. };
  47. }
  48. };
  49. }
  50. #if defined(O3DE_GEM_NAME)
  51. AZ_DECLARE_MODULE_CLASS(AZ_JOIN(Gem_, O3DE_GEM_NAME, _Editor), EditorPythonBindings::EditorPythonBindingsModule)
  52. #else
  53. AZ_DECLARE_MODULE_CLASS(Gem_EditorPythonBindings_Editor, EditorPythonBindings::EditorPythonBindingsModule)
  54. #endif