GeomNodesEditorModule.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 "Editor/Components/EditorGeomNodesComponent.h"
  9. #include "Editor/Components/EditorGeomNodesSystemComponent.h"
  10. #include "Editor/Systems/GeomNodesSystem.h"
  11. #include <Editor/Configuration/GNEditorSettingsRegistryManager.h>
  12. #include <GeomNodes/GeomNodesTypeIds.h>
  13. #include <GeomNodesModuleInterface.h>
  14. namespace GeomNodes
  15. {
  16. class GeomNodesEditorModule : public GeomNodesModuleInterface
  17. {
  18. public:
  19. AZ_RTTI(GeomNodesEditorModule, GeomNodesEditorModuleTypeId, GeomNodesModuleInterface);
  20. AZ_CLASS_ALLOCATOR(GeomNodesEditorModule, AZ::SystemAllocator);
  21. GeomNodesEditorModule()
  22. : m_gnSystem(AZStd::make_unique<GNEditorSettingsRegistryManager>())
  23. {
  24. // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
  25. // Add ALL components descriptors associated with this gem to m_descriptors.
  26. // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and
  27. // EditContext. This happens through the [MyComponent]::Reflect() function.
  28. m_descriptors.insert(
  29. m_descriptors.end(),
  30. {
  31. EditorGeomNodesSystemComponent::CreateDescriptor(),
  32. EditorGeomNodesComponent::CreateDescriptor(),
  33. });
  34. }
  35. virtual ~GeomNodesEditorModule()
  36. {
  37. m_gnSystem.Shutdown();
  38. }
  39. /**
  40. * Add required SystemComponents to the SystemEntity.
  41. * Non-SystemComponents should not be added here
  42. */
  43. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  44. {
  45. return AZ::ComponentTypeList{
  46. azrtti_typeid<EditorGeomNodesSystemComponent>(),
  47. azrtti_typeid<EditorGeomNodesComponent>(),
  48. };
  49. }
  50. private:
  51. GeomNodesSystem m_gnSystem;
  52. };
  53. } // namespace GeomNodes
  54. AZ_DECLARE_MODULE_CLASS(Gem_GeomNodes, GeomNodes::GeomNodesEditorModule)