Added CSceneIterator and implemented support for Select All/Invert Selection

This commit is contained in:
parax0
2016-01-09 09:39:43 -07:00
parent 7eeb90b925
commit 38d04bcd25
20 changed files with 459 additions and 48 deletions

View File

@@ -2,12 +2,13 @@
#include "Editor/Undo/UndoCommands.h"
INodeEditor::INodeEditor(QWidget *pParent)
: QMainWindow(pParent),
mShowGizmo(false),
mGizmoHovering(false),
mGizmoTransforming(false),
mTranslateSpace(eWorldTransform),
mRotateSpace(eWorldTransform)
: QMainWindow(pParent)
, mSelectionLocked(false)
, mShowGizmo(false)
, mGizmoHovering(false)
, mGizmoTransforming(false)
, mTranslateSpace(eWorldTransform)
, mRotateSpace(eWorldTransform)
{
// Create undo actions
QAction *pUndoAction = mUndoStack.createUndoAction(this);
@@ -133,39 +134,68 @@ void INodeEditor::ExpandSelectionBounds(CSceneNode *pNode)
void INodeEditor::SelectNode(CSceneNode *pNode)
{
if (!pNode->IsSelected())
mUndoStack.push(new CSelectNodeCommand(this, pNode, mSelection));
if (!mSelectionLocked)
{
if (!pNode->IsSelected())
mUndoStack.push(new CSelectNodeCommand(this, pNode, mSelection));
}
}
void INodeEditor::DeselectNode(CSceneNode *pNode)
{
if (pNode->IsSelected())
mUndoStack.push(new CDeselectNodeCommand(this, pNode, mSelection));
if (!mSelectionLocked)
{
if (pNode->IsSelected())
mUndoStack.push(new CDeselectNodeCommand(this, pNode, mSelection));
}
}
void INodeEditor::ClearSelection()
{
if (!mSelection.empty())
mUndoStack.push(new CClearSelectionCommand(this, mSelection));
if (!mSelectionLocked)
{
if (!mSelection.empty())
mUndoStack.push(new CClearSelectionCommand(this, mSelection));
}
}
void INodeEditor::ClearAndSelectNode(CSceneNode *pNode)
{
if (mSelection.empty())
mUndoStack.push(new CSelectNodeCommand(this, pNode, mSelection));
else if ((mSelection.size() == 1) && (mSelection.front() == pNode))
return;
else
if (!mSelectionLocked)
{
mUndoStack.beginMacro("Select");
mUndoStack.push(new CClearSelectionCommand(this, mSelection));
mUndoStack.push(new CSelectNodeCommand(this, pNode, mSelection));
mUndoStack.endMacro();
if (mSelection.empty())
mUndoStack.push(new CSelectNodeCommand(this, pNode, mSelection));
else if ((mSelection.size() == 1) && (mSelection.front() == pNode))
return;
else
{
mUndoStack.beginMacro("Select");
mUndoStack.push(new CClearSelectionCommand(this, mSelection));
mUndoStack.push(new CSelectNodeCommand(this, pNode, mSelection));
mUndoStack.endMacro();
}
}
}
void INodeEditor::SelectAll(FNodeFlags NodeFlags)
{
if (!mSelectionLocked)
mUndoStack.push(new CSelectAllCommand(this, mSelection, &mScene, NodeFlags));
}
void INodeEditor::InvertSelection(FNodeFlags NodeFlags)
{
if (!mSelectionLocked)
mUndoStack.push(new CInvertSelectionCommand(this, mSelection, &mScene, NodeFlags));
}
void INodeEditor::SetSelectionLocked(bool Locked)
{
mSelectionLocked = Locked;
}
// ************ PUBLIC SLOTS ************
void INodeEditor::OnGizmoMoved()
{