PrimeWorldEditor/src/Editor/CSceneViewport.h

108 lines
3.0 KiB
C
Raw Normal View History

#ifndef CSCENEVIEWPORT_H
#define CSCENEVIEWPORT_H
#include "CBasicViewport.h"
#include "CGridRenderable.h"
#include "CLineRenderable.h"
#include "INodeEditor.h"
class CSceneViewport : public CBasicViewport
{
Q_OBJECT
INodeEditor *mpEditor;
2016-01-06 10:19:06 +00:00
CScene *mpScene;
CRenderer *mpRenderer;
bool mRenderingMergedWorld;
// Scene interaction
bool mGizmoHovering;
bool mGizmoTransforming;
SRayIntersection mRayIntersection;
CSceneNode *mpHoverNode;
CVector3f mHoverPoint;
2016-01-05 14:54:16 +00:00
// Context Menu
QMenu *mpContextMenu;
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
QMenu *mpSelectConnectedMenu;
QAction *mpSelectConnectedOutgoingAction;
QAction *mpSelectConnectedIncomingAction;
QAction *mpSelectConnectedAllAction;
// Grid
CGridRenderable mGrid;
// Link Line
bool mLinkLineEnabled;
CLineRenderable mLinkLine;
public:
CSceneViewport(QWidget *pParent = 0);
~CSceneViewport();
2016-01-06 10:19:06 +00:00
void SetScene(INodeEditor *pEditor, CScene *pScene);
void SetShowWorld(bool Visible);
2016-03-27 19:09:38 +00:00
void SetRenderMergedWorld(bool RenderMerged);
FShowFlags ShowFlags() const;
CRenderer* Renderer();
CSceneNode* HoverNode();
CVector3f HoverPoint();
2016-03-27 19:09:38 +00:00
void CheckGizmoInput(const CRay& rkRay);
SRayIntersection SceneRayCast(const CRay& rkRay);
void ResetHover();
bool IsHoveringGizmo();
void keyPressEvent(QKeyEvent* pEvent);
void keyReleaseEvent(QKeyEvent* pEvent);
inline void SetLinkLineEnabled(bool Enable) { mLinkLineEnabled = Enable; }
inline void SetLinkLine(const CVector3f& rkPointA, const CVector3f& rkPointB) { mLinkLine.SetPoints(rkPointA, rkPointB); }
2016-01-05 14:54:16 +00:00
protected:
void CreateContextMenu();
QMouseEvent CreateMouseEvent();
void FindConnectedObjects(uint32 InstanceID, bool SearchOutgoing, bool SearchIncoming, QList<uint32>& rIDList);
2016-01-05 14:54:16 +00:00
signals:
void InputProcessed(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
void ViewportClick(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
void GizmoMoved();
2015-11-27 21:18:22 +00:00
void CameraOrbit();
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
// Menu Actions
void OnToggleSelect();
void OnSelectConnected();
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();
};
#endif // CSCENEVIEWPORT_H