ScriptCanvasCommonGem.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 <ScriptCanvasGem.h>
  9. #include <SystemComponent.h>
  10. #include <Asset/RuntimeAssetSystemComponent.h>
  11. #include <ScriptCanvas/AutoGen/ScriptCanvasAutoGenRegistry.h>
  12. #include <ScriptCanvas/Core/Graph.h>
  13. #include <ScriptCanvas/Core/Connection.h>
  14. #include <ScriptCanvas/Data/DataRegistry.h>
  15. #include <ScriptCanvas/Libraries/Libraries.h>
  16. #include <ScriptCanvas/Debugger/Debugger.h>
  17. #include <ScriptCanvas/Execution/RuntimeComponent.h>
  18. #include <ScriptCanvas/Libraries/Libraries.h>
  19. #include <ScriptCanvas/Libraries/Math/MathNodeUtilities.h>
  20. #include <ScriptCanvas/Variable/GraphVariableManagerComponent.h>
  21. namespace ScriptCanvas
  22. {
  23. /////////////////////////////
  24. // ScriptCanvasModuleCommon
  25. /////////////////////////////
  26. ScriptCanvasModuleCommon::ScriptCanvasModuleCommon()
  27. : AZ::Module()
  28. {
  29. // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
  30. m_descriptors.insert(m_descriptors.end(), {
  31. // System Component
  32. ScriptCanvas::SystemComponent::CreateDescriptor(),
  33. // Components
  34. ScriptCanvas::Connection::CreateDescriptor(),
  35. ScriptCanvas::Node::CreateDescriptor(),
  36. ScriptCanvas::Debugger::ServiceComponent::CreateDescriptor(),
  37. ScriptCanvas::Graph::CreateDescriptor(),
  38. ScriptCanvas::GraphVariableManagerComponent::CreateDescriptor(),
  39. ScriptCanvas::RuntimeComponent::CreateDescriptor(),
  40. // ScriptCanvasBuilder
  41. ScriptCanvas::RuntimeAssetSystemComponent::CreateDescriptor(),
  42. });
  43. ScriptCanvas::InitLibraries();
  44. AZStd::vector<AZ::ComponentDescriptor*> libraryDescriptors = ScriptCanvas::GetLibraryDescriptors();
  45. m_descriptors.insert(m_descriptors.end(), libraryDescriptors.begin(), libraryDescriptors.end());
  46. MathNodeUtilities::RandomEngineInit();
  47. InitDataRegistry();
  48. ScriptCanvasModel::Instance().Init();
  49. }
  50. ScriptCanvasModuleCommon::~ScriptCanvasModuleCommon()
  51. {
  52. MathNodeUtilities::RandomEngineReset();
  53. ScriptCanvas::ResetLibraries();
  54. ResetDataRegistry();
  55. }
  56. AZ::ComponentTypeList ScriptCanvasModuleCommon::GetCommonSystemComponents() const
  57. {
  58. return std::initializer_list<AZ::Uuid> {
  59. azrtti_typeid<ScriptCanvas::SystemComponent>(),
  60. azrtti_typeid<ScriptCanvas::RuntimeAssetSystemComponent>(),
  61. azrtti_typeid<ScriptCanvas::Debugger::ServiceComponent>(),
  62. };
  63. }
  64. }