General: Make use of ranged for where applicable
This commit is contained in:
parent
9bc2723498
commit
ec66d7af9d
|
@ -49,7 +49,7 @@ bool CEditorApplication::CloseAllEditors()
|
|||
return true;
|
||||
|
||||
// Close active editor windows.
|
||||
foreach (IEditor *pEditor, mEditorWindows)
|
||||
for (IEditor *pEditor : mEditorWindows)
|
||||
{
|
||||
if (pEditor != mpWorldEditor && !pEditor->close())
|
||||
return false;
|
||||
|
@ -318,16 +318,20 @@ void CEditorApplication::TickEditors()
|
|||
gpResourceStore->ConditionalSaveStore();
|
||||
|
||||
// Tick each editor window and redraw their viewports
|
||||
foreach(IEditor *pEditor, mEditorWindows)
|
||||
for (IEditor *pEditor : mEditorWindows)
|
||||
{
|
||||
if (pEditor->isVisible())
|
||||
{
|
||||
CBasicViewport *pViewport = pEditor->Viewport();
|
||||
bool ViewportVisible = (pViewport && pViewport->isVisible() && !pEditor->isMinimized());
|
||||
const bool ViewportVisible = (pViewport && pViewport->isVisible() && !pEditor->isMinimized());
|
||||
|
||||
if (ViewportVisible) pViewport->ProcessInput();
|
||||
pEditor->EditorTick((float) DeltaTime);
|
||||
if (ViewportVisible) pViewport->Render();
|
||||
if (ViewportVisible)
|
||||
pViewport->ProcessInput();
|
||||
|
||||
pEditor->EditorTick(static_cast<float>(DeltaTime));
|
||||
|
||||
if (ViewportVisible)
|
||||
pViewport->Render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
~CNodeSelection() override
|
||||
{
|
||||
foreach (CSceneNode *pNode, mSelectedNodes)
|
||||
for (CSceneNode *pNode : mSelectedNodes)
|
||||
pNode->SetSelected(false);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
void Clear()
|
||||
{
|
||||
foreach (CSceneNode *pNode, mSelectedNodes)
|
||||
for (CSceneNode *pNode : mSelectedNodes)
|
||||
pNode->SetSelected(false);
|
||||
|
||||
mSelectedNodes.clear();
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
blockSignals(true);
|
||||
Clear();
|
||||
|
||||
foreach (CSceneNode *pNode, rkList)
|
||||
for (CSceneNode *pNode : rkList)
|
||||
SelectNode(pNode);
|
||||
blockSignals(false);
|
||||
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
{
|
||||
mCachedBounds = CAABox::Infinite();
|
||||
|
||||
foreach (CSceneNode *pNode, mSelectedNodes)
|
||||
for (CSceneNode *pNode : mSelectedNodes)
|
||||
{
|
||||
mCachedBounds.ExpandBounds(pNode->AABox());
|
||||
|
||||
|
|
|
@ -438,7 +438,7 @@ void CSceneViewport::OnSelectConnected()
|
|||
FindConnectedObjects(static_cast<CScriptNode*>(mpMenuNode)->Instance()->InstanceID(), SearchOutgoing, SearchIncoming, InstanceIDs);
|
||||
|
||||
QList<CSceneNode*> Nodes;
|
||||
foreach (uint32 ID, InstanceIDs)
|
||||
for (const uint32 ID : InstanceIDs)
|
||||
Nodes << mpScene->NodeForInstanceID(ID);
|
||||
|
||||
const bool ShouldClear = ((qApp->keyboardModifiers() & Qt::ControlModifier) == 0);
|
||||
|
|
|
@ -129,9 +129,9 @@ void CTweakEditor::OnProjectChanged(CGameProject* pNewProject)
|
|||
return pLeft->TweakName().ToUpper() < pRight->TweakName().ToUpper();
|
||||
});
|
||||
|
||||
foreach (CTweakData* pTweakData, mTweakAssets)
|
||||
for (CTweakData* pTweakData : mTweakAssets)
|
||||
{
|
||||
QString TweakName = TO_QSTRING( pTweakData->TweakName() );
|
||||
const QString TweakName = TO_QSTRING(pTweakData->TweakName());
|
||||
mpUI->TweakTabs->addTab(TweakName);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ INodeEditor::INodeEditor(QWidget *pParent)
|
|||
|
||||
mpGizmoGroup = new QActionGroup(this);
|
||||
|
||||
foreach (QAction *pAction, mGizmoActions)
|
||||
for (QAction *pAction : mGizmoActions)
|
||||
{
|
||||
pAction->setCheckable(true);
|
||||
mpGizmoGroup->addAction(pAction);
|
||||
|
@ -57,7 +57,7 @@ CGizmo* INodeEditor::Gizmo()
|
|||
return &mGizmo;
|
||||
}
|
||||
|
||||
bool INodeEditor::IsGizmoVisible()
|
||||
bool INodeEditor::IsGizmoVisible() const
|
||||
{
|
||||
return (mShowGizmo && !mpSelection->IsEmpty());
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ void INodeEditor::BeginGizmoTransform()
|
|||
if ((qApp->keyboardModifiers() & Qt::ShiftModifier) != 0)
|
||||
mCloneState = ECloneState::ReadyToClone;
|
||||
|
||||
foreach (QAction *pAction, mGizmoActions)
|
||||
for (QAction *pAction : mGizmoActions)
|
||||
pAction->setEnabled(false);
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ void INodeEditor::EndGizmoTransform()
|
|||
{
|
||||
mGizmoTransforming = false;
|
||||
|
||||
foreach (QAction *pAction, mGizmoActions)
|
||||
for (QAction *pAction : mGizmoActions)
|
||||
pAction->setEnabled(true);
|
||||
|
||||
if (mGizmo.HasTransformed())
|
||||
|
@ -95,7 +95,7 @@ void INodeEditor::EndGizmoTransform()
|
|||
mCloneState = ECloneState::NotCloning;
|
||||
}
|
||||
|
||||
ETransformSpace INodeEditor::CurrentTransformSpace()
|
||||
ETransformSpace INodeEditor::CurrentTransformSpace() const
|
||||
{
|
||||
switch (mGizmo.Mode())
|
||||
{
|
||||
|
@ -108,98 +108,100 @@ ETransformSpace INodeEditor::CurrentTransformSpace()
|
|||
|
||||
void INodeEditor::SelectNode(CSceneNode *pNode)
|
||||
{
|
||||
if (!mSelectionLocked)
|
||||
{
|
||||
if (!pNode->IsSelected())
|
||||
mUndoStack.push(new CSelectNodeCommand(mpSelection, pNode));
|
||||
}
|
||||
if (mSelectionLocked)
|
||||
return;
|
||||
|
||||
if (!pNode->IsSelected())
|
||||
mUndoStack.push(new CSelectNodeCommand(mpSelection, pNode));
|
||||
}
|
||||
|
||||
void INodeEditor::BatchSelectNodes(QList<CSceneNode*> Nodes, bool ClearExistingSelection, const QString& rkCommandName /*= "Select"*/)
|
||||
{
|
||||
if (!mSelectionLocked)
|
||||
if (mSelectionLocked)
|
||||
return;
|
||||
|
||||
if (!ClearExistingSelection)
|
||||
{
|
||||
if (!ClearExistingSelection)
|
||||
for (CSceneNode *pNode : Nodes)
|
||||
{
|
||||
foreach (CSceneNode *pNode, Nodes)
|
||||
{
|
||||
if (pNode->IsSelected())
|
||||
Nodes.removeOne(pNode);
|
||||
}
|
||||
if (pNode->IsSelected())
|
||||
Nodes.removeOne(pNode);
|
||||
}
|
||||
}
|
||||
|
||||
if (Nodes.size() > 0)
|
||||
{
|
||||
mUndoStack.beginMacro(rkCommandName);
|
||||
if (Nodes.size() > 0)
|
||||
{
|
||||
mUndoStack.beginMacro(rkCommandName);
|
||||
|
||||
if (ClearExistingSelection)
|
||||
ClearSelection();
|
||||
if (ClearExistingSelection)
|
||||
ClearSelection();
|
||||
|
||||
foreach (CSceneNode *pNode, Nodes)
|
||||
SelectNode(pNode);
|
||||
for (CSceneNode *pNode : Nodes)
|
||||
SelectNode(pNode);
|
||||
|
||||
mUndoStack.endMacro();
|
||||
}
|
||||
mUndoStack.endMacro();
|
||||
}
|
||||
}
|
||||
|
||||
void INodeEditor::DeselectNode(CSceneNode *pNode)
|
||||
{
|
||||
if (!mSelectionLocked)
|
||||
{
|
||||
if (pNode->IsSelected())
|
||||
mUndoStack.push(new CDeselectNodeCommand(mpSelection, pNode));
|
||||
}
|
||||
if (mSelectionLocked)
|
||||
return;
|
||||
|
||||
if (pNode->IsSelected())
|
||||
mUndoStack.push(new CDeselectNodeCommand(mpSelection, pNode));
|
||||
}
|
||||
|
||||
void INodeEditor::BatchDeselectNodes(QList<CSceneNode*> Nodes, const QString& rkCommandName /*= "Deselect"*/)
|
||||
{
|
||||
if (!mSelectionLocked)
|
||||
if (mSelectionLocked)
|
||||
return;
|
||||
|
||||
for (CSceneNode *pNode : Nodes)
|
||||
{
|
||||
foreach (CSceneNode *pNode, Nodes)
|
||||
{
|
||||
if (!pNode->IsSelected())
|
||||
Nodes.removeOne(pNode);
|
||||
}
|
||||
if (!pNode->IsSelected())
|
||||
Nodes.removeOne(pNode);
|
||||
}
|
||||
|
||||
if (Nodes.size() > 0)
|
||||
{
|
||||
mUndoStack.beginMacro(rkCommandName);
|
||||
if (Nodes.size() > 0)
|
||||
{
|
||||
mUndoStack.beginMacro(rkCommandName);
|
||||
|
||||
foreach (CSceneNode *pNode, Nodes)
|
||||
DeselectNode(pNode);
|
||||
for (CSceneNode *pNode : Nodes)
|
||||
DeselectNode(pNode);
|
||||
|
||||
mUndoStack.endMacro();
|
||||
}
|
||||
mUndoStack.endMacro();
|
||||
}
|
||||
}
|
||||
|
||||
void INodeEditor::ClearSelection()
|
||||
{
|
||||
if (!mSelectionLocked)
|
||||
{
|
||||
if (!mpSelection->IsEmpty())
|
||||
mUndoStack.push(new CClearSelectionCommand(mpSelection));
|
||||
}
|
||||
if (mSelectionLocked)
|
||||
return;
|
||||
|
||||
if (!mpSelection->IsEmpty())
|
||||
mUndoStack.push(new CClearSelectionCommand(mpSelection));
|
||||
}
|
||||
|
||||
void INodeEditor::ClearAndSelectNode(CSceneNode *pNode)
|
||||
{
|
||||
if (!mSelectionLocked)
|
||||
if (mSelectionLocked)
|
||||
return;
|
||||
|
||||
if (mpSelection->IsEmpty())
|
||||
{
|
||||
if (mpSelection->IsEmpty())
|
||||
mUndoStack.push(new CSelectNodeCommand(mpSelection, pNode));
|
||||
|
||||
else if ((mpSelection->Size() == 1) && (mpSelection->Front() == pNode))
|
||||
return;
|
||||
|
||||
else
|
||||
{
|
||||
mUndoStack.beginMacro(tr("Select"));
|
||||
mUndoStack.push(new CClearSelectionCommand(mpSelection));
|
||||
mUndoStack.push(new CSelectNodeCommand(mpSelection, pNode));
|
||||
mUndoStack.endMacro();
|
||||
}
|
||||
mUndoStack.push(new CSelectNodeCommand(mpSelection, pNode));
|
||||
}
|
||||
else if ((mpSelection->Size() == 1) && (mpSelection->Front() == pNode))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
mUndoStack.beginMacro(tr("Select"));
|
||||
mUndoStack.push(new CClearSelectionCommand(mpSelection));
|
||||
mUndoStack.push(new CSelectNodeCommand(mpSelection, pNode));
|
||||
mUndoStack.endMacro();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,11 +248,11 @@ void INodeEditor::EnterPickMode(FNodeFlags AllowedNodes, bool ExitOnInvalidPick,
|
|||
|
||||
void INodeEditor::ExitPickMode()
|
||||
{
|
||||
if (mPickMode)
|
||||
{
|
||||
mPickMode = false;
|
||||
emit PickModeExited();
|
||||
}
|
||||
if (!mPickMode)
|
||||
return;
|
||||
|
||||
mPickMode = false;
|
||||
emit PickModeExited();
|
||||
}
|
||||
|
||||
void INodeEditor::NotifySelectionTransformed()
|
||||
|
|
|
@ -60,10 +60,10 @@ public:
|
|||
|
||||
CScene* Scene();
|
||||
CGizmo* Gizmo();
|
||||
bool IsGizmoVisible();
|
||||
bool IsGizmoVisible() const;
|
||||
void BeginGizmoTransform();
|
||||
void EndGizmoTransform();
|
||||
ETransformSpace CurrentTransformSpace();
|
||||
ETransformSpace CurrentTransformSpace() const;
|
||||
|
||||
void SelectNode(CSceneNode *pNode);
|
||||
void BatchSelectNodes(QList<CSceneNode*> Nodes, bool ClearExistingSelection, const QString& rkCommandName = "Select");
|
||||
|
|
|
@ -237,7 +237,7 @@ void CResourceBrowser::SelectDirectory(CVirtualDirectory *pDir)
|
|||
void CResourceBrowser::CreateFilterCheckboxes()
|
||||
{
|
||||
// Delete existing checkboxes
|
||||
foreach (const SResourceType& rkType, mTypeList)
|
||||
for (const SResourceType& rkType : mTypeList)
|
||||
delete rkType.pFilterCheckBox;
|
||||
|
||||
mTypeList.clear();
|
||||
|
@ -257,12 +257,12 @@ void CResourceBrowser::CreateFilterCheckboxes()
|
|||
mTypeList << SResourceType { pType, pCheck };
|
||||
}
|
||||
|
||||
std::sort(mTypeList.begin(), mTypeList.end(), [](const SResourceType& rkLeft, const SResourceType& rkRight) -> bool {
|
||||
std::sort(mTypeList.begin(), mTypeList.end(), [](const SResourceType& rkLeft, const SResourceType& rkRight) {
|
||||
return rkLeft.pTypeInfo->TypeName().ToUpper() < rkRight.pTypeInfo->TypeName().ToUpper();
|
||||
});
|
||||
|
||||
// Add sorted checkboxes to the UI
|
||||
foreach (const SResourceType& rkType, mTypeList)
|
||||
for (const SResourceType& rkType : mTypeList)
|
||||
{
|
||||
QCheckBox *pCheck = rkType.pFilterCheckBox;
|
||||
mpFilterBoxesLayout->addWidget(rkType.pFilterCheckBox);
|
||||
|
@ -380,7 +380,7 @@ bool CResourceBrowser::MoveResources(const QList<CResourceEntry*>& rkResources,
|
|||
QList<CResourceEntry*> ConflictingResources;
|
||||
QList<CResourceEntry*> ValidResources;
|
||||
|
||||
foreach (CResourceEntry *pEntry, rkResources)
|
||||
for (CResourceEntry *pEntry : rkResources)
|
||||
{
|
||||
CResourceEntry *pConflict = pNewDir->FindChildResource(pEntry->Name(), pEntry->ResourceType());
|
||||
|
||||
|
@ -396,7 +396,7 @@ bool CResourceBrowser::MoveResources(const QList<CResourceEntry*>& rkResources,
|
|||
QList<CVirtualDirectory*> ConflictingDirs;
|
||||
QList<CVirtualDirectory*> ValidDirs;
|
||||
|
||||
foreach (CVirtualDirectory *pDir, rkDirectories)
|
||||
for (CVirtualDirectory *pDir : rkDirectories)
|
||||
{
|
||||
CVirtualDirectory *pConflict = pNewDir->FindChildDirectory(pDir->Name(), false);
|
||||
|
||||
|
@ -414,12 +414,12 @@ bool CResourceBrowser::MoveResources(const QList<CResourceEntry*>& rkResources,
|
|||
{
|
||||
QString ErrorMsg = tr("Failed to move; the destination directory has conflicting files.\n\n");
|
||||
|
||||
foreach (CVirtualDirectory *pDir, ConflictingDirs)
|
||||
for (const CVirtualDirectory *pDir : ConflictingDirs)
|
||||
{
|
||||
ErrorMsg += tr("* %1").arg(TO_QSTRING(pDir->Name()));
|
||||
}
|
||||
|
||||
foreach (CResourceEntry *pEntry, ConflictingResources)
|
||||
for (const CResourceEntry *pEntry : ConflictingResources)
|
||||
{
|
||||
ErrorMsg += tr("* %1.%2\n").arg(TO_QSTRING(pEntry->Name())).arg(TO_QSTRING(pEntry->CookedExtension().ToString()));
|
||||
}
|
||||
|
@ -434,10 +434,10 @@ bool CResourceBrowser::MoveResources(const QList<CResourceEntry*>& rkResources,
|
|||
mUndoStack.beginMacro(tr("Move Resources"));
|
||||
mUndoStack.push(new CSaveStoreCommand(mpStore));
|
||||
|
||||
foreach (CVirtualDirectory* pDir, ValidDirs)
|
||||
for (CVirtualDirectory* pDir : ValidDirs)
|
||||
mUndoStack.push(new CMoveDirectoryCommand(mpStore, pDir, pNewDir));
|
||||
|
||||
foreach (CResourceEntry* pEntry, ValidResources)
|
||||
for (CResourceEntry* pEntry : ValidResources)
|
||||
mUndoStack.push(new CMoveResourceCommand(pEntry, pNewDir));
|
||||
|
||||
mUndoStack.push(new CSaveStoreCommand(mpStore));
|
||||
|
@ -744,7 +744,7 @@ bool CResourceBrowser::Delete(QVector<CResourceEntry*> Resources, QVector<CVirtu
|
|||
mUndoStack.push(new CSaveStoreCommand(mpStore));
|
||||
|
||||
// Delete resources first.
|
||||
foreach (CResourceEntry* pEntry, Resources)
|
||||
for (CResourceEntry* pEntry : Resources)
|
||||
mUndoStack.push(new CDeleteResourceCommand(pEntry));
|
||||
|
||||
// Now delete directories in reverse order (so subdirectories delete first)
|
||||
|
@ -922,7 +922,7 @@ void CResourceBrowser::ImportPackageContentsList()
|
|||
|
||||
SetActiveDirectory(nullptr);
|
||||
|
||||
foreach(const QString& rkPath, PathList)
|
||||
for (const QString& rkPath : PathList)
|
||||
mpStore->ImportNamesFromPakContentsTxt(TO_TSTRING(rkPath), false);
|
||||
|
||||
RefreshResources();
|
||||
|
@ -1060,7 +1060,7 @@ void CResourceBrowser::OnFilterTypeBoxTicked(bool Checked)
|
|||
|
||||
else if (Checked)
|
||||
{
|
||||
foreach (const SResourceType& rkType, mTypeList)
|
||||
for (const SResourceType& rkType : mTypeList)
|
||||
{
|
||||
rkType.pFilterCheckBox->setChecked(false);
|
||||
mpProxyModel->SetTypeFilter(rkType.pTypeInfo, false);
|
||||
|
@ -1070,7 +1070,7 @@ void CResourceBrowser::OnFilterTypeBoxTicked(bool Checked)
|
|||
|
||||
else
|
||||
{
|
||||
foreach (const SResourceType& rkType, mTypeList)
|
||||
for (const SResourceType& rkType : mTypeList)
|
||||
{
|
||||
if (rkType.pFilterCheckBox == sender())
|
||||
{
|
||||
|
|
|
@ -214,7 +214,7 @@ void CResourceTableContextMenu::Delete()
|
|||
QVector<CResourceEntry*> Resources;
|
||||
QVector<CVirtualDirectory*> Directories;
|
||||
|
||||
foreach (const QModelIndex& kIndex, mSelectedIndexes)
|
||||
for (const QModelIndex& kIndex : mSelectedIndexes)
|
||||
{
|
||||
if (mpModel->IsIndexDirectory(kIndex))
|
||||
Directories << mpModel->IndexDirectory(kIndex);
|
||||
|
|
|
@ -96,7 +96,7 @@ bool CResourceTableModel::canDropMimeData(const QMimeData *pkData, Qt::DropActio
|
|||
if (pDir)
|
||||
{
|
||||
// Make sure this directory isn't part of the mime data, or a subdirectory of a directory in the mime data
|
||||
foreach (CVirtualDirectory *pMimeDir, pkMimeData->Directories())
|
||||
for (CVirtualDirectory *pMimeDir : pkMimeData->Directories())
|
||||
{
|
||||
if (pDir == pMimeDir || pDir->IsDescendantOf(pMimeDir))
|
||||
return false;
|
||||
|
@ -132,13 +132,15 @@ QMimeData* CResourceTableModel::mimeData(const QModelIndexList& rkIndexes) const
|
|||
QList<CResourceEntry*> Resources;
|
||||
QList<CVirtualDirectory*> Dirs;
|
||||
|
||||
foreach(QModelIndex Index, rkIndexes)
|
||||
for (const QModelIndex Index : rkIndexes)
|
||||
{
|
||||
CResourceEntry *pEntry = IndexEntry(Index);
|
||||
CVirtualDirectory *pDir = IndexDirectory(Index);
|
||||
|
||||
if (pEntry) Resources << pEntry;
|
||||
else Dirs << pDir;
|
||||
if (pEntry)
|
||||
Resources << pEntry;
|
||||
else
|
||||
Dirs << pDir;
|
||||
}
|
||||
|
||||
return new CResourceMimeData(Resources, Dirs);
|
||||
|
|
|
@ -47,9 +47,9 @@ void CResourceTableView::DeleteSelected()
|
|||
QVector<CResourceEntry*> ResourcesToDelete;
|
||||
QVector<CVirtualDirectory*> DirsToDelete;
|
||||
|
||||
foreach (QModelIndex Index, List)
|
||||
for (const QModelIndex Index : List)
|
||||
{
|
||||
QModelIndex SourceIndex = pProxy->mapToSource(Index);
|
||||
const QModelIndex SourceIndex = pProxy->mapToSource(Index);
|
||||
|
||||
if (pModel->IsIndexDirectory(SourceIndex))
|
||||
DirsToDelete << pModel->IndexDirectory(SourceIndex);
|
||||
|
|
|
@ -138,7 +138,7 @@ bool CVirtualDirectoryModel::canDropMimeData(const QMimeData *pkData, Qt::DropAc
|
|||
if (pkMimeData)
|
||||
{
|
||||
// Don't allow moving a directory into one of its children
|
||||
foreach (CVirtualDirectory *pMoveDir, pkMimeData->Directories())
|
||||
for (CVirtualDirectory *pMoveDir : pkMimeData->Directories())
|
||||
{
|
||||
if (pDir->IsDescendantOf(pMoveDir))
|
||||
return false;
|
||||
|
@ -222,7 +222,7 @@ QModelIndex CVirtualDirectoryModel::GetIndexForDirectory(CVirtualDirectory *pDir
|
|||
// Traverse hierarchy
|
||||
QModelIndex Out = index(0, 0, QModelIndex());
|
||||
|
||||
foreach (int Idx, Indices)
|
||||
for (const int Idx : Indices)
|
||||
Out = index(Idx, 0, Out);
|
||||
|
||||
ASSERT(IndexDirectory(Out) == pOriginal);
|
||||
|
|
|
@ -5,7 +5,7 @@ CChangeLayerCommand::CChangeLayerCommand(CWorldEditor *pEditor, const QList<CScr
|
|||
, mpNewLayer(pNewLayer)
|
||||
, mpEditor(pEditor)
|
||||
{
|
||||
foreach (CScriptNode *pNode, rkNodeList)
|
||||
for (CScriptNode *pNode : rkNodeList)
|
||||
{
|
||||
CScriptLayer *pLayer = pNode->Instance()->Layer();
|
||||
|
||||
|
@ -23,9 +23,10 @@ void CChangeLayerCommand::undo()
|
|||
QList<CSceneNode*> Nodes = mNodes.DereferenceList();
|
||||
|
||||
QList<CScriptNode*> ScriptNodes;
|
||||
foreach (CSceneNode *pNode, Nodes) ScriptNodes << static_cast<CScriptNode*>(pNode);
|
||||
for (CSceneNode* pNode : Nodes)
|
||||
ScriptNodes << static_cast<CScriptNode*>(pNode);
|
||||
|
||||
foreach (CScriptNode *pNode, ScriptNodes)
|
||||
for (CScriptNode *pNode : ScriptNodes)
|
||||
pNode->Instance()->SetLayer(mOldLayers[pNode->ID()]);
|
||||
|
||||
mpEditor->InstancesLayerChanged(ScriptNodes);
|
||||
|
@ -37,9 +38,10 @@ void CChangeLayerCommand::redo()
|
|||
QList<CSceneNode*> Nodes = mNodes.DereferenceList();
|
||||
|
||||
QList<CScriptNode*> ScriptNodes;
|
||||
foreach (CSceneNode *pNode, Nodes) ScriptNodes << static_cast<CScriptNode*>(pNode);
|
||||
for (CSceneNode* pNode : Nodes)
|
||||
ScriptNodes << static_cast<CScriptNode*>(pNode);
|
||||
|
||||
foreach (CScriptNode *pNode, ScriptNodes)
|
||||
for (CScriptNode *pNode : ScriptNodes)
|
||||
pNode->Instance()->SetLayer(mpNewLayer);
|
||||
|
||||
mpEditor->InstancesLayerChanged(ScriptNodes);
|
||||
|
|
|
@ -33,7 +33,7 @@ void CCloneSelectionCommand::undo()
|
|||
QList<CSceneNode*> ClonedNodes = mClonedNodes.DereferenceList();
|
||||
mpEditor->Selection()->Clear();
|
||||
|
||||
foreach (CSceneNode *pNode, ClonedNodes)
|
||||
for (CSceneNode *pNode : ClonedNodes)
|
||||
{
|
||||
CScriptObject *pInst = static_cast<CScriptNode*>(pNode)->Instance();
|
||||
|
||||
|
@ -56,7 +56,7 @@ void CCloneSelectionCommand::redo()
|
|||
QList<uint32> ClonedInstanceIDs;
|
||||
|
||||
// Clone nodes
|
||||
foreach (CSceneNode *pNode, ToClone)
|
||||
for (CSceneNode *pNode : ToClone)
|
||||
{
|
||||
mpEditor->NotifyNodeAboutToBeSpawned();
|
||||
CScriptNode *pScript = static_cast<CScriptNode*>(pNode);
|
||||
|
@ -101,7 +101,7 @@ void CCloneSelectionCommand::redo()
|
|||
}
|
||||
|
||||
// Call LoadFinished
|
||||
foreach (CSceneNode *pNode, ClonedNodes)
|
||||
for (CSceneNode *pNode : ClonedNodes)
|
||||
pNode->OnLoadFinished();
|
||||
|
||||
mpEditor->OnLinksModified(mLinkedInstances.DereferenceList());
|
||||
|
|
|
@ -75,7 +75,7 @@ CDeleteSelectionCommand::CDeleteSelectionCommand(CWorldEditor *pEditor, const QS
|
|||
// Remove selected objects from the linked instances list.
|
||||
LinkedInstances.removeAll(nullptr);
|
||||
|
||||
foreach (CScriptObject *pInst, LinkedInstances)
|
||||
for (CScriptObject *pInst : LinkedInstances)
|
||||
{
|
||||
if (mpEditor->Scene()->NodeForInstance(pInst)->IsSelected())
|
||||
LinkedInstances.removeOne(pInst);
|
||||
|
@ -144,7 +144,7 @@ void CDeleteSelectionCommand::undo()
|
|||
}
|
||||
|
||||
// Run OnLoadFinished
|
||||
foreach (CSceneNode *pNode, NewNodes)
|
||||
for (CSceneNode *pNode : NewNodes)
|
||||
pNode->OnLoadFinished();
|
||||
|
||||
// Add selection and done
|
||||
|
|
|
@ -25,7 +25,7 @@ void CPasteNodesCommand::undo()
|
|||
mpEditor->Selection()->SetSelectedNodes(mOriginalSelection.DereferenceList());
|
||||
QList<CSceneNode*> PastedNodes = mPastedNodes.DereferenceList();
|
||||
|
||||
foreach (CSceneNode *pNode, PastedNodes)
|
||||
for (CSceneNode *pNode : PastedNodes)
|
||||
{
|
||||
CScriptObject *pInst = (pNode->NodeType() == ENodeType::Script ? static_cast<CScriptNode*>(pNode)->Instance() : nullptr);
|
||||
mpEditor->NotifyNodeAboutToBeDeleted(pNode);
|
||||
|
@ -41,14 +41,15 @@ void CPasteNodesCommand::undo()
|
|||
|
||||
void CPasteNodesCommand::redo()
|
||||
{
|
||||
if (!mpMimeData) return;
|
||||
if (!mpMimeData)
|
||||
return;
|
||||
|
||||
const QVector<CNodeCopyMimeData::SCopiedNode>& rkNodes = mpMimeData->CopiedNodes();
|
||||
CScene *pScene = mpEditor->Scene();
|
||||
CGameArea *pArea = mpEditor->ActiveArea();
|
||||
QList<CSceneNode*> PastedNodes;
|
||||
|
||||
foreach (const CNodeCopyMimeData::SCopiedNode& rkNode, rkNodes)
|
||||
for (const CNodeCopyMimeData::SCopiedNode& rkNode : rkNodes)
|
||||
{
|
||||
CSceneNode *pNewNode = nullptr;
|
||||
|
||||
|
@ -87,7 +88,7 @@ void CPasteNodesCommand::redo()
|
|||
// 1. If the link receiver has also been copied then redirect to the copied version.
|
||||
// 2. If we're pasting into the same area that this data was copied from and the receiver still exists, connect to original receiver.
|
||||
// 3. If neither of those things is true, then delete the link.
|
||||
foreach (CSceneNode *pNode, PastedNodes)
|
||||
for (CSceneNode *pNode : PastedNodes)
|
||||
{
|
||||
if (pNode && pNode->NodeType() == ENodeType::Script)
|
||||
{
|
||||
|
@ -126,7 +127,7 @@ void CPasteNodesCommand::redo()
|
|||
// Call PostLoad on all new nodes and select them
|
||||
PastedNodes.removeAll(nullptr);
|
||||
|
||||
foreach (CSceneNode *pNode, PastedNodes)
|
||||
for (CSceneNode *pNode : PastedNodes)
|
||||
pNode->OnLoadFinished();
|
||||
|
||||
mpEditor->Selection()->SetSelectedNodes(PastedNodes);
|
||||
|
|
|
@ -21,7 +21,7 @@ CRotateNodeCommand::CRotateNodeCommand(
|
|||
{
|
||||
mNodeList.reserve(rkNodes.size());
|
||||
|
||||
foreach (CSceneNode *pNode, rkNodes)
|
||||
for (CSceneNode *pNode : rkNodes)
|
||||
{
|
||||
SNodeRotate Rotate;
|
||||
Rotate.pNode = pNode;
|
||||
|
@ -83,7 +83,7 @@ void CRotateNodeCommand::undo()
|
|||
{
|
||||
if (!mpEditor) return;
|
||||
|
||||
foreach (SNodeRotate Rotate, mNodeList)
|
||||
for (SNodeRotate& Rotate : mNodeList)
|
||||
{
|
||||
Rotate.pNode->SetPosition(Rotate.InitialPos);
|
||||
Rotate.pNode->SetRotation(Rotate.InitialRot);
|
||||
|
@ -97,7 +97,7 @@ void CRotateNodeCommand::redo()
|
|||
{
|
||||
if (!mpEditor) return;
|
||||
|
||||
foreach (SNodeRotate Rotate, mNodeList)
|
||||
for (SNodeRotate& Rotate : mNodeList)
|
||||
{
|
||||
Rotate.pNode->SetPosition(Rotate.NewPos);
|
||||
Rotate.pNode->SetRotation(Rotate.NewRot);
|
||||
|
|
|
@ -13,7 +13,7 @@ CScaleNodeCommand::CScaleNodeCommand(INodeEditor *pEditor, const QList<CSceneNod
|
|||
{
|
||||
mNodeList.reserve(rkNodes.size());
|
||||
|
||||
foreach (CSceneNode *pNode, rkNodes)
|
||||
for (CSceneNode *pNode : rkNodes)
|
||||
{
|
||||
SNodeScale Scale;
|
||||
Scale.pNode = pNode;
|
||||
|
@ -74,9 +74,10 @@ bool CScaleNodeCommand::mergeWith(const QUndoCommand *pkOther)
|
|||
|
||||
void CScaleNodeCommand::undo()
|
||||
{
|
||||
if (!mpEditor) return;
|
||||
if (!mpEditor)
|
||||
return;
|
||||
|
||||
foreach (SNodeScale Scale, mNodeList)
|
||||
for (SNodeScale& Scale : mNodeList)
|
||||
{
|
||||
Scale.pNode->SetPosition(Scale.InitialPos);
|
||||
Scale.pNode->SetScale(Scale.InitialScale);
|
||||
|
@ -88,9 +89,10 @@ void CScaleNodeCommand::undo()
|
|||
|
||||
void CScaleNodeCommand::redo()
|
||||
{
|
||||
if (!mpEditor) return;
|
||||
if (!mpEditor)
|
||||
return;
|
||||
|
||||
foreach (SNodeScale Scale, mNodeList)
|
||||
for (SNodeScale& Scale : mNodeList)
|
||||
{
|
||||
Scale.pNode->SetPosition(Scale.NewPos);
|
||||
Scale.pNode->SetScale(Scale.NewScale);
|
||||
|
|
|
@ -13,7 +13,7 @@ CTranslateNodeCommand::CTranslateNodeCommand(INodeEditor *pEditor, const QList<C
|
|||
{
|
||||
mNodeList.reserve(rkNodes.size());
|
||||
|
||||
foreach (CSceneNode *pNode, rkNodes)
|
||||
for (CSceneNode *pNode : rkNodes)
|
||||
{
|
||||
SNodeTranslate Translate;
|
||||
Translate.pNode = pNode;
|
||||
|
@ -59,9 +59,10 @@ bool CTranslateNodeCommand::mergeWith(const QUndoCommand *pkOther)
|
|||
|
||||
void CTranslateNodeCommand::undo()
|
||||
{
|
||||
if (!mpEditor) return;
|
||||
if (!mpEditor)
|
||||
return;
|
||||
|
||||
foreach (SNodeTranslate Translate, mNodeList)
|
||||
for (SNodeTranslate& Translate : mNodeList)
|
||||
Translate.pNode->SetPosition(Translate.InitialPos);
|
||||
|
||||
mpEditor->NotifySelectionTransformed();
|
||||
|
@ -70,9 +71,10 @@ void CTranslateNodeCommand::undo()
|
|||
|
||||
void CTranslateNodeCommand::redo()
|
||||
{
|
||||
if (!mpEditor) return;
|
||||
if (!mpEditor)
|
||||
return;
|
||||
|
||||
foreach (SNodeTranslate Translate, mNodeList)
|
||||
for (SNodeTranslate& Translate : mNodeList)
|
||||
Translate.pNode->SetPosition(Translate.NewPos);
|
||||
|
||||
mpEditor->NotifySelectionTransformed();
|
||||
|
|
|
@ -11,7 +11,7 @@ void IEditPropertyCommand::SaveObjectStateToArray(std::vector<char>& rVector)
|
|||
QVector<void*> DataPointers;
|
||||
GetObjectDataPointers(DataPointers);
|
||||
|
||||
foreach (void* pData, DataPointers)
|
||||
for (void* pData : DataPointers)
|
||||
{
|
||||
mpProperty->SerializeValue(pData, Writer);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ void IEditPropertyCommand::RestoreObjectStateFromArray(std::vector<char>& rArray
|
|||
QVector<void*> DataPointers;
|
||||
GetObjectDataPointers(DataPointers);
|
||||
|
||||
foreach (void* pData, DataPointers)
|
||||
for (void* pData : DataPointers)
|
||||
{
|
||||
mpProperty->SerializeValue(pData, Reader);
|
||||
}
|
||||
|
|
|
@ -508,7 +508,7 @@ void CInstancesModel::InstancesLayerPreChange()
|
|||
void CInstancesModel::InstancesLayerPostChange(const QList<CScriptNode*>& rkInstanceList)
|
||||
{
|
||||
QList<CScriptObject*> InstanceList;
|
||||
foreach (CScriptNode *pNode, rkInstanceList)
|
||||
for (CScriptNode *pNode : rkInstanceList)
|
||||
InstanceList << pNode->Instance();
|
||||
|
||||
QModelIndex ScriptIdx = index(0, 0, QModelIndex());
|
||||
|
|
|
@ -126,7 +126,7 @@ public slots:
|
|||
{
|
||||
QModelIndexList SelectedIndices = mpListView->selectionModel()->selectedRows();
|
||||
|
||||
foreach (const QModelIndex& rkIndex, SelectedIndices)
|
||||
for (const QModelIndex& rkIndex : SelectedIndices)
|
||||
{
|
||||
QModelIndex SourceIndex = mModel.mapToSource(rkIndex);
|
||||
mSelection << mSourceModel.PoiForIndex(SourceIndex);
|
||||
|
|
|
@ -205,10 +205,10 @@ void CPoiMapSidebar::UpdateModelHighlights()
|
|||
}
|
||||
}
|
||||
|
||||
foreach (const QModelIndex& rkIndex, UnselectedIndices)
|
||||
for (const QModelIndex& rkIndex : UnselectedIndices)
|
||||
UnhighlightPoiModels(rkIndex);
|
||||
|
||||
foreach (const QModelIndex& rkIndex, SelectedIndices)
|
||||
for (const QModelIndex& rkIndex : SelectedIndices)
|
||||
HighlightPoiModels(rkIndex);
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ void CPoiMapSidebar::OnUnmapAllPressed()
|
|||
QModelIndex Index = GetSelectedRow();
|
||||
QList<CModelNode*> ModelList = mSourceModel.GetPoiMeshList(Index);
|
||||
|
||||
foreach (CModelNode *pModel, ModelList)
|
||||
for (CModelNode *pModel : ModelList)
|
||||
{
|
||||
mSourceModel.RemoveMapping(Index, pModel);
|
||||
RevertModelOverlay(pModel);
|
||||
|
@ -343,7 +343,7 @@ void CPoiMapSidebar::OnInstanceListButtonClicked()
|
|||
|
||||
if (!rkSelection.empty())
|
||||
{
|
||||
foreach (CScriptNode *pNode, rkSelection)
|
||||
for (CScriptNode *pNode : rkSelection)
|
||||
mSourceModel.AddPOI(pNode);
|
||||
|
||||
mModel.sort(0);
|
||||
|
|
|
@ -238,7 +238,7 @@ void CTemplateEditDialog::UpdateDescription(const TString& rkNewDesc)
|
|||
}
|
||||
|
||||
// Update equivalent properties with new description
|
||||
foreach (IProperty* pProperty, mEquivalentProperties)
|
||||
for (IProperty* pProperty : mEquivalentProperties)
|
||||
{
|
||||
pProperty->SetDescription(rkNewDesc);
|
||||
}
|
||||
|
|
|
@ -557,7 +557,7 @@ void CWorldEditor::OnActiveProjectChanged(CGameProject *pProj)
|
|||
|
||||
void CWorldEditor::OnLinksModified(const QList<CScriptObject*>& rkInstances)
|
||||
{
|
||||
foreach (CScriptObject *pInstance, rkInstances)
|
||||
for (CScriptObject *pInstance : rkInstances)
|
||||
{
|
||||
CScriptNode *pNode = mScene.NodeForInstance(pInstance);
|
||||
pNode->LinksModified();
|
||||
|
@ -665,7 +665,7 @@ void CWorldEditor::SetSelectionActive(bool Active)
|
|||
|
||||
pCommand->SaveOldData();
|
||||
|
||||
foreach (CScriptObject* pInstance, CommandObjects)
|
||||
for (CScriptObject* pInstance : CommandObjects)
|
||||
pInstance->SetActive(Active);
|
||||
|
||||
pCommand->SaveNewData();
|
||||
|
@ -736,7 +736,7 @@ void CWorldEditor::UpdateOpenRecentActions()
|
|||
}
|
||||
|
||||
// Remove projects that don't exist anymore
|
||||
foreach (const QString& rkProj, RecentProjectsList)
|
||||
for (const QString& rkProj : RecentProjectsList)
|
||||
{
|
||||
if (!FileUtil::Exists( TO_TSTRING(rkProj) ) || rkProj.contains('\\') )
|
||||
RecentProjectsList.removeAll(rkProj);
|
||||
|
@ -1114,7 +1114,7 @@ void CWorldEditor::OnUnlinkClicked()
|
|||
bool UnlinkIncoming = (Dialog.UserChoice() != CConfirmUnlinkDialog::EChoice::OutgoingOnly);
|
||||
bool UnlinkOutgoing = (Dialog.UserChoice() != CConfirmUnlinkDialog::EChoice::IncomingOnly);
|
||||
|
||||
foreach (CScriptNode *pNode, SelectedScriptNodes)
|
||||
for (CScriptNode *pNode : SelectedScriptNodes)
|
||||
{
|
||||
CScriptObject *pInst = pNode->Instance();
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ void CWorldTreeModel::OnProjectChanged(CGameProject *pProj)
|
|||
pProj->GetWorldList(WorldIDs);
|
||||
QList<CAssetID> QWorldIDs = QList<CAssetID>::fromStdList(WorldIDs);
|
||||
|
||||
foreach (const CAssetID& rkID, QWorldIDs)
|
||||
for (const CAssetID& rkID : QWorldIDs)
|
||||
{
|
||||
CResourceEntry *pEntry = pProj->ResourceStore()->FindEntry(rkID);
|
||||
|
||||
|
|
Loading…
Reference in New Issue