Viewport.h 21 KB

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