DccScriptingInterfaceEditorModule.cpp 2.3 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 <DccScriptingInterfaceModuleInterface.h>
  9. #include "DccScriptingInterfaceEditorSystemComponent.h"
  10. #include <AzToolsFramework/API/PythonLoader.h>
  11. #include <QtGlobal>
  12. void InitDccScriptingInterfaceResources()
  13. {
  14. // We must register our Qt resources (.qrc file) since this is being loaded from a separate module (gem)
  15. Q_INIT_RESOURCE(DccScriptingInterface);
  16. }
  17. namespace DccScriptingInterface
  18. {
  19. class DccScriptingInterfaceEditorModule
  20. : public DccScriptingInterfaceModuleInterface
  21. , public AzToolsFramework::EmbeddedPython::PythonLoader
  22. {
  23. public:
  24. AZ_RTTI(DccScriptingInterfaceEditorModule, "{F6CEC69D-14DB-48F8-9AFC-D56D0602D79F}", DccScriptingInterfaceModuleInterface);
  25. AZ_CLASS_ALLOCATOR(DccScriptingInterfaceEditorModule, AZ::SystemAllocator);
  26. DccScriptingInterfaceEditorModule()
  27. {
  28. InitDccScriptingInterfaceResources();
  29. // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
  30. // Add ALL components descriptors associated with this gem to m_descriptors.
  31. // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
  32. // This happens through the [MyComponent]::Reflect() function.
  33. m_descriptors.insert(m_descriptors.end(), {
  34. DccScriptingInterfaceEditorSystemComponent::CreateDescriptor(),
  35. });
  36. }
  37. /**
  38. * Add required SystemComponents to the SystemEntity.
  39. * Non-SystemComponents should not be added here
  40. */
  41. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  42. {
  43. return AZ::ComponentTypeList {
  44. azrtti_typeid<DccScriptingInterfaceEditorSystemComponent>(),
  45. };
  46. }
  47. };
  48. }// namespace DccScriptingInterface
  49. #if defined(O3DE_GEM_NAME)
  50. AZ_DECLARE_MODULE_CLASS(AZ_JOIN(Gem_, O3DE_GEM_NAME), DccScriptingInterface::DccScriptingInterfaceEditorModule)
  51. #else
  52. AZ_DECLARE_MODULE_CLASS(Gem_DccScriptingInterface, DccScriptingInterface::DccScriptingInterfaceEditorModule)
  53. #endif