CameraEditorSystemComponent.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 <AzToolsFramework/Editor/EditorContextMenuBus.h>
  14. #include "CameraViewRegistrationBus.h"
  15. namespace Camera
  16. {
  17. class CameraEditorSystemComponent
  18. : public AZ::Component
  19. , private AzToolsFramework::EditorEvents::Bus::Handler
  20. , private EditorCameraSystemRequestBus::Handler
  21. , private CameraViewRegistrationRequestsBus::Handler
  22. , private AzToolsFramework::EditorContextMenuBus::Handler
  23. , private AzToolsFramework::ActionManagerRegistrationNotificationBus::Handler
  24. {
  25. public:
  26. AZ_COMPONENT(CameraEditorSystemComponent, "{769802EB-722A-4F89-A475-DA396DA1FDCC}");
  27. static void Reflect(AZ::ReflectContext* context);
  28. CameraEditorSystemComponent() = default;
  29. ~CameraEditorSystemComponent() override = default;
  30. //////////////////////////////////////////////////////////////////////////
  31. // AZ::Component
  32. void Activate() override;
  33. void Deactivate() override;
  34. //////////////////////////////////////////////////////////////////////////
  35. private:
  36. //////////////////////////////////////////////////////////////////////////
  37. // AzToolsFramework::EditorContextMenuBus
  38. void PopulateEditorGlobalContextMenu(QMenu* menu, const AZStd::optional<AzFramework::ScreenPoint>& point, int flags) override;
  39. //////////////////////////////////////////////////////////////////////////
  40. //////////////////////////////////////////////////////////////////////////
  41. // AzToolsFramework::EditorEvents
  42. void NotifyRegisterViews() override;
  43. //////////////////////////////////////////////////////////////////////////
  44. //////////////////////////////////////////////////////////////////////////
  45. // EditorCameraRequestBus::Handler
  46. void CreateCameraEntityFromViewport() override;
  47. //////////////////////////////////////////////////////////////////////////
  48. //////////////////////////////////////////////////////////////////////////
  49. // CameraViewRegistrationRequestsBus::Handler
  50. void SetViewForEntity(const AZ::EntityId& id, AZ::RPI::ViewPtr view) override;
  51. AZ::RPI::ViewPtr GetViewForEntity(const AZ::EntityId& id) override;
  52. //////////////////////////////////////////////////////////////////////////
  53. // ActionManagerRegistrationNotificationBus overrides ...
  54. void OnActionRegistrationHook() override;
  55. void OnMenuBindingHook() override;
  56. AZStd::map<AZ::EntityId, AZStd::weak_ptr<AZ::RPI::View>> m_entityViewMap;
  57. };
  58. }