SceneProcessingConfigSystemComponent.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #pragma once
  9. #include <AzCore/Component/Component.h>
  10. #include <AzCore/std/smart_ptr/unique_ptr.h>
  11. #include <AzCore/Serialization/SerializeContext.h>
  12. #include <SceneAPI/SceneCore/Components/SceneSystemComponent.h>
  13. #include <Config/SceneProcessingConfigBus.h>
  14. #include <Config/SettingsObjects/SoftNameSetting.h>
  15. #include <SceneAPI/SceneCore/Events/AssetImportRequest.h>
  16. namespace AZ
  17. {
  18. class DynamicModuleHandle;
  19. namespace SceneProcessingConfig
  20. {
  21. class SceneProcessingConfigSystemComponentSerializationEvents
  22. : public SerializeContext::IEventHandler
  23. {
  24. public:
  25. AZ_CLASS_ALLOCATOR(SceneProcessingConfigSystemComponentSerializationEvents, SystemAllocator, 0);
  26. void OnWriteBegin(void* classPtr) override;
  27. };
  28. class SceneProcessingConfigSystemComponent
  29. : public AZ::SceneAPI::SceneCore::SceneSystemComponent
  30. , protected SceneProcessingConfigRequestBus::Handler
  31. , public AZ::SceneAPI::Events::AssetImportRequestBus::Handler
  32. {
  33. public:
  34. AZ_COMPONENT(SceneProcessingConfigSystemComponent, "{80FE1130-91B4-44D4-869F-859BB996161A}", AZ::SceneAPI::SceneCore::SceneSystemComponent);
  35. SceneProcessingConfigSystemComponent();
  36. ~SceneProcessingConfigSystemComponent();
  37. void Activate() override;
  38. void Deactivate() override;
  39. void Clear();
  40. // SceneProcessingConfigRequestBus START
  41. const AZStd::vector<SoftNameSetting*>* GetSoftNames() override;
  42. bool AddNodeSoftName(const char* pattern,
  43. SceneAPI::SceneCore::PatternMatcher::MatchApproach approach,
  44. const char* virtualType, bool includeChildren) override;
  45. bool AddFileSoftName(const char* pattern, SceneAPI::SceneCore::PatternMatcher::MatchApproach approach,
  46. const char* virtualType, bool inclusive, const AZStd::string& graphObjectTypeName) override;
  47. // SceneProcessingConfigRequestBus END
  48. void AreCustomNormalsUsed(bool &value) override;
  49. void GetPolicyName(AZStd::string& result) const override
  50. {
  51. result = "SceneProcessingConfigSystemComponent";
  52. }
  53. static void Reflect(AZ::ReflectContext* context);
  54. static void GetProvidedServices(ComponentDescriptor::DependencyArrayType& provided);
  55. static void GetIncompatibleServices(ComponentDescriptor::DependencyArrayType& incompatible);
  56. static void GetRequiredServices(ComponentDescriptor::DependencyArrayType& required);
  57. static void GetDependentServices(ComponentDescriptor::DependencyArrayType& dependent);
  58. private:
  59. /// It is the responsibility of the caller to delete newSoftname if this method returns
  60. /// false.
  61. bool AddSoftName(SoftNameSetting* newSoftname);
  62. static void ReflectSceneModule(ReflectContext* context, const AZStd::unique_ptr<DynamicModuleHandle>& module);
  63. static void ActivateSceneModule(const AZStd::unique_ptr<DynamicModuleHandle>& module);
  64. static void DeactivateSceneModule(const AZStd::unique_ptr<DynamicModuleHandle>& module);
  65. AZStd::vector<SoftNameSetting*> m_softNames;
  66. bool m_UseCustomNormals;
  67. };
  68. } // namespace SceneProcessingConfig
  69. } // namespace AZ