Merge branch 'development' of https://github.com/aws-lumberyard-dev/o3de into mnaumov/LYN-4539

Signed-off-by: Mikhail Naumov <mnaumov@amazon.com>
This commit is contained in:
Mikhail Naumov
2021-08-23 17:08:00 -07:00
1114 changed files with 12444 additions and 13129 deletions
+42 -38
View File
@@ -70,9 +70,9 @@ static void OnMenuGrid()
inline Vec3 SnapToSize(Vec3 v, double size)
{
Vec3 snapped;
snapped.x = floor((v.x / size) + 0.5) * size;
snapped.y = floor((v.y / size) + 0.5) * size;
snapped.z = floor((v.z / size) + 0.5) * size;
snapped.x = static_cast<f32>(floor((v.x / size) + 0.5) * size);
snapped.y = static_cast<f32>(floor((v.y / size) + 0.5) * size);
snapped.z = static_cast<f32>(floor((v.z / size) + 0.5) * size);
return snapped;
}
@@ -479,8 +479,8 @@ void Q2DViewport::SetZoom(float fZoomFactor, const QPoint& center)
SetZoomFactor(fZoomFactor);
// Calculate new offset to center zoom on mouse.
float x2 = center.x();
float y2 = m_rcClient.height() - center.y();
float x2 = static_cast<float>(center.x());
float y2 = static_cast<float>(m_rcClient.height() - center.y());
ofsx = -(x2 / s2 - x2 / s1 - ofsx);
ofsy = -(y2 / s2 - y2 / s1 - ofsy);
SetScrollOffset(ofsx, ofsy, true);
@@ -544,21 +544,21 @@ void Q2DViewport::Update()
QPoint Q2DViewport::WorldToView(const Vec3& wp) const
{
Vec3 sp = m_screenTM.TransformPoint(wp);
QPoint p = QPoint(sp.x, sp.y);
QPoint p = QPoint(static_cast<int>(sp.x), static_cast<int>(sp.y));
return p;
}
//////////////////////////////////////////////////////////////////////////
QPoint Q2DViewport::WorldToViewParticleEditor(const Vec3& wp, [[maybe_unused]] int width, [[maybe_unused]] int height) const //Eric@conffx implement for the children class of IDisplayViewport
{
Vec3 sp = m_screenTM.TransformPoint(wp);
QPoint p = QPoint(sp.x, sp.y);
QPoint p = QPoint(static_cast<int>(sp.x), static_cast<int>(sp.y));
return p;
}
//////////////////////////////////////////////////////////////////////////
Vec3 Q2DViewport::ViewToWorld(const QPoint& vp, [[maybe_unused]] bool* collideWithTerrain, [[maybe_unused]] bool onlyTerrain, [[maybe_unused]] bool bSkipVegetation, [[maybe_unused]] bool bTestRenderMesh, [[maybe_unused]] bool* collideWithObject) const
{
Vec3 wp = m_screenTM_Inverted.TransformPoint(Vec3(vp.x(), vp.y(), 0));
Vec3 wp = m_screenTM_Inverted.TransformPoint(Vec3(static_cast<f32>(vp.x()), static_cast<f32>(vp.y()), 0.0f));
switch (m_axis)
{
case VPA_XY:
@@ -694,10 +694,10 @@ void Q2DViewport::DrawGrid(DisplayContext& dc, bool bNoXNumbers)
Matrix34 viewTM = GetViewTM().GetInverted() * m_screenTM_Inverted;
Matrix34 viewTM_Inv = m_screenTM * GetViewTM();
Vec3 viewP0 = viewTM.TransformPoint(Vec3(0, 0, 0));
Vec3 viewP1 = viewTM.TransformPoint(Vec3(m_rcClient.width(), m_rcClient.height(), 0));
Vec3 viewP0 = viewTM.TransformPoint(Vec3(0.0f, 0.0f, 0.0f));
Vec3 viewP1 = viewTM.TransformPoint(Vec3(static_cast<f32>(m_rcClient.width()), static_cast<f32>(m_rcClient.height()), 0.0f));
Vec3 viewP_Text = viewTM.TransformPoint(Vec3(0, m_rcClient.height(), 0));
Vec3 viewP_Text = viewTM.TransformPoint(Vec3(0.0f, static_cast<f32>(m_rcClient.height()), 0.0f));
if (m_bShowMinorGridLines && (!m_bAutoAdjustGrids || pixelsPerGrid > 5))
{
@@ -806,8 +806,8 @@ void Q2DViewport::DrawGrid(DisplayContext& dc, bool bNoXNumbers)
{
Vec3 org = m_screenTM.TransformPoint(Vec3(0, 0, 0));
dc.SetColor(AXIS_GRID_COLOR);
dc.DrawLine(Vec3(org.x, 0, fZ), Vec3(org.x, height, fZ));
dc.DrawLine(Vec3(0, org.y, fZ), Vec3(width, org.y, fZ));
dc.DrawLine(Vec3(org.x, 0.0f, fZ), Vec3(org.x, static_cast<f32>(height), fZ));
dc.DrawLine(Vec3(0.0f, org.y, fZ), Vec3(static_cast<f32>(width), org.y, fZ));
}
//////////////////////////////////////////////////////////////////////////
}
@@ -860,18 +860,18 @@ void Q2DViewport::DrawAxis(DisplayContext& dc)
int height = m_rcClient.height();
int size = 25;
Vec3 pos(30, height - 15, 1);
Vec3 pos(30.0f, static_cast<f32>(height - 15), 1.0f);
dc.SetColor(colx.x, colx.y, colx.z, 1);
dc.DrawLine(pos, pos + Vec3(size, 0, 0));
dc.DrawLine(pos, pos + Vec3(static_cast<f32>(size), 0.0f, 0.0f));
dc.SetColor(coly.x, coly.y, coly.z, 1);
dc.DrawLine(pos, pos - Vec3(0, size, 0));
dc.SetColor(coly.x, coly.y, coly.z, 1.0f);
dc.DrawLine(pos, pos - Vec3(0.0f, static_cast<f32>(size), 0.0f));
dc.SetColor(m_colorAxisText);
pos.x -= 3;
pos.y -= 4;
pos.z = 2;
pos.x -= 3.0f;
pos.y -= 4.0f;
pos.z = 2.0f;
dc.Draw2dTextLabel(pos.x + size + 4, pos.y - 2, 1, xstr);
dc.Draw2dTextLabel(pos.x + 3, pos.y - size, 1, ystr);
dc.Draw2dTextLabel(pos.x - 5, pos.y + 5, 1, zstr);
@@ -910,10 +910,14 @@ void Q2DViewport::DrawSelection(DisplayContext& dc)
dc.SetColor(SELECTION_RECT_COLOR.x, SELECTION_RECT_COLOR.y, SELECTION_RECT_COLOR.z, 1);
QPoint p1(m_selectedRect.left(), m_selectedRect.top());
QPoint p2(m_selectedRect.right() + 1, m_selectedRect.bottom() +1);
dc.DrawLine(Vec3(p1.x(), p1.y(), 0), Vec3(p2.x(), p1.y(), 0));
dc.DrawLine(Vec3(p1.x(), p2.y(), 0), Vec3(p2.x(), p2.y(), 0));
dc.DrawLine(Vec3(p1.x(), p1.y(), 0), Vec3(p1.x(), p2.y(), 0));
dc.DrawLine(Vec3(p2.x(), p1.y(), 0), Vec3(p2.x(), p2.y(), 0));
dc.DrawLine(
Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p1.y()), 0.0f), Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p1.y()), 0.0f));
dc.DrawLine(
Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p2.y()), 0.0f), Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p2.y()), 0.0f));
dc.DrawLine(
Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p1.y()), 0.0f), Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p2.y()), 0.0f));
dc.DrawLine(
Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p1.y()), 0.0f), Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p2.y()), 0.0f));
}
}
@@ -1038,16 +1042,16 @@ AABB Q2DViewport::GetWorldBounds(const QPoint& pnt1, const QPoint& pnt2)
{
case VPA_XY:
case VPA_YX:
box.min.z = -maxSize;
box.max.z = maxSize;
box.min.z = static_cast<f32>(-maxSize);
box.max.z = static_cast<f32>(maxSize);
break;
case VPA_XZ:
box.min.y = -maxSize;
box.max.y = maxSize;
box.min.y = static_cast<f32>(-maxSize);
box.max.y = static_cast<f32>(maxSize);
break;
case VPA_YZ:
box.min.x = -maxSize;
box.max.x = maxSize;
box.min.x = static_cast<f32>(-maxSize);
box.max.x = static_cast<f32>(maxSize);
break;
}
return box;
@@ -1076,32 +1080,32 @@ void Q2DViewport::OnDragSelectRectangle(const QRect &rect, [[maybe_unused]] bool
switch (m_axis)
{
case VPA_XY:
box.min.z = -maxSize;
box.max.z = maxSize;
box.min.z = static_cast<f32>(-maxSize);
box.max.z = static_cast<f32>(maxSize);
w = box.max.x - box.min.x;
h = box.max.y - box.min.y;
sprintf_s(szNewStatusText, "X:%g Y:%g W:%g H:%g", org.x, org.y, w, h);
break;
case VPA_YX:
box.min.z = -maxSize;
box.max.z = maxSize;
box.min.z = static_cast<f32>(-maxSize);
box.max.z = static_cast<f32>(maxSize);
w = box.max.y - box.min.y;
h = box.max.x - box.min.x;
sprintf_s(szNewStatusText, "X:%g Y:%g W:%g H:%g", org.x, org.y, w, h);
break;
case VPA_XZ:
box.min.y = -maxSize;
box.max.y = maxSize;
box.min.y = static_cast<f32>(-maxSize);
box.max.y = static_cast<f32>(maxSize);
w = box.max.x - box.min.x;
h = box.max.z - box.min.z;
sprintf_s(szNewStatusText, "X:%g Z:%g W:%g H:%g", org.x, org.z, w, h);
break;
case VPA_YZ:
box.min.x = -maxSize;
box.max.x = maxSize;
box.min.x = static_cast<f32>(-maxSize);
box.max.x = static_cast<f32>(maxSize);
w = box.max.y - box.min.y;
h = box.max.z - box.min.z;
@@ -675,14 +675,14 @@ void AzAssetBrowserRequestHandler::OpenAssetInAssociatedEditor(const AZ::Data::A
firstValidOpener = &openerDetails;
}
// bind a callback such that when the menu item is clicked, it sets that as the opener to use.
menu.addAction(openerDetails.m_iconToUse, QObject::tr(openerDetails.m_displayText.c_str()), mainWindow, AZStd::bind(switchToOpener, &openerDetails));
menu.addAction(openerDetails.m_iconToUse, QObject::tr(openerDetails.m_displayText.c_str()), mainWindow, [switchToOpener, details = &openerDetails] { return switchToOpener(details); });
}
}
if (numValidOpeners > 1) // more than one option was added
{
menu.addSeparator();
menu.addAction(QObject::tr("Cancel"), AZStd::bind(switchToOpener, nullptr)); // just something to click on to avoid doing anything.
menu.addAction(QObject::tr("Cancel"), [switchToOpener] { return switchToOpener(nullptr); }); // just something to click on to avoid doing anything.
menu.exec(QCursor::pos());
}
else if (numValidOpeners == 1)
+2 -2
View File
@@ -43,7 +43,7 @@ public:
//evaluate size
XmlString xmlStr = m_undoCtx.node->getXML();
m_size = sizeof(CUndoBaseLibraryItem);
m_size += xmlStr.GetAllocatedMemory();
m_size += static_cast<int>(xmlStr.GetAllocatedMemory());
m_size += m_itemPath.length();
m_size += m_description.length();
}
@@ -87,7 +87,7 @@ protected:
libItem->Serialize(m_redoCtx);
XmlString xmlStr = m_redoCtx.node->getXML();
m_size += xmlStr.GetAllocatedMemory();
m_size += static_cast<int>(xmlStr.GetAllocatedMemory());
}
//load previous saved data
+1 -1
View File
@@ -73,7 +73,7 @@ public:
virtual IDataBaseLibrary* AddLibrary(const QString& library, bool bIsLevelLibrary = false, bool bIsLoading = true) override;
virtual void DeleteLibrary(const QString& library, bool forceDeleteLevel = false) override;
//! Get number of libraries.
virtual int GetLibraryCount() const override { return m_libs.size(); };
virtual int GetLibraryCount() const override { return static_cast<int>(m_libs.size()); };
//! Get number of modified libraries.
virtual int GetModifiedLibraryCount() const override;
+1
View File
@@ -242,6 +242,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
Legacy::CryCommon
AZ::AzToolsFramework
AZ::AzToolsFramework.Tests
AZ::AzFrameworkTestShared
AZ::AzToolsFrameworkTestCommon
Legacy::EditorLib
Gem::AtomToolsFramework.Static
+2 -2
View File
@@ -529,8 +529,8 @@ QString CEditorCommandManager::ExecuteAndLogReturn(CCommand* pCommand, const CCo
void CEditorCommandManager::GetArgsFromString(const AZStd::string& argsTxt, CCommand::CArgs& argList)
{
const char quoteSymbol = '\'';
int curPos = 0;
int prevPos = 0;
size_t curPos = 0;
size_t prevPos = 0;
AZStd::vector<AZStd::string> tokens;
AZ::StringFunc::Tokenize(argsTxt, tokens, ' ');
for(AZStd::string& arg : tokens)
+1 -1
View File
@@ -33,7 +33,7 @@ namespace Config
uint32 CConfigGroup::GetVarCount()
{
return m_vars.size();
return static_cast<uint32>(m_vars.size());
}
IConfigVar* CConfigGroup::GetVar(const char* szName)
+1 -6
View File
@@ -72,7 +72,7 @@ void CColorGradientCtrl::resizeEvent(QResizeEvent* event)
m_grid.rect = m_rcGradient;
if (m_bNoZoom)
{
m_grid.zoom.x = m_grid.rect.width();
m_grid.zoom.x = static_cast<f32>(m_grid.rect.width());
}
m_rcKeys = rc;
@@ -106,11 +106,6 @@ QPoint CColorGradientCtrl::KeyToPoint(int nKey)
QPoint CColorGradientCtrl::TimeToPoint(float time)
{
return QPoint(m_grid.WorldToClient(Vec2(time, 0)).x(), m_rcGradient.height() / 2);
QPoint point;
point.rx() = (time - m_fMinTime) * (m_rcGradient.width() / (m_fMaxTime - m_fMinTime)) + m_rcGradient.left();
point.ry() = m_rcGradient.height() / 2;
return point;
}
//////////////////////////////////////////////////////////////////////////
+6 -6
View File
@@ -220,7 +220,7 @@ void ConsoleLineEdit::keyPressEvent(QKeyEvent* ev)
}
// If a history command was reused directly via up arrow enter, do not reset history index
if (m_history.size() > 0 && m_historyIndex < m_history.size() && m_history[m_historyIndex] == str)
if (m_history.size() > 0 && m_historyIndex < static_cast<unsigned int>(m_history.size()) && m_history[m_historyIndex] == str)
{
m_bReusedHistory = true;
}
@@ -833,15 +833,15 @@ static void SetEditorRange(EditorType* editor, IVariable* var)
// If this variable has custom limits set, then use that as the min/max
// Otherwise, the min/max for the input box will be bounded by the type
// limit, but the slider will be constricted to a smaller default range
static const double defaultMin = -100.0f;
static const double defaultMax = 100.0f;
static const float defaultMin = -100.0f;
static const float defaultMax = 100.0f;
if (var->HasCustomLimits())
{
editor->setRange(min, max);
editor->setRange(static_cast<typename EditorType::value_type>(min), static_cast<typename EditorType::value_type>(max));
}
else
{
editor->setSoftRange(defaultMin, defaultMax);
editor->setSoftRange(static_cast<typename EditorType::value_type>(defaultMin), static_cast<typename EditorType::value_type>(defaultMax));
}
// Set the step size. The default variable step is 0, so if it's
@@ -850,7 +850,7 @@ static void SetEditorRange(EditorType* editor, IVariable* var)
// use that for the int values
if (step > 0)
{
editor->spinbox()->setSingleStep(step);
editor->spinbox()->setSingleStep(static_cast<int>(step));
}
else if (auto doubleSpinBox = qobject_cast<AzQtComponents::DoubleSpinBox*>(editor->spinbox()))
{
+12 -12
View File
@@ -175,7 +175,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
penSpikes = penColor;
painter.setPen(Qt::black);
painter.setBrush(Qt::white);
rcGraph = QRect(QPoint(m_graphMargin, m_graphMargin), QPoint(abs(rc.width() - m_graphMargin), abs(rc.height() * m_graphHeightPercent)));
rcGraph = QRect(QPoint(m_graphMargin, m_graphMargin), QPoint(abs(rc.width() - m_graphMargin), static_cast<int>(abs(rc.height() * m_graphHeightPercent))));
painter.drawRect(rcGraph);
painter.setPen(penSpikes);
@@ -193,7 +193,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
{
float scale = 0;
i = ((float)x / graphWidth) * (kNumColorLevels - 1);
i = static_cast<int>(((float)x / graphWidth) * (kNumColorLevels - 1));
i = CLAMP(i, 0, kNumColorLevels - 1);
switch (m_drawMode)
@@ -244,8 +244,8 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
}
}
crtX = rcGraph.left() + x + 1;
painter.drawLine(crtX, graphBottom, crtX, graphBottom - scale * graphHeight);
crtX = static_cast<int>(rcGraph.left() + x + 1);
painter.drawLine(crtX, graphBottom, crtX, static_cast<int>(graphBottom - scale * graphHeight));
}
}
else
@@ -258,9 +258,9 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x)
{
i = ((float)x / graphWidth) * (kNumColorLevels - 1);
i = static_cast<int>(((float)x / graphWidth) * (kNumColorLevels - 1));
i = CLAMP(i, 0, kNumColorLevels - 1);
crtX = rcGraph.left() + x + 1;
crtX = static_cast<UINT>(rcGraph.left() + x + 1);
scaleR = scaleG = scaleB = scaleA = 0;
if (m_maxCount[0])
@@ -283,10 +283,10 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
scaleA = (float)m_count[3][i] / m_maxCount[3];
}
heightR = graphBottom - scaleR * graphHeight;
heightG = graphBottom - scaleG * graphHeight;
heightB = graphBottom - scaleB * graphHeight;
heightA = graphBottom - scaleA * graphHeight;
heightR = static_cast<int>(graphBottom - scaleR * graphHeight);
heightG = static_cast<int>(graphBottom - scaleG * graphHeight);
heightB = static_cast<int>(graphBottom - scaleB * graphHeight);
heightA = static_cast<int>(graphBottom - scaleA * graphHeight);
if (lastHeight[0] == INT_MAX)
{
@@ -350,7 +350,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x)
{
pos = (float)x / graphWidth;
i = (float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels;
i = static_cast<int>((float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels);
i = CLAMP(i, 0, kNumColorLevels - 1);
scale = 0;
@@ -385,7 +385,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
}
painter.setPen(pPen);
painter.drawLine(rcGraph.left() + x + 1, graphBottom, rcGraph.left() + x + 1, graphBottom - scale * graphHeight);
painter.drawLine(rcGraph.left() + static_cast<int>(x) + 1, graphBottom, rcGraph.left() + static_cast<int>(x) + 1, static_cast<int>(graphBottom - scale * graphHeight));
}
// then draw 3 lines so we separate the channels
@@ -422,7 +422,7 @@ void QBitmapPreviewDialogImp::paintEvent(QPaintEvent* e)
curr_x = histogramRect.left() + x + 1;
int i = ((float)x / (graphWidth - 1)) * (CImageHistogram::kNumColorLevels - 1);
int i = static_cast<int>(((float)x / (graphWidth - 1)) * (CImageHistogram::kNumColorLevels - 1));
if (m_histrogramMode == eHistogramMode_SplitRGB)
{
// Filter out to area which we are interested
@@ -446,7 +446,7 @@ void QBitmapPreviewDialogImp::paintEvent(QPaintEvent* e)
scale = (float)m_histogram.m_count[c][i] / m_histogram.m_maxCount[c];
}
int height = graphBottom - graphHeight * scale;
int height = static_cast<int>(graphBottom - graphHeight * scale);
if (last_height == INT_MAX)
{
last_height = height;
@@ -56,8 +56,8 @@ CReflectedVarAnimation AnimationPropertyCtrl::value() const
void AnimationPropertyCtrl::OnApplyClicked()
{
QStringList cSelectedAnimations;
size_t nTotalAnimations(0);
size_t nCurrentAnimation(0);
int nTotalAnimations(0);
int nCurrentAnimation(0);
QString combinedString = GetIEditor()->GetResourceSelectorHost()->GetGlobalSelection("animation");
SplitString(combinedString, cSelectedAnimations, ',');
@@ -145,7 +145,7 @@ bool UserPopupWidgetHandler::ReadValuesIntoGUI(size_t index, UserPropertyEditor*
QWidget* FloatCurveHandler::CreateGUI(QWidget *pParent)
{
CSplineCtrl *cSpline = new CSplineCtrl(pParent);
cSpline->SetUpdateCallback(AZStd::bind(&FloatCurveHandler::OnSplineChange, this, AZStd::placeholders::_1));
cSpline->SetUpdateCallback([this](CSplineCtrl* spl) { OnSplineChange(spl); });
cSpline->SetTimeRange(0, 1);
cSpline->SetValueRange(0, 1);
cSpline->SetGrid(12, 12);
@@ -203,7 +203,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlo
outBlockPtr = new CVarBlock;
for (size_t i = 0, iGroupCount(node->getChildCount()); i < iGroupCount; ++i)
{
XmlNodeRef groupNode = node->getChild(i);
XmlNodeRef groupNode = node->getChild(static_cast<int>(i));
if (groupNode->haveAttr("hidden"))
{
@@ -308,7 +308,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlo
int nMin(0), nMax(0);
if (child->getAttr("min", nMin) && child->getAttr("max", nMax))
{
intVar->SetLimits(nMin, nMax);
intVar->SetLimits(static_cast<float>(nMin), static_cast<float>(nMax));
}
}
else if (!azstricmp(type, "float"))
@@ -560,7 +560,7 @@ void ReflectedPropertyControl::RequestPropertyContextMenu(AzToolsFramework::Inst
// Popup Menu with Event selection.
QMenu menu;
UINT i = 0;
unsigned int i = 0;
const int ePPA_CustomItemBase = 10; // reserved from 10 to 99
const int ePPA_CustomPopupBase = 100; // reserved from 100 to x*100+100 where x is size of m_customPopupMenuPopups
@@ -595,12 +595,12 @@ void ReflectedPropertyControl::RequestPropertyContextMenu(AzToolsFramework::Inst
action->setData(ePPA_CustomItemBase + i);
}
for (UINT j = 0; j < m_customPopupMenuPopups.size(); ++j)
for (unsigned int j = 0; j < m_customPopupMenuPopups.size(); ++j)
{
SCustomPopupMenu* pMenuInfo = &m_customPopupMenuPopups[j];
QMenu* pSubMenu = menu.addMenu(pMenuInfo->m_text);
for (UINT k = 0; k < pMenuInfo->m_subMenuText.size(); ++k)
for (UINT k = 0; k < static_cast<UINT>(pMenuInfo->m_subMenuText.size()); ++k)
{
const UINT uID = ePPA_CustomPopupBase + ePPA_CustomPopupBase * j + k;
QAction *action = pSubMenu->addAction(pMenuInfo->m_subMenuText[k]);
@@ -172,8 +172,8 @@ ReflectedPropertyItem::ReflectedPropertyItem(ReflectedPropertyControl *control,
if (parent)
parent->AddChild(this);
m_onSetCallback = AZStd::bind(&ReflectedPropertyItem::OnVariableChange, this, AZStd::placeholders::_1);
m_onSetEnumCallback = AZStd::bind(&ReflectedPropertyItem::OnVariableEnumChange, this, AZStd::placeholders::_1);
m_onSetCallback = [this](IVariable* var) { OnVariableChange(var); };
m_onSetEnumCallback = [this](IVariable* var) { OnVariableEnumChange(var); };
}
ReflectedPropertyItem::~ReflectedPropertyItem()
@@ -39,20 +39,20 @@ namespace {
hardMin = desc.m_bHardMin;
hardMax = desc.m_bHardMax;
}
reflectedVar->m_softMinVal = min;
reflectedVar->m_softMaxVal = max;
reflectedVar->m_softMinVal = static_cast<R>(min);
reflectedVar->m_softMaxVal = static_cast<R>(max);
if (hardMin)
{
reflectedVar->m_minVal = min;
reflectedVar->m_minVal = static_cast<R>(min);
}
else
{
reflectedVar->m_minVal = std::numeric_limits<int>::lowest();
reflectedVar->m_minVal = std::numeric_limits<R>::lowest();
}
if (hardMax)
{
reflectedVar->m_maxVal = max;
reflectedVar->m_maxVal = static_cast<R>(max);
}
else
{
@@ -64,9 +64,9 @@ namespace {
../Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp:59:38: error: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Werror,-Wimplicit-int-float-conversion]
reflectedVar->m_maxVal = std::numeric_limits<int>::max();
*/
reflectedVar->m_maxVal = static_cast<float>(std::numeric_limits<int>::max());
reflectedVar->m_maxVal = static_cast<R>(std::numeric_limits<int>::max());
}
reflectedVar->m_stepSize = step;
reflectedVar->m_stepSize = static_cast<R>(step);
}
}
@@ -95,9 +95,9 @@ void ReflectedVarIntAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
{
int intValue;
pVariable->Get(intValue);
value = intValue;
value = static_cast<float>(intValue);
}
m_reflectedVar->m_value = std::round(value * m_valueMultiplier);
m_reflectedVar->m_value = static_cast<int>(std::round(value * m_valueMultiplier));
}
void ReflectedVarIntAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
@@ -362,14 +362,14 @@ void ReflectedVarColorAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
Vec3 v(0, 0, 0);
pVariable->Get(v);
const QColor col = ColorLinearToGamma(ColorF(v.x, v.y, v.z));
m_reflectedVar->m_color.Set(col.redF(), col.greenF(), col.blueF());
m_reflectedVar->m_color.Set(static_cast<float>(col.redF()), static_cast<float>(col.greenF()), static_cast<float>(col.blueF()));
}
else
{
int col(0);
pVariable->Get(col);
const QColor qcolor = ColorToQColor((uint32)col);
m_reflectedVar->m_color.Set(qcolor.redF(), qcolor.greenF(), qcolor.blueF());
m_reflectedVar->m_color.Set(static_cast<float>(qcolor.redF()), static_cast<float>(qcolor.greenF()), static_cast<float>(qcolor.blueF()));
}
}
@@ -382,9 +382,9 @@ void ReflectedVarColorAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
}
else
{
int ir = m_reflectedVar->m_color.GetX() * 255.0f;
int ig = m_reflectedVar->m_color.GetY() * 255.0f;
int ib = m_reflectedVar->m_color.GetZ() * 255.0f;
int ir = static_cast<int>(m_reflectedVar->m_color.GetX() * 255.0f);
int ig = static_cast<int>(m_reflectedVar->m_color.GetY() * 255.0f);
int ib = static_cast<int>(m_reflectedVar->m_color.GetZ() * 255.0f);
pVariable->Set(static_cast<int>(RGB(ir, ig, ib)));
}
+2 -2
View File
@@ -86,13 +86,13 @@ QPoint CSplineCtrl::KeyToPoint(int nKey)
QPoint CSplineCtrl::TimeToPoint(float time)
{
QPoint point;
point.setX((time - m_fMinTime) * (m_rcSpline.width() / (m_fMaxTime - m_fMinTime)) + m_rcSpline.left());
point.setX(static_cast<int>((time - m_fMinTime) * (m_rcSpline.width() / (m_fMaxTime - m_fMinTime)) + m_rcSpline.left()));
float val = 0;
if (m_pSpline)
{
m_pSpline->InterpolateFloat(time, val);
}
point.setY((floor((m_fMaxValue - val) * (m_rcSpline.height() / (m_fMaxValue - m_fMinValue)) + 0.5f) + m_rcSpline.top()));
point.setY(static_cast<int>((floor((m_fMaxValue - val) * (m_rcSpline.height() / (m_fMaxValue - m_fMinValue)) + 0.5f) + m_rcSpline.top())));
return point;
}
+28 -28
View File
@@ -641,7 +641,7 @@ QPoint AbstractSplineWidget::TimeToPoint(float time, ISplineInterpolator* pSplin
//////////////////////////////////////////////////////////////////////////
float AbstractSplineWidget::TimeToXOfs(float x)
{
return WorldToClient(Vec2(float(x), 0.0f)).x();
return static_cast<float>(WorldToClient(Vec2(float(x), 0.0f)).x());
}
//////////////////////////////////////////////////////////////////////////
@@ -832,8 +832,8 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float
int nTotalNumberOfDimensions(0);
int nCurrentDimension(0);
int left = TimeToXOfs(startTime);//rcClip.left;
int right = TimeToXOfs(endTime);//rcClip.right;
int left = static_cast<int>(TimeToXOfs(startTime));//rcClip.left;
int right = static_cast<int>(TimeToXOfs(endTime));//rcClip.right;
QPoint p0 = TimeToPoint(pSpline->GetKeyTime(0), pSpline);
QPoint p1 = TimeToPoint(pSpline->GetKeyTime(pSpline->GetKeyCount() - 1), pSpline);
@@ -898,7 +898,7 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float
if ((x == right && pointsInLine >= 0) || (pointsInLine > 0 && fabs(lineStart.y() + gradient * (pt.x() - lineStart.x()) - pt.y()) > 1.0f))
{
lineStart = QPoint(pt.x() - 1, lineStart.y() + gradient * (pt.x() - 1 - lineStart.x()));
lineStart = QPoint(pt.x() - 1, static_cast<int>(lineStart.y() + gradient * (pt.x() - 1 - lineStart.x())));
path.lineTo(lineStart);
gradient = float(pt.y() - lineStart.y()) / (pt.x() - lineStart.x());
pointsInLine = 1;
@@ -1063,7 +1063,7 @@ void SplineWidget::DrawTimeMarker(QPainter* painter)
float x = TimeToXOfs(m_fTimeMarker);
if (x >= m_rcSpline.left() && x <= m_rcSpline.right() + 1)
{
painter->drawLine(x, m_rcSpline.top(), x, m_rcSpline.bottom() + 1);
painter->drawLine(static_cast<int>(x), m_rcSpline.top(), static_cast<int>(x), m_rcSpline.bottom() + 1);
}
painter->setPen(pOldPen);
}
@@ -1583,7 +1583,7 @@ bool AbstractSplineWidget::IsKeySelected(ISplineInterpolator* pSpline, int nKey,
int AbstractSplineWidget::GetNumSelected()
{
int nSelected = 0;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
if (ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline)
{
@@ -1818,7 +1818,7 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point
}
// For each Spline...
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
ISplineInterpolator* pDetailSpline = m_splines[splineIndex].pDetailSpline;
@@ -1856,7 +1856,7 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point
// Check tangent handles first.
{
QPoint incomingHandlePt, outgoingHandlePt, pt;
if (GetTangentHandlePts(incomingHandlePt, pt, outgoingHandlePt, splineIndex, i, nCurrentDimension))
if (GetTangentHandlePts(incomingHandlePt, pt, outgoingHandlePt, static_cast<int>(splineIndex), static_cast<int>(i), nCurrentDimension))
{
// For the incoming handle
if (abs(incomingHandlePt.x() - point.x()) < 4 && abs(incomingHandlePt.y() - point.y()) < 4)
@@ -1973,7 +1973,7 @@ void AbstractSplineWidget::ScaleAmplitudeKeys(float time, float startValue, floa
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2077,7 +2077,7 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT
float affectedRangeMin = FLT_MAX;
float affectedRangeMax = -FLT_MAX;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2145,8 +2145,8 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT
}
}
int rangeMin = TimeToXOfs(affectedRangeMin);
int rangeMax = TimeToXOfs(affectedRangeMax);
int rangeMin = static_cast<int>(TimeToXOfs(affectedRangeMin));
int rangeMax = static_cast<int>(TimeToXOfs(affectedRangeMax));
if (m_timeRange.start == affectedRangeMin)
{
@@ -2184,7 +2184,7 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue)
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2223,7 +2223,7 @@ void AbstractSplineWidget::MoveSelectedKeys(Vec2 offset, bool copyKeys)
}
// For each spline...
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2298,7 +2298,7 @@ void AbstractSplineWidget::RemoveSelectedKeys()
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2338,7 +2338,7 @@ void AbstractSplineWidget::RemoveSelectedKeyTimesImpl()
StoreUndo();
SendNotifyEvent(SPLN_BEFORE_CHANGE);
for (int splineIndex = 0, end = m_splines.size(); splineIndex < end; ++splineIndex)
for (size_t splineIndex = 0, end = m_splines.size(); splineIndex < end; ++splineIndex)
{
std::vector<KeyTime>::iterator itTime = m_keyTimes.begin(), endTime = m_keyTimes.end();
for (int keyIndex = 0, endIndex = m_splines[splineIndex].pSpline->GetKeyCount(); keyIndex < endIndex; )
@@ -2376,9 +2376,9 @@ void AbstractSplineWidget::RedrawWindowAroundMarker()
{
UpdateKeyTimes();
std::vector<KeyTime>::iterator itKeyTime = std::lower_bound(m_keyTimes.begin(), m_keyTimes.end(), KeyTime(m_fTimeMarker, 0));
int keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size());
int redrawRangeStart = (keyTimeIndex >= 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time) : m_rcSpline.left());
int redrawRangeEnd = (keyTimeIndex < int(m_keyTimes.size()) - 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time) : m_rcSpline.right() + 1);
size_t keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size());
int redrawRangeStart = (keyTimeIndex >= 2 ? static_cast<int>(TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time)) : m_rcSpline.left());
int redrawRangeEnd = (keyTimeIndex < m_keyTimes.size() - 2 ? static_cast<int>(TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time)) : m_rcSpline.right() + 1);
QRect rc(QPoint(redrawRangeStart, m_rcSpline.top()), QPoint(redrawRangeEnd, m_rcSpline.bottom() + 1) - QPoint(1, 1));
rc = rc.normalized().intersected(m_rcSpline);
@@ -2478,7 +2478,7 @@ void AbstractSplineWidget::ClearSelection()
{
ConditionalStoreUndo();
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2521,7 +2521,7 @@ void AbstractSplineWidget::StoreUndo()
if (CUndo::IsRecording() && !m_pCurrentUndo)
{
std::vector<ISplineInterpolator*> splines(m_splines.size());
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
splines[splineIndex] = m_splines[splineIndex].pSpline;
}
@@ -2564,7 +2564,7 @@ void AbstractSplineWidget::DuplicateSelectedKeys()
using KeysToAddContainer = std::vector<CKeyCopyInfo>;
KeysToAddContainer keysToInsert;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2664,7 +2664,7 @@ void AbstractSplineWidget::KeyAll()
//////////////////////////////////////////////////////////////////////////
void AbstractSplineWidget::SelectAll()
{
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2815,7 +2815,7 @@ void AbstractSplineWidget::SelectRectangle(const QRect& rc, bool bSelect)
{
std::swap(t0, t1);
}
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
ISplineInterpolator* pDetailSpline = m_splines[splineIndex].pDetailSpline;
@@ -3031,7 +3031,7 @@ void AbstractSplineWidget::ModifySelectedKeysFlags(int nRemoveFlags, int nAddFla
SendNotifyEvent(SPLN_BEFORE_CHANGE);
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -3188,7 +3188,7 @@ void AbstractSplineWidget::GotoNextKey(bool previousKey)
{
bool boFoundTheSelectedKey(false);
for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
for (int i = 0; i < pSpline->GetKeyCount(); i++)
@@ -3230,7 +3230,7 @@ void AbstractSplineWidget::GotoNextKey(bool previousKey)
}
else
{
for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -3281,7 +3281,7 @@ void AbstractSplineWidget::RemoveAllKeysButThis()
{
std::vector<int> keys;
for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
+1 -1
View File
@@ -98,7 +98,7 @@ public:
void AddSpline(ISplineInterpolator * pSpline, ISplineInterpolator * pDetailSpline, QColor anColorArray[4]);
void RemoveSpline(ISplineInterpolator* pSpline);
void RemoveAllSplines();
int GetSplineCount() const { return m_splines.size(); }
int GetSplineCount() const { return static_cast<int>(m_splines.size()); }
ISplineInterpolator* GetSpline(int nIndex) const { return m_splines[nIndex].pSpline; }
void SetTimeMarker(float fTime);
+1 -1
View File
@@ -53,7 +53,7 @@ void CTextEditorCtrl::LoadFile(const QString& sFileName)
size_t length = file.GetLength();
QByteArray text;
text.resize(length);
text.resize(static_cast<int>(length));
file.ReadRaw(text.data(), length);
setPlainText(text);
+7 -7
View File
@@ -25,9 +25,9 @@ static const QColor ltgrayCol = QColor(110, 110, 110);
QColor InterpolateColor(const QColor& c1, const QColor& c2, float fraction)
{
const int r = (c2.red() - c1.red()) * fraction + c1.red();
const int g = (c2.green() - c1.green()) * fraction + c1.green();
const int b = (c2.blue() - c1.blue()) * fraction + c1.blue();
const int r = static_cast<int>(static_cast<float>(c2.red() - c1.red()) * fraction + c1.red());
const int g = static_cast<int>(static_cast<float>(c2.green() - c1.green()) * fraction + c1.green());
const int b = static_cast<int>(static_cast<float>(c2.blue() - c1.blue()) * fraction + c1.blue());
return QColor(r, g, b);
}
@@ -120,7 +120,7 @@ float TimelineWidget::SnapTime(float time)
{
double t = floor((double)time * m_ticksStep + 0.5);
t = t / m_ticksStep;
return t;
return static_cast<float>(t);
}
//////////////////////////////////////////////////////////////////////////
@@ -153,10 +153,10 @@ void TimelineWidget::DrawTicks(QPainter* painter)
painter->setPen(redpen);
int x = TimeToClient(m_fTimeMarker);
painter->setBrush(Qt::NoBrush);
painter->drawRect(QRect(QPoint(x - 3, rc.top()), QPoint(x + 2, rc.bottom())));
painter->drawRect(QRect(QPoint(x - 3, static_cast<int>(rc.top())), QPoint(x + 2, static_cast<int>(rc.bottom()))));
painter->setPen(redpen);
painter->drawLine(x, rc.top(), x, rc.bottom());
painter->drawLine(x, static_cast<int>(rc.top()), x, static_cast<int>(rc.bottom()));
painter->setBrush(Qt::NoBrush);
// Draw vertical line showing current time.
@@ -190,7 +190,7 @@ void TimelineWidget::DrawTicks(QPainter* painter)
float keyTime = (m_pKeyTimeSet ? m_pKeyTimeSet->GetKeyTime(keyTimeIndex) : 0.0f);
int x2 = TimeToClient(keyTime);
painter->drawRect(QRect(QPoint(x2 - 1, rc.top()), QPoint(x2 + 2, rc.bottom())));
painter->drawRect(QRect(QPoint(x2 - 1, static_cast<int>(rc.top())), QPoint(x2 + 2, static_cast<int>(rc.bottom()))));
}
painter->setPen(pOldPen);
+4 -4
View File
@@ -613,7 +613,7 @@ public:
}
// Get boolean options
const int numOptions = options.size();
const int numOptions = static_cast<int>(options.size());
for (int i = 0; i < numOptions; ++i)
{
options[i].second = parser.isSet(options[i].first);
@@ -3240,7 +3240,7 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
{
QFileInfo info(fullyQualifiedLevelName);
const AZStd::string rawProjectDirectory = Path::GetEditingGameDataFolder();
const QString projectDirectory = QDir::toNativeSeparators(QString::fromUtf8(rawProjectDirectory.data(), rawProjectDirectory.size()));
const QString projectDirectory = QDir::toNativeSeparators(QString::fromUtf8(rawProjectDirectory.data(), static_cast<int>(rawProjectDirectory.size())));
const QString elidedLevelName = QStringLiteral("%1...%2").arg(levelName.left(10)).arg(levelName.right(10));
const QString elidedLevelFileName = QStringLiteral("%1...%2").arg(info.fileName().left(10)).arg(info.fileName().right(10));
const QString message = QObject::tr(
@@ -3380,7 +3380,7 @@ CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* lpszFileName)
void CCryEditApp::OnResourcesReduceworkingset()
{
#ifdef WIN32 // no such thing on macOS
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
SetProcessWorkingSetSize(GetCurrentProcess(), std::numeric_limits<SIZE_T>::max(), std::numeric_limits<SIZE_T>::max());
#endif
}
@@ -3922,7 +3922,7 @@ void CCryEditApp::OpenLUAEditor(const char* files)
void CCryEditApp::PrintAlways(const AZStd::string& output)
{
m_stdoutRedirection.WriteBypassingRedirect(output.c_str(), output.size());
m_stdoutRedirection.WriteBypassingRedirect(output.c_str(), static_cast<unsigned int>(output.size()));
}
QString CCryEditApp::GetRootEnginePath() const
+7 -7
View File
@@ -1047,7 +1047,7 @@ static bool TryRenameFile(const QString& oldPath, const QString& newPath, int re
bool CCryEditDoc::SaveLevel(const QString& filename)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
QWaitCursor wait;
CAutoCheckOutDialogEnableForAll enableForAll;
@@ -1067,7 +1067,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel BackupBeforeSave");
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel BackupBeforeSave");
BackupBeforeSave();
}
@@ -1178,7 +1178,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
CPakFile pakFile;
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Open PakFile");
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Open PakFile");
if (!pakFile.Open(tempSaveFile.toUtf8().data(), false))
{
gEnv->pLog->LogWarning("Unable to open pack file %s for writing", tempSaveFile.toUtf8().data());
@@ -1209,7 +1209,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
AZ::IO::ByteContainerStream<AZStd::vector<char>> entitySaveStream(&entitySaveBuffer);
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Save Entities To Stream");
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Save Entities To Stream");
EBUS_EVENT_RESULT(
savedEntities, AzToolsFramework::EditorEntityContextRequestBus, SaveToStreamForEditor, entitySaveStream, layerEntities,
instancesInLayers);
@@ -1223,8 +1223,8 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
if (savedEntities)
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Updated PakFile levelEntities.editor_xml");
pakFile.UpdateFile("LevelEntities.editor_xml", entitySaveBuffer.begin(), entitySaveBuffer.size());
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Updated PakFile levelEntities.editor_xml");
pakFile.UpdateFile("LevelEntities.editor_xml", entitySaveBuffer.begin(), static_cast<int>(entitySaveBuffer.size()));
// Save XML archive to pak file.
bool bSaved = xmlAr.SaveToPak(Path::GetPath(tempSaveFile), pakFile);
@@ -2055,7 +2055,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
}
// QVariant will not convert a void * to int, so do it manually.
int nKey = reinterpret_cast<intptr_t>(pVar->GetUserData().value<void*>());
int nKey = static_cast<int>(reinterpret_cast<intptr_t>(pVar->GetUserData().value<void*>()));
int nGroup = (nKey & 0xFFFF0000) >> 16;
int nChild = (nKey & 0x0000FFFF);
+3 -3
View File
@@ -46,7 +46,7 @@ void CDisplaySettings::SaveRegistry()
SaveValue("Settings", "RenderFlags", m_renderFlags);
SaveValue("Settings", "DisplayFlags", m_flags & SETTINGS_SERIALIZABLE_FLAGS_MASK);
SaveValue("Settings", "DebugFlags", m_debugFlags);
SaveValue("Settings", "LabelsDistance", m_labelsDistance);
SaveValue("Settings", "LabelsDistance", static_cast<int>(m_labelsDistance));
}
void CDisplaySettings::LoadRegistry()
@@ -56,9 +56,9 @@ void CDisplaySettings::LoadRegistry()
LoadValue("Settings", "DisplayFlags", m_flags);
m_flags &= SETTINGS_SERIALIZABLE_FLAGS_MASK;
LoadValue("Settings", "DebugFlags", m_debugFlags);
int temp = m_labelsDistance;
int temp = static_cast<int>(m_labelsDistance);
LoadValue("Settings", "LabelsDistance", temp);
m_labelsDistance = temp;
m_labelsDistance = static_cast<float>(temp);
gSettings.objectHideMask = m_objectHideMask;
}
@@ -44,14 +44,14 @@ bool SubObjectSelectionReferenceFrameCalculator::GetFrame(Matrix34& refFrame)
if (this->nNormals > 0)
{
this->normal = this->normal / this->nNormals;
this->normal = this->normal / static_cast<float>(this->nNormals);
if (!this->normal.IsZero())
{
this->normal.Normalize();
}
// Average position.
this->pos = this->pos / this->nNormals;
this->pos = this->pos / static_cast<float>(this->nNormals);
refFrame.SetTranslation(this->pos);
}
-12
View File
@@ -33,18 +33,6 @@
#include <Include/SandboxAPI.h>
#include <Include/EditorCoreAPI.h>
// Warnings in STL
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters in the debug information.
#pragma warning (disable : 4244) // conversion from 'long' to 'float', possible loss of data
#pragma warning (disable : 4018) // signed/unsigned mismatch
// Disable warning when a function returns a value inside an __asm block
#pragma warning (disable : 4035)
//////////////////////////////////////////////////////////////////////////
// 64-bits related warnings.
#pragma warning (disable : 4267) // conversion from 'size_t' to 'int', possible loss of data
//////////////////////////////////////////////////////////////////////////
// Simple type definitions.
//////////////////////////////////////////////////////////////////////////
@@ -201,20 +201,24 @@ void CEditorPreferencesPage_ViewportGeneral::OnApply()
ds->SetLabelsDistance(m_textLabels.m_labelsDistance);
gSettings.objectColorSettings.fChildGeomAlpha = m_selectionPreviewColor.m_childObjectGeomAlpha;
gSettings.objectColorSettings.entityHighlight = QColor(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f,
m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f,
m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f);
gSettings.objectColorSettings.groupHighlight = QColor(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f,
m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f,
m_selectionPreviewColor.m_colorGroupBBox.GetB() * 255.0f);
gSettings.objectColorSettings.entityHighlight = QColor(
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f));
gSettings.objectColorSettings.groupHighlight = QColor(
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetB() * 255.0f));
gSettings.objectColorSettings.fBBoxAlpha = m_selectionPreviewColor.m_fBBoxAlpha;
gSettings.objectColorSettings.fGeomAlpha = m_selectionPreviewColor.m_fgeomAlpha;
gSettings.objectColorSettings.geometryHighlightColor = QColor(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f,
m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f,
m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f);
gSettings.objectColorSettings.solidBrushGeometryColor = QColor(m_selectionPreviewColor.m_solidBrushGeometryColor.GetR() * 255.0f,
m_selectionPreviewColor.m_solidBrushGeometryColor.GetG() * 255.0f,
m_selectionPreviewColor.m_solidBrushGeometryColor.GetB() * 255.0f);
gSettings.objectColorSettings.geometryHighlightColor = QColor(
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f));
gSettings.objectColorSettings.solidBrushGeometryColor = QColor(
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetR() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetG() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetB() * 255.0f));
}
void CEditorPreferencesPage_ViewportGeneral::InitializeSettings()
@@ -252,10 +256,10 @@ void CEditorPreferencesPage_ViewportGeneral::InitializeSettings()
m_textLabels.m_labelsDistance = ds->GetLabelsDistance();
m_selectionPreviewColor.m_childObjectGeomAlpha = gSettings.objectColorSettings.fChildGeomAlpha;
m_selectionPreviewColor.m_colorEntityBBox.Set(gSettings.objectColorSettings.entityHighlight.redF(), gSettings.objectColorSettings.entityHighlight.greenF(), gSettings.objectColorSettings.entityHighlight.blueF(), 1.0f);
m_selectionPreviewColor.m_colorGroupBBox.Set(gSettings.objectColorSettings.groupHighlight.redF(), gSettings.objectColorSettings.groupHighlight.greenF(), gSettings.objectColorSettings.groupHighlight.blueF(), 1.0f);
m_selectionPreviewColor.m_colorEntityBBox.Set(static_cast<float>(gSettings.objectColorSettings.entityHighlight.redF()), static_cast<float>(gSettings.objectColorSettings.entityHighlight.greenF()), static_cast<float>(gSettings.objectColorSettings.entityHighlight.blueF()), 1.0f);
m_selectionPreviewColor.m_colorGroupBBox.Set(static_cast<float>(gSettings.objectColorSettings.groupHighlight.redF()), static_cast<float>(gSettings.objectColorSettings.groupHighlight.greenF()), static_cast<float>(gSettings.objectColorSettings.groupHighlight.blueF()), 1.0f);
m_selectionPreviewColor.m_fBBoxAlpha = gSettings.objectColorSettings.fBBoxAlpha;
m_selectionPreviewColor.m_fgeomAlpha = gSettings.objectColorSettings.fGeomAlpha;
m_selectionPreviewColor.m_geometryHighlightColor.Set(gSettings.objectColorSettings.geometryHighlightColor.redF(), gSettings.objectColorSettings.geometryHighlightColor.greenF(), gSettings.objectColorSettings.geometryHighlightColor.blueF(), 1.0f);
m_selectionPreviewColor.m_solidBrushGeometryColor.Set(gSettings.objectColorSettings.solidBrushGeometryColor.redF(), gSettings.objectColorSettings.solidBrushGeometryColor.greenF(), gSettings.objectColorSettings.solidBrushGeometryColor.blueF(), 1.0f);
m_selectionPreviewColor.m_geometryHighlightColor.Set(static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.redF()), static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.greenF()), static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.blueF()), 1.0f);
m_selectionPreviewColor.m_solidBrushGeometryColor.Set(static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.redF()), static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.greenF()), static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.blueF()), 1.0f);
}
+22
View File
@@ -31,6 +31,8 @@ namespace SandboxEditor
constexpr AZStd::string_view CameraPanSpeedSetting = "/Amazon/Preferences/Editor/Camera/PanSpeed";
constexpr AZStd::string_view CameraRotateSmoothnessSetting = "/Amazon/Preferences/Editor/Camera/RotateSmoothness";
constexpr AZStd::string_view CameraTranslateSmoothnessSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothness";
constexpr AZStd::string_view CameraTranslateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothing";
constexpr AZStd::string_view CameraRotateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/RotateSmoothing";
constexpr AZStd::string_view CameraTranslateForwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateForwardId";
constexpr AZStd::string_view CameraTranslateBackwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateBackwardId";
constexpr AZStd::string_view CameraTranslateLeftIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateLeftId";
@@ -259,6 +261,26 @@ namespace SandboxEditor
SetRegistry(CameraTranslateSmoothnessSetting, smoothness);
}
bool CameraRotateSmoothingEnabled()
{
return GetRegistry(CameraRotateSmoothingSetting, true);
}
void SetCameraRotateSmoothingEnabled(const bool enabled)
{
SetRegistry(CameraRotateSmoothingSetting, enabled);
}
bool CameraTranslateSmoothingEnabled()
{
return GetRegistry(CameraTranslateSmoothingSetting, true);
}
void SetCameraTranslateSmoothingEnabled(const bool enabled)
{
SetRegistry(CameraTranslateSmoothingSetting, enabled);
}
AzFramework::InputChannelId CameraTranslateForwardChannelId()
{
return AzFramework::InputChannelId(
+6
View File
@@ -80,6 +80,12 @@ namespace SandboxEditor
SANDBOX_API float CameraTranslateSmoothness();
SANDBOX_API void SetCameraTranslateSmoothness(float smoothness);
SANDBOX_API bool CameraRotateSmoothingEnabled();
SANDBOX_API void SetCameraRotateSmoothingEnabled(bool enabled);
SANDBOX_API bool CameraTranslateSmoothingEnabled();
SANDBOX_API void SetCameraTranslateSmoothingEnabled(bool enabled);
SANDBOX_API AzFramework::InputChannelId CameraTranslateForwardChannelId();
SANDBOX_API void SetCameraTranslateForwardChannelId(AZStd::string_view cameraTranslateForwardId);
+56 -34
View File
@@ -132,12 +132,11 @@ namespace AZ::ViewportHelpers
{
static const char TextCantCreateCameraNoLevel[] = "Cannot create camera when no level is loaded.";
class EditorEntityNotifications
: public AzToolsFramework::EditorEntityContextNotificationBus::Handler
class EditorEntityNotifications : public AzToolsFramework::EditorEntityContextNotificationBus::Handler
{
public:
EditorEntityNotifications(EditorViewportWidget& renderViewport)
: m_renderViewport(renderViewport)
EditorEntityNotifications(EditorViewportWidget& editorViewportWidget)
: m_editorViewportWidget(editorViewportWidget)
{
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
}
@@ -147,22 +146,24 @@ namespace AZ::ViewportHelpers
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
}
// AzToolsFramework::EditorEntityContextNotificationBus
// AzToolsFramework::EditorEntityContextNotificationBus overrides ...
void OnStartPlayInEditor() override
{
m_renderViewport.OnStartPlayInEditor();
m_editorViewportWidget.OnStartPlayInEditor();
}
void OnStopPlayInEditor() override
{
m_renderViewport.OnStopPlayInEditor();
m_editorViewportWidget.OnStopPlayInEditor();
}
void OnStartPlayInEditorBegin() override
{
m_renderViewport.OnStartPlayInEditorBegin();
m_editorViewportWidget.OnStartPlayInEditorBegin();
}
private:
EditorViewportWidget& m_renderViewport;
EditorViewportWidget& m_editorViewportWidget;
};
} // namespace AZ::ViewportHelpers
@@ -284,7 +285,7 @@ void EditorViewportWidget::paintEvent([[maybe_unused]] QPaintEvent* event)
const char* kFontName = "Arial";
const QColor kTextColor(255, 255, 255);
const QColor kTextShadowColor(0, 0, 0);
const QFont font(kFontName, kFontSize / 10.0);
const QFont font(kFontName, static_cast<int>(kFontSize / 10.0f));
painter.setFont(font);
QString friendlyName = QFileInfo(GetIEditor()->GetLevelName()).fileName();
@@ -815,29 +816,35 @@ void EditorViewportWidget::UpdateSafeFrame()
float maxSafeFrameWidth = m_safeFrame.height() * targetAspectRatio;
float widthDifference = m_safeFrame.width() - maxSafeFrameWidth;
m_safeFrame.setLeft(m_safeFrame.left() + widthDifference * 0.5);
m_safeFrame.setRight(m_safeFrame.right() - widthDifference * 0.5);
m_safeFrame.setLeft(static_cast<int>(m_safeFrame.left() + widthDifference * 0.5f));
m_safeFrame.setRight(static_cast<int>(m_safeFrame.right() - widthDifference * 0.5f));
}
else
{
float maxSafeFrameHeight = m_safeFrame.width() / targetAspectRatio;
float heightDifference = m_safeFrame.height() - maxSafeFrameHeight;
m_safeFrame.setTop(m_safeFrame.top() + heightDifference * 0.5);
m_safeFrame.setBottom(m_safeFrame.bottom() - heightDifference * 0.5);
m_safeFrame.setTop(static_cast<int>(m_safeFrame.top() + heightDifference * 0.5f));
m_safeFrame.setBottom(static_cast<int>(m_safeFrame.bottom() - heightDifference * 0.5f));
}
m_safeFrame.adjust(0, 0, -1, -1); // <-- aesthetic improvement.
const float SAFE_ACTION_SCALE_FACTOR = 0.05f;
m_safeAction = m_safeFrame;
m_safeAction.adjust(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR,
-m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, -m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR);
m_safeAction.adjust(
static_cast<int>(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR),
static_cast<int>(m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR),
static_cast<int>(-m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR),
static_cast<int>(-m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR));
const float SAFE_TITLE_SCALE_FACTOR = 0.1f;
m_safeTitle = m_safeFrame;
m_safeTitle.adjust(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR,
-m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, -m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR);
m_safeTitle.adjust(
static_cast<int>(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR),
static_cast<int>(m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR),
static_cast<int>(-m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR),
static_cast<int>(-m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR));
}
//////////////////////////////////////////////////////////////////////////
@@ -856,8 +863,8 @@ void EditorViewportWidget::RenderSafeFrame(const QRect& frame, float r, float g,
const int LINE_WIDTH = 2;
for (int i = 0; i < LINE_WIDTH; i++)
{
AZ::Vector3 topLeft(frame.left() + i, frame.top() + i, 0);
AZ::Vector3 bottomRight(frame.right() - i, frame.bottom() - i, 0);
AZ::Vector3 topLeft(static_cast<float>(frame.left() + i), static_cast<float>(frame.top() + i), 0.0f);
AZ::Vector3 bottomRight(static_cast<float>(frame.right() - i), static_cast<float>(frame.bottom() - i), 0.0f);
m_debugDisplay->DrawWireBox(topLeft, bottomRight);
}
}
@@ -1027,10 +1034,16 @@ bool EditorViewportWidget::ShowingWorldSpace()
}
AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateModularViewportCameraController(
AzFramework::ViewportId viewportId)
const AzFramework::ViewportId viewportId)
{
auto controller = AZStd::make_shared<AtomToolsFramework::ModularViewportCameraController>();
controller->SetCameraViewportContextBuilderCallback(
[viewportId](AZStd::unique_ptr<AtomToolsFramework::ModularCameraViewportContext>& cameraViewportContext)
{
cameraViewportContext = AZStd::make_unique<AtomToolsFramework::ModularCameraViewportContextImpl>(viewportId);
});
controller->SetCameraPriorityBuilderCallback(
[](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn)
{
@@ -1049,6 +1062,16 @@ AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateMod
{
return SandboxEditor::CameraTranslateSmoothness();
};
cameraProps.m_rotateSmoothingEnabledFn = []
{
return SandboxEditor::CameraRotateSmoothingEnabled();
};
cameraProps.m_translateSmoothingEnabledFn = []
{
return SandboxEditor::CameraTranslateSmoothingEnabled();
};
});
controller->SetCameraListBuilderCallback(
@@ -1477,7 +1500,7 @@ bool EditorViewportWidget::AddCameraMenuItems(QMenu* menu)
Camera::CameraBus::BroadcastResult(getCameraResults, &Camera::CameraRequests::GetCameras);
QVector<QAction*> additionalCameras;
additionalCameras.reserve(getCameraResults.values.size());
additionalCameras.reserve(static_cast<int>(getCameraResults.values.size()));
for (const AZ::EntityId& entityId : getCameraResults.values)
{
@@ -1899,7 +1922,7 @@ void EditorViewportWidget::RenderSelectedRegion()
// Draw volume
dc.DepthWriteOff();
dc.CullOff();
dc.pRenderAuxGeom->DrawTriangles(&verts[0], verts.size(), &inds[0], numInds, &colors[0]);
dc.pRenderAuxGeom->DrawTriangles(&verts[0], static_cast<uint32>(verts.size()), &inds[0], numInds, &colors[0]);
dc.CullOn();
dc.DepthWriteOn();
}
@@ -1915,8 +1938,8 @@ Vec3 EditorViewportWidget::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nF
{
out.x = (x / 100) * m_rcClient.width();
out.y = (y / 100) * m_rcClient.height();
out.x /= QHighDpiScaling::factor(windowHandle()->screen());
out.y /= QHighDpiScaling::factor(windowHandle()->screen());
out.x /= static_cast<float>(QHighDpiScaling::factor(windowHandle()->screen()));
out.y /= static_cast<float>(QHighDpiScaling::factor(windowHandle()->screen()));
out.z = z;
}
return out;
@@ -1936,8 +1959,8 @@ QPoint EditorViewportWidget::WorldToViewParticleEditor(const Vec3& wp, int width
ProjectToScreen(wp.x, wp.y, wp.z, &x, &y, &z);
if (_finite(x) || _finite(y))
{
p.rx() = (x / 100) * width;
p.ry() = (y / 100) * height;
p.rx() = static_cast<int>((x / 100) * width);
p.ry() = static_cast<int>((y / 100) * height);
}
else
{
@@ -1950,7 +1973,7 @@ QPoint EditorViewportWidget::WorldToViewParticleEditor(const Vec3& wp, int width
Vec3 EditorViewportWidget::ViewToWorld(
const QPoint& vp, bool* collideWithTerrain, bool onlyTerrain, bool bSkipVegetation, bool bTestRenderMesh, bool* collideWithObject) const
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
AZ_UNUSED(collideWithTerrain)
AZ_UNUSED(onlyTerrain)
@@ -1985,7 +2008,7 @@ Vec3 EditorViewportWidget::ViewToWorldNormal(const QPoint& vp, bool onlyTerrain,
AZ_UNUSED(onlyTerrain)
AZ_UNUSED(bTestRenderMesh)
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
return Vec3(0, 0, 1);
}
@@ -2091,8 +2114,8 @@ void EditorViewportWidget::UnProjectFromScreen(float sx, float sy, float sz, flo
void EditorViewportWidget::ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const
{
AzFramework::ScreenPoint screenPosition = m_renderViewport->ViewportWorldToScreen(AZ::Vector3{ptx, pty, ptz});
*sx = screenPosition.m_x;
*sy = screenPosition.m_y;
*sx = static_cast<float>(screenPosition.m_x);
*sy = static_cast<float>(screenPosition.m_y);
*sz = 0.f;
}
@@ -2103,7 +2126,7 @@ void EditorViewportWidget::ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3&
Vec3 pos0, pos1;
float wx, wy, wz;
UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 0, &wx, &wy, &wz);
UnProjectFromScreen(static_cast<float>(vp.x()), static_cast<float>(rc.bottom() - vp.y()), 0.0f, &wx, &wy, &wz);
if (!_finite(wx) || !_finite(wy) || !_finite(wz))
{
return;
@@ -2113,7 +2136,7 @@ void EditorViewportWidget::ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3&
return;
}
pos0(wx, wy, wz);
UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 1, &wx, &wy, &wz);
UnProjectFromScreen(static_cast<float>(vp.x()), static_cast<float>(rc.bottom() - vp.y()), 1.0f, &wx, &wy, &wz);
if (!_finite(wx) || !_finite(wy) || !_finite(wz))
{
return;
@@ -2611,7 +2634,6 @@ void EditorViewportWidget::ShowCursor()
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::PushDisableRendering()
{
assert(m_disableRenderingCount >= 0);
++m_disableRenderingCount;
}
+6 -1
View File
@@ -54,7 +54,8 @@ namespace AZ::ViewportHelpers
namespace AtomToolsFramework
{
class RenderViewportWidget;
}
class ModularViewportCameraController;
} // namespace AtomToolsFramework
namespace AzToolsFramework
{
@@ -389,3 +390,7 @@ private:
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};
//! Creates a modular camera controller in the configuration used by the editor viewport.
SANDBOX_API AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateModularViewportCameraController(
const AzFramework::ViewportId viewportId);
+4 -4
View File
@@ -45,7 +45,7 @@ bool GetPositionFromString(QString er, float* x, float* y, float* z)
}
if (ind > 0)
{
*x = er.mid(0, ind).toDouble();
*x = er.mid(0, ind).toFloat();
er = er.mid(ind);
er.remove(QRegExp("^[ ,]*"));
@@ -57,12 +57,12 @@ bool GetPositionFromString(QString er, float* x, float* y, float* z)
}
if (ind > 0)
{
*y = er.mid(0, ind).toDouble();
*y = er.mid(0, ind).toFloat();
er = er.mid(ind);
er.remove(QRegExp("^[ ,]*"));
if (er.length())
{
*z = er.toDouble();
*z = er.toFloat();
return true;
}
}
@@ -119,7 +119,7 @@ void CErrorReportTableModel::setErrorReport(CErrorReport* report)
int CErrorReportTableModel::rowCount(const QModelIndex& parent) const
{
return parent.isValid() ? 0 : m_errorRecords.size();
return parent.isValid() ? 0 : static_cast<int>(m_errorRecords.size());
}
int CErrorReportTableModel::columnCount(const QModelIndex& parent) const
+4 -13
View File
@@ -40,15 +40,6 @@
namespace
{
void SetTexture(Export::TPath& outName, IRenderShaderResources* pRes, int nSlot)
{
SEfResTexture* pTex = pRes->GetTextureResource(nSlot);
if (pTex)
{
azstrcat(outName, AZ_ARRAY_SIZE(outName), Path::GamePathToFullPath(pTex->m_Name.c_str()).toUtf8().data());
}
}
inline Export::Vector3D Vec3ToVector3D(const Vec3& vec)
{
Export::Vector3D ret;
@@ -302,7 +293,7 @@ void CExportManager::ProcessEntityAnimationTrack(
return;
}
for (int trackNumber = 0; trackNumber < pEntityTrack->GetChildCount(); ++trackNumber)
for (unsigned int trackNumber = 0; trackNumber < pEntityTrack->GetChildCount(); ++trackNumber)
{
CTrackViewTrack* pSubTrack = static_cast<CTrackViewTrack*>(pEntityTrack->GetChild(trackNumber));
@@ -964,7 +955,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo
}
const uint numKeys = pSequenceTrack->GetKeyCount();
for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex)
for (uint keyIndex = 0; keyIndex < numKeys; ++keyIndex)
{
const CTrackViewKeyHandle& keyHandle = pSequenceTrack->GetKey(keyIndex);
ISequenceKey sequenceKey;
@@ -1043,7 +1034,7 @@ bool CExportManager::AddSelectedRegionObjects()
std::vector<CBaseObject*> objects;
GetIEditor()->GetObjectManager()->FindObjectsInAABB(box, objects);
int numObjects = objects.size();
const size_t numObjects = objects.size();
if (numObjects > m_data.m_objects.size())
{
m_data.m_objects.reserve(numObjects + 1); // +1 for terrain
@@ -1164,7 +1155,7 @@ bool CExportManager::Export(const char* defaultName, const char* defaultExt, con
// Export the whole sequence with baked keys
if (ShowFBXExportDialog())
{
m_numberOfExportFrames = pSequence->GetTimeRange().end * m_FBXBakedExportFPS;
m_numberOfExportFrames = static_cast<int>(pSequence->GetTimeRange().end * m_FBXBakedExportFPS);
if (!m_bExportOnlyPrimaryCamera)
{
+12 -12
View File
@@ -36,7 +36,7 @@ namespace Export
public:
CMesh();
virtual int GetFaceCount() const { return m_faces.size(); }
virtual int GetFaceCount() const { return static_cast<int>(m_faces.size()); }
virtual const Face* GetFaceBuffer() const { return m_faces.size() ? &m_faces[0] : 0; }
private:
@@ -53,22 +53,22 @@ namespace Export
public:
CObject(const char* pName);
virtual int GetVertexCount() const { return m_vertices.size(); }
virtual const Vector3D* GetVertexBuffer() const{ return m_vertices.size() ? &m_vertices[0] : 0; }
int GetVertexCount() const override { return static_cast<int>(m_vertices.size()); }
const Vector3D* GetVertexBuffer() const override { return m_vertices.size() ? &m_vertices[0] : nullptr; }
virtual int GetNormalCount() const { return m_normals.size(); }
virtual const Vector3D* GetNormalBuffer() const { return m_normals.size() ? &m_normals[0] : 0; }
int GetNormalCount() const override { return static_cast<int>(m_normals.size()); }
const Vector3D* GetNormalBuffer() const override { return m_normals.size() ? &m_normals[0] : nullptr; }
virtual int GetTexCoordCount() const { return m_texCoords.size(); }
virtual const UV* GetTexCoordBuffer() const { return m_texCoords.size() ? &m_texCoords[0] : 0; }
int GetTexCoordCount() const override { return static_cast<int>(m_texCoords.size()); }
const UV* GetTexCoordBuffer() const override { return m_texCoords.size() ? &m_texCoords[0] : nullptr; }
virtual int GetMeshCount() const { return m_meshes.size(); }
virtual Mesh* GetMesh(int index) const { return m_meshes[index]; }
int GetMeshCount() const override { return static_cast<int>(m_meshes.size()); }
Mesh* GetMesh(int index) const override { return m_meshes[index]; }
virtual size_t MeshHash() const{return m_MeshHash; }
size_t MeshHash() const override{return m_MeshHash; }
void SetMaterialName(const char* pName);
virtual int GetEntityAnimationDataCount() const {return m_entityAnimData.size(); }
virtual int GetEntityAnimationDataCount() const {return static_cast<int>(m_entityAnimData.size()); }
virtual const EntityAnimData* GetEntityAnimationData(int index) const {return &m_entityAnimData[index]; }
virtual void SetEntityAnimationData(EntityAnimData entityData){ m_entityAnimData.push_back(entityData); };
void SetLastPtr(CBaseObject* pObject){m_pLastObject = pObject; };
@@ -92,7 +92,7 @@ namespace Export
: public IData
{
public:
virtual int GetObjectCount() const { return m_objects.size(); }
virtual int GetObjectCount() const { return static_cast<int>(m_objects.size()); }
virtual Object* GetObject(int index) const { return m_objects[index]; }
virtual Object* AddObject(const char* objectName);
void Clear();
+2 -2
View File
@@ -227,7 +227,7 @@ QString COBJExporter::MakeRelativePath(const char* pMainFileName, const char* pF
const char* ch = strrchr(pMainFileName, '\\');
if (ch)
{
if (strlen(pFileName) > ch - pMainFileName && !_strnicmp(pMainFileName, pFileName, ch - pMainFileName))
if (strlen(pFileName) > static_cast<size_t>(ch - pMainFileName) && !_strnicmp(pMainFileName, pFileName, ch - pMainFileName))
{
return QString(pFileName + (ch - pMainFileName) + 1);
}
@@ -256,7 +256,7 @@ const char* COBJExporter::TrimFloat(float fValue) const
++nCurBuf;
sprintf_s(pBuf, bufSize, "%f", fValue);
for (int i = strlen(pBuf) - 1; i > 0; --i)
for (int i = static_cast<int>(strlen(pBuf)) - 1; i > 0; --i)
{
if (pBuf[i] == '0')
{
+6 -6
View File
@@ -215,7 +215,7 @@ bool COCMExporter::ExportToFile(const char* filename, const Export::IData* pExpo
for (size_t a = 0; a < MeshCount; a++)
{
SOCMeshInfo MeshInfo;
MeshInfo.m_MeshHash = pExportData->GetObject(a)->MeshHash();
MeshInfo.m_MeshHash = pExportData->GetObject(static_cast<int>(a))->MeshHash();
const tdMeshOffset::iterator it = std::find(MeshOffsets.begin(), MeshOffsets.end(), MeshInfo);
if (it != MeshOffsets.end())
{
@@ -223,15 +223,15 @@ bool COCMExporter::ExportToFile(const char* filename, const Export::IData* pExpo
}
else
{
MeshInfo.m_Offset = Offset;
Offset += SaveMesh(Writer, pExportData->GetObject(a), MeshInfo.m_OBBMat);
MeshInfo.m_Offset = static_cast<uint32>(Offset);
Offset += SaveMesh(Writer, pExportData->GetObject(static_cast<int>(a)), MeshInfo.m_OBBMat);
}
MeshOffsets.push_back(MeshInfo);
}
OffsetInstances = Offset;
OffsetInstances = static_cast<uint32>(Offset);
for (size_t a = 0; a < InstCount; a++)
{
SaveInstance(Writer, pExportData->GetObject(a), MeshOffsets[a]);
SaveInstance(Writer, pExportData->GetObject(static_cast<int>(a)), MeshOffsets[a]);
}
Writer.Seek(4);
Writer.Write(static_cast<uint32>(MeshOffsets.size()));
@@ -263,7 +263,7 @@ const char* COCMExporter::TrimFloat(float fValue) const
++nCurBuf;
sprintf_s(pBuf, bufSize, "%f", fValue);
for (int i = strlen(pBuf) - 1; i > 0; --i)
for (int i = static_cast<int>(strlen(pBuf)) - 1; i > 0; --i)
{
if (pBuf[i] == '0')
{
+2 -2
View File
@@ -20,7 +20,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
namespace
{
const uint kDefaultFPS = 30.0f;
const uint kDefaultFPS = 30u;
}
CFBXExporterDialog::CFBXExporterDialog(bool bDisplayOnlyFPSSetting, QWidget* pParent)
@@ -43,7 +43,7 @@ CFBXExporterDialog::~CFBXExporterDialog()
float CFBXExporterDialog::GetFPS() const
{
return m_ui->m_fpsCombo->currentText().toDouble();
return m_ui->m_fpsCombo->currentText().toFloat();
}
bool CFBXExporterDialog::GetExportCoordsLocalToTheSelectedObject() const
+7 -7
View File
@@ -252,11 +252,11 @@ void CGameExporter::ExportOcclusionMesh(const char* pszGamePath)
{
CMemoryBlock Temp;
const size_t Size = FileIn.size();
Temp.Allocate(Size);
Temp.Allocate(static_cast<int>(Size));
FileIn.read(reinterpret_cast<char*>(Temp.GetBuffer()), Size);
FileIn.close();
CCryMemFile FileOut;
FileOut.Write(Temp.GetBuffer(), Size);
FileOut.Write(Temp.GetBuffer(), static_cast<int>(Size));
m_levelPak.m_pakFile.UpdateFile(levelDataFile.toUtf8().data(), FileOut);
}
}
@@ -281,13 +281,13 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/
QString levelDataFile = path + "LevelData.xml";
XmlString xmlData = root->getXML();
CCryMemFile file;
file.Write(xmlData.c_str(), xmlData.length());
file.Write(xmlData.c_str(), static_cast<unsigned int>(xmlData.length()));
m_levelPak.m_pakFile.UpdateFile(levelDataFile.toUtf8().data(), file);
QString levelDataActionFile = path + "LevelDataAction.xml";
XmlString xmlDataAction = rootAction->getXML();
CCryMemFile fileAction;
fileAction.Write(xmlDataAction.c_str(), xmlDataAction.length());
fileAction.Write(xmlDataAction.c_str(), static_cast<unsigned int>(xmlDataAction.length()));
m_levelPak.m_pakFile.UpdateFile(levelDataActionFile.toUtf8().data(), fileAction);
AZStd::vector<char> entitySaveBuffer;
@@ -298,7 +298,7 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/
{
QString entitiesFile;
entitiesFile = QStringLiteral("%1%2.entities_xml").arg(path, "Mission0");
m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), entitySaveBuffer.size());
m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), static_cast<int>(entitySaveBuffer.size()));
}
}
@@ -329,7 +329,7 @@ void CGameExporter::ExportLevelInfo(const QString& path)
XmlString xmlData = root->getXML();
CCryMemFile file;
file.Write(xmlData.c_str(), xmlData.length());
file.Write(xmlData.c_str(), static_cast<unsigned int>(xmlData.length()));
m_levelPak.m_pakFile.UpdateFile(filename.toUtf8().data(), file);
}
@@ -342,7 +342,7 @@ void CGameExporter::ExportLevelResourceList(const QString& path)
CCryMemFile memFile;
for (const char* filename = pResList->GetFirst(); filename; filename = pResList->GetNext())
{
memFile.Write(filename, strlen(filename));
memFile.Write(filename, static_cast<unsigned int>(strlen(filename)));
memFile.Write("\n", 1);
}
+2 -19
View File
@@ -97,7 +97,7 @@ void CGameResourcesExporter::Save(const QString& outputDirectory)
{
// Save this file in target folder.
QString trgFilename = Path::Make(outputDirectory, srcFilename);
int fsize = file.GetLength();
int fsize = static_cast<int>(file.GetLength());
if (fsize > data.GetSize())
{
data.Allocate(fsize + 16);
@@ -123,23 +123,6 @@ void CGameResourcesExporter::Save(const QString& outputDirectory)
m_files.clear();
}
#if defined(WIN64) || defined(APPLE) || defined(AZ_PLATFORM_LINUX)
template <class Container1, class Container2>
void Append(Container1& a, const Container2& b)
{
a.reserve (a.size() + b.size());
for (auto it = b.begin(); it != b.end(); ++it)
{
a.insert(a.end(), *it);
}
}
#else
template <class Container1, class Container2>
void Append(Container1& a, const Container2& b)
{
a.insert (a.end(), b.begin(), b.end());
}
#endif
//////////////////////////////////////////////////////////////////////////
//
// Go through all editor objects and gathers files from thier properties.
@@ -150,5 +133,5 @@ void CGameResourcesExporter::GetFilesFromObjects()
CUsedResources rs;
GetIEditor()->GetObjectManager()->GatherUsedResources(rs);
Append(m_files, rs.files);
AZStd::copy(rs.files.begin(), rs.files.end(), AZStd::back_inserter(m_files));
}
+11 -11
View File
@@ -201,7 +201,7 @@ void CTriMesh::SetFromMesh(CMesh& mesh)
face.v [j] = numv;
face.uv[j] = numv;
face.n [j] = mesh.m_pNorms[idx].GetN();
face.MatID = subset.nMatID;
face.MatID = static_cast<unsigned char>(subset.nMatID);
face.flags = 0;
numv++;
@@ -269,7 +269,7 @@ void CTriMesh::SharePositions()
for (int i = 0; i < 3; i++)
{
const Vec3& v = pVertices[face.v[i]].pos;
uint8 nHash = RoundFloatToInt((v.x + v.y + v.z) * fHashScale);
uint8 nHash = static_cast<uint8>(RoundFloatToInt((v.x + v.y + v.z) * fHashScale));
int find = FindVertexInHash(v, pNewVerts, arrHashTable[nHash], fEpsilon);
if (find < 0)
@@ -320,7 +320,7 @@ void CTriMesh::ShareUV()
for (int i = 0; i < 3; i++)
{
const Vec2 uv = pUV[face.uv[i]].GetUV();
uint8 nHash = RoundFloatToInt((uv.x + uv.y) * fHashScale);
uint8 nHash = static_cast<uint8>(RoundFloatToInt((uv.x + uv.y) * fHashScale));
int find = FindTexCoordInHash(pUV[face.uv[i]], pNewUV, arrHashTable[nHash], fEpsilon);
if (find < 0)
@@ -380,7 +380,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
// To find really used materials
std::vector<int> usedMaterialIds;
uint16 MatIdToSubset[MAX_SUB_MATERIALS];
int nLastSubsetId = 0;
uint16 nLastSubsetId = 0;
memset(MatIdToSubset, 0, sizeof(MatIdToSubset));
//////////////////////////////////////////////////////////////////////////
@@ -398,7 +398,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
MatIdToSubset[face.MatID] = 1 + nLastSubsetId++;
usedMaterialIds.push_back(face.MatID); // Order of material ids in usedMaterialIds correspond to the indices of chunks.
}
meshFace.nSubset = MatIdToSubset[face.MatID] - 1;
meshFace.nSubset = static_cast<unsigned char>(MatIdToSubset[face.MatID] - 1);
for (int j = 0; j < 3; ++j)
{
@@ -420,7 +420,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
pIndexedMesh->SetBBox(bb);
pIndexedMesh->SetSubSetCount(usedMaterialIds.size());
pIndexedMesh->SetSubSetCount(static_cast<int>(usedMaterialIds.size()));
for (int i = 0; i < usedMaterialIds.size(); i++)
{
pIndexedMesh->SetSubsetMaterialId(i, usedMaterialIds[i]);
@@ -677,11 +677,11 @@ void CTriMesh::GetEdgesByVertex(MeshElementsArray& inVertices, MeshElementsArray
std::sort(inVertices.begin(), inVertices.end());
for (int i = 0; i < GetEdgeCount(); i++)
{
if (stl::binary_find(inVertices.begin(), inVertices.end(), pEdges[i].v[0]) != inVertices.end())
if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pEdges[i].v[0])) != inVertices.end())
{
outEdges.push_back(i);
}
else if (stl::binary_find(inVertices.begin(), inVertices.end(), pEdges[i].v[1]) != inVertices.end())
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pEdges[i].v[1])) != inVertices.end())
{
outEdges.push_back(i);
}
@@ -696,15 +696,15 @@ void CTriMesh::GetFacesByVertex(MeshElementsArray& inVertices, MeshElementsArray
std::sort(inVertices.begin(), inVertices.end());
for (int i = 0; i < GetFacesCount(); i++)
{
if (stl::binary_find(inVertices.begin(), inVertices.end(), pFaces[i].v[0]) != inVertices.end())
if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[0])) != inVertices.end())
{
outFaces.push_back(i);
}
else if (stl::binary_find(inVertices.begin(), inVertices.end(), pFaces[i].v[1]) != inVertices.end())
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[1])) != inVertices.end())
{
outFaces.push_back(i);
}
else if (stl::binary_find(inVertices.begin(), inVertices.end(), pFaces[i].v[2]) != inVertices.end())
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[2])) != inVertices.end())
{
outFaces.push_back(i);
}
+1 -1
View File
@@ -86,7 +86,7 @@ void GotoPositionDialog::OnChangeEdit()
const QStringList parts = m_transform.split(QRegularExpression("[\\s,;\\t]"), Qt::SkipEmptyParts);
for (int i = 0; i < argCount && i < parts.count(); ++i)
{
transform[i] = parts[i].toDouble();
transform[i] = parts[i].toFloat();
}
m_ui->m_dymX->setValue(transform[0]);
+1 -1
View File
@@ -477,7 +477,7 @@ bool CLevelFileDialog::ValidateLevelPath(const QString& levelPath) const
QString currentPath = (Path::GetEditingGameDataFolder() + "/" + kLevelsFolder).c_str();
for (size_t i = 0; i < splittedPath.size() - 1; ++i)
{
currentPath += "/" + splittedPath[i];
currentPath += "/" + splittedPath[static_cast<int>(i)];
if (CFileUtil::FileExists(currentPath) || CheckLevelFolder(currentPath))
{
@@ -0,0 +1,170 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AtomToolsFramework/Viewport/ModularViewportCameraController.h>
#include <AzFramework/Viewport/ViewportControllerList.h>
#include <AzToolsFramework/Input/QtEventToAzInputManager.h>
#include <AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.h>
#include <EditorViewportWidget.h>
#include <Mocks/MockWindowRequests.h>
namespace UnitTest
{
const QSize WidgetSize = QSize(1920, 1080);
using AzToolsFramework::ViewportInteraction::MouseInteractionEvent;
class ModularViewportCameraControllerFixture : public AllocatorsTestFixture
{
public:
static const AzFramework::ViewportId TestViewportId;
void SetUp() override
{
AllocatorsTestFixture::SetUp();
m_rootWidget = AZStd::make_unique<QWidget>();
m_rootWidget->setFixedSize(WidgetSize);
m_controllerList = AZStd::make_shared<AzFramework::ViewportControllerList>();
m_controllerList->RegisterViewportContext(TestViewportId);
m_inputChannelMapper = AZStd::make_unique<AzToolsFramework::QtEventToAzInputMapper>(m_rootWidget.get(), TestViewportId);
}
void TearDown() override
{
m_inputChannelMapper.reset();
m_controllerList->UnregisterViewportContext(TestViewportId);
m_controllerList.reset();
m_rootWidget.reset();
AllocatorsTestFixture::TearDown();
}
AZStd::unique_ptr<QWidget> m_rootWidget;
AzFramework::ViewportControllerListPtr m_controllerList;
AZStd::unique_ptr<AzToolsFramework::QtEventToAzInputMapper> m_inputChannelMapper;
};
const AzFramework::ViewportId ModularViewportCameraControllerFixture::TestViewportId = AzFramework::ViewportId(0);
class TestModularCameraViewportContextImpl : public AtomToolsFramework::ModularCameraViewportContext
{
public:
AZ::Transform GetCameraTransform() const override
{
return m_cameraTransform;
}
void SetCameraTransform(const AZ::Transform& transform) override
{
m_cameraTransform = transform;
}
void ConnectViewMatrixChangedHandler(AZ::RPI::ViewportContext::MatrixChangedEvent::Handler&) override
{
// noop
}
private:
AZ::Transform m_cameraTransform = AZ::Transform::CreateIdentity();
};
TEST_F(ModularViewportCameraControllerFixture, Mouse_movement_does_not_accumulate_excessive_drift_in_modular_viewport_camera)
{
AzFramework::NativeWindowHandle nativeWindowHandle = nullptr;
const float deltaTime = 1.0f / 60.0f; // mimic 60fps
// Given
// listen for events signaled from QtEventToAzInputMapper and forward to the controller list
QObject::connect(
m_inputChannelMapper.get(), &AzToolsFramework::QtEventToAzInputMapper::InputChannelUpdated, m_rootWidget.get(),
[this, nativeWindowHandle](const AzFramework::InputChannel* inputChannel, [[maybe_unused]] QEvent* event)
{
m_controllerList->HandleInputChannelEvent(
AzFramework::ViewportControllerInputEvent{ TestViewportId, nativeWindowHandle, *inputChannel });
});
using ::testing::NiceMock;
using ::testing::Return;
NiceMock<MockWindowRequests> mockWindowRequests;
mockWindowRequests.Connect(nativeWindowHandle);
// note: WindowRequests is used internally by ModularViewportCameraController, this ensures it returns the viewport size we want
ON_CALL(mockWindowRequests, GetClientAreaSize())
.WillByDefault(Return(AzFramework::WindowSize(WidgetSize.width(), WidgetSize.height())));
// create editor modular camera
auto controller = CreateModularViewportCameraController(TestViewportId);
// set some overrides for the test
AtomToolsFramework::ModularCameraViewportContext* cameraViewportContextView = nullptr;
controller->SetCameraViewportContextBuilderCallback(
[&cameraViewportContextView](AZStd::unique_ptr<AtomToolsFramework::ModularCameraViewportContext>& cameraViewportContext)
{
cameraViewportContext = AZStd::make_unique<TestModularCameraViewportContextImpl>();
cameraViewportContextView = cameraViewportContext.get();
});
controller->SetCameraPropsBuilderCallback(
[](AzFramework::CameraProps& cameraProps)
{
cameraProps.m_rotateSmoothingEnabledFn = []
{
return false;
};
cameraProps.m_translateSmoothingEnabledFn = []
{
return false;
};
});
m_controllerList->Add(controller);
// move to the center of the screen
auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2);
MouseMove(m_rootWidget.get(), start, QPoint(0, 0));
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
// When
// move mouse diagonally to top right, then to bottom left and back repeatedly
auto current = start;
auto halfDelta = QPoint(200, -200);
const int iterationsPerDiagonal = 50;
for (int diagonals = 0; diagonals < 80; ++diagonals)
{
for (int i = 0; i < iterationsPerDiagonal; ++i)
{
MousePressAndMove(m_rootWidget.get(), current, halfDelta / iterationsPerDiagonal, Qt::MouseButton::RightButton);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
current += halfDelta / iterationsPerDiagonal;
}
if (diagonals % 2 == 0)
{
halfDelta.setX(halfDelta.x() * -1);
halfDelta.setY(halfDelta.y() * -1);
}
}
QTest::mouseRelease(m_rootWidget.get(), Qt::MouseButton::RightButton, Qt::KeyboardModifier::NoModifier, current);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
// Then
// ensure the camera rotation is the identity (no significant drift has occurred as we moved the mouse)
const AZ::Transform cameraRotation = cameraViewportContextView->GetCameraTransform();
EXPECT_THAT(cameraRotation.GetRotation(), IsClose(AZ::Quaternion::CreateIdentity()));
mockWindowRequests.Disconnect();
}
} // namespace UnitTest
@@ -24,10 +24,10 @@ namespace UnitTest
void Disconnect();
// EditorInteractionSystemViewportSelectionRequestBus overrides ...
void SetHandler(const AzToolsFramework::ViewportSelectionRequestsBuilderFn& interactionRequestsBuilder);
void SetDefaultHandler();
bool InternalHandleMouseViewportInteraction(const MouseInteractionEvent& mouseInteraction);
bool InternalHandleMouseManipulatorInteraction(const MouseInteractionEvent& mouseInteraction);
void SetHandler(const AzToolsFramework::ViewportSelectionRequestsBuilderFn& interactionRequestsBuilder) override;
void SetDefaultHandler() override;
bool InternalHandleMouseViewportInteraction(const MouseInteractionEvent& mouseInteraction) override;
bool InternalHandleMouseManipulatorInteraction(const MouseInteractionEvent& mouseInteraction) override;
AZStd::function<bool(const MouseInteractionEvent& mouseInteraction)> m_internalHandleMouseViewportInteraction;
AZStd::function<bool(const MouseInteractionEvent& mouseInteraction)> m_internalHandleMouseManipulatorInteraction;
@@ -77,7 +77,7 @@ namespace UnitTest
class ViewportManipulatorControllerFixture : public AllocatorsTestFixture
{
public:
static const AzFramework::ViewportId TestViewportId = AzFramework::ViewportId(0);
static const AzFramework::ViewportId TestViewportId;
void SetUp() override
{
@@ -92,7 +92,7 @@ namespace UnitTest
m_inputChannelMapper = AZStd::make_unique<AzToolsFramework::QtEventToAzInputMapper>(m_rootWidget.get(), TestViewportId);
}
void TearDown()
void TearDown() override
{
m_inputChannelMapper.reset();
@@ -108,6 +108,8 @@ namespace UnitTest
AZStd::unique_ptr<AzToolsFramework::QtEventToAzInputMapper> m_inputChannelMapper;
};
const AzFramework::ViewportId ViewportManipulatorControllerFixture::TestViewportId = AzFramework::ViewportId(0);
TEST_F(ViewportManipulatorControllerFixture, An_event_is_not_propagated_to_the_viewport_when_a_manipulator_handles_it_first)
{
// forward input events to our controller list
+1 -1
View File
@@ -504,7 +504,7 @@ static inline QString CopyAndRemoveColorCode(const char* sText)
*d++ = *s++;
}
ret.resize(d - ret.data());
ret.resize(static_cast<int>(d - ret.data()));
return QString::fromLatin1(ret);
}
+2 -2
View File
@@ -1672,7 +1672,7 @@ void MainWindow::OnUpdateConnectionStatus()
tooltip += m_connectionListener->LastAssetProcessorTask().c_str();
tooltip += "\n";
AZStd::set<AZStd::string> failedJobs = m_connectionListener->FailedJobsList();
int failureCount = failedJobs.size();
int failureCount = static_cast<int>(failedJobs.size());
if (failureCount)
{
tooltip += "\n Failed Jobs\n";
@@ -1767,7 +1767,7 @@ void MainWindow::RegisterOpenWndCommands()
cmdUI.tooltip = (QString("Open ") + className).toUtf8().data();
cmdUI.iconFilename = className.toUtf8().data();
GetIEditor()->GetCommandManager()->RegisterUICommand("editor", openCommandName.toUtf8().data(),
"", "", AZStd::bind(&CEditorOpenViewCommand::Execute, pCmd), cmdUI);
"", "", [pCmd] { pCmd->Execute(); }, cmdUI);
GetIEditor()->GetCommandManager()->GetUIInfo("editor", openCommandName.toUtf8().data(), cmdUI);
}
}
+1 -1
View File
@@ -274,7 +274,7 @@ Matrix34 CAxisGizmo::GetTransformation(RefCoordSys coordSys, IDisplayViewport* v
//////////////////////////////////////////////////////////////////////////
bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, [[maybe_unused]] int nFlags)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
if (event == eMouseLDown)
{
+27 -27
View File
@@ -840,8 +840,8 @@ void CBaseObject::DrawDefault(DisplayContext& dc, const QColor& labelColor)
{
dc.DrawLine(GetParentAttachPointWorldTM().GetTranslation(), wp, IsFrozen() ? kLinkColorGray : kLinkColorParent, IsFrozen() ? kLinkColorGray : kLinkColorChild);
}
int nChildCount = GetChildCount();
for (int i = 0; i < nChildCount; ++i)
size_t nChildCount = GetChildCount();
for (size_t i = 0; i < nChildCount; ++i)
{
const CBaseObject* pChild = GetChild(i);
dc.DrawLine(pChild->GetParentAttachPointWorldTM().GetTranslation(), pChild->GetWorldPos(), pChild->IsFrozen() ? kLinkColorGray : kLinkColorParent, pChild->IsFrozen() ? kLinkColorGray : kLinkColorChild);
@@ -1022,10 +1022,10 @@ void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& l
if (camDist < dc.settings->GetLabelsDistance() || (dc.flags & DISPLAY_SELECTION_HELPERS))
{
float range = maxDist / 2.0f;
Vec3 c(labelColor.redF(), labelColor.greenF(), labelColor.redF());
Vec3 c(static_cast<f32>(labelColor.redF()), static_cast<f32>(labelColor.greenF()), static_cast<f32>(labelColor.redF()));
if (IsSelected())
{
c = Vec3(dc.GetSelectedColor().redF(), dc.GetSelectedColor().greenF(), dc.GetSelectedColor().blueF());
c = Vec3(static_cast<f32>(dc.GetSelectedColor().redF()), static_cast<f32>(dc.GetSelectedColor().greenF()), static_cast<f32>(dc.GetSelectedColor().blueF()));
}
float col[4] = { c.x, c.y, c.z, 1 };
@@ -1033,7 +1033,7 @@ void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& l
{
if (IsHighlighted())
{
c = Vec3(dc.GetSelectedColor().redF(), dc.GetSelectedColor().greenF(), dc.GetSelectedColor().blueF());
c = Vec3(static_cast<f32>(dc.GetSelectedColor().redF()), static_cast<f32>(dc.GetSelectedColor().greenF()), static_cast<f32>(dc.GetSelectedColor().blueF()));
}
col[0] = c.x;
col[1] = c.y;
@@ -1233,7 +1233,7 @@ float CBaseObject::GetCameraVisRatio(const CCamera& camera)
//////////////////////////////////////////////////////////////////////////
int CBaseObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
if (event == eMouseMove || event == eMouseLDown)
{
@@ -1263,9 +1263,9 @@ int CBaseObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint&
if (event == eMouseWheel)
{
double angle = 1;
float angle = 1;
Quat rot = GetRotation();
rot.SetRotationXYZ(Ang3(0, 0, rot.GetRotZ() + DEG2RAD(flags > 0 ? angle * (-1) : angle)));
rot.SetRotationXYZ(Ang3(0.f, 0.f, rot.GetRotZ() + DEG2RAD(flags > 0 ? angle * (-1) : angle)));
SetRotation(rot);
}
return MOUSECREATE_CONTINUE;
@@ -1375,7 +1375,7 @@ bool CBaseObject::IsHiddenBySpec() const
return false;
}
return (m_nMinSpec != 0 && gSettings.editorConfigSpec != 0 && m_nMinSpec > gSettings.editorConfigSpec);
return (m_nMinSpec != 0 && gSettings.editorConfigSpec != 0 && m_nMinSpec > static_cast<uint32>(gSettings.editorConfigSpec));
}
//////////////////////////////////////////////////////////////////////////
@@ -1515,8 +1515,8 @@ void CBaseObject::Serialize(CObjectArchive& ar)
SetFrozen(bFrozen);
SetHidden(bHidden);
ar.SetResolveCallback(this, parentId, AZStd::bind(&CBaseObject::ResolveParent, this, AZStd::placeholders::_1 ));
ar.SetResolveCallback(this, lookatId, AZStd::bind(&CBaseObject::SetLookAt, this, AZStd::placeholders::_1));
ar.SetResolveCallback(this, parentId, [this](CBaseObject* parent) { ResolveParent(parent); });
ar.SetResolveCallback(this, lookatId, [this](CBaseObject* target) { SetLookAt(target); });
InvalidateTM(0);
SetModified(false);
@@ -1857,10 +1857,10 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box)
const int kMaxSizeOfEdgeList0(4);
Edge2D edgelist0[kMaxSizeOfEdgeList0] = {
Edge2D(Vec2(hc.rect.left(), hc.rect.top()), Vec2(hc.rect.right(), hc.rect.top())),
Edge2D(Vec2(hc.rect.right(), hc.rect.top()), Vec2(hc.rect.right(), hc.rect.bottom())),
Edge2D(Vec2(hc.rect.right(), hc.rect.bottom()), Vec2(hc.rect.left(), hc.rect.bottom())),
Edge2D(Vec2(hc.rect.left(), hc.rect.bottom()), Vec2(hc.rect.left(), hc.rect.top()))
Edge2D(Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.top())), Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.top()))),
Edge2D(Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.top())), Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.bottom()))),
Edge2D(Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.bottom())), Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.bottom()))),
Edge2D(Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.bottom())), Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.top())))
};
const int kMaxSizeOfEdgeList1(8);
@@ -1888,12 +1888,12 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box)
pointsForRegion1.reserve(kMaxSizeOfEdgeList1);
for (int i = 0; i < kMaxSizeOfEdgeList1; ++i)
{
pointsForRegion1.push_back(Vec3(obb_p[i].x(), obb_p[i].y(), 0));
pointsForRegion1.push_back(Vec3(static_cast<f32>(obb_p[i].x()), static_cast<f32>(obb_p[i].y()), 0.0f));
}
std::vector<Vec3> convexHullForRegion1;
ConvexHull2D(convexHullForRegion1, pointsForRegion1);
nEdgeList1Count = convexHullForRegion1.size();
nEdgeList1Count = static_cast<int>(convexHullForRegion1.size());
if (nEdgeList1Count < 3 || nEdgeList1Count > kMaxSizeOfEdgeList1)
{
return true;
@@ -1928,7 +1928,7 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box)
//////////////////////////////////////////////////////////////////////////
bool CBaseObject::HitTestRect(HitContext& hc)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
AZ_PROFILE_FUNCTION(Entity);
AABB box;
@@ -1965,7 +1965,7 @@ bool CBaseObject::HitHelperTest(HitContext& hc)
//////////////////////////////////////////////////////////////////////////
bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
AZ_PROFILE_FUNCTION(Entity);
bool bResult = false;
@@ -1978,8 +1978,8 @@ bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos)
{
float fScreenScale = hc.view->GetScreenScaleFactor(pos);
iconSizeX *= OBJECT_TEXTURE_ICON_SCALE / fScreenScale;
iconSizeY *= OBJECT_TEXTURE_ICON_SCALE / fScreenScale;
iconSizeX = static_cast<int>(static_cast<float>(iconSizeX) * OBJECT_TEXTURE_ICON_SCALE / fScreenScale);
iconSizeY = static_cast<int>(static_cast<float>(iconSizeY) * OBJECT_TEXTURE_ICON_SCALE / fScreenScale);
}
// Hit Test icon of this object.
@@ -2038,7 +2038,7 @@ bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos)
//////////////////////////////////////////////////////////////////////////
CBaseObject* CBaseObject::GetChild(size_t const i) const
{
assert(i >= 0 && i < m_childs.size());
assert(i < m_childs.size());
return m_childs[i];
}
@@ -2062,7 +2062,7 @@ void CBaseObject::GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj
{
const CBaseObject* pBaseObj = pObj ? pObj : this;
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == nullptr)
@@ -2078,7 +2078,7 @@ void CBaseObject::GetAllChildren(DynArray< _smart_ptr<CBaseObject> >& outAllChil
{
const CBaseObject* pBaseObj = pObj ? pObj : this;
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == nullptr)
@@ -2094,7 +2094,7 @@ void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* p
{
const CBaseObject* pBaseObj = pObj ? pObj : this;
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == nullptr)
@@ -2114,7 +2114,7 @@ void CBaseObject::CloneChildren(CBaseObject* pFromObject)
return;
}
for (int i = 0, nChildCount(pFromObject->GetChildCount()); i < nChildCount; ++i)
for (size_t i = 0, nChildCount(pFromObject->GetChildCount()); i < nChildCount; ++i)
{
CBaseObject* pFromChildObject = pFromObject->GetChild(i);
@@ -2729,7 +2729,7 @@ void CBaseObject::SetMinSpec(uint32 nSpec, bool bSetChildren)
// Set min spec for all childs.
if (bSetChildren)
{
for (int i = m_childs.size() - 1; i >= 0; --i)
for (int i = static_cast<int>(m_childs.size()) - 1; i >= 0; --i)
{
m_childs[i]->SetMinSpec(nSpec, true);
}
+5 -5
View File
@@ -83,12 +83,12 @@ struct SANDBOX_API DisplayContext
// Draw functions
//////////////////////////////////////////////////////////////////////////
//! Set current materialc color.
void SetColor(float r, float g, float b, float a = 1) { m_color4b = ColorB(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f), int(a * 255.0f)); };
void SetColor(const Vec3& color, float a = 1) { m_color4b = ColorB(int(color.x * 255.0f), int(color.y * 255.0f), int(color.z * 255.0f), int(a * 255.0f)); };
void SetColor(const QColor& rgb, float a) { m_color4b = ColorB(rgb.red(), rgb.green(), rgb.blue(), int(a * 255.0f)); };
void SetColor(const QColor& color) { m_color4b = ColorB(color.red(), color.green(), color.blue(), color.alpha()); };
void SetColor(float r, float g, float b, float a = 1) { m_color4b = ColorB(static_cast<uint8>(r * 255.0f), static_cast<uint8>(g * 255.0f), static_cast<uint8>(b * 255.0f), static_cast<uint8>(a * 255.0f)); };
void SetColor(const Vec3& color, float a = 1) { m_color4b = ColorB(static_cast<uint8>(color.x * 255.0f), static_cast<uint8>(color.y * 255.0f), static_cast<uint8>(color.z * 255.0f), static_cast<uint8>(a * 255.0f)); };
void SetColor(const QColor& rgb, float a) { m_color4b = ColorB(static_cast<uint8>(rgb.red()), static_cast<uint8>(rgb.green()), static_cast<uint8>(rgb.blue()), static_cast<uint8>(a * 255.0f)); };
void SetColor(const QColor& color) { m_color4b = ColorB(static_cast<uint8>(color.red()), static_cast<uint8>(color.green()), static_cast<uint8>(color.blue()), static_cast<uint8>(color.alpha())); };
void SetColor(const ColorB& color) { m_color4b = color; };
void SetAlpha(float a = 1) { m_color4b.a = int(a * 255.0f); };
void SetAlpha(float a = 1) { m_color4b.a = static_cast<uint8>(a * 255.0f); };
ColorB GetColor() const { return m_color4b; }
void SetSelectedColor(float fAlpha = 1);
+5 -2
View File
@@ -63,7 +63,7 @@ void DisplayContext::InternalDrawLine(const Vec3& v0, const ColorB& colV0, const
//////////////////////////////////////////////////////////////////////////
void DisplayContext::DrawPoint(const Vec3& p, int nSize)
{
pRenderAuxGeom->DrawPoint(ToWorldSpacePosition(p), m_color4b, nSize);
pRenderAuxGeom->DrawPoint(ToWorldSpacePosition(p), m_color4b, static_cast<uint8>(nSize));
}
//////////////////////////////////////////////////////////////////////////
@@ -856,7 +856,10 @@ void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const ColorF& col1
//////////////////////////////////////////////////////////////////////////
void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const QColor& rgb1, const QColor& rgb2)
{
InternalDrawLine(ToWorldSpacePosition(p1), ColorB(rgb1.red(), rgb1.green(), rgb1.blue(), 255), ToWorldSpacePosition(p2), ColorB(rgb2.red(), rgb2.green(), rgb2.blue(), 255));
InternalDrawLine(ToWorldSpacePosition(p1),
ColorB(static_cast<uint8>(rgb1.red()), static_cast<uint8>(rgb1.green()), static_cast<uint8>(rgb1.blue()), 255),
ToWorldSpacePosition(p2),
ColorB(static_cast<uint8>(rgb2.red()), static_cast<uint8>(rgb2.green()), static_cast<uint8>(rgb2.blue()), 255));
}
//////////////////////////////////////////////////////////////////////////
+42 -39
View File
@@ -63,7 +63,7 @@ protected:
void Undo([[maybe_unused]] bool bUndo) override
{
for (int i = 0, iLinkSize(m_Links.size()); i < iLinkSize; ++i)
for (int i = 0, iLinkSize = static_cast<int>(m_Links.size()); i < iLinkSize; ++i)
{
SLink& link = m_Links[i];
CBaseObject* pObj = GetIEditor()->GetObjectManager()->FindObject(link.entityID);
@@ -230,25 +230,25 @@ CEntityObject::CEntityObject()
m_attachmentType = eAT_Pivot;
// cache all the variable callbacks, must match order of enum defined in header
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaHeightChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaLightChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaLightSizeChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaWidthChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxHeightChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxLengthChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxProjectionChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxSizeXChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxSizeYChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxSizeZChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxWidthChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnColorChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnInnerRadiusChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnOuterRadiusChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnProjectInAllDirsChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnProjectorFOVChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnProjectorTextureChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnPropertyChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnRadiusChange, this, AZStd::placeholders::_1));
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaHeightChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaLightChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaLightSizeChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaWidthChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxHeightChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxLengthChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxProjectionChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeXChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeYChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeZChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxWidthChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnColorChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnInnerRadiusChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnOuterRadiusChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectInAllDirsChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectorFOVChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectorTextureChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnPropertyChange(var); });
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnRadiusChange(var); });
}
CEntityObject::~CEntityObject()
@@ -497,7 +497,7 @@ bool CEntityObject::HitTestRect(HitContext& hc)
//////////////////////////////////////////////////////////////////////////
int CEntityObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
if (event == eMouseMove || event == eMouseLDown)
{
@@ -938,11 +938,14 @@ void CEntityObject::Serialize(CObjectArchive& ar)
eventTarget->getAttr("TargetId", targetId);
eventTarget->getAttr("Event", et.event);
eventTarget->getAttr("SourceEvent", et.sourceEvent);
m_eventTargets.push_back(et);
m_eventTargets.emplace_back(AZStd::move(et));
if (targetId != GUID_NULL)
{
using namespace AZStd::placeholders;
ar.SetResolveCallback(this, targetId, AZStd::bind(&CEntityObject::ResolveEventTarget, this, _1, _2), i);
ar.SetResolveCallback(
this, targetId,
[this](CBaseObject* object, unsigned int index) { ResolveEventTarget(object, index); },
i);
}
}
}
@@ -1217,7 +1220,7 @@ XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlN
if (!m_links.empty())
{
XmlNodeRef linksNode = objNode->newChild("EntityLinks");
for (int i = 0, num = m_links.size(); i < num; i++)
for (size_t i = 0, num = m_links.size(); i < num; i++)
{
if (m_links[i].target)
{
@@ -1283,7 +1286,7 @@ void CEntityObject::UpdateVisibility(bool bVisible)
CBaseObject::UpdateVisibility(bVisible);
bool bVisibleWithSpec = bVisible && !IsHiddenBySpec();
if (bVisibleWithSpec != m_bVisible)
if (bVisibleWithSpec != static_cast<bool>(m_bVisible))
{
m_bVisible = bVisibleWithSpec;
}
@@ -1368,8 +1371,8 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx
// Clone event targets.
if (!pFromEntity->m_eventTargets.empty())
{
int numTargets = pFromEntity->m_eventTargets.size();
for (int i = 0; i < numTargets; i++)
size_t numTargets = pFromEntity->m_eventTargets.size();
for (size_t i = 0; i < numTargets; i++)
{
CEntityEventTarget& et = pFromEntity->m_eventTargets[i];
CBaseObject* pClonedTarget = ctx.FindClone(et.target);
@@ -1386,7 +1389,7 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx
// Clone links.
if (!pFromEntity->m_links.empty())
{
int numTargets = pFromEntity->m_links.size();
int numTargets = static_cast<int>(pFromEntity->m_links.size());
for (int i = 0; i < numTargets; i++)
{
CEntityLink& et = pFromEntity->m_links[i];
@@ -1413,7 +1416,7 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx
void CEntityObject::ResolveEventTarget(CBaseObject* object, unsigned int index)
{
// Find target id.
assert(index >= 0 && index < m_eventTargets.size());
assert(index < m_eventTargets.size());
if (object)
{
object->AddEventListener(this);
@@ -1437,7 +1440,7 @@ void CEntityObject::RemoveAllEntityLinks()
{
while (!m_links.empty())
{
RemoveEntityLink(m_links.size() - 1);
RemoveEntityLink(static_cast<int>(m_links.size() - 1));
}
m_links.clear();
SetModified(false);
@@ -1448,7 +1451,7 @@ void CEntityObject::ReleaseEventTargets()
{
while (!m_eventTargets.empty())
{
RemoveEventTarget(m_eventTargets.size() - 1, false);
RemoveEventTarget(static_cast<int>(m_eventTargets.size() - 1), false);
}
m_eventTargets.clear();
SetModified(false);
@@ -1518,7 +1521,7 @@ void CEntityObject::SaveLink(XmlNodeRef xmlNode)
}
XmlNodeRef linksNode = xmlNode->newChild("EntityLinks");
for (int i = 0, num = m_links.size(); i < num; i++)
for (size_t i = 0, num = m_links.size(); i < num; i++)
{
XmlNodeRef linkNode = linksNode->newChild("Link");
linkNode->setAttr("TargetId", m_links[i].targetId);
@@ -1534,26 +1537,26 @@ void CEntityObject::OnObjectEvent(CBaseObject* target, int event)
if (event == CBaseObject::ON_DELETE)
{
// Find this target in events list and remove.
int numTargets = m_eventTargets.size();
int numTargets = static_cast<int>(m_eventTargets.size());
for (int i = 0; i < numTargets; i++)
{
if (m_eventTargets[i].target == target)
{
RemoveEventTarget(i);
numTargets = m_eventTargets.size();
numTargets = static_cast<int>(m_eventTargets.size());
i--;
}
}
}
else if (event == CBaseObject::ON_PREDELETE)
{
int numTargets = m_links.size();
int numTargets = static_cast<int>(m_links.size());
for (int i = 0; i < numTargets; i++)
{
if (m_links[i].target == target)
{
RemoveEntityLink(i);
numTargets = m_eventTargets.size();
numTargets = static_cast<int>(m_eventTargets.size());
i--;
}
}
@@ -1589,7 +1592,7 @@ int CEntityObject::AddEventTarget(CBaseObject* target, const QString& event, con
m_eventTargets.push_back(et);
SetModified(false);
return m_eventTargets.size() - 1;
return static_cast<int>(m_eventTargets.size() - 1);
}
//////////////////////////////////////////////////////////////////////////
@@ -1659,13 +1662,13 @@ int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId)
SetModified(false);
return m_links.size() - 1;
return static_cast<int>(m_links.size() - 1);
}
//////////////////////////////////////////////////////////////////////////
bool CEntityObject::EntityLinkExists(const QString& name, GUID targetEntityId)
{
for (int i = 0, num = m_links.size(); i < num; ++i)
for (size_t i = 0, num = m_links.size(); i < num; ++i)
{
if (m_links[i].targetId == targetEntityId && name.compare(m_links[i].name, Qt::CaseInsensitive) == 0)
{
+4 -4
View File
@@ -126,7 +126,7 @@ void CObjectArchive::ResolveObjects()
//////////////////////////////////////////////////////////////////////////
// Serialize All Objects from XML.
//////////////////////////////////////////////////////////////////////////
int numObj = m_loadedObjects.size();
int numObj = static_cast<int>(m_loadedObjects.size());
for (i = 0; i < numObj; i++)
{
if (m_bProgressBarEnabled)
@@ -143,7 +143,7 @@ void CObjectArchive::ResolveObjects()
m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
// Objects can be added to the list here (from Groups).
numObj = m_loadedObjects.size();
numObj = static_cast<int>(m_loadedObjects.size());
}
m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
//////////////////////////////////////////////////////////////////////////
@@ -221,7 +221,7 @@ void CObjectArchive::ResolveObjects()
//////////////////////////////////////////////////////////////////////////
// Serialize All Objects from XML.
//////////////////////////////////////////////////////////////////////////
int numObj = m_loadedObjects.size();
int numObj = static_cast<int>(m_loadedObjects.size());
for (i = 0; i < numObj; i++)
{
if (m_bProgressBarEnabled)
@@ -246,7 +246,7 @@ void CObjectArchive::ResolveObjects()
// Call PostLoad on all these objects.
//////////////////////////////////////////////////////////////////////////
{
int numObj = m_loadedObjects.size();
int numObj = static_cast<int>(m_loadedObjects.size());
for (i = 0; i < numObj; i++)
{
SLoadedObjectInfo& obj = m_loadedObjects[i];
+26 -26
View File
@@ -368,7 +368,7 @@ CBaseObject* CObjectManager::NewObject(const QString& typeName, CBaseObject* pre
//////////////////////////////////////////////////////////////////////////
void CObjectManager::DeleteObject(CBaseObject* obj)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
if (m_currEditObject == obj)
{
EndEditParams();
@@ -414,7 +414,7 @@ void CObjectManager::DeleteObject(CBaseObject* obj)
//////////////////////////////////////////////////////////////////////////
void CObjectManager::DeleteSelection(CSelectionGroup* pSelection)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
if (pSelection == nullptr)
{
return;
@@ -478,7 +478,7 @@ void CObjectManager::DeleteSelection(CSelectionGroup* pSelection)
//////////////////////////////////////////////////////////////////////////
void CObjectManager::DeleteAllObjects()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
EndEditParams();
@@ -519,7 +519,7 @@ void CObjectManager::DeleteAllObjects()
CBaseObject* CObjectManager::CloneObject(CBaseObject* obj)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
assert(obj);
//CRuntimeClass *cls = obj->GetRuntimeClass();
//CBaseObject *clone = (CBaseObject*)cls->CreateObject();
@@ -746,7 +746,7 @@ void CObjectManager::ChangeObjectName(CBaseObject* obj, const QString& newName)
//////////////////////////////////////////////////////////////////////////
int CObjectManager::GetObjectCount() const
{
return m_objects.size();
return static_cast<int>(m_objects.size());
}
//////////////////////////////////////////////////////////////////////////
@@ -765,7 +765,7 @@ void CObjectManager::GetObjects(DynArray<CBaseObject*>& objects) const
CBaseObjectsArray objectArray;
GetObjects(objectArray);
objects.clear();
for (int i = 0, iCount(objectArray.size()); i < iCount; ++i)
for (size_t i = 0, iCount(objectArray.size()); i < iCount; ++i)
{
objects.push_back(objectArray[i]);
}
@@ -1112,7 +1112,7 @@ void CObjectManager::SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading)
//////////////////////////////////////////////////////////////////////////
int CObjectManager::ClearSelection()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
// Make sure to unlock selection.
GetIEditor()->LockSelection(false);
@@ -1165,7 +1165,7 @@ int CObjectManager::ClearSelection()
//////////////////////////////////////////////////////////////////////////
int CObjectManager::InvertSelection()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
int selCount = 0;
// iterate all objects.
@@ -1189,7 +1189,7 @@ int CObjectManager::InvertSelection()
void CObjectManager::SetSelection(const QString& name)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
if (selection)
{
@@ -1202,7 +1202,7 @@ void CObjectManager::SetSelection(const QString& name)
void CObjectManager::RemoveSelection(const QString& name)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
QString selName = name;
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
@@ -1221,7 +1221,7 @@ void CObjectManager::RemoveSelection(const QString& name)
void CObjectManager::SelectCurrent()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
for (int i = 0; i < m_currSelection->GetCount(); i++)
{
CBaseObject* obj = m_currSelection->GetObject(i);
@@ -1236,7 +1236,7 @@ void CObjectManager::SelectCurrent()
void CObjectManager::UnselectCurrent()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
// Make sure to unlock selection.
GetIEditor()->LockSelection(false);
@@ -1260,7 +1260,7 @@ void CObjectManager::UnselectCurrent()
//////////////////////////////////////////////////////////////////////////
void CObjectManager::Display(DisplayContext& dc)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
int currentHideMask = GetIEditor()->GetDisplaySettings()->GetObjectHideMask();
if (m_lastHideMask != currentHideMask)
@@ -1320,7 +1320,7 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
return;
}
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
auto start = std::chrono::steady_clock::now();
CBaseObjectsCache* pDispayedViewObjects = dc.view->GetVisibleObjectsCache();
@@ -1336,11 +1336,11 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
bbox.max.zero();
pDispayedViewObjects->ClearObjects();
pDispayedViewObjects->Reserve(m_visibleObjects.size());
pDispayedViewObjects->Reserve(static_cast<int>(m_visibleObjects.size()));
if (dc.flags & DISPLAY_2D)
{
int numVis = m_visibleObjects.size();
int numVis = static_cast<int>(m_visibleObjects.size());
for (int i = 0; i < numVis; i++)
{
CBaseObject* obj = m_visibleObjects[i];
@@ -1374,7 +1374,7 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
pSelection->GetObject(0)->CBaseObject::DrawDimensions(dc, &mergedAABB);
}
int numVis = m_visibleObjects.size();
int numVis = static_cast<int>(m_visibleObjects.size());
for (int i = 0; i < numVis; i++)
{
CBaseObject* obj = m_visibleObjects[i];
@@ -1451,7 +1451,7 @@ void CObjectManager::EndEditParams([[maybe_unused]] int flags)
//! Select objects within specified distance from given position.
int CObjectManager::SelectObjects(const AABB& box, bool bUnselect)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
int numSel = 0;
AABB objBounds;
@@ -1551,7 +1551,7 @@ bool CObjectManager::IsObjectDeletionAllowed(CBaseObject* pObject)
//////////////////////////////////////////////////////////////////////////
void CObjectManager::DeleteSelection()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
// Make sure to unlock selection.
GetIEditor()->LockSelection(false);
@@ -1581,7 +1581,7 @@ void CObjectManager::DeleteSelection()
//////////////////////////////////////////////////////////////////////////
bool CObjectManager::HitTestObject(CBaseObject* obj, HitContext& hc)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
if (obj->IsFrozen())
{
@@ -1648,7 +1648,7 @@ bool CObjectManager::HitTestObject(CBaseObject* obj, HitContext& hc)
//////////////////////////////////////////////////////////////////////////
bool CObjectManager::HitTest(HitContext& hitInfo)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
hitInfo.object = nullptr;
hitInfo.dist = FLT_MAX;
@@ -1766,7 +1766,7 @@ bool CObjectManager::HitTest(HitContext& hitInfo)
}
void CObjectManager::FindObjectsInRect(CViewport* view, const QRect& rect, std::vector<GUID>& guids)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
if (rect.width() < 1 || rect.height() < 1)
{
@@ -1795,7 +1795,7 @@ void CObjectManager::FindObjectsInRect(CViewport* view, const QRect& rect, std::
//////////////////////////////////////////////////////////////////////////
void CObjectManager::SelectObjectsInRect(CViewport* view, const QRect& rect, bool bSelect)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
// Ignore too small rectangles.
if (rect.width() < 1 || rect.height() < 1)
@@ -2016,7 +2016,7 @@ void CObjectManager::GetClassCategories(QStringList& categories)
}
}
categories.clear();
categories.reserve(cset.size());
categories.reserve(static_cast<int>(cset.size()));
for (std::set<QString>::iterator cit = cset.begin(); cit != cset.end(); ++cit)
{
categories.push_back(*cit);
@@ -2363,7 +2363,7 @@ bool CObjectManager::ConvertToType(CBaseObject* pObject, const QString& typeName
//////////////////////////////////////////////////////////////////////////
void CObjectManager::SetObjectSelected(CBaseObject* pObject, bool bSelect)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
// Only select/unselect once.
if ((pObject->IsSelected() && bSelect) || (!pObject->IsSelected() && !bSelect))
{
@@ -2629,7 +2629,7 @@ void CObjectManager::EnteredComponentMode(const AZStd::vector<AZ::Uuid>& /*compo
const size_t gizmoCount = static_cast<size_t>(gizmoManager->GetGizmoCount());
for (size_t i = 0; i < gizmoCount; ++i)
{
gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(i));
gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(static_cast<int>(i)));
}
}
@@ -204,7 +204,7 @@ CUndoBaseObjectBulkSelect::CUndoBaseObjectBulkSelect(const AZStd::unordered_set<
void CUndoBaseObjectBulkSelect::Undo(bool bUndo)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
if (!bUndo)
{
return;
@@ -217,7 +217,7 @@ void CUndoBaseObjectBulkSelect::Undo(bool bUndo)
void CUndoBaseObjectBulkSelect::Redo()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
&AzToolsFramework::ToolsApplicationRequests::MarkEntitiesSelected,
@@ -256,7 +256,7 @@ CUndoBaseObjectClearSelection::CUndoBaseObjectClearSelection(const CSelectionGro
void CUndoBaseObjectClearSelection::Undo(bool bUndo)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
if (!bUndo)
{
@@ -270,7 +270,7 @@ void CUndoBaseObjectClearSelection::Undo(bool bUndo)
void CUndoBaseObjectClearSelection::Redo()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
&AzToolsFramework::ToolsApplicationRequests::SetSelectedEntities,
+3 -3
View File
@@ -109,7 +109,7 @@ bool CSelectionGroup::SameObjectType()
//////////////////////////////////////////////////////////////////////////
int CSelectionGroup::GetCount() const
{
return m_objects.size();
return static_cast<int>(m_objects.size());
}
//////////////////////////////////////////////////////////////////////////
@@ -157,7 +157,7 @@ Vec3 CSelectionGroup::GetCenter() const
}
if (GetCount() > 0)
{
c /= GetCount();
c /= static_cast<f32>(GetCount());
}
return c;
}
@@ -632,7 +632,7 @@ void CSelectionGroup::IndicateSnappingVertex(DisplayContext& dc) const
void CSelectionGroup::FinishChanges()
{
Objects selectedObjects(m_objects);
int iObjectSize(selectedObjects.size());
int iObjectSize = static_cast<int>(selectedObjects.size());
for (int i = 0; i < iObjectSize; ++i)
{
CBaseObject* pObject = selectedObjects[i];
@@ -5,8 +5,3 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
ly_add_source_properties(
SOURCES MainWindow.cpp CryEdit.cpp
PROPERTY COMPILE_OPTIONS
VALUES -bigobj
)
+1 -1
View File
@@ -136,7 +136,7 @@ IClassDesc* CClassFactory::FindClass(const char* pClassName) const
return nullptr;
}
QString name = QString(pClassName).left(pSubClassName - pClassName);
QString name = QString(pClassName).left(static_cast<int>(pSubClassName - pClassName));
return stl::find_in_map(m_nameToClass, name, (IClassDesc*)nullptr);
}
+1 -1
View File
@@ -262,7 +262,7 @@ void CPluginManager::RegisterPlugin(QLibrary* dllHandle, IPlugin* pPlugin)
entry.hLibrary = dllHandle;
entry.pPlugin = pPlugin;
m_plugins.push_back(entry);
m_uuidPluginMap[m_currentUUID] = pPlugin;
m_uuidPluginMap[static_cast<unsigned char>(m_currentUUID)] = pPlugin;
++m_currentUUID;
}
@@ -661,8 +661,8 @@ bool CComponentEntityObject::HitHelperTest(HitContext& hc)
if (IsEntityIconVisible())
{
const QPoint entityScreenPos = hc.view->WorldToView(GetWorldPos());
const float screenPosX = entityScreenPos.x();
const float screenPosY = entityScreenPos.y();
const float screenPosX = static_cast<float>(entityScreenPos.x());
const float screenPosY = static_cast<float>(entityScreenPos.y());
const float iconRange = static_cast<float>(s_kIconSize / 2);
if ((hc.point2d.x() >= screenPosX - iconRange && hc.point2d.x() <= screenPosX + iconRange)
@@ -679,7 +679,7 @@ bool CComponentEntityObject::HitHelperTest(HitContext& hc)
bool CComponentEntityObject::HitTest(HitContext& hc)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
AZ_PROFILE_FUNCTION(Entity);
if (m_iconOnlyHitTest)
{
@@ -705,7 +705,7 @@ bool CComponentEntityObject::HitTest(HitContext& hc)
[&hc, &closestDistance, &rayIntersection, &preciseSelectionRequired, viewportId](
AzToolsFramework::EditorComponentSelectionRequests* handler) -> bool
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
AZ_PROFILE_FUNCTION(Entity);
if (handler->SupportsEditorRayIntersect())
{
@@ -768,7 +768,7 @@ bool CComponentEntityObject::HitTest(HitContext& hc)
void CComponentEntityObject::GetBoundBox(AABB& box)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
AZ_PROFILE_FUNCTION(Entity);
box.Reset();
@@ -472,7 +472,7 @@ void SandboxIntegrationManager::EntityParentChanged(
const AZ::EntityId newParentId,
const AZ::EntityId oldParentId)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
if (m_unsavedEntities.find(entityId) != m_unsavedEntities.end())
{
@@ -626,7 +626,7 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con
{
view->GetDimensions(&width, &height);
}
m_contextMenuViewPoint.Set(width / 2, height / 2);
m_contextMenuViewPoint.Set(static_cast<float>(width / 2), static_cast<float>(height / 2));
}
else
{
@@ -646,16 +646,27 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con
QAction* action = nullptr;
action = menu->addAction(QObject::tr("Create entity"));
QObject::connect(action, &QAction::triggered, action, [this] { ContextMenu_NewEntity(); });
if (selected.size() == 1)
// when nothing is selected, entity is created at root level
if (selected.size() == 0)
{
action = menu->addAction(QObject::tr("Create child entity"));
QObject::connect(action, &QAction::triggered, action, [selected]
{
EBUS_EVENT(AzToolsFramework::EditorRequests::Bus, CreateNewEntityAsChild, selected.front());
});
action = menu->addAction(QObject::tr("Create entity"));
QObject::connect(
action, &QAction::triggered, action,
[this]
{
ContextMenu_NewEntity();
});
}
// when a single entity is selected, entity is created as its child
else if (selected.size() == 1)
{
action = menu->addAction(QObject::tr("Create entity"));
QObject::connect(
action, &QAction::triggered, action,
[selected]
{
EBUS_EVENT(AzToolsFramework::EditorRequests::Bus, CreateNewEntityAsChild, selected.front());
});
}
bool prefabSystemEnabled = false;
@@ -847,7 +858,7 @@ void SandboxIntegrationManager::SetupLayerContextMenu(QMenu* menu)
void SandboxIntegrationManager::SetupSliceContextMenu(QMenu* menu)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
AzToolsFramework::EntityIdList selectedEntities;
GetSelectedOrHighlightedEntities(selectedEntities);
@@ -949,7 +960,7 @@ void SandboxIntegrationManager::SetupSliceContextMenu(QMenu* menu)
void SandboxIntegrationManager::SetupSliceContextMenu_Modify(QMenu* menu, const AzToolsFramework::EntityIdList& selectedEntities, [[maybe_unused]] const AZ::u32 numEntitiesInSlices)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
using namespace AzToolsFramework;
// Gather the set of relevant entities from the selected entities and all descendants
@@ -998,7 +1009,7 @@ void SandboxIntegrationManager::HandleObjectModeSelection(const AZ::Vector2& poi
if (m_inObjectPickMode)
{
CViewport* view = GetIEditor()->GetViewManager()->GetGameViewport();
const QPoint viewPoint(point.GetX(), point.GetY());
const QPoint viewPoint(static_cast<int>(point.GetX()), static_cast<int>(point.GetY()));
HitContext hitInfo;
hitInfo.view = view;
@@ -1072,7 +1083,7 @@ void SandboxIntegrationManager::CreateEditorRepresentation(AZ::Entity* entity)
bool SandboxIntegrationManager::DestroyEditorRepresentation(AZ::EntityId entityId, bool deleteAZEntity)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
IEditor* editor = GetIEditor();
if (editor->GetObjectManager())
@@ -1084,7 +1095,7 @@ bool SandboxIntegrationManager::DestroyEditorRepresentation(AZ::EntityId entityI
{
static_cast<CComponentEntityObject*>(object)->AssignEntity(nullptr, deleteAZEntity);
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SandboxIntegrationManager::DestroyEditorRepresentation:ObjManagerDeleteObject");
AZ_PROFILE_SCOPE(AzToolsFramework, "SandboxIntegrationManager::DestroyEditorRepresentation:ObjManagerDeleteObject");
editor->GetObjectManager()->DeleteObject(object);
}
return true;
@@ -1206,7 +1217,7 @@ void SandboxIntegrationManager::ClearRedoStack()
void SandboxIntegrationManager::CloneSelection(bool& handled)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
AzToolsFramework::EntityIdList entities;
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
@@ -1440,7 +1451,7 @@ void SandboxIntegrationManager::ContextMenu_NewEntity()
// will be created at the origin.
if (view)
{
const QPoint viewPoint(m_contextMenuViewPoint.GetX(), m_contextMenuViewPoint.GetY());
const QPoint viewPoint(static_cast<int>(m_contextMenuViewPoint.GetX()), static_cast<int>(m_contextMenuViewPoint.GetY()));
worldPosition = view->GetHitLocation(viewPoint);
}
@@ -1630,7 +1641,7 @@ void SandboxIntegrationManager::InstantiateSliceFromAssetId(const AZ::Data::Asse
// will be instantiated at the origin.
if (view)
{
const QPoint viewPoint(m_contextMenuViewPoint.GetX(), m_contextMenuViewPoint.GetY());
const QPoint viewPoint(static_cast<int>(m_contextMenuViewPoint.GetX()), static_cast<int>(m_contextMenuViewPoint.GetY()));
sliceWorldTransform = AZ::Transform::CreateTranslation(LYVec3ToAZVec3(view->SnapToGrid(view->ViewToWorld(viewPoint))));
}
@@ -1839,7 +1850,7 @@ AZStd::string SandboxIntegrationManager::GetComponentEditorIcon(const AZ::Uuid&
AZStd::string SandboxIntegrationManager::GetComponentIconPath(const AZ::Uuid& componentType,
AZ::Crc32 componentIconAttrib, AZ::Component* component)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
if (componentIconAttrib != AZ::Edit::Attributes::Icon
&& componentIconAttrib != AZ::Edit::Attributes::ViewportIcon
&& componentIconAttrib != AZ::Edit::Attributes::HideIcon)
@@ -472,7 +472,7 @@ void AssetCatalogModel::LoadDatabase()
{
m_fileCacheCurrentIndex = 0;
Q_EMIT UpdateProgress(0);
Q_EMIT SetTotalProgress(m_fileCache.size());
Q_EMIT SetTotalProgress(static_cast<int>(m_fileCache.size()));
};
EBUS_EVENT(AZ::Data::AssetCatalogRequestBus, EnumerateAssets, startCB, enumerateCB, endCB);
@@ -262,7 +262,7 @@ QModelIndex ComponentDataModel::parent([[maybe_unused]] const QModelIndex &child
int ComponentDataModel::rowCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const
{
return m_componentList.size();
return static_cast<int>(m_componentList.size());
}
int ComponentDataModel::columnCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const
@@ -1054,7 +1054,7 @@ bool OutlinerListModel::dropMimeDataEntities(const QMimeData* data, Qt::DropActi
bool OutlinerListModel::CanReparentEntities(const AZ::EntityId& newParentId, const AzToolsFramework::EntityIdList &selectedEntityIds) const
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
if (selectedEntityIds.empty())
{
return false;
@@ -1143,7 +1143,7 @@ bool OutlinerListModel::CanReparentEntities(const AZ::EntityId& newParentId, con
bool OutlinerListModel::ReparentEntities(const AZ::EntityId& newParentId, const AzToolsFramework::EntityIdList &selectedEntityIds, const AZ::EntityId& beforeEntityId)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
if (!CanReparentEntities(newParentId, selectedEntityIds))
{
return false;
@@ -1233,7 +1233,7 @@ bool OutlinerListModel::ReparentEntities(const AZ::EntityId& newParentId, const
QMimeData* OutlinerListModel::mimeData(const QModelIndexList& indexes) const
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
AZ::TypeId uuid1 = AZ::AzTypeInfo<AZ::Entity>::Uuid();
AZ::TypeId uuid2 = AZ::AzTypeInfo<AzToolsFramework::EditorEntityIdContainer>::Uuid();
@@ -1323,7 +1323,7 @@ public:
void OutlinerListModel::ProcessEntityUpdates()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
m_entityChangeQueued = false;
if (m_layoutResetQueued)
{
@@ -1331,7 +1331,7 @@ void OutlinerListModel::ProcessEntityUpdates()
}
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:ExpandQueue");
AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:ExpandQueue");
for (auto entityId : m_entityExpandQueue)
{
emit ExpandEntity(entityId, IsExpanded(entityId));
@@ -1340,7 +1340,7 @@ void OutlinerListModel::ProcessEntityUpdates()
}
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:SelectQueue");
AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:SelectQueue");
for (auto entityId : m_entitySelectQueue)
{
emit SelectEntity(entityId, AzToolsFramework::IsSelected(entityId));
@@ -1350,7 +1350,7 @@ void OutlinerListModel::ProcessEntityUpdates()
if (!m_entityChangeQueue.empty())
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:ChangeQueue");
AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:ChangeQueue");
// its faster to just do a bulk data change than to carefully pick out indices
// so we'll just merge all ranges into a single range rather than try to make gaps
@@ -1383,7 +1383,7 @@ void OutlinerListModel::ProcessEntityUpdates()
}
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:LayoutChanged");
AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:LayoutChanged");
if (m_entityLayoutQueued)
{
emit layoutAboutToBeChanged();
@@ -1393,7 +1393,7 @@ void OutlinerListModel::ProcessEntityUpdates()
}
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:InvalidateFilter");
AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:InvalidateFilter");
if (m_isFilterDirty)
{
InvalidateFilter();
@@ -1416,7 +1416,7 @@ void OutlinerListModel::OnEntityInfoResetEnd()
void OutlinerListModel::ProcessEntityInfoResetEnd()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
m_layoutResetQueued = false;
m_entityChangeQueued = false;
m_entityChangeQueue.clear();
@@ -1437,7 +1437,7 @@ void OutlinerListModel::OnEntityInfoUpdatedAddChildBegin(AZ::EntityId parentId,
void OutlinerListModel::OnEntityInfoUpdatedAddChildEnd(AZ::EntityId parentId, AZ::EntityId childId)
{
(void)parentId;
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
endInsertRows();
//expand ancestors if a new descendant is already selected
@@ -1475,7 +1475,7 @@ void OutlinerListModel::OnEntityInfoUpdatedRemoveChildBegin(AZ::EntityId parentI
void OutlinerListModel::OnEntityInfoUpdatedRemoveChildEnd(AZ::EntityId parentId, AZ::EntityId childId)
{
(void)childId;
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
endResetModel();
@@ -1494,7 +1494,7 @@ void OutlinerListModel::OnEntityInfoUpdatedOrderBegin(AZ::EntityId parentId, AZ:
void OutlinerListModel::OnEntityInfoUpdatedOrderEnd(AZ::EntityId parentId, AZ::EntityId childId, AZ::u64 index)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
(void)index;
m_entityLayoutQueued = true;
QueueEntityUpdate(parentId);
@@ -1565,7 +1565,7 @@ QString OutlinerListModel::GetSliceAssetName(const AZ::EntityId& entityId) const
QModelIndex OutlinerListModel::GetIndexFromEntity(const AZ::EntityId& entityId, int column) const
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
if (entityId.IsValid())
{
@@ -1727,7 +1727,7 @@ void OutlinerListModel::OnEditorEntityDuplicated(const AZ::EntityId& oldEntity,
void OutlinerListModel::ExpandAncestors(const AZ::EntityId& entityId)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
//typically to reveal selected entities, expand all parent entities
if (entityId.IsValid())
{
@@ -1932,7 +1932,7 @@ bool OutlinerListModel::HasSelectedDescendant(const AZ::EntityId& entityId) cons
bool OutlinerListModel::AreAllDescendantsSameLockState(const AZ::EntityId& entityId) const
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
//TODO result can be cached in mutable map and cleared when any descendant changes to avoid recursion in deep hierarchies
bool isLocked = false;
AzToolsFramework::EditorEntityInfoRequestBus::EventResult(isLocked, entityId, &AzToolsFramework::EditorEntityInfoRequestBus::Events::IsJustThisEntityLocked);
@@ -1953,7 +1953,7 @@ bool OutlinerListModel::AreAllDescendantsSameLockState(const AZ::EntityId& entit
bool OutlinerListModel::AreAllDescendantsSameVisibleState(const AZ::EntityId& entityId) const
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
//TODO result can be cached in mutable map and cleared when any descendant changes to avoid recursion in deep hierarchies
bool isVisible = AzToolsFramework::IsEntitySetToBeVisible(entityId);
@@ -2476,10 +2476,10 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
auto backgroundBoxRect = option.rect;
backgroundBoxRect.setX(backgroundBoxRect.x() + 0.5);
backgroundBoxRect.setY(backgroundBoxRect.y() + 2.5);
backgroundBoxRect.setWidth(backgroundBoxRect.width() - 1.0);
backgroundBoxRect.setHeight(backgroundBoxRect.height() - 1.0);
backgroundBoxRect.setX(static_cast<int>(backgroundBoxRect.x() + 0.5f));
backgroundBoxRect.setY(static_cast<int>(backgroundBoxRect.y() + 2.5f));
backgroundBoxRect.setWidth(static_cast<int>(backgroundBoxRect.width() - 1.0f));
backgroundBoxRect.setHeight(static_cast<int>(backgroundBoxRect.height() - 1.0f));
const qreal sliceBorderHeight = 0.8f;
@@ -2513,7 +2513,7 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
else
{
auto newRect = option.rect;
newRect.setHeight(newRect.height() - 1.0);
newRect.setHeight(static_cast<int>(newRect.height() - 1.0f));
path.addRect(newRect);
}
@@ -2597,7 +2597,7 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
QString htmlStripped = layerInfoString;
htmlStripped.remove(htmlMarkupRegex);
const float layerInfoPadding = 1.2f;
textWidthAvailable -= fontMetrics.horizontalAdvance(htmlStripped) * layerInfoPadding;
textWidthAvailable -= static_cast<int>(fontMetrics.horizontalAdvance(htmlStripped) * layerInfoPadding);
}
entityNameRichText = fontMetrics.elidedText(optionV4.text, Qt::TextElideMode::ElideRight, textWidthAvailable);
@@ -274,8 +274,8 @@ void OutlinerTreeView::drawBranches(QPainter* painter, const QRect& rect, const
// if the item has children offset the drawn line to compensate for drawn expander buttons
bool hasChildren = previousIndex.model()->index(0, 0, previousIndex).isValid();
int horizontalLineY = rect.top() + rectHalfHeight;
int horizontalLineLeft = rect.right() - indentation() * 1.5f;
int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : (lineBaseX - indentation() * 0.5f);
int horizontalLineLeft = static_cast<int>(rect.right() - indentation() * 1.5f);
int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : static_cast<int>(lineBaseX - indentation() * 0.5f);
painter->drawLine(horizontalLineLeft, horizontalLineY, horizontalLineRight, horizontalLineY);
}
@@ -284,7 +284,7 @@ void OutlinerTreeView::drawBranches(QPainter* painter, const QRect& rect, const
bool hasNext = previousIndex.sibling(previousIndex.row() + 1, previousIndex.column()).isValid();
if (hasNext || previousIndex == index)
{
int verticalLineX = lineBaseX - indentation() * 1.5f;
int verticalLineX = static_cast<int>(lineBaseX - indentation() * 1.5f);
int verticalLineTop = rect.top();
int verticalLineBottom = hasNext ? rect.bottom() : rect.bottom() - rectHalfHeight;
painter->drawLine(verticalLineX, verticalLineTop, verticalLineX, verticalLineBottom);
@@ -96,7 +96,7 @@ namespace
void SortEntityChildren(AZ::EntityId entityId, const EntityIdCompareFunc& comparer, AzToolsFramework::EntityOrderArray* newEntityOrder = nullptr)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
AzToolsFramework::EntityOrderArray entityOrderArray = AzToolsFramework::GetEntityChildOrder(entityId);
AZStd::sort(entityOrderArray.begin(), entityOrderArray.end(), comparer);
@@ -110,7 +110,7 @@ namespace
void SortEntityChildrenRecursively(AZ::EntityId entityId, const EntityIdCompareFunc& comparer)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
AzToolsFramework::EntityOrderArray entityOrderArray;
SortEntityChildren(entityId, comparer, &entityOrderArray);
@@ -303,7 +303,7 @@ void OutlinerWidget::OnSelectionChanged(const QItemSelection& selected, const QI
return;
}
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
AzToolsFramework::EntityIdList newlySelected;
ExtractEntityIdsFromSelection(selected, newlySelected);
@@ -450,7 +450,7 @@ void OutlinerWidget::UpdateSelection()
{
if (m_selectionChangeQueued)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
m_selectionChangeInProgress = true;
@@ -458,7 +458,7 @@ void OutlinerWidget::UpdateSelection()
{
// Calling Deselect for a large number of items is very slow,
// use a single ClearAndSelect call instead.
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:ClearAndSelect");
AZ_PROFILE_SCOPE(AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:ClearAndSelect");
AzToolsFramework::EntityIdList selectedEntities;
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntities, &AzToolsFramework::ToolsApplicationRequests::Bus::Events::GetSelectedEntities);
@@ -469,12 +469,12 @@ void OutlinerWidget::UpdateSelection()
else
{
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Deselect");
AZ_PROFILE_SCOPE(AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Deselect");
m_gui->m_objectTree->selectionModel()->select(
BuildSelectionFromEntities(m_entitiesToDeselect), QItemSelectionModel::Deselect);
}
{
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Select");
AZ_PROFILE_SCOPE(AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Select");
m_gui->m_objectTree->selectionModel()->select(
BuildSelectionFromEntities(m_entitiesToSelect), QItemSelectionModel::Select);
}
@@ -497,7 +497,7 @@ void OutlinerWidget::UpdateSelection()
template <class EntityIdCollection>
QItemSelection OutlinerWidget::BuildSelectionFromEntities(const EntityIdCollection& entityIds)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
QItemSelection selection;
for (const auto& entityId : entityIds)
@@ -517,7 +517,7 @@ QItemSelection OutlinerWidget::BuildSelectionFromEntities(const EntityIdCollecti
void OutlinerWidget::contextMenuEvent(QContextMenuEvent* event)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
bool isDocumentOpen = false;
EBUS_EVENT_RESULT(isDocumentOpen, AzToolsFramework::EditorRequests::Bus, IsLevelDocumentOpen);
@@ -1272,7 +1272,7 @@ void OutlinerWidget::ExtractEntityIdsFromSelection(const QItemSelection& selecti
void OutlinerWidget::OnSearchTextChanged(const QString& activeTextFilter)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
AZStd::string filterString = activeTextFilter.toUtf8().data();
m_listModel->SearchStringChanged(filterString);
@@ -1388,7 +1388,7 @@ void OutlinerWidget::QueueContentUpdateSort(const AZ::EntityId& entityId)
void OutlinerWidget::SortContent()
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
m_sortContentQueued = false;
@@ -1424,7 +1424,7 @@ void OutlinerWidget::OnSortModeChanged(EntityOutliner::DisplaySortMode sortMode)
if (sortMode != EntityOutliner::DisplaySortMode::Manually)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZ_PROFILE_FUNCTION(AzToolsFramework);
auto comparer = AZStd::bind(&CompareEntitiesForSorting, AZStd::placeholders::_1, AZStd::placeholders::_2, sortMode);
SortEntityChildrenRecursively(AZ::EntityId(), comparer);
}
@@ -43,7 +43,7 @@ AssetImporterDocument::AssetImporterDocument()
bool AssetImporterDocument::LoadScene(const AZStd::string& sceneFullPath)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
namespace SceneEvents = AZ::SceneAPI::Events;
SceneEvents::SceneSerializationBus::BroadcastResult(m_scene, &SceneEvents::SceneSerializationBus::Events::LoadScene, sceneFullPath, AZ::Uuid::CreateNull());
return !!m_scene;
@@ -500,10 +500,10 @@ void AssetImporterWindow::SetTitle(const char* filePath)
AZStd::string extension;
if (AzFramework::StringFunc::Path::GetExtension(filePath, extension, false))
{
extension[0] = toupper(extension[0]);
extension[0] = static_cast<char>(toupper(extension[0]));
for (size_t i = 1; i < extension.size(); ++i)
{
extension[i] = tolower(extension[i]);
extension[i] = static_cast<char>(tolower(extension[i]));
}
}
else
@@ -45,7 +45,7 @@ AZ::SceneAPI::UI::ManifestWidget* ImporterRootDisplay::GetManifestWidget()
void ImporterRootDisplay::SetSceneDisplay(const QString& headerText, const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& scene)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
if (!scene)
{
AZ_Assert(scene, "No scene provided to display.");
@@ -62,7 +62,7 @@ void ImporterRootDisplay::SetSceneDisplay(const QString& headerText, const AZStd
void ImporterRootDisplay::HandleSceneWasReset(const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& scene)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
// Don't accept updates while the widget is being filled in.
BusDisconnect();
m_manifestWidget->BuildFromScene(scene);
@@ -6,6 +6,7 @@
*
*/
#include <AzCore/Debug/Profiler.h>
#include <AzCore/IO/SystemFile.h>
#include <AzCore/std/algorithm.h>
#include <AzCore/std/string/conversions.h>
@@ -37,7 +38,7 @@ namespace AZ
AZStd::shared_ptr<SceneAPI::Containers::Scene> SceneSerializationHandler::LoadScene(
const AZStd::string& filePath, Uuid sceneSourceGuid)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
AZ_PROFILE_FUNCTION(Editor);
namespace Utilities = AZ::SceneAPI::Utilities;
using AZ::SceneAPI::Events::AssetImportRequest;
@@ -12,6 +12,8 @@
#include <QPainter>
#include <QPalette>
#include <AzCore/Casting/numeric_cast.h>
namespace DrawingPrimitives
{
void DrawTimeSlider(QPainter& painter, const QPalette& palette, const STimeSliderOptions& options)
@@ -9,8 +9,6 @@
#include "platform.h"
#pragma warning(disable: 4266) // disabled warning from afk overrides
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
#include <afxwin.h>
#include <vector>
@@ -30,13 +28,10 @@
#include "QtUtil.h"
// ugly dependencies:
#pragma warning(push)
#pragma warning(disable: 4244) // warning C4244: 'argument' : conversion from 'A' to 'B', possible loss of data
#include "Functor.h"
class CXmlArchive;
#include <IRenderer.h>
#include "Util/PathUtil.h"
#pragma warning(pop)
// ^^^
// ---------------------------------------------------------------------------
+1 -1
View File
@@ -89,7 +89,7 @@ REFGUID CStdPreferencesClassDesc::ClassID()
//////////////////////////////////////////////////////////////////////////
int CStdPreferencesClassDesc::GetPagesCount()
{
return m_pageCreators.size();
return static_cast<int>(m_pageCreators.size());
}
IPreferencesPage* CStdPreferencesClassDesc::CreateEditorPreferencesPage(int index)
+3 -5
View File
@@ -76,7 +76,7 @@ namespace
}
else if (pCVar->GetType() == CVAR_FLOAT)
{
PySetCVarFromFloat(pName, std::stod(pValue));
PySetCVarFromFloat(pName, static_cast<float>(std::stod(pValue)));
}
else if (pCVar->GetType() != CVAR_STRING)
{
@@ -152,11 +152,11 @@ namespace
}
else if (pCVar->GetType() == CVAR_INT)
{
PySetCVarFromInt(pName, AZStd::any_cast<AZ::s64>(value));
PySetCVarFromInt(pName, static_cast<int>(AZStd::any_cast<AZ::s64>(value)));
}
else if (pCVar->GetType() == CVAR_FLOAT)
{
PySetCVarFromFloat(pName, AZStd::any_cast<double>(value));
PySetCVarFromFloat(pName, static_cast<float>(AZStd::any_cast<double>(value)));
}
else if (pCVar->GetType() == CVAR_STRING)
{
@@ -548,13 +548,11 @@ namespace
if (title.empty())
{
throw std::runtime_error("Incorrect title argument passed in. ");
return result;
}
if (values.size() == 0)
{
throw std::runtime_error("Empty value list passed in. ");
return result;
}
QStringList list;
+1 -1
View File
@@ -31,7 +31,7 @@ int PixmapLabelPreview::heightForWidth(int width) const
return width;
}
return ((qreal)m_pixmap.height() * width) / m_pixmap.width();
return static_cast<int>(((qreal)m_pixmap.height() * width) / m_pixmap.width());
}
+3 -3
View File
@@ -184,7 +184,7 @@ bool QtViewPane::CloseInstance(QDockWidget* dockWidget, CloseModes closeModes)
const int numTopLevel = topLevelWidgets.size();
for (size_t i = 0; i < numTopLevel; ++i)
{
QWidget* widget = topLevelWidgets[i];
QWidget* widget = topLevelWidgets[static_cast<int>(i)];
if (widget->isModal() && widget->isVisible())
{
widget->activateWindow();
@@ -1102,7 +1102,7 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
entityInspectorViewPane->m_dockWidget->setFloating(false);
static const float tabWidgetWidthPercentage = 0.2f;
int newWidth = (float)screenWidth * tabWidgetWidthPercentage;
int newWidth = static_cast<int>((float)screenWidth * tabWidgetWidthPercentage);
if (levelInspectorPane)
{
@@ -1139,7 +1139,7 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
// so that they get an appropriate default width since the minimum sizes have
// been removed from these widgets
static const float entityOutlinerWidthPercentage = 0.15f;
int newWidth = (float)screenWidth * entityOutlinerWidthPercentage;
int newWidth = static_cast<int>((float)screenWidth * entityOutlinerWidthPercentage);
m_mainWindow->resizeDocks({ entityOutlinerViewPane->m_dockWidget }, { newWidth }, Qt::Horizontal);
}
+2 -2
View File
@@ -394,7 +394,7 @@ void SEditorSettings::LoadValue(const char* sSection, const char* sKey, float& v
{
const SettingsGroup sg(sSection);
const QString defaultVal = s_editorSettings()->value(sKey, QString::number(value)).toString();
value = defaultVal.toDouble();
value = defaultVal.toFloat();
if (GetIEditor()->GetSettingsManager())
{
@@ -1061,7 +1061,7 @@ void SEditorSettings::ConvertPath(const AZStd::string_view sourcePath, AZStd::st
// The reason for the difference is to have this API be consistent with the path syntax in Open 3D Engine Python APIs.
// Find the last pipe separator ("|") in the path
int lastSeparator = sourcePath.find_last_of("|");
size_t lastSeparator = sourcePath.find_last_of("|");
// Everything before the last separator is the category (since only the category is hierarchical)
category = sourcePath.substr(0, lastSeparator);
+3 -6
View File
@@ -60,7 +60,7 @@ void CToolBoxCommand::Execute() const
// Toggle the variable.
float val = GetIEditor()->GetConsoleVar(m_text.toUtf8().data());
bool bOn = val != 0;
GetIEditor()->SetConsoleVar(m_text.toUtf8().data(), (bOn) ? 0 : 1);
GetIEditor()->SetConsoleVar(m_text.toUtf8().data(), (bOn) ? 0.0f : 1.0f);
}
else
{
@@ -186,7 +186,6 @@ const CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox) const
assert(0 <= iIndex && iIndex < m_shelveMacros.size());
return m_shelveMacros[iIndex];
}
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -202,7 +201,6 @@ CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox)
assert(0 <= iIndex && iIndex < m_shelveMacros.size());
return m_shelveMacros[iIndex];
}
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -237,7 +235,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in
{
if (bToolbox)
{
const int macroCount = m_macros.size();
const int macroCount = static_cast<int>(m_macros.size());
if (macroCount > ID_TOOL_LAST - ID_TOOL_FIRST + 1)
{
return nullptr;
@@ -261,7 +259,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in
}
else
{
const int shelveMacroCount = m_shelveMacros.size();
const int shelveMacroCount = static_cast<int>(m_shelveMacros.size());
if (shelveMacroCount > ID_TOOL_SHELVE_LAST - ID_TOOL_SHELVE_FIRST + 1)
{
return nullptr;
@@ -275,7 +273,6 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in
m_shelveMacros.push_back(pNewTool);
return pNewTool;
}
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -503,7 +503,7 @@ void ToolbarManager::InitializeStandardToolbars()
{
auto macroToolbars = GetIEditor()->GetToolBoxManager()->GetToolbars();
m_standardToolbars.reserve(5 + macroToolbars.size());
m_standardToolbars.reserve(static_cast<int>(5 + macroToolbars.size()));
m_standardToolbars.push_back(GetEditModeToolbar());
m_standardToolbars.push_back(GetObjectToolbar());
m_standardToolbars.push_back(GetPlayConsoleToolbar());
+1 -1
View File
@@ -840,7 +840,7 @@ void CToolsConfigPage::FillScriptCmds()
{
EditorPythonConsoleInterface::GlobalFunctionCollection globalFunctionCollection;
editorPythonConsoleInterface->GetGlobalFunctionList(globalFunctionCollection);
commands.reserve(globalFunctionCollection.size());
commands.reserve(static_cast<int>(globalFunctionCollection.size()));
for (const EditorPythonConsoleInterface::GlobalFunction& globalFunction : globalFunctionCollection)
{
const QString fullCmd = QString("%1.%2()").arg(globalFunction.m_moduleName.data()).arg(globalFunction.m_functionName.data());
@@ -122,7 +122,7 @@ void CCommentKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle& sel
for (size_t keyIndex = 0, num = selectedKeys.GetKeyCount(); keyIndex < num; keyIndex++)
{
CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex);
CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(static_cast<unsigned int>(keyIndex));
CAnimParamType paramType = keyHandle.GetTrack()->GetParameterType();
if (paramType == AnimParamType::CommentText)
@@ -128,7 +128,7 @@ void CScreenFaderKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle&
for (size_t keyIndex = 0, num = selectedKeys.GetKeyCount(); keyIndex < num; ++keyIndex)
{
CTrackViewKeyHandle selectedKey = selectedKeys.GetKey(keyIndex);
CTrackViewKeyHandle selectedKey = selectedKeys.GetKey(static_cast<unsigned int>(keyIndex));
CAnimParamType paramType = selectedKey.GetTrack()->GetParameterType();
if (paramType == AnimParamType::ScreenFader)
@@ -93,7 +93,7 @@ static void UpdateAtomOutputFrameCaptureView(TrackView::AtomOutputFrameCapture&
const AZ::EntityId activeCameraEntityId = TrackView::ActiveCameraEntityId();
atomOutputFrameCapture.UpdateView(
TrackView::TransformFromEntityId(activeCameraEntityId),
TrackView::ProjectionFromCameraEntityId(activeCameraEntityId, width, height));
TrackView::ProjectionFromCameraEntityId(activeCameraEntityId, static_cast<float>(width), static_cast<float>(height)));
}
CSequenceBatchRenderDialog::CSequenceBatchRenderDialog(float fps, QWidget* pParent /* = nullptr */)
@@ -170,10 +170,10 @@ void CSequenceBatchRenderDialog::OnInitDialog()
connect(m_ui->m_endFrame, editingFinished, this, &CSequenceBatchRenderDialog::OnEndFrameChange);
connect(m_ui->m_imageFormatCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &CSequenceBatchRenderDialog::OnImageFormatChange);
const float bigEnoughNumber = 1000000.0f;
m_ui->m_startFrame->setRange(0.0f, bigEnoughNumber);
const int bigEnoughNumber = 1000000;
m_ui->m_startFrame->setRange(0, bigEnoughNumber);
m_ui->m_endFrame->setRange(0.0f, bigEnoughNumber);
m_ui->m_endFrame->setRange(0, bigEnoughNumber);
// Fill the sequence combo box.
bool activeSequenceWasSet = false;
@@ -301,8 +301,8 @@ void CSequenceBatchRenderDialog::OnRenderItemSelChange()
}
}
// frame range
m_ui->m_startFrame->setValue(item.frameRange.start * m_fpsForTimeToFrameConversion);
m_ui->m_endFrame->setValue(item.frameRange.end * m_fpsForTimeToFrameConversion);
m_ui->m_startFrame->setValue(static_cast<int>(item.frameRange.start * m_fpsForTimeToFrameConversion));
m_ui->m_endFrame->setValue(static_cast<int>(item.frameRange.end * m_fpsForTimeToFrameConversion));
// folder
m_ui->m_destinationEdit->setText(item.folder);
// fps
@@ -357,7 +357,7 @@ void CSequenceBatchRenderDialog::OnRenderItemSelChange()
QString cvarsText;
for (size_t i = 0; i < item.cvars.size(); ++i)
{
cvarsText += item.cvars[i];
cvarsText += item.cvars[static_cast<int>(i)];
cvarsText += "\r\n";
}
m_ui->m_cvarsEdit->setPlainText(cvarsText);
@@ -580,12 +580,12 @@ void CSequenceBatchRenderDialog::OnSequenceSelected()
// Adjust the frame range.
float sFrame = pSequence->GetTimeRange().start * m_fpsForTimeToFrameConversion;
float eFrame = pSequence->GetTimeRange().end * m_fpsForTimeToFrameConversion;
m_ui->m_startFrame->setRange(0.0f, eFrame);
m_ui->m_endFrame->setRange(0.0f, eFrame);
m_ui->m_startFrame->setRange(0, static_cast<int>(eFrame));
m_ui->m_endFrame->setRange(0, static_cast<int>(eFrame));
// Set the default start/end frames properly.
m_ui->m_startFrame->setValue(sFrame);
m_ui->m_endFrame->setValue(eFrame);
m_ui->m_startFrame->setValue(static_cast<int>(sFrame));
m_ui->m_endFrame->setValue(static_cast<int>(eFrame));
m_ui->m_shotCombo->clear();
// Fill the shot combo box with the names of director nodes.
@@ -894,7 +894,7 @@ void CSequenceBatchRenderDialog::CaptureItemStart()
// Set up the custom config cvars for this item.
for (size_t i = 0; i < renderItem.cvars.size(); ++i)
{
GetIEditor()->GetSystem()->GetIConsole()->ExecuteString(renderItem.cvars[i].toUtf8().data());
GetIEditor()->GetSystem()->GetIConsole()->ExecuteString(renderItem.cvars[static_cast<int>(i)].toUtf8().data());
}
// Set specific capture options for this item.
@@ -1519,7 +1519,7 @@ void CSequenceBatchRenderDialog::OnSaveBatch()
// cvars
for (size_t k = 0; k < item.cvars.size(); ++k)
{
itemNode->newChild("cvar")->setContent(item.cvars[k].toUtf8().data());
itemNode->newChild("cvar")->setContent(item.cvars[static_cast<int>(k)].toUtf8().data());
}
}
@@ -84,7 +84,7 @@ bool CSequenceKeyUIControls::OnKeySelectionChange(CTrackViewKeyBundle& selectedK
mv_sequence->AddEnumItem(QObject::tr("<None>"), CTrackViewDialog::GetEntityIdAsString(AZ::EntityId(AZ::EntityId::InvalidEntityId)));
const CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager();
for (int i = 0; i < pSequenceManager->GetCount(); ++i)
for (unsigned int i = 0; i < pSequenceManager->GetCount(); ++i)
{
CTrackViewSequence* pCurrentSequence = pSequenceManager->GetSequenceByIndex(i);
bool bNotMe = pCurrentSequence != pSequence;
@@ -367,7 +367,7 @@ bool CTVCustomizeTrackColorsDlg::Import(const QString& fullPath)
{
return entry.paramType == paramType;
});
int entryIndex = pEntry - g_trackEntries;
int entryIndex = static_cast<int>(pEntry - g_trackEntries);
if (entryIndex >= arraysize(g_trackEntries)) // If not found, skip this.
{
continue;
@@ -56,7 +56,7 @@ private:
inline void GetQColorFromXmlNode(QColor& colorOut, const XmlNodeRef& xmlNode) const
{
QRgb rgb = -1;
QRgb rgb = std::numeric_limits<unsigned int>::max();
xmlNode->getAttr("color", rgb);
colorOut.setRgb(rgb);
};
+1 -1
View File
@@ -363,7 +363,7 @@ int TVEventsModel::GetNumberOfUsageAndFirstTimeUsed(const char* eventName, float
{
CTrackViewTrack* pTrack = tracks.GetTrack(currentTrack);
for (int currentKey = 0; currentKey < pTrack->GetKeyCount(); ++currentKey)
for (unsigned int currentKey = 0; currentKey < pTrack->GetKeyCount(); ++currentKey)
{
CTrackViewKeyHandle keyHandle = pTrack->GetKey(currentKey);
+6 -6
View File
@@ -106,8 +106,8 @@ void CTVSequenceProps::MoveScaleKeys()
// Move/Rescale the sequence to a new time range.
Range timeRangeOld = m_pSequence->GetTimeRange();
Range timeRangeNew;
timeRangeNew.start = ui->START_TIME->value();
timeRangeNew.end = ui->END_TIME->value();
timeRangeNew.start = static_cast<float>(ui->START_TIME->value());
timeRangeNew.end = static_cast<float>(ui->END_TIME->value());
if (!(timeRangeNew == timeRangeOld))
{
@@ -123,14 +123,14 @@ void CTVSequenceProps::UpdateSequenceProps(const QString& name)
}
Range timeRange;
timeRange.start = ui->START_TIME->value();
timeRange.end = ui->END_TIME->value();
timeRange.start = static_cast<float>(ui->START_TIME->value());
timeRange.end = static_cast<float>(ui->END_TIME->value());
if (m_timeUnit == Frames)
{
float invFPS = 1.0f / m_FPS;
timeRange.start = ui->START_TIME->value() * invFPS;
timeRange.end = ui->END_TIME->value() * invFPS;
timeRange.start = static_cast<float>(ui->START_TIME->value()) * invFPS;
timeRange.end = static_cast<float>(ui->END_TIME->value()) * invFPS;
}
m_pSequence->SetTimeRange(timeRange);
+3 -3
View File
@@ -452,7 +452,7 @@ CTrackViewAnimNode* CTrackViewAnimNode::CreateSubNode(
{
// Check for a duplicates
CTrackViewAnimNodeBundle azEntityNodesFound = director2->GetAnimNodesByType(AnimNodeType::AzEntity);
for (int x = 0; x < azEntityNodesFound.GetCount(); x++)
for (unsigned int x = 0; x < azEntityNodesFound.GetCount(); x++)
{
if (azEntityNodesFound.GetNode(x)->GetAzEntityId() == owner)
{
@@ -1477,7 +1477,7 @@ bool CTrackViewAnimNode::PasteNodesFromClipboard(QWidget* context)
AZStd::map<int, IAnimNode*> copiedIdToNodeMap;
const unsigned int numNodes = animNodesRoot->getChildCount();
for (int i = 0; i < numNodes; ++i)
for (unsigned int i = 0; i < numNodes; ++i)
{
XmlNodeRef xmlNode = animNodesRoot->getChild(i);
@@ -2123,7 +2123,7 @@ bool CTrackViewAnimNode::ContainsComponentWithId(AZ::ComponentId componentId) co
if (GetType() == AnimNodeType::AzEntity)
{
// search for a matching componentId on all children
for (int i = 0; i < GetChildCount(); i++)
for (unsigned int i = 0; i < GetChildCount(); i++)
{
CTrackViewNode* childNode = GetChild(i);
if (childNode->GetNodeType() == eTVNT_AnimNode)
@@ -145,7 +145,7 @@ void CTrackViewCurveEditor::UpdateSplines()
std::set<CTrackViewTrack*> newTracks;
if (selectedTracks.AreAllOfSameType())
{
for (int i = 0; i < selectedTracks.GetCount(); i++)
for (unsigned int i = 0; i < selectedTracks.GetCount(); i++)
{
CTrackViewTrack* pTrack = selectedTracks.GetTrack(i);
+8 -8
View File
@@ -782,7 +782,7 @@ void CTrackViewDialog::UpdateActions()
}
bool allSelectedTracksUseMute = true;
for (int i = 0; i < selectedTrackCount; i++)
for (unsigned int i = 0; i < selectedTrackCount; i++)
{
CTrackViewTrack* pTrack = selectedTracks.GetTrack(i);
if (pTrack && !pTrack->UsesMute())
@@ -1121,7 +1121,7 @@ void CTrackViewDialog::ReloadSequencesComboBox()
CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager();
const unsigned int numSequences = pSequenceManager->GetCount();
for (int k = 0; k < numSequences; ++k)
for (unsigned int k = 0; k < numSequences; ++k)
{
CTrackViewSequence* sequence = pSequenceManager->GetSequenceByIndex(k);
QString entityIdString = GetEntityIdAsString(sequence->GetSequenceComponentEntityId());
@@ -1559,7 +1559,7 @@ void CTrackViewDialog::OnAddSelectedNode()
selectedEntitiesCount, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntitiesCount);
// check to make sure all nodes were added and notify user if they weren't
if (addedNodes.GetCount() != selectedEntitiesCount)
if (addedNodes.GetCount() != static_cast<unsigned int>(selectedEntitiesCount))
{
IMovieSystem* movieSystem = GetIEditor()->GetMovieSystem();
@@ -1765,7 +1765,7 @@ void CTrackViewDialog::OnSnapFPS()
if (ok)
{
m_wndDopeSheet->SetSnapFPS(fps);
m_wndCurveEditor->SetFPS(fps);
m_wndCurveEditor->SetFPS(static_cast<float>(fps));
SetCursorPosText(GetIEditor()->GetAnimation()->GetTime());
}
@@ -1799,7 +1799,7 @@ void CTrackViewDialog::SaveMiscSettings() const
settings.setValue(s_kFrameSnappingFPSEntry, fps);
settings.setValue(s_kTickDisplayModeEntry, static_cast<int>(m_wndDopeSheet->GetTickDisplayMode()));
settings.setValue(s_kDefaultTracksEntry, QByteArray(reinterpret_cast<const char*>(m_defaultTracksForEntityNode.data()),
m_defaultTracksForEntityNode.size() * sizeof(AnimParamType)));
static_cast<int>(m_defaultTracksForEntityNode.size() * sizeof(AnimParamType))));
}
//////////////////////////////////////////////////////////////////////////
@@ -1828,7 +1828,7 @@ void CTrackViewDialog::ReadMiscSettings()
if (settings.contains(s_kFrameSnappingFPSEntry))
{
float fps = settings.value(s_kFrameSnappingFPSEntry).toDouble();
float fps = settings.value(s_kFrameSnappingFPSEntry).toFloat();
if (fps >= s_kMinimumFrameSnappingFPS && fps <= s_kMaximumFrameSnappingFPS)
{
m_wndDopeSheet->SetSnapFPS(FloatToIntRet(fps));
@@ -1991,7 +1991,7 @@ void CTrackViewDialog::UpdateTracksToolBar()
&Maestro::EditorSequenceComponentRequestBus::Events::GetAllAnimatablePropertiesForComponent,
animatableProperties, azEntityId, pAnimNode->GetComponentId());
paramCount = animatableProperties.size();
paramCount = static_cast<int>(animatableProperties.size());
}
}
else
@@ -2317,7 +2317,7 @@ void CTrackViewDialog::SaveCurrentSequenceToFBX()
CTrackViewTrackBundle allTracks = sequence->GetAllTracks();
for (int trackID = 0; trackID < allTracks.GetCount(); ++trackID)
for (unsigned int trackID = 0; trackID < allTracks.GetCount(); ++trackID)
{
CTrackViewTrack* pCurrentTrack = allTracks.GetTrack(trackID);
@@ -146,8 +146,7 @@ CTrackViewDopeSheetBase::~CTrackViewDopeSheetBase()
//////////////////////////////////////////////////////////////////////////
int CTrackViewDopeSheetBase::TimeToClient(float time) const
{
int x = m_leftOffset - m_scrollOffset.x() + (time * m_timeScale);
return x;
return static_cast<int>(m_leftOffset - m_scrollOffset.x() + (time * m_timeScale));
}
//////////////////////////////////////////////////////////////////////////
@@ -193,7 +192,7 @@ void CTrackViewDopeSheetBase::SetTimeRange(float start, float end)
m_timeRange.Set(start, end);
SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale - m_leftOffset);
SetHorizontalExtent(-m_leftOffset, static_cast<int>(m_timeRange.end * m_timeScale - m_leftOffset));
}
//////////////////////////////////////////////////////////////////////////
@@ -258,12 +257,12 @@ void CTrackViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime)
while (fPixelsPerTick >= 12.0 && steps < 100);
float fCurrentOffset = -fAnchorTime * m_timeScale;
m_scrollOffset.rx() += fOldOffset - fCurrentOffset;
m_scrollOffset.rx() += static_cast<int>(fOldOffset - fCurrentOffset);
m_scrollBar->setValue(m_scrollOffset.x());
update();
SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale);
SetHorizontalExtent(-m_leftOffset, static_cast<int>(m_timeRange.end * m_timeScale));
ComputeFrameSteps(GetVisibleRange());
@@ -353,15 +352,15 @@ float CTrackViewDopeSheetBase::TickSnap(float time) const
double tickTime = GetTickTime();
double t = floor(((double)time / tickTime) + 0.5);
t *= tickTime;
return t;
return static_cast<float>(t);
}
//////////////////////////////////////////////////////////////////////////
float CTrackViewDopeSheetBase::TimeFromPoint(const QPoint& point) const
{
int x = point.x() - m_leftOffset + m_scrollOffset.x();
double t = (double)x / m_timeScale;
return (float)TickSnap(t);
float t = static_cast<float>(x) / m_timeScale;
return TickSnap(t);
}
//////////////////////////////////////////////////////////////////////////
@@ -369,7 +368,7 @@ float CTrackViewDopeSheetBase::TimeFromPointUnsnapped(const QPoint& point) const
{
int x = point.x() - m_leftOffset + m_scrollOffset.x();
double t = (double)x / m_timeScale;
return t;
return static_cast<float>(t);
}
void CTrackViewDopeSheetBase::mousePressEvent(QMouseEvent* event)
@@ -1028,12 +1027,12 @@ void CTrackViewDopeSheetBase::SelectAllKeysWithinTimeFrame(const QRect& rc, cons
CTrackViewTrackBundle tracks = sequence->GetAllTracks();
CTrackViewSequenceNotificationContext context(sequence);
for (int i = 0; i < tracks.GetCount(); ++i)
for (unsigned int i = 0; i < tracks.GetCount(); ++i)
{
CTrackViewTrack* pTrack = tracks.GetTrack(i);
// Check which keys we intersect.
for (int j = 0; j < pTrack->GetKeyCount(); j++)
for (unsigned int j = 0; j < pTrack->GetKeyCount(); j++)
{
CTrackViewKeyHandle keyHandle = pTrack->GetKey(j);
const float time = keyHandle.GetTime();
@@ -1429,7 +1428,7 @@ bool CTrackViewDopeSheetBase::IsOkToAddKeyHere(const CTrackViewTrack* pTrack, fl
{
const float timeEpsilon = 0.05f;
for (int i = 0; i < pTrack->GetKeyCount(); ++i)
for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i)
{
const CTrackViewKeyConstHandle& keyHandle = pTrack->GetKey(i);
@@ -1556,7 +1555,7 @@ void CTrackViewDopeSheetBase::MouseMoveMove(const QPoint& p, [[maybe_unused]] Qt
const TrackMemento& trackMemento = iter->second;
pTrack->RestoreFromMemento(trackMemento.m_memento);
const unsigned int numKeys = trackMemento.m_keySelectionStates.size();
const unsigned int numKeys = static_cast<unsigned int>(trackMemento.m_keySelectionStates.size());
for (unsigned int i = 0; i < numKeys; ++i)
{
pTrack->GetKey(i).Select(trackMemento.m_keySelectionStates[i]);
@@ -1764,7 +1763,7 @@ float CTrackViewDopeSheetBase::MagnetSnap(float newTime, const CTrackViewAnimNod
newTime = keys.GetKey(0).GetTime();
// But if there is an in-range key in a sibling track, use it instead.
// Here a 'sibling' means a track that belongs to a same node.
for (int i = 0; i < keys.GetKeyCount(); ++i)
for (unsigned int i = 0; i < keys.GetKeyCount(); ++i)
{
CTrackViewKeyHandle keyHandle = keys.GetKey(i);
if (keyHandle.GetTrack()->GetAnimNode() == pNode)
@@ -1783,7 +1782,7 @@ float CTrackViewDopeSheetBase::FrameSnap(float time) const
{
double t = floor((double)time / m_snapFrameTime + 0.5);
t = t * m_snapFrameTime;
return t;
return static_cast<float>(t);
}
//////////////////////////////////////////////////////////////////////////
@@ -1946,7 +1945,7 @@ void CTrackViewDopeSheetBase::ChangeSequenceTrackSelection(CTrackViewSequence* s
CTrackViewTrackBundle prevSelectedTracks;
prevSelectedTracks = sequenceWithTrack->GetSelectedTracks();
for (int i = 0; i < prevSelectedTracks.GetCount(); i++)
for (unsigned int i = 0; i < prevSelectedTracks.GetCount(); i++)
{
CTrackViewTrack* prevSelectedTrack = prevSelectedTracks.GetTrack(i);
if (prevSelectedTrack != trackToSelect)
@@ -2003,9 +2002,10 @@ bool CTrackViewDopeSheetBase::CreateColorKey(CTrackViewTrack* pTrack, float keyT
Vec3 vColor(0, 0, 0);
pTrack->GetValue(keyTime, vColor);
const AZ::Color defaultColor(clamp_tpl<AZ::u8>(FloatToIntRet(vColor.x), 0, 255),
clamp_tpl<AZ::u8>(FloatToIntRet(vColor.y), 0, 255),
clamp_tpl<AZ::u8>(FloatToIntRet(vColor.z), 0, 255),
const AZ::Color defaultColor(
clamp_tpl<AZ::u8>(static_cast<AZ::u8>(FloatToIntRet(vColor.x)), 0, 255),
clamp_tpl<AZ::u8>(static_cast<AZ::u8>(FloatToIntRet(vColor.y)), 0, 255),
clamp_tpl<AZ::u8>(static_cast<AZ::u8>(FloatToIntRet(vColor.z)), 0, 255),
255);
AzQtComponents::ColorPicker dlg(AzQtComponents::ColorPicker::Configuration::RGB, QString(), this);
dlg.setWindowTitle(tr("Select Color"));
@@ -2023,7 +2023,7 @@ bool CTrackViewDopeSheetBase::CreateColorKey(CTrackViewTrack* pTrack, float keyT
AzToolsFramework::ScopedUndoBatch undoBatch("Set Key");
const unsigned int numChildNodes = pTrack->GetChildCount();
for (int i = 0; i < numChildNodes; ++i)
for (unsigned int i = 0; i < numChildNodes; ++i)
{
CTrackViewTrack* subTrack = static_cast<CTrackViewTrack*>(pTrack->GetChild(i));
if (IsOkToAddKeyHere(subTrack, keyTime))
@@ -2054,7 +2054,7 @@ void CTrackViewDopeSheetBase::OnCurrentColorChange(const AZ::Color& color)
void CTrackViewDopeSheetBase::UpdateColorKey(const QColor& color, bool addToUndo)
{
ColorF colArray(color.red(), color.green(), color.blue(), color.alpha());
ColorF colArray(static_cast<f32>(color.redF()), static_cast<f32>(color.greenF()), static_cast<f32>(color.blueF()), static_cast<f32>(color.alphaF()));
CTrackViewSequence* sequence = m_colorUpdateTrack->GetSequence();
if (nullptr != sequence)
@@ -2083,7 +2083,7 @@ void CTrackViewDopeSheetBase::UpdateColorKey(const QColor& color, bool addToUndo
void CTrackViewDopeSheetBase::UpdateColorKeyHelper(const ColorF& color)
{
const unsigned int numChildNodes = m_colorUpdateTrack->GetChildCount();
for (int i = 0; i < numChildNodes; ++i)
for (unsigned int i = 0; i < numChildNodes; ++i)
{
CTrackViewTrack* subTrack = static_cast<CTrackViewTrack*>(m_colorUpdateTrack->GetChild(i));
CTrackViewKeyHandle subTrackKey = subTrack->GetKeyByTime(m_colorUpdateKeyTime);
@@ -2119,9 +2119,10 @@ void CTrackViewDopeSheetBase::EditSelectedColorKey(CTrackViewTrack* pTrack)
Vec3 color;
pTrack->GetValue(m_colorUpdateKeyTime, color);
const AZ::Color defaultColor(clamp_tpl<AZ::u8>(FloatToIntRet(color.x), 0, 255),
clamp_tpl<AZ::u8>(FloatToIntRet(color.y), 0, 255),
clamp_tpl<AZ::u8>(FloatToIntRet(color.z), 0, 255),
const AZ::Color defaultColor(
clamp_tpl(static_cast<AZ::u8>(FloatToIntRet(color.x)), AZ::u8(0), AZ::u8(255)),
clamp_tpl(static_cast<AZ::u8>(FloatToIntRet(color.y)), AZ::u8(0), AZ::u8(255)),
clamp_tpl(static_cast<AZ::u8>(FloatToIntRet(color.z)), AZ::u8(0), AZ::u8(255)),
255);
AzQtComponents::ColorPicker picker(AzQtComponents::ColorPicker::Configuration::RGB);
@@ -2258,7 +2259,7 @@ void CTrackViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKey
}
else // A compound track
{
for (int k = 0; k < pCurrTrack->GetChildCount(); ++k)
for (unsigned int k = 0; k < pCurrTrack->GetChildCount(); ++k)
{
CTrackViewTrack* pSubTrack = static_cast<CTrackViewTrack*>(pCurrTrack->GetChild(k));
if (IsOkToAddKeyHere(pSubTrack, keyTime))
@@ -2293,7 +2294,7 @@ void CTrackViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKey
else
{
AzToolsFramework::ScopedUndoBatch undoBatch("Create Key");
for (int i = 0; i < pTrack->GetChildCount(); ++i)
for (unsigned int i = 0; i < pTrack->GetChildCount(); ++i)
{
CTrackViewTrack* pSubTrack = static_cast<CTrackViewTrack*>(pTrack->GetChild(i));
if (IsOkToAddKeyHere(pSubTrack, keyTime))
@@ -2369,12 +2370,12 @@ void CTrackViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Rang
nNumberTicks = 8;
}
double start = TickSnap(timeRange.start);
double step = 1.0 / m_ticksStep;
float start = TickSnap(timeRange.start);
float step = 1.0f / static_cast<float>(m_ticksStep);
for (double t = 0.0f; t <= timeRange.end + step; t += step)
for (float t = 0.0f; t <= timeRange.end + step; t += step)
{
double st = TickSnap(t);
float st = TickSnap(t);
if (st > timeRange.end)
{
st = timeRange.end;
@@ -2393,7 +2394,7 @@ void CTrackViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Rang
continue;
}
int k = RoundFloatToInt(st * m_ticksStep);
int k = RoundFloatToInt(st * static_cast<float>(m_ticksStep));
if (k % nNumberTicks == 0)
{
if (st >= start)
@@ -3094,7 +3095,7 @@ void CTrackViewDopeSheetBase::SelectKeys(const QRect& rc, const bool bMultiSelec
// note the tracks to select for the keyHandles selected
CTrackViewTrackBundle tracksToSelect;
for (int i = 0; i < tracks.GetCount(); ++i)
for (unsigned int i = 0; i < tracks.GetCount(); ++i)
{
CTrackViewTrack* pTrack = tracks.GetTrack(i);
@@ -3108,7 +3109,7 @@ void CTrackViewDopeSheetBase::SelectKeys(const QRect& rc, const bool bMultiSelec
(rc.bottom() >= trackRect.top() && rc.bottom() <= trackRect.bottom()))
{
// Check which keys we intersect.
for (int j = 0; j < pTrack->GetKeyCount(); j++)
for (unsigned int j = 0; j < pTrack->GetKeyCount(); j++)
{
CTrackViewKeyHandle keyHandle = pTrack->GetKey(j);
@@ -3175,7 +3176,7 @@ void CTrackViewDopeSheetBase::DrawSelectedKeyIndicators(QPainter* painter)
painter->setPen(Qt::green);
CTrackViewKeyBundle keys = pSequence->GetSelectedKeys();
for (int i = 0; i < keys.GetKeyCount(); ++i)
for (unsigned int i = 0; i < keys.GetKeyCount(); ++i)
{
const CTrackViewKeyHandle& keyHandle = keys.GetKey(i);
int x = TimeToClient(keyHandle.GetTime());
@@ -3218,7 +3219,7 @@ void CTrackViewDopeSheetBase::ComputeFrameSteps(const Range& visRange)
float nBIntermediateTicks = 5;
m_fFrameLabelStep = fFact * afStepTable[nStepIdx];
if (TimeToClient(m_fFrameLabelStep) - TimeToClient(0) > 1300)
if (TimeToClient(static_cast<float>(m_fFrameLabelStep)) - TimeToClient(0.0f) > 1300)
{
nBIntermediateTicks = 10;
}
@@ -3230,7 +3231,7 @@ void CTrackViewDopeSheetBase::ComputeFrameSteps(const Range& visRange)
void CTrackViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRect& rc, [[maybe_unused]] const QColor& lineCol, const QColor& textCol, [[maybe_unused]] double step)
{
float fFramesPerSec = 1.0f / m_snapFrameTime;
float fInvFrameLabelStep = 1.0f / m_fFrameLabelStep;
float fInvFrameLabelStep = 1.0f / static_cast<float>(m_fFrameLabelStep);
Range VisRange = GetVisibleRange();
const Range& timeRange = m_timeRange;
@@ -3238,9 +3239,9 @@ void CTrackViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRec
const QPen ltgray(QColor(90, 90, 90));
const QPen black(textCol);
for (double t = TickSnap(timeRange.start); t <= timeRange.end + m_fFrameTickStep; t += m_fFrameTickStep)
for (float t = TickSnap(timeRange.start); t <= timeRange.end + static_cast<float>(m_fFrameTickStep); t += static_cast<float>(m_fFrameTickStep))
{
double st = t;
float st = t;
if (st > timeRange.end)
{
st = timeRange.end;
@@ -3285,9 +3286,9 @@ void CTrackViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QRe
const QPen ltgray(QColor(90, 90, 90));
const QPen black(textCol);
for (double t = TickSnap(timeRange.start); t <= timeRange.end + step; t += step)
for (float t = TickSnap(timeRange.start); t <= timeRange.end + static_cast<float>(step); t += static_cast<float>(step))
{
double st = TickSnap(t);
float st = TickSnap(t);
if (st > timeRange.end)
{
st = timeRange.end;
@@ -3306,7 +3307,7 @@ void CTrackViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QRe
}
int x = TimeToClient(st);
int k = RoundFloatToInt(st * m_ticksStep);
int k = RoundFloatToInt(st * static_cast<float>(m_ticksStep));
if (k % nNumberTicks == 0)
{
painter->setPen(black);
@@ -3423,7 +3424,7 @@ void CTrackViewDopeSheetBase::DrawSummary(QPainter* painter, const QRect& rcUpda
// Draw a short thick line at each place where there is a key in any tracks.
CTrackViewKeyBundle keys = pSequence->GetAllKeys();
for (int i = 0; i < keys.GetKeyCount(); ++i)
for (unsigned int i = 0; i < keys.GetKeyCount(); ++i)
{
const CTrackViewKeyHandle& keyHandle = keys.GetKey(i);
int x = TimeToClient(keyHandle.GetTime());
@@ -3635,7 +3636,7 @@ void CTrackViewDopeSheetBase::StoreMementoForTracksWithSelectedKeys()
std::set<CTrackViewTrack*> tracks;
const unsigned int numKeys = selectedKeys.GetKeyCount();
for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex)
for (unsigned int keyIndex = 0; keyIndex < numKeys; ++keyIndex)
{
CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex);
tracks.insert(keyHandle.GetTrack());
@@ -110,7 +110,7 @@ void CTrackViewKeyPropertiesDlg::PopulateVariables()
m_wndProps->RemoveAllItems();
m_wndProps->AddVarBlock(m_pVarBlock);
m_wndProps->SetUpdateCallback(AZStd::bind(&CTrackViewKeyPropertiesDlg::OnVarChange, this, AZStd::placeholders::_1));
m_wndProps->SetUpdateCallback([this](IVariable* var) { OnVarChange(var); });
//m_wndProps->m_props.ExpandAll();
+1 -1
View File
@@ -86,7 +86,7 @@ void CTrackViewKeyHandle::SetTime(float time, bool notifyListeners)
if (!m_pTrack->IsSortMarkerKey(m_keyIndex))
{
CTrackViewKeyBundle allKeys = m_pTrack->GetAllKeys();
for (int x = 0; x < allKeys.GetKeyCount(); x++)
for (unsigned int x = 0; x < allKeys.GetKeyCount(); x++)
{
unsigned int curIndex = allKeys.GetKey(x).GetIndex();
if (m_pTrack->IsSortMarkerKey(curIndex))
+6 -6
View File
@@ -1113,7 +1113,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point)
selectedEntitiesCount, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntitiesCount);
// check to make sure all nodes were added and notify user if they weren't
if (addedNodes.GetCount() != selectedEntitiesCount)
if (addedNodes.GetCount() != static_cast<unsigned int>(selectedEntitiesCount))
{
IMovieSystem* movieSystem = GetIEditor()->GetMovieSystem();
@@ -1419,7 +1419,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point)
{
if (animNode)
{
UINT_PTR menuId = cmd - eMI_AddTrackBase;
unsigned int menuId = cmd - eMI_AddTrackBase;
if (animNode->GetType() != AnimNodeType::AzEntity)
{
@@ -1765,7 +1765,7 @@ void CTrackViewNodesCtrl::ImportFromFBX()
pSpline->SetKeyInTangent(keyIndex, inTangent);
}
if (keyIndex < (pTrack->GetKeyCount() - 1))
if (keyIndex < static_cast<int>(pTrack->GetKeyCount() - 1))
{
CTrackViewKeyHandle nextKey = key.GetNextKey();
if (nextKey.IsValid())
@@ -2306,7 +2306,7 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con
&Maestro::EditorSequenceComponentRequestBus::Events::GetAllAnimatablePropertiesForComponent,
animatableProperties, azEntityId, animNode->GetComponentId());
paramCount = animatableProperties.size();
paramCount = static_cast<int>(animatableProperties.size());
}
}
else
@@ -2352,7 +2352,7 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con
QStringList splittedName = name.split("/", Qt::SkipEmptyParts);
STrackMenuTreeNode* pCurrentNode = &menuAddTrack;
for (unsigned int j = 0; j < splittedName.size() - 1; ++j)
for (int j = 0; j < splittedName.size() - 1; ++j)
{
const QString& segment = splittedName[j];
auto findIter = pCurrentNode->children.find(segment);
@@ -2652,7 +2652,7 @@ void CTrackViewNodesCtrl::CreateSetAnimationLayerPopupMenu(QMenu& menuSetLayer,
CTrackViewTrackBundle animationTracks = pTrack->GetAnimNode()->GetTracksByParam(AnimParamType::Animation);
const unsigned int numAnimationTracks = animationTracks.GetCount();
for (int i = 0; i < numAnimationTracks; ++i)
for (unsigned int i = 0; i < numAnimationTracks; ++i)
{
CTrackViewTrack* pAnimationTrack = animationTracks.GetTrack(i);
if (pAnimationTrack)
@@ -113,7 +113,7 @@ namespace
AZStd::string PyTrackViewGetSequenceName(unsigned int index)
{
if (index < PyTrackViewGetNumSequences())
if (static_cast<int>(index) < PyTrackViewGetNumSequences())
{
const CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager();
return pSequenceManager->GetSequenceByIndex(index)->GetName();
@@ -378,7 +378,7 @@ namespace
}
CTrackViewAnimNodeBundle foundNodes = pParentDirector->GetAllAnimNodes();
if (index < 0 || index >= foundNodes.GetCount())
if (index < 0 || index >= static_cast<int>(foundNodes.GetCount()))
{
throw std::runtime_error("Invalid node index");
}
+5 -5
View File
@@ -455,7 +455,7 @@ void CTrackViewSequence::OnNodeChanged(CTrackViewNode* node, ITrackViewSequenceL
// Make sure to deselect any keys
CTrackViewKeyBundle keys = node->GetAllKeys();
for (int key = 0; key < keys.GetKeyCount(); key++)
for (unsigned int key = 0; key < keys.GetKeyCount(); key++)
{
CTrackViewKeyHandle keyHandle = keys.GetKey(key);
if (keyHandle.IsSelected())
@@ -1249,7 +1249,7 @@ void CTrackViewSequence::DeselectAllKeys()
CTrackViewSequenceNotificationContext context(this);
CTrackViewKeyBundle selectedKeys = GetSelectedKeys();
for (int i = 0; i < selectedKeys.GetKeyCount(); ++i)
for (unsigned int i = 0; i < selectedKeys.GetKeyCount(); ++i)
{
CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(i);
keyHandle.Select(false);
@@ -1403,7 +1403,7 @@ float CTrackViewSequence::ClipTimeOffsetForSliding(const float timeOffset)
for (pTrackIter = tracks.begin(); pTrackIter != tracks.end(); ++pTrackIter)
{
CTrackViewTrack* pTrack = *pTrackIter;
for (int i = 0; i < pTrack->GetKeyCount(); ++i)
for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i)
{
const CTrackViewKeyHandle& keyHandle = pTrack->GetKey(i);
@@ -1486,7 +1486,7 @@ void CTrackViewSequence::CloneSelectedKeys()
std::vector<float> selectedKeyTimes;
for (size_t k = 0; k < selectedKeys.GetKeyCount(); ++k)
{
CTrackViewKeyHandle skey = selectedKeys.GetKey(k);
CTrackViewKeyHandle skey = selectedKeys.GetKey(static_cast<unsigned int>(k));
if (pTrack != skey.GetTrack())
{
pTrack = skey.GetTrack();
@@ -1498,7 +1498,7 @@ void CTrackViewSequence::CloneSelectedKeys()
// Now, do the actual cloning.
for (size_t k = 0; k < selectedKeyTimes.size(); ++k)
{
CTrackViewKeyHandle skey = selectedKeys.GetKey(k);
CTrackViewKeyHandle skey = selectedKeys.GetKey(static_cast<unsigned int>(k));
skey = skey.GetTrack()->GetKeyByTime(selectedKeyTimes[k]);
assert(skey.IsValid());
@@ -227,7 +227,7 @@ void CTrackViewSequenceManager::AddTrackViewSequence(CTrackViewSequence* sequenc
////////////////////////////////////////////////////////////////////////////
void CTrackViewSequenceManager::DeleteSequence(CTrackViewSequence* sequence)
{
const int numSequences = m_sequences.size();
const int numSequences = static_cast<int>(m_sequences.size());
for (int sequenceIndex = 0; sequenceIndex < numSequences; ++sequenceIndex)
{
if (m_sequences[sequenceIndex].get() == sequence)
@@ -246,7 +246,7 @@ void CTrackViewSequenceManager::DeleteSequence(CTrackViewSequence* sequence)
{
AZ::ComponentTypeList requiredComponents;
AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(requiredComponents, &AzToolsFramework::EditorEntityContextRequestBus::Events::GetRequiredComponentTypes);
const int numComponentToDeleteEntity = requiredComponents.size() + 1;
const int numComponentToDeleteEntity = static_cast<int>(requiredComponents.size() + 1);
AZ::Entity::ComponentArrayType entityComponents = entity->GetComponents();
if (entityComponents.size() == numComponentToDeleteEntity)
@@ -413,9 +413,9 @@ void CTrackViewSequenceManager::OnDataBaseItemEvent([[maybe_unused]] IDataBaseIt
{
if (event != EDataBaseItemEvent::EDB_ITEM_EVENT_ADD)
{
const uint numSequences = m_sequences.size();
const size_t numSequences = m_sequences.size();
for (uint i = 0; i < numSequences; ++i)
for (size_t i = 0; i < numSequences; ++i)
{
m_sequences[i]->UpdateDynamicParams();
}
@@ -706,7 +706,7 @@ void CTrackViewSplineCtrl::mouseMoveEvent(QMouseEvent* event)
QString tipText;
bool boFoundTheSelectedKey(false);
for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
CTrackViewTrack* pTrack = m_tracks[splineIndex];
@@ -796,7 +796,7 @@ void CTrackViewSplineCtrl::AdjustTCB(float d_tension, float d_continuity, float
SendNotifyEvent(SPLN_BEFORE_CHANGE);
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
CTrackViewTrack* pTrack = m_tracks[splineIndex];
@@ -892,7 +892,7 @@ void CTrackViewSplineCtrl::OnUserCommand(UINT cmd)
bool CTrackViewSplineCtrl::IsUnifiedKeyCurrentlySelected() const
{
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
+1 -1
View File
@@ -70,7 +70,7 @@ CTrackViewTrack* CUndoComponentEntityTrackObject::FindTrack(CTrackViewSequence*
CTrackViewTrack* track = nullptr;
CTrackViewTrackBundle allTracks = sequence->GetAllTracks();
for (int trackIndex = 0; trackIndex < allTracks.GetCount(); trackIndex++)
for (unsigned int trackIndex = 0; trackIndex < allTracks.GetCount(); trackIndex++)
{
CTrackViewTrack* curTrack = allTracks.GetTrack(trackIndex);
if (curTrack->GetAnimNode() && curTrack->GetAnimNode()->GetComponentId() == m_trackComponentId)
+1 -1
View File
@@ -78,7 +78,7 @@ void CTVNewSequenceDialog::OnOK()
return;
}
for (int k = 0; k < GetIEditor()->GetSequenceManager()->GetCount(); ++k)
for (unsigned int k = 0; k < GetIEditor()->GetSequenceManager()->GetCount(); ++k)
{
CTrackViewSequence* pSequence = GetIEditor()->GetSequenceManager()->GetSequenceByIndex(k);
QString fullname = pSequence->GetName();

Some files were not shown because too many files have changed in this diff Show More