2015-09-01 17:05:48 +00:00
|
|
|
#ifndef CSCENEVIEWPORT_H
|
|
|
|
#define CSCENEVIEWPORT_H
|
|
|
|
|
|
|
|
#include "CBasicViewport.h"
|
2017-02-12 01:35:33 +00:00
|
|
|
#include "CGridRenderable.h"
|
2016-05-03 11:15:47 +00:00
|
|
|
#include "CLineRenderable.h"
|
2015-09-01 17:05:48 +00:00
|
|
|
#include "INodeEditor.h"
|
|
|
|
|
|
|
|
class CSceneViewport : public CBasicViewport
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
INodeEditor *mpEditor;
|
2016-01-06 10:19:06 +00:00
|
|
|
CScene *mpScene;
|
2015-09-01 17:05:48 +00:00
|
|
|
CRenderer *mpRenderer;
|
2016-01-15 23:36:58 +00:00
|
|
|
bool mRenderingMergedWorld;
|
2015-09-01 17:05:48 +00:00
|
|
|
|
|
|
|
// Scene interaction
|
|
|
|
bool mGizmoHovering;
|
|
|
|
bool mGizmoTransforming;
|
2016-01-16 19:57:20 +00:00
|
|
|
SRayIntersection mRayIntersection;
|
2015-09-01 17:05:48 +00:00
|
|
|
CSceneNode *mpHoverNode;
|
|
|
|
CVector3f mHoverPoint;
|
|
|
|
|
2016-01-05 14:54:16 +00:00
|
|
|
// Context Menu
|
|
|
|
QMenu *mpContextMenu;
|
2016-01-09 23:52:01 +00:00
|
|
|
QAction *mpToggleSelectAction;
|
|
|
|
QAction *mpHideSelectionSeparator;
|
|
|
|
QAction *mpHideSelectionAction;
|
|
|
|
QAction *mpHideUnselectedAction;
|
|
|
|
QAction *mpHideHoverSeparator;
|
|
|
|
QAction *mpHideHoverNodeAction;
|
|
|
|
QAction *mpHideHoverTypeAction;
|
|
|
|
QAction *mpHideHoverLayerAction;
|
|
|
|
QAction *mpUnhideSeparator;
|
2016-01-05 14:54:16 +00:00
|
|
|
QAction *mpUnhideAllAction;
|
2019-04-06 22:53:05 +00:00
|
|
|
QAction *mpPlayFromHereSeparator;
|
|
|
|
QAction *mpPlayFromHereAction;
|
2016-01-05 14:54:16 +00:00
|
|
|
CSceneNode *mpMenuNode;
|
2019-04-06 22:53:05 +00:00
|
|
|
CVector3f mMenuPoint;
|
2016-01-05 14:54:16 +00:00
|
|
|
|
2016-03-20 03:47:40 +00:00
|
|
|
QMenu *mpSelectConnectedMenu;
|
|
|
|
QAction *mpSelectConnectedOutgoingAction;
|
|
|
|
QAction *mpSelectConnectedIncomingAction;
|
|
|
|
QAction *mpSelectConnectedAllAction;
|
|
|
|
|
2017-02-12 01:35:33 +00:00
|
|
|
// Grid
|
|
|
|
CGridRenderable mGrid;
|
|
|
|
|
2016-03-08 00:34:48 +00:00
|
|
|
// Link Line
|
|
|
|
bool mLinkLineEnabled;
|
2016-05-03 11:15:47 +00:00
|
|
|
CLineRenderable mLinkLine;
|
2016-03-08 00:34:48 +00:00
|
|
|
|
2015-09-01 17:05:48 +00:00
|
|
|
public:
|
|
|
|
CSceneViewport(QWidget *pParent = 0);
|
|
|
|
~CSceneViewport();
|
2016-01-06 10:19:06 +00:00
|
|
|
void SetScene(INodeEditor *pEditor, CScene *pScene);
|
2016-01-15 23:36:58 +00:00
|
|
|
void SetShowWorld(bool Visible);
|
2016-03-27 19:09:38 +00:00
|
|
|
void SetRenderMergedWorld(bool RenderMerged);
|
2016-01-09 16:39:43 +00:00
|
|
|
FShowFlags ShowFlags() const;
|
2015-09-01 17:05:48 +00:00
|
|
|
CRenderer* Renderer();
|
|
|
|
CSceneNode* HoverNode();
|
|
|
|
CVector3f HoverPoint();
|
2016-03-27 19:09:38 +00:00
|
|
|
void CheckGizmoInput(const CRay& rkRay);
|
|
|
|
SRayIntersection SceneRayCast(const CRay& rkRay);
|
2015-09-01 17:05:48 +00:00
|
|
|
void ResetHover();
|
|
|
|
bool IsHoveringGizmo();
|
|
|
|
|
2015-11-26 07:47:02 +00:00
|
|
|
void keyPressEvent(QKeyEvent* pEvent);
|
|
|
|
void keyReleaseEvent(QKeyEvent* pEvent);
|
|
|
|
|
2016-05-03 11:15:47 +00:00
|
|
|
inline void SetLinkLineEnabled(bool Enable) { mLinkLineEnabled = Enable; }
|
|
|
|
inline void SetLinkLine(const CVector3f& rkPointA, const CVector3f& rkPointB) { mLinkLine.SetPoints(rkPointA, rkPointB); }
|
2016-03-08 00:34:48 +00:00
|
|
|
|
2016-01-05 14:54:16 +00:00
|
|
|
protected:
|
|
|
|
void CreateContextMenu();
|
2016-01-16 19:57:20 +00:00
|
|
|
QMouseEvent CreateMouseEvent();
|
2018-12-12 05:50:46 +00:00
|
|
|
void FindConnectedObjects(uint32 InstanceID, bool SearchOutgoing, bool SearchIncoming, QList<uint32>& rIDList);
|
2016-01-05 14:54:16 +00:00
|
|
|
|
2015-09-01 17:05:48 +00:00
|
|
|
signals:
|
2016-01-16 19:57:20 +00:00
|
|
|
void InputProcessed(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
|
|
|
void ViewportClick(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
2015-09-01 17:05:48 +00:00
|
|
|
void GizmoMoved();
|
2015-11-27 21:18:22 +00:00
|
|
|
void CameraOrbit();
|
2015-09-01 17:05:48 +00:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void CheckUserInput();
|
|
|
|
void Paint();
|
|
|
|
void ContextMenu(QContextMenuEvent *pEvent);
|
|
|
|
void OnResize();
|
|
|
|
void OnMouseClick(QMouseEvent *pEvent);
|
|
|
|
void OnMouseRelease(QMouseEvent *pEvent);
|
2016-01-05 14:54:16 +00:00
|
|
|
|
2016-01-09 23:52:01 +00:00
|
|
|
// Menu Actions
|
|
|
|
void OnToggleSelect();
|
2016-03-20 03:02:23 +00:00
|
|
|
void OnSelectConnected();
|
2016-01-09 23:52:01 +00:00
|
|
|
void OnHideSelection();
|
|
|
|
void OnHideUnselected();
|
2016-01-05 14:54:16 +00:00
|
|
|
void OnHideNode();
|
|
|
|
void OnHideType();
|
|
|
|
void OnHideLayer();
|
|
|
|
void OnUnhideAll();
|
2019-04-06 22:53:05 +00:00
|
|
|
void OnPlayFromHere();
|
2016-01-05 14:54:16 +00:00
|
|
|
void OnContextMenuClose();
|
2015-09-01 17:05:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CSCENEVIEWPORT_H
|