EditorPythonBindingsModule.cpp 2.1 KB

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