CameraEditorSystemComponent.h 2.5 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. #pragma once
  9. #include <AzCore/Component/Component.h>
  10. #include <AzToolsFramework/ActionManager/ActionManagerRegistrationNotificationBus.h>
  11. #include <AzToolsFramework/API/ToolsApplicationAPI.h>
  12. #include <AzToolsFramework/API/EditorCameraBus.h>
  13. #include "CameraViewRegistrationBus.h"
  14. namespace Camera
  15. {
  16. class CameraEditorSystemComponent
  17. : public AZ::Component
  18. , private AzToolsFramework::EditorEvents::Bus::Handler
  19. , private EditorCameraSystemRequestBus::Handler
  20. , private CameraViewRegistrationRequestsBus::Handler
  21. , private AzToolsFramework::ActionManagerRegistrationNotificationBus::Handler
  22. {
  23. public:
  24. AZ_COMPONENT(CameraEditorSystemComponent, "{769802EB-722A-4F89-A475-DA396DA1FDCC}");
  25. static void Reflect(AZ::ReflectContext* context);
  26. CameraEditorSystemComponent() = default;
  27. ~CameraEditorSystemComponent() override = default;
  28. //////////////////////////////////////////////////////////////////////////
  29. // AZ::Component
  30. void Activate() override;
  31. void Deactivate() override;
  32. //////////////////////////////////////////////////////////////////////////
  33. private:
  34. //////////////////////////////////////////////////////////////////////////
  35. // AzToolsFramework::EditorEvents
  36. void NotifyRegisterViews() override;
  37. //////////////////////////////////////////////////////////////////////////
  38. //////////////////////////////////////////////////////////////////////////
  39. // EditorCameraRequestBus::Handler
  40. void CreateCameraEntityFromViewport() override;
  41. //////////////////////////////////////////////////////////////////////////
  42. //////////////////////////////////////////////////////////////////////////
  43. // CameraViewRegistrationRequestsBus::Handler
  44. void SetViewForEntity(const AZ::EntityId& id, AZ::RPI::ViewPtr view) override;
  45. AZ::RPI::ViewPtr GetViewForEntity(const AZ::EntityId& id) override;
  46. //////////////////////////////////////////////////////////////////////////
  47. // ActionManagerRegistrationNotificationBus overrides ...
  48. void OnActionRegistrationHook() override;
  49. void OnMenuBindingHook() override;
  50. AZStd::map<AZ::EntityId, AZStd::weak_ptr<AZ::RPI::View>> m_entityViewMap;
  51. };
  52. }