Viewport.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  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. // Description : interface for the CViewport class.
  9. #pragma once
  10. #if !defined(Q_MOC_RUN)
  11. #include <AzFramework/Viewport/ViewportId.h>
  12. #include <AzToolsFramework/Viewport/ViewportTypes.h>
  13. #include <AzToolsFramework/ViewportUi/ViewportUiManager.h>
  14. #include <Cry_Color.h>
  15. #include "IPostRenderer.h"
  16. #include "Include/IDisplayViewport.h"
  17. #include "Include/SandboxAPI.h"
  18. #include <QMenu>
  19. #include <QPointer>
  20. #if defined(Q_OS_WIN)
  21. #include <QtWinExtras/qwinfunctions.h>
  22. #endif
  23. #include <AzCore/Math/Uuid.h>
  24. #include <IEditor.h>
  25. #endif
  26. namespace AzQtComponents
  27. {
  28. class ViewportDragContext;
  29. }
  30. // forward declarations.
  31. class CBaseObject;
  32. struct DisplayContext;
  33. class CCryEditDoc;
  34. class CLayoutViewPane;
  35. class CViewManager;
  36. class CBaseObjectsCache;
  37. struct HitContext;
  38. class CImageEx;
  39. class QMenu;
  40. /** Type of viewport.
  41. */
  42. enum EViewportType
  43. {
  44. ET_ViewportUnknown = 0,
  45. ET_ViewportXY,
  46. ET_ViewportXZ,
  47. ET_ViewportYZ,
  48. ET_ViewportCamera,
  49. ET_ViewportMap,
  50. ET_ViewportModel,
  51. ET_ViewportZ, //!< Z Only viewport.
  52. ET_ViewportUI,
  53. ET_ViewportLast,
  54. };
  55. //////////////////////////////////////////////////////////////////////////
  56. // Standart cursors viewport can display.
  57. //////////////////////////////////////////////////////////////////////////
  58. enum EStdCursor
  59. {
  60. STD_CURSOR_DEFAULT,
  61. STD_CURSOR_HIT,
  62. STD_CURSOR_MOVE,
  63. STD_CURSOR_ROTATE,
  64. STD_CURSOR_SCALE,
  65. STD_CURSOR_SEL_PLUS,
  66. STD_CURSOR_SEL_MINUS,
  67. STD_CURSOR_SUBOBJ_SEL,
  68. STD_CURSOR_SUBOBJ_SEL_PLUS,
  69. STD_CURSOR_SUBOBJ_SEL_MINUS,
  70. STD_CURSOR_HAND,
  71. STD_CURSOR_GAME,
  72. STD_CURSOR_LAST,
  73. };
  74. AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
  75. class SANDBOX_API CViewport
  76. : public IDisplayViewport
  77. {
  78. AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
  79. public:
  80. typedef void(* DropCallback)(CViewport* viewport, int ptx, int pty, void* custom);
  81. virtual ~CViewport() {}
  82. virtual void SetActiveWindow() = 0;
  83. // Changed my view manager.
  84. void SetViewManager(CViewManager* viewMgr) { m_viewManager = viewMgr; };
  85. //! Access to view manager.
  86. CViewManager* GetViewManager() const { return m_viewManager; };
  87. virtual void AddPostRenderer(IPostRenderer* pPostRenderer) = 0;
  88. virtual bool RemovePostRenderer(IPostRenderer* pPostRenderer) = 0;
  89. virtual bool DestroyWindow() { return false; }
  90. /** Get type of this viewport.
  91. */
  92. virtual EViewportType GetType() const { return ET_ViewportUnknown; }
  93. /** Must be overriden in derived classes.
  94. */
  95. virtual void SetType(EViewportType type) = 0;
  96. /** Get name of viewport
  97. */
  98. virtual QString GetName() const = 0;
  99. virtual void SetSelected([[maybe_unused]] bool const bSelect){}
  100. //! Resets current selection region.
  101. virtual void ResetSelectionRegion() = 0;
  102. //! Set 2D selection rectangle.
  103. virtual void SetSelectionRectangle(const QRect& rect) = 0;
  104. inline void SetSelectionRectangle(const QPoint& startMousePosition, const QPoint& currentMousePosition)
  105. {
  106. // QRect's bottom/right are width - 1, height - 1, so when specifying the right position
  107. // directly in a QRect, we need to offset it by -1.
  108. SetSelectionRectangle(QRect(startMousePosition, currentMousePosition - QPoint(1, 1)));
  109. }
  110. //! Return 2D selection rectangle.
  111. virtual QRect GetSelectionRectangle() const = 0;
  112. //! Called when dragging selection rectangle.
  113. virtual void OnDragSelectRectangle(const QRect& rect, bool bNormalizeRect = false) = 0;
  114. void OnDragSelectRectangle(const QPoint& startMousePosition, const QPoint& currentMousePosition, bool bNormalizeRect = false)
  115. {
  116. // QRect's bottom/right are width - 1, height - 1, so when specifying the right position
  117. // directly in a QRect, we need to offset it by -1.
  118. OnDragSelectRectangle(QRect(startMousePosition, currentMousePosition - QPoint(1, 1)), bNormalizeRect);
  119. }
  120. virtual void ResetContent() = 0;
  121. virtual void UpdateContent(int flags) = 0;
  122. virtual void SetAxisConstrain(int axis) = 0;
  123. int GetAxisConstrain() const { return GetIEditor()->GetAxisConstrains(); };
  124. virtual Vec3 SnapToGrid(const Vec3& vec) = 0;
  125. //! Get selection precision tolerance.
  126. virtual float GetSelectionTolerance() const = 0;
  127. //////////////////////////////////////////////////////////////////////////
  128. // View matrix.
  129. //////////////////////////////////////////////////////////////////////////
  130. //! Set current view matrix,
  131. //! This is a matrix that transforms from world to view space.
  132. virtual void SetViewTM([[maybe_unused]] const Matrix34& tm)
  133. {
  134. AZ_Error("CryLegacy", false, "QtViewport::SetViewTM not implemented");
  135. }
  136. //! Get current view matrix.
  137. //! This is a matrix that transforms from world space to view space.
  138. const Matrix34& GetViewTM() const override
  139. {
  140. AZ_Error("CryLegacy", false, "QtViewport::GetViewTM not implemented");
  141. static const Matrix34 m;
  142. return m;
  143. };
  144. //////////////////////////////////////////////////////////////////////////
  145. //! Get current screen matrix.
  146. //! Screen matrix transform from World space to Screen space.
  147. const Matrix34& GetScreenTM() const override
  148. {
  149. return m_screenTM;
  150. }
  151. virtual Vec3 MapViewToCP(const QPoint& point) = 0;
  152. //! Map viewport position to world space position.
  153. Vec3 ViewToWorld(const QPoint& vp, bool* pCollideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override = 0;
  154. //! Convert point on screen to world ray.
  155. void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override = 0;
  156. //! Get normal for viewport position
  157. virtual Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) = 0;
  158. virtual Vec3 GetCPVector(const Vec3& p1, const Vec3& p2, int axis) = 0;
  159. virtual Vec3 GetCPVector(const Vec3& p1, const Vec3& p2) { return GetCPVector(p1, p2, GetAxisConstrain()); }
  160. //! Performs hit testing of 2d point in view to find which object hit.
  161. virtual bool HitTest(const QPoint& point, HitContext& hitInfo) = 0;
  162. virtual void MakeConstructionPlane(int axis) = 0;
  163. // Access to the member m_bAdvancedSelectMode so interested modules can know its value.
  164. virtual bool GetAdvancedSelectModeFlag() = 0;
  165. virtual void ToggleCameraObject() {}
  166. virtual bool IsSequenceCamera() const { return false; }
  167. //! Center viewport on selection.
  168. virtual void CenterOnSelection() = 0;
  169. virtual void CenterOnAABB(const AABB& aabb) = 0;
  170. virtual void CenterOnSliceInstance() = 0;
  171. /** Set ID of this viewport
  172. */
  173. virtual void SetViewportId(int id) { m_nCurViewportID = id; };
  174. /** Get ID of this viewport
  175. */
  176. virtual int GetViewportId() const { return m_nCurViewportID; };
  177. // Store final Game Matrix ready for editor
  178. void SetGameTM(const Matrix34& tm) { m_gameTM = tm; };
  179. //////////////////////////////////////////////////////////////////////////
  180. // Drag and drop support on viewports.
  181. // To be overrided in derived classes.
  182. //////////////////////////////////////////////////////////////////////////
  183. virtual void SetGlobalDropCallback(DropCallback dropCallback, void* dropCallbackCustom)
  184. {
  185. m_dropCallback = dropCallback;
  186. m_dropCallbackCustom = dropCallbackCustom;
  187. }
  188. virtual void SetConstructionMatrix(RefCoordSys coordSys, const Matrix34& xform) = 0;
  189. virtual void BeginUndo() = 0;
  190. virtual void AcceptUndo(const QString& undoDescription) = 0;
  191. virtual void CancelUndo() = 0;
  192. virtual void RestoreUndo() = 0;
  193. virtual bool IsUndoRecording() const = 0;
  194. virtual void CaptureMouse() {};
  195. virtual void SetCapture() { CaptureMouse(); }
  196. virtual void ReleaseMouse() {};
  197. virtual void ResetCursor() = 0;
  198. virtual void SetCursor(const QCursor& cursor) = 0;
  199. virtual void SetCurrentCursor(EStdCursor stdCursor) = 0;
  200. virtual void SetCurrentCursor(EStdCursor stdCursor, const QString& str) = 0;
  201. virtual void SetSupplementaryCursorStr(const QString& str) = 0;
  202. virtual void SetCursorString(const QString& str) = 0;
  203. virtual void SetFocus() = 0;
  204. virtual void Invalidate(bool bErase = true) = 0;
  205. // Is overridden by RenderViewport
  206. virtual void SetFOV([[maybe_unused]] float fov) {}
  207. virtual float GetFOV() const;
  208. virtual QObject* qobject() { return nullptr; }
  209. virtual QWidget* widget() { return nullptr; }
  210. virtual void OnTitleMenu([[maybe_unused]] QMenu* menu) {}
  211. void SetViewPane(CLayoutViewPane* viewPane) { m_viewPane = viewPane; }
  212. CViewport *asCViewport() override { return this; }
  213. protected:
  214. CLayoutViewPane* m_viewPane = nullptr;
  215. CViewManager* m_viewManager;
  216. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  217. // Screen Matrix
  218. Matrix34 m_screenTM;
  219. int m_nCurViewportID;
  220. // Final game view matrix before dropping back to editor
  221. Matrix34 m_gameTM;
  222. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  223. // Custom drop callback (Leroy@Conffx)
  224. DropCallback m_dropCallback;
  225. void* m_dropCallbackCustom;
  226. };
  227. template<typename T>
  228. typename std::enable_if<std::is_base_of<QObject, typename std::remove_cv<typename std::remove_pointer<T>::type>::type>::value, T>::type
  229. viewport_cast(CViewport* viewport)
  230. {
  231. if (viewport == nullptr)
  232. {
  233. return nullptr;
  234. }
  235. if (QObject* obj = viewport->qobject())
  236. {
  237. return qobject_cast<T>(obj);
  238. }
  239. else
  240. {
  241. return nullptr;
  242. }
  243. }
  244. /** Base class for all Editor Viewports.
  245. */
  246. class SANDBOX_API QtViewport
  247. : public QWidget
  248. , public CViewport
  249. {
  250. Q_OBJECT
  251. public:
  252. QObject* qobject() override { return this; }
  253. QWidget* widget() override { return this; }
  254. template<typename T>
  255. static const GUID& GetClassID()
  256. {
  257. static GUID guid = [] {
  258. return AZ::Uuid::CreateRandom();
  259. } ();
  260. return guid;
  261. }
  262. QtViewport(QWidget* parent = nullptr);
  263. virtual ~QtViewport();
  264. void SetActiveWindow() override { activateWindow(); }
  265. //! Called while window is idle.
  266. void Update() override;
  267. /** Set name of this viewport.
  268. */
  269. void SetName(const QString& name);
  270. /** Get name of viewport
  271. */
  272. QString GetName() const override;
  273. void SetFocus() override { setFocus(); }
  274. void Invalidate([[maybe_unused]] bool bErase = 1) override { update(); }
  275. // Is overridden by RenderViewport
  276. void SetFOV([[maybe_unused]] float fov) override {}
  277. float GetFOV() const override;
  278. // Must be overridden in derived classes.
  279. // Returns:
  280. // e.g. 4.0/3.0
  281. float GetAspectRatio() const override = 0;
  282. void GetDimensions(int* pWidth, int* pHeight) const override;
  283. void ScreenToClient(QPoint& pPoint) const override;
  284. void ResetContent() override;
  285. void UpdateContent(int flags) override;
  286. //! Set current zoom factor for this viewport.
  287. virtual void SetZoomFactor(float fZoomFactor);
  288. //! Get current zoom factor for this viewport.
  289. virtual float GetZoomFactor() const;
  290. virtual void OnActivate();
  291. virtual void OnDeactivate();
  292. //! Map world space position to viewport position.
  293. QPoint WorldToView(const Vec3& wp) const override;
  294. //! Map world space position to 3D viewport position.
  295. Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const override;
  296. //! Map viewport position to world space position.
  297. virtual Vec3 ViewToWorld(const QPoint& vp, bool* pCollideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
  298. //! Convert point on screen to world ray.
  299. virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
  300. //! Get normal for viewport position
  301. virtual Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
  302. //! Map view point to world space using current construction plane.
  303. Vec3 MapViewToCP(const QPoint& point) override { return MapViewToCP(point, GetAxisConstrain()); }
  304. virtual Vec3 MapViewToCP(const QPoint& point, int axis);
  305. //! This method return a vector (p2-p1) in world space alligned to construction plane and restriction axises.
  306. //! p1 and p2 must be given in world space and lie on construction plane.
  307. using CViewport::GetCPVector;
  308. Vec3 GetCPVector(const Vec3& p1, const Vec3& p2, int axis) override;
  309. //! Snap any given 3D world position to grid lines if snap is enabled.
  310. Vec3 SnapToGrid(const Vec3& vec) override;
  311. //! Returns the screen scale factor for a point given in world coordinates.
  312. //! This factor gives the width in world-space units at the point's distance of the viewport.
  313. float GetScreenScaleFactor([[maybe_unused]] const Vec3& worldPoint) const override { return 1; };
  314. void SetAxisConstrain(int axis) override;
  315. /// Take raw input and create a final mouse interaction.
  316. /// @attention Do not map **point** from widget to viewport explicitly,
  317. /// this is handled internally by BuildMouseInteraction - just pass directly.
  318. virtual AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
  319. Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point);
  320. //////////////////////////////////////////////////////////////////////////
  321. // Selection.
  322. //////////////////////////////////////////////////////////////////////////
  323. //! Resets current selection region.
  324. void ResetSelectionRegion() override;
  325. //! Set 2D selection rectangle.
  326. void SetSelectionRectangle(const QRect& rect) override;
  327. //! Return 2D selection rectangle.
  328. QRect GetSelectionRectangle() const override { return m_selectedRect; };
  329. //! Called when dragging selection rectangle.
  330. void OnDragSelectRectangle(const QRect& rect, bool bNormalizeRect = false) override;
  331. //! Get selection precision tolerance.
  332. float GetSelectionTolerance() const override { return m_selectionTolerance; }
  333. //! Center viewport on selection.
  334. void CenterOnSelection() override {}
  335. void CenterOnAABB([[maybe_unused]] const AABB& aabb) override {}
  336. void CenterOnSliceInstance() override {}
  337. //! Performs hit testing of 2d point in view to find which object hit.
  338. bool HitTest(const QPoint& point, HitContext& hitInfo) override;
  339. float GetDistanceToLine(const Vec3& lineP1, const Vec3& lineP2, const QPoint& point) const override;
  340. // Access to the member m_bAdvancedSelectMode so interested modules can know its value.
  341. bool GetAdvancedSelectModeFlag() override;
  342. void GetPerpendicularAxis(EAxis* pAxis, bool* pIs2D) const override;
  343. //////////////////////////////////////////////////////////////////////////
  344. //! Set construction plane from given position construction matrix refrence coord system and axis settings.
  345. //////////////////////////////////////////////////////////////////////////
  346. void MakeConstructionPlane(int axis) override;
  347. void SetConstructionMatrix(RefCoordSys coordSys, const Matrix34& xform) override;
  348. virtual const Matrix34& GetConstructionMatrix(RefCoordSys coordSys);
  349. // Set simple construction plane origin.
  350. void SetConstructionOrigin(const Vec3& worldPos);
  351. //////////////////////////////////////////////////////////////////////////
  352. void DegradateQuality(bool bEnable);
  353. //////////////////////////////////////////////////////////////////////////
  354. // Undo for viewpot operations.
  355. void BeginUndo() override;
  356. void AcceptUndo(const QString& undoDescription) override;
  357. void CancelUndo() override;
  358. void RestoreUndo() override;
  359. bool IsUndoRecording() const override;
  360. //////////////////////////////////////////////////////////////////////////
  361. //! Get prefered original size for this viewport.
  362. //! if 0, then no preference.
  363. virtual QSize GetIdealSize() const;
  364. //! Check if world space bounding box is visible in this view.
  365. bool IsBoundsVisible(const AABB& box) const override;
  366. //////////////////////////////////////////////////////////////////////////
  367. void SetCursor(const QCursor& cursor) override
  368. {
  369. setCursor(cursor);
  370. }
  371. // Set`s current cursor string.
  372. void SetCurrentCursor(const QCursor& hCursor, const QString& cursorString);
  373. void SetCurrentCursor(EStdCursor stdCursor, const QString& cursorString) override;
  374. void SetCurrentCursor(EStdCursor stdCursor) override;
  375. void SetCursorString(const QString& cursorString) override;
  376. void ResetCursor() override;
  377. void SetSupplementaryCursorStr(const QString& str) override;
  378. void AddPostRenderer(IPostRenderer* pPostRenderer) override;
  379. bool RemovePostRenderer(IPostRenderer* pPostRenderer) override;
  380. void CaptureMouse() override { m_mouseCaptured = true; QWidget::grabMouse(); }
  381. void ReleaseMouse() override { m_mouseCaptured = false; QWidget::releaseMouse(); }
  382. void setRay(QPoint& vp, Vec3& raySrc, Vec3& rayDir) override;
  383. QPoint m_vp;
  384. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  385. Vec3 m_raySrc;
  386. Vec3 m_rayDir;
  387. // Greater than 0 while running MouseCallback() function. It needs to be a counter
  388. // because of recursive calls to MouseCallback(). It's used to make an exception
  389. // during the SScopedCurrentContext count check of m_cameraSetForWidgetRenderingCount.
  390. int m_processingMouseCallbacksCounter = 0;
  391. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  392. protected:
  393. friend class CViewManager;
  394. bool IsVectorInValidRange(const Vec3& v) const { return fabs(v.x) < 1e+8 && fabs(v.y) < 1e+8 && fabs(v.z) < 1e+8; }
  395. void AssignConstructionPlane(const Vec3& p1, const Vec3& p2, const Vec3& p3);
  396. HWND renderOverlayHWND() const;
  397. void setRenderOverlayVisible(bool);
  398. bool isRenderOverlayVisible() const;
  399. void mousePressEvent(QMouseEvent* event) override;
  400. void mouseReleaseEvent(QMouseEvent* event) override;
  401. void mouseDoubleClickEvent(QMouseEvent* event) override;
  402. void mouseMoveEvent(QMouseEvent* event) override;
  403. void wheelEvent(QWheelEvent* event) override;
  404. void keyPressEvent(QKeyEvent* event) override;
  405. void keyReleaseEvent(QKeyEvent* event) override;
  406. void resizeEvent(QResizeEvent* event) override;
  407. void paintEvent(QPaintEvent* event) override;
  408. virtual void OnMouseMove(Qt::KeyboardModifiers, Qt::MouseButtons, const QPoint&) {}
  409. virtual void OnMouseWheel(Qt::KeyboardModifiers, short zDelta, const QPoint&);
  410. virtual void OnLButtonDown(Qt::KeyboardModifiers, const QPoint&) {}
  411. virtual void OnLButtonUp(Qt::KeyboardModifiers, const QPoint&) {}
  412. virtual void OnRButtonDown(Qt::KeyboardModifiers, const QPoint&) {}
  413. virtual void OnRButtonUp(Qt::KeyboardModifiers, const QPoint&) {}
  414. virtual void OnMButtonDblClk(Qt::KeyboardModifiers, const QPoint&) {}
  415. virtual void OnMButtonDown(Qt::KeyboardModifiers, const QPoint&) {}
  416. virtual void OnMButtonUp(Qt::KeyboardModifiers, const QPoint&) {}
  417. virtual void OnLButtonDblClk(Qt::KeyboardModifiers, const QPoint&) {}
  418. virtual void OnRButtonDblClk(Qt::KeyboardModifiers, const QPoint&) {}
  419. virtual void OnKeyDown([[maybe_unused]] UINT nChar, [[maybe_unused]] UINT nRepCnt, [[maybe_unused]] UINT nFlags) {}
  420. virtual void OnKeyUp([[maybe_unused]] UINT nChar, [[maybe_unused]] UINT nRepCnt, [[maybe_unused]] UINT nFlags) {}
  421. #if defined(AZ_PLATFORM_WINDOWS)
  422. void OnRawInput(UINT wParam, HRAWINPUT lParam);
  423. #endif
  424. void OnSetCursor();
  425. virtual void BuildDragDropContext(
  426. AzQtComponents::ViewportDragContext& context, AzFramework::ViewportId viewportId, const QPoint& point);
  427. void dragEnterEvent(QDragEnterEvent* event) override;
  428. void dragMoveEvent(QDragMoveEvent* event) override;
  429. void dragLeaveEvent(QDragLeaveEvent* event) override;
  430. void dropEvent(QDropEvent* event) override;
  431. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  432. AzToolsFramework::ViewportUi::ViewportUiManager m_viewportUi;
  433. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  434. float m_selectionTolerance;
  435. QMenu m_cViewMenu;
  436. mutable float m_fZoomFactor;
  437. QPoint m_cMouseDownPos;
  438. //! Current selected rectangle.
  439. QRect m_selectedRect;
  440. int m_activeAxis;
  441. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  442. //! Current construction plane.
  443. ::Plane m_constructionPlane;
  444. Vec3 m_constructionPlaneAxisX;
  445. Vec3 m_constructionPlaneAxisY;
  446. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  447. // When true selection helpers will be shown and hit tested against.
  448. bool m_bAdvancedSelectMode;
  449. //////////////////////////////////////////////////////////////////////////
  450. // Standard cursors.
  451. //////////////////////////////////////////////////////////////////////////
  452. QCursor m_hCursor[STD_CURSOR_LAST];
  453. QCursor m_hCurrCursor;
  454. //! Mouse is over this object.
  455. CBaseObject* m_pMouseOverObject;
  456. QString m_cursorStr;
  457. QString m_cursorSupplementaryStr;
  458. static bool m_bDegradateQuality;
  459. // Grid size modifier due to zoom.
  460. float m_fGridZoom;
  461. int m_nLastUpdateFrame;
  462. int m_nLastMouseMoveFrame;
  463. QRect m_rcClient;
  464. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  465. // Same construction matrix is shared by all viewports.
  466. Matrix34 m_constructionMatrix[LAST_COORD_SYSTEM];
  467. typedef std::vector<_smart_ptr<IPostRenderer> > PostRenderers;
  468. PostRenderers m_postRenderers;
  469. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  470. protected:
  471. bool m_mouseCaptured = false;
  472. private:
  473. QWidget m_renderOverlay;
  474. };