SceneImportRequestHandler.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 <SceneAPI/SceneCore/Components/BehaviorComponent.h>
  10. #include <SceneAPI/SceneCore/Events/AssetImportRequest.h>
  11. namespace AZ
  12. {
  13. namespace SceneAPI
  14. {
  15. struct SceneImporterSettings
  16. {
  17. AZ_TYPE_INFO(SceneImporterSettings, "{8BB6C7AD-BF99-44DC-9DA1-E7AD3F03DC10}");
  18. static void Reflect(AZ::ReflectContext* context);
  19. AZStd::unordered_set<AZStd::string> m_supportedFileTypeExtensions;
  20. };
  21. class SceneImportRequestHandler
  22. : public AZ::Component
  23. , public Events::AssetImportRequestBus::Handler
  24. {
  25. public:
  26. AZ_COMPONENT(SceneImportRequestHandler, "{9F4B189C-0A96-4F44-A5F0-E087FF1561F8}");
  27. ~SceneImportRequestHandler() override = default;
  28. void Activate() override;
  29. void Deactivate() override;
  30. static void Reflect(ReflectContext* context);
  31. void GetSupportedFileExtensions(AZStd::unordered_set<AZStd::string>& extensions) override;
  32. Events::LoadingResult LoadAsset(Containers::Scene& scene, const AZStd::string& path, const Uuid& guid,
  33. RequestingApplication requester) override;
  34. void GetPolicyName(AZStd::string& result) const override
  35. {
  36. result = "SceneImportRequestHandler";
  37. }
  38. static void GetProvidedServices(ComponentDescriptor::DependencyArrayType& provided);
  39. private:
  40. SceneImporterSettings m_settings;
  41. static constexpr const char* SettingsFilename = "AssetImporterSettings.json";
  42. };
  43. } // namespace SceneAPI
  44. } // namespace AZ