FileSoftNameSetting.h 3.0 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 <initializer_list>
  10. #include <Config/SettingsObjects/SoftNameSetting.h>
  11. namespace AZ
  12. {
  13. namespace SceneProcessingConfig
  14. {
  15. class FileSoftNameSetting : public SoftNameSetting
  16. {
  17. public:
  18. class GraphType
  19. {
  20. public:
  21. AZ_CLASS_ALLOCATOR(GraphType, AZ::SystemAllocator);
  22. AZ_RTTI(GraphType, "{368E85F4-4FF5-4708-82A1-FCDC993D4C34}");
  23. GraphType();
  24. explicit GraphType(const AZStd::string& name);
  25. explicit GraphType(AZStd::string&& name);
  26. virtual ~GraphType() = default;
  27. const AZStd::string& GetName() const;
  28. const Uuid& GetId() const;
  29. static void Reflect(AZ::ReflectContext* context);
  30. private:
  31. AZStd::string m_name;
  32. mutable Uuid m_cachedId;
  33. };
  34. // Wrapper around AZStd::vector<GraphType> for the sole purpose of forcing the reflected
  35. // property editor to not use a container view.
  36. class GraphTypeContainer
  37. {
  38. public:
  39. AZ_CLASS_ALLOCATOR(GraphTypeContainer, AZ::SystemAllocator);
  40. AZ_RTTI(GraphTypeContainer, "{35E70739-CD31-43C2-A024-769755A26CAE}");
  41. GraphTypeContainer() = default;
  42. explicit GraphTypeContainer(std::initializer_list<GraphType> graphTypes);
  43. virtual ~GraphTypeContainer() = default;
  44. AZStd::vector<GraphType>& GetGraphTypes();
  45. const AZStd::vector<GraphType>& GetGraphTypes() const;
  46. static void Reflect(AZ::ReflectContext* context);
  47. private:
  48. AZStd::vector<GraphType> m_types;
  49. };
  50. AZ_CLASS_ALLOCATOR(FileSoftNameSetting, AZ::SystemAllocator);
  51. AZ_RTTI(FileSoftNameSetting, "{CED5FBF7-F74A-49E2-9FE0-DFF7EDA274CE}", SoftNameSetting);
  52. FileSoftNameSetting() = default;
  53. FileSoftNameSetting(const char* pattern, SceneAPI::SceneCore::PatternMatcher::MatchApproach approach,
  54. const char* virtualType, bool inclusive, std::initializer_list<GraphType> graphTypes);
  55. ~FileSoftNameSetting() override = default;
  56. bool IsVirtualType(const SceneAPI::Containers::Scene& scene, SceneAPI::Containers::SceneGraph::NodeIndex node) const override;
  57. const AZ::Uuid GetTypeId() const override;
  58. static void Reflect(AZ::ReflectContext* context);
  59. private:
  60. GraphTypeContainer m_graphTypes;
  61. bool m_inclusiveList;
  62. mutable const SceneAPI::Containers::Scene* m_cachedScene;
  63. mutable bool m_cachedNameMatch;
  64. };
  65. } // namespace SceneProcessingConfig
  66. } // namespace AZ