PrefabGroup.h 2.9 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 <PrefabGroup/IPrefabGroup.h>
  10. #include <AzToolsFramework/Prefab/Procedural/ProceduralPrefabAsset.h>
  11. #include <AzCore/Memory/Memory.h>
  12. #include <AzCore/Memory/SystemAllocator.h>
  13. #include <AzCore/std/containers/vector.h>
  14. #include <AzCore/std/smart_ptr/shared_ptr.h>
  15. #include <SceneAPI/SceneCore/Containers/RuleContainer.h>
  16. #include <SceneAPI/SceneData/ManifestBase/SceneNodeSelectionList.h>
  17. #include <SceneAPI/SceneCore/DataTypes/Rules/IRule.h>
  18. namespace AZ
  19. {
  20. class ReflectContext;
  21. }
  22. namespace AZ::SceneAPI::Containers
  23. {
  24. class Scene;
  25. }
  26. namespace AZ::SceneAPI::SceneData
  27. {
  28. class PrefabGroup final
  29. : public DataTypes::IPrefabGroup
  30. {
  31. public:
  32. AZ_RTTI(PrefabGroup, "{99FE3C6F-5B55-4D8B-8013-2708010EC715}", DataTypes::IPrefabGroup);
  33. AZ_CLASS_ALLOCATOR(PrefabGroup, SystemAllocator);
  34. static void Reflect(AZ::ReflectContext* context);
  35. PrefabGroup();
  36. ~PrefabGroup() override = default;
  37. // DataTypes::IPrefabGroup
  38. AzToolsFramework::Prefab::PrefabDomConstReference GetPrefabDomRef() const override;
  39. const AZStd::string& GetName() const override;
  40. const Uuid& GetId() const override;
  41. Containers::RuleContainer& GetRuleContainer() override;
  42. const Containers::RuleContainer& GetRuleContainerConst() const override;
  43. DataTypes::ISceneNodeSelectionList& GetSceneNodeSelectionList() override;
  44. const DataTypes::ISceneNodeSelectionList& GetSceneNodeSelectionList() const override;
  45. // IManifestObject
  46. void GetManifestObjectsToRemoveOnRemoved(
  47. AZStd::vector<const IManifestObject*>& toRemove, const AZ::SceneAPI::Containers::SceneManifest& manifest) const override;
  48. // Concrete API
  49. void SetId(Uuid id);
  50. void SetName(AZStd::string name);
  51. void SetPrefabDom(AzToolsFramework::Prefab::PrefabDom prefabDom);
  52. private:
  53. SceneNodeSelectionList m_nodeSelectionList;
  54. Containers::RuleContainer m_rules;
  55. AZStd::string m_name;
  56. Uuid m_id;
  57. AZStd::shared_ptr<Prefab::PrefabDomData> m_prefabDomData;
  58. };
  59. //! If this IRule ends up in a MeshGroup container's rule group,
  60. //! then the MeshGroup was created by the procedural prefab group logic.
  61. class ProceduralMeshGroupRule final
  62. : public AZ::SceneAPI::DataTypes::IRule
  63. {
  64. public:
  65. AZ_RTTI(ProceduralMeshGroupRule, "{8A224146-FBA5-414F-AA98-DA57F86738CD}", IRule);
  66. AZ_CLASS_ALLOCATOR(ProceduralMeshGroupRule, AZ::SystemAllocator)
  67. ProceduralMeshGroupRule() = default;
  68. ~ProceduralMeshGroupRule() override = default;
  69. bool ModifyTooltip(AZStd::string& tooltip) override;
  70. };
  71. }