2015-09-01 17:05:48 +00:00
|
|
|
#ifndef INODEEDITOR_H
|
|
|
|
#define INODEEDITOR_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QAction>
|
|
|
|
#include <QActionGroup>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QList>
|
|
|
|
#include <QUndoStack>
|
|
|
|
|
|
|
|
#include "CGizmo.h"
|
|
|
|
#include <Common/ETransformSpace.h>
|
|
|
|
#include <Core/CSceneManager.h>
|
|
|
|
|
|
|
|
class INodeEditor : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Undo stack
|
|
|
|
QUndoStack mUndoStack;
|
|
|
|
QList<QAction*> mUndoActions;
|
|
|
|
|
|
|
|
// Node management
|
|
|
|
CSceneManager mScene;
|
|
|
|
QList<CSceneNode*> mSelection;
|
|
|
|
CAABox mSelectionBounds;
|
|
|
|
|
|
|
|
// Gizmo
|
|
|
|
CGizmo mGizmo;
|
|
|
|
bool mShowGizmo;
|
|
|
|
bool mGizmoHovering;
|
|
|
|
bool mGizmoTransforming;
|
|
|
|
ETransformSpace mTranslateSpace;
|
|
|
|
ETransformSpace mRotateSpace;
|
|
|
|
|
|
|
|
// Gizmo widgets
|
|
|
|
QActionGroup *mpGizmoGroup;
|
|
|
|
QList<QAction*> mGizmoActions;
|
|
|
|
QComboBox *mpTransformCombo;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit INodeEditor(QWidget *pParent = 0);
|
|
|
|
virtual ~INodeEditor();
|
|
|
|
QUndoStack* UndoStack();
|
|
|
|
CSceneManager* Scene();
|
|
|
|
CGizmo* Gizmo();
|
|
|
|
bool IsGizmoVisible();
|
|
|
|
void BeginGizmoTransform();
|
|
|
|
void EndGizmoTransform();
|
|
|
|
|
|
|
|
ETransformSpace CurrentTransformSpace();
|
|
|
|
void RecalculateSelectionBounds();
|
|
|
|
void ExpandSelectionBounds(CSceneNode *pNode);
|
|
|
|
void SelectNode(CSceneNode *pNode);
|
|
|
|
void DeselectNode(CSceneNode *pNode);
|
|
|
|
void ClearSelection();
|
|
|
|
void ClearAndSelectNode(CSceneNode *pNode);
|
|
|
|
|
|
|
|
virtual void UpdateGizmoUI() = 0;
|
|
|
|
virtual void UpdateSelectionUI() = 0;
|
|
|
|
|
2015-11-27 12:26:32 +00:00
|
|
|
signals:
|
|
|
|
void SelectionModified();
|
2015-11-27 21:18:22 +00:00
|
|
|
void SelectionTransformed();
|
2015-11-27 12:26:32 +00:00
|
|
|
|
2015-09-01 17:05:48 +00:00
|
|
|
public slots:
|
|
|
|
void OnGizmoMoved();
|
|
|
|
|
|
|
|
protected:
|
2015-11-24 10:22:37 +00:00
|
|
|
virtual void GizmoModeChanged(CGizmo::EGizmoMode /*mode*/) {}
|
2015-09-01 17:05:48 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void OnSelectObjectsTriggered();
|
|
|
|
void OnTranslateTriggered();
|
|
|
|
void OnRotateTriggered();
|
|
|
|
void OnScaleTriggered();
|
|
|
|
void OnTransformSpaceChanged(int spaceIndex);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INODEEDITOR_H
|