DisplaySettingsPythonFuncs.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #pragma once
  2. /*
  3. * Copyright (c) Contributors to the Open 3D Engine Project.
  4. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. *
  6. * SPDX-License-Identifier: Apache-2.0 OR MIT
  7. *
  8. */
  9. #pragma once
  10. #include <AzCore/Component/Component.h>
  11. #include <AzCore/EBus/EBus.h>
  12. namespace AzToolsFramework
  13. {
  14. //! A legacy component to reflect scriptable commands for the Editor
  15. class DisplaySettingsPythonFuncsHandler
  16. : public AZ::Component
  17. {
  18. public:
  19. AZ_COMPONENT(DisplaySettingsPythonFuncsHandler, "{517AC40C-4A1F-4E02-ABA2-5A927582ECB4}")
  20. static void Reflect(AZ::ReflectContext* context);
  21. // AZ::Component ...
  22. void Activate() override {}
  23. void Deactivate() override {}
  24. };
  25. //! Class to store the Display Settings
  26. class DisplaySettingsState
  27. {
  28. public:
  29. AZ_TYPE_INFO(DisplaySettingsState, "{EBEDA5EC-29D3-4F23-ABCC-C7C4EE48FA36}")
  30. //! Disable collision with terrain.
  31. bool m_noCollision;
  32. //! Do not draw labels.
  33. bool m_noLabels;
  34. //! Simulation is enabled.
  35. bool m_simulate;
  36. //! Enable displaying of animation tracks in views.
  37. bool m_hideTracks;
  38. //! Enable displaying of links between objects.
  39. bool m_hideLinks;
  40. //! Disable displaying of all object helpers.
  41. bool m_hideHelpers;
  42. //! Enable displaying of dimension figures.
  43. bool m_showDimensionFigures;
  44. //! Equality test operator
  45. bool operator==(const DisplaySettingsState& rhs) const;
  46. //! String representation of the current state
  47. AZStd::string ToString() const;
  48. };
  49. //! API to retrieve and set the Display Settings
  50. class DisplaySettingsRequests : public AZ::EBusTraits
  51. {
  52. public:
  53. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  54. //! Get the current display settings state
  55. virtual DisplaySettingsState GetSettingsState() const = 0;
  56. //! Set the display settings state
  57. virtual void SetSettingsState(const DisplaySettingsState& settingsState) = 0;
  58. ~DisplaySettingsRequests() = default;
  59. };
  60. using DisplaySettingsBus = AZ::EBus<DisplaySettingsRequests>;
  61. //! Component to modify Display Settings
  62. class DisplaySettingsComponent final
  63. : public AZ::Component
  64. , public DisplaySettingsBus::Handler
  65. {
  66. public:
  67. AZ_COMPONENT(DisplaySettingsComponent, "{A7CDBF22-3904-46C6-85D2-073CD902DD7F}")
  68. DisplaySettingsComponent() = default;
  69. ~DisplaySettingsComponent() override = default;
  70. static void Reflect(AZ::ReflectContext* context);
  71. // Component...
  72. void Activate() override;
  73. void Deactivate() override;
  74. // DisplaySettingsBus...
  75. DisplaySettingsState GetSettingsState() const override;
  76. void SetSettingsState(const DisplaySettingsState& settingsState) override;
  77. int ConvertToFlags(const DisplaySettingsState& settingsState) const;
  78. DisplaySettingsState ConvertToSettings(int settings) const;
  79. };
  80. } // namespace AzToolsFramework