AtomRenderOptionsSystemComponent.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include "AtomRenderOptionsSystemComponent.h"
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. namespace AZ::Render
  12. {
  13. void AtomRenderOptionsSystemComponent::Reflect(AZ::ReflectContext* context)
  14. {
  15. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  16. {
  17. serialize->Class<AtomRenderOptionsSystemComponent, AZ::Component>()->Version(0);
  18. if (AZ::EditContext* ec = serialize->GetEditContext())
  19. {
  20. ec->Class<AtomRenderOptionsSystemComponent>(
  21. "Atom Render Options", "Allow to toggle and edit render passes inside the Editor viewport")
  22. ->ClassElement(Edit::ClassElements::EditorData, "")
  23. ->Attribute(Edit::Attributes::AutoExpand, true);
  24. }
  25. }
  26. }
  27. void AtomRenderOptionsSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  28. {
  29. provided.push_back(AZ_CRC_CE("AtomRenderOptionsService"));
  30. }
  31. void AtomRenderOptionsSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  32. {
  33. incompatible.push_back(AZ_CRC_CE("AtomRenderOptionsService"));
  34. }
  35. void AtomRenderOptionsSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  36. {
  37. required.push_back(AZ_CRC_CE("RPISystem"));
  38. }
  39. void AtomRenderOptionsSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  40. {
  41. }
  42. void AtomRenderOptionsSystemComponent::Activate()
  43. {
  44. if (!m_actionHandler)
  45. {
  46. m_actionHandler = AZStd::make_unique<AtomRenderOptionsActionHandler>();
  47. }
  48. m_actionHandler->Activate();
  49. }
  50. void AtomRenderOptionsSystemComponent::Deactivate()
  51. {
  52. m_actionHandler->Deactivate();
  53. }
  54. } // namespace AZ::Render