Clang/Clazy pass over AzCore (#5045)
* Multiple cleanups ( tidy etc. ) Coalesce nested namespaces. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Multiple cleanups ( tidy etc. ) cntd. Converted Uuid into POD ( defaulted the constructor ) Add `&/const &` to `for` loops that benefit from their use Some Qt optimizations ( string ref, prevent container detaches, etc. ) Replace `::bind` in a few places. Replaced the use of AZ_CRC with AZ_CRC_CE in a few places. Replace a few `typedef`s with `using`s Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Linux compilation fix. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Apply review suggestions. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix vs2019 build Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Small clang re-format in StringFunc.cpp Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Apply reviewer's suggestions. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
This commit is contained in:
@@ -10,24 +10,21 @@
|
||||
|
||||
#include "AnimationBipedBoneNames.h"
|
||||
|
||||
namespace EditorAnimationBones
|
||||
namespace EditorAnimationBones::Biped
|
||||
{
|
||||
namespace Biped
|
||||
{
|
||||
const char* Pelvis = "Bip01 Pelvis";
|
||||
const char* Head = "Bip01 Head";
|
||||
const char* Weapon = "weapon_bone";
|
||||
const char* Pelvis = "Bip01 Pelvis";
|
||||
const char* Head = "Bip01 Head";
|
||||
const char* Weapon = "weapon_bone";
|
||||
|
||||
const char* LeftEye = "eye_bone_left";
|
||||
const char* RightEye = "eye_bone_right";
|
||||
const char* LeftEye = "eye_bone_left";
|
||||
const char* RightEye = "eye_bone_right";
|
||||
|
||||
const char* Spine[5] = { "Bip01 Spine", "Bip01 Spine1", "Bip01 Spine2", "Bip01 Spine3", "Bip01 Spine4" };
|
||||
const char* Neck[2] = { "Bip01 Neck", "Bip01 Neck1" };
|
||||
const char* Spine[5] = { "Bip01 Spine", "Bip01 Spine1", "Bip01 Spine2", "Bip01 Spine3", "Bip01 Spine4" };
|
||||
const char* Neck[2] = { "Bip01 Neck", "Bip01 Neck1" };
|
||||
|
||||
const char* LeftHeel = "Bip01 L Heel";
|
||||
const char* LeftToe[2] = { "Bip01 L Toe0", "Bip01 L Toe1" };
|
||||
const char* LeftHeel = "Bip01 L Heel";
|
||||
const char* LeftToe[2] = { "Bip01 L Toe0", "Bip01 L Toe1" };
|
||||
|
||||
const char* RightHeel = "Bip01 R Heel";
|
||||
const char* RightToe[2] = { "Bip01 R Toe0", "Bip01 R Toe1" };
|
||||
}
|
||||
}
|
||||
const char* RightHeel = "Bip01 R Heel";
|
||||
const char* RightToe[2] = { "Bip01 R Toe0", "Bip01 R Toe1" };
|
||||
} // namespace EditorAnimationBones::Biped
|
||||
|
||||
@@ -140,7 +140,7 @@ bool AssetImporterManager::OnBrowseFiles()
|
||||
bool encounteredCrate = false;
|
||||
QStringList invalidFiles;
|
||||
|
||||
for (QString path : fileDialog.selectedFiles())
|
||||
for (const QString& path : fileDialog.selectedFiles())
|
||||
{
|
||||
QString fileName = GetFileName(path);
|
||||
QFileInfo info(path);
|
||||
|
||||
@@ -671,7 +671,7 @@ AzToolsFramework::PropertyRowWidget* ReflectedPropertyControl::FindPropertyRowWi
|
||||
return nullptr;
|
||||
}
|
||||
const AzToolsFramework::ReflectedPropertyEditor::WidgetList& widgets = m_editor->GetWidgets();
|
||||
for (auto instance : widgets)
|
||||
for (const auto& instance : widgets)
|
||||
{
|
||||
if (instance.second->label() == item->GetPropertyName())
|
||||
{
|
||||
|
||||
@@ -40,10 +40,10 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
namespace
|
||||
{
|
||||
// File name extension for python files
|
||||
const QString s_kPythonFileNameSpec = "*.py";
|
||||
const QString s_kPythonFileNameSpec("*.py");
|
||||
|
||||
// Tree root element name
|
||||
const QString s_kRootElementName = "Python Scripts";
|
||||
const QString s_kRootElementName("Python Scripts");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1649,7 +1649,7 @@ QString CBaseObject::GetTypeName() const
|
||||
}
|
||||
|
||||
QString name;
|
||||
name.append(className.mid(0, className.length() - subClassName.length()));
|
||||
name.append(className.midRef(0, className.length() - subClassName.length()));
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -592,11 +592,11 @@ void CEntityObject::AdjustLightProperties(CVarBlockPtr& properties, const char*
|
||||
if (IVariable* pCastShadowVarLegacy = FindVariableInSubBlock(properties, pSubBlockVar, "bCastShadow"))
|
||||
{
|
||||
pCastShadowVarLegacy->SetFlags(pCastShadowVarLegacy->GetFlags() | IVariable::UI_INVISIBLE);
|
||||
|
||||
if (pCastShadowVarLegacy->GetDisplayValue()[0] != '0')
|
||||
const QString zeroPrefix("0");
|
||||
if (!pCastShadowVarLegacy->GetDisplayValue().startsWith(zeroPrefix))
|
||||
{
|
||||
bCastShadowLegacy = true;
|
||||
pCastShadowVarLegacy->SetDisplayValue("0");
|
||||
pCastShadowVarLegacy->SetDisplayValue(zeroPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -828,7 +828,7 @@ void CObjectManager::ShowLastHiddenObject()
|
||||
{
|
||||
uint64 mostRecentID = CBaseObject::s_invalidHiddenID;
|
||||
CBaseObject* mostRecentObject = nullptr;
|
||||
for (auto it : m_objects)
|
||||
for (const auto& it : m_objects)
|
||||
{
|
||||
CBaseObject* obj = it.second;
|
||||
|
||||
|
||||
@@ -2640,7 +2640,7 @@ QSize OutlinerItemDelegate::sizeHint(const QStyleOptionViewItem& option, const Q
|
||||
m_cachedBoundingRectOfTallCharacter = QRect();
|
||||
};
|
||||
|
||||
QTimer::singleShot(0, resetFunction);
|
||||
QTimer::singleShot(0, this, resetFunction);
|
||||
}
|
||||
|
||||
// And add 8 to it gives the outliner roughly the visible spacing we're looking for.
|
||||
|
||||
@@ -121,6 +121,18 @@ namespace
|
||||
SortEntityChildrenRecursively(childId, comparer);
|
||||
}
|
||||
}
|
||||
|
||||
QModelIndex nextIndexForTree(bool direction, OutlinerTreeView *tree, QModelIndex current)
|
||||
{
|
||||
if (direction)
|
||||
{
|
||||
return tree->indexAbove(current);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tree->indexBelow(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OutlinerWidget::OutlinerWidget(QWidget* pParent, Qt::WindowFlags flags)
|
||||
@@ -891,9 +903,7 @@ void OutlinerWidget::DoSelectSliceRootNextToSelection(bool isTraversalUpwards)
|
||||
return;
|
||||
}
|
||||
|
||||
AZStd::function<QModelIndex(QModelIndex)> getNextIdxFunction =
|
||||
AZStd::bind(isTraversalUpwards ? &QTreeView::indexAbove : &QTreeView::indexBelow, treeView, AZStd::placeholders::_1);
|
||||
QModelIndex nextIdx = getNextIdxFunction(currentIdx);
|
||||
QModelIndex nextIdx = nextIndexForTree(isTraversalUpwards,treeView,currentIdx);
|
||||
bool foundSliceRoot = false;
|
||||
|
||||
while (nextIdx.isValid() && !foundSliceRoot)
|
||||
@@ -904,7 +914,7 @@ void OutlinerWidget::DoSelectSliceRootNextToSelection(bool isTraversalUpwards)
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
foundSliceRoot, &AzToolsFramework::ToolsApplicationRequests::IsSliceRootEntity, currentEntityId);
|
||||
|
||||
nextIdx = getNextIdxFunction(currentIdx);
|
||||
nextIdx = nextIndexForTree(isTraversalUpwards, treeView, currentIdx);
|
||||
}
|
||||
|
||||
if (foundSliceRoot)
|
||||
@@ -934,13 +944,10 @@ void OutlinerWidget::DoSelectEdgeSliceRoot(bool shouldSelectTopMostSlice)
|
||||
}
|
||||
|
||||
QModelIndex currentIdx;
|
||||
AZStd::function<QModelIndex(QModelIndex)> getNextIdxFunction;
|
||||
|
||||
if (shouldSelectTopMostSlice)
|
||||
{
|
||||
currentIdx = itemModel->index(0, OutlinerListModel::ColumnName);
|
||||
|
||||
getNextIdxFunction =
|
||||
AZStd::bind(&QTreeView::indexBelow, treeView, AZStd::placeholders::_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -949,9 +956,6 @@ void OutlinerWidget::DoSelectEdgeSliceRoot(bool shouldSelectTopMostSlice)
|
||||
{
|
||||
currentIdx = itemModel->index(itemModel->rowCount(currentIdx) - 1, OutlinerListModel::ColumnName, currentIdx);
|
||||
}
|
||||
|
||||
getNextIdxFunction =
|
||||
AZStd::bind(&QTreeView::indexAbove, treeView, AZStd::placeholders::_1);
|
||||
}
|
||||
|
||||
QModelIndex nextIdx = currentIdx;
|
||||
@@ -964,7 +968,7 @@ void OutlinerWidget::DoSelectEdgeSliceRoot(bool shouldSelectTopMostSlice)
|
||||
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
foundSliceRoot, &AzToolsFramework::ToolsApplicationRequests::IsSliceRootEntity, currentEntityId);
|
||||
nextIdx = getNextIdxFunction(currentIdx);
|
||||
nextIdx = nextIndexForTree(shouldSelectTopMostSlice,treeView,currentIdx);
|
||||
} while (nextIdx.isValid() && !foundSliceRoot);
|
||||
|
||||
if (foundSliceRoot)
|
||||
@@ -1416,7 +1420,10 @@ void OutlinerWidget::SortContent()
|
||||
}
|
||||
m_entitiesToSort.clear();
|
||||
|
||||
auto comparer = AZStd::bind(&CompareEntitiesForSorting, AZStd::placeholders::_1, AZStd::placeholders::_2, m_sortMode);
|
||||
auto comparer = [sortMode = m_sortMode](AZ::EntityId left, AZ::EntityId right) -> bool
|
||||
{
|
||||
return CompareEntitiesForSorting(left, right, sortMode);
|
||||
};
|
||||
for (const AZ::EntityId& entityId : parentsToSort)
|
||||
{
|
||||
SortEntityChildren(entityId, comparer);
|
||||
@@ -1433,7 +1440,10 @@ void OutlinerWidget::OnSortModeChanged(EntityOutliner::DisplaySortMode sortMode)
|
||||
if (sortMode != EntityOutliner::DisplaySortMode::Manually)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
auto comparer = AZStd::bind(&CompareEntitiesForSorting, AZStd::placeholders::_1, AZStd::placeholders::_2, sortMode);
|
||||
auto comparer = [sortMode = m_sortMode](AZ::EntityId left, AZ::EntityId right) -> bool
|
||||
{
|
||||
return CompareEntitiesForSorting(left, right, sortMode);
|
||||
};
|
||||
SortEntityChildrenRecursively(AZ::EntityId(), comparer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user