ComponentEntityObjectBus.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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/EBus/EBus.h>
  10. #include <AzCore/Component/EntityId.h>
  11. #include <AzCore/Component/ComponentBus.h>
  12. #include <AzToolsFramework/ToolsComponents/EditorSelectionAccentSystemComponent.h>
  13. namespace AzToolsFramework
  14. {
  15. /**
  16. * Bus for querying about sandbox data associated with a given Entity.
  17. */
  18. class ComponentEntityEditorRequests
  19. : public AZ::ComponentBus
  20. {
  21. public:
  22. virtual ~ComponentEntityEditorRequests() {}
  23. /// Returns true if the object is highlighted.
  24. virtual bool IsSandboxObjectHighlighted() = 0;
  25. // Sets accent for the component entity
  26. virtual void SetSandboxObjectAccent(EntityAccentType accent) = 0;
  27. // Set the component entity's isolation flag when the editor is in Isolation Mode
  28. virtual void SetSandBoxObjectIsolated(bool isIsolated) = 0;
  29. // Returns if the component entity is isolated when the editor is in Isolation Mode
  30. virtual bool IsSandBoxObjectIsolated() = 0;
  31. /// Updates the entity to match the visibility and lock state of its hierarchy.
  32. /// Necessary because ancestors that are layers can override the current entity's visibility and lock state.
  33. virtual void RefreshVisibilityAndLock() = 0;
  34. };
  35. using ComponentEntityEditorRequestBus = AZ::EBus < ComponentEntityEditorRequests >;
  36. class ComponentEntityObjectRequests
  37. : public AZ::EBusTraits
  38. {
  39. public:
  40. //////////////////////////////////////////////////////////////////////////
  41. // EBusTraits overrides
  42. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  43. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
  44. typedef void* BusIdType; // ID'd on CComponentEntityObject pointer.
  45. //////////////////////////////////////////////////////////////////////////
  46. virtual ~ComponentEntityObjectRequests() {}
  47. /// Retrieve AZ Entity Id associated with this sandbox object.
  48. virtual AZ::EntityId GetAssociatedEntityId() = 0;
  49. };
  50. using ComponentEntityObjectRequestBus = AZ::EBus < ComponentEntityObjectRequests >;
  51. } // namespace AzToolsFramework