diff --git a/Code/Editor/2DViewport.cpp b/Code/Editor/2DViewport.cpp index 838d30e0b3..ed810aea29 100644 --- a/Code/Editor/2DViewport.cpp +++ b/Code/Editor/2DViewport.cpp @@ -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(floor((v.x / size) + 0.5) * size); + snapped.y = static_cast(floor((v.y / size) + 0.5) * size); + snapped.z = static_cast(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(center.x()); + float y2 = static_cast(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(sp.x), static_cast(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(sp.x), static_cast(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(vp.x()), static_cast(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(m_rcClient.width()), static_cast(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(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(height), fZ)); + dc.DrawLine(Vec3(0.0f, org.y, fZ), Vec3(static_cast(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(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(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(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(p1.x()), static_cast(p1.y()), 0.0f), Vec3(static_cast(p2.x()), static_cast(p1.y()), 0.0f)); + dc.DrawLine( + Vec3(static_cast(p1.x()), static_cast(p2.y()), 0.0f), Vec3(static_cast(p2.x()), static_cast(p2.y()), 0.0f)); + dc.DrawLine( + Vec3(static_cast(p1.x()), static_cast(p1.y()), 0.0f), Vec3(static_cast(p1.x()), static_cast(p2.y()), 0.0f)); + dc.DrawLine( + Vec3(static_cast(p2.x()), static_cast(p1.y()), 0.0f), Vec3(static_cast(p2.x()), static_cast(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(-maxSize); + box.max.z = static_cast(maxSize); break; case VPA_XZ: - box.min.y = -maxSize; - box.max.y = maxSize; + box.min.y = static_cast(-maxSize); + box.max.y = static_cast(maxSize); break; case VPA_YZ: - box.min.x = -maxSize; - box.max.x = maxSize; + box.min.x = static_cast(-maxSize); + box.max.x = static_cast(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(-maxSize); + box.max.z = static_cast(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(-maxSize); + box.max.z = static_cast(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(-maxSize); + box.max.y = static_cast(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(-maxSize); + box.max.x = static_cast(maxSize); w = box.max.y - box.min.y; h = box.max.z - box.min.z; diff --git a/Code/Editor/BaseLibraryItem.cpp b/Code/Editor/BaseLibraryItem.cpp index 252510c951..b1fba91fad 100644 --- a/Code/Editor/BaseLibraryItem.cpp +++ b/Code/Editor/BaseLibraryItem.cpp @@ -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(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(xmlStr.GetAllocatedMemory()); } //load previous saved data diff --git a/Code/Editor/BaseLibraryManager.h b/Code/Editor/BaseLibraryManager.h index 05f370e632..6f0b905760 100644 --- a/Code/Editor/BaseLibraryManager.h +++ b/Code/Editor/BaseLibraryManager.h @@ -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(m_libs.size()); }; //! Get number of modified libraries. virtual int GetModifiedLibraryCount() const override; diff --git a/Code/Editor/Commands/CommandManager.cpp b/Code/Editor/Commands/CommandManager.cpp index f28ca96ac8..5f194971f5 100644 --- a/Code/Editor/Commands/CommandManager.cpp +++ b/Code/Editor/Commands/CommandManager.cpp @@ -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 tokens; AZ::StringFunc::Tokenize(argsTxt, tokens, ' '); for(AZStd::string& arg : tokens) diff --git a/Code/Editor/ConfigGroup.cpp b/Code/Editor/ConfigGroup.cpp index b18edf1142..74fe6f7b5c 100644 --- a/Code/Editor/ConfigGroup.cpp +++ b/Code/Editor/ConfigGroup.cpp @@ -33,7 +33,7 @@ namespace Config uint32 CConfigGroup::GetVarCount() { - return m_vars.size(); + return static_cast(m_vars.size()); } IConfigVar* CConfigGroup::GetVar(const char* szName) diff --git a/Code/Editor/Controls/ColorGradientCtrl.cpp b/Code/Editor/Controls/ColorGradientCtrl.cpp index 3bd3b11690..446e5810c5 100644 --- a/Code/Editor/Controls/ColorGradientCtrl.cpp +++ b/Code/Editor/Controls/ColorGradientCtrl.cpp @@ -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(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; } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp index 093575d445..dbe7ba3472 100644 --- a/Code/Editor/Controls/ConsoleSCB.cpp +++ b/Code/Editor/Controls/ConsoleSCB.cpp @@ -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(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(min), static_cast(max)); } else { - editor->setSoftRange(defaultMin, defaultMax); + editor->setSoftRange(static_cast(defaultMin), static_cast(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(step)); } else if (auto doubleSpinBox = qobject_cast(editor->spinbox())) { diff --git a/Code/Editor/Controls/ImageHistogramCtrl.cpp b/Code/Editor/Controls/ImageHistogramCtrl.cpp index 7218c0cd38..252bf4f09b 100644 --- a/Code/Editor/Controls/ImageHistogramCtrl.cpp +++ b/Code/Editor/Controls/ImageHistogramCtrl.cpp @@ -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(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(((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(rcGraph.left() + x + 1); + painter.drawLine(crtX, graphBottom, crtX, static_cast(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(((float)x / graphWidth) * (kNumColorLevels - 1)); i = CLAMP(i, 0, kNumColorLevels - 1); - crtX = rcGraph.left() + x + 1; + crtX = static_cast(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(graphBottom - scaleR * graphHeight); + heightG = static_cast(graphBottom - scaleG * graphHeight); + heightB = static_cast(graphBottom - scaleB * graphHeight); + heightA = static_cast(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((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(x) + 1, graphBottom, rcGraph.left() + static_cast(x) + 1, static_cast(graphBottom - scale * graphHeight)); } // then draw 3 lines so we separate the channels diff --git a/Code/Editor/Controls/QBitmapPreviewDialogImp.cpp b/Code/Editor/Controls/QBitmapPreviewDialogImp.cpp index c438858e81..b47a535d2a 100644 --- a/Code/Editor/Controls/QBitmapPreviewDialogImp.cpp +++ b/Code/Editor/Controls/QBitmapPreviewDialogImp.cpp @@ -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(((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(graphBottom - graphHeight * scale); if (last_height == INT_MAX) { last_height = height; diff --git a/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp index fde5642b05..4fb18e438c 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp @@ -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, ','); diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp index 1a7060aa8d..40ea71f577 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp @@ -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(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(nMin), static_cast(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(pMenuInfo->m_subMenuText.size()); ++k) { const UINT uID = ePPA_CustomPopupBase + ePPA_CustomPopupBase * j + k; QAction *action = pSubMenu->addAction(pMenuInfo->m_subMenuText[k]); diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp index aba346ce6a..b3f1b35461 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp @@ -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(min); + reflectedVar->m_softMaxVal = static_cast(max); if (hardMin) { - reflectedVar->m_minVal = min; + reflectedVar->m_minVal = static_cast(min); } else { - reflectedVar->m_minVal = std::numeric_limits::lowest(); + reflectedVar->m_minVal = std::numeric_limits::lowest(); } if (hardMax) { - reflectedVar->m_maxVal = max; + reflectedVar->m_maxVal = static_cast(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::max(); */ - reflectedVar->m_maxVal = static_cast(std::numeric_limits::max()); + reflectedVar->m_maxVal = static_cast(std::numeric_limits::max()); } - reflectedVar->m_stepSize = step; + reflectedVar->m_stepSize = static_cast(step); } } @@ -95,9 +95,9 @@ void ReflectedVarIntAdapter::SyncReflectedVarToIVar(IVariable *pVariable) { int intValue; pVariable->Get(intValue); - value = intValue; + value = static_cast(intValue); } - m_reflectedVar->m_value = std::round(value * m_valueMultiplier); + m_reflectedVar->m_value = static_cast(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(col.redF()), static_cast(col.greenF()), static_cast(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(qcolor.redF()), static_cast(qcolor.greenF()), static_cast(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(m_reflectedVar->m_color.GetX() * 255.0f); + int ig = static_cast(m_reflectedVar->m_color.GetY() * 255.0f); + int ib = static_cast(m_reflectedVar->m_color.GetZ() * 255.0f); pVariable->Set(static_cast(RGB(ir, ig, ib))); } diff --git a/Code/Editor/Controls/SplineCtrl.cpp b/Code/Editor/Controls/SplineCtrl.cpp index d66fc16ade..80d30b37ad 100644 --- a/Code/Editor/Controls/SplineCtrl.cpp +++ b/Code/Editor/Controls/SplineCtrl.cpp @@ -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((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((floor((m_fMaxValue - val) * (m_rcSpline.height() / (m_fMaxValue - m_fMinValue)) + 0.5f) + m_rcSpline.top()))); return point; } diff --git a/Code/Editor/Controls/SplineCtrlEx.cpp b/Code/Editor/Controls/SplineCtrlEx.cpp index 5977aff105..f299ce185d 100644 --- a/Code/Editor/Controls/SplineCtrlEx.cpp +++ b/Code/Editor/Controls/SplineCtrlEx.cpp @@ -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(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(TimeToXOfs(startTime));//rcClip.left; + int right = static_cast(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(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(x), m_rcSpline.top(), static_cast(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(splineIndex), static_cast(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(TimeToXOfs(affectedRangeMin)); + int rangeMax = static_cast(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::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::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(TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time)) : m_rcSpline.left()); + int redrawRangeEnd = (keyTimeIndex < m_keyTimes.size() - 2 ? static_cast(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 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; 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 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; diff --git a/Code/Editor/Controls/SplineCtrlEx.h b/Code/Editor/Controls/SplineCtrlEx.h index add4bcb0a9..711cbcf8d4 100644 --- a/Code/Editor/Controls/SplineCtrlEx.h +++ b/Code/Editor/Controls/SplineCtrlEx.h @@ -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(m_splines.size()); } ISplineInterpolator* GetSpline(int nIndex) const { return m_splines[nIndex].pSpline; } void SetTimeMarker(float fTime); diff --git a/Code/Editor/Controls/TextEditorCtrl.cpp b/Code/Editor/Controls/TextEditorCtrl.cpp index 5961c9d9a3..c372138d80 100644 --- a/Code/Editor/Controls/TextEditorCtrl.cpp +++ b/Code/Editor/Controls/TextEditorCtrl.cpp @@ -53,7 +53,7 @@ void CTextEditorCtrl::LoadFile(const QString& sFileName) size_t length = file.GetLength(); QByteArray text; - text.resize(length); + text.resize(static_cast(length)); file.ReadRaw(text.data(), length); setPlainText(text); diff --git a/Code/Editor/Controls/TimelineCtrl.cpp b/Code/Editor/Controls/TimelineCtrl.cpp index a5a941fc78..8159084784 100644 --- a/Code/Editor/Controls/TimelineCtrl.cpp +++ b/Code/Editor/Controls/TimelineCtrl.cpp @@ -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(static_cast(c2.red() - c1.red()) * fraction + c1.red()); + const int g = static_cast(static_cast(c2.green() - c1.green()) * fraction + c1.green()); + const int b = static_cast(static_cast(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(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(rc.top())), QPoint(x + 2, static_cast(rc.bottom())))); painter->setPen(redpen); - painter->drawLine(x, rc.top(), x, rc.bottom()); + painter->drawLine(x, static_cast(rc.top()), x, static_cast(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(rc.top())), QPoint(x2 + 2, static_cast(rc.bottom())))); } painter->setPen(pOldPen); diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index 8444f81317..280613815e 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -613,7 +613,7 @@ public: } // Get boolean options - const int numOptions = options.size(); + const int numOptions = static_cast(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(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::max(), std::numeric_limits::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(output.size())); } QString CCryEditApp::GetRootEnginePath() const diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index b83babc5c5..e5988918f5 100644 --- a/Code/Editor/CryEditDoc.cpp +++ b/Code/Editor/CryEditDoc.cpp @@ -1224,7 +1224,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename) if (savedEntities) { AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Updated PakFile levelEntities.editor_xml"); - pakFile.UpdateFile("LevelEntities.editor_xml", entitySaveBuffer.begin(), entitySaveBuffer.size()); + pakFile.UpdateFile("LevelEntities.editor_xml", entitySaveBuffer.begin(), static_cast(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(pVar->GetUserData().value()); + int nKey = static_cast(reinterpret_cast(pVar->GetUserData().value())); int nGroup = (nKey & 0xFFFF0000) >> 16; int nChild = (nKey & 0x0000FFFF); diff --git a/Code/Editor/DisplaySettings.cpp b/Code/Editor/DisplaySettings.cpp index dc4cf083a9..ed4ca180b4 100644 --- a/Code/Editor/DisplaySettings.cpp +++ b/Code/Editor/DisplaySettings.cpp @@ -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(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(m_labelsDistance); LoadValue("Settings", "LabelsDistance", temp); - m_labelsDistance = temp; + m_labelsDistance = static_cast(temp); gSettings.objectHideMask = m_objectHideMask; } diff --git a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp b/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp index cf7cf5e959..80368d3ec1 100644 --- a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp +++ b/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp @@ -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(this->nNormals); if (!this->normal.IsZero()) { this->normal.Normalize(); } // Average position. - this->pos = this->pos / this->nNormals; + this->pos = this->pos / static_cast(this->nNormals); refFrame.SetTranslation(this->pos); } diff --git a/Code/Editor/EditorDefs.h b/Code/Editor/EditorDefs.h index 6614fa4d72..423f4c5f73 100644 --- a/Code/Editor/EditorDefs.h +++ b/Code/Editor/EditorDefs.h @@ -33,18 +33,6 @@ #include #include -// 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. ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/EditorPreferencesPageViewportGeneral.cpp b/Code/Editor/EditorPreferencesPageViewportGeneral.cpp index 1fc0d14988..a9eec22e69 100644 --- a/Code/Editor/EditorPreferencesPageViewportGeneral.cpp +++ b/Code/Editor/EditorPreferencesPageViewportGeneral.cpp @@ -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(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f), + static_cast(m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f), + static_cast(m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f)); + gSettings.objectColorSettings.groupHighlight = QColor( + static_cast(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f), + static_cast(m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f), + static_cast(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(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f), + static_cast(m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f), + static_cast(m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f)); + gSettings.objectColorSettings.solidBrushGeometryColor = QColor( + static_cast(m_selectionPreviewColor.m_solidBrushGeometryColor.GetR() * 255.0f), + static_cast(m_selectionPreviewColor.m_solidBrushGeometryColor.GetG() * 255.0f), + static_cast(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(gSettings.objectColorSettings.entityHighlight.redF()), static_cast(gSettings.objectColorSettings.entityHighlight.greenF()), static_cast(gSettings.objectColorSettings.entityHighlight.blueF()), 1.0f); + m_selectionPreviewColor.m_colorGroupBBox.Set(static_cast(gSettings.objectColorSettings.groupHighlight.redF()), static_cast(gSettings.objectColorSettings.groupHighlight.greenF()), static_cast(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(gSettings.objectColorSettings.geometryHighlightColor.redF()), static_cast(gSettings.objectColorSettings.geometryHighlightColor.greenF()), static_cast(gSettings.objectColorSettings.geometryHighlightColor.blueF()), 1.0f); + m_selectionPreviewColor.m_solidBrushGeometryColor.Set(static_cast(gSettings.objectColorSettings.solidBrushGeometryColor.redF()), static_cast(gSettings.objectColorSettings.solidBrushGeometryColor.greenF()), static_cast(gSettings.objectColorSettings.solidBrushGeometryColor.blueF()), 1.0f); } diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index c29b2b6d11..c305b1be6c 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -285,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(kFontSize / 10.0f)); painter.setFont(font); QString friendlyName = QFileInfo(GetIEditor()->GetLevelName()).fileName(); @@ -816,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(m_safeFrame.left() + widthDifference * 0.5f)); + m_safeFrame.setRight(static_cast(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(m_safeFrame.top() + heightDifference * 0.5f)); + m_safeFrame.setBottom(static_cast(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(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR), + static_cast(m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR), + static_cast(-m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR), + static_cast(-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(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR), + static_cast(m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR), + static_cast(-m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR), + static_cast(-m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR)); } ////////////////////////////////////////////////////////////////////////// @@ -857,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(frame.left() + i), static_cast(frame.top() + i), 0.0f); + AZ::Vector3 bottomRight(static_cast(frame.right() - i), static_cast(frame.bottom() - i), 0.0f); m_debugDisplay->DrawWireBox(topLeft, bottomRight); } } @@ -1494,7 +1500,7 @@ bool EditorViewportWidget::AddCameraMenuItems(QMenu* menu) Camera::CameraBus::BroadcastResult(getCameraResults, &Camera::CameraRequests::GetCameras); QVector additionalCameras; - additionalCameras.reserve(getCameraResults.values.size()); + additionalCameras.reserve(static_cast(getCameraResults.values.size())); for (const AZ::EntityId& entityId : getCameraResults.values) { @@ -1916,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(verts.size()), &inds[0], numInds, &colors[0]); dc.CullOn(); dc.DepthWriteOn(); } @@ -1932,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(QHighDpiScaling::factor(windowHandle()->screen())); + out.y /= static_cast(QHighDpiScaling::factor(windowHandle()->screen())); out.z = z; } return out; @@ -1953,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((x / 100) * width); + p.ry() = static_cast((y / 100) * height); } else { @@ -2108,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(screenPosition.m_x); + *sy = static_cast(screenPosition.m_y); *sz = 0.f; } @@ -2120,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(vp.x()), static_cast(rc.bottom() - vp.y()), 0.0f, &wx, &wy, &wz); if (!_finite(wx) || !_finite(wy) || !_finite(wz)) { return; @@ -2130,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(vp.x()), static_cast(rc.bottom() - vp.y()), 1.0f, &wx, &wy, &wz); if (!_finite(wx) || !_finite(wy) || !_finite(wz)) { return; diff --git a/Code/Editor/ErrorReportTableModel.cpp b/Code/Editor/ErrorReportTableModel.cpp index c0c24bb7ce..f5dce1a86d 100644 --- a/Code/Editor/ErrorReportTableModel.cpp +++ b/Code/Editor/ErrorReportTableModel.cpp @@ -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(m_errorRecords.size()); } int CErrorReportTableModel::columnCount(const QModelIndex& parent) const diff --git a/Code/Editor/Export/ExportManager.cpp b/Code/Editor/Export/ExportManager.cpp index 5abd3ab5d0..7601740033 100644 --- a/Code/Editor/Export/ExportManager.cpp +++ b/Code/Editor/Export/ExportManager.cpp @@ -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(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 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(pSequence->GetTimeRange().end * m_FBXBakedExportFPS); if (!m_bExportOnlyPrimaryCamera) { diff --git a/Code/Editor/Export/ExportManager.h b/Code/Editor/Export/ExportManager.h index 698ad3ad5d..be81591e56 100644 --- a/Code/Editor/Export/ExportManager.h +++ b/Code/Editor/Export/ExportManager.h @@ -36,7 +36,7 @@ namespace Export public: CMesh(); - virtual int GetFaceCount() const { return m_faces.size(); } + virtual int GetFaceCount() const { return static_cast(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(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(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(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(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(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(m_objects.size()); } virtual Object* GetObject(int index) const { return m_objects[index]; } virtual Object* AddObject(const char* objectName); void Clear(); diff --git a/Code/Editor/Export/OBJExporter.cpp b/Code/Editor/Export/OBJExporter.cpp index bd2696090e..6ce40f8cd3 100644 --- a/Code/Editor/Export/OBJExporter.cpp +++ b/Code/Editor/Export/OBJExporter.cpp @@ -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(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(strlen(pBuf)) - 1; i > 0; --i) { if (pBuf[i] == '0') { diff --git a/Code/Editor/Export/OCMExporter.cpp b/Code/Editor/Export/OCMExporter.cpp index 653dc28dd3..ba5c343d0d 100644 --- a/Code/Editor/Export/OCMExporter.cpp +++ b/Code/Editor/Export/OCMExporter.cpp @@ -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(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(Offset); + Offset += SaveMesh(Writer, pExportData->GetObject(static_cast(a)), MeshInfo.m_OBBMat); } MeshOffsets.push_back(MeshInfo); } - OffsetInstances = Offset; + OffsetInstances = static_cast(Offset); for (size_t a = 0; a < InstCount; a++) { - SaveInstance(Writer, pExportData->GetObject(a), MeshOffsets[a]); + SaveInstance(Writer, pExportData->GetObject(static_cast(a)), MeshOffsets[a]); } Writer.Seek(4); Writer.Write(static_cast(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(strlen(pBuf)) - 1; i > 0; --i) { if (pBuf[i] == '0') { diff --git a/Code/Editor/FBXExporterDialog.cpp b/Code/Editor/FBXExporterDialog.cpp index 86e7843ca1..bae4b9bf7e 100644 --- a/Code/Editor/FBXExporterDialog.cpp +++ b/Code/Editor/FBXExporterDialog.cpp @@ -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 diff --git a/Code/Editor/GameExporter.cpp b/Code/Editor/GameExporter.cpp index 415103e10d..1fc980fdac 100644 --- a/Code/Editor/GameExporter.cpp +++ b/Code/Editor/GameExporter.cpp @@ -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(Size)); FileIn.read(reinterpret_cast(Temp.GetBuffer()), Size); FileIn.close(); CCryMemFile FileOut; - FileOut.Write(Temp.GetBuffer(), Size); + FileOut.Write(Temp.GetBuffer(), static_cast(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(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(xmlDataAction.length())); m_levelPak.m_pakFile.UpdateFile(levelDataActionFile.toUtf8().data(), fileAction); AZStd::vector 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(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(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(strlen(filename))); memFile.Write("\n", 1); } diff --git a/Code/Editor/GameResourcesExporter.cpp b/Code/Editor/GameResourcesExporter.cpp index dd16b2eca1..b47f8c63a6 100644 --- a/Code/Editor/GameResourcesExporter.cpp +++ b/Code/Editor/GameResourcesExporter.cpp @@ -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(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 -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 -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)); } diff --git a/Code/Editor/Geometry/TriMesh.cpp b/Code/Editor/Geometry/TriMesh.cpp index 737886cabc..d56aa038b5 100644 --- a/Code/Editor/Geometry/TriMesh.cpp +++ b/Code/Editor/Geometry/TriMesh.cpp @@ -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(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(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(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 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(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(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(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(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(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(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(pFaces[i].v[2])) != inVertices.end()) { outFaces.push_back(i); } diff --git a/Code/Editor/GotoPositionDlg.cpp b/Code/Editor/GotoPositionDlg.cpp index aec5f03fbd..84d149de58 100644 --- a/Code/Editor/GotoPositionDlg.cpp +++ b/Code/Editor/GotoPositionDlg.cpp @@ -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]); diff --git a/Code/Editor/LevelFileDialog.cpp b/Code/Editor/LevelFileDialog.cpp index cefa1330eb..c0c2b96c59 100644 --- a/Code/Editor/LevelFileDialog.cpp +++ b/Code/Editor/LevelFileDialog.cpp @@ -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(i)]; if (CFileUtil::FileExists(currentPath) || CheckLevelFolder(currentPath)) { diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 2295e1897f..5978356781 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -504,7 +504,7 @@ static inline QString CopyAndRemoveColorCode(const char* sText) *d++ = *s++; } - ret.resize(d - ret.data()); + ret.resize(static_cast(d - ret.data())); return QString::fromLatin1(ret); } diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp index 9560fd0fe7..fbd8e85482 100644 --- a/Code/Editor/MainWindow.cpp +++ b/Code/Editor/MainWindow.cpp @@ -1672,7 +1672,7 @@ void MainWindow::OnUpdateConnectionStatus() tooltip += m_connectionListener->LastAssetProcessorTask().c_str(); tooltip += "\n"; AZStd::set failedJobs = m_connectionListener->FailedJobsList(); - int failureCount = failedJobs.size(); + int failureCount = static_cast(failedJobs.size()); if (failureCount) { tooltip += "\n Failed Jobs\n"; diff --git a/Code/Editor/Objects/BaseObject.cpp b/Code/Editor/Objects/BaseObject.cpp index c9002f2dfa..8eb3bb83c1 100644 --- a/Code/Editor/Objects/BaseObject.cpp +++ b/Code/Editor/Objects/BaseObject.cpp @@ -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(labelColor.redF()), static_cast(labelColor.greenF()), static_cast(labelColor.redF())); if (IsSelected()) { - c = Vec3(dc.GetSelectedColor().redF(), dc.GetSelectedColor().greenF(), dc.GetSelectedColor().blueF()); + c = Vec3(static_cast(dc.GetSelectedColor().redF()), static_cast(dc.GetSelectedColor().greenF()), static_cast(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(dc.GetSelectedColor().redF()), static_cast(dc.GetSelectedColor().greenF()), static_cast(dc.GetSelectedColor().blueF())); } col[0] = c.x; col[1] = c.y; @@ -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(gSettings.editorConfigSpec)); } ////////////////////////////////////////////////////////////////////////// @@ -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(hc.rect.left()), static_cast(hc.rect.top())), Vec2(static_cast(hc.rect.right()), static_cast(hc.rect.top()))), + Edge2D(Vec2(static_cast(hc.rect.right()), static_cast(hc.rect.top())), Vec2(static_cast(hc.rect.right()), static_cast(hc.rect.bottom()))), + Edge2D(Vec2(static_cast(hc.rect.right()), static_cast(hc.rect.bottom())), Vec2(static_cast(hc.rect.left()), static_cast(hc.rect.bottom()))), + Edge2D(Vec2(static_cast(hc.rect.left()), static_cast(hc.rect.bottom())), Vec2(static_cast(hc.rect.left()), static_cast(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(obb_p[i].x()), static_cast(obb_p[i].y()), 0.0f)); } std::vector convexHullForRegion1; ConvexHull2D(convexHullForRegion1, pointsForRegion1); - nEdgeList1Count = convexHullForRegion1.size(); + nEdgeList1Count = static_cast(convexHullForRegion1.size()); if (nEdgeList1Count < 3 || nEdgeList1Count > kMaxSizeOfEdgeList1) { return true; @@ -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(static_cast(iconSizeX) * OBJECT_TEXTURE_ICON_SCALE / fScreenScale); + iconSizeY = static_cast(static_cast(iconSizeY) * OBJECT_TEXTURE_ICON_SCALE / fScreenScale); } // Hit Test icon of this object. @@ -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 >& 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 (size_t i = m_childs.size() - 1; i >= 0; --i) { m_childs[i]->SetMinSpec(nSpec, true); } diff --git a/Code/Editor/Objects/DisplayContext.h b/Code/Editor/Objects/DisplayContext.h index 4b09d4afe9..47fd450220 100644 --- a/Code/Editor/Objects/DisplayContext.h +++ b/Code/Editor/Objects/DisplayContext.h @@ -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(r * 255.0f), static_cast(g * 255.0f), static_cast(b * 255.0f), static_cast(a * 255.0f)); }; + void SetColor(const Vec3& color, float a = 1) { m_color4b = ColorB(static_cast(color.x * 255.0f), static_cast(color.y * 255.0f), static_cast(color.z * 255.0f), static_cast(a * 255.0f)); }; + void SetColor(const QColor& rgb, float a) { m_color4b = ColorB(static_cast(rgb.red()), static_cast(rgb.green()), static_cast(rgb.blue()), static_cast(a * 255.0f)); }; + void SetColor(const QColor& color) { m_color4b = ColorB(static_cast(color.red()), static_cast(color.green()), static_cast(color.blue()), static_cast(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(a * 255.0f); }; ColorB GetColor() const { return m_color4b; } void SetSelectedColor(float fAlpha = 1); diff --git a/Code/Editor/Objects/DisplayContextShared.inl b/Code/Editor/Objects/DisplayContextShared.inl index a602d8eca9..5af04d821e 100644 --- a/Code/Editor/Objects/DisplayContextShared.inl +++ b/Code/Editor/Objects/DisplayContextShared.inl @@ -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(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(rgb1.red()), static_cast(rgb1.green()), static_cast(rgb1.blue()), 255), + ToWorldSpacePosition(p2), + ColorB(static_cast(rgb2.red()), static_cast(rgb2.green()), static_cast(rgb2.blue()), 255)); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Objects/EntityObject.cpp b/Code/Editor/Objects/EntityObject.cpp index b42afb5c39..d2a2ae7d18 100644 --- a/Code/Editor/Objects/EntityObject.cpp +++ b/Code/Editor/Objects/EntityObject.cpp @@ -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(m_Links.size()); i < iLinkSize; ++i) { SLink& link = m_Links[i]; CBaseObject* pObj = GetIEditor()->GetObjectManager()->FindObject(link.entityID); @@ -1217,7 +1217,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 +1283,7 @@ void CEntityObject::UpdateVisibility(bool bVisible) CBaseObject::UpdateVisibility(bVisible); bool bVisibleWithSpec = bVisible && !IsHiddenBySpec(); - if (bVisibleWithSpec != m_bVisible) + if (bVisibleWithSpec != static_cast(m_bVisible)) { m_bVisible = bVisibleWithSpec; } @@ -1368,8 +1368,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 +1386,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(pFromEntity->m_links.size()); for (int i = 0; i < numTargets; i++) { CEntityLink& et = pFromEntity->m_links[i]; @@ -1437,7 +1437,7 @@ void CEntityObject::RemoveAllEntityLinks() { while (!m_links.empty()) { - RemoveEntityLink(m_links.size() - 1); + RemoveEntityLink(static_cast(m_links.size() - 1)); } m_links.clear(); SetModified(false); @@ -1448,7 +1448,7 @@ void CEntityObject::ReleaseEventTargets() { while (!m_eventTargets.empty()) { - RemoveEventTarget(m_eventTargets.size() - 1, false); + RemoveEventTarget(static_cast(m_eventTargets.size() - 1), false); } m_eventTargets.clear(); SetModified(false); @@ -1518,7 +1518,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 +1534,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(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(m_eventTargets.size()); i--; } } } else if (event == CBaseObject::ON_PREDELETE) { - int numTargets = m_links.size(); + int numTargets = static_cast(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(m_eventTargets.size()); i--; } } @@ -1589,7 +1589,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(m_eventTargets.size() - 1); } ////////////////////////////////////////////////////////////////////////// @@ -1659,13 +1659,13 @@ int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId) SetModified(false); - return m_links.size() - 1; + return static_cast(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) { diff --git a/Code/Editor/Objects/ObjectLoader.cpp b/Code/Editor/Objects/ObjectLoader.cpp index 2583eb6230..9596265bb9 100644 --- a/Code/Editor/Objects/ObjectLoader.cpp +++ b/Code/Editor/Objects/ObjectLoader.cpp @@ -126,7 +126,7 @@ void CObjectArchive::ResolveObjects() ////////////////////////////////////////////////////////////////////////// // Serialize All Objects from XML. ////////////////////////////////////////////////////////////////////////// - int numObj = m_loadedObjects.size(); + int numObj = static_cast(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(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(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(m_loadedObjects.size()); for (i = 0; i < numObj; i++) { SLoadedObjectInfo& obj = m_loadedObjects[i]; diff --git a/Code/Editor/Objects/ObjectManager.cpp b/Code/Editor/Objects/ObjectManager.cpp index 61a8944a90..940ef5b551 100644 --- a/Code/Editor/Objects/ObjectManager.cpp +++ b/Code/Editor/Objects/ObjectManager.cpp @@ -746,7 +746,7 @@ void CObjectManager::ChangeObjectName(CBaseObject* obj, const QString& newName) ////////////////////////////////////////////////////////////////////////// int CObjectManager::GetObjectCount() const { - return m_objects.size(); + return static_cast(m_objects.size()); } ////////////////////////////////////////////////////////////////////////// @@ -765,7 +765,7 @@ void CObjectManager::GetObjects(DynArray& 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]); } @@ -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(m_visibleObjects.size())); if (dc.flags & DISPLAY_2D) { - int numVis = m_visibleObjects.size(); + int numVis = static_cast(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(m_visibleObjects.size()); for (int i = 0; i < numVis; i++) { CBaseObject* obj = m_visibleObjects[i]; @@ -2016,7 +2016,7 @@ void CObjectManager::GetClassCategories(QStringList& categories) } } categories.clear(); - categories.reserve(cset.size()); + categories.reserve(static_cast(cset.size())); for (std::set::iterator cit = cset.begin(); cit != cset.end(); ++cit) { categories.push_back(*cit); @@ -2629,7 +2629,7 @@ void CObjectManager::EnteredComponentMode(const AZStd::vector& /*compo const size_t gizmoCount = static_cast(gizmoManager->GetGizmoCount()); for (size_t i = 0; i < gizmoCount; ++i) { - gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(i)); + gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(static_cast(i))); } } diff --git a/Code/Editor/Objects/SelectionGroup.cpp b/Code/Editor/Objects/SelectionGroup.cpp index 027c88172e..f2b7b9ddaf 100644 --- a/Code/Editor/Objects/SelectionGroup.cpp +++ b/Code/Editor/Objects/SelectionGroup.cpp @@ -109,7 +109,7 @@ bool CSelectionGroup::SameObjectType() ////////////////////////////////////////////////////////////////////////// int CSelectionGroup::GetCount() const { - return m_objects.size(); + return static_cast(m_objects.size()); } ////////////////////////////////////////////////////////////////////////// @@ -157,7 +157,7 @@ Vec3 CSelectionGroup::GetCenter() const } if (GetCount() > 0) { - c /= GetCount(); + c /= static_cast(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(selectedObjects.size()); for (int i = 0; i < iObjectSize; ++i) { CBaseObject* pObject = selectedObjects[i]; diff --git a/Code/Editor/Platform/Common/MSVC/editor_lib_msvc.cmake b/Code/Editor/Platform/Common/MSVC/editor_lib_msvc.cmake index cd72cfb3d8..7a325ca97e 100644 --- a/Code/Editor/Platform/Common/MSVC/editor_lib_msvc.cmake +++ b/Code/Editor/Platform/Common/MSVC/editor_lib_msvc.cmake @@ -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 -) diff --git a/Code/Editor/Plugin.cpp b/Code/Editor/Plugin.cpp index e73b9daa2c..4f6fe0279d 100644 --- a/Code/Editor/Plugin.cpp +++ b/Code/Editor/Plugin.cpp @@ -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(pSubClassName - pClassName)); return stl::find_in_map(m_nameToClass, name, (IClassDesc*)nullptr); } diff --git a/Code/Editor/PluginManager.cpp b/Code/Editor/PluginManager.cpp index 350102ead2..494748dc79 100644 --- a/Code/Editor/PluginManager.cpp +++ b/Code/Editor/PluginManager.cpp @@ -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(m_currentUUID)] = pPlugin; ++m_currentUUID; } diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp index ba08b5c069..c91bf58074 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp @@ -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(entityScreenPos.x()); + const float screenPosY = static_cast(entityScreenPos.y()); const float iconRange = static_cast(s_kIconSize / 2); if ((hc.point2d.x() >= screenPosX - iconRange && hc.point2d.x() <= screenPosX + iconRange) diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp index ac393607ae..429fbd923c 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp @@ -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(width / 2), static_cast(height / 2)); } else { @@ -1009,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(point.GetX()), static_cast(point.GetY())); HitContext hitInfo; hitInfo.view = view; @@ -1451,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(m_contextMenuViewPoint.GetX()), static_cast(m_contextMenuViewPoint.GetY())); worldPosition = view->GetHitLocation(viewPoint); } @@ -1641,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(m_contextMenuViewPoint.GetX()), static_cast(m_contextMenuViewPoint.GetY())); sliceWorldTransform = AZ::Transform::CreateTranslation(LYVec3ToAZVec3(view->SnapToGrid(view->ViewToWorld(viewPoint)))); } diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp index 0d661349a9..d0091f968e 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp @@ -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(m_fileCache.size())); }; EBUS_EVENT(AZ::Data::AssetCatalogRequestBus, EnumerateAssets, startCB, enumerateCB, endCB); diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp index f7f2b721b7..cd0fba350f 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp @@ -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(m_componentList.size()); } int ComponentDataModel::columnCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp index 7d63f8e15b..9ec81cdb3b 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp @@ -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(backgroundBoxRect.x() + 0.5f)); + backgroundBoxRect.setY(static_cast(backgroundBoxRect.y() + 2.5f)); + backgroundBoxRect.setWidth(static_cast(backgroundBoxRect.width() - 1.0f)); + backgroundBoxRect.setHeight(static_cast(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(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(fontMetrics.horizontalAdvance(htmlStripped) * layerInfoPadding); } entityNameRichText = fontMetrics.elidedText(optionV4.text, Qt::TextElideMode::ElideRight, textWidthAvailable); diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerTreeView.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerTreeView.cpp index 158e45d6e2..452db49d37 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerTreeView.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerTreeView.cpp @@ -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(rect.right() - indentation() * 1.5f); + int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : static_cast(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(lineBaseX - indentation() * 1.5f); int verticalLineTop = rect.top(); int verticalLineBottom = hasNext ? rect.bottom() : rect.bottom() - rectHalfHeight; painter->drawLine(verticalLineX, verticalLineTop, verticalLineX, verticalLineBottom); diff --git a/Code/Editor/Plugins/EditorAssetImporter/AssetImporterWindow.cpp b/Code/Editor/Plugins/EditorAssetImporter/AssetImporterWindow.cpp index f9b2c6c023..98bf228391 100644 --- a/Code/Editor/Plugins/EditorAssetImporter/AssetImporterWindow.cpp +++ b/Code/Editor/Plugins/EditorAssetImporter/AssetImporterWindow.cpp @@ -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(toupper(extension[0])); for (size_t i = 1; i < extension.size(); ++i) { - extension[i] = tolower(extension[i]); + extension[i] = static_cast(tolower(extension[i])); } } else diff --git a/Code/Editor/Plugins/EditorCommon/QtViewPane.cpp b/Code/Editor/Plugins/EditorCommon/QtViewPane.cpp index 7d97e6f580..3deef7e503 100644 --- a/Code/Editor/Plugins/EditorCommon/QtViewPane.cpp +++ b/Code/Editor/Plugins/EditorCommon/QtViewPane.cpp @@ -9,8 +9,6 @@ #include "platform.h" -#pragma warning(disable: 4266) // disabled warning from afk overrides - #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS #include #include @@ -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 #include "Util/PathUtil.h" -#pragma warning(pop) // ^^^ // --------------------------------------------------------------------------- diff --git a/Code/Editor/PreferencesStdPages.cpp b/Code/Editor/PreferencesStdPages.cpp index a4b3ee8ba4..b593541a07 100644 --- a/Code/Editor/PreferencesStdPages.cpp +++ b/Code/Editor/PreferencesStdPages.cpp @@ -89,7 +89,7 @@ REFGUID CStdPreferencesClassDesc::ClassID() ////////////////////////////////////////////////////////////////////////// int CStdPreferencesClassDesc::GetPagesCount() { - return m_pageCreators.size(); + return static_cast(m_pageCreators.size()); } IPreferencesPage* CStdPreferencesClassDesc::CreateEditorPreferencesPage(int index) diff --git a/Code/Editor/PythonEditorFuncs.cpp b/Code/Editor/PythonEditorFuncs.cpp index 2b7bca3b0b..dff41c0a86 100644 --- a/Code/Editor/PythonEditorFuncs.cpp +++ b/Code/Editor/PythonEditorFuncs.cpp @@ -76,7 +76,7 @@ namespace } else if (pCVar->GetType() == CVAR_FLOAT) { - PySetCVarFromFloat(pName, std::stod(pValue)); + PySetCVarFromFloat(pName, static_cast(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(value)); + PySetCVarFromInt(pName, static_cast(AZStd::any_cast(value))); } else if (pCVar->GetType() == CVAR_FLOAT) { - PySetCVarFromFloat(pName, AZStd::any_cast(value)); + PySetCVarFromFloat(pName, static_cast(AZStd::any_cast(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; diff --git a/Code/Editor/QtUI/PixmapLabelPreview.cpp b/Code/Editor/QtUI/PixmapLabelPreview.cpp index a98c743afb..9c415a6c4d 100644 --- a/Code/Editor/QtUI/PixmapLabelPreview.cpp +++ b/Code/Editor/QtUI/PixmapLabelPreview.cpp @@ -31,7 +31,7 @@ int PixmapLabelPreview::heightForWidth(int width) const return width; } - return ((qreal)m_pixmap.height() * width) / m_pixmap.width(); + return static_cast(((qreal)m_pixmap.height() * width) / m_pixmap.width()); } diff --git a/Code/Editor/QtViewPaneManager.cpp b/Code/Editor/QtViewPaneManager.cpp index f4f18fde83..022bb6ecd9 100644 --- a/Code/Editor/QtViewPaneManager.cpp +++ b/Code/Editor/QtViewPaneManager.cpp @@ -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(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((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((float)screenWidth * entityOutlinerWidthPercentage); m_mainWindow->resizeDocks({ entityOutlinerViewPane->m_dockWidget }, { newWidth }, Qt::Horizontal); } diff --git a/Code/Editor/Settings.cpp b/Code/Editor/Settings.cpp index 09b0d0f4f4..8672bad5c4 100644 --- a/Code/Editor/Settings.cpp +++ b/Code/Editor/Settings.cpp @@ -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); diff --git a/Code/Editor/ToolBox.cpp b/Code/Editor/ToolBox.cpp index d784bc2083..cfebc378f7 100644 --- a/Code/Editor/ToolBox.cpp +++ b/Code/Editor/ToolBox.cpp @@ -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(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(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; } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/ToolbarManager.cpp b/Code/Editor/ToolbarManager.cpp index d44e794b6a..1831fe6a55 100644 --- a/Code/Editor/ToolbarManager.cpp +++ b/Code/Editor/ToolbarManager.cpp @@ -503,7 +503,7 @@ void ToolbarManager::InitializeStandardToolbars() { auto macroToolbars = GetIEditor()->GetToolBoxManager()->GetToolbars(); - m_standardToolbars.reserve(5 + macroToolbars.size()); + m_standardToolbars.reserve(static_cast(5 + macroToolbars.size())); m_standardToolbars.push_back(GetEditModeToolbar()); m_standardToolbars.push_back(GetObjectToolbar()); m_standardToolbars.push_back(GetPlayConsoleToolbar()); diff --git a/Code/Editor/ToolsConfigPage.cpp b/Code/Editor/ToolsConfigPage.cpp index 965c862554..1871dc763f 100644 --- a/Code/Editor/ToolsConfigPage.cpp +++ b/Code/Editor/ToolsConfigPage.cpp @@ -840,7 +840,7 @@ void CToolsConfigPage::FillScriptCmds() { EditorPythonConsoleInterface::GlobalFunctionCollection globalFunctionCollection; editorPythonConsoleInterface->GetGlobalFunctionList(globalFunctionCollection); - commands.reserve(globalFunctionCollection.size()); + commands.reserve(static_cast(globalFunctionCollection.size())); for (const EditorPythonConsoleInterface::GlobalFunction& globalFunction : globalFunctionCollection) { const QString fullCmd = QString("%1.%2()").arg(globalFunction.m_moduleName.data()).arg(globalFunction.m_functionName.data()); diff --git a/Code/Editor/TrackView/CommentKeyUIControls.cpp b/Code/Editor/TrackView/CommentKeyUIControls.cpp index c7c5f83cbf..6b52efd8f1 100644 --- a/Code/Editor/TrackView/CommentKeyUIControls.cpp +++ b/Code/Editor/TrackView/CommentKeyUIControls.cpp @@ -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(keyIndex)); CAnimParamType paramType = keyHandle.GetTrack()->GetParameterType(); if (paramType == AnimParamType::CommentText) diff --git a/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp b/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp index a62ab17cbf..d8b3a2bdf7 100644 --- a/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp +++ b/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp @@ -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(keyIndex)); CAnimParamType paramType = selectedKey.GetTrack()->GetParameterType(); if (paramType == AnimParamType::ScreenFader) diff --git a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp index 66c4f63d35..33f1b0d441 100644 --- a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp +++ b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp @@ -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(width), static_cast(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(&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(item.frameRange.start * m_fpsForTimeToFrameConversion)); + m_ui->m_endFrame->setValue(static_cast(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(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(eFrame)); + m_ui->m_endFrame->setRange(0, static_cast(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(sFrame)); + m_ui->m_endFrame->setValue(static_cast(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(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(k)].toUtf8().data()); } } diff --git a/Code/Editor/TrackView/SequenceKeyUIControls.cpp b/Code/Editor/TrackView/SequenceKeyUIControls.cpp index c3bc39d65d..4199563e10 100644 --- a/Code/Editor/TrackView/SequenceKeyUIControls.cpp +++ b/Code/Editor/TrackView/SequenceKeyUIControls.cpp @@ -84,7 +84,7 @@ bool CSequenceKeyUIControls::OnKeySelectionChange(CTrackViewKeyBundle& selectedK mv_sequence->AddEnumItem(QObject::tr(""), 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; diff --git a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp index e2f8a4f7a2..ae1080a9c1 100644 --- a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp +++ b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp @@ -367,7 +367,7 @@ bool CTVCustomizeTrackColorsDlg::Import(const QString& fullPath) { return entry.paramType == paramType; }); - int entryIndex = pEntry - g_trackEntries; + int entryIndex = static_cast(pEntry - g_trackEntries); if (entryIndex >= arraysize(g_trackEntries)) // If not found, skip this. { continue; diff --git a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.h b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.h index 23401453d6..d3017d8e83 100644 --- a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.h +++ b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.h @@ -56,7 +56,7 @@ private: inline void GetQColorFromXmlNode(QColor& colorOut, const XmlNodeRef& xmlNode) const { - QRgb rgb = -1; + QRgb rgb = std::numeric_limits::max(); xmlNode->getAttr("color", rgb); colorOut.setRgb(rgb); }; diff --git a/Code/Editor/TrackView/TVEventsDialog.cpp b/Code/Editor/TrackView/TVEventsDialog.cpp index c8221b38cd..86b4c1f6bc 100644 --- a/Code/Editor/TrackView/TVEventsDialog.cpp +++ b/Code/Editor/TrackView/TVEventsDialog.cpp @@ -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); diff --git a/Code/Editor/TrackView/TVSequenceProps.cpp b/Code/Editor/TrackView/TVSequenceProps.cpp index 1ac31d7e2b..d4e06d0c94 100644 --- a/Code/Editor/TrackView/TVSequenceProps.cpp +++ b/Code/Editor/TrackView/TVSequenceProps.cpp @@ -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(ui->START_TIME->value()); + timeRangeNew.end = static_cast(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(ui->START_TIME->value()); + timeRange.end = static_cast(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(ui->START_TIME->value()) * invFPS; + timeRange.end = static_cast(ui->END_TIME->value()) * invFPS; } m_pSequence->SetTimeRange(timeRange); diff --git a/Code/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Editor/TrackView/TrackViewAnimNode.cpp index 9edac32da0..4b599859e9 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.cpp +++ b/Code/Editor/TrackView/TrackViewAnimNode.cpp @@ -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 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) diff --git a/Code/Editor/TrackView/TrackViewCurveEditor.cpp b/Code/Editor/TrackView/TrackViewCurveEditor.cpp index 83204f76a6..a757387563 100644 --- a/Code/Editor/TrackView/TrackViewCurveEditor.cpp +++ b/Code/Editor/TrackView/TrackViewCurveEditor.cpp @@ -145,7 +145,7 @@ void CTrackViewCurveEditor::UpdateSplines() std::set 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); diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index 331daf6730..f1701f9e20 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -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(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(fps)); SetCursorPosText(GetIEditor()->GetAnimation()->GetTime()); } @@ -1799,7 +1799,7 @@ void CTrackViewDialog::SaveMiscSettings() const settings.setValue(s_kFrameSnappingFPSEntry, fps); settings.setValue(s_kTickDisplayModeEntry, static_cast(m_wndDopeSheet->GetTickDisplayMode())); settings.setValue(s_kDefaultTracksEntry, QByteArray(reinterpret_cast(m_defaultTracksForEntityNode.data()), - m_defaultTracksForEntityNode.size() * sizeof(AnimParamType))); + static_cast(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(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); diff --git a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp index aa4ef94e9e..d0034b2da4 100644 --- a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp +++ b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp @@ -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(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(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(fOldOffset - fCurrentOffset); m_scrollBar->setValue(m_scrollOffset.x()); update(); - SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale); + SetHorizontalExtent(-m_leftOffset, static_cast(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(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(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(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(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(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(FloatToIntRet(vColor.x), 0, 255), - clamp_tpl(FloatToIntRet(vColor.y), 0, 255), - clamp_tpl(FloatToIntRet(vColor.z), 0, 255), + const AZ::Color defaultColor( + clamp_tpl(static_cast(FloatToIntRet(vColor.x)), 0, 255), + clamp_tpl(static_cast(FloatToIntRet(vColor.y)), 0, 255), + clamp_tpl(static_cast(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(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(color.redF()), static_cast(color.greenF()), static_cast(color.blueF()), static_cast(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(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(FloatToIntRet(color.x), 0, 255), - clamp_tpl(FloatToIntRet(color.y), 0, 255), - clamp_tpl(FloatToIntRet(color.z), 0, 255), + const AZ::Color defaultColor( + clamp_tpl(static_cast(FloatToIntRet(color.x)), AZ::u8(0), AZ::u8(255)), + clamp_tpl(static_cast(FloatToIntRet(color.y)), AZ::u8(0), AZ::u8(255)), + clamp_tpl(static_cast(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(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(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(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(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(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(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(m_fFrameTickStep); t += static_cast(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(step); t += static_cast(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(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 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()); diff --git a/Code/Editor/TrackView/TrackViewNode.cpp b/Code/Editor/TrackView/TrackViewNode.cpp index 882a23f6b0..d8507d9b0a 100644 --- a/Code/Editor/TrackView/TrackViewNode.cpp +++ b/Code/Editor/TrackView/TrackViewNode.cpp @@ -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)) diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index 16baa72709..ae38323cc3 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -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(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(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(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) diff --git a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp index acabff6827..d50060269b 100644 --- a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp +++ b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp @@ -113,7 +113,7 @@ namespace AZStd::string PyTrackViewGetSequenceName(unsigned int index) { - if (index < PyTrackViewGetNumSequences()) + if (static_cast(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(foundNodes.GetCount())) { throw std::runtime_error("Invalid node index"); } diff --git a/Code/Editor/TrackView/TrackViewSequence.cpp b/Code/Editor/TrackView/TrackViewSequence.cpp index 3647c554dc..f66e5276cd 100644 --- a/Code/Editor/TrackView/TrackViewSequence.cpp +++ b/Code/Editor/TrackView/TrackViewSequence.cpp @@ -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 selectedKeyTimes; for (size_t k = 0; k < selectedKeys.GetKeyCount(); ++k) { - CTrackViewKeyHandle skey = selectedKeys.GetKey(k); + CTrackViewKeyHandle skey = selectedKeys.GetKey(static_cast(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(k)); skey = skey.GetTrack()->GetKeyByTime(selectedKeyTimes[k]); assert(skey.IsValid()); diff --git a/Code/Editor/TrackView/TrackViewSequenceManager.cpp b/Code/Editor/TrackView/TrackViewSequenceManager.cpp index 277483691a..780c8f04ce 100644 --- a/Code/Editor/TrackView/TrackViewSequenceManager.cpp +++ b/Code/Editor/TrackView/TrackViewSequenceManager.cpp @@ -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(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(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(); } diff --git a/Code/Editor/TrackView/TrackViewSplineCtrl.cpp b/Code/Editor/TrackView/TrackViewSplineCtrl.cpp index c21403d1f5..4911297985 100644 --- a/Code/Editor/TrackView/TrackViewSplineCtrl.cpp +++ b/Code/Editor/TrackView/TrackViewSplineCtrl.cpp @@ -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; diff --git a/Code/Editor/TrackView/TrackViewUndo.cpp b/Code/Editor/TrackView/TrackViewUndo.cpp index d0b85762a2..c9cdc62bc3 100644 --- a/Code/Editor/TrackView/TrackViewUndo.cpp +++ b/Code/Editor/TrackView/TrackViewUndo.cpp @@ -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) diff --git a/Code/Editor/TrackViewNewSequenceDialog.cpp b/Code/Editor/TrackViewNewSequenceDialog.cpp index 0efc7a932e..287f69df47 100644 --- a/Code/Editor/TrackViewNewSequenceDialog.cpp +++ b/Code/Editor/TrackViewNewSequenceDialog.cpp @@ -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(); diff --git a/Code/Editor/Undo/Undo.cpp b/Code/Editor/Undo/Undo.cpp index 6af141b9e7..b49c6ea567 100644 --- a/Code/Editor/Undo/Undo.cpp +++ b/Code/Editor/Undo/Undo.cpp @@ -49,7 +49,7 @@ public: } void Undo(bool bUndo) override { - for (int i = m_undoSteps.size() - 1; i >= 0; i--) + for (size_t i = m_undoSteps.size() - 1; i >= 0; i--) { m_undoSteps[i]->Undo(bUndo); } @@ -624,13 +624,13 @@ void CUndoManager::SuperCancel() ////////////////////////////////////////////////////////////////////////// int CUndoManager::GetUndoStackLen() const { - return m_undoStack.size(); + return static_cast(m_undoStack.size()); } ////////////////////////////////////////////////////////////////////////// int CUndoManager::GetRedoStackLen() const { - return m_redoStack.size(); + return static_cast(m_redoStack.size()); } ////////////////////////////////////////////////////////////////////////// @@ -817,7 +817,7 @@ void CUndoManager::SignalNumUndoRedoToListeners() { for (IUndoManagerListener* listener : m_listeners) { - listener->SignalNumUndoRedo(m_undoStack.size(), m_redoStack.size()); + listener->SignalNumUndoRedo(static_cast(m_undoStack.size()), static_cast(m_redoStack.size())); } } diff --git a/Code/Editor/UndoDropDown.cpp b/Code/Editor/UndoDropDown.cpp index fbe18d5d52..6bf807ebf4 100644 --- a/Code/Editor/UndoDropDown.cpp +++ b/Code/Editor/UndoDropDown.cpp @@ -68,7 +68,7 @@ public: return 0; } - return m_stackNames.size(); + return static_cast(m_stackNames.size()); } QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override @@ -101,13 +101,13 @@ public: if (fresh.size() < m_stackNames.size()) { - beginRemoveRows(createIndex(-1, -1), fresh.size(), m_stackNames.size() - 1); + beginRemoveRows(createIndex(-1, -1), static_cast(fresh.size()), static_cast(m_stackNames.size() - 1)); m_stackNames = fresh; endRemoveRows(); } else { - beginInsertRows(createIndex(-1, -1), m_stackNames.size(), fresh.size() - 1); + beginInsertRows(createIndex(-1, -1), static_cast(m_stackNames.size()), static_cast(fresh.size() - 1)); m_stackNames = fresh; endInsertRows(); } diff --git a/Code/Editor/Util/AffineParts.cpp b/Code/Editor/Util/AffineParts.cpp index 7e6a1be35b..d83a1986b9 100644 --- a/Code/Editor/Util/AffineParts.cpp +++ b/Code/Editor/Util/AffineParts.cpp @@ -9,8 +9,6 @@ #include "EditorDefs.h" -#pragma warning ( disable : 4244 ) // conversion from 'double' to 'float', possible loss of data. - /**** Decompose.h - Basic declarations ****/ typedef struct { @@ -160,11 +158,11 @@ static Quatern Qt_FromMatrix(HMatrix mat) if (tr >= 0.0) { s = sqrt(tr + mat[W][W]); - qu.w = s * 0.5; + qu.w = static_cast(s * 0.5); s = 0.5 / s; - qu.x = (mat[Z][Y] - mat[Y][Z]) * s; - qu.y = (mat[X][Z] - mat[Z][X]) * s; - qu.z = (mat[Y][X] - mat[X][Y]) * s; + qu.x = static_cast((mat[Z][Y] - mat[Y][Z]) * s); + qu.y = static_cast((mat[X][Z] - mat[Z][X]) * s); + qu.z = static_cast((mat[Y][X] - mat[X][Y]) * s); } else { @@ -182,11 +180,11 @@ static Quatern Qt_FromMatrix(HMatrix mat) #define caseMacro(i, j, k, I, J, K) \ case I: \ s = sqrt((mat[I][I] - (mat[J][J] + mat[K][K])) + mat[W][W]); \ - qu.i = s * 0.5; \ + qu.i = static_cast(s * 0.5); \ s = 0.5 / s; \ - qu.j = (mat[I][J] + mat[J][I]) * s; \ - qu.k = (mat[K][I] + mat[I][K]) * s; \ - qu.w = (mat[K][J] - mat[J][K]) * s; \ + qu.j = static_cast((mat[I][J] + mat[J][I]) * s); \ + qu.k = static_cast((mat[K][I] + mat[I][K]) * s); \ + qu.w = static_cast((mat[K][J] - mat[J][K]) * s); \ break caseMacro(x, y, z, X, Y, Z); caseMacro(y, z, x, Y, Z, X); @@ -265,7 +263,7 @@ static void make_reflector(float* v, float* u) u[0] = v[0]; u[1] = v[1]; u[2] = v[2] + ((v[2] < 0.0) ? -s : s); - s = sqrt(2.0 / vdot(u, u)); + s = static_cast(sqrt(2.0f / vdot(u, u))); u[0] = u[0] * s; u[1] = u[1] * s; u[2] = u[2] * s; @@ -409,8 +407,8 @@ float polar_decomp(HMatrix M, HMatrix Q, HMatrix S) MadjT_one = norm_one(MadjTk); MadjT_inf = norm_inf(MadjTk); gamma = sqrt(sqrt((MadjT_one * MadjT_inf) / (M_one * M_inf)) / fabs(det)); - g1 = gamma * 0.5; - g2 = 0.5 / (gamma * det); + g1 = gamma * 0.5f; + g2 = 0.5f / (gamma * det); mat_copy(Ek, =, Mk, 3); mat_binop(Mk, =, g1 * Mk, +, g2 * MadjTk, 3); mat_copy(Ek, -=, Mk, 3); @@ -426,7 +424,7 @@ float polar_decomp(HMatrix M, HMatrix Q, HMatrix S) { for (int j = i; j < 3; j++) { - S[i][j] = S[j][i] = 0.5 * (S[i][j] + S[j][i]); + S[i][j] = S[j][i] = 0.5f * (S[i][j] + S[j][i]); } } return (det); @@ -456,7 +454,7 @@ HVect spect_decomp(HMatrix S, HMatrix U) OffD[Z] = S[X][Y]; for (sweep = 20; sweep > 0; sweep--) { - float sm = fabs(OffD[X]) + fabs(OffD[Y]) + fabs(OffD[Z]); + float sm = static_cast(fabs(OffD[X]) + fabs(OffD[Y]) + fabs(OffD[Z])); if (sm == 0.0) { break; @@ -498,16 +496,16 @@ HVect spect_decomp(HMatrix S, HMatrix U) { a = U[j][p]; b = U[j][q]; - U[j][p] -= s * (b + tau * a); - U[j][q] += s * (a - tau * b); + U[j][p] -= static_cast(s * (b + tau * a)); + U[j][q] += static_cast(s * (a - tau * b)); } } } } - kv.x = Diag[X]; - kv.y = Diag[Y]; - kv.z = Diag[Z]; - kv.w = 1.0; + kv.x = static_cast(Diag[X]); + kv.y = static_cast(Diag[Y]); + kv.z = static_cast(Diag[Z]); + kv.w = 1.0f; return (kv); } @@ -652,7 +650,7 @@ Quatern snuggle(Quatern q, HVect* k) } qp = Qt_Mul(q, p); t = sqrt(mag[win] + 0.5); - p = Qt_Mul(p, Qt_(0.0, 0.0, -qp.z / t, qp.w / t)); + p = Qt_Mul(p, Qt_(0.0f, 0.0f, static_cast(-qp.z / t), static_cast(qp.w / t))); p = Qt_Mul(qtoz, Qt_Conj(p)); } else @@ -723,14 +721,14 @@ Quatern snuggle(Quatern q, HVect* k) int ii; for (ii = 0; ii < 4; ii++) { - pa[ii] = sgn(neg[ii], 0.5); + pa[ii] = static_cast(sgn(neg[ii], 0.5f)); } } cycle(ka, par) } else { /*big*/ - pa[hi] = sgn(neg[hi], 1.0); + pa[hi] = static_cast(sgn(neg[hi], 1.0f)); } } else @@ -754,7 +752,7 @@ Quatern snuggle(Quatern q, HVect* k) } else { /*big*/ - pa[hi] = sgn(neg[hi], 1.0); + pa[hi] = static_cast(sgn(neg[hi], 1.0f)); } } p.x = -pa[0]; diff --git a/Code/Editor/Util/Contrib/NvFloatMath.inl b/Code/Editor/Util/Contrib/NvFloatMath.inl index 218d77b749..6bd3b9f7c5 100644 --- a/Code/Editor/Util/Contrib/NvFloatMath.inl +++ b/Code/Editor/Util/Contrib/NvFloatMath.inl @@ -103,7 +103,6 @@ it hasn't been integrated into this code drop yet. ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#pragma warning(disable:4996) class TVec { diff --git a/Code/Editor/Util/FileUtil.cpp b/Code/Editor/Util/FileUtil.cpp index f26ffa60ec..435ec67a99 100644 --- a/Code/Editor/Util/FileUtil.cpp +++ b/Code/Editor/Util/FileUtil.cpp @@ -455,7 +455,7 @@ bool CFileUtil::ExtractDccFilenameUsingNamingConventions(const QString& assetFil ////////////////////////////////////////////////////////////////////////// void CFileUtil::FormatFilterString(QString& filter) { - const int numPipeChars = std::count(filter.begin(), filter.end(), '|'); + const int numPipeChars = static_cast(std::count(filter.begin(), filter.end(), '|')); if (numPipeChars == 1) { filter = QStringLiteral("%1||").arg(filter); @@ -1228,7 +1228,7 @@ bool CFileUtil::CreatePath(const QString& strPath) nTotalPathQueueElements = cstrDirectoryQueue.size(); for (nCurrentPathQueue = 0; nCurrentPathQueue < nTotalPathQueueElements; ++nCurrentPathQueue) { - strCurrentDirectoryPath += cstrDirectoryQueue[nCurrentPathQueue]; + strCurrentDirectoryPath += cstrDirectoryQueue[static_cast(nCurrentPathQueue)]; strCurrentDirectoryPath += "\\"; // The value which will go out of this loop is the result of the attempt to create the // last directory, only. @@ -1368,8 +1368,8 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory return eCopyResult; } - QString sourceName = sourceDir.absoluteFilePath(cFiles[nCurrent]); - QString targetName = targetDir.absoluteFilePath(cFiles[nCurrent]); + QString sourceName = sourceDir.absoluteFilePath(cFiles[static_cast(nCurrent)]); + QString targetName = targetDir.absoluteFilePath(cFiles[static_cast(nCurrent)]); if (boConfirmOverwrite) { @@ -1387,7 +1387,7 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm file overwrite?"), QObject::tr("There is already a file named \"%1\" in the target folder. Do you want to move this file anyway replacing the old one?") - .arg(cFiles[nCurrent]), + .arg(cFiles[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { @@ -1448,8 +1448,8 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory bool bnLastDirectoryWasCreated(false); - QString sourceName = sourceDir.absoluteFilePath(cDirectories[nCurrent]); - QString targetName = targetDir.absoluteFilePath(cDirectories[nCurrent]); + QString sourceName = sourceDir.absoluteFilePath(cDirectories[static_cast(nCurrent)]); + QString targetName = targetDir.absoluteFilePath(cDirectories[static_cast(nCurrent)]); bnLastDirectoryWasCreated = QDir().mkpath(targetName); @@ -1473,7 +1473,7 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm directory overwrite?"), QObject::tr("There is already a folder named \"%1\" in the target folder. Do you want to move this folder anyway?") - .arg(cDirectories[nCurrent]), + .arg(cDirectories[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { @@ -1742,8 +1742,8 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto } bool bnLastFileWasCopied(false); - QString sourceName(sourceDir.absoluteFilePath(cFiles[nCurrent])); - QString targetName(targetDir.absoluteFilePath(cFiles[nCurrent])); + QString sourceName(sourceDir.absoluteFilePath(cFiles[static_cast(nCurrent)])); + QString targetName(targetDir.absoluteFilePath(cFiles[static_cast(nCurrent)])); if (boConfirmOverwrite) { @@ -1761,7 +1761,7 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm file overwrite?"), QObject::tr("There is already a file named \"%1\" in the target folder. Do you want to move this file anyway replacing the old one?") - .arg(cFiles[nCurrent]), + .arg(cFiles[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { @@ -1822,8 +1822,8 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto return eCopyResult; } - QString sourceName(sourceDir.absoluteFilePath(cDirectories[nCurrent])); - QString targetName(targetDir.absoluteFilePath(cDirectories[nCurrent])); + QString sourceName(sourceDir.absoluteFilePath(cDirectories[static_cast(nCurrent)])); + QString targetName(targetDir.absoluteFilePath(cDirectories[static_cast(nCurrent)])); bnLastDirectoryWasCreated = QDir().mkdir(targetName); @@ -1847,7 +1847,7 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm directory overwrite?"), QObject::tr("There is already a folder named \"%1\" in the target folder. Do you want to move this folder anyway?") - .arg(cDirectories[nCurrent]), + .arg(cDirectories[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { diff --git a/Code/Editor/Util/GdiUtil.cpp b/Code/Editor/Util/GdiUtil.cpp index eba5ac8579..1048b5f4dd 100644 --- a/Code/Editor/Util/GdiUtil.cpp +++ b/Code/Editor/Util/GdiUtil.cpp @@ -15,43 +15,6 @@ #include #include -bool ComputeThumbsLayoutInfo(float aContainerWidth, float aThumbWidth, float aMargin, UINT aThumbCount, UINT& rThumbsPerRow, float& rNewMargin) -{ - rThumbsPerRow = 0; - rNewMargin = 0; - - if (aThumbWidth <= 0 || aMargin <= 0 || (aThumbWidth + aMargin * 2) <= 0) - { - return false; - } - - if (aContainerWidth <= 0) - { - return true; - } - - rThumbsPerRow = (int) aContainerWidth / (aThumbWidth + aMargin * 2); - - if ((aThumbWidth + aMargin * 2) * aThumbCount < aContainerWidth) - { - rNewMargin = aMargin; - } - else - { - if (rThumbsPerRow > 0) - { - rNewMargin = (aContainerWidth - rThumbsPerRow * aThumbWidth); - - if (rNewMargin > 0) - { - rNewMargin = (float)rNewMargin / rThumbsPerRow / 2.0f; - } - } - } - - return true; -} - QColor ScaleColor(const QColor& c, float aScale) { QColor aColor = c; @@ -61,15 +24,11 @@ QColor ScaleColor(const QColor& c, float aScale) aColor = QColor(1, 1, 1); } - int r = aColor.red(); - int g = aColor.green(); - int b = aColor.blue(); + const float r = static_cast(aColor.red()) * aScale; + const float g = static_cast(aColor.green()) * aScale; + const float b = static_cast(aColor.blue()) * aScale; - r *= aScale; - g *= aScale; - b *= aScale; - - return QColor(CLAMP(r, 0, 255), CLAMP(g, 0, 255), CLAMP(b, 0, 255)); + return QColor(CLAMP(static_cast(r), 0, 255), CLAMP(static_cast(g), 0, 255), CLAMP(static_cast(b), 0, 255)); } CAlphaBitmap::CAlphaBitmap() diff --git a/Code/Editor/Util/GdiUtil.h b/Code/Editor/Util/GdiUtil.h index 55165b5799..f38cbc0c0e 100644 --- a/Code/Editor/Util/GdiUtil.h +++ b/Code/Editor/Util/GdiUtil.h @@ -14,16 +14,6 @@ #define CRYINCLUDE_EDITOR_UTIL_GDIUTIL_H #pragma once -//! function used to compute thumbs per row and spacing, used in asset browser and other tools where thumb layout is needed and maybe GDI canvas used -//! \param aContainerWidth the thumbs' container width -//! \param aThumbWidth the thumb image width -//! \param aMargin the thumb default minimum horizontal margin -//! \param aThumbCount the thumb count -//! \param rThumbsPerRow returned thumb count per single row -//! \param rNewMargin returned new computed margin between thumbs -//! \note The margin between thumbs will grow/shrink dynamically to keep up with the thumb count per row -bool ComputeThumbsLayoutInfo(float aContainerWidth, float aThumbWidth, float aMargin, UINT aThumbCount, UINT& rThumbsPerRow, float& rNewMargin); - QColor ScaleColor(const QColor& coor, float aScale); //! This class loads alpha-channel bitmaps and holds a DC for use with AlphaBlend function diff --git a/Code/Editor/Util/GuidUtil.h b/Code/Editor/Util/GuidUtil.h index 2a82e3682b..9952d6b4ed 100644 --- a/Code/Editor/Util/GuidUtil.h +++ b/Code/Editor/Util/GuidUtil.h @@ -64,14 +64,14 @@ inline GUID GuidUtil::FromString(const char* guidString) guid.Data3 = 0; azsscanf(guidString, "{%8" SCNx32 "-%4hX-%4hX-%2X%2X-%2X%2X%2X%2X%2X%2X}", &guid.Data1, &guid.Data2, &guid.Data3, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5], &d[6], &d[7]); - guid.Data4[0] = d[0]; - guid.Data4[1] = d[1]; - guid.Data4[2] = d[2]; - guid.Data4[3] = d[3]; - guid.Data4[4] = d[4]; - guid.Data4[5] = d[5]; - guid.Data4[6] = d[6]; - guid.Data4[7] = d[7]; + guid.Data4[0] = static_cast(d[0]); + guid.Data4[1] = static_cast(d[1]); + guid.Data4[2] = static_cast(d[2]); + guid.Data4[3] = static_cast(d[3]); + guid.Data4[4] = static_cast(d[4]); + guid.Data4[5] = static_cast(d[5]); + guid.Data4[6] = static_cast(d[6]); + guid.Data4[7] = static_cast(d[7]); return guid; } diff --git a/Code/Editor/Util/ImageASC.cpp b/Code/Editor/Util/ImageASC.cpp index 11dad7b696..c166917a68 100644 --- a/Code/Editor/Util/ImageASC.cpp +++ b/Code/Editor/Util/ImageASC.cpp @@ -55,9 +55,9 @@ bool CImageASC::Save(const QString& fileName, const CFloatImage& image) fprintf(file, fileHeader.c_str()); // Then print all the pixels. - for (int y = 0; y < height; y++) + for (uint32 y = 0; y < height; y++) { - for (int x = 0; x < width; x++) + for (uint32 x = 0; x < width; x++) { fprintf(file, "%.7f ", pixels[x + y * width]); } @@ -132,7 +132,7 @@ bool CImageASC::Load(const QString& fileName, CFloatImage& image) token = azstrtok(nullptr, 0, seps, &nextToken); validData = validData && (azstricmp(token, "nodata_value") == 0); token = azstrtok(nullptr, 0, seps, &nextToken); - nodataValue = atof(token); + nodataValue = static_cast(atof(token)); if (!validData) { @@ -157,7 +157,7 @@ bool CImageASC::Load(const QString& fileName, CFloatImage& image) if (token != nullptr) { // Negative heights aren't supported, clamp to 0. - pixelValue = max(0.0, atof(token)); + pixelValue = max(0.0f, static_cast(atof(token))); // If this is a location we specifically don't have data for, set it to 0. if (pixelValue == nodataValue) diff --git a/Code/Editor/Util/ImageGif.cpp b/Code/Editor/Util/ImageGif.cpp index 2c07fc9acb..a9ab4efdaf 100644 --- a/Code/Editor/Util/ImageGif.cpp +++ b/Code/Editor/Util/ImageGif.cpp @@ -185,7 +185,7 @@ bool CImageGif::Load(const QString& fileName, CImageEx& outImage) CLogFile::FormatLine("File not found %s", fileName.toUtf8().data()); return false; } - long filesize = file.GetLength(); + long filesize = static_cast(file.GetLength()); data.resize(filesize); uint8* ptr = &data[0]; @@ -411,7 +411,7 @@ bool CImageGif::Load(const QString& fileName, CImageEx& outImage) FreeCode = FirstFree; CurCode = OldCode = Code = ReadCode(); FinChar = CurCode & BitMask; - AddToPixel (FinChar); + AddToPixel(static_cast(FinChar)); } else { @@ -455,7 +455,7 @@ bool CImageGif::Load(const QString& fileName, CImageEx& outImage) for (i = OutCount - 1; i >= 0; i--) { - AddToPixel (OutCode[i]); + AddToPixel(static_cast(OutCode[i])); } OutCount = 0; diff --git a/Code/Editor/Util/ImageHistogram.cpp b/Code/Editor/Util/ImageHistogram.cpp index 15f6bc2e47..acea2dc340 100644 --- a/Code/Editor/Util/ImageHistogram.cpp +++ b/Code/Editor/Util/ImageHistogram.cpp @@ -220,5 +220,5 @@ void CImageHistogram::ComputeStatisticsForChannel(int aIndex) } } - m_median[aIndex] = median; + m_median[aIndex] = static_cast(median); } diff --git a/Code/Editor/Util/ImageTIF.cpp b/Code/Editor/Util/ImageTIF.cpp index 25e4296154..7929d63030 100644 --- a/Code/Editor/Util/ImageTIF.cpp +++ b/Code/Editor/Util/ImageTIF.cpp @@ -60,7 +60,7 @@ libtiffDummyReadProc (thandle_t fd, tdata_t buf, tsize_t size) memcpy(buf, &memImage->buffer[memImage->offset], size); - memImage->offset += size; + memImage->offset += static_cast(size); // Return the amount of data read return size; @@ -79,19 +79,19 @@ libtiffDummySeekProc (thandle_t fd, toff_t off, int i) switch (i) { case SEEK_SET: - memImage->offset = off; + memImage->offset = static_cast(off); break; case SEEK_CUR: - memImage->offset += off; + memImage->offset += static_cast(off); break; case SEEK_END: - memImage->offset = memImage->size - off; + memImage->offset = static_cast(memImage->size - off); break; default: - memImage->offset = off; + memImage->offset = static_cast(off); break; } @@ -119,7 +119,7 @@ bool CImageTIF::Load(const QString& fileName, CImageEx& outImage) std::vector data; - memImage.size = file.GetLength(); + memImage.size = static_cast(file.GetLength()); data.resize(memImage.size); memImage.buffer = &data[0]; @@ -210,7 +210,7 @@ bool CImageTIF::Load(const QString& fileName, CFloatImage& outImage) std::vector data; - memImage.size = file.GetLength(); + memImage.size = static_cast(file.GetLength()); data.resize(memImage.size); memImage.buffer = &data[0]; @@ -262,7 +262,7 @@ bool CImageTIF::Load(const QString& fileName, CFloatImage& outImage) } } - uint32 linesize = TIFFScanlineSize(tif); + uint32 linesize = static_cast(TIFFScanlineSize(tif)); uint8* linebuf = static_cast(_TIFFmalloc(linesize)); // We assume that a scanline has all of the samples in it. Validate the assumption. @@ -460,7 +460,7 @@ const char* CImageTIF::GetPreset(const QString& fileName) MemImage memImage; - memImage.size = file.GetLength(); + memImage.size = static_cast(file.GetLength()); data.resize(memImage.size); memImage.buffer = &data[0]; diff --git a/Code/Editor/Util/ImageUtil.cpp b/Code/Editor/Util/ImageUtil.cpp index 5753e0a138..00e33162cf 100644 --- a/Code/Editor/Util/ImageUtil.cpp +++ b/Code/Editor/Util/ImageUtil.cpp @@ -106,9 +106,9 @@ bool CImageUtil::SavePGM(const QString& fileName, const CImageEx& image) fprintf(file, fileHeader.c_str()); // Then print all the pixels. - for (int32 y = 0; y < height; y++) + for (uint32 y = 0; y < height; y++) { - for (int32 x = 0; x < width; x++) + for (uint32 x = 0; x < width; x++) { fprintf(file, "%d ", pixels[x + (y * width)]); } @@ -478,7 +478,7 @@ unsigned char CImageUtil::GetBilinearFilteredAt(const int iniX256, const int ini DWORD x = (DWORD)(iniX256) >> 8; DWORD y = (DWORD)(iniY256) >> 8; - if (x >= image.GetWidth() - 1 || y >= image.GetHeight() - 1) + if (x >= static_cast(image.GetWidth() - 1) || y >= static_cast(image.GetHeight() - 1)) { return image.ValueAt(x, y); // border is not filtered, 255 to get in range 0..1 } diff --git a/Code/Editor/Util/KDTree.cpp b/Code/Editor/Util/KDTree.cpp index 4547149e9b..182b9b8eb1 100644 --- a/Code/Editor/Util/KDTree.cpp +++ b/Code/Editor/Util/KDTree.cpp @@ -190,7 +190,7 @@ bool SearchForBestSplitPos(CKDTree::ESplitAxis axis, const std::vector(indices.size()); for (int i = 0; i < nSizeOfIndices; ++i) { @@ -329,7 +329,7 @@ bool CKDTree::Build(IStatObj* pStatObj) entireBoundBox.Reset(); std::vector indices; - for (int i = 0, iStatObjSize(m_StatObjectList.size()); i < iStatObjSize; ++i) + for (int i = 0, iStatObjSize = static_cast(m_StatObjectList.size()); i < iStatObjSize; ++i) { IIndexedMesh* pMesh = m_StatObjectList[i].pStatObj->GetIndexedMesh(true); if (pMesh == nullptr) diff --git a/Code/Editor/Util/MemoryBlock.cpp b/Code/Editor/Util/MemoryBlock.cpp index 03d432762d..e840a1735e 100644 --- a/Code/Editor/Util/MemoryBlock.cpp +++ b/Code/Editor/Util/MemoryBlock.cpp @@ -175,7 +175,7 @@ void CMemoryBlock::Uncompress(CMemoryBlock& toBlock) const #endif uncompress((unsigned char*)toBlock.GetBuffer(), &destSize, (unsigned char*)GetBuffer(), GetSize()); assert(result == Z_OK); - assert(destSize == m_uncompressedSize); + assert(destSize == static_cast(m_uncompressedSize)); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Util/NamedData.cpp b/Code/Editor/Util/NamedData.cpp index 240d71f58d..67e69a0392 100644 --- a/Code/Editor/Util/NamedData.cpp +++ b/Code/Editor/Util/NamedData.cpp @@ -158,7 +158,7 @@ bool CNamedData::Serialize(CArchive& ar) { if (ar.IsStoring()) { - int iSize = m_blocks.size(); + int iSize = static_cast(m_blocks.size()); ar << iSize; for (TBlocks::iterator it = m_blocks.begin(); it != m_blocks.end(); it++) @@ -286,7 +286,7 @@ bool CNamedData::Load(const QString& levelPath, [[maybe_unused]] CPakFile& pakFi CCryFile cfile; if (cfile.Open(Path::Make(levelPath, filename).toUtf8().data(), "rb")) { - int fileSize = cfile.GetLength(); + int fileSize = static_cast(cfile.GetLength()); if (fileSize > 0) { QString key = Path::GetFileName(filename); @@ -307,7 +307,7 @@ bool CNamedData::Load(const QString& levelPath, [[maybe_unused]] CPakFile& pakFi CCryFile cfile; if (cfile.Open(Path::Make(levelPath, filename).toUtf8().data(), "rb")) { - int fileSize = cfile.GetLength(); + int fileSize = static_cast(cfile.GetLength()); if (fileSize > 0) { // Read uncompressed data size. diff --git a/Code/Editor/Util/PakFile.cpp b/Code/Editor/Util/PakFile.cpp index 88d5598495..fc8431ef24 100644 --- a/Code/Editor/Util/PakFile.cpp +++ b/Code/Editor/Util/PakFile.cpp @@ -106,7 +106,7 @@ bool CPakFile::UpdateFile(const char* filename, CCryMemFile& file, bool bCompres { if (m_pArchive) { - int nSize = file.GetLength(); + int nSize = static_cast(file.GetLength()); UpdateFile(filename, file.GetMemPtr(), nSize, bCompress); file.Close(); diff --git a/Code/Editor/Util/Util.h b/Code/Editor/Util/Util.h index b0ec0db818..61bb0eed09 100644 --- a/Code/Editor/Util/Util.h +++ b/Code/Editor/Util/Util.h @@ -137,8 +137,6 @@ namespace Util { x = x - 1; -#pragma warning(push) -#pragma warning(disable : 4293) if (sizeof(TInteger) > 0) { x |= x >> 1; @@ -163,7 +161,6 @@ namespace Util { x |= x >> 32; } -#pragma warning(pop) return x + 1; } diff --git a/Code/Editor/Util/Variable.cpp b/Code/Editor/Util/Variable.cpp index 97c2a1e8af..3d7c35ac1c 100644 --- a/Code/Editor/Util/Variable.cpp +++ b/Code/Editor/Util/Variable.cpp @@ -511,7 +511,7 @@ CVarGlobalEnumList::CVarGlobalEnumList(const QString& enumName) //! Get the name of specified value in enumeration. QString CVarGlobalEnumList::GetItemName(uint index) { - if (!m_pEnum || index >= m_pEnum->strings.size()) + if (!m_pEnum || index >= static_cast(m_pEnum->strings.size())) { return QString(); } diff --git a/Code/Editor/Util/Variable.h b/Code/Editor/Util/Variable.h index da506b9db0..9c3f96a3f6 100644 --- a/Code/Editor/Util/Variable.h +++ b/Code/Editor/Util/Variable.h @@ -405,7 +405,7 @@ public: unsigned char GetDataType() const { return m_dataType; }; void SetDataType(unsigned char dataType) { m_dataType = dataType; } - void SetFlags(int flags) { m_flags = flags; } + void SetFlags(int flags) { m_flags = static_cast(flags); } int GetFlags() const { return m_flags; } void SetFlagRecursive(EFlags flag) { m_flags |= flag; } diff --git a/Code/Editor/Util/VariablePropertyType.cpp b/Code/Editor/Util/VariablePropertyType.cpp index 17c80a505c..3f472dde72 100644 --- a/Code/Editor/Util/VariablePropertyType.cpp +++ b/Code/Editor/Util/VariablePropertyType.cpp @@ -171,7 +171,7 @@ namespace Prop { // Limit step size to 1000. int nPrec = max(3 - int(log(m_rangeMax - m_rangeMin) / log(10.f)), 0); - m_step = max(m_step, powf(10.f, -nPrec)); + m_step = max(m_step, powf(10.f, static_cast(-nPrec))); } } diff --git a/Code/Editor/Util/XmlArchive.cpp b/Code/Editor/Util/XmlArchive.cpp index ca399632d4..e6bc93fdf4 100644 --- a/Code/Editor/Util/XmlArchive.cpp +++ b/Code/Editor/Util/XmlArchive.cpp @@ -120,7 +120,7 @@ bool CXmlArchive::SaveToPak([[maybe_unused]] const QString& levelPath, CPakFile& // Save xml file. QString xmlFilename = "Level.editor_xml"; - pakFile.UpdateFile(xmlFilename.toUtf8().data(), (void*)pXmlStrData->GetString(), pXmlStrData->GetStringLength()); + pakFile.UpdateFile(xmlFilename.toUtf8().data(), (void*)pXmlStrData->GetString(), static_cast(pXmlStrData->GetStringLength())); if (pakFile.GetArchive()) { diff --git a/Code/Editor/Util/bitarray.h b/Code/Editor/Util/bitarray.h index f55d195fd1..5a887b02d5 100644 --- a/Code/Editor/Util/bitarray.h +++ b/Code/Editor/Util/bitarray.h @@ -220,7 +220,7 @@ public: b.resize((compsize + 1) << 3); out = (char*)b.m_bits; in = (char*)m_bits; - *out++ = bsize; + *out++ = static_cast(bsize); for (i = 0; i < bsize; i++) { *out++ = in[i]; @@ -239,7 +239,7 @@ public: } } i--; - *out++ = countz; + *out++ = static_cast(countz); } } } diff --git a/Code/Editor/ViewPane.cpp b/Code/Editor/ViewPane.cpp index 466274c06e..a932f05c79 100644 --- a/Code/Editor/ViewPane.cpp +++ b/Code/Editor/ViewPane.cpp @@ -646,7 +646,7 @@ namespace if (viewPane && viewPane->GetViewport()) { const QRect rcViewport = viewPane->GetViewport()->rect(); - return AZ::Vector2(rcViewport.width(), rcViewport.height()); + return AZ::Vector2(static_cast(rcViewport.width()), static_cast(rcViewport.height())); } else { diff --git a/Code/Editor/Viewport.cpp b/Code/Editor/Viewport.cpp index fe60778c13..3c34f464b8 100644 --- a/Code/Editor/Viewport.cpp +++ b/Code/Editor/Viewport.cpp @@ -419,7 +419,7 @@ void QtViewport::Update() ////////////////////////////////////////////////////////////////////////// QPoint QtViewport::WorldToView(const Vec3& wp) const { - return QPoint(wp.x, wp.y); + return QPoint(static_cast(wp.x), static_cast(wp.y)); } ////////////////////////////////////////////////////////////////////////// @@ -427,8 +427,8 @@ Vec3 QtViewport::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nFlags) cons { QPoint p = WorldToView(wp); Vec3 out; - out.x = p.x(); - out.y = p.y(); + out.x = static_cast(p.x()); + out.y = static_cast(p.y()); out.z = wp.z; return out; } @@ -437,8 +437,8 @@ Vec3 QtViewport::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nFlags) cons Vec3 QtViewport::ViewToWorld(const QPoint& vp, bool* pCollideWithTerrain, [[maybe_unused]] bool onlyTerrain, [[maybe_unused]] bool bSkipVegetation, [[maybe_unused]] bool bTestRenderMesh, [[maybe_unused]] bool* collideWithObject) const { Vec3 wp; - wp.x = vp.x(); - wp.y = vp.y(); + wp.x = static_cast(vp.x()); + wp.y = static_cast(vp.y()); wp.z = 0; if (pCollideWithTerrain) { @@ -520,7 +520,7 @@ void QtViewport::mouseMoveEvent(QMouseEvent* event) void QtViewport::wheelEvent(QWheelEvent* event) { - OnMouseWheel(event->modifiers(), event->angleDelta().y(), event->position().toPoint()); + OnMouseWheel(event->modifiers(), static_cast(event->angleDelta().y()), event->position().toPoint()); event->accept(); } @@ -1276,9 +1276,9 @@ float QtViewport::GetDistanceToLine(const Vec3& lineP1, const Vec3& lineP2, cons QPoint p2 = WorldToView(lineP2); return PointToLineDistance2D( - Vec3(p1.x(), p1.y(), 0), - Vec3(p2.x(), p2.y(), 0), - Vec3(point.x(), point.y(), 0)); + Vec3(static_cast(p1.x()), static_cast(p1.y()), 0.0f), + Vec3(static_cast(p2.x()), static_cast(p2.y()), 0.0f), + Vec3(static_cast(point.x()), static_cast(point.y()), 0.0f)); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/ViewportManipulatorController.cpp b/Code/Editor/ViewportManipulatorController.cpp index 5282af009f..a67d733cf9 100644 --- a/Code/Editor/ViewportManipulatorController.cpp +++ b/Code/Editor/ViewportManipulatorController.cpp @@ -113,8 +113,8 @@ namespace SandboxEditor windowSize, event.m_windowHandle, &AzFramework::WindowRequestBus::Events::GetClientAreaSize); auto screenPoint = AzFramework::ScreenPoint( - position->m_normalizedPosition.GetX() * windowSize.m_width, - position->m_normalizedPosition.GetY() * windowSize.m_height); + static_cast(position->m_normalizedPosition.GetX() * windowSize.m_width), + static_cast(position->m_normalizedPosition.GetY() * windowSize.m_height)); m_mouseInteraction.m_mousePick.m_screenCoordinates = screenPoint; AZStd::optional ray; diff --git a/Code/Editor/ViewportTitleDlg.cpp b/Code/Editor/ViewportTitleDlg.cpp index eacf01a6fe..a6dee5382e 100644 --- a/Code/Editor/ViewportTitleDlg.cpp +++ b/Code/Editor/ViewportTitleDlg.cpp @@ -311,7 +311,7 @@ void CViewportTitleDlg::OnInitDialog() AZ::VR::VREventBus::Handler::BusConnect(); QFontMetrics metrics({}); - int width = metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier; + int width = static_cast(metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier); m_cameraSpeed->setFixedWidth(width); @@ -462,7 +462,7 @@ void CViewportTitleDlg::AddFOVMenus(QMenu* menu, std::function call float fov = gSettings.viewports.fDefaultFov; bool ok; - float f = customPreset.toDouble(&ok); + float f = customPreset.toFloat(&ok); if (ok) { fov = std::max(1.0f, f); @@ -482,7 +482,7 @@ void CViewportTitleDlg::OnMenuFOVCustom() if (ok) { - m_pViewPane->SetViewportFOV(fov); + m_pViewPane->SetViewportFOV(static_cast(fov)); // Update the custom presets. const QString text = QString::number(fov); @@ -986,12 +986,12 @@ void CViewportTitleDlg::OnAngleSnappingToggled() void CViewportTitleDlg::OnGridSpinBoxChanged(double value) { - SandboxEditor::SetGridSnappingSize(value); + SandboxEditor::SetGridSnappingSize(static_cast(value)); } void CViewportTitleDlg::OnAngleSpinBoxChanged(double value) { - SandboxEditor::SetAngleSnappingSize(value); + SandboxEditor::SetAngleSnappingSize(static_cast(value)); } void CViewportTitleDlg::UpdateOverFlowMenuState() diff --git a/Code/Editor/WipFeatureManager.cpp b/Code/Editor/WipFeatureManager.cpp index f6fbc7ac93..4fb9ed1d93 100644 --- a/Code/Editor/WipFeatureManager.cpp +++ b/Code/Editor/WipFeatureManager.cpp @@ -189,7 +189,7 @@ bool CWipFeatureManager::Load(const char* pFilename, bool bClearExisting) for (size_t i = 0, iCount = root->getChildCount(); i < iCount; ++i) { SWipFeatureInfo wf; - XmlNodeRef node = root->getChild(i); + XmlNodeRef node = root->getChild(static_cast(i)); XmlString str; node->getAttr("id", wf.m_id); diff --git a/Code/Editor/WipFeaturesDlg.cpp b/Code/Editor/WipFeaturesDlg.cpp index 0d0a179539..bc4372d7fb 100644 --- a/Code/Editor/WipFeaturesDlg.cpp +++ b/Code/Editor/WipFeaturesDlg.cpp @@ -35,7 +35,7 @@ public: int rowCount(const QModelIndex& parent = QModelIndex()) const override { - return parent.isValid() ? 0 : CWipFeatureManager::Instance()->GetFeatures().size(); + return parent.isValid() ? 0 : static_cast(CWipFeatureManager::Instance()->GetFeatures().size()); } int columnCount(const QModelIndex& parent = QModelIndex()) const override diff --git a/Code/Editor/editor_lib_files.cmake b/Code/Editor/editor_lib_files.cmake index c10db3bac5..6c5096a8f5 100644 --- a/Code/Editor/editor_lib_files.cmake +++ b/Code/Editor/editor_lib_files.cmake @@ -503,6 +503,7 @@ set(FILES LogFileImpl.h Objects/ClassDesc.cpp Objects/ClassDesc.h + Objects/DisplayContextShared.inl Objects/IEntityObjectListener.h Objects/SelectionGroup.cpp Objects/SelectionGroup.h diff --git a/Code/Framework/AzCore/AzCore/Console/Console.cpp b/Code/Framework/AzCore/AzCore/Console/Console.cpp index 016bd86e46..a1b8a1759d 100644 --- a/Code/Framework/AzCore/AzCore/Console/Console.cpp +++ b/Code/Framework/AzCore/AzCore/Console/Console.cpp @@ -198,7 +198,7 @@ namespace AZ ConsoleFunctorBase* Console::FindCommand(AZStd::string_view command) { CVarFixedString lowerName(command); - AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); }); + AZStd::to_lower(lowerName.begin(), lowerName.end()); CommandMap::iterator iter = m_commands.find(lowerName); if (iter != m_commands.end()) @@ -284,7 +284,7 @@ namespace AZ } CVarFixedString lowerName = functor->GetName(); - AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); }); + AZStd::to_lower(lowerName.begin(), lowerName.end()); CommandMap::iterator iter = m_commands.find(lowerName); if (iter != m_commands.end()) { @@ -327,7 +327,7 @@ namespace AZ } CVarFixedString lowerName = functor->GetName(); - AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); }); + AZStd::to_lower(lowerName.begin(), lowerName.end()); CommandMap::iterator iter = m_commands.find(lowerName); if (iter != m_commands.end()) { @@ -403,7 +403,7 @@ namespace AZ ConsoleFunctorFlags flags = ConsoleFunctorFlags::Null; CVarFixedString lowerName(command); - AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); }); + AZStd::to_lower(lowerName.begin(), lowerName.end()); CommandMap::iterator iter = m_commands.find(lowerName); if (iter != m_commands.end()) diff --git a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl index 4e8356b436..d0bf4c1dbe 100644 --- a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl +++ b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl @@ -221,7 +221,7 @@ namespace AZ::IO::Internal ? strncmp(left.data(), right.data(), maxCharsToCompare) : azstrnicmp(left.data(), right.data(), maxCharsToCompare); return charCompareResult == 0 - ? aznumeric_cast(left.size()) - aznumeric_cast(right.size()) + ? static_cast(aznumeric_cast(left.size()) - aznumeric_cast(right.size())) : charCompareResult; } } diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp index 09ab10b8cf..e838324408 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp @@ -39,7 +39,7 @@ namespace AZ break; } - u32 cacheSize = m_cacheSizeMib * 1_mib; + u32 cacheSize = static_cast(m_cacheSizeMib * 1_mib); if (blockSize * 2 > cacheSize) { AZ_Warning("Streamer", false, "Size (%u) for BlockCache isn't big enough to hold at least two cache blocks of size (%zu). " @@ -189,7 +189,7 @@ namespace AZ s32 numAvailableSlots = CalculateAvailableRequestSlots(); status.m_numAvailableSlots = AZStd::min(status.m_numAvailableSlots, numAvailableSlots); status.m_isIdle = status.m_isIdle && - numAvailableSlots == m_numBlocks && + static_cast(numAvailableSlots) == m_numBlocks && m_delayedSections.empty(); } diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp index 6ec3fb295c..e0e512e21f 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp @@ -36,7 +36,7 @@ namespace AZ break; } - u32 cacheSize = m_cacheSizeMib * 1_mib; + u32 cacheSize = static_cast(m_cacheSizeMib * 1_mib); if (blockSize > cacheSize) { AZ_Warning("Streamer", false, "Size (%u) for DedicatedCache isn't big enough to hold at least one cache blocks of size (%zu). " diff --git a/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h b/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h index 27efde7e64..a45846c107 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h +++ b/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h @@ -13,11 +13,6 @@ #include -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable: 4355) // 'this' : used in base member initializer list -#endif - // A reasonable define for a stack allocator size for the high level jobs. #define AZ_JOBS_DEFAULT_STACK_ALLOCATOR_SIZE AZStd::GetMax(2048,512 * AZStd::thread::hardware_concurrency()) @@ -769,9 +764,5 @@ namespace AZ } } -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif - #endif #pragma once diff --git a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl index 7320c9be1c..484351c799 100644 --- a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl +++ b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl @@ -10,12 +10,9 @@ #include -#ifdef _MSC_VER // Unity builds on windows using the scalar backend are tripping some really strange warning behavior.. // Disable the warning so we can test the scalar implementation with unity on windows -# pragma warning (push) -# pragma warning (disable: 4723) // Potential divide by zero -#endif +AZ_PUSH_DISABLE_WARNING(4723, "-Wunknown-warning-option") // Potential divide by zero namespace AZ { @@ -1049,6 +1046,4 @@ namespace AZ } } -#ifdef _MSC_VER -# pragma warning (pop) -#endif +AZ_POP_DISABLE_WARNING \ No newline at end of file diff --git a/Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp b/Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp index eabfcd8cf0..edf481a590 100644 --- a/Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp +++ b/Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp @@ -57,7 +57,7 @@ namespace AZ float GetPerspectiveMatrixFOV(const Matrix4x4& m) { - return 2.0 * AZStd::atan(1.0f / m.GetElement(1, 1)); + return 2.0f * AZStd::atan(1.0f / m.GetElement(1, 1)); } Matrix4x4* MakeFrustumMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist, bool reverseDepth) diff --git a/Code/Framework/AzCore/AzCore/Math/Quaternion.h b/Code/Framework/AzCore/AzCore/Math/Quaternion.h index 36def91817..f2c266ed3e 100644 --- a/Code/Framework/AzCore/AzCore/Math/Quaternion.h +++ b/Code/Framework/AzCore/AzCore/Math/Quaternion.h @@ -246,10 +246,6 @@ namespace AZ //! Takes the absolute value of each component of the quaternion. Quaternion GetAbs() const; -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec4::FloatType m_value; @@ -263,9 +259,6 @@ namespace AZ float m_w; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; //! Non-member functionality belonging to the AZ namespace diff --git a/Code/Framework/AzCore/AzCore/Math/Vector2.h b/Code/Framework/AzCore/AzCore/Math/Vector2.h index c667f48010..b2b1ceeb4d 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector2.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector2.h @@ -281,10 +281,6 @@ namespace AZ private: -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec2::FloatType m_value; @@ -296,9 +292,6 @@ namespace AZ float m_y; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; //! Allows pre-multiplying by a float. diff --git a/Code/Framework/AzCore/AzCore/Math/Vector3.h b/Code/Framework/AzCore/AzCore/Math/Vector3.h index 6b7ded5641..4bf0a18894 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector3.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector3.h @@ -312,10 +312,6 @@ namespace AZ private: -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec3::FloatType m_value; @@ -328,9 +324,6 @@ namespace AZ float m_z; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; //! Non member functionality belonging to the AZ namespace. diff --git a/Code/Framework/AzCore/AzCore/Math/Vector4.h b/Code/Framework/AzCore/AzCore/Math/Vector4.h index 7ae0350805..6bd67e8831 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector4.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector4.h @@ -283,11 +283,6 @@ namespace AZ Simd::Vec4::FloatType GetSimdValue() const; protected: - -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec4::FloatType m_value; @@ -301,9 +296,6 @@ namespace AZ float m_w; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; } diff --git a/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl b/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl index 861e2de7ac..3756fbb36c 100644 --- a/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl +++ b/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl @@ -1294,14 +1294,6 @@ int mspace_mallopt(int, int); /*------------------------------ internal #includes ---------------------- */ -#ifdef WIN32 -#pragma warning(push) -#pragma warning( disable : 4146 ) /* no "unsigned" warnings */ -# ifdef AZ_PLATFORM_WINDOWS -# pragma warning( disable : 4267 ) -# endif -#endif /* WIN32 */ - #include /* for printing in malloc_stats */ #ifndef LACKS_ERRNO_H @@ -2170,7 +2162,7 @@ typedef unsigned int flag_t; /* The type of various bit flag sets */ #define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) /* Bounds on request (not chunk) sizes. */ -#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) +#define MAX_REQUEST ((~MIN_CHUNK_SIZE + 1) << 2) #define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) /* pad request bytes into a usable size */ @@ -2881,10 +2873,10 @@ static size_t traverse_and_check(mstate m); #define treemap_is_marked(M, i) ((M)->treemap & idx2bit(i)) /* isolate the least set bit of a bitmap */ -#define least_bit(x) ((x) & - (x)) +#define least_bit(x) ((x) & (~(x)+1)) /* mask with all bits to left of least bit of x on */ -#define left_bits(x) ((x << 1) | -(x << 1)) +#define left_bits(x) ((x << 1) | (~(x << 1)+1)) /* mask with all bits to left of or equal to least bit of x on */ #define same_or_left_bits(x) ((x) | -(x)) @@ -4528,7 +4520,7 @@ static int sys_trim(mstate m, size_t pad) static void* tmalloc_large(mstate m, size_t nb) { tchunkptr v = 0; - size_t rsize = -nb; /* Unsigned negation */ + size_t rsize = ~nb+1; /* Unsigned negation */ tchunkptr t; bindex_t idx; compute_tree_index(nb, idx); @@ -4807,7 +4799,7 @@ static void* internal_memalign(mstate m, size_t alignment, size_t bytes) char* br = (char*)mem2chunk((size_t)(((size_t)(mem + alignment - SIZE_T_ONE)) & - - alignment)); + (~alignment+1))); char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE) ? br : br + alignment; mchunkptr newp = (mchunkptr)pos; @@ -5489,7 +5481,7 @@ postaction: size_t msize; ensure_initialization(); msize = pad_request(sizeof(struct malloc_state)); - if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) + if (capacity < (~(msize + TOP_FOOT_SIZE + mparams.page_size)+1)) { size_t rs = ((capacity == 0) ? mparams.granularity : (capacity + TOP_FOOT_SIZE + msize)); @@ -5512,7 +5504,7 @@ postaction: ensure_initialization(); msize = pad_request(sizeof(struct malloc_state)); if (capacity > msize + TOP_FOOT_SIZE && - capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) + capacity < (~(msize + TOP_FOOT_SIZE + mparams.page_size)+1)) { m = init_user_mstate((char*)base, capacity); m->seg.sflags = EXTERN_BIT; @@ -6367,6 +6359,3 @@ postaction: */ -#ifdef WIN32 -#pragma warning(pop) -#endif /* WIN32 */ diff --git a/Code/Framework/AzCore/AzCore/PlatformDef.h b/Code/Framework/AzCore/AzCore/PlatformDef.h index 55126fdf4c..47f45931ba 100644 --- a/Code/Framework/AzCore/AzCore/PlatformDef.h +++ b/Code/Framework/AzCore/AzCore/PlatformDef.h @@ -87,9 +87,6 @@ #define AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING AZ_POP_DISABLE_WARNING # define AZ_FORCE_INLINE __forceinline -#if !defined(_DEBUG) -# pragma warning(disable:4714) //warning C4714 marked as __forceinline not inlined. Sadly this happens when LTCG during linking. We tried to NOT use force inline but VC 2012 is bad at inlining. -#endif /// Aligns a declaration. # define AZ_ALIGN(_decl, _alignment) \ diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h index 42fc762769..0c4eaf8383 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h @@ -24,11 +24,6 @@ #include #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - namespace AZStd { template @@ -4507,7 +4502,7 @@ namespace AZ params.resize(sizeof...(Args) + eBehaviorBusForwarderEventIndices::ParameterFirst); SetParameters(¶ms[eBehaviorBusForwarderEventIndices::Result], nullptr); SetParameters(¶ms[eBehaviorBusForwarderEventIndices::UserData], nullptr); - if (sizeof...(Args) > 0) + if constexpr (sizeof...(Args) > 0) { SetParameters(¶ms[eBehaviorBusForwarderEventIndices::ParameterFirst], nullptr); } @@ -4872,10 +4867,6 @@ namespace AZ } // namespace Internal } // namespace AZ -#if defined(AZ_COMPILER_MSVC) -# pragma warning(pop) -#endif - // pull AzStd on demand reflection #include #include diff --git a/Code/Framework/AzCore/AzCore/Serialization/EditContext.h b/Code/Framework/AzCore/AzCore/Serialization/EditContext.h index 492550f266..a08e971ac4 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/EditContext.h +++ b/Code/Framework/AzCore/AzCore/Serialization/EditContext.h @@ -656,26 +656,25 @@ namespace AZ using ElementType = typename AZStd::Utils::if_c::value, typename ElementTypeInfo::Type, typename ElementTypeInfo::ElementType>::type; AZ_Assert(m_classData->m_typeId == AzTypeInfo::Uuid(), "Data element (%s) belongs to a different class!", AzTypeInfo::Name()); -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif const SerializeContext::ClassData* classData = m_context->m_serializeContext.FindClassData(AzTypeInfo::Uuid()); if (classData && classData->m_editData) { return DataElement(uiId, memberVariable, classData->m_editData->m_name, classData->m_editData->m_description); } - else if (AZStd::is_enum::value && AzTypeInfo::Name() != nullptr) + else { - auto enumIter = m_context->m_enumData.find(AzTypeInfo::Uuid()); - if (enumIter != m_context->m_enumData.end()) + if constexpr (AZStd::is_enum::value) { - return DataElement(uiId, memberVariable, enumIter->second.m_name, enumIter->second.m_description); + if (AzTypeInfo::Name() != nullptr) + { + auto enumIter = m_context->m_enumData.find(AzTypeInfo::Uuid()); + if (enumIter != m_context->m_enumData.end()) + { + return DataElement(uiId, memberVariable, enumIter->second.m_name, enumIter->second.m_description); + } + } } } -#if defined(AZ_COMPILER_MSVC) -# pragma warning(pop) -#endif const char* typeName = AzTypeInfo::Name(); return DataElement(uiId, memberVariable, typeName, typeName); diff --git a/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp b/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp index da7a78e1b3..ff30291a70 100644 --- a/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp +++ b/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp @@ -342,8 +342,8 @@ namespace AZ::StringFunc::Internal { for (const char stripCharacter : stripCharacters) { - const char lower = tolower(stripCharacter); - const char upper = toupper(stripCharacter); + const char lower = static_cast(tolower(stripCharacter)); + const char upper = static_cast(toupper(stripCharacter)); if (lower != upper) { combinedStripCharacters.push_back(lower); diff --git a/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp b/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp index 13db590291..2bb88fbfa2 100644 --- a/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp +++ b/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp @@ -41,7 +41,7 @@ namespace AZ { Task& task = m_tasks[i]; task.m_graph = this; - task.m_successorOffset = cursor - m_successors.data(); + task.m_successorOffset = static_cast(cursor - m_successors.data()); cursor += task.m_outboundLinkCount; AZ_Assert(task.m_outboundLinkCount == links[i].size(), "Task outbound link information mismatch"); @@ -78,7 +78,7 @@ namespace AZ return remaining; } - if (m_waitEvent && remaining == (m_parent ? 1 : 0)) + if (m_waitEvent && remaining == (m_parent ? 1u : 0u)) { m_waitEvent->Signal(); } @@ -259,7 +259,7 @@ namespace AZ } bool isRetained = task->m_graph->m_parent != nullptr; - if (task->m_graph->Release() == (isRetained ? 1 : 0)) + if (task->m_graph->Release() == (isRetained ? 1u : 0u)) { m_executor->ReleaseGraph(); } diff --git a/Code/Framework/AzCore/AzCore/std/delegate/delegate.h b/Code/Framework/AzCore/AzCore/std/delegate/delegate.h index 610c1982f2..1b44437f31 100644 --- a/Code/Framework/AzCore/AzCore/std/delegate/delegate.h +++ b/Code/Framework/AzCore/AzCore/std/delegate/delegate.h @@ -291,9 +291,7 @@ namespace AZStd template <> struct SimplifyMemFunc { -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 4121) // alignment of a member was sensitive to packing + AZ_PUSH_DISABLE_WARNING(4121, "-Wunknown-warning-option") // alignment of a member was sensitive to packing // GenericClass* (X::*ProbeFunc) changes it's size. From Microsoft: // Jason Shirk [MSFT] // This is a known bug/issue. Unfortunately, we can't fix it in X86 product @@ -302,7 +300,6 @@ namespace AZStd // We have addressed the issue for all future platforms (including IA64) where // binary compatibility isn't yet an issue. // We can fix this warning by adding forward decl class __single_inheritance CLASS; if the XFuncType is member function. -#endif template inline static GenericClass* Convert(X* pthis, XFuncType function_to_bind, GenericMemFuncType& bound_func) { @@ -330,11 +327,7 @@ namespace AZStd u.s.codeptr = u2.s.codeptr; return (pthis->*u.ProbeFunc)(); } - -#if defined(AZ_COMPILER_MSVC) -# pragma warning(default: 4121) // alignment of a member was sensitive to packing -# pragma warning(pop) -#endif + AZ_POP_DISABLE_WARNING }; // Nasty hack for Microsoft and Intel (IA32 and Itanium) diff --git a/Code/Framework/AzCore/AzCore/std/function/function_base.h b/Code/Framework/AzCore/AzCore/std/function/function_base.h index c1dd669f51..32892a4c03 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_base.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_base.h @@ -20,13 +20,6 @@ #include #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning( push ) -# pragma warning( disable : 4793 ) // complaint about native code generation -# pragma warning( disable : 4127 ) // "conditional expression is constant" -# pragma warning( disable : 4275 ) // non dll-interface class 'stdext::exception' used as base for dll-interface class 'std::bad_cast' -#endif - #define AZSTD_FUNCTION_TARGET_FIX(x) #define AZSTD_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type) AZStd::enable_if_t, Type> @@ -796,12 +789,5 @@ namespace AZStd //#undef aztypeid //#undef aztypeid_cmp -#if defined(AZ_COMPILER_MSVC) -# pragma warning( default : 4793 ) // complaint about native code generation -# pragma warning( default : 4127 ) // "conditional expression is constant" -# pragma warning( default : 4275 ) // non dll-interface class 'stdext::exception' used as base for dll-interface class 'std::bad_cast' -# pragma warning( pop ) -#endif - #endif // AZSTD_FUNCTION_BASE_HEADER #pragma once diff --git a/Code/Framework/AzCore/AzCore/std/function/function_template.h b/Code/Framework/AzCore/AzCore/std/function/function_template.h index 586b02e671..7f388c4006 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_template.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_template.h @@ -13,11 +13,6 @@ #include #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning( push ) -# pragma warning( disable : 4127 ) // "conditional expression is constant" -#endif - namespace AZStd { namespace Internal @@ -689,7 +684,3 @@ namespace AZStd } }; } // end namespace AZStd - -#if defined(AZ_COMPILER_MSVC) -# pragma warning( pop ) -#endif diff --git a/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h b/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h index 524eff7e64..c8fc709778 100644 --- a/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h +++ b/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h @@ -489,24 +489,26 @@ namespace AZStd { return; } - - float loadFactor = (float)m_numElements.load(memory_order_acquire) / (float)m_storage.get_num_buckets(); - if (loadFactor > max_load_factor()) + else { - acquire_all(); - - //check the load factor again, as another thread may have beaten us to the rehash - size_type numElements = m_numElements.load(memory_order_acquire); - float maxLoadFactor = max_load_factor(); - size_type numBuckets = m_storage.get_num_buckets(); - loadFactor = (float)numElements / (float)numBuckets; - if (loadFactor > maxLoadFactor) + float loadFactor = (float)m_numElements.load(memory_order_acquire) / (float)m_storage.get_num_buckets(); + if (loadFactor > max_load_factor()) { - size_type minNumBuckets = (size_type)((float)numElements / maxLoadFactor); - m_storage.rehash(this, minNumBuckets); - } + acquire_all(); - release_all(); + // check the load factor again, as another thread may have beaten us to the rehash + size_type numElements = m_numElements.load(memory_order_acquire); + float maxLoadFactor = max_load_factor(); + size_type numBuckets = m_storage.get_num_buckets(); + loadFactor = (float)numElements / (float)numBuckets; + if (loadFactor > maxLoadFactor) + { + size_type minNumBuckets = (size_type)((float)numElements / maxLoadFactor); + m_storage.rehash(this, minNumBuckets); + } + + release_all(); + } } } diff --git a/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h b/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h index aaaf90e8f7..80dee72d03 100644 --- a/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h +++ b/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h @@ -192,9 +192,5 @@ namespace AZStd } } // namespace AZStd -/*#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif */ - #endif // #ifndef AZSTD_SMART_PTR_WEAK_PTR_H #pragma once diff --git a/Code/Framework/AzCore/AzCore/std/string/regex.h b/Code/Framework/AzCore/AzCore/std/string/regex.h index 2c120436d5..2ca223937b 100644 --- a/Code/Framework/AzCore/AzCore/std/string/regex.h +++ b/Code/Framework/AzCore/AzCore/std/string/regex.h @@ -22,11 +22,6 @@ // used for std::pointer_traits \note do an AZStd version #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 6011 28198) -#endif // AZ_COMPILER_MSVC - #ifndef AZ_REGEX_MAX_COMPLEXITY_COUNT #define AZ_REGEX_MAX_COMPLEXITY_COUNT 10000000L /* set to 0 to disable */ #endif /* AZ_REGEX_MAX_COMPLEXITY_COUNT */ @@ -4766,7 +4761,3 @@ namespace AZStd Trans(); } } // namespace AZStd - -#if defined(AZ_COMPILER_MSVC) -# pragma warning(pop) -#endif // AZ_COMPILER_MSVC diff --git a/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp b/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp index bf0a1023ab..fc707c9751 100644 --- a/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp +++ b/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp @@ -95,7 +95,7 @@ namespace AZ auto printElement = [&os, &mat](int64_t row, int64_t col) -> std::ostream& { const std::streamsize width = 10; - os << std::setw(width) << std::fixed << mat.GetElement(row, col); + os << std::setw(width) << std::fixed << mat.GetElement(static_cast(row), static_cast(col)); return os; }; diff --git a/Code/Framework/AzCore/Tests/Jobs.cpp b/Code/Framework/AzCore/Tests/Jobs.cpp index 4a1af4cc24..0eb46a0051 100644 --- a/Code/Framework/AzCore/Tests/Jobs.cpp +++ b/Code/Framework/AzCore/Tests/Jobs.cpp @@ -1736,7 +1736,7 @@ namespace Benchmark std::numeric_limits::max()); std::generate(m_randomPriorities.begin(), m_randomPriorities.end(), [&randomPriorityDistribution, &randomPriorityGenerator]() { - return randomPriorityDistribution(randomPriorityGenerator); + return static_cast(randomPriorityDistribution(randomPriorityGenerator)); }); // Generate some random depths diff --git a/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp b/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp index b05a95dbce..4570d79b83 100644 --- a/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp +++ b/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp @@ -94,7 +94,7 @@ namespace UnitTest float testStoreValues[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; VectorType::StoreUnaligned(testStoreValues, result); - for (int32_t i = 0; i < VectorType::ElementCount; ++i) + for (uint32_t i = 0; i < VectorType::ElementCount; ++i) { if (i == replaceIndex) { diff --git a/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp b/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp index 3bda826313..44c1b1641d 100644 --- a/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp +++ b/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp @@ -297,7 +297,7 @@ AZ_POP_DISABLE_WARNING // the overflow guard is generated out of rand, so we set a fixed seed before doing the allocation // to get a deterministic guard srand(0); - const unsigned char expectedInitialGuard = rand(); + const unsigned char expectedInitialGuard = static_cast(rand()); srand(0); TestClass<16>* someObject = aznew TestClass<16>(); diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp index be06e76f68..c971535f0b 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp @@ -32,12 +32,12 @@ namespace JsonSerializationTests AZStd::shared_ptr CreateDefaultInstance() override { - return AZStd::make_shared(0); + return AZStd::make_shared(NumberType(0)); } AZStd::shared_ptr CreateFullySetInstance() override { - return AZStd::make_shared(4); + return AZStd::make_shared(NumberType(4)); } AZStd::string_view GetJsonForFullySetInstance() override diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp index ca558d1624..1126aeb662 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp @@ -225,7 +225,6 @@ namespace JsonSerializationTests static_assert((RowCount >= 3 && RowCount <= 4) && (ColumnCount >= 3 && ColumnCount <= 4), "Only matrix 3x3, 3x4 or 4x4 are supported by this test."); } - return "{}"; } void ConfigureFeatures(JsonSerializerConformityTestDescriptorFeatures& features) override diff --git a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp index d263ad3d0b..5bcdc3d719 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp @@ -236,7 +236,7 @@ namespace AZ::IO::ArchiveInternal return 0; } - if (nReadBytes != nTotal) + if (static_cast(nReadBytes) != nTotal) { AZ_Warning("Archive", false, "FRead did not read expected number of byte from file, only %zu of %lld bytes read", nTotal, nReadBytes); nTotal = (size_t)nReadBytes; @@ -348,17 +348,12 @@ namespace AZ::IO::ArchiveInternal return EOF; } int c = EOF; - int i; - for (i = 0; i < 1; i++) + if (m_nCurSeek == GetFileSize()) { - if (i + m_nCurSeek == GetFileSize()) - { - return c; - } - c = pData[i + m_nCurSeek]; - break; + return c; } - m_nCurSeek += i + 1; + c = pData[m_nCurSeek]; + m_nCurSeek += 1; return c; } } @@ -1792,11 +1787,11 @@ namespace AZ::IO AZ_Assert(m_pZip, "ZipFile is nullptr"); AZ_Assert(m_pFileEntry && m_pZip->IsOwnerOf(m_pFileEntry), "ZipFile is not owner of m_pFileEntry"); - if (nDataSize != m_pFileEntry->desc.lSizeUncompressed && bDecompress) + if (static_cast(nDataSize) != m_pFileEntry->desc.lSizeUncompressed && bDecompress) { return false; } - else if (nDataSize != m_pFileEntry->desc.lSizeCompressed && !bDecompress) + else if (static_cast(nDataSize) != m_pFileEntry->desc.lSizeCompressed && !bDecompress) { return false; } diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp index baabfb35cc..d74f69e27b 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp @@ -75,7 +75,7 @@ namespace AZ::IO::ZipDir for (i = 0; i < AZ_ARRAY_SIZE(szBuf) - 1; ++i) { int r = distrib(gen); - szBuf[i] = r > 9 ? (r - 10) + 'a' : '0' + r; + szBuf[i] = static_cast(r > 9 ? (r - 10) + 'a' : '0' + r); } szBuf[i] = '\0'; return szBuf; diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp index 445bba63f4..5f0d58a4cb 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp @@ -104,7 +104,7 @@ namespace AZ::IO::ZipDir::ZipDirStructuresInternal if (*pReturnCode == Z_BUF_ERROR) { // As long as we consumed something, keep going. Only fail permanently if we've stalled. - if (nAvailIn != pZStream->avail_in || nAvailOut != pZStream->avail_out) + if (nAvailIn != static_cast(pZStream->avail_in) || nAvailOut != static_cast(pZStream->avail_out)) { *pReturnCode = Z_OK; } @@ -338,14 +338,15 @@ namespace AZ::IO::ZipDir else { AZ::IO::HandleType realFileHandle = m_fileHandle; - size_t nFileSize = ~0; AZ::u64 fileSize = 0; if (!m_fileIOBase->Size(realFileHandle, fileSize)) { - goto error; + // Error + m_nSize = 0; + return; } - nFileSize = static_cast(fileSize); + const size_t nFileSize = static_cast(fileSize); m_pInMemoryData = ZipDirStructuresInternal::CreateMemoryBlock(nFileSize, szUsage); @@ -353,16 +354,18 @@ namespace AZ::IO::ZipDir if (!m_fileIOBase->Seek(realFileHandle, 0, AZ::IO::SeekType::SeekFromStart)) { - goto error; + // Error + m_nSize = 0; + return; } if (!m_fileIOBase->Read(realFileHandle, m_pInMemoryData->m_address.get(), nFileSize, true)) { - goto error; + // Error + m_nSize = 0; + return; } return; - error: - m_nSize = 0; } } } @@ -832,18 +835,18 @@ namespace AZ::IO::ZipDir // conversion routines for the date/time fields used in Zip uint16_t DOSDate(tm* t) { - return + return static_cast( ((t->tm_year - 80) << 9) | (t->tm_mon << 5) - | t->tm_mday; + | t->tm_mday); } uint16_t DOSTime(tm* t) { - return + return static_cast( ((t->tm_hour) << 11) | ((t->tm_min) << 5) - | ((t->tm_sec) >> 1); + | ((t->tm_sec) >> 1)); } // sets the current time to modification time @@ -872,7 +875,7 @@ namespace AZ::IO::ZipDir // we'll need CRC32 of the file to pack it this->desc.lCRC32 = AZ::Crc32(pUncompressed, nSize); - this->nMethod = nCompressionMethod; + this->nMethod = static_cast(nCompressionMethod); } uint64_t FileEntry::GetModificationTime() diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h b/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h index bb53d6d3dd..26dfcd3b77 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h +++ b/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h @@ -56,7 +56,7 @@ namespace AzPhysics //! A handle to a Scene within the physics simulation. //! A SceneHandle is a tuple of a Crc of the scenes name and the index in the Scene list. using SceneHandle = AZStd::tuple; - static constexpr SceneHandle InvalidSceneHandle = { AZ::Crc32(), -1 }; + static constexpr SceneHandle InvalidSceneHandle = { AZ::Crc32(), SceneIndex(-1) }; //! Ease of use type for referencing a List of SceneHandle objects. using SceneHandleList = AZStd::vector; diff --git a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp index aaf2de3e58..292cce29ec 100644 --- a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp @@ -357,26 +357,23 @@ namespace AzFramework } } - #pragma warning( push ) - #pragma warning( disable : 4505 ) // StackDump is useful to debug the lua stack. Disable warning about this method being unused. //========================================================================= // DebugPrintStack // Prints the Lua stack starting from the bottom. //========================================================================= - static void DebugPrintStack(lua_State* lua, const AZStd::string& prefix = "") - { - AZStd::string dump = prefix; - const int stackSize = lua_gettop(lua); - for (int stackIdx = 1; stackIdx <= stackSize; ++stackIdx) - { - dump += PrintLuaValue(lua, stackIdx); - dump += " "; // add separator - } - - AZ_Warning("ScriptComponent", false, "Stack Dump: '%s'", dump.c_str()); - } - #pragma warning( pop ) - + // DO NOT DELETE StackDump is useful to debug the lua stack. + //static void DebugPrintStack(lua_State* lua, const AZStd::string& prefix = "") + //{ + // AZStd::string dump = prefix; + // const int stackSize = lua_gettop(lua); + // for (int stackIdx = 1; stackIdx <= stackSize; ++stackIdx) + // { + // dump += PrintLuaValue(lua, stackIdx); + // dump += " "; // add separator + // } + // + // AZ_Warning("ScriptComponent", false, "Stack Dump: '%s'", dump.c_str()); + //} //========================================================================= // Properties__IndexFindSubtable diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp index f40c92997a..74adcd9543 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp @@ -791,8 +791,8 @@ namespace AzFramework AZ_Assert(position, "Expected PositionData2D but found nullptr"); return CursorEvent{ ScreenPoint( - position->m_normalizedPosition.GetX() * windowSize.m_width, - position->m_normalizedPosition.GetY() * windowSize.m_height) }; + static_cast(position->m_normalizedPosition.GetX() * windowSize.m_width), + static_cast(position->m_normalizedPosition.GetY() * windowSize.m_height)) }; } else if (inputChannelId == InputDeviceMouse::Movement::X) { diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h index 190a32ddc7..49f5533548 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h @@ -176,7 +176,7 @@ namespace AzNetworking //! Takes a quantized integral value and stores the floating point representation. void DecodeQuantizedValues(); - AZ_PUSH_DISABLE_WARNING(4201 4324, "-Wunknown-warning-option") // anonymous union, structure was padded due to alignment + AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") // structure was padded due to alignment union { float m_quantizedValues[NUM_ELEMENTS]; diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.inl b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.inl index b0a424d48a..86e736928a 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.inl +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.inl @@ -218,14 +218,7 @@ namespace AzNetworking { SerializeType serializedValue = static_cast(m_serializeValues[i]); -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - if (NUM_BYTES == 3) -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif + if constexpr (NUM_BYTES == 3) { uint8_t lowByte = static_cast((serializedValue & 0x000000FF) ); uint8_t midByte = static_cast((serializedValue & 0x0000FF00) >> 8); diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/SliderCombo.h b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/SliderCombo.h index 7baa386784..2646162af4 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/SliderCombo.h +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/SliderCombo.h @@ -40,6 +40,8 @@ namespace AzQtComponents //! Current value. Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) public: + using value_type = int; + explicit SliderCombo(QWidget *parent = nullptr); ~SliderCombo(); @@ -142,6 +144,8 @@ namespace AzQtComponents Q_PROPERTY(double curveMidpoint READ curveMidpoint WRITE setCurveMidpoint) public: + using value_type = double; + explicit SliderDoubleCombo(QWidget *parent = nullptr); ~SliderDoubleCombo(); diff --git a/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp b/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp index dc4b31c9be..fcda5d351a 100644 --- a/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp +++ b/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp @@ -30,7 +30,7 @@ namespace AZ while (maxAttempts > 0) { // Use the system's tick count to base the folder name - DWORD currentTick = GetTickCount64(); + ULONGLONG currentTick = GetTickCount64(); azsnprintf(workingTempPathBuffer, bufferSize, "%sUnitTest-%X", tempDir, aznumeric_cast(currentTick)); // Check if the requested directory name is available and re-generate if it already exists diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp index 260270e85e..d39ade5527 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp @@ -297,8 +297,8 @@ namespace AzToolsFramework GetInputChannel(AzFramework::InputDeviceMouse::Movement::Z); systemCursorChannel->ProcessRawInputEvent(m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetLength()); - movementXChannel->ProcessRawInputEvent(cursorDelta.x()); - movementYChannel->ProcessRawInputEvent(cursorDelta.y()); + movementXChannel->ProcessRawInputEvent(static_cast(cursorDelta.x())); + movementYChannel->ProcessRawInputEvent(static_cast(cursorDelta.y())); mouseWheelChannel->ProcessRawInputEvent(0.0f); NotifyUpdateChannelIfNotIdle(systemCursorChannel, nullptr); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp index 806170df6f..380d6876da 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp @@ -2180,7 +2180,7 @@ namespace AzToolsFramework QPainterPath path; auto newRect = option.rect; - newRect.setHeight(newRect.height() - 1.0); + newRect.setHeight(newRect.height() - 1); path.addRect(newRect); // Get the foreground color of the current object to draw our sub-object-selected box diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp index ec09275703..223a573c55 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp @@ -254,8 +254,8 @@ namespace AzToolsFramework QRect globalRect = m_editor->GetWidgetAndVisibleChildrenGlobalRect(dragRowWidget); int top = mapFromGlobal(globalRect.topLeft()).y(); - int imageHeight = dragImage.height() / dragImage.devicePixelRatioF(); - int imageWidth = dragImage.width() / dragImage.devicePixelRatioF(); + int imageHeight = static_cast(dragImage.height() / dragImage.devicePixelRatioF()); + int imageWidth = static_cast(dragImage.width() / dragImage.devicePixelRatioF()); QRect currRect = QRect(QPoint(LeftMargin + 1, top), QPoint(LeftMargin + 1 + imageWidth, top + imageHeight)); painter.setOpacity(alpha); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp index 44e71daf71..9ba998b99a 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp @@ -1867,7 +1867,7 @@ namespace AzToolsFramework } const auto dpr = devicePixelRatioF(); - QPixmap dragImage(width * dpr, height * dpr); + QPixmap dragImage(static_cast(width * dpr), static_cast(height * dpr)); dragImage.setDevicePixelRatio(dpr); dragImage.fill(Qt::transparent); diff --git a/Code/Framework/AzToolsFramework/CMakeLists.txt b/Code/Framework/AzToolsFramework/CMakeLists.txt index 4ee329bd93..e444ce5efb 100644 --- a/Code/Framework/AzToolsFramework/CMakeLists.txt +++ b/Code/Framework/AzToolsFramework/CMakeLists.txt @@ -20,7 +20,6 @@ ly_add_target( AzToolsFramework/aztoolsframework_files.cmake AzToolsFramework/aztoolsframework_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake - Platform/Common/${PAL_TRAIT_COMPILER_ID}/aztoolsframework_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake INCLUDE_DIRECTORIES PUBLIC . diff --git a/Code/Framework/AzToolsFramework/Platform/Common/Clang/aztoolsframework_clang.cmake b/Code/Framework/AzToolsFramework/Platform/Common/Clang/aztoolsframework_clang.cmake deleted file mode 100644 index 7a325ca97e..0000000000 --- a/Code/Framework/AzToolsFramework/Platform/Common/Clang/aztoolsframework_clang.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -# 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 -# -# diff --git a/Code/Framework/AzToolsFramework/Platform/Common/MSVC/aztoolsframework_msvc.cmake b/Code/Framework/AzToolsFramework/Platform/Common/MSVC/aztoolsframework_msvc.cmake deleted file mode 100644 index 1a34f54a63..0000000000 --- a/Code/Framework/AzToolsFramework/Platform/Common/MSVC/aztoolsframework_msvc.cmake +++ /dev/null @@ -1,13 +0,0 @@ -# -# 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 -# -# - -ly_add_source_properties( - SOURCES AzToolsFramework/Application/ToolsApplication.cpp - PROPERTY COMPILE_OPTIONS - VALUES -bigobj -) diff --git a/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp b/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp index 895c91b0a4..e95f7aa271 100644 --- a/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp @@ -583,7 +583,7 @@ namespace UnitTest AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::EventResult( m_mouseInteractionResult, AzToolsFramework::GetEntityContextId(), &AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions, - vi::MouseInteractionEvent(mouseInteraction, ev->angleDelta().y())); + vi::MouseInteractionEvent(mouseInteraction, static_cast(ev->angleDelta().y()))); } MouseInteractionResult m_mouseInteractionResult; diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabCreateBenchmarks.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabCreateBenchmarks.cpp index 12efea1cc8..64c4058a47 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabCreateBenchmarks.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabCreateBenchmarks.cpp @@ -16,7 +16,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefabs_SingleEntityEach)(::benchmark::State& state) { - const unsigned int numEntities = state.range(); + const unsigned int numEntities = static_cast(state.range()); const unsigned int numInstances = numEntities; CreateFakePaths(numInstances); @@ -58,7 +58,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromEntities)(::benchmark::State& state) { - const unsigned int numEntities = state.range(); + const unsigned int numEntities = static_cast(state.range()); for (auto _ : state) { @@ -93,7 +93,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromSingleDepthInstances)(::benchmark::State& state) { - const unsigned int numInstancesToAdd = state.range(); + const unsigned int numInstancesToAdd = static_cast(state.range()); const unsigned int numEntities = numInstancesToAdd; // Create fake paths for all the nested instances @@ -144,7 +144,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromLinearNestingOfInstances)(::benchmark::State& state) { - const unsigned int numInstances = state.range(); + const unsigned int numInstances = static_cast(state.range()); // Create fake paths for all the nested instances // plus the root instance diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabInstantiateBenchmarks.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabInstantiateBenchmarks.cpp index 90ff30a30e..f2f3cf82b0 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabInstantiateBenchmarks.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabInstantiateBenchmarks.cpp @@ -16,7 +16,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabInstantiate, InstantiatePrefab_SingleEntityInstance)(::benchmark::State& state) { - const unsigned int numInstances = state.range(); + const unsigned int numInstances = static_cast(state.range()); AZStd::unique_ptr firstInstance = m_prefabSystemComponent->CreatePrefab( { CreateEntity("Entity1") }, diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabLoadBenchmarks.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabLoadBenchmarks.cpp index a6c1e27caf..dd29654416 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabLoadBenchmarks.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabLoadBenchmarks.cpp @@ -16,7 +16,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabLoad, LoadPrefab_Basic)(::benchmark::State& state) { - const unsigned int numTemplates = state.range(); + const unsigned int numTemplates = static_cast(state.range()); CreateFakePaths(numTemplates); for (auto _ : state) diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabUpdateInstancesBenchmarks.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabUpdateInstancesBenchmarks.cpp index f1e319b28a..0d95049e76 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabUpdateInstancesBenchmarks.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabUpdateInstancesBenchmarks.cpp @@ -18,7 +18,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_SingeEntityInstances)(::benchmark::State& state) { - const unsigned int numInstances = state.range(); + const unsigned int numInstances = static_cast(state.range()); CreateFakePaths(2); const auto& nestedTemplatePath = m_paths.front(); @@ -80,7 +80,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_SingleLinearNestingOfInstances)(::benchmark::State& state) { - const unsigned int maxDepth = state.range(); + const unsigned int maxDepth = static_cast(state.range()); CreateFakePaths(maxDepth); const unsigned int numInstances = maxDepth; @@ -131,8 +131,8 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_MultipleLinearNestingOfInstances)(::benchmark::State& state) { - const unsigned int numRootInstances = state.range(); - const unsigned int maxDepth = state.range(); + const unsigned int numRootInstances = static_cast(state.range()); + const unsigned int maxDepth = static_cast(state.range()); CreateFakePaths(maxDepth); const unsigned int numInstances = numRootInstances * maxDepth; @@ -192,7 +192,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_BinaryTreeNestedInstanceHierarchy)(::benchmark::State& state) { - const unsigned int maxDepth = state.range(); + const unsigned int maxDepth = static_cast(state.range()); CreateFakePaths(maxDepth); const unsigned int numInstances = (1 << maxDepth) - 1; diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/SpawnableCreateBenchmarks.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/SpawnableCreateBenchmarks.cpp index 54e53a6ebc..d9024114a5 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/SpawnableCreateBenchmarks.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/SpawnableCreateBenchmarks.cpp @@ -18,7 +18,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_SpawnableCreate, CreateSpawnable_SingleEntityInstance)(::benchmark::State& state) { - const unsigned int numSpawnables = state.range(); + const unsigned int numSpawnables = static_cast(state.range()); AZStd::unique_ptr instance(m_prefabSystemComponent->CreatePrefab( { CreateEntity("Entity1") }, diff --git a/Code/LauncherUnified/Platform/Windows/Launcher_Windows.cpp b/Code/LauncherUnified/Platform/Windows/Launcher_Windows.cpp index 44426f6d01..d1e6a69e5e 100644 --- a/Code/LauncherUnified/Platform/Windows/Launcher_Windows.cpp +++ b/Code/LauncherUnified/Platform/Windows/Launcher_Windows.cpp @@ -73,8 +73,8 @@ void CVar_OnViewportPosition(const AZ::Vector2& value) if (HWND windowHandle = GetActiveWindow()) { SetWindowPos(windowHandle, nullptr, - value.GetX(), - value.GetY(), + static_cast(value.GetX()), + static_cast(value.GetY()), 0, 0, SWP_NOOWNERZORDER | SWP_NOSIZE); } } diff --git a/Code/Legacy/CryCommon/CryHeaders.h b/Code/Legacy/CryCommon/CryHeaders.h index 4d037b52d9..49ea28ee0e 100644 --- a/Code/Legacy/CryCommon/CryHeaders.h +++ b/Code/Legacy/CryCommon/CryHeaders.h @@ -395,7 +395,7 @@ struct MotionParams905 MotionParams905() { m_nAssetFlags = 0; - m_nCompression = -1; + m_nCompression = std::numeric_limits::max(); m_nTicksPerFrame = 0; m_fSecsPerTick = 0; m_nStart = 0; diff --git a/Code/Legacy/CryCommon/ISerialize.h b/Code/Legacy/CryCommon/ISerialize.h index d427e222bb..b153a52487 100644 --- a/Code/Legacy/CryCommon/ISerialize.h +++ b/Code/Legacy/CryCommon/ISerialize.h @@ -31,7 +31,7 @@ class InterpolatedValue_tpl; // Unfortunately this needs to be here - should be in CryNetwork somewhere. struct SNetObjectID { - static const uint16 InvalidId = ~uint16(0); + static const uint16 InvalidId = std::numeric_limits::max(); SNetObjectID() : id(InvalidId) diff --git a/Code/Legacy/CryCommon/ISplines.h b/Code/Legacy/CryCommon/ISplines.h index ad59f1328d..2353489163 100644 --- a/Code/Legacy/CryCommon/ISplines.h +++ b/Code/Legacy/CryCommon/ISplines.h @@ -466,7 +466,7 @@ namespace spline ILINE void flag_clr(int flag) { m_flags &= ~flag; }; ILINE int flag(int flag) { return m_flags & flag; }; - ILINE void ORT(int ort) { m_ORT = ort; }; + ILINE void ORT(int ort) { m_ORT = static_cast(ort); }; ILINE int ORT() const { return m_ORT; }; ILINE int isORT(int o) const { return (m_ORT == o); }; diff --git a/Code/Legacy/CryCommon/PNoise3.h b/Code/Legacy/CryCommon/PNoise3.h index 1cb7f0d65b..fe19997ef4 100644 --- a/Code/Legacy/CryCommon/PNoise3.h +++ b/Code/Legacy/CryCommon/PNoise3.h @@ -205,7 +205,7 @@ public: // Initialize the permutation table for(i = 0; i < NOISE_TABLE_SIZE; i++) - m_p[i] = i; + m_p[i] = static_cast(i); for(i = 0; i < NOISE_TABLE_SIZE; i++) { @@ -213,7 +213,7 @@ public: nSwap = m_p[i]; m_p[i] = m_p[j]; - m_p[j] = nSwap; + m_p[j] = static_cast(nSwap); } // Generate the gradient lookup tables diff --git a/Code/Legacy/CryCommon/Vertex.h b/Code/Legacy/CryCommon/Vertex.h index 2e61524cab..b9e0b25d38 100644 --- a/Code/Legacy/CryCommon/Vertex.h +++ b/Code/Legacy/CryCommon/Vertex.h @@ -1037,7 +1037,7 @@ namespace AZ } AZ_Assert(stride < (0x1 << (sizeof(m_stride) * 8)), "Vertex stride is larger than the maximum supported, update the type for m_stride in Vertex.h"); - m_stride = stride; + m_stride = static_cast(stride); } diff --git a/Code/Legacy/CrySystem/CmdLine.cpp b/Code/Legacy/CrySystem/CmdLine.cpp index 50b8b2c092..702709ffe5 100644 --- a/Code/Legacy/CrySystem/CmdLine.cpp +++ b/Code/Legacy/CrySystem/CmdLine.cpp @@ -192,7 +192,6 @@ AZStd::string CCmdLine::Next(char*& src) return AZStd::string(org, src); } - ch = *src++; } return AZStd::string(); diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index 68a8a6659b..db77eda3e8 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -473,7 +473,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, const char* pFind = strstr(sCellContent.c_str(), sLocalizedColumnNames[i]); if (pFind != 0) { - nCellIndexToType[nCellIndex] = i; + nCellIndexToType[nCellIndex] = static_cast(i); // find SoundMood if (i == ELOCALIZED_COLUMN_SOUNDMOOD) diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index 872a522a69..be2816c890 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -1228,7 +1228,7 @@ void CLog::CreateBackupFile() const while (!fileSystem->Eof(inFileHandle)) { - uint8 c = AZ::IO::GetC(inFileHandle); + uint8 c = static_cast(AZ::IO::GetC(inFileHandle)); if (c == '\"') { diff --git a/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp b/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp index 6d2d393a11..7cdb62d45a 100644 --- a/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp +++ b/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp @@ -334,7 +334,7 @@ void CViewSystem::SetActiveView(IView* pView) } else { - m_activeViewId = ~0; + m_activeViewId = ~0u; } m_bActiveViewFromSequence = false; diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp index 36443fb9ee..2293352f7e 100644 --- a/Code/Legacy/CrySystem/XConsole.cpp +++ b/Code/Legacy/CrySystem/XConsole.cpp @@ -2464,8 +2464,9 @@ void CXConsole::DisplayVarValue(ICVar* pVar) sValue += " ("; if (nonAlphaBits != 0) { - char nonAlphaChars[3]; // 1..63 + '\0' - sValue += azitoa(nonAlphaBits, nonAlphaChars, AZ_ARRAY_SIZE(nonAlphaChars), 10); + char nonAlphaChars[3] = { 0 }; // 1..63 + '\0' + azitoa(nonAlphaBits, nonAlphaChars, AZ_ARRAY_SIZE(nonAlphaChars), 10); + sValue += nonAlphaChars; sValue += ", "; } sValue += alphaChars; @@ -2856,7 +2857,7 @@ void CXConsole::Paste() Utf8::Unchecked::octet_iterator end(data.end()); for (Utf8::Unchecked::octet_iterator it(data.begin()); it != end; ++it) { - const wchar_t cp = *it; + const wchar_t cp = static_cast(*it); if (cp != '\r') { // Convert UCS code-point into UTF-8 string diff --git a/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp b/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp index e74b457191..841697ecdb 100644 --- a/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp +++ b/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp @@ -44,7 +44,7 @@ bool CSerializeXMLReaderImpl::Value(const char* name, int8& value) } else { - value = temp; + value = static_cast(temp); } return bResult; } diff --git a/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp b/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp index 257fc3ca69..d209478957 100644 --- a/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp +++ b/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp @@ -320,7 +320,7 @@ bool CBinaryXmlNode::getAttr(const char* key, ColorB& value) const // If we only found 3 values, a should be unchanged, and still be 255 if (r < 256 && g < 256 && b < 256 && a < 256) { - value = ColorB(r, g, b, a); + value = ColorB(static_cast(r), static_cast(g), static_cast(b), static_cast(a)); return true; } } diff --git a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp index a2a35cfe8b..265953850f 100644 --- a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp +++ b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp @@ -244,7 +244,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nPar nd.nContentStringOffset = nContentStringOffset; nd.nParentIndex = nParentIndex; nd.nFirstAttributeIndex = nFirstAttributeIndex; - nd.nAttributeCount = nAttributeCount; + nd.nAttributeCount = static_cast(nAttributeCount); m_nodes.push_back(nd); } @@ -271,7 +271,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nPar } } - m_nodes[nIndex].nChildCount = nChildCount; + m_nodes[nIndex].nChildCount = static_cast(nChildCount); return true; } diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp index 7a9bb4bc36..adbfcc5f3e 100644 --- a/Code/Legacy/CrySystem/XML/xml.cpp +++ b/Code/Legacy/CrySystem/XML/xml.cpp @@ -641,7 +641,7 @@ bool CXmlNode::getAttr(const char* key, ColorB& value) const // If we only found 3 values, a should be unchanged, and still be 255 if (r < 256 && g < 256 && b < 256 && a < 256) { - value = ColorB(r, g, b, a); + value = ColorB(static_cast(r), static_cast(g), static_cast(b), static_cast(a)); return true; } } diff --git a/Code/Tools/AssetProcessor/AssetBuilder/AssetBuilderComponent.cpp b/Code/Tools/AssetProcessor/AssetBuilder/AssetBuilderComponent.cpp index 7702cc259d..eb6cc4033c 100644 --- a/Code/Tools/AssetProcessor/AssetBuilder/AssetBuilderComponent.cpp +++ b/Code/Tools/AssetProcessor/AssetBuilder/AssetBuilderComponent.cpp @@ -337,7 +337,7 @@ bool AssetBuilderComponent::ConnectToAssetProcessor() AZStd::string overridePort; if (GetParameter(s_paramPort, overridePort, false)) { - connectionSettings.m_assetProcessorPort = AZStd::stoi(overridePort); + connectionSettings.m_assetProcessorPort = static_cast(AZStd::stoi(overridePort)); } //the asset builder may have been given an optional asset platform to use diff --git a/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp b/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp index 7a78786258..2465be2b33 100644 --- a/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp +++ b/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp @@ -814,7 +814,7 @@ public: AssetRecognizer good; good.m_name = "Good"; - good.m_version = versionNumber; + good.m_version = static_cast(versionNumber); good.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.foo", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard); good.m_platformSpecs["pc"] = good_spec; good.m_productAssetType = builderProductType; diff --git a/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp b/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp index a3f5c117ea..0f5fea5eb9 100644 --- a/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp +++ b/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp @@ -147,7 +147,7 @@ void RCcontrollerUnitTests::RunRCControllerTests() if (returnedCount != expectedCount) { - Q_EMIT UnitTestFailed("RCJobListModel has " + QString(returnedCount) + " elements, which is invalid. Expected " + expectedCount); + Q_EMIT UnitTestFailed("RCJobListModel has " + QString(returnedCount) + " elements, which is invalid. Expected " + QString(expectedCount)); return; } diff --git a/Code/Tools/AssetProcessor/native/utilities/BatchApplicationServer.cpp b/Code/Tools/AssetProcessor/native/utilities/BatchApplicationServer.cpp index 8a7974c615..e7ebc030e6 100644 --- a/Code/Tools/AssetProcessor/native/utilities/BatchApplicationServer.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/BatchApplicationServer.cpp @@ -38,7 +38,7 @@ bool BatchApplicationServer::startListening(unsigned short port) // Since we're starting up builders ourselves and informing them of the port chosen, we can scan for a free port - while (!listen(QHostAddress::Any, m_serverListeningPort)) + while (!listen(QHostAddress::Any, static_cast(m_serverListeningPort))) { auto error = serverError(); diff --git a/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp b/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp index 782e145ad6..07106614cf 100644 --- a/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp @@ -197,7 +197,7 @@ namespace AssetProcessor } else if (valueName == "order") { - scanFolderEntry.m_scanOrder = value; + scanFolderEntry.m_scanOrder = static_cast(value); } } @@ -475,7 +475,7 @@ namespace AssetProcessor RCAssetRecognizer& assetRecognizer = *assetRecognizerEntryIt; if (valueName == "priority") { - assetRecognizer.m_recognizer.m_priority = value; + assetRecognizer.m_recognizer.m_priority = static_cast(value); } } diff --git a/Code/Tools/AssetProcessor/native/utilities/UnitTestShaderCompilerServer.cpp b/Code/Tools/AssetProcessor/native/utilities/UnitTestShaderCompilerServer.cpp index 18e1730de5..88e8520e3c 100644 --- a/Code/Tools/AssetProcessor/native/utilities/UnitTestShaderCompilerServer.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/UnitTestShaderCompilerServer.cpp @@ -49,7 +49,7 @@ void UnitTestShaderCompilerServer::startServer() { if (!m_server->isListening()) { - if (!m_server->listen(QHostAddress(m_serverAddress), m_serverPort)) + if (!m_server->listen(QHostAddress(m_serverAddress), static_cast(m_serverPort))) { AZ_TracePrintf(AssetProcessor::DebugChannel, "Server %s could not start.\n", m_serverAddress.toUtf8().data()); emit errorMessage("Server could not start "); diff --git a/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp b/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp index b33aa183f3..74f271e7c0 100644 --- a/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp +++ b/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp @@ -72,10 +72,15 @@ namespace O3de return true; } #if !AZ_TRAIT_OS_PLATFORM_APPLE - AZ_PUSH_DISABLE_WARNING(4996, "-Wunknown-warning-option") + #if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS + char noConfirmation[64]{}; + size_t variableSize = 0; + getenv_s(&variableSize, noConfirmation, AZ_ARRAY_SIZE(noConfirmation), "LY_NO_CONFIRM"); + if (variableSize == 0) + #else const char* noConfirmation = getenv("LY_NO_CONFIRM"); - AZ_POP_DISABLE_WARNING if (noConfirmation == nullptr) + #endif { int argCount = 0; diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp index d5a213e80f..21bb56daef 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp @@ -29,7 +29,7 @@ namespace O3DE::ProjectManager { QPixmap pixmap(iconPath); qreal aspectRatio = static_cast(pixmap.width()) / pixmap.height(); - m_platformIcons.insert(platform, QIcon(iconPath).pixmap(s_platformIconSize * aspectRatio, s_platformIconSize)); + m_platformIcons.insert(platform, QIcon(iconPath).pixmap(static_cast(static_cast(s_platformIconSize) * aspectRatio), s_platformIconSize)); } void GemItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const @@ -48,7 +48,7 @@ namespace O3DE::ProjectManager CalcRects(options, fullRect, itemRect, contentRect); QFont standardFont(options.font); - standardFont.setPixelSize(s_fontSize); + standardFont.setPixelSize(static_cast(s_fontSize)); QFontMetrics standardFontMetrics(standardFont); painter->save(); @@ -78,7 +78,7 @@ namespace O3DE::ProjectManager QString gemName = GemModel::GetName(modelIndex); QFont gemNameFont(options.font); const int firstColumnMaxTextWidth = s_summaryStartX - 30; - gemNameFont.setPixelSize(s_gemNameFontSize); + gemNameFont.setPixelSize(static_cast(s_gemNameFontSize)); gemNameFont.setBold(true); gemName = QFontMetrics(gemNameFont).elidedText(gemName, Qt::TextElideMode::ElideRight, firstColumnMaxTextWidth); QRect gemNameRect = GetTextRect(gemNameFont, gemName, s_gemNameFontSize); @@ -178,7 +178,7 @@ namespace O3DE::ProjectManager QRect GemItemDelegate::GetTextRect(QFont& font, const QString& text, qreal fontSize) const { - font.setPixelSize(fontSize); + font.setPixelSize(static_cast(fontSize)); return QFontMetrics(font).boundingRect(text); } @@ -208,7 +208,7 @@ namespace O3DE::ProjectManager const QPixmap& pixmap = iterator.value(); painter->drawPixmap(contentRect.left() + startX, contentRect.bottom() - s_platformIconSize, pixmap); qreal aspectRatio = static_cast(pixmap.width()) / pixmap.height(); - startX += s_platformIconSize * aspectRatio + s_platformIconSize / 2.5; + startX += static_cast(s_platformIconSize * aspectRatio + s_platformIconSize / 2.5); } } } diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemRequirementDelegate.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemRequirementDelegate.cpp index 655f6055f1..0d5f752858 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemRequirementDelegate.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemRequirementDelegate.cpp @@ -35,7 +35,7 @@ namespace O3DE::ProjectManager CalcRects(options, fullRect, itemRect, contentRect); QFont standardFont(options.font); - standardFont.setPixelSize(s_fontSize); + standardFont.setPixelSize(static_cast(s_fontSize)); QFontMetrics standardFontMetrics(standardFont); painter->save(); @@ -55,10 +55,10 @@ namespace O3DE::ProjectManager QFont gemNameFont(options.font); const int firstColumnMaxTextWidth = s_summaryStartX - 30; gemName = QFontMetrics(gemNameFont).elidedText(gemName, Qt::TextElideMode::ElideRight, firstColumnMaxTextWidth); - gemNameFont.setPixelSize(s_gemNameFontSize); + gemNameFont.setPixelSize(static_cast(s_gemNameFontSize)); gemNameFont.setBold(true); QRect gemNameRect = GetTextRect(gemNameFont, gemName, s_gemNameFontSize); - gemNameRect.moveTo(contentRect.left(), contentRect.center().y() - s_gemNameFontSize); + gemNameRect.moveTo(contentRect.left(), contentRect.center().y() - static_cast(s_gemNameFontSize)); painter->setFont(gemNameFont); painter->setPen(m_textColor); diff --git a/Code/Tools/ProjectManager/Source/ProjectUtils.cpp b/Code/Tools/ProjectManager/Source/ProjectUtils.cpp index fb0ea23ece..fb3f7e0270 100644 --- a/Code/Tools/ProjectManager/Source/ProjectUtils.cpp +++ b/Code/Tools/ProjectManager/Source/ProjectUtils.cpp @@ -117,7 +117,7 @@ namespace O3DE::ProjectManager const int updateStatusEvery = 64; if (outFileCount % updateStatusEvery == 0) { - statusCallback(outFileCount, outTotalSizeInBytes); + statusCallback(outFileCount, static_cast(outTotalSizeInBytes)); } } } @@ -163,7 +163,7 @@ namespace O3DE::ProjectManager } QLocale locale; - const float progressDialogRangeHalf = qFabs(progressDialog->maximum() - progressDialog->minimum()) * 0.5f; + const float progressDialogRangeHalf = static_cast(qFabs(progressDialog->maximum() - progressDialog->minimum()) * 0.5f); for (const QString& file : original.entryList(QDir::Files)) { if (progressDialog->wasCanceled()) @@ -184,7 +184,7 @@ namespace O3DE::ProjectManager // for cases combining many small files and some really large files. const float normalizedNumFiles = static_cast(outNumCopiedFiles) / filesToCopyCount; const float normalizedFileSize = static_cast(outCopiedFileSize) / totalSizeToCopy; - const int progress = normalizedNumFiles * progressDialogRangeHalf + normalizedFileSize * progressDialogRangeHalf; + const int progress = static_cast(normalizedNumFiles * progressDialogRangeHalf + normalizedFileSize * progressDialogRangeHalf); progressDialog->setValue(progress); const QString copiedFileSizeString = locale.formattedDataSize(outCopiedFileSize); diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index 8bdfb0f152..18901946f3 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -434,8 +434,6 @@ namespace O3DE::ProjectManager { return AZ::Success(AZStd::move(engineInfo)); } - - return AZ::Failure(); } bool PythonBindings::SetEngineInfo(const EngineInfo& engineInfo) diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp index 97b5960a8d..16f8d85509 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp @@ -49,7 +49,7 @@ namespace AZ double totalFramesAtDefaultTimeStep = totalTicks / AssImpAnimationImporter::s_defaultTimeStepBetweenFrames + 1; if (!AZ::IsClose(totalFramesAtDefaultTimeStep, numKeys, 1)) { - numKeys = AZStd::ceilf(totalFramesAtDefaultTimeStep); + numKeys = static_cast(AZStd::ceilf(static_cast(totalFramesAtDefaultTimeStep))); } return numKeys; } @@ -122,7 +122,7 @@ namespace AZ if (keys[lastIndex + 1].mTime != keys[lastIndex].mTime) { normalizedTimeBetweenFrames = - (time - keys[lastIndex].mTime) / (keys[lastIndex + 1].mTime - keys[lastIndex].mTime); + static_cast((time - keys[lastIndex].mTime) / (keys[lastIndex + 1].mTime - keys[lastIndex].mTime)); } else { @@ -620,7 +620,7 @@ namespace AZ for (unsigned int valIdx = 0; valIdx < key.mNumValuesAndWeights; ++valIdx) { int currentValue = key.mValues[valIdx]; - KeyData thisKey(key.mWeights[valIdx], key.mTime); + KeyData thisKey(static_cast(key.mWeights[valIdx]), static_cast(key.mTime)); valueToKeyDataMap[currentValue].insert( AZStd::upper_bound(valueToKeyDataMap[currentValue].begin(), valueToKeyDataMap[currentValue].end(),thisKey), thisKey); diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpSkinWeightsImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpSkinWeightsImporter.cpp index 1e298aca5c..014d1bc5bf 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpSkinWeightsImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpSkinWeightsImporter.cpp @@ -97,7 +97,7 @@ namespace AZ } Pending pending; pending.m_bone = bone; - pending.m_numVertices = totalVertices; + pending.m_numVertices = static_cast(totalVertices); pending.m_skinWeightData = skinWeightData; pending.m_vertOffset = vertexCount; m_pendingSkinWeights.push_back(pending); diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpUvMapImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpUvMapImporter.cpp index fc0ac15244..9e0d788896 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpUvMapImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpUvMapImporter.cpp @@ -88,7 +88,7 @@ namespace AZ AZ_Error( Utilities::ErrorWindow, meshesPerTextureCoordinateIndex[texCoordIndex] == 0 || - meshesPerTextureCoordinateIndex[texCoordIndex] == currentNode->mNumMeshes, + meshesPerTextureCoordinateIndex[texCoordIndex] == static_cast(currentNode->mNumMeshes), "Texture coordinate index %d for node %s is not on all meshes on this node. " "Placeholder arbitrary texture values will be generated to allow the data to process, but the source art " "needs to be fixed to correct this. All meshes on this node should have the same number of texture coordinate channels.", diff --git a/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleTestSequenceEventHandler.cpp b/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleTestSequenceEventHandler.cpp index e7430fe90b..a90f2cf4a2 100644 --- a/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleTestSequenceEventHandler.cpp +++ b/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleTestSequenceEventHandler.cpp @@ -26,8 +26,8 @@ namespace TestImpact void ImpactAnalysisTestSelection(size_t numSelectedTests, size_t numDiscardedTests, size_t numExcludedTests, size_t numDraftedTests) { - const float totalTests = numSelectedTests + numDiscardedTests; - const float saving = (1.0 - (numSelectedTests / totalTests)) * 100.0f; + const float totalTests = static_cast(numSelectedTests + numDiscardedTests); + const float saving = (1.0f - (numSelectedTests / totalTests)) * 100.0f; std::cout << numSelectedTests << " tests selected, " << numDiscardedTests << " tests discarded (" << saving << "% test saving)\n"; std::cout << "Of which " << numExcludedTests << " tests have been excluded and " << numDraftedTests << " tests have been drafted.\n"; diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp index aa03292047..f5d7d3a8a2 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp @@ -67,7 +67,7 @@ namespace TestImpact const auto getDuration = [&Keys](const AZ::rapidxml::xml_node<>* node) { const AZStd::string duration = node->first_attribute(Keys[DurationKey])->value(); - return AZStd::chrono::milliseconds(AZStd::stof(duration) * 1000.f); + return AZStd::chrono::milliseconds(static_cast(AZStd::stof(duration) * 1000.f)); }; TestRunSuite testSuite; @@ -95,7 +95,7 @@ namespace TestImpact const auto getResult = [](const AZ::rapidxml::xml_node<>* node) { - for (auto child_node = node->first_node("failure"); child_node; child_node = child_node->next_sibling()) + if (auto child_node = node->first_node("failure")) { return TestRunResult::Failed; } diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp index 62d251c074..c0ca2caeae 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp @@ -52,7 +52,7 @@ namespace TestImpact // Run duration writer.Key(TestRunFields::Keys[TestRunFields::DurationKey]); - writer.Uint(testRun.GetDuration().count()); + writer.Uint(static_cast(testRun.GetDuration().count())); // Suites writer.Key(TestRunFields::Keys[TestRunFields::SuitesKey]); @@ -69,7 +69,7 @@ namespace TestImpact // Suite duration writer.Key(TestRunFields::Keys[TestRunFields::DurationKey]); - writer.Uint(suite.m_duration.count()); + writer.Uint(static_cast(suite.m_duration.count())); // Suite enabled writer.Key(TestRunFields::Keys[TestRunFields::EnabledKey]); @@ -93,7 +93,7 @@ namespace TestImpact // Test duration writer.Key(TestRunFields::Keys[TestRunFields::DurationKey]); - writer.Uint(test.m_duration.count()); + writer.Uint(static_cast(test.m_duration.count())); // Test status writer.Key(TestRunFields::Keys[TestRunFields::StatusKey]); diff --git a/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h index 2070bab4b6..e991b2af7e 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h @@ -45,15 +45,10 @@ namespace AWSCore virtual std::shared_ptr GetClient() = 0; }; -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4250 ) // warning C4250: 'AWSCore::AwsApiClientJobConfig': inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. - -#endif - + AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option") /// Configuration for AWS jobs using a specific client type. template class AwsApiClientJobConfig @@ -126,9 +121,6 @@ namespace AWSCore /// Set by ApplySettings std::shared_ptr m_client; }; - -#ifdef _MSC_VER -#pragma warning( pop ) // C4250 -#endif + AZ_POP_DISABLE_WARNING } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h index 9018c167f6..5b348d8630 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h @@ -27,15 +27,10 @@ namespace AWSCore }; -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4250 ) // warning C4250: 'AWSCore::HttpRequestJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. - -#endif - + AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option") //! Provides service job configuration using settings properties. class HttpRequestJobConfig : public AwsApiJobConfig @@ -98,9 +93,6 @@ namespace AWSCore std::shared_ptr m_httpClient{ nullptr }; Aws::String m_userAgent{}; }; - -#ifdef _MSC_VER -#pragma warning( pop ) // C4250 -#endif + AZ_POP_DISABLE_WARNING } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h index 239fdfdbc0..9082498e96 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h @@ -60,16 +60,11 @@ namespace AWSCore static const char* GetRESTApiStageKeyName() { return RESTAPI_STAGE; } \ }; -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4250 ) // warning C4250: 'AWSCore::ServiceClientJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. - -#endif - -/// Provides service job configuration using settings properties. + AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option") + /// Provides service job configuration using settings properties. template class ServiceClientJobConfig : public ServiceJobConfig @@ -132,10 +127,7 @@ namespace AWSCore } }; - -#ifdef _MSC_VER -#pragma warning( pop ) // C4250 -#endif + AZ_POP_DISABLE_WARNING } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h index 0e2e2de96d..f1a01cfb7b 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h @@ -12,28 +12,21 @@ namespace AWSCore { - /// Provides configuration needed by service jobs. class IServiceJobConfig : public virtual IHttpRequestJobConfig { }; -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4250 ) // warning C4250: 'AWSCore::ServiceJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. - -#endif - -/// Provides service job configuration using settings properties. + AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option") + /// Provides service job configuration using settings properties. class ServiceJobConfig : public HttpRequestJobConfig , public virtual IServiceJobConfig { - public: AZ_CLASS_ALLOCATOR(ServiceJobConfig, AZ::SystemAllocator, 0); @@ -59,13 +52,7 @@ namespace AWSCore } void ApplySettings() override; - - private: - }; - -#ifdef _MSC_VER -#pragma warning( pop ) // C4250 -#endif + AZ_POP_DISABLE_WARNING } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h index 8395384427..240331496e 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h @@ -25,15 +25,10 @@ namespace AWSCore virtual bool IsValid() const = 0; }; -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4250 ) // warning C4250: 'AWSCore::ServiceRequestJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. - -#endif - + AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option") template class ServiceRequestJobConfig : public ServiceClientJobConfig @@ -105,9 +100,6 @@ namespace AWSCore std::shared_ptr m_credentialsProvider; }; - -#ifdef _MSC_VER -#pragma warning( pop ) // C4250 -#endif + AZ_POP_DISABLE_WARNING } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp b/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp index f54d7f71af..aee766d355 100644 --- a/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp +++ b/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp @@ -12,8 +12,6 @@ #include #include -#pragma warning(disable : 4996) - namespace AWSCore { constexpr char AWSAttributionMetricDefaultO3DEVersion[] = "1.1"; @@ -97,7 +95,13 @@ namespace AWSCore time_t now; time(&now); char buffer[50]; - strftime(buffer, sizeof(buffer), "%FT%TZ", gmtime(&now)); + tm time; +#if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS + gmtime_s(&time, &now); +#else + time = *gmtime(&now); +#endif + strftime(buffer, sizeof(buffer), "%FT%TZ", &time); return buffer; } diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp index 667a8de679..16d0cf4241 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp @@ -48,7 +48,7 @@ namespace AWSGameLift { request.SetFleetId(createSessionRequest.m_fleetId.c_str()); } - request.SetMaximumPlayerSessionCount(createSessionRequest.m_maxPlayer); + request.SetMaximumPlayerSessionCount(static_cast(createSessionRequest.m_maxPlayer)); AZ_TracePrintf(AWSGameLiftCreateSessionActivityName, "Built CreateGameSessionRequest with CreatorId=%s, Name=%s, IdempotencyToken=%s, GameProperties=%s, AliasId=%s, FleetId=%s and MaximumPlayerSessionCount=%d", diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp index a8a393aa18..1ac9c7db1c 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp @@ -33,7 +33,7 @@ namespace AWSGameLift // Required attributes request.SetGameSessionQueueName(createSessionOnQueueRequest.m_queueName.c_str()); - request.SetMaximumPlayerSessionCount(createSessionOnQueueRequest.m_maxPlayer); + request.SetMaximumPlayerSessionCount(static_cast(createSessionOnQueueRequest.m_maxPlayer)); request.SetPlacementId(createSessionOnQueueRequest.m_placementId.c_str()); AZ_TracePrintf(AWSGameLiftCreateSessionOnQueueActivityName, diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp index d54907aa71..a47e59255f 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp @@ -47,7 +47,7 @@ namespace AWSGameLift //sessionConnectionConfig.m_dnsName = createPlayerSessionResult.GetPlayerSession().GetDnsName().c_str(); sessionConnectionConfig.m_ipAddress = createPlayerSessionResult.GetPlayerSession().GetIpAddress().c_str(); sessionConnectionConfig.m_playerSessionId = createPlayerSessionResult.GetPlayerSession().GetPlayerSessionId().c_str(); - sessionConnectionConfig.m_port = createPlayerSessionResult.GetPlayerSession().GetPort(); + sessionConnectionConfig.m_port = static_cast(createPlayerSessionResult.GetPlayerSession().GetPort()); AZ_TracePrintf(AWSGameLiftJoinSessionActivityName, "Built SessionConnectionConfig with IpAddress=%s, PlayerSessionId=%s and Port=%d", diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp index ec592735ae..3d29fa2b71 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp @@ -99,7 +99,7 @@ namespace AWSGameLift session.m_currentPlayer = gameSession.GetCurrentPlayerSessionCount(); session.m_ipAddress = gameSession.GetIpAddress().c_str(); session.m_maxPlayer = gameSession.GetMaximumPlayerSessionCount(); - session.m_port = gameSession.GetPort(); + session.m_port = static_cast(gameSession.GetPort()); session.m_sessionId = gameSession.GetGameSessionId().c_str(); session.m_sessionName = gameSession.GetName().c_str(); session.m_status = AWSGameLiftSessionStatusNames[(int)gameSession.GetStatus()]; diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp index b1601e248a..70dcdba1af 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp @@ -44,7 +44,7 @@ TEST_F(AWSGameLiftCreateSessionActivityTest, ValidateCreateSessionRequest_CallWi TEST_F(AWSGameLiftCreateSessionActivityTest, ValidateCreateSessionRequest_CallWithNegativeMaxPlayer_GetFalseResult) { AWSGameLiftCreateSessionRequest request; - request.m_maxPlayer = -1; + request.m_maxPlayer = std::numeric_limits::max(); auto result = CreateSessionActivity::ValidateCreateSessionRequest(request); EXPECT_FALSE(result); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp index 529179b1fb..8a785d8007 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp @@ -40,7 +40,7 @@ TEST_F(AWSGameLiftCreateSessionOnQueueActivityTest, ValidateCreateSessionOnQueue TEST_F(AWSGameLiftCreateSessionOnQueueActivityTest, ValidateCreateSessionOnQueueRequest_CallWithNegativeMaxPlayer_GetFalseResult) { AWSGameLiftCreateSessionOnQueueRequest request; - request.m_maxPlayer = -1; + request.m_maxPlayer = std::numeric_limits::max(); auto result = CreateSessionOnQueueActivity::ValidateCreateSessionOnQueueRequest(request); EXPECT_FALSE(result); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/AWSGameLiftServerManager.cpp b/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/AWSGameLiftServerManager.cpp index f98ae7b6f1..94d6a7dac1 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/AWSGameLiftServerManager.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/AWSGameLiftServerManager.cpp @@ -70,7 +70,7 @@ namespace AWSGameLift sessionConfig.m_ipAddress = gameSession.GetIpAddress().c_str(); sessionConfig.m_maxPlayer = gameSession.GetMaximumPlayerSessionCount(); sessionConfig.m_sessionName = gameSession.GetName().c_str(); - sessionConfig.m_port = gameSession.GetPort(); + sessionConfig.m_port = static_cast(gameSession.GetPort()); sessionConfig.m_status = AWSGameLiftSessionStatusNames[(int)gameSession.GetStatus()]; AZ_TracePrintf(AWSGameLiftServerManagerName, diff --git a/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp b/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp index ae9b868f42..7e216f33be 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp @@ -10,8 +10,6 @@ #include -#pragma warning(disable : 4996) - namespace AWSGameLift { Aws::GameLift::GenericOutcome GameLiftServerSDKWrapper::AcceptPlayerSession(const std::string& playerSessionId) @@ -56,7 +54,13 @@ namespace AWSGameLift } char buffer[50]; - strftime(buffer, sizeof(buffer), "%FT%TZ", gmtime(&terminationTime)); + tm time; +#if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS + gmtime_s(&time, &terminationTime); +#else + time = *gmtime(&terminationTime); +#endif + strftime(buffer, sizeof(buffer), "%FT%TZ", &time); return AZStd::string(buffer); } diff --git a/Gems/AWSMetrics/Code/Source/ClientConfiguration.cpp b/Gems/AWSMetrics/Code/Source/ClientConfiguration.cpp index eabac5a5c3..13cbf924c3 100644 --- a/Gems/AWSMetrics/Code/Source/ClientConfiguration.cpp +++ b/Gems/AWSMetrics/Code/Source/ClientConfiguration.cpp @@ -99,7 +99,7 @@ namespace AWSMetrics AZ::s64 ClientConfiguration::GetMaxQueueSizeInBytes() const { - return m_maxQueueSizeInMb * 1000000; + return static_cast(m_maxQueueSizeInMb * 1000000); } AZ::s64 ClientConfiguration::GetQueueFlushPeriodInSeconds() const diff --git a/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp b/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp index b7d9163fa9..743a8c5849 100644 --- a/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp +++ b/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp @@ -15,9 +15,6 @@ #include -#pragma warning(disable : 4996) - - namespace AWSMetrics { MetricsEventBuilder::MetricsEventBuilder() @@ -58,7 +55,13 @@ namespace AWSMetrics time_t now; time(&now); char buffer[50]; - strftime(buffer, sizeof(buffer), "%FT%TZ", gmtime(&now)); + tm time; +#if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS + gmtime_s(&time, &now); +#else + time = *gmtime(&now); +#endif + strftime(buffer, sizeof(buffer), "%FT%TZ", &time); m_currentMetricsEvent.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyEventTimestamp, AZStd::string(buffer))); } diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp index c6046bb5a2..0b06e00a9f 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp @@ -76,9 +76,9 @@ namespace ImageProcessingAtom for (int r = 0; r < ePS_Red; ++r) { SColor col; - col.r = 255 * r / (ePS_Red); - col.g = 255 * g / (ePS_Green); - col.b = 255 * b / (ePS_Blue); + col.r = static_cast(255 * r / (ePS_Red)); + col.g = static_cast(255 * g / (ePS_Green)); + col.b = static_cast(255 * b / (ePS_Blue)); int l = 255 - (col.r * 3 + col.g * 6 + col.b) / 10; col.r = col.g = col.b = (unsigned char)l; m_mapping.push_back(col); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/Cubemap.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/Cubemap.cpp index cd01d955d1..4f13c6f9bf 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/Cubemap.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/Cubemap.cpp @@ -191,7 +191,7 @@ namespace ImageProcessingAtom } //for each pixel in dst image, find it's location in src and copy the data from there - float halfSize = rectSize / 2; + float halfSize = static_cast(rectSize / 2); for (AZ::u32 row = 0; row < rectSize; row++) { for (AZ::u32 col = 0; col < rectSize; col++) @@ -201,8 +201,8 @@ namespace ImageProcessingAtom float dstY = halfSize - row - 0.5f; float srcX = dstX * mtx[0] + dstY * mtx[1]; float srcY = dstX * mtx[2] + dstY * mtx[3]; - AZ::u32 srcCol = srcX + halfSize; - AZ::u32 srcRow = halfSize - srcY; + AZ::u32 srcCol = static_cast(srcX + halfSize); + AZ::u32 srcRow = static_cast(halfSize - srcY); memcpy(&dstImageBuf[(row * rectSize + col) * bytePerPixel], &srcImageBuf[(srcRow * rectSize + srcCol) * bytePerPixel], bytePerPixel); @@ -464,7 +464,7 @@ namespace ImageProcessingAtom else { //transform the image - TransformImage(srcDir, dstDir, buf, tempBuf, sizePerPixel, faceSize); + TransformImage(srcDir, dstDir, buf, tempBuf, static_cast(sizePerPixel), faceSize); dstCubemap->SetFaceData(face, tempBuf, outSize); } } @@ -649,7 +649,7 @@ namespace ImageProcessingAtom preset.m_cubemapSetting->m_mipSlope, //MipAnglePerLevelScale, (int)preset.m_cubemapSetting->m_filter, //FilterType, CP_FILTER_TYPE_COSINE for diffuse cube preset.m_cubemapSetting->m_edgeFixup > 0 ? CP_FIXUP_PULL_LINEAR : CP_FIXUP_NONE, //FixupType, CP_FIXUP_PULL_LINEAR if FixupWidth> 0 - preset.m_cubemapSetting->m_edgeFixup, //FixupWidth, + static_cast(preset.m_cubemapSetting->m_edgeFixup), //FixupWidth, true, //bUseSolidAngle, 16, //GlossScale, 0, //GlossBias diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Weights.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Weights.cpp index a7689a86ba..170805aa57 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Weights.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Weights.cpp @@ -17,7 +17,7 @@ namespace ImageProcessingAtom { float round(float x) { - return ((x) >= 0) ? floor((x) + 0.5) : ceil((x)-0.5); + return ((x) >= 0.f) ? floor((x) + 0.5f) : ceil((x) - 0.5f); } void calculateFilterRange(unsigned int srcFactor, int& srcFirst, int& srcLast, @@ -220,7 +220,7 @@ namespace ImageProcessingAtom /* normalize against the peak sumWeights, because the sums are not allowed to leave -32768/32767 */ fWeight = fWeight * nrmWeights; - iWeight = int(round(fWeight)); + iWeight = int(round(static_cast(fWeight))); /* find first nonzero */ if (stillzero && (iWeight == 0)) @@ -246,7 +246,7 @@ namespace ImageProcessingAtom /* add weight to table, interleaved sign */ for (n = 0; n < -numRepetitions; n++) { - *weightsPtr++ = sgnextend(n, -iWeight); + *weightsPtr++ = static_cast(sgnextend(n, -iWeight)); } } else @@ -254,7 +254,7 @@ namespace ImageProcessingAtom /* add weight to table */ for (n = 0; n < numRepetitions; n++) { - *weightsPtr++ = -iWeight; + *weightsPtr++ = static_cast(-iWeight); } } @@ -311,7 +311,7 @@ namespace ImageProcessingAtom for (n = 0, weightsPtr = weightsMem + (i - i0) * numRepetitions; n < numRepetitions; n++) { - *weightsPtr++ -= iWeight; + *weightsPtr++ -= static_cast(iWeight); } } } diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp index c1d2d7bf19..b9054a9911 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp @@ -90,7 +90,7 @@ namespace ImageProcessingAtom for (i; i < ePixelFormat_Count; i++) { const PixelFormatInfo* info = CPixelFormats::GetInstance().GetPixelFormatInfo((EPixelFormat)i); - if (info->d3d10Format == dxgiFormat) + if (static_cast(info->d3d10Format) == dxgiFormat) { eFormat = (EPixelFormat)i; break; @@ -509,7 +509,7 @@ namespace ImageProcessingAtom for (i; i < ePixelFormat_Count; i++) { const PixelFormatInfo* info = CPixelFormats::GetInstance().GetPixelFormatInfo((EPixelFormat)i); - if (info->d3d10Format == dxgiFormat) + if (static_cast(info->d3d10Format) == dxgiFormat) { format = (EPixelFormat)i; break; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp index 0b0a241d40..c254d172ad 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp @@ -97,8 +97,8 @@ namespace ImageProcessingAtom RHI::Format format = Utils::PixelFormatToRHIFormat(m_imageObject->GetPixelFormat(), m_imageObject->HasImageFlags(EIF_SRGBRead)); RHI::ImageBindFlags bindFlag = RHI::ImageBindFlags::ShaderRead; - RHI::ImageDescriptor imageDesc = RHI::ImageDescriptor::Create2DArray(bindFlag, imageWidth, imageHeight, arraySize, format); - imageDesc.m_mipLevels = m_imageObject->GetMipCount(); + RHI::ImageDescriptor imageDesc = RHI::ImageDescriptor::Create2DArray(bindFlag, imageWidth, imageHeight, static_cast(arraySize), format); + imageDesc.m_mipLevels = static_cast(m_imageObject->GetMipCount()); if (m_imageObject->HasImageFlags(EIF_Cubemap)) { imageDesc.m_isCubemap = true; @@ -227,7 +227,7 @@ namespace ImageProcessingAtom { RPI::ImageMipChainAssetCreator builder; uint32_t arraySize = m_imageObject->HasImageFlags(EIF_Cubemap) ? 6 : 1; - builder.Begin(chainAssetId, mipLevels, arraySize); + builder.Begin(chainAssetId, static_cast(mipLevels), static_cast(arraySize)); for (uint32_t mip = startMip; mip < startMip + mipLevels; mip++) { diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h index 5f1cbf938a..ec1ec1bfaf 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h @@ -52,7 +52,7 @@ namespace ImageProcessingAtom Result = ((intValue + 0x0FFFU + ((intValue >> 13U) & 1U)) >> 13U) & 0x7FFFU; } - h = (Result | Sign); + h = static_cast(Result | Sign); } operator float() const @@ -82,7 +82,7 @@ namespace ImageProcessingAtom } else // The value is zero { - Exponent = -112; + Exponent = static_cast(-112); } Result = ((h & 0x8000) << 16) | // Sign diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp index 3ac9c334c5..4b28fbe4ef 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp @@ -269,11 +269,11 @@ namespace UnitTest public: //helper function to save an image object to a file through QtImage - static void SaveImageToFile(const IImageObjectPtr imageObject, const AZStd::string imageName, AZ::u32 maxMipCnt = 100) + static void SaveImageToFile([[maybe_unused]] const IImageObjectPtr imageObject, [[maybe_unused]] const AZStd::string imageName, [[maybe_unused]] AZ::u32 maxMipCnt = 100) { #ifndef DEBUG_OUTPUT_IMAGES return; - #endif + #else if (imageObject == nullptr) { return; @@ -314,6 +314,7 @@ namespace UnitTest QImage qimage(imageBuf, width, height, pitch, QImage::Format_RGBA8888); qimage.save(filePath); } + #endif } static bool GetComparisonResult(IImageObjectPtr image1, IImageObjectPtr image2, QString& output) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/temp/128x128_RGBA8.tga.streamingimage b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/temp/128x128_RGBA8.tga.streamingimage index b867b7cfb1..6826f2a76e 100644 Binary files a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/temp/128x128_RGBA8.tga.streamingimage and b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/temp/128x128_RGBA8.tga.streamingimage differ diff --git a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.cpp b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.cpp index fa861c739a..8a4d727e8c 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.cpp @@ -8,7 +8,7 @@ #include #include -#define CP_PI 3.14159265358979323846 +#define CP_PI 3.14159265358979323846f namespace ImageProcessingAtom @@ -259,10 +259,10 @@ namespace ImageProcessingAtom //get face idx and u, v texel coordinate in face VectToTexelCoord(a_XYZ, a_Surface[0].m_Width, &faceIdx, &u, &v ); - u = VM_MIN((int32)u, a_Surface[0].m_Width - 1); - v = VM_MIN((int32)v, a_Surface[0].m_Width - 1); + u = static_cast(VM_MIN((int32)u, a_Surface[0].m_Width - 1)); + v = static_cast(VM_MIN((int32)v, a_Surface[0].m_Width - 1)); - return( a_Surface[faceIdx].GetSurfaceTexelPtr(u, v) ); + return( a_Surface[faceIdx].GetSurfaceTexelPtr(static_cast(u), static_cast(v)) ); } //-------------------------------------------------------------------------------------- @@ -357,7 +357,7 @@ namespace ImageProcessingAtom VM_XPROD3_UNTYPED(xProdVect, edgeVect0, edgeVect1 ); texelArea += 0.5f * sqrt( VM_DOTPROD3_UNTYPED(xProdVect, xProdVect ) ); - return texelArea; + return static_cast(texelArea); } @@ -1130,7 +1130,7 @@ namespace ImageProcessingAtom // if p0 = 0 and p1 = 1, and d0 and d1 = 0, the interpolation reduces to // // p(t) = - 2t^3 + 3t^2 - fixupWeight = ((-2.0 * fixupFrac + 3.0) * fixupFrac * fixupFrac); + fixupWeight = ((-2.0f * fixupFrac + 3.0f) * fixupFrac * fixupFrac); } break; case CP_FIXUP_AVERAGE_LINEAR: @@ -1147,7 +1147,7 @@ namespace ImageProcessingAtom break; case CP_FIXUP_AVERAGE_HERMITE: { - fixupWeight = ((-2.0 * fixupFrac + 3.0) * fixupFrac * fixupFrac); + fixupWeight = ((-2.0f * fixupFrac + 3.0f) * fixupFrac * fixupFrac); //perform weighted average of edge tap value and current tap // fade off weight using hermite spline with distance from edge @@ -1538,7 +1538,7 @@ namespace ImageProcessingAtom // Find angle for which: cos(a) ^ cosinePower = epsilon const float epsilon = 0.000001f; float angle = acosf(powf(epsilon, 1.0f / cosinePower)); - angle *= 180.0f / (float)CP_PI; + angle *= 180.0f / CP_PI; angle *= 2.0f; return angle; @@ -1555,7 +1555,7 @@ namespace ImageProcessingAtom bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - return float(bits) * 2.3283064365386963e-10; // float(bits) * 2^-32 + return float(bits) * 2.3283064365386963e-10f; // float(bits) * 2^-32 } inline void HammersleySequence(uint32 sampleIndex, uint32 sampleCount, float* vXi) @@ -1668,7 +1668,7 @@ namespace ImageProcessingAtom float mip = 0.5f * log2f(solidAngleSample / solidAngleTexel) + 1.0f; //determine surrounding mip levels - uint32 mipA = floor(mip); + uint32 mipA = static_cast(floor(mip)); uint32 mipB = mipA + 1; float lerp = 0.0f; VM_CLAMP(lerp, mip - mipA, 0.0f, 1.0f); @@ -1819,7 +1819,7 @@ namespace ImageProcessingAtom float filterAngle; //min angle a src texel can cover (in degrees) - srcTexelAngle = (180.0f / (float)CP_PI) * atan2f(1.0f, (float)a_SrcCubeMapWidth); + srcTexelAngle = (180.0f / CP_PI) * atan2f(1.0f, (float)a_SrcCubeMapWidth); //filter angle is 1/2 the cone angle filterAngle = a_FilterConeAngle / 2.0f; @@ -1870,7 +1870,7 @@ namespace ImageProcessingAtom const int32 dstSize = a_DstCubeMap[0].m_Width; //min angle a src texel can cover (in degrees) - const float srcTexelAngle = (180.0f / (float)CP_PI) * atan2f(1.0f, (float)srcSize); + const float srcTexelAngle = (180.0f / CP_PI) * atan2f(1.0f, (float)srcSize); //angle about center tap to define filter cone float filterAngle; @@ -1897,7 +1897,7 @@ namespace ImageProcessingAtom //dotProdThresh threshold based on cone angle to determine whether or not taps // reside within the cone angle - const float dotProdThresh = cosf( ((float)CP_PI / 180.0f) * filterAngle ); + const float dotProdThresh = cosf( (CP_PI / 180.0f) * filterAngle ); //thread progress m_ThreadProgress[a_ThreadIdx].m_StartFace = a_FaceIdxStart; @@ -2004,8 +2004,8 @@ namespace ImageProcessingAtom else if( a_FilterType == CP_FILTER_TYPE_ANGULAR_GAUSSIAN ) { //fit 3 standard deviations within angular extent of filter - CP_ITYPE stdDev = (a_FilterAngle * CP_PI / 180.0) / 3.0; - CP_ITYPE inv2Variance = 1.0 / (2.0 * stdDev * stdDev); + CP_ITYPE stdDev = (a_FilterAngle * CP_PI / 180.0f) / 3.0f; + CP_ITYPE inv2Variance = 1.0f / (2.0f * stdDev * stdDev); for(iLUTEntry=0; iLUTEntry>= (23 - 10); //assemble s10e5 number using logical operations - rawf16Data = (signVal << 15) | (exponent << 10) | mantissa; + rawf16Data = static_cast((signVal << 15) | (exponent << 10) | mantissa); //return re-assembled raw data as a 32 bit float return rawf16Data; @@ -386,7 +386,7 @@ namespace ImageProcessingAtom if (k < 3) //only apply gamma and scale to RGB channels { //degamma texel val, by raising to the power gamma - texelVal = pow(texelVal, a_Gamma); + texelVal = static_cast(pow(texelVal, a_Gamma)); //scale texel val in linear space (after degamma) texelVal *= a_Scale; @@ -514,7 +514,7 @@ namespace ImageProcessingAtom texelVal *= a_Scale; //apply gamma to texel val by raising the texelVal to the power of (1/gamma) - texelVal = pow(texelVal, 1.0f / a_Gamma); + texelVal = static_cast(pow(texelVal, 1.0f / a_Gamma)); } //write out texture value diff --git a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h index c293cf1ac7..42ec07e02c 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h @@ -18,9 +18,6 @@ //-------------------------------------------------------------------------------------- // Modified from original -//disable warning about doubles being converted down to float -#pragma warning (disable : 4244 ) - #define VM_LARGE_FLOAT 3.7e37f #define VM_MIN(a, b) (((a) < (b)) ? (a) : (b)) @@ -128,7 +125,7 @@ //normalize vectors #define VM_NORM3_UNTYPED(d, s) {double __idsq; __idsq=1.0/sqrt(VM_DOTPROD3_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; } -#define VM_NORM3_UNTYPED_F32(d, s) {float __idsq; __idsq=1.0/sqrt(VM_DOTPROD3_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; } +#define VM_NORM3_UNTYPED_F32(d, s) {float __idsq; __idsq=1.0f/sqrt(VM_DOTPROD3_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; } #define VM_NORM3(d, s) VM_NORM3_UNTYPED_F32(((float *)(d)), ((float *)(s))) #define VM_NORM4_UNTYPED(d, s) {double __idsq; __idsq=1.0/sqrt(VM_DOTPROD4_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; d[3]=s[3]*__idsq; } diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp index cc42fac422..f5fb73182a 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp @@ -211,11 +211,11 @@ namespace AZ case rapidjson::kNumberType: if (name == "cols") { - inputStructParams.m_variable.m_cols = itr2->value.GetInt(); + inputStructParams.m_variable.m_cols = static_cast(itr2->value.GetInt()); } else if (name == "rows") { - inputStructParams.m_variable.m_rows = itr2->value.GetInt(); + inputStructParams.m_variable.m_rows = static_cast(itr2->value.GetInt()); } else if (name == "semanticIndex") { @@ -304,7 +304,7 @@ namespace AZ case rapidjson::kNumberType: if (name == "cols") { - outputStructParams.m_variable.m_cols = itr2->value.GetInt(); + outputStructParams.m_variable.m_cols = static_cast(itr2->value.GetInt()); } else if (name == "semanticIndex") { diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/CommonTypes.h b/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/CommonTypes.h index d5e5c7132c..fd34251277 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/CommonTypes.h +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/CommonTypes.h @@ -278,7 +278,7 @@ namespace AZ { AZ::Name m_nameId; uint32_t m_sizeInBytes = 0; - uint32_t m_space = -1; + uint32_t m_space = std::numeric_limits::max(); uint32_t m_registerId = RHI::UndefinedRegisterSlot; }; } // ShaderBuilder diff --git a/Gems/Atom/Asset/Shader/Code/Tests/McppBinderTests.cpp b/Gems/Atom/Asset/Shader/Code/Tests/McppBinderTests.cpp index 926f9b0a76..f1731c0501 100644 --- a/Gems/Atom/Asset/Shader/Code/Tests/McppBinderTests.cpp +++ b/Gems/Atom/Asset/Shader/Code/Tests/McppBinderTests.cpp @@ -32,7 +32,7 @@ namespace UnitTest { for (int bufferPos = 0, rollback = 0; bufferPos < (bufferSize - 1); ++bufferPos) { - const char value = 'a' + rollback++; + const char value = 'a' + static_cast(rollback++); buffer[bufferPos] = value; if (value == 'z') { diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/DiskLightFeatureProcessorInterface.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/DiskLightFeatureProcessorInterface.h index e4986eee93..bcb470d831 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/DiskLightFeatureProcessorInterface.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/DiskLightFeatureProcessorInterface.h @@ -38,7 +38,7 @@ namespace AZ float m_cosInnerConeAngle = 0.0f; // cosine of inner cone angle float m_cosOuterConeAngle = 0.0f; // cosine of outer cone angle float m_bulbPositionOffset = 0.0f; // Distance from the light disk surface to the tip of the cone of the light. m_bulbRadius * tanf(pi/2 - m_outerConeAngle). - uint16_t m_shadowIndex = -1; // index for ProjectedShadowData. A value of 0xFFFF indicates an illegal index. + uint16_t m_shadowIndex = std::numeric_limits::max(); // index for ProjectedShadowData. A value of 0xFFFF indicates an illegal index. uint16_t m_padding; // Explicit padding. }; diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Material/MaterialAssignmentId.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Material/MaterialAssignmentId.h index e58a8397db..599f4c380e 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Material/MaterialAssignmentId.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Material/MaterialAssignmentId.h @@ -64,7 +64,7 @@ namespace AZ bool operator==(const MaterialAssignmentId& rhs) const; bool operator!=(const MaterialAssignmentId& rhs) const; - static constexpr MaterialAssignmentLodIndex NonLodIndex = -1; + static constexpr MaterialAssignmentLodIndex NonLodIndex = std::numeric_limits::max(); MaterialAssignmentLodIndex m_lodIndex = NonLodIndex; RPI::ModelMaterialSlot::StableId m_materialSlotStableId = RPI::ModelMaterialSlot::InvalidStableId; diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/TransformService/TransformServiceFeatureProcessor.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/TransformService/TransformServiceFeatureProcessor.h index 1f31701d91..6482871234 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/TransformService/TransformServiceFeatureProcessor.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/TransformService/TransformServiceFeatureProcessor.h @@ -61,7 +61,7 @@ namespace AZ }; // Flag value for when the buffers have no empty spaces. - static const uint32_t NoAvailableTransformIndices = -1; + static const uint32_t NoAvailableTransformIndices = std::numeric_limits::max(); TransformServiceFeatureProcessor(const TransformServiceFeatureProcessor&) = delete; diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/MultiSparseVector.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/MultiSparseVector.h index 2d93b4a7fd..216e90c594 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/MultiSparseVector.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/MultiSparseVector.h @@ -49,7 +49,7 @@ namespace AZ::Render private: - static constexpr size_t NoFreeSlot = -1; + static constexpr size_t NoFreeSlot = std::numeric_limits::max(); static constexpr size_t InitialReservedCount = 128; using Fn = void(&)(AZStd::vector& ...); @@ -103,7 +103,7 @@ namespace AZ::Render template inline size_t MultiSparseVector::Reserve() { - size_t slotToReturn = -1; + size_t slotToReturn = std::numeric_limits::max(); if (m_nextFreeSlot != NoFreeSlot) { // If there's a free slot, then use that space and update the linked list of free slots. diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/SparseVector.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/SparseVector.h index 525288adb0..8f388e23b9 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/SparseVector.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/SparseVector.h @@ -49,7 +49,7 @@ namespace AZ::Render private: - static constexpr size_t NoFreeSlot = -1; + static constexpr size_t NoFreeSlot = std::numeric_limits::max(); static constexpr size_t InitialReservedCount = 128; size_t m_nextFreeSlot = NoFreeSlot; @@ -66,7 +66,7 @@ namespace AZ::Render template inline size_t SparseVector::Reserve() { - size_t slotToReturn = -1; + size_t slotToReturn = std::numeric_limits::max(); if (m_nextFreeSlot != NoFreeSlot) { // If there's a free slot, then use that space and update the linked list of free slots. diff --git a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp index 698b7e1e37..0045311bef 100644 --- a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp @@ -405,15 +405,15 @@ namespace AZ for (uint16_t ring = 0; ring < numRings - 2; ++ring) { - uint16_t firstVertOfThisRing = 1 + ring * numSections; - uint16_t firstVertOfNextRing = 1 + (ring + 1) * numSections; + uint16_t firstVertOfThisRing = static_cast(1 + ring * numSections); + uint16_t firstVertOfNextRing = static_cast(1 + (ring + 1) * numSections); for (uint16_t section = 0; section < numSections; ++section) { uint32_t nextSection = (section + 1) % numSections; // line around ring indices.push_back(firstVertOfThisRing + section); - indices.push_back(firstVertOfThisRing + nextSection); + indices.push_back(static_cast(firstVertOfThisRing + nextSection)); // line around section indices.push_back(firstVertOfThisRing + section); @@ -423,15 +423,15 @@ namespace AZ // build faces for end caps (to connect "inner" vertices with poles) uint16_t firstPoleVert = 0; - uint16_t firstVertOfFirstRing = 1 + (0) * numSections; + uint16_t firstVertOfFirstRing = static_cast(1 + (0) * numSections); for (uint16_t section = 0; section < numSections; ++section) { indices.push_back(firstPoleVert); indices.push_back(firstVertOfFirstRing + section); } - uint16_t lastPoleVert = (numRings - 1) * numSections + 1; - uint16_t firstVertOfLastRing = 1 + (numRings - 2) * numSections; + uint16_t lastPoleVert = static_cast((numRings - 1) * numSections + 1); + uint16_t firstVertOfLastRing = static_cast(1 + (numRings - 2) * numSections); for (uint16_t section = 0; section < numSections; ++section) { indices.push_back(firstVertOfLastRing + section); @@ -457,13 +457,13 @@ namespace AZ for (uint32_t section = 0; section < numSections; ++section) { uint32_t nextSection = (section + 1) % numSections; - indices.push_back((uint16_t)firstVertOfThisRing + nextSection); - indices.push_back((uint16_t)firstVertOfThisRing + section); - indices.push_back((uint16_t)firstVertOfNextRing + nextSection); + indices.push_back(static_cast(firstVertOfThisRing + nextSection)); + indices.push_back(static_cast(firstVertOfThisRing + section)); + indices.push_back(static_cast(firstVertOfNextRing + nextSection)); - indices.push_back((uint16_t)firstVertOfNextRing + section); - indices.push_back((uint16_t)firstVertOfNextRing + nextSection); - indices.push_back((uint16_t)firstVertOfThisRing + section); + indices.push_back(static_cast(firstVertOfNextRing + section)); + indices.push_back(static_cast(firstVertOfNextRing + nextSection)); + indices.push_back(static_cast(firstVertOfThisRing + section)); } } @@ -473,9 +473,9 @@ namespace AZ for (uint32_t section = 0; section < numSections; ++section) { uint32_t nextSection = (section + 1) % numSections; - indices.push_back((uint16_t)firstVertOfFirstRing + section); - indices.push_back((uint16_t)firstVertOfFirstRing + nextSection); - indices.push_back((uint16_t)firstPoleVert); + indices.push_back(static_cast(firstVertOfFirstRing + section)); + indices.push_back(static_cast(firstVertOfFirstRing + nextSection)); + indices.push_back(static_cast(firstPoleVert)); } uint32_t lastPoleVert = (numRings - 1) * numSections + 1; @@ -483,9 +483,9 @@ namespace AZ for (uint32_t section = 0; section < numSections; ++section) { uint32_t nextSection = (section + 1) % numSections; - indices.push_back((uint16_t)firstVertOfLastRing + nextSection); - indices.push_back((uint16_t)firstVertOfLastRing + section); - indices.push_back((uint16_t)lastPoleVert); + indices.push_back(static_cast(firstVertOfLastRing + nextSection)); + indices.push_back(static_cast(firstVertOfLastRing + section)); + indices.push_back(static_cast(lastPoleVert)); } } } @@ -637,12 +637,12 @@ namespace AZ { // Line from center of disk to outer edge meshData.m_lineIndices.push_back(centerIndex); - meshData.m_lineIndices.push_back(firstSection + section); + meshData.m_lineIndices.push_back(static_cast(firstSection + section)); // Line from outer edge to next edge - meshData.m_lineIndices.push_back(firstSection + section); + meshData.m_lineIndices.push_back(static_cast(firstSection + section)); uint32_t nextSection = (section + 1) % numSections; - meshData.m_lineIndices.push_back(firstSection + nextSection); + meshData.m_lineIndices.push_back(static_cast(firstSection + nextSection)); } // Create triangle indices @@ -652,13 +652,13 @@ namespace AZ meshData.m_triangleIndices.push_back(centerIndex); if (isUp) { - meshData.m_triangleIndices.push_back(firstSection + nextSection); - meshData.m_triangleIndices.push_back(firstSection + section); + meshData.m_triangleIndices.push_back(static_cast(firstSection + nextSection)); + meshData.m_triangleIndices.push_back(static_cast(firstSection + section)); } else { - meshData.m_triangleIndices.push_back(firstSection + section); - meshData.m_triangleIndices.push_back(firstSection + nextSection); + meshData.m_triangleIndices.push_back(static_cast(firstSection + section)); + meshData.m_triangleIndices.push_back(static_cast(firstSection + nextSection)); } } } @@ -776,7 +776,7 @@ namespace AZ normals.push_back(AuxGeomNormal(0.0f, 1.0f, 0.0f)); // vertex indexes for start of the cone sides and for the cone point - uint16_t indexOfSidesStart = numSections + 1; + uint16_t indexOfSidesStart = static_cast(numSections + 1); uint32_t indexOfConePoint = indexOfSidesStart + numRings * numSections; // indices for points @@ -795,8 +795,8 @@ namespace AZ // build lines between already completed cap for each section for (uint16_t section = 0; section < numSections; ++section) { - indices.push_back(indexOfSidesStart + numRings * section); - indices.push_back(indexOfConePoint); + indices.push_back(static_cast(indexOfSidesStart + numRings * section)); + indices.push_back(static_cast(indexOfConePoint)); } } @@ -812,19 +812,19 @@ namespace AZ // faces from end cap to close to point for (uint32_t ring = 0; ring < numRings - 1; ++ring) { - indices.push_back(indexOfSidesStart + numRings * nextSection + ring + 1); - indices.push_back(indexOfSidesStart + numRings * nextSection + ring); - indices.push_back(indexOfSidesStart + numRings * section + ring); + indices.push_back(static_cast(indexOfSidesStart + numRings * nextSection + ring + 1)); + indices.push_back(static_cast(indexOfSidesStart + numRings * nextSection + ring)); + indices.push_back(static_cast(indexOfSidesStart + numRings * section + ring)); - indices.push_back(indexOfSidesStart + numRings * section + ring); - indices.push_back(indexOfSidesStart + numRings * section + ring + 1); - indices.push_back(indexOfSidesStart + numRings * nextSection + ring + 1); + indices.push_back(static_cast(indexOfSidesStart + numRings * section + ring)); + indices.push_back(static_cast(indexOfSidesStart + numRings * section + ring + 1)); + indices.push_back(static_cast(indexOfSidesStart + numRings * nextSection + ring + 1)); } // faces for point (from last ring of verts to point) - indices.push_back(indexOfConePoint); - indices.push_back(indexOfSidesStart + numRings * nextSection + numRings - 1); - indices.push_back(indexOfSidesStart + numRings * section + numRings - 1); + indices.push_back(static_cast(indexOfConePoint)); + indices.push_back(static_cast(indexOfSidesStart + numRings * nextSection + numRings - 1)); + indices.push_back(static_cast(indexOfSidesStart + numRings * section + numRings - 1)); } } } @@ -912,7 +912,7 @@ namespace AZ //uint16_t indexOfBottomStart = 1; //uint16_t indexOfTopCenter = numSections + 1; //uint16_t indexOfTopStart = numSections + 2; - uint16_t indexOfSidesStart = 2 * numSections + 2; + uint16_t indexOfSidesStart = static_cast(2 * numSections + 2); // build point indices { diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/CascadedShadowmapsPass.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/CascadedShadowmapsPass.cpp index 33123d67a1..5529a2916b 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/CascadedShadowmapsPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/CascadedShadowmapsPass.cpp @@ -126,7 +126,7 @@ namespace AZ return; } - SetCascadesCount(m_arraySize); + SetCascadesCount(static_cast(m_arraySize)); const RHI::Size imageSize { aznumeric_cast(m_shadowmapSize), diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp index 4aa749f7d7..6a418117fc 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp @@ -225,7 +225,7 @@ namespace AZ } if (segmentsNeedUpdate) { - UpdateViewsOfCascadeSegments(m_shadowingLightHandle, cascadeCount); + UpdateViewsOfCascadeSegments(m_shadowingLightHandle, static_cast(cascadeCount)); SetShadowmapImageSizeArraySize(m_shadowingLightHandle); } @@ -933,9 +933,10 @@ namespace AZ uint16_t DirectionalLightFeatureProcessor::GetCascadeCount(LightHandle handle) const { - for (const auto& segmentIt : m_shadowProperties.GetData(handle.GetIndex()).m_segments) + const auto& segments = m_shadowProperties.GetData(handle.GetIndex()).m_segments; + if (!segments.empty()) { - return aznumeric_cast(segmentIt.second.size()); + return aznumeric_cast(segments.begin()->second.size()); } return 0; } @@ -1216,7 +1217,7 @@ namespace AZ else { // If ESM is not used, set filter offsets and filter counts zero in ESM data. - for (uint32_t index = 0; index < GetCascadeCount(handle); ++index) + for (uint16_t index = 0; index < GetCascadeCount(handle); ++index) { EsmShadowmapsPass::FilterParameter& filterParameter = m_esmParameterData.at(cameraView).GetData(index); filterParameter.m_isEnabled = false; diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.cpp index a88c587f66..03a423f6db 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.cpp @@ -159,7 +159,7 @@ namespace AZ void LightCullingPass::ResetInternal() { - m_tileDataIndex = -1; + m_tileDataIndex = std::numeric_limits::max(); m_constantDataIndex.Reset(); for (auto& elem : m_lightdata) @@ -234,7 +234,7 @@ namespace AZ return i; } } - return -1; + return std::numeric_limits::max(); } AZ::RHI::Size LightCullingPass::GetTileDataBufferResolution() diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.h b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.h index af230b8d57..9fa81bd7de 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.h +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.h @@ -94,7 +94,7 @@ namespace AZ Data::Instance m_lightList; - uint32_t m_tileDataIndex = -1; + uint32_t m_tileDataIndex = std::numeric_limits::max(); }; } // namespace Render } // namespace AZ diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingRemap.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingRemap.cpp index e4881ed665..1a03b7ef38 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingRemap.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingRemap.cpp @@ -101,7 +101,7 @@ namespace AZ return i; } } - return -1; + return std::numeric_limits::max(); } void LightCullingRemap::BuildInternal() diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/ProjectedShadowmapsPass.h b/Gems/Atom/Feature/Common/Code/Source/CoreLights/ProjectedShadowmapsPass.h index f1607191fc..dc7df7de78 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/ProjectedShadowmapsPass.h +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/ProjectedShadowmapsPass.h @@ -30,7 +30,7 @@ namespace AZ AZ_CLASS_ALLOCATOR(ProjectedShadowmapsPass, SystemAllocator, 0); AZ_RTTI(ProjectedShadowmapsPass, "00024B13-1095-40FA-BEC3-B0F68110BEA2", Base); - static constexpr uint16_t InvalidIndex = ~0; + static constexpr uint16_t InvalidIndex = std::numeric_limits::max(); struct ShadowmapSizeWithIndices { ShadowmapSize m_size = ShadowmapSize::None; diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/ShadowmapAtlas.h b/Gems/Atom/Feature/Common/Code/Source/CoreLights/ShadowmapAtlas.h index 5081a9ef9e..f0a372ec5b 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/ShadowmapAtlas.h +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/ShadowmapAtlas.h @@ -52,7 +52,7 @@ namespace AZ // then m_nextTableOffset == 0, which works as the terminator for seaching // a shadowmap index in a compute shader. uint32_t m_nextTableOffset = 0; - uint32_t m_shadowmapIndex = ~0; // invalid index + uint32_t m_shadowmapIndex = std::numeric_limits::max(); // invalid index }; //! This initializes the packing of shadowmap sizes. @@ -156,7 +156,7 @@ namespace AZ //! [2,2,2] indicates (0, 1024+512)-(0+511, 1024+512+511) of slice:2 (width 512). using Location = AZStd::vector; static constexpr uint8_t LocationIndexNum = 4; - static constexpr size_t InvalidIndex = ~0; + static constexpr size_t InvalidIndex = std::numeric_limits::max(); struct LocationHasher { diff --git a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArray.cpp b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArray.cpp index 6531a04e22..ebdc884ecf 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArray.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArray.cpp @@ -147,7 +147,7 @@ namespace AZ RPI::ImageMipChainAssetCreator assetCreator; const uint32_t mipLevels = GetNumMipLevels(); - assetCreator.Begin(Data::AssetId(AZ::Uuid::CreateRandom()), mipLevels, aznumeric_cast(numTexturesToCreate)); + assetCreator.Begin(Data::AssetId(AZ::Uuid::CreateRandom()), static_cast(mipLevels), aznumeric_cast(numTexturesToCreate)); for (uint32_t mipLevel = 0; mipLevel < mipLevels; ++mipLevel) { diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistancePass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistancePass.cpp index a3927b802d..69a4ecdee5 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistancePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistancePass.cpp @@ -72,9 +72,9 @@ namespace AZ return; } - m_dispatchArgs.m_threadsPerGroupX = AZStd::any_cast(args[0]); - m_dispatchArgs.m_threadsPerGroupY = AZStd::any_cast(args[1]); - m_dispatchArgs.m_threadsPerGroupZ = AZStd::any_cast(args[2]); + m_dispatchArgs.m_threadsPerGroupX = static_cast(AZStd::any_cast(args[0])); + m_dispatchArgs.m_threadsPerGroupY = static_cast(AZStd::any_cast(args[1])); + m_dispatchArgs.m_threadsPerGroupZ = static_cast(AZStd::any_cast(args[2])); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiancePass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiancePass.cpp index 6ff8bdd867..83ef312bf4 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiancePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiancePass.cpp @@ -72,9 +72,9 @@ namespace AZ return; } - m_dispatchArgs.m_threadsPerGroupX = AZStd::any_cast(args[0]); - m_dispatchArgs.m_threadsPerGroupY = AZStd::any_cast(args[1]); - m_dispatchArgs.m_threadsPerGroupZ = AZStd::any_cast(args[2]); + m_dispatchArgs.m_threadsPerGroupX = static_cast(AZStd::any_cast(args[0])); + m_dispatchArgs.m_threadsPerGroupY = static_cast(AZStd::any_cast(args[1])); + m_dispatchArgs.m_threadsPerGroupZ = static_cast(AZStd::any_cast(args[2])); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdatePass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdatePass.cpp index ddfe0f11b1..b251526cb4 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdatePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdatePass.cpp @@ -85,9 +85,9 @@ namespace AZ return; } - dispatchArgs.m_threadsPerGroupX = AZStd::any_cast(args[0]); - dispatchArgs.m_threadsPerGroupY = AZStd::any_cast(args[1]); - dispatchArgs.m_threadsPerGroupZ = AZStd::any_cast(args[2]); + dispatchArgs.m_threadsPerGroupX = static_cast(AZStd::any_cast(args[0])); + dispatchArgs.m_threadsPerGroupY = static_cast(AZStd::any_cast(args[1])); + dispatchArgs.m_threadsPerGroupZ = static_cast(AZStd::any_cast(args[2])); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridClassificationPass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridClassificationPass.cpp index 4c6b07d780..2690f90a7d 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridClassificationPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridClassificationPass.cpp @@ -76,9 +76,9 @@ namespace AZ return; } - m_dispatchArgs.m_threadsPerGroupX = AZStd::any_cast(args[0]); - m_dispatchArgs.m_threadsPerGroupY = AZStd::any_cast(args[1]); - m_dispatchArgs.m_threadsPerGroupZ = AZStd::any_cast(args[2]); + m_dispatchArgs.m_threadsPerGroupX = static_cast(AZStd::any_cast(args[0])); + m_dispatchArgs.m_threadsPerGroupY = static_cast(AZStd::any_cast(args[1])); + m_dispatchArgs.m_threadsPerGroupZ = static_cast(AZStd::any_cast(args[2])); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridRelocationPass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridRelocationPass.cpp index 54cf9783cd..67fb95a833 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridRelocationPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridRelocationPass.cpp @@ -76,9 +76,9 @@ namespace AZ return; } - m_dispatchArgs.m_threadsPerGroupX = AZStd::any_cast(args[0]); - m_dispatchArgs.m_threadsPerGroupY = AZStd::any_cast(args[1]); - m_dispatchArgs.m_threadsPerGroupZ = AZStd::any_cast(args[2]); + m_dispatchArgs.m_threadsPerGroupX = static_cast(AZStd::any_cast(args[0])); + m_dispatchArgs.m_threadsPerGroupY = static_cast(AZStd::any_cast(args[1])); + m_dispatchArgs.m_threadsPerGroupZ = static_cast(AZStd::any_cast(args[2])); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp index f87a9b30e9..f73b0d71eb 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp @@ -396,12 +396,12 @@ namespace AZ { auto imguiContextScope = ImguiContextScope(m_imguiContext); - m_viewportWidth = params.m_viewportState.m_maxX - params.m_viewportState.m_minX; - m_viewportHeight = params.m_viewportState.m_maxY - params.m_viewportState.m_minY; + m_viewportWidth = static_cast(params.m_viewportState.m_maxX - params.m_viewportState.m_minX); + m_viewportHeight = static_cast(params.m_viewportState.m_maxY - params.m_viewportState.m_minY); auto& io = ImGui::GetIO(); - io.DisplaySize.x = AZStd::max(1.0f, m_viewportWidth); - io.DisplaySize.y = AZStd::max(1.0f, m_viewportHeight); + io.DisplaySize.x = AZStd::max(1.0f, static_cast(m_viewportWidth)); + io.DisplaySize.y = AZStd::max(1.0f, static_cast(m_viewportHeight)); Matrix4x4 projectionMatrix = Matrix4x4::CreateFromRows( @@ -547,8 +547,8 @@ namespace AZ for (const ImDrawCmd& drawCmd : drawList->CmdBuffer) { AZ_Assert(drawCmd.UserCallback == nullptr, "ImGui UserCallbacks are not supported by the ImGui Pass"); - uint32_t scissorMaxX = drawCmd.ClipRect.z; - uint32_t scissorMaxY = drawCmd.ClipRect.w; + uint32_t scissorMaxX = static_cast(drawCmd.ClipRect.z); + uint32_t scissorMaxY = static_cast(drawCmd.ClipRect.w); //scissorMaxX/scissorMaxY can be a frame stale from imgui (ImGui::NewFrame runs after this) hence we clamp it to viewport bounds //otherwise it is possible to have a frame where scissor bounds can be bigger than window's bounds if we resize the window @@ -559,8 +559,8 @@ namespace AZ { RHI::DrawIndexed(1, 0, vertexOffset, drawCmd.ElemCount, indexOffset), RHI::Scissor( - (drawCmd.ClipRect.x), - (drawCmd.ClipRect.y), + static_cast(drawCmd.ClipRect.x), + static_cast(drawCmd.ClipRect.y), scissorMaxX, scissorMaxY ) diff --git a/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp index 58541da92a..6ed37ce972 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp @@ -800,19 +800,19 @@ namespace AZ // note that the element count is the size of the entire buffer, even though this mesh may only // occupy a portion of the vertex buffer. This is necessary since we are accessing it using // a ByteAddressBuffer in the raytracing shaders and passing the byte offset to the shader in a constant buffer. - uint32_t positionBufferByteCount = const_cast(streamBufferViews[0].GetBuffer())->GetDescriptor().m_byteCount; + uint32_t positionBufferByteCount = static_cast(const_cast(streamBufferViews[0].GetBuffer())->GetDescriptor().m_byteCount); RHI::BufferViewDescriptor positionBufferDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, positionBufferByteCount); - uint32_t normalBufferByteCount = const_cast(streamBufferViews[1].GetBuffer())->GetDescriptor().m_byteCount; + uint32_t normalBufferByteCount = static_cast(const_cast(streamBufferViews[1].GetBuffer())->GetDescriptor().m_byteCount); RHI::BufferViewDescriptor normalBufferDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, normalBufferByteCount); - uint32_t tangentBufferByteCount = const_cast(streamBufferViews[2].GetBuffer())->GetDescriptor().m_byteCount; + uint32_t tangentBufferByteCount = static_cast(const_cast(streamBufferViews[2].GetBuffer())->GetDescriptor().m_byteCount); RHI::BufferViewDescriptor tangentBufferDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, tangentBufferByteCount); - uint32_t bitangentBufferByteCount = const_cast(streamBufferViews[3].GetBuffer())->GetDescriptor().m_byteCount; + uint32_t bitangentBufferByteCount = static_cast(const_cast(streamBufferViews[3].GetBuffer())->GetDescriptor().m_byteCount); RHI::BufferViewDescriptor bitangentBufferDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, bitangentBufferByteCount); - uint32_t uvBufferByteCount = const_cast(streamBufferViews[4].GetBuffer())->GetDescriptor().m_byteCount; + uint32_t uvBufferByteCount = static_cast(const_cast(streamBufferViews[4].GetBuffer())->GetDescriptor().m_byteCount); RHI::BufferViewDescriptor uvBufferDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, uvBufferByteCount); const RHI::IndexBufferView& indexBufferView = mesh.m_indexBufferView; diff --git a/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp b/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp index 0f8a30d8aa..19f379b17d 100644 --- a/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp @@ -85,9 +85,9 @@ namespace AZ { const auto& args = *numThreads; // Check that the arguments are valid integers, and fall back to 1,1,1 if there is an error - arguments.m_threadsPerGroupX = args[0].type() == azrtti_typeid() ? AZStd::any_cast(args[0]) : 1; - arguments.m_threadsPerGroupY = args[1].type() == azrtti_typeid() ? AZStd::any_cast(args[1]) : 1; - arguments.m_threadsPerGroupZ = args[2].type() == azrtti_typeid() ? AZStd::any_cast(args[2]) : 1; + arguments.m_threadsPerGroupX = static_cast(args[0].type() == azrtti_typeid() ? AZStd::any_cast(args[0]) : 1); + arguments.m_threadsPerGroupY = static_cast(args[1].type() == azrtti_typeid() ? AZStd::any_cast(args[1]) : 1); + arguments.m_threadsPerGroupZ = static_cast(args[2].type() == azrtti_typeid() ? AZStd::any_cast(args[2]) : 1); } arguments.m_totalNumberOfThreadsX = m_morphTargetMetaData.m_vertexCount; diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp index 8631ae2eb3..f74837bd9a 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp @@ -326,7 +326,7 @@ namespace AZ one_over[curLutIndex] = 1.f; } - int current = 0; + uint32_t current = 0; for (size_t lutIndex = 0; lutIndex < numLuts; lutIndex++) { LutBlendItem& lutBlendItem = settings->GetLutBlendItem(lutIndex); @@ -378,7 +378,7 @@ namespace AZ { // Compute all the weights // First compute the weight of the ungraded color value - for (int lutIndex = 0; lutIndex < current; lutIndex++) + for (uint32_t lutIndex = 0; lutIndex < current; lutIndex++) { float weight = one_intensity[lutIndex] * over[lutIndex]; for (int overrideLutIndex = lutIndex + 1; overrideLutIndex < LookModificationSettings::MaxBlendLuts; overrideLutIndex++) @@ -388,7 +388,7 @@ namespace AZ m_weights[0] += weight; } // Then compute the weights for the LUTs - for (int weightIndex = 0; weightIndex < current; weightIndex++) + for (uint32_t weightIndex = 0; weightIndex < current; weightIndex++) { m_weights[weightIndex + 1] = intensity[weightIndex] * over[weightIndex]; for (int lutIndex = weightIndex + 1; lutIndex < LookModificationSettings::MaxBlendLuts; lutIndex++) diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp index b93e847fd2..3fcff54eaa 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp @@ -153,8 +153,8 @@ namespace AZ inBinding.m_connectedBinding = isHorizontalPass ? &parentInOutBinding : &parentInBinding; RHI::ImageViewDescriptor viewDesc; - viewDesc.m_mipSliceMin = mipLevel; - viewDesc.m_mipSliceMax = mipLevel; + viewDesc.m_mipSliceMin = static_cast(mipLevel); + viewDesc.m_mipSliceMax = static_cast(mipLevel); inBinding.m_unifiedScopeDesc.SetAsImage(viewDesc); pass->AddAttachmentBinding(inBinding); diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomCompositePass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomCompositePass.cpp index 11e53e8805..e9b428c877 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomCompositePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomCompositePass.cpp @@ -133,8 +133,8 @@ namespace AZ inBinding.m_connectedBinding = &parentInBinding; RHI::ImageViewDescriptor inViewDesc; - inViewDesc.m_mipSliceMin = mipLevel; - inViewDesc.m_mipSliceMax = mipLevel; + inViewDesc.m_mipSliceMin = static_cast(mipLevel); + inViewDesc.m_mipSliceMax = static_cast(mipLevel); inBinding.m_unifiedScopeDesc.SetAsImage(inViewDesc); pass->AddAttachmentBinding(inBinding); @@ -151,8 +151,8 @@ namespace AZ if (mipLevel != 0) { RHI::ImageViewDescriptor outViewDesc; - outViewDesc.m_mipSliceMin = mipLevel - 1; - outViewDesc.m_mipSliceMax = mipLevel - 1; + outViewDesc.m_mipSliceMin = static_cast(mipLevel - 1); + outViewDesc.m_mipSliceMax = static_cast(mipLevel - 1); outBinding.m_unifiedScopeDesc.SetAsImage(outViewDesc); } diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomDownsamplePass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomDownsamplePass.cpp index 1481a7999e..8b824a424d 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomDownsamplePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomDownsamplePass.cpp @@ -47,7 +47,7 @@ namespace AZ { RPI::Ptr outAttachment = m_ownedAttachments[0]; - for (uint32_t i = 0; i < Render::Bloom::MaxStageCount; ++i) + for (uint16_t i = 0; i < Render::Bloom::MaxStageCount; ++i) { // Create bindings diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/TaaPass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/TaaPass.cpp index d1f42069fb..779f02cba0 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/TaaPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/TaaPass.cpp @@ -76,7 +76,7 @@ namespace AZ::Render void TaaPass::FrameBeginInternal(FramePrepareParams params) { RHI::Size inputSize = m_inputColorBinding->m_attachment->m_descriptor.m_image.m_size; - Vector2 rcpInputSize = Vector2(1.0 / inputSize.m_width, 1.0 / inputSize.m_height); + Vector2 rcpInputSize = Vector2(1.0f / inputSize.m_width, 1.0f / inputSize.m_height); RPI::ViewPtr view = GetRenderPipeline()->GetDefaultView(); m_offsetIndex = (m_offsetIndex + 1) % m_subPixelOffsets.size(); diff --git a/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp b/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp index a6e41a3ce1..276ea7683f 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp @@ -361,7 +361,7 @@ namespace AZ drawRequest.m_listTag = drawListTag; drawRequest.m_pipelineState = pipelineState->GetRHIPipelineState(); drawRequest.m_streamBufferViews = m_reflectionRenderData->m_boxPositionBufferView; - drawRequest.m_stencilRef = stencilRef; + drawRequest.m_stencilRef = static_cast(stencilRef); drawRequest.m_sortKey = m_sortKey; drawPacketBuilder.AddDrawItem(drawRequest); diff --git a/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp index c3125e0bbe..3e97277594 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp @@ -38,14 +38,14 @@ namespace AZ if (m_imageSize != size) { m_imageSize = size; - m_outputScale = (m_passType == PassType::Vertical) ? pow(2.0f, m_mipLevel) : 1.0f; + m_outputScale = (m_passType == PassType::Vertical) ? static_cast(pow(2.0f, m_mipLevel)) : 1.0f; m_updateSrg = true; } float inverseScale = 1.0f / m_outputScale; - uint32_t outputWidth = m_imageSize.m_width * inverseScale; - uint32_t outputHeight = m_imageSize.m_height * inverseScale; + uint32_t outputWidth = static_cast(m_imageSize.m_width * inverseScale); + uint32_t outputHeight = static_cast(m_imageSize.m_height * inverseScale); params.m_viewportState = RHI::Viewport(0, static_cast(outputWidth), 0, static_cast(outputHeight)); params.m_scissorState = RHI::Scissor(0, 0, outputWidth, outputHeight); diff --git a/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurPass.cpp index 4f5caca108..394a6fd406 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurPass.cpp @@ -190,8 +190,8 @@ namespace AZ RPI::PassAttachmentBinding& outputAttachmentBinding = horizontalBlurChildPass->GetInputOutputBinding(1); uint32_t mipLevel = attachmentIndex + 1; RHI::ImageViewDescriptor outputViewDesc; - outputViewDesc.m_mipSliceMin = mipLevel; - outputViewDesc.m_mipSliceMax = mipLevel; + outputViewDesc.m_mipSliceMin = static_cast(mipLevel); + outputViewDesc.m_mipSliceMax = static_cast(mipLevel); outputAttachmentBinding.m_unifiedScopeDesc.SetAsImage(outputViewDesc); outputAttachmentBinding.SetAttachment(reflectionImageAttachment); diff --git a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp index 5a25951163..0e42c5520e 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp @@ -539,9 +539,10 @@ namespace AZ::Render { esmPass->QueueForBuildAndInitialization(); } - - for (ProjectedShadowmapsPass* shadowPass : m_projectedShadowmapsPasses) + + if (!m_projectedShadowmapsPasses.empty()) { + const ProjectedShadowmapsPass* shadowPass = m_projectedShadowmapsPasses.front(); for (const auto& shadowProperty : shadowProperties) { const int16_t shadowIndexInSrg = shadowProperty.m_shadowId.GetIndex(); @@ -553,7 +554,6 @@ namespace AZ::Render filterData.m_shadowmapOriginInSlice = origin.m_originInSlice; m_deviceBufferNeedsUpdate = true; } - break; } m_shadowmapPassNeedsUpdate = false; @@ -571,8 +571,9 @@ namespace AZ::Render void ProjectedShadowFeatureProcessor::PrepareViews(const PrepareViewsPacket&, AZStd::vector>& outViews) { - for (ProjectedShadowmapsPass* pass : m_projectedShadowmapsPasses) + if (!m_projectedShadowmapsPasses.empty()) { + ProjectedShadowmapsPass* pass = m_projectedShadowmapsPasses.front(); RPI::RenderPipeline* renderPipeline = pass->GetRenderPipeline(); if (renderPipeline) { @@ -598,7 +599,6 @@ namespace AZ::Render outViews.emplace_back(AZStd::make_pair(viewTag, shadowProperty.m_shadowmapView)); } } - break; } } @@ -606,8 +606,9 @@ namespace AZ::Render { AZ_ATOM_PROFILE_FUNCTION("RPI", "ProjectedShadowFeatureProcessor: Render"); - for (const ProjectedShadowmapsPass* pass : m_projectedShadowmapsPasses) + if (!m_projectedShadowmapsPasses.empty()) { + const ProjectedShadowmapsPass* pass = m_projectedShadowmapsPasses.front(); for (const RPI::ViewPtr& view : packet.m_views) { if (view->GetUsageFlags() & RPI::View::UsageFlags::UsageCamera) @@ -622,7 +623,6 @@ namespace AZ::Render m_filterParamBufferHandler.UpdateSrg(srg); } } - break; } } diff --git a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshDispatchItem.cpp b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshDispatchItem.cpp index cd181f7011..bfc533763e 100644 --- a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshDispatchItem.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshDispatchItem.cpp @@ -205,9 +205,9 @@ namespace AZ if (numThreads) { const auto& args = *numThreads; - arguments.m_threadsPerGroupX = args[0].type() == azrtti_typeid() ? AZStd::any_cast(args[0]) : 1; - arguments.m_threadsPerGroupY = args[1].type() == azrtti_typeid() ? AZStd::any_cast(args[1]) : 1; - arguments.m_threadsPerGroupZ = args[2].type() == azrtti_typeid() ? AZStd::any_cast(args[2]) : 1; + arguments.m_threadsPerGroupX = static_cast(args[0].type() == azrtti_typeid() ? AZStd::any_cast(args[0]) : 1); + arguments.m_threadsPerGroupY = static_cast(args[1].type() == azrtti_typeid() ? AZStd::any_cast(args[1]) : 1); + arguments.m_threadsPerGroupZ = static_cast(args[2].type() == azrtti_typeid() ? AZStd::any_cast(args[2]) : 1); } arguments.m_totalNumberOfThreadsX = xThreads; diff --git a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp index 58c8b3a4a3..4229416066 100644 --- a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp @@ -445,7 +445,7 @@ namespace AZ MorphTargetInstanceMetaData instanceMetaData; // Positions start at the beginning of the allocation - instanceMetaData.m_accumulatedPositionDeltaOffsetInBytes = allocation->GetVirtualAddress().m_ptr; + instanceMetaData.m_accumulatedPositionDeltaOffsetInBytes = static_cast(allocation->GetVirtualAddress().m_ptr); uint32_t deltaStreamSizeInBytes = static_cast(vertexCount * MorphTargetConstants::s_unpackedMorphTargetDeltaSizeInBytes); // Followed by normals, tangents, and bitangents diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Edit/ShaderPlatformInterface.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Edit/ShaderPlatformInterface.h index 5c5898e8d1..b2b16692b5 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Edit/ShaderPlatformInterface.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Edit/ShaderPlatformInterface.h @@ -81,7 +81,7 @@ namespace AZ struct ByProducts { AZStd::set m_intermediatePaths; //!< intermediate file paths (like dxil text form) - static constexpr uint32_t UnknownDynamicBranchCount = -1; + static constexpr uint32_t UnknownDynamicBranchCount = std::numeric_limits::max(); uint32_t m_dynamicBranchCount = UnknownDynamicBranchCount; }; diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/AliasedAttachmentAllocator.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/AliasedAttachmentAllocator.h index 5ccb48bf1c..8527d034d5 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/AliasedAttachmentAllocator.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/AliasedAttachmentAllocator.h @@ -248,7 +248,7 @@ namespace AZ // The no allocation heap is used when doing a 2 pass strategy. Internal::NoAllocationAliasedHeap::Descriptor heapAllocator; heapAllocator.m_alignment = descriptor.m_alignment; - heapAllocator.m_budgetInBytes = ~0; + heapAllocator.m_budgetInBytes = std::numeric_limits::max(); m_noAllocationHeap.Init(device, heapAllocator); typename decltype(m_garbageCollector)::Descriptor collectorDescriptor; diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/ImageProperty.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/ImageProperty.h index 00f329059c..23027083a4 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/ImageProperty.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/ImageProperty.h @@ -183,7 +183,7 @@ namespace AZ else { // Insert intervals by mip level. - for (uint32_t mipLevel = subResourceRange.m_mipSliceMin; mipLevel <= subResourceRange.m_mipSliceMax; ++mipLevel) + for (uint16_t mipLevel = subResourceRange.m_mipSliceMin; mipLevel <= subResourceRange.m_mipSliceMax; ++mipLevel) { m_intervalMap.assign( ConvertSubresourceToIndex(aspect, mipLevel, subResourceRange.m_arraySliceMin), @@ -273,7 +273,7 @@ namespace AZ else { // Traverse one mip level at a time. - for (uint32_t mipLevel = subResourceRange.m_mipSliceMin; mipLevel <= subResourceRange.m_mipSliceMax; ++mipLevel) + for (uint16_t mipLevel = subResourceRange.m_mipSliceMin; mipLevel <= subResourceRange.m_mipSliceMax; ++mipLevel) { getIntervals( ConvertSubresourceToIndex(aspect, mipLevel, subResourceRange.m_arraySliceMin), @@ -332,8 +332,8 @@ namespace AZ { const uint32_t subresourcesPerAspect = m_imageDescriptor.m_mipLevels * m_imageDescriptor.m_arraySize; return ImageSubresource( - (index % subresourcesPerAspect) / m_imageDescriptor.m_arraySize, - (index % subresourcesPerAspect) % m_imageDescriptor.m_arraySize, + static_cast((index % subresourcesPerAspect) / m_imageDescriptor.m_arraySize), + static_cast((index % subresourcesPerAspect) % m_imageDescriptor.m_arraySize), static_cast(index/ subresourcesPerAspect)); } diff --git a/Gems/Atom/RHI/Code/Source/RHI/CpuProfilerImpl.cpp b/Gems/Atom/RHI/Code/Source/RHI/CpuProfilerImpl.cpp index 5585cc7032..6cfd68d3c6 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/CpuProfilerImpl.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/CpuProfilerImpl.cpp @@ -320,7 +320,7 @@ namespace AZ m_cachedTimeRegions.clear(); } - timeRegion.m_stackDepth = m_stackLevel; + timeRegion.m_stackDepth = static_cast(m_stackLevel); AZ_Assert(m_timeRegionStack.size() < TimeRegionStackSize, "Adding too many time regions to the stack. Increase the size of TimeRegionStackSize."); m_timeRegionStack.push_back(&timeRegion); diff --git a/Gems/Atom/RHI/Code/Source/RHI/FrameGraph.cpp b/Gems/Atom/RHI/Code/Source/RHI/FrameGraph.cpp index d2298cda3f..ff6ecb4df5 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/FrameGraph.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/FrameGraph.cpp @@ -497,7 +497,7 @@ namespace AZ for (const uint32_t edgeIndex : graphEdges[producerIndex]) { const GraphEdge& graphEdge = m_graphEdges[edgeIndex]; - const uint16_t consumerIndex = graphEdge.m_consumerIndex; + const uint16_t consumerIndex = static_cast(graphEdge.m_consumerIndex); if (--m_graphNodes[consumerIndex].m_unsortedProducerCount == 0) { NodeId newNode; diff --git a/Gems/Atom/RHI/Code/Source/RHI/Image.cpp b/Gems/Atom/RHI/Code/Source/RHI/Image.cpp index acefcca9e7..e864849a30 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/Image.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/Image.cpp @@ -61,7 +61,7 @@ namespace AZ imageStats->m_bindFlags = descriptor.m_bindFlags; ImageSubresourceRange subresourceRange; - subresourceRange.m_mipSliceMin = GetResidentMipLevel(); + subresourceRange.m_mipSliceMin = static_cast(GetResidentMipLevel()); GetSubresourceLayouts(subresourceRange, nullptr, &imageStats->m_sizeInBytes); } diff --git a/Gems/Atom/RHI/Code/Tests/ImagePropertyTests.cpp b/Gems/Atom/RHI/Code/Tests/ImagePropertyTests.cpp index 60d6bfdf96..d53a9d31e6 100644 --- a/Gems/Atom/RHI/Code/Tests/ImagePropertyTests.cpp +++ b/Gems/Atom/RHI/Code/Tests/ImagePropertyTests.cpp @@ -106,7 +106,7 @@ namespace UnitTest range.m_arraySliceMax -= 1; auto overlapInterval = m_property.Get(range); EXPECT_EQ(overlapInterval.size(), m_imageDescriptor.m_mipLevels); - for (uint32_t i = 0; i < overlapInterval.size(); ++i) + for (uint16_t i = 0; i < overlapInterval.size(); ++i) { RHI::ImageSubresourceRange mipRange = range; mipRange.m_mipSliceMin = i; diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp index 0cc8fd0202..5007b21976 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp @@ -26,7 +26,7 @@ namespace AZ BufferPoolDescriptor::BufferPoolDescriptor() { - m_bufferPoolPageSizeInBytes = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes; + m_bufferPoolPageSizeInBytes = static_cast(RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes); } } } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp index 680669776c..c7b78a3945 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp @@ -203,7 +203,7 @@ namespace AZ RHI::HeapMemoryUsage& heapMemoryUsage = m_memoryUsage.GetHeapMemoryUsage(descriptorBase.m_heapMemoryLevel); - uint32_t bufferPageSize = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes; + uint32_t bufferPageSize = static_cast(RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes); // The DX12 descriptor provides an explicit buffer page size override. if (const DX12::BufferPoolDescriptor* descriptor = azrtti_cast(&descriptorBase)) diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp index 98dc2965fb..823ec8e4e0 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp @@ -353,7 +353,7 @@ namespace AZ if (imageViewDescriptor.m_depthSliceMax == RHI::ImageViewDescriptor::HighestSliceIndex) { - renderTargetView.Texture3D.WSize = -1; + renderTargetView.Texture3D.WSize = std::numeric_limits::max(); } else { @@ -578,7 +578,7 @@ namespace AZ if (imageViewDescriptor.m_depthSliceMax == RHI::ImageViewDescriptor::HighestSliceIndex) { - unorderedAccessView.Texture3D.WSize = -1; + unorderedAccessView.Texture3D.WSize = std::numeric_limits::max(); } else { @@ -1264,7 +1264,7 @@ namespace AZ dst.BlendOpAlpha = ConvertBlendOp(src.m_blendAlphaOp); dst.DestBlend = ConvertBlendFactor(src.m_blendDest); dst.DestBlendAlpha = ConvertBlendFactor(src.m_blendAlphaDest); - dst.RenderTargetWriteMask = ConvertColorWriteMask(src.m_writeMask); + dst.RenderTargetWriteMask = ConvertColorWriteMask(static_cast(src.m_writeMask)); dst.SrcBlend = ConvertBlendFactor(src.m_blendSource); dst.SrcBlendAlpha = ConvertBlendFactor(src.m_blendAlphaSource); dst.LogicOp = D3D12_LOGIC_OP_CLEAR; @@ -1399,8 +1399,8 @@ namespace AZ desc.DepthFunc = ConvertComparisonFunc(depthStencil.m_depth.m_func); desc.DepthWriteMask = ConvertDepthWriteMask(depthStencil.m_depth.m_writeMask); desc.StencilEnable = depthStencil.m_stencil.m_enable; - desc.StencilReadMask = depthStencil.m_stencil.m_readMask; - desc.StencilWriteMask = depthStencil.m_stencil.m_writeMask; + desc.StencilReadMask = static_cast(depthStencil.m_stencil.m_readMask); + desc.StencilWriteMask = static_cast(depthStencil.m_stencil.m_writeMask); return desc; } } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp index 30ed07bd22..371aa20a84 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp @@ -84,8 +84,8 @@ namespace AZ StagingMemoryAllocator::Descriptor allocatorDesc; allocatorDesc.m_device = this; - allocatorDesc.m_mediumPageSizeInBytes = platLimitsDesc->m_platformDefaultValues.m_mediumStagingBufferPageSizeInBytes; - allocatorDesc.m_largePageSizeInBytes = platLimitsDesc->m_platformDefaultValues.m_largestStagingBufferPageSizeInBytes; + allocatorDesc.m_mediumPageSizeInBytes = static_cast(platLimitsDesc->m_platformDefaultValues.m_mediumStagingBufferPageSizeInBytes); + allocatorDesc.m_largePageSizeInBytes = static_cast(platLimitsDesc->m_platformDefaultValues.m_largestStagingBufferPageSizeInBytes); allocatorDesc.m_collectLatency = m_descriptor.m_frameCountMax; m_stagingMemoryAllocator.Init(allocatorDesc); } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLayout.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLayout.cpp index 1336642d8b..3fdeec1c51 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLayout.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLayout.cpp @@ -139,8 +139,8 @@ namespace AZ const RHI::ShaderResourceGroupLayout& groupLayout = *descriptor.GetShaderResourceGroupLayout(groupLayoutIndex); const uint32_t srgLayoutSlot = groupLayout.GetBindingSlot(); - m_slotToIndexTable[srgLayoutSlot] = groupLayoutIndex; - m_indexToSlotTable[groupLayoutIndex] = srgLayoutSlot; + m_slotToIndexTable[srgLayoutSlot] = static_cast(groupLayoutIndex); + m_indexToSlotTable[groupLayoutIndex] = static_cast(srgLayoutSlot); } // Construct a list of indexes sorted by frequency. diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp index c00dcced58..11863cb70b 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp @@ -129,7 +129,7 @@ namespace AZ residentImageDescriptor.m_size = imageDescriptor.m_size.GetReducedMip(residentMipLevel); residentImageDescriptor.m_size.m_width = RHI::AlignUp(residentImageDescriptor.m_size.m_width, alignment); residentImageDescriptor.m_size.m_height = RHI::AlignUp(residentImageDescriptor.m_size.m_height, alignment); - residentImageDescriptor.m_mipLevels = imageDescriptor.m_mipLevels - residentMipLevel; + residentImageDescriptor.m_mipLevels = static_cast(imageDescriptor.m_mipLevels - residentMipLevel); D3D12_RESOURCE_ALLOCATION_INFO allocationInfo; GetDevice().GetImageAllocationInfo(residentImageDescriptor, allocationInfo); diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp index 160dce12d5..c80b04bc73 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp @@ -26,7 +26,7 @@ namespace AZ BufferPoolDescriptor::BufferPoolDescriptor() { - m_bufferPoolPageSizeInBytes = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes; + m_bufferPoolPageSizeInBytes = static_cast(RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes); } } } diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp index 12e14f6134..8f44abccef 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp @@ -173,7 +173,7 @@ namespace AZ auto* image = static_cast(request.m_image); auto& device = static_cast(GetDevice()); - const uint16_t startMip = residentMip - 1; + const uint16_t startMip = static_cast(residentMip - 1); const uint16_t endMip = static_cast(residentMip - request.m_mipSlices.size()); RHI::Ptr uploadFence = Fence::Create(); @@ -277,7 +277,7 @@ namespace AZ copyDescriptor.m_sourceSize.m_depth = 1; copyDescriptor.m_destinationImage = image; copyDescriptor.m_destinationSubresource.m_mipSlice = curMip; - copyDescriptor.m_destinationSubresource.m_arraySlice = arraySlice; + copyDescriptor.m_destinationSubresource.m_arraySlice = static_cast(arraySlice); copyDescriptor.m_destinationOrigin.m_left = 0; copyDescriptor.m_destinationOrigin.m_top = 0; copyDescriptor.m_destinationOrigin.m_front = depth; @@ -309,7 +309,7 @@ namespace AZ copyDescriptor.m_sourceSize.m_depth = 1; copyDescriptor.m_destinationImage = image; copyDescriptor.m_destinationSubresource.m_mipSlice = curMip; - copyDescriptor.m_destinationSubresource.m_arraySlice = arraySlice; + copyDescriptor.m_destinationSubresource.m_arraySlice = static_cast(arraySlice); copyDescriptor.m_destinationOrigin.m_left = 0; copyDescriptor.m_destinationOrigin.m_top = 0; copyDescriptor.m_destinationOrigin.m_front = depth; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp index 9457a765fa..f31132f039 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp @@ -304,7 +304,7 @@ namespace AZ { uint32_t m_familyIndex = InvalidFamilyIndex; bool m_newQueue = false; - uint32_t m_remainingFlags = ~0; + uint32_t m_remainingFlags = std::numeric_limits::max(); bool operator>(const QueueSelection& other) const { diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp index 18ddc0f4df..d5671cff05 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp @@ -257,7 +257,7 @@ namespace AZ state.srcAlphaBlendFactor = ConvertBlendFactor(targetBlendState.m_blendAlphaSource); state.dstAlphaBlendFactor = ConvertBlendFactor(targetBlendState.m_blendAlphaDest); state.alphaBlendOp = ConvertBlendOp(targetBlendState.m_blendAlphaOp); - state.colorWriteMask = ConvertComponentFlags(targetBlendState.m_writeMask); + state.colorWriteMask = ConvertComponentFlags(static_cast(targetBlendState.m_writeMask)); } VkBlendFactor ConvertBlendFactor(const RHI::BlendFactor& blendFactor) diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp index d6cf28e78f..15a532f832 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp @@ -78,7 +78,7 @@ namespace AZ BuildDeviceQueueInfo(physicalDevice); - m_supportedPipelineStageFlagsMask = ~0; + m_supportedPipelineStageFlagsMask = std::numeric_limits::max(); const auto& deviceFeatures = physicalDevice.GetPhysicalDeviceFeatures(); m_enabledDeviceFeatures.samplerAnisotropy = deviceFeatures.samplerAnisotropy; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h index 5a8ed04c11..13ccf9367b 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h @@ -152,7 +152,7 @@ namespace AZ VkDevice m_nativeDevice = VK_NULL_HANDLE; VkPhysicalDeviceFeatures m_enabledDeviceFeatures{}; - VkPipelineStageFlags m_supportedPipelineStageFlagsMask = ~0; + VkPipelineStageFlags m_supportedPipelineStageFlagsMask = std::numeric_limits::max(); AZStd::vector m_queueFamilyProperties; RHI::Ptr m_asyncUploadQueue; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp index d4697cbd32..44c36f5c70 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp @@ -117,8 +117,8 @@ namespace AZ const auto& device = static_cast(GetDevice()); const auto& physicalDevice = static_cast(GetDevice().GetPhysicalDevice()); - const uint16_t width = imgDesc.m_size.m_width; - const uint16_t height = imgDesc.m_size.m_height; + const uint16_t width = static_cast(imgDesc.m_size.m_width); + const uint16_t height = static_cast(imgDesc.m_size.m_height); const uint16_t depth = AZStd::min(static_cast(imgViewDesc.m_depthSliceMax - imgViewDesc.m_depthSliceMin), static_cast(imgDesc.m_size.m_depth - 1)) + 1; const uint16_t samples = imgDesc.m_multisampleState.m_samples; const uint16_t arrayLayers = AZStd::min(static_cast(imgViewDesc.m_arraySliceMax - imgViewDesc.m_arraySliceMin), static_cast(imgDesc.m_arraySize - 1)) + 1; @@ -233,7 +233,7 @@ namespace AZ // https://www.khronos.org/registry/vulkan/specs/1.1/html/chap11.html#VkImageSubresourceRange { range.m_arraySliceMin = descriptor.m_depthSliceMin; - range.m_arraySliceMax = AZStd::GetMin(descriptor.m_depthSliceMax, imageDesc.m_size.m_depth - 1); + range.m_arraySliceMax = AZStd::GetMin(descriptor.m_depthSliceMax, static_cast(imageDesc.m_size.m_depth - 1)); break; } case VK_IMAGE_VIEW_TYPE_3D: diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/MergedShaderResourceGroup.h b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/MergedShaderResourceGroup.h index f285807210..649f9c3b80 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/MergedShaderResourceGroup.h +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/MergedShaderResourceGroup.h @@ -53,7 +53,7 @@ namespace AZ // Helper struct for easy initialization of the frame iteration. struct FrameIteration { - uint64_t m_frameIteration = ~0; + uint64_t m_frameIteration = std::numeric_limits::max(); }; // Utility function that merges multiple ShaderResoruceGroup data into one. diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PipelineLayout.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PipelineLayout.cpp index 5c7a78fd89..f627ddf2cc 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PipelineLayout.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PipelineLayout.cpp @@ -134,7 +134,7 @@ namespace AZ uint32_t bindingSlot = srgLayout->GetBindingSlot(); m_indexToSlot[bindingInfo.m_spaceId].set(bindingSlot); - m_slotToIndex[bindingSlot] = bindingInfo.m_spaceId; + m_slotToIndex[bindingSlot] = static_cast(bindingInfo.m_spaceId); } m_descriptorSetLayouts.reserve(srgCount); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp index 9189c2e177..586470da0a 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp @@ -108,7 +108,7 @@ namespace AZ WaitFinishUploading(image); - const uint16_t residentMipLevelBefore = image.GetResidentMipLevel(); + const uint16_t residentMipLevelBefore = static_cast(image.GetResidentMipLevel()); const uint16_t residentMipLevelAfter = residentMipLevelBefore - static_cast(request.m_mipSlices.size()); const VkMemoryRequirements memoryRequirements = GetMemoryRequirements(image.GetDescriptor(), residentMipLevelAfter); @@ -149,11 +149,11 @@ namespace AZ // Set streamed mip level to target mip level. if (image.GetStreamedMipLevel() < targetMipLevel) { - image.SetStreamedMipLevel(targetMipLevel); + image.SetStreamedMipLevel(static_cast(targetMipLevel)); } const VkMemoryRequirements memoryRequirements = GetMemoryRequirements(image.GetDescriptor(), targetMipLevel); - const uint16_t residentMipLevelBefore = image.GetResidentMipLevel(); + const uint16_t residentMipLevelBefore = static_cast(image.GetResidentMipLevel()); RHI::HeapMemoryUsage& memoryUsage = m_memoryUsage.GetHeapMemoryUsage(RHI::HeapMemoryLevel::Device); const size_t imageSizeBefore = image.GetResidentSizeInBytes(); @@ -203,7 +203,7 @@ namespace AZ residentImageDescriptor.m_size = imageDescriptor.m_size.GetReducedMip(residentMipLevel); residentImageDescriptor.m_size.m_width = RHI::AlignUp(residentImageDescriptor.m_size.m_width, alignment); residentImageDescriptor.m_size.m_height = RHI::AlignUp(residentImageDescriptor.m_size.m_height, alignment); - residentImageDescriptor.m_mipLevels = imageDescriptor.m_mipLevels - residentMipLevel; + residentImageDescriptor.m_mipLevels = imageDescriptor.m_mipLevels - static_cast(residentMipLevel); return device.GetImageMemoryRequirements(imageDescriptor); } diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h index d3c4da27ad..085256f6d8 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h @@ -103,7 +103,7 @@ namespace AZ AZ::TypeId GetStorageDataTypeId() const; //! Returns the value of the enum from its name. If this property is not an enum or the name is undefined, InvalidEnumValue is returned. - static constexpr uint32_t InvalidEnumValue = -1; + static constexpr uint32_t InvalidEnumValue = std::numeric_limits::max(); uint32_t GetEnumValue(const AZ::Name& enumName) const; //! Returns the unique name ID of this property diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Shader/ShaderVariantTreeAsset.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Shader/ShaderVariantTreeAsset.h index e2e5b5c140..e010024fa3 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Shader/ShaderVariantTreeAsset.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Shader/ShaderVariantTreeAsset.h @@ -75,7 +75,7 @@ namespace AZ private: - static constexpr uint32_t UnspecifiedIndex = -1; + static constexpr uint32_t UnspecifiedIndex = std::numeric_limits::max(); //! Returns the node associated with the provided index. const ShaderVariantTreeNode& GetNode(uint32_t index) const; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp index 8e54e5e90f..13e5714b52 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp @@ -1822,7 +1822,7 @@ namespace AZ if (iter != materialAssetsByUid.end()) { ModelMaterialSlot materialSlot; - materialSlot.m_stableId = meshView.m_materialUid; + materialSlot.m_stableId = static_cast(meshView.m_materialUid); materialSlot.m_displayName = iter->second.m_name; materialSlot.m_defaultMaterialAsset = iter->second.m_asset; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImage.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImage.cpp index 45070371d6..8629588ea2 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImage.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImage.cpp @@ -247,7 +247,7 @@ namespace AZ uint16_t StreamingImage::GetResidentMipLevel() { - return m_image->GetResidentMipLevel(); + return static_cast(m_image->GetResidentMipLevel()); } RHI::ResultCode StreamingImage::TrimToMipChainLevel(size_t mipChainIndex) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp index 94421e2ca4..40dce7d138 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp @@ -155,7 +155,7 @@ namespace AZ m_item.m_arguments = RHI::DrawArguments(draw); m_item.m_pipelineState = m_shader->AcquirePipelineState(pipelineStateDescriptor); - m_item.m_stencilRef = m_stencilRef; + m_item.m_stencilRef = static_cast(m_stencilRef); } void FullscreenTrianglePass::FrameBeginInternal(FramePrepareParams params) @@ -179,10 +179,10 @@ namespace AZ RHI::Size targetImageSize = outputAttachment->m_descriptor.m_image.m_size; - m_viewportState.m_maxX = AZStd::min(static_cast(params.m_viewportState.m_maxX), targetImageSize.m_width); - m_viewportState.m_maxY = AZStd::min(static_cast(params.m_viewportState.m_maxY), targetImageSize.m_height); - m_viewportState.m_minX = AZStd::min(params.m_viewportState.m_minX, m_viewportState.m_maxX); - m_viewportState.m_minY = AZStd::min(params.m_viewportState.m_minY, m_viewportState.m_maxY); + m_viewportState.m_maxX = static_cast(AZStd::min(static_cast(params.m_viewportState.m_maxX), targetImageSize.m_width)); + m_viewportState.m_maxY = static_cast(AZStd::min(static_cast(params.m_viewportState.m_maxY), targetImageSize.m_height)); + m_viewportState.m_minX = static_cast(AZStd::min(params.m_viewportState.m_minX, m_viewportState.m_maxX)); + m_viewportState.m_minY = static_cast(AZStd::min(params.m_viewportState.m_minY, m_viewportState.m_maxY)); m_scissorState.m_maxX = AZStd::min(static_cast(params.m_scissorState.m_maxX), targetImageSize.m_width); m_scissorState.m_maxY = AZStd::min(static_cast(params.m_scissorState.m_maxY), targetImageSize.m_height); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelMaterialSlot.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelMaterialSlot.cpp index 0900949625..b9d9200aaf 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelMaterialSlot.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelMaterialSlot.cpp @@ -15,7 +15,7 @@ namespace AZ { // Normally this would be defined in the header file and substituted by the compiler, but for // some reason clang doesn't accept it. - const ModelMaterialSlot::StableId ModelMaterialSlot::InvalidStableId = -1; + const ModelMaterialSlot::StableId ModelMaterialSlot::InvalidStableId = std::numeric_limits::max(); void ModelMaterialSlot::Reflect(AZ::ReflectContext* context) { diff --git a/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp b/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp index 3b113b78f8..f648de6997 100644 --- a/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp @@ -67,7 +67,8 @@ namespace UnitTest bufferData.resize(bufferSize); // The actual data doesn't matter - for (uint32_t i = 0; i < bufferData.size(); ++i) + const uint8_t bufferDataSize = static_cast(bufferData.size()); + for (uint8_t i = 0; i < bufferDataSize; ++i) { bufferData[i] = i; } diff --git a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp index 21f3239698..ff998ad4d3 100644 --- a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp @@ -38,7 +38,8 @@ namespace UnitTest bufferData.resize(bufferSize); //The actual data doesn't matter - for (uint32_t i = 0; i < bufferData.size(); ++i) + const uint8_t bufferDataSize = static_cast(bufferData.size()); + for (uint8_t i = 0; i < bufferDataSize; ++i) { bufferData[i] = i; } diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h index 6edb44bc5c..cb63ff295c 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h @@ -8,9 +8,6 @@ #pragma once -//! Disables "unreferenced formal parameter" warning -#pragma warning(disable : 4100) - #include #include #include @@ -53,10 +50,10 @@ namespace AtomToolsFramework //! Resizes the main window to achieve a requested size for the viewport render target. //! (This indicates the size of the render target, not the desktop-scaled QT widget size). - virtual void ResizeViewportRenderTarget(uint32_t width, uint32_t height) {}; + virtual void ResizeViewportRenderTarget([[maybe_unused]] uint32_t width, [[maybe_unused]] uint32_t height) {}; //! Forces the viewport's render target to use the given resolution, ignoring the size of the viewport widget. - virtual void LockViewportRenderTargetSize(uint32_t width, uint32_t height) {}; + virtual void LockViewportRenderTargetSize([[maybe_unused]] uint32_t width, [[maybe_unused]] uint32_t height) {}; //! Releases the viewport's render target resolution lock, allowing it to match the viewport widget again. virtual void UnlockViewportRenderTargetSize() {}; diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocument.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocument.cpp index e8eb9401d4..336737f419 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocument.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocument.cpp @@ -38,35 +38,35 @@ namespace AtomToolsFramework return m_relativePath; } - const AZStd::any& AtomToolsDocument::GetPropertyValue(const AZ::Name& propertyFullName) const + const AZStd::any& AtomToolsDocument::GetPropertyValue([[maybe_unused]] const AZ::Name& propertyFullName) const { AZ_UNUSED(propertyFullName); AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); return m_invalidValue; } - const AtomToolsFramework::DynamicProperty& AtomToolsDocument::GetProperty(const AZ::Name& propertyFullName) const + const AtomToolsFramework::DynamicProperty& AtomToolsDocument::GetProperty([[maybe_unused]] const AZ::Name& propertyFullName) const { AZ_UNUSED(propertyFullName); AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); return m_invalidProperty; } - bool AtomToolsDocument::IsPropertyGroupVisible(const AZ::Name& propertyGroupFullName) const + bool AtomToolsDocument::IsPropertyGroupVisible([[maybe_unused]] const AZ::Name& propertyGroupFullName) const { AZ_UNUSED(propertyGroupFullName); AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); return false; } - void AtomToolsDocument::SetPropertyValue(const AZ::Name& propertyFullName, const AZStd::any& value) + void AtomToolsDocument::SetPropertyValue([[maybe_unused]] const AZ::Name& propertyFullName, [[maybe_unused]] const AZStd::any& value) { AZ_UNUSED(propertyFullName); AZ_UNUSED(value); AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); } - bool AtomToolsDocument::Open(AZStd::string_view loadPath) + bool AtomToolsDocument::Open([[maybe_unused]] AZStd::string_view loadPath) { AZ_UNUSED(loadPath); AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); @@ -85,7 +85,7 @@ namespace AtomToolsFramework return false; } - bool AtomToolsDocument::SaveAsCopy(AZStd::string_view savePath) + bool AtomToolsDocument::SaveAsCopy([[maybe_unused]] AZStd::string_view savePath) { AZ_UNUSED(savePath); AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); @@ -93,7 +93,7 @@ namespace AtomToolsFramework } - bool AtomToolsDocument::SaveAsChild(AZStd::string_view savePath) + bool AtomToolsDocument::SaveAsChild([[maybe_unused]] AZStd::string_view savePath) { AZ_UNUSED(savePath); AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp index ca938c3745..48f2dc3441 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp @@ -131,7 +131,7 @@ namespace MaterialEditor QSize newDeviceSize = m_materialViewport->size(); AZ_Warning( - "Material Editor", newDeviceSize.width() == width && newDeviceSize.height() == height, + "Material Editor", static_cast(newDeviceSize.width()) == width && static_cast(newDeviceSize.height()) == height, "Resizing the window did not give the expected frame size. Requested %d x %d but got %d x %d.", width, height, newDeviceSize.width(), newDeviceSize.height()); } diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/LightingPresetComboBox.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/LightingPresetComboBox.cpp index c034977aac..e0bb59cb82 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/LightingPresetComboBox.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/LightingPresetComboBox.cpp @@ -61,7 +61,7 @@ namespace MaterialEditor auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset); if (presetItr != m_presets.end()) { - setCurrentIndex(AZStd::distance(m_presets.begin(), presetItr)); + setCurrentIndex(static_cast(AZStd::distance(m_presets.begin(), presetItr))); } } @@ -80,7 +80,7 @@ namespace MaterialEditor auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset); if (presetItr != m_presets.end()) { - setItemText(AZStd::distance(m_presets.begin(), presetItr), preset->m_displayName.c_str()); + setItemText(static_cast(AZStd::distance(m_presets.begin(), presetItr)), preset->m_displayName.c_str()); } else { diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/ModelPresetComboBox.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/ModelPresetComboBox.cpp index 30b88f6f47..1e8bfec485 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/ModelPresetComboBox.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/ModelPresetComboBox.cpp @@ -61,7 +61,7 @@ namespace MaterialEditor auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset); if (presetItr != m_presets.end()) { - setCurrentIndex(AZStd::distance(m_presets.begin(), presetItr)); + setCurrentIndex(static_cast(AZStd::distance(m_presets.begin(), presetItr))); } } @@ -80,7 +80,7 @@ namespace MaterialEditor auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset); if (presetItr != m_presets.end()) { - setItemText(AZStd::distance(m_presets.begin(), presetItr), preset->m_displayName.c_str()); + setItemText(static_cast(AZStd::distance(m_presets.begin(), presetItr)), preset->m_displayName.c_str()); } else { diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl index 9b4eebf043..a225646761 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl @@ -761,7 +761,7 @@ namespace AZ else // We have enough space to draw the entire label, draw and center text. { const float remainingWidth = regionPixelWidth - textWidth; - const float offset = remainingWidth * .5; + const float offset = remainingWidth * .5f; drawList->AddText({ startPoint.x + offset, startPoint.y }, IM_COL32_WHITE, label.c_str()); } diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl index ec7b30cd3e..e6bde136f8 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl @@ -1092,8 +1092,8 @@ namespace AZ AZStd::sort(m_tableRows.begin(), m_tableRows.end(), [ascending](const TableRow& lhs, const TableRow& rhs) { - const float lhsSize = lhs.m_sizeInBytes; - const float rhsSize = rhs.m_sizeInBytes; + const float lhsSize = static_cast(lhs.m_sizeInBytes); + const float rhsSize = static_cast(rhs.m_sizeInBytes); return ascending ? lhsSize < rhsSize : lhsSize > rhsSize; }); break; diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h b/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h index 454a6d4086..58c2a59cbf 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h @@ -130,7 +130,7 @@ namespace AZ template struct StableDynamicArray::Page { - static constexpr size_t InvalidPage = -1; + static constexpr size_t InvalidPage = std::numeric_limits::max(); static constexpr uint64_t FullBits = 0xFFFFFFFFFFFFFFFFull; static constexpr size_t NumUint64_t = ElementsPerPage / 64; diff --git a/Gems/Atom/Utils/Code/Source/ImageComparison.cpp b/Gems/Atom/Utils/Code/Source/ImageComparison.cpp index e226d0b2b4..a17d07ed3f 100644 --- a/Gems/Atom/Utils/Code/Source/ImageComparison.cpp +++ b/Gems/Atom/Utils/Code/Source/ImageComparison.cpp @@ -67,9 +67,9 @@ namespace AZ { // We use the max error from a single channel instead of accumulating the error from each channel. // This normalizes differences so that for example black vs red has the same weight as black vs yellow. - const int16_t diffR = abs(aznumeric_cast(bufferA[i]) - aznumeric_cast(bufferB[i])); - const int16_t diffG = abs(aznumeric_cast(bufferA[i + 1]) - aznumeric_cast(bufferB[i + 1])); - const int16_t diffB = abs(aznumeric_cast(bufferA[i + 2]) - aznumeric_cast(bufferB[i + 2])); + const int16_t diffR = static_cast(abs(aznumeric_cast(bufferA[i]) - aznumeric_cast(bufferB[i]))); + const int16_t diffG = static_cast(abs(aznumeric_cast(bufferA[i + 1]) - aznumeric_cast(bufferB[i + 1]))); + const int16_t diffB = static_cast(abs(aznumeric_cast(bufferA[i + 2]) - aznumeric_cast(bufferB[i + 2]))); const int16_t maxDiff = AZ::GetMax(AZ::GetMax(diffR, diffG), diffB); const float finalDiffNormalized = maxDiff / 255.0f; diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FontTexture.h b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FontTexture.h index b9bdce6810..f20b0463d9 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FontTexture.h +++ b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FontTexture.h @@ -39,7 +39,7 @@ namespace AZ void Reset() { m_slotUsage = 0; - m_currentCharacter = ~0; + m_currentCharacter = std::numeric_limits::max(); m_horizontalAdvance = 0; m_characterWidth = 0; m_characterHeight = 0; diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/GlyphCache.h b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/GlyphCache.h index 8c6cf721b3..271b6810d3 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/GlyphCache.h +++ b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/GlyphCache.h @@ -46,7 +46,7 @@ namespace AZ void Reset() { m_usage = 0; - m_currentCharacter = ~0; + m_currentCharacter = std::numeric_limits::max(); m_characterWidth = 0; m_characterHeight = 0; diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp index 9317cae846..b10edfae2e 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp @@ -1070,7 +1070,7 @@ int AZ::FFont::CreateQuadsForText(const RHI::Viewport& viewport, float x, float uint32_t packedColor = 0xffffffff; { ColorB tempColor = color; - tempColor.a = ((uint32_t) tempColor.a * alphaBlend) >> 8; + tempColor.a = static_cast(((uint32_t) tempColor.a * alphaBlend) >> 8); packedColor = tempColor.pack_argb8888(); //note: this ends up in r,g,b,a order on little-endian machines } @@ -1220,7 +1220,7 @@ void AZ::FFont::WrapText(AZStd::string& result, float maxWidth, const char* str, if (ctx.m_processSpecialChars && ch == '$') { ++pChar; - char nextChar = *pChar; + char nextChar = static_cast(*pChar); if (isdigit(nextChar) || nextChar == 'O' || nextChar == 'o') { @@ -1480,7 +1480,7 @@ bool AZ::FFont::UpdateTexture() return false; } - if (m_fontTexture->GetWidth() != m_fontImage->GetDescriptor().m_size.m_width || m_fontTexture->GetHeight() != m_fontImage->GetDescriptor().m_size.m_height) + if (m_fontTexture->GetWidth() != static_cast(m_fontImage->GetDescriptor().m_size.m_width) || m_fontTexture->GetHeight() != static_cast(m_fontImage->GetDescriptor().m_size.m_height)) { AZ_Assert(false, "AtomFont::FFont:::UpdateTexture size mismatch between texture and image!"); return false; @@ -1516,7 +1516,7 @@ bool AZ::FFont::InitCache() char* p = buf; // precache all [normal] printable characters to the string (missing ones are updated on demand) - for (int i = first; i <= last; ++i) + for (char i = first; i <= last; ++i) { *p++ = i; } diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp index 8c023f9353..053a2eb419 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp @@ -235,12 +235,12 @@ int AZ::FontRenderer::GetGlyph(GlyphBitmap* glyphBitmap, int* horizontalAdvance, if (glyphWidth) { - *glyphWidth = m_glyph->bitmap.width; + *glyphWidth = static_cast(m_glyph->bitmap.width); } if (glyphHeight) { - *glyphHeight = m_glyph->bitmap.rows; + *glyphHeight = static_cast(m_glyph->bitmap.rows); } unsigned char* buffer = glyphBitmap->GetBuffer(); diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontTexture.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontTexture.cpp index 1ee7f80eda..773b19e740 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontTexture.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontTexture.cpp @@ -496,8 +496,8 @@ int AZ::FontTexture::UpdateSlot(int slotIndex, uint16_t slotUsage, uint32_t char return 0; } - slot->m_characterWidth = width; - slot->m_characterHeight = height; + slot->m_characterWidth = static_cast(width); + slot->m_characterHeight = static_cast(height); // Add a pixel along width and height to avoid artifacts being rendered // from a previous glyph in this slot due to bilinear filtering. The source @@ -519,8 +519,8 @@ void AZ::FontTexture::CreateGradientSlot() assert(slot->m_currentCharacter == (uint32_t)~0); // 0 needs to be unused spot slot->Reset(); - slot->m_characterWidth = m_cellWidth - 2; - slot->m_characterHeight = m_cellHeight - 2; + slot->m_characterWidth = static_cast(m_cellWidth - 2); + slot->m_characterHeight = static_cast(m_cellHeight - 2); slot->SetNotReusable(); int x = slot->m_textureSlot % m_widthCellCount; @@ -533,7 +533,7 @@ void AZ::FontTexture::CreateGradientSlot() { for (uint32_t dwX = 0; dwX < slot->m_characterWidth; ++dwX) { - buffer[dwX + dwY * m_width] = dwY * 255 / (slot->m_characterHeight - 1); + buffer[dwX + dwY * m_width] = static_cast(dwY * 255 / (slot->m_characterHeight - 1)); } } } diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/GlyphBitmap.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/GlyphBitmap.cpp index 09bc27783b..395a161b83 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/GlyphBitmap.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/GlyphBitmap.cpp @@ -118,7 +118,7 @@ int AZ::GlyphBitmap::Blur(AZ::FontSmoothAmount smoothAmount) colorSum += m_buffer[yOffset + x]; } - m_buffer[yOffset + x] = colorSum >> 2; + m_buffer[yOffset + x] = static_cast(colorSum >> 2); } } } diff --git a/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp b/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp index 40c4f8e48f..45757c2c6c 100644 --- a/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp +++ b/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp @@ -135,7 +135,7 @@ namespace AZ::Render return; } - m_fpsInterval = AZStd::chrono::seconds(r_fpsCalcInterval); + m_fpsInterval = AZStd::chrono::seconds(static_cast(r_fpsCalcInterval)); UpdateFramerate(); @@ -156,7 +156,7 @@ namespace AZ::Render m_drawParams.m_drawViewportId = viewportContext->GetId(); auto viewportSize = viewportContext->GetViewportSize(); - m_drawParams.m_position = AZ::Vector3(viewportSize.m_width, 0.0f, 1.0f) + AZ::Vector3(r_topRightBorderPadding) * viewportContext->GetDpiScalingFactor(); + m_drawParams.m_position = AZ::Vector3(static_cast(viewportSize.m_width), 0.0f, 1.0f) + AZ::Vector3(r_topRightBorderPadding) * viewportContext->GetDpiScalingFactor(); m_drawParams.m_color = AZ::Colors::White; m_drawParams.m_scale = AZ::Vector2(BaseFontSize); m_drawParams.m_hAlign = AzFramework::TextHorizontalAlignment::Right; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentController.cpp index b90b145320..0a5598a74a 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentController.cpp @@ -535,7 +535,7 @@ namespace AZ::Render void AreaLightComponentController::SetPredictionSampleCount(uint32_t count) { - m_configuration.m_predictionSampleCount = count; + m_configuration.m_predictionSampleCount = static_cast(count); if (m_lightShapeDelegate) { m_lightShapeDelegate->SetPredictionSampleCount(count); @@ -549,7 +549,7 @@ namespace AZ::Render void AreaLightComponentController::SetFilteringSampleCount(uint32_t count) { - m_configuration.m_filteringSampleCount = count; + m_configuration.m_filteringSampleCount = static_cast(count); if (m_lightShapeDelegate) { m_lightShapeDelegate->SetFilteringSampleCount(count); diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentController.cpp index 031d935513..642e50d104 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentController.cpp @@ -259,7 +259,8 @@ namespace AZ void DirectionalLightComponentController::SetCascadeCount(uint32_t cascadeCount) { - const uint16_t cascadeCount16 = cascadeCount = GetMin(Shadow::MaxNumberOfCascades, GetMax(1, aznumeric_cast(cascadeCount))); + const uint16_t cascadeCount16 = GetMin(static_cast(Shadow::MaxNumberOfCascades), GetMax(1, aznumeric_cast(cascadeCount))); + cascadeCount = cascadeCount16; m_configuration.m_cascadeCount = cascadeCount16; if (m_featureProcessor) { diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp index c6e4441d57..91856f7ee5 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp @@ -159,7 +159,7 @@ namespace AZ::Render { if (GetShadowsEnabled() && GetLightHandle().IsValid()) { - GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), count); + GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), static_cast(count)); } } @@ -167,7 +167,7 @@ namespace AZ::Render { if (GetShadowsEnabled() && GetLightHandle().IsValid()) { - GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), count); + GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), static_cast(count)); } } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp index edf08ba8c9..b4728c0c38 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp @@ -104,7 +104,7 @@ namespace AZ::Render { if (GetShadowsEnabled() && GetLightHandle().IsValid()) { - GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), count); + GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), static_cast(count)); } } @@ -112,7 +112,7 @@ namespace AZ::Render { if (GetShadowsEnabled() && GetLightHandle().IsValid()) { - GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), count); + GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), static_cast(count)); } } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentSlot.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentSlot.h index 79fddf2611..58d6fa9ab0 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentSlot.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentSlot.h @@ -19,7 +19,7 @@ namespace AZ { namespace Render { - static const size_t DefaultMaterialSlotIndex = -1; + static const size_t DefaultMaterialSlotIndex = std::numeric_limits::max(); //! Details for a single editable material assignment struct EditorMaterialComponentSlot final diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp index 68276a7320..bb38f932fb 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp @@ -442,7 +442,7 @@ namespace AZ RPI::Cullable::LodOverride MeshComponentController::GetLodOverride() const { - return m_meshFeatureProcessor->GetSortKey(m_meshHandle); + return static_cast(m_meshFeatureProcessor->GetSortKey(m_meshHandle)); } void MeshComponentController::SetVisibility(bool visible) diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp index d5a48b900d..e85c2b92e7 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp @@ -161,7 +161,7 @@ namespace AZ const AZ::Color skeletonColor(0.604f, 0.804f, 0.196f, 1.0f); RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs; lineArgs.m_verts = m_auxVertices.data(); - lineArgs.m_vertCount = aznumeric_caster(m_auxVertices.size()); + lineArgs.m_vertCount = static_cast(m_auxVertices.size()); lineArgs.m_colors = &skeletonColor; lineArgs.m_colorCount = 1; lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off; @@ -202,9 +202,9 @@ namespace AZ RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs; lineArgs.m_verts = m_auxVertices.data(); - lineArgs.m_vertCount = aznumeric_caster(m_auxVertices.size()); + lineArgs.m_vertCount = static_cast(m_auxVertices.size()); lineArgs.m_colors = m_auxColors.data(); - lineArgs.m_colorCount = aznumeric_caster(m_auxColors.size()); + lineArgs.m_colorCount = static_cast(m_auxColors.size()); lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off; auxGeom->DrawLines(lineArgs); } @@ -861,7 +861,7 @@ namespace AZ // Set the weights for any active masks for (size_t i = 0; i < m_wrinkleMaskWeights.size(); ++i) { - wrinkleMaskObjectSrg->SetConstant(wrinkleMaskWeightsIndex, m_wrinkleMaskWeights[i], aznumeric_caster(i)); + wrinkleMaskObjectSrg->SetConstant(wrinkleMaskWeightsIndex, m_wrinkleMaskWeights[i], static_cast(i)); } AZ_Error("AtomActorInstance", m_wrinkleMaskWeights.size() <= s_maxActiveWrinkleMasks, "The skinning shader supports no more than %d active morph targets with wrinkle masks.", s_maxActiveWrinkleMasks); } diff --git a/Gems/AudioSystem/Code/Source/Editor/QConnectionsWidget.cpp b/Gems/AudioSystem/Code/Source/Editor/QConnectionsWidget.cpp index b65e690f1b..cdd7d937e3 100644 --- a/Gems/AudioSystem/Code/Source/Editor/QConnectionsWidget.cpp +++ b/Gems/AudioSystem/Code/Source/Editor/QConnectionsWidget.cpp @@ -138,7 +138,7 @@ namespace AudioControls for (int i = 0; i < size; ++i) { QListWidgetItem* listItem = m_connectionList->item(i); - if (listItem && listItem->data(eMDR_ID).toInt() == middlewareControl->GetId()) + if (listItem && listItem->data(eMDR_ID).toInt() == static_cast(middlewareControl->GetId())) { m_connectionList->clearSelection(); listItem->setSelected(true); diff --git a/Gems/AudioSystem/Code/Tests/AudioSystemTest.cpp b/Gems/AudioSystem/Code/Tests/AudioSystemTest.cpp index 70d9dec330..ba1603d2e2 100644 --- a/Gems/AudioSystem/Code/Tests/AudioSystemTest.cpp +++ b/Gems/AudioSystem/Code/Tests/AudioSystemTest.cpp @@ -589,7 +589,7 @@ TEST(AudioFlagsTest, AudioFlags_OneFlag_OneFlagIsSet) { const AZ::u8 flagBit = 1 << 4; Audio::Flags testFlags(flagBit); - EXPECT_FALSE(testFlags.AreAnyFlagsActive(~flagBit)); + EXPECT_FALSE(testFlags.AreAnyFlagsActive(static_cast(~flagBit))); EXPECT_TRUE(testFlags.AreAnyFlagsActive(flagBit)); EXPECT_TRUE(testFlags.AreAnyFlagsActive(flagBit | 1)); EXPECT_TRUE(testFlags.AreAllFlagsActive(flagBit)); @@ -603,7 +603,7 @@ TEST(AudioFlagsTest, AudioFlags_MultipleFlags_MultipleFlagsAreSet) { const AZ::u8 flagBits = (1 << 5) | (1 << 2) | (1 << 3); Audio::Flags testFlags(flagBits); - EXPECT_FALSE(testFlags.AreAnyFlagsActive(~flagBits)); + EXPECT_FALSE(testFlags.AreAnyFlagsActive(static_cast(~flagBits))); EXPECT_TRUE(testFlags.AreAnyFlagsActive(flagBits)); EXPECT_TRUE(testFlags.AreAllFlagsActive(flagBits)); EXPECT_FALSE(testFlags.AreAllFlagsActive(flagBits | 1)); diff --git a/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp b/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp index 495ef88467..e6d5399561 100644 --- a/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp +++ b/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp @@ -55,11 +55,35 @@ namespace BarrierInput void Eat(int len) { data += len; } void InsertString(const char* str) { int len = static_cast(strlen(str)); memcpy(end, str, len); end += len; } - void InsertU32(int a) { end[0] = a >> 24; end[1] = a >> 16; end[2] = a >> 8; end[3] = a; end += 4; } - void InsertU16(int a) { end[0] = a >> 8; end[1] = a; end += 2; } - void InsertU8(int a) { end[0] = a; end += 1; } + void InsertU32(int a) + { + end[0] = static_cast(a >> 24); + end[1] = static_cast(a >> 16); + end[2] = static_cast(a >> 8); + end[3] = static_cast(a); + end += 4; + } + void InsertU16(int a) + { + end[0] = static_cast(a >> 8); + end[1] = static_cast(a); + end += 2; + } + void InsertU8(int a) + { + end[0] = static_cast(a); + end += 1; + } void OpenPacket() { packet = end; end += 4; } - void ClosePacket() { int len = GetLength() - sizeof(AZ::u32); packet[0] = len >> 24; packet[1] = len >> 16; packet[2] = len >> 8; packet[3] = len; packet = NULL; } + void ClosePacket() + { + int len = GetLength() - sizeof(AZ::u32); + packet[0] = static_cast(len >> 24); + packet[1] = static_cast(len >> 16); + packet[2] = static_cast(len >> 8); + packet[3] = static_cast(len); + packet = nullptr; + } }; enum ArgType @@ -381,7 +405,7 @@ namespace BarrierInput if (AZ::AzSock::IsAzSocketValid(m_socket)) { AZ::AzSock::AzSocketAddress socketAddress; - if (socketAddress.SetAddress(m_serverHostName.c_str(), m_connectionPort)) + if (socketAddress.SetAddress(m_serverHostName.c_str(), static_cast(m_connectionPort))) { const int result = AZ::AzSock::Connect(m_socket, socketAddress); if (!AZ::AzSock::SocketErrorOccured(result)) diff --git a/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp b/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp index 87624b1c8d..7a8d6be020 100644 --- a/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp +++ b/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp @@ -125,7 +125,7 @@ namespace Camera }); if (cameraIt != m_cameraItems.end()) { - int listIndex = cameraIt - m_cameraItems.begin(); + int listIndex = static_cast(cameraIt - m_cameraItems.begin()); beginRemoveRows(QModelIndex(), listIndex, listIndex); m_cameraItems.erase(cameraIt); endRemoveRows(); diff --git a/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp b/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp index f65d98d7da..c4ddb50c53 100644 --- a/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp +++ b/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp @@ -7,16 +7,11 @@ */ #include +#include #include #include -#include -#include -#include - -#pragma warning(disable : 4996) - namespace O3de { @@ -24,21 +19,26 @@ namespace O3de { if (!m_noConfirmation) { +#if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS + char noConfirmation[64]{}; + size_t variableSize = 0; + getenv_s(&variableSize, noConfirmation, AZ_ARRAY_SIZE(noConfirmation), "LY_NO_CONFIRM"); + if (variableSize == 0) +#else const char* noConfirmation = getenv("LY_NO_CONFIRM"); if (noConfirmation == nullptr) +#endif + { - - std::wstring sendDialogMessage; - - std::wstring_convert> converter; - sendDialogMessage = converter.from_bytes(m_executableName); + AZStd::wstring sendDialogMessage; + AZStd::to_wstring(sendDialogMessage, m_executableName.c_str()); sendDialogMessage += L" has encountered a fatal error. We're sorry for the inconvenience.\n\nA crash debugging file has been created at:\n"; - sendDialogMessage += report.file_path.value(); + sendDialogMessage += report.file_path.value().c_str(); sendDialogMessage += L"\n\nIf you are willing to submit this file to Amazon it will help us improve the Lumberyard experience. We will treat this report as confidential.\n\nWould you like to send the error report?"; int msgboxID = MessageBoxW( - NULL, + nullptr, sendDialogMessage.data(), L"Send Error Report", (MB_ICONEXCLAMATION | MB_YESNO | MB_SYSTEMMODAL) diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp index 5a8fcda907..5a4ca95670 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp @@ -1115,7 +1115,7 @@ namespace EMotionFX void ActorInstance::EnableAllNodes() { m_enabledNodes.resize(m_actor->GetNumNodes()); - std::iota(m_enabledNodes.begin(), m_enabledNodes.end(), 0); + std::iota(m_enabledNodes.begin(), m_enabledNodes.end(), uint16(0)); } // disable all nodes diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.h index 042799192d..2d83d21d0d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.h @@ -28,12 +28,12 @@ namespace EMotionFX AZ_CLASS_ALLOCATOR_DECL // - enum + enum : uint16 { OUTPUTPORT_RESULT = 0 }; - enum + enum : uint16 { PORTID_OUTPUT_POSE = 0 }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h index a07bbc625c..692b81b70e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h @@ -32,7 +32,7 @@ namespace EMotionFX AZ_RTTI(AnimGraphMotionNode, "{B8B8AAE6-E532-4BF8-898F-3D40AA41BC82}", AnimGraphNode) AZ_CLASS_ALLOCATOR_DECL - enum + enum : uint16 { INPUTPORT_PLAYSPEED = 0, INPUTPORT_INPLACE = 1, @@ -41,7 +41,7 @@ namespace EMotionFX OUTPUTPORT_MOTION = 1 }; - enum + enum : uint16 { PORTID_INPUT_PLAYSPEED = 0, PORTID_INPUT_INPLACE = 1, diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h index 9a9b51b5d1..991fb03472 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h @@ -26,7 +26,7 @@ namespace EMotionFX using WeightedMaskEntry = AZStd::pair; - enum + enum : uint16 { INPUTPORT_POSE_A = 0, INPUTPORT_POSE_B = 1, @@ -34,7 +34,7 @@ namespace EMotionFX OUTPUTPORT_POSE = 0 }; - enum + enum : uint16 { PORTID_INPUT_POSE_A = 0, PORTID_INPUT_POSE_B = 1, diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h index 72d6ad120c..4f4b8a7ac3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h @@ -49,7 +49,7 @@ namespace EMotionFX AZ_RTTI(BlendTreeBlendNNode, "{CBFFDE41-008D-45A1-AC2A-E9A25C8CE62A}", AnimGraphNode) AZ_CLASS_ALLOCATOR_DECL - enum + enum : uint16 { INPUTPORT_POSE_0 = 0, INPUTPORT_POSE_1 = 1, @@ -65,7 +65,7 @@ namespace EMotionFX OUTPUTPORT_POSE = 0 }; - enum + enum : uint16 { PORTID_INPUT_POSE_0 = 0, PORTID_INPUT_POSE_1 = 1, diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.h index 756f6a4bab..fc922934ed 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.h @@ -26,7 +26,7 @@ namespace EMotionFX AZ_CLASS_ALLOCATOR_DECL // - enum + enum : uint16 { INPUTPORT_X = 0, INPUTPORT_Y = 1, @@ -34,7 +34,7 @@ namespace EMotionFX OUTPUTPORT_BOOL = 1 }; - enum + enum : uint16 { PORTID_INPUT_X = 0, PORTID_INPUT_Y = 1, diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h index e39cd7258e..29b497457e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h @@ -27,7 +27,7 @@ namespace EMotionFX AZ_RTTI(BlendTreeTwoLinkIKNode, "{0C3E8B7F-F810-47A6-B1A9-27BD4E4B5500}", AnimGraphNode) AZ_CLASS_ALLOCATOR_DECL - enum + enum : uint16 { INPUTPORT_POSE = 0, INPUTPORT_GOALPOS = 1, @@ -37,7 +37,7 @@ namespace EMotionFX OUTPUTPORT_POSE = 0 }; - enum + enum : uint16 { PORTID_INPUT_POSE = 0, PORTID_INPUT_GOALPOS = 1, diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h index c2d776bcdb..ebd65f833a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h @@ -64,7 +64,7 @@ namespace EMotionFX * VertexAttributeLayerAbstractData::GetType() values for the vertex data * Use these with the Mesh::FindVertexData() and Mesh::FindOriginalVertexData() methods. */ - enum + enum : uint32 { ATTRIB_POSITIONS = 0, /**< Vertex positions. Typecast to AZ::Vector3. Positions are always exist. */ ATTRIB_NORMALS = 1, /**< Vertex normals. Typecast to AZ::Vector3. Normals are always exist. */ diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp index d84bbebbc6..728ceb059b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp @@ -114,7 +114,7 @@ namespace EMStudio } // Set the current history index in case the user called undo. - m_list->setCurrentRow(commandManager->GetHistoryIndex()); + m_list->setCurrentRow(static_cast(commandManager->GetHistoryIndex())); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.cpp index 6e68a761de..a6733ee614 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.cpp @@ -562,9 +562,9 @@ namespace EMStudio ModelItemData modelItemData(graphInstance, animGraphObject); AZStd::pair itModelItemData = m_modelItemDataSet.equal_range(&modelItemData); - for (ModelItemDataSet::const_iterator it = itModelItemData.first; it != itModelItemData.second; ++it) + if (itModelItemData.first != itModelItemData.second) { - ModelItemData* modelItemData2 = *it; + ModelItemData* modelItemData2 = *itModelItemData.first; return createIndex(modelItemData2->m_row, 0, modelItemData2); } return QModelIndex(); @@ -590,9 +590,9 @@ namespace EMStudio // Find the model index ModelItemData modelItemData(animGraphInstance, animGraphObject); AZStd::pair itModelItemData = m_modelItemDataSet.equal_range(&modelItemData); - for (ModelItemDataSet::const_iterator it = itModelItemData.first; it != itModelItemData.second; ++it) + if (itModelItemData.first != itModelItemData.second) { - ModelItemData* modelItemData2 = *it; + ModelItemData* modelItemData2 = *itModelItemData.first; return createIndex(modelItemData2->m_row, 0, modelItemData2); } } @@ -603,9 +603,9 @@ namespace EMStudio // Find the model index ModelItemData modelItemData(nullptr, animGraphObject); AZStd::pair itModelItemData = m_modelItemDataSet.equal_range(&modelItemData); - for (ModelItemDataSet::const_iterator it = itModelItemData.first; it != itModelItemData.second; ++it) + if (itModelItemData.first != itModelItemData.second) { - ModelItemData* modelItemData2 = *it; + ModelItemData* modelItemData2 = *itModelItemData.first; return createIndex(modelItemData2->m_row, 0, modelItemData2); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp index c17ff12947..6434799773 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp @@ -1176,7 +1176,7 @@ namespace EMStudio } else { - settingsInfo->m_axis = elementID; + settingsInfo->m_axis = static_cast(elementID); } } else @@ -1188,7 +1188,7 @@ namespace EMStudio } else { - settingsInfo->m_axis = value - 1; + settingsInfo->m_axis = static_cast(value - 1); } } #else @@ -1619,7 +1619,7 @@ namespace EMStudio const uint32 numButtons = m_gameController->GetNumButtons(); for (uint32 i = 0; i < numButtons; ++i) { - const bool isPressed = m_gameController->GetIsButtonPressed(i); + const bool isPressed = m_gameController->GetIsButtonPressed(static_cast(i)); // get the game controller settings info for the given button EMotionFX::AnimGraphGameControllerSettings::ButtonInfo* settingsInfo = activePreset->FindButtonInfo(i); @@ -1792,7 +1792,7 @@ namespace EMStudio m_string.clear(); for (uint32 i = 0; i < numButtons; ++i) { - if (m_gameController->GetIsButtonPressed(i)) + if (m_gameController->GetIsButtonPressed(static_cast(i))) { m_string += AZStd::string::format("%s%d ", (i < 10) ? "0" : "", i); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeGroupInfo.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeGroupInfo.cpp index f25158ae0d..06b87c2bc2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeGroupInfo.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeGroupInfo.cpp @@ -26,7 +26,7 @@ namespace EMStudio const size_t numGroupNodes = nodeGroup->GetNumNodes(); for (size_t j = 0; j < numGroupNodes; ++j) { - const uint16 nodeIndex = nodeGroup->GetNode(j); + const uint16 nodeIndex = nodeGroup->GetNode(static_cast(j)); const EMotionFX::Node* node = actor->GetSkeleton()->GetNode(nodeIndex); m_nodes.emplace_back(node->GetNameString()); } diff --git a/Gems/EMotionFX/Code/Include/Integration/ActorComponentBus.h b/Gems/EMotionFX/Code/Include/Integration/ActorComponentBus.h index c6b18745e6..658f15786f 100644 --- a/Gems/EMotionFX/Code/Include/Integration/ActorComponentBus.h +++ b/Gems/EMotionFX/Code/Include/Integration/ActorComponentBus.h @@ -95,7 +95,7 @@ namespace EMotionFX /// Returns skinning method used by the actor. virtual SkinningMethod GetSkinningMethod() const = 0; - static const size_t s_invalidJointIndex = ~0; + static const size_t s_invalidJointIndex = std::numeric_limits::max(); }; using ActorComponentRequestBus = AZ::EBus; diff --git a/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp b/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp index 5cdd9c2600..b59f2b69a0 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp @@ -1123,7 +1123,7 @@ namespace MCore for (size_t i = 0; i < numHistoryEntries; ++i) { AZStd::string text = AZStd::string::format("%.3zu: name='%s', num parameters=%zu", i, m_commandHistory[i].m_executedCommand->GetName(), m_commandHistory[i].m_parameters.GetNumParameters()); - if (i == m_historyIndex) + if (i == static_cast(m_historyIndex)) { LogDetailedInfo("-> %s", text.c_str()); } diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.h b/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.h index ac35a6dfcd..6a920fa10d 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.h +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.h @@ -28,7 +28,7 @@ namespace EMotionFX Q_OBJECT //AUTOMOC public: - enum + enum : uint32 { CLASS_ID = 0x8efd2bee }; diff --git a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/MotionSetMotionIdHandler.h b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/MotionSetMotionIdHandler.h index f5ef1ffed5..6ea49bf9ef 100644 --- a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/MotionSetMotionIdHandler.h +++ b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/MotionSetMotionIdHandler.h @@ -59,7 +59,7 @@ namespace EMotionFX static void ResetDisplayedRoundingError(); private: - size_t m_id = -1; + size_t m_id = std::numeric_limits::max(); bool m_displayMotionSelectionWeight = false; const IRandomMotionSelectionDataContainer* m_dataContainer = nullptr; static float s_displayedRoundingError; diff --git a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/PropertyTypes.cpp b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/PropertyTypes.cpp index e8c4ee69d8..a93ec07477 100644 --- a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/PropertyTypes.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/PropertyTypes.cpp @@ -89,8 +89,9 @@ namespace EMotionFX AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Broadcast(&AzToolsFramework::PropertyTypeRegistrationMessages::RegisterPropertyType, handler); } return propertyHandlers; -#endif +#else return AZStd::vector {}; +#endif } diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp index aa1bde295a..0449005659 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp @@ -36,7 +36,7 @@ namespace EMotionFX m_blendTree->AddChildNode(paramNode); paramNode->InitAfterLoading(m_animGraph.get()); paramNode->InvalidateUniqueData(m_animGraphInstance); - m_blend2Node->AddConnection(paramNode, paramNode->FindOutputPortByName("weightParam")->m_portId, BlendTreeBlend2Node::PORTID_INPUT_WEIGHT); + m_blend2Node->AddConnection(paramNode, static_cast(paramNode->FindOutputPortByName("weightParam")->m_portId), BlendTreeBlend2Node::PORTID_INPUT_WEIGHT); } void ConstructGraph() @@ -126,8 +126,8 @@ namespace EMotionFX blendNNode->SetName(blendNNodeName); blendTree->AddChildNode(blendNNode); - const int motionNodeCount = 5; - for (AZ::u32 i = 0; i < motionNodeCount; ++i) + const uint16 motionNodeCount = 5; + for (uint16 i = 0; i < motionNodeCount; ++i) { AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); motionNode->SetName(AZStd::string::format("Motion %i (%s)", i, blendNNodeName).c_str()); @@ -172,7 +172,7 @@ namespace EMotionFX finalNode->AddConnection(blendNNode, BlendTreeBlendNNode::PORTID_OUTPUT_POSE, BlendTreeFinalNode::PORTID_INPUT_POSE); // Creates 5x blend N nodes as input for the blend N node created here. Each of these five blend N nodes have 5x input motions. - for (AZ::u32 i = 0; i < 5; ++i) + for (uint16 i = 0; i < 5; ++i) { BlendTreeBlendNNode* inputNode = CreateBlendNNode(testBlendTree, parameterNode, AZStd::string::format("InputBlendNode%i", i).c_str()); blendNNode->AddConnection(inputNode, AnimGraphMotionNode::PORTID_OUTPUT_POSE, i); diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp index 121f438d82..a377495d6c 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp @@ -303,7 +303,7 @@ namespace EMotionFX TEST_F(AnimGraphMotionNodeFixture, InPlaceInputAndNoEffectOutputsCorrectMotionAndPose) { - m_motionNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("InPlace")->m_portId, AnimGraphMotionNode::INPUTPORT_INPLACE); + m_motionNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("InPlace")->m_portId), AnimGraphMotionNode::INPUTPORT_INPLACE); ParamSetValue("InPlace", true); m_animGraphInstance->FindOrCreateUniqueNodeData(m_motionNode); diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp index 1f700129c0..39fc296d9f 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp @@ -165,7 +165,7 @@ namespace EMotionFX for (const auto& activeObjects : activeObjectsAtFrame) { - if (activeObjects.m_frameNr == frame) + if (activeObjects.m_frameNr == static_cast(frame)) { // Check which states and transitions are active and compare it to the expected ones. EXPECT_EQ(activeObjects.m_stateA, compareAgainst.m_stateA) diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp index 1f9fb9cae3..1f5fb9a512 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp @@ -51,8 +51,8 @@ namespace EMotionFX m_blendTree->AddChildNode(finalNode); finalNode->AddConnection(m_blendNNode, BlendTreeBlendNNode::PORTID_OUTPUT_POSE, BlendTreeFinalNode::PORTID_INPUT_POSE); - const int motionNodeCount = 3; - for (int i = 0; i < motionNodeCount; ++i) + const uint16 motionNodeCount = 3; + for (uint16 i = 0; i < motionNodeCount; ++i) { AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); m_blendTree->AddChildNode(motionNode); @@ -213,7 +213,7 @@ namespace EMotionFX finalNode->AddConnection(m_blendNNode, BlendTreeBlendNNode::PORTID_OUTPUT_POSE, BlendTreeFinalNode::PORTID_INPUT_POSE); ASSERT_TRUE(param.m_motionNodeCount <= 10) << "The blend N node only has 10 pose inputs."; - for (AZ::u32 i = 0; i < param.m_motionNodeCount; ++i) + for (uint16 i = 0; i < param.m_motionNodeCount; ++i) { AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); m_blendTree->AddChildNode(motionNode); diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp index 3ece046845..f4b11a3f8a 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp @@ -98,7 +98,7 @@ namespace EMotionFX void TestInput(const AZStd::string& paramName, std::vector xInputs) { BlendTreeConnection* connection = m_floatMath1Node->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName(paramName)->m_portId, BlendTreeFloatMath1Node::PORTID_INPUT_X); + static_cast(m_paramNode->FindOutputPortByName(paramName)->m_portId), BlendTreeFloatMath1Node::PORTID_INPUT_X); for (inputType i : xInputs) { diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp index b86041c7aa..8bd66ced88 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp @@ -173,7 +173,7 @@ namespace EMotionFX m_blendTree->AddChildNode(m_basePoseNode); m_maskNode->AddConnection(m_basePoseNode, BlendTreeTestInputNode::OUTPUTPORT_RESULT, BlendTreeMaskNode::INPUTPORT_BASEPOSE); - for (AZ::u32 i = 0; i < m_numMaskInputNodes; ++i) + for (uint16 i = 0; i < m_numMaskInputNodes; ++i) { BlendTreeTestInputNode* inputNode = aznew BlendTreeTestInputNode(static_cast(i)); m_blendTree->AddChildNode(inputNode); diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp index d68bf9db83..eab445ddfe 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp @@ -137,9 +137,9 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, ReachablePositionsOutputCorrectPose) { // Set values for vector3 and twoLinkIKNode weight parameter - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); GetEMotionFX().Update(1.0f / 60.0f); const float weight = testing::get<0>(GetParam()); @@ -179,7 +179,7 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, ReachableAlignToNodeOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); GetEMotionFX().Update(1.0f / 60.0f); @@ -224,10 +224,10 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, UnreachablePositionsOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); GetEMotionFX().Update(1.0f / 60.0f); const float weight = testing::get<0>(GetParam()); @@ -272,12 +272,12 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, RotatedPositionsOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("RotationParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); + static_cast(m_paramNode->FindOutputPortByName("RotationParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); m_twoLinkIKNode->SetRotationEnabled(true); GetEMotionFX().Update(1.0f / 60.0f); @@ -315,12 +315,12 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, BendDirectionOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("BendDirParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); + static_cast(m_paramNode->FindOutputPortByName("BendDirParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); m_twoLinkIKNode->SetRelativeBendDir(true); GetEMotionFX().Update(1.0f / 60.0f); @@ -382,14 +382,14 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, CombinedFunctionsOutputCorrectPose) { // Two Link IK Node should not break when using all of its functions at the same time - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("RotationParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); + static_cast(m_paramNode->FindOutputPortByName("RotationParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("BendDirParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); + static_cast(m_paramNode->FindOutputPortByName("BendDirParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); m_twoLinkIKNode->SetRotationEnabled(true); m_twoLinkIKNode->SetRelativeBendDir(true); GetEMotionFX().Update(1.0f / 60.0f); diff --git a/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp index 6214005a71..dbf9f18e9e 100644 --- a/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp @@ -53,8 +53,8 @@ namespace EMotionFX m_blendTree->AddChildNode(finalNode); finalNode->AddConnection(m_blendNNode, BlendTreeBlendNNode::PORTID_OUTPUT_POSE, BlendTreeFinalNode::PORTID_INPUT_POSE); - const int motionNodeCount = 2; - for (int i = 0; i < motionNodeCount; ++i) + const uint16 motionNodeCount = 2; + for (uint16 i = 0; i < motionNodeCount; ++i) { AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); m_blendTree->AddChildNode(motionNode); diff --git a/Gems/EMotionFX/Code/Tests/Vector2ToVector3CompatibilityTests.cpp b/Gems/EMotionFX/Code/Tests/Vector2ToVector3CompatibilityTests.cpp index 26702af550..d5ce41cfeb 100644 --- a/Gems/EMotionFX/Code/Tests/Vector2ToVector3CompatibilityTests.cpp +++ b/Gems/EMotionFX/Code/Tests/Vector2ToVector3CompatibilityTests.cpp @@ -46,8 +46,8 @@ namespace EMotionFX m_blendTree->AddChildNode(finalNode); finalNode->AddUnitializedConnection(m_blendNNode, BlendTreeBlendNNode::PORTID_OUTPUT_POSE, BlendTreeFinalNode::PORTID_INPUT_POSE); - const int motionNodeCount = 3; - for (int i = 0; i < motionNodeCount; ++i) + const uint16 motionNodeCount = 3; + for (uint16 i = 0; i < motionNodeCount; ++i) { AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); m_blendTree->AddChildNode(motionNode); diff --git a/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp b/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp index d1b59e7ecc..af21420b62 100644 --- a/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp +++ b/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp @@ -795,7 +795,7 @@ namespace EditorPythonBindings } } - AZ_Warning("python", PyDict_Size(pyObj.ptr()) == mapDataContainer->Size(mapInstance.m_address), "Python Dict size:%d does not match the size of the unordered_map:%d", pos, mapDataContainer->Size(mapInstance.m_address)); + AZ_Warning("python", static_cast(PyDict_Size(pyObj.ptr())) == mapDataContainer->Size(mapInstance.m_address), "Python Dict size:%d does not match the size of the unordered_map:%d", pos, mapDataContainer->Size(mapInstance.m_address)); outValue.m_value = mapInstance.m_address; outValue.m_typeId = mapInstance.m_typeId; outValue.m_traits = traits; diff --git a/Gems/EditorPythonBindings/Code/Tests/PythonDictionaryTests.cpp b/Gems/EditorPythonBindings/Code/Tests/PythonDictionaryTests.cpp index 8f6abd5a17..24689bbfe3 100644 --- a/Gems/EditorPythonBindings/Code/Tests/PythonDictionaryTests.cpp +++ b/Gems/EditorPythonBindings/Code/Tests/PythonDictionaryTests.cpp @@ -52,8 +52,8 @@ namespace UnitTest } }; - MapOf m_indexOfu8tou32 { {1, 4}, {2, 5}, {3, 6}, {4, 7} }; - MapOf m_indexOfu16toFloat { {1, 0.4f}, {2, 0.5f}, {3, 0.6f}, {4, 0.7f} }; + MapOf m_indexOfu8tou32 { {AZ::u8(1), 4u}, {AZ::u8(2), 5u}, {AZ::u8(3), 6u}, {AZ::u8(4), 7u} }; + MapOf m_indexOfu16toFloat { {AZ::u16(1u), 0.4f}, {AZ::u16(2u), 0.5f}, {AZ::u16(3u), 0.6f}, {AZ::u16(4u), 0.7f} }; MapOf m_indexOfStringTos32 { {"1", -4}, {"2", 5}, {"3", -6}, {"4", 7} }; MapOf m_indexOfStringToString { {"hello", "foo"}, {"world", "bar"}, {"bye", "baz"}, {"sky", "qux"} }; MapOf m_indexOfStringToVec3{ {"up", AZ::Vector3{ 0, 1.0, 0 }}, {"down", AZ::Vector3{0, -1.0, 0}}, diff --git a/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp b/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp index 51980ca08a..de073fe600 100644 --- a/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp +++ b/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp @@ -202,13 +202,13 @@ void FastNoise::SetSeed(int seed) std::mt19937_64 gen(seed); for (int i = 0; i < 256; i++) - m_perm[i] = i; + m_perm[i] = static_cast(i); for (int j = 0; j < 256; j++) { int rng = (int)(gen() % (256 - j)); int k = rng + j; - int l = m_perm[j]; + unsigned char l = m_perm[j]; m_perm[j] = m_perm[j + 256] = m_perm[k]; m_perm[k] = l; m_perm12[j] = m_perm12[j + 256] = m_perm[j] % 12; diff --git a/Gems/GradientSignal/Code/Tests/GradientSignalImageTests.cpp b/Gems/GradientSignal/Code/Tests/GradientSignalImageTests.cpp index ea9a1d380f..4c22afac76 100644 --- a/Gems/GradientSignal/Code/Tests/GradientSignalImageTests.cpp +++ b/Gems/GradientSignal/Code/Tests/GradientSignalImageTests.cpp @@ -145,7 +145,7 @@ namespace UnitTest { for (AZ::u32 x = 0; x < width; ++x) { - if ((x == pixelX) && (y == pixelY)) + if ((x == static_cast(pixelX)) && (y == static_cast(pixelY))) { m_imageData->m_imageData.push_back(pixelValue); } diff --git a/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp b/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp index fa265ad644..c317e8044a 100644 --- a/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp +++ b/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp @@ -2493,18 +2493,18 @@ namespace GraphCanvas { if (growOnly) { - int left = blockBoundingRect.left(); + int left = static_cast(blockBoundingRect.left()); if (left >= calculatedBounds.left()) { - left = calculatedBounds.left() - gridStep.GetX(); + left = static_cast(calculatedBounds.left() - gridStep.GetX()); } - int right = blockBoundingRect.right(); + int right = static_cast(blockBoundingRect.right()); if (right <= calculatedBounds.right()) { - right = calculatedBounds.right() + gridStep.GetX(); + right = static_cast(calculatedBounds.right() + gridStep.GetX()); } blockBoundingRect.setX(left); @@ -2521,18 +2521,18 @@ namespace GraphCanvas { if (growOnly) { - int top = blockBoundingRect.top(); + int top = static_cast(blockBoundingRect.top()); if (top >= calculatedBounds.top()) { - top = calculatedBounds.top() - gridStep.GetY(); + top = static_cast(calculatedBounds.top() - gridStep.GetY()); } - int bottom = blockBoundingRect.bottom(); + int bottom = static_cast(blockBoundingRect.bottom()); if (bottom <= calculatedBounds.bottom()) { - bottom = calculatedBounds.bottom() + gridStep.GetY(); + bottom = static_cast(calculatedBounds.bottom() + gridStep.GetY()); } blockBoundingRect.setY(top); diff --git a/Gems/GraphCanvas/Code/Source/Widgets/GraphCanvasLabel.cpp b/Gems/GraphCanvas/Code/Source/Widgets/GraphCanvasLabel.cpp index fd7ac05cd2..e76487a4e8 100644 --- a/Gems/GraphCanvas/Code/Source/Widgets/GraphCanvasLabel.cpp +++ b/Gems/GraphCanvas/Code/Source/Widgets/GraphCanvasLabel.cpp @@ -432,7 +432,5 @@ namespace GraphCanvas default: return QGraphicsWidget::sizeHint(which, constraint); } - - return QGraphicsWidget::sizeHint(which, constraint); } } diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Components/Nodes/Wrapper/WrapperNodeBus.h b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Components/Nodes/Wrapper/WrapperNodeBus.h index a30915917f..0d45cbe536 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Components/Nodes/Wrapper/WrapperNodeBus.h +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Components/Nodes/Wrapper/WrapperNodeBus.h @@ -34,14 +34,14 @@ namespace GraphCanvas AZ_CLASS_ALLOCATOR(WrappedNodeConfiguration, AZ::SystemAllocator, 0); WrappedNodeConfiguration() - : m_layoutOrder(-1) - , m_elementOrdering(-1) + : m_layoutOrder(std::numeric_limits::max()) + , m_elementOrdering(std::numeric_limits::max()) { } WrappedNodeConfiguration(AZ::u32 layoutOrder) : m_layoutOrder(layoutOrder) - , m_elementOrdering(-1) + , m_elementOrdering(std::numeric_limits::max()) { } diff --git a/Gems/GraphModel/Code/Include/GraphModel/Model/Common.h b/Gems/GraphModel/Code/Include/GraphModel/Model/Common.h index 17ce8e8471..ec5901a4b5 100644 --- a/Gems/GraphModel/Code/Include/GraphModel/Model/Common.h +++ b/Gems/GraphModel/Code/Include/GraphModel/Model/Common.h @@ -66,6 +66,6 @@ namespace GraphModel using ModuleGraphManagerPtr = AZStd::shared_ptr; using ConstModuleGraphManagerPtr = AZStd::shared_ptr; - static const AZ::u32 DefaultWrappedNodeLayoutOrder = -1; + static const AZ::u32 DefaultWrappedNodeLayoutOrder = std::numeric_limits::max(); } // namespace GraphModel diff --git a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp index 8e0e23652c..7f4877347f 100644 --- a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp +++ b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp @@ -770,8 +770,8 @@ namespace ImGui { AZStd::string name1 = com1->RTTI_GetTypeName(); AZStd::string name2 = com2->RTTI_GetTypeName(); - AZStd::transform(name1.begin(), name1.end(), name1.begin(), ::tolower); - AZStd::transform(name2.begin(), name2.end(), name2.begin(), ::tolower); + AZStd::to_lower(name1.begin(), name1.end()); + AZStd::to_lower(name2.begin(), name2.end()); return name1 < name2; }; AZStd::sort(components.begin(), components.end(), sortByComponentName); @@ -1017,8 +1017,8 @@ namespace ImGui AZStd::string name1, name2; AZ::ComponentApplicationBus::BroadcastResult(name1, &AZ::ComponentApplicationBus::Events::GetEntityName, ent1->m_entityId); AZ::ComponentApplicationBus::BroadcastResult(name2, &AZ::ComponentApplicationBus::Events::GetEntityName, ent2->m_entityId); - AZStd::transform(name1.begin(), name1.end(), name1.begin(), ::tolower); - AZStd::transform(name2.begin(), name2.end(), name2.begin(), ::tolower); + AZStd::to_lower(name1.begin(), name1.end()); + AZStd::to_lower(name2.begin(), name2.end()); return name1 < name2; }; AZStd::sort(entityInfo->m_children.begin(), entityInfo->m_children.end(), sortByEntityName); diff --git a/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.cpp b/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.cpp index 4140cff935..3f9ba6e813 100644 --- a/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.cpp +++ b/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.cpp @@ -20,9 +20,9 @@ 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(static_cast(c2.red() - c1.red()) * fraction + c1.red()); + const int g = static_cast(static_cast(c2.green() - c1.green()) * fraction + c1.green()); + const int b = static_cast(static_cast(c2.blue() - c1.blue()) * fraction + c1.blue()); return QColor(r, g, b); } @@ -114,7 +114,7 @@ float TimelineWidget::SnapTime(float time) { double t = floor((double)time * m_ticksStep + 0.5); t = t / m_ticksStep; - return t; + return static_cast(t); } ////////////////////////////////////////////////////////////////////////// @@ -147,10 +147,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 + 4, rc.bottom()))); + painter->drawRect(QRect(QPoint(x - 3, static_cast(rc.top())), QPoint(x + 4, static_cast(rc.bottom())))); painter->setPen(redpen); - painter->drawLine(x, rc.top(), x, rc.bottom()); + painter->drawLine(x, static_cast(rc.top()), x, static_cast(rc.bottom())); painter->setBrush(Qt::NoBrush); // Draw vertical line showing current time. @@ -184,7 +184,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 - 2, rc.top()), QPoint(x2 + 3, rc.bottom()))); + painter->drawRect(QRect(QPoint(x2 - 2, static_cast(rc.top())), QPoint(x2 + 3, static_cast(rc.bottom())))); } painter->setPen(pOldPen); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp b/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp index cd7cb56421..533625c762 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp @@ -320,12 +320,12 @@ bool CUiAVCustomizeTrackColorsDlg::Import(const QString& fullPath) { return entry.paramType == paramType; }); - int entryIndex = pEntry - g_trackEntries; + int entryIndex = static_cast(pEntry - g_trackEntries); if (entryIndex >= arraysize(g_trackEntries)) // If not found, skip this. { continue; } - COLORREF color = -1; + COLORREF color = std::numeric_limits::max(); childNode->getAttr("color", color); m_colorButtons[entryIndex]->SetColor(color); } @@ -333,7 +333,7 @@ bool CUiAVCustomizeTrackColorsDlg::Import(const QString& fullPath) XmlNodeRef othersNode = customTrackColorsNode->findChild("others"); if (othersNode) { - COLORREF color = -1; + COLORREF color = std::numeric_limits::max(); othersNode->getAttr("color", color); m_colorButtons[kOthersEntryIndex]->SetColor(color); } @@ -341,7 +341,7 @@ bool CUiAVCustomizeTrackColorsDlg::Import(const QString& fullPath) XmlNodeRef disabledNode = customTrackColorsNode->findChild("disabled"); if (disabledNode) { - COLORREF color = -1; + COLORREF color = std::numeric_limits::max(); disabledNode->getAttr("color", color); m_colorButtons[kDisabledEntryIndex]->SetColor(color); } @@ -349,7 +349,7 @@ bool CUiAVCustomizeTrackColorsDlg::Import(const QString& fullPath) XmlNodeRef mutedNode = customTrackColorsNode->findChild("muted"); if (mutedNode) { - COLORREF color = -1; + COLORREF color = std::numeric_limits::max(); mutedNode->getAttr("color", color); m_colorButtons[kMutedEntryIndex]->SetColor(color); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp index 339cb4b5bc..51209c7f02 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp @@ -177,7 +177,7 @@ void CUiAnimViewCurveEditor::UpdateSplines() std::set newTracks; if (selectedTracks.AreAllOfSameType()) { - for (int i = 0; i < selectedTracks.GetCount(); i++) + for (unsigned int i = 0; i < selectedTracks.GetCount(); i++) { CUiAnimViewTrack* pTrack = selectedTracks.GetTrack(i); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp index ac210ba2f2..6a3afe2036 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp @@ -989,7 +989,7 @@ void CUiAnimViewDialog::ReloadSequencesComboBox() CUiAnimViewSequenceManager* pSequenceManager = CUiAnimViewSequenceManager::GetSequenceManager(); const unsigned int numSequences = pSequenceManager->GetCount(); - for (int k = 0; k < numSequences; ++k) + for (unsigned int k = 0; k < numSequences; ++k) { CUiAnimViewSequence* pSequence = pSequenceManager->GetSequenceByIndex(k); QString fullname = pSequence->GetName(); @@ -1470,7 +1470,7 @@ void CUiAnimViewDialog::OnSnapFPS() if (ok) { m_wndDopeSheet->SetSnapFPS(fps); - m_wndCurveEditor->SetFPS(fps); + m_wndCurveEditor->SetFPS(static_cast(fps)); SetCursorPosText(m_animationContext->GetTime()); } @@ -1541,7 +1541,7 @@ void CUiAnimViewDialog::ReadMiscSettings() if (settings.contains(s_kFrameSnappingFPSEntry)) { - float fps = settings.value(s_kFrameSnappingFPSEntry).toDouble(); + float fps = settings.value(s_kFrameSnappingFPSEntry).toFloat(); m_wndDopeSheet->SetSnapFPS(FloatToIntRet(fps)); m_wndCurveEditor->SetFPS(fps); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp index a38736ff67..4e67fb520e 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp @@ -139,8 +139,7 @@ CUiAnimViewDopeSheetBase::~CUiAnimViewDopeSheetBase() ////////////////////////////////////////////////////////////////////////// int CUiAnimViewDopeSheetBase::TimeToClient(float time) const { - int x = m_leftOffset - m_scrollOffset.x() + (time * m_timeScale); - return x; + return static_cast(m_leftOffset - m_scrollOffset.x() + (time * m_timeScale)); } ////////////////////////////////////////////////////////////////////////// @@ -186,7 +185,7 @@ void CUiAnimViewDopeSheetBase::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(m_timeRange.end * m_timeScale - m_leftOffset)); } ////////////////////////////////////////////////////////////////////////// @@ -251,11 +250,11 @@ void CUiAnimViewDopeSheetBase::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(fOldOffset - fCurrentOffset); update(); - SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale); + SetHorizontalExtent(-m_leftOffset, static_cast(m_timeRange.end * m_timeScale)); ComputeFrameSteps(GetVisibleRange()); } @@ -346,15 +345,15 @@ float CUiAnimViewDopeSheetBase::TickSnap(float time) const double tickTime = GetTickTime(); double t = floor(((double)time / tickTime) + 0.5); t *= tickTime; - return t; + return static_cast(t); } ////////////////////////////////////////////////////////////////////////// float CUiAnimViewDopeSheetBase::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(x) / m_timeScale; + return TickSnap(t); } ////////////////////////////////////////////////////////////////////////// @@ -362,7 +361,7 @@ float CUiAnimViewDopeSheetBase::TimeFromPointUnsnapped(const QPoint& point) cons { int x = point.x() - m_leftOffset + m_scrollOffset.x(); double t = (double)x / m_timeScale; - return t; + return static_cast(t); } void CUiAnimViewDopeSheetBase::mousePressEvent(QMouseEvent* event) @@ -925,12 +924,12 @@ void CUiAnimViewDopeSheetBase::SelectAllKeysWithinTimeFrame(const QRect& rc, con CUiAnimViewTrackBundle tracks = pSequence->GetAllTracks(); CUiAnimViewSequenceNotificationContext context(pSequence); - for (int i = 0; i < tracks.GetCount(); ++i) + for (unsigned int i = 0; i < tracks.GetCount(); ++i) { CUiAnimViewTrack* 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++) { CUiAnimViewKeyHandle keyHandle = pTrack->GetKey(j); const float time = keyHandle.GetTime(); @@ -1311,7 +1310,7 @@ bool CUiAnimViewDopeSheetBase::IsOkToAddKeyHere(const CUiAnimViewTrack* pTrack, { const float timeEpsilon = 0.05f; - for (int i = 0; i < pTrack->GetKeyCount(); ++i) + for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i) { CUiAnimViewKeyHandle keyHandle = const_cast(pTrack)->GetKey(i); @@ -1425,10 +1424,10 @@ void CUiAnimViewDopeSheetBase::MouseMoveMove(const QPoint& p, [[maybe_unused]] Q const TrackMemento& trackMemento = iter->second; pTrack->RestoreFromMemento(trackMemento.m_memento); - const unsigned int numKeys = trackMemento.m_keySelectionStates.size(); - for (unsigned int i = 0; i < numKeys; ++i) + const size_t numKeys = trackMemento.m_keySelectionStates.size(); + for (size_t i = 0; i < numKeys; ++i) { - pTrack->GetKey(i).Select(trackMemento.m_keySelectionStates[i]); + pTrack->GetKey(static_cast(i)).Select(trackMemento.m_keySelectionStates[i]); } } @@ -1632,7 +1631,7 @@ float CUiAnimViewDopeSheetBase::MagnetSnap(float newTime, const CUiAnimViewAnimN 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) { CUiAnimViewKeyHandle keyHandle = keys.GetKey(i); if (keyHandle.GetTrack()->GetAnimNode() == pNode) @@ -1651,7 +1650,7 @@ float CUiAnimViewDopeSheetBase::FrameSnap(float time) const { double t = floor((double)time / m_snapFrameTime + 0.5); t = t * m_snapFrameTime; - return t; + return static_cast(t); } ////////////////////////////////////////////////////////////////////////// @@ -1755,9 +1754,10 @@ bool CUiAnimViewDopeSheetBase::CreateColorKey(CUiAnimViewTrack* pTrack, float ke Vec3 vColor(0, 0, 0); pTrack->GetValue(keyTime, vColor); - const AZ::Color defaultColor = AZ::Color::CreateFromRgba(clamp_tpl(FloatToIntRet(vColor.x), 0, 255), - clamp_tpl(FloatToIntRet(vColor.y), 0, 255), - clamp_tpl(FloatToIntRet(vColor.z), 0, 255), 255); + const AZ::Color defaultColor = AZ::Color::CreateFromRgba( + clamp_tpl(static_cast(FloatToIntRet(vColor.x)), AZ::u8(0), AZ::u8(255)), + clamp_tpl(static_cast(FloatToIntRet(vColor.y)), AZ::u8(0), AZ::u8(255)), + clamp_tpl(static_cast(FloatToIntRet(vColor.z)), AZ::u8(0), AZ::u8(255)), 255); AzQtComponents::ColorPicker dlg(AzQtComponents::ColorPicker::Configuration::RGB, tr("Select Color"), this); dlg.setCurrentColor(defaultColor); dlg.setSelectedColor(defaultColor); @@ -1770,7 +1770,7 @@ bool CUiAnimViewDopeSheetBase::CreateColorKey(CUiAnimViewTrack* pTrack, float ke CUiAnimViewSequenceNotificationContext context(pTrack->GetSequence()); const unsigned int numChildNodes = pTrack->GetChildCount(); - for (int i = 0; i < numChildNodes; ++i) + for (unsigned int i = 0; i < numChildNodes; ++i) { CUiAnimViewTrack* subTrack = static_cast(pTrack->GetChild(i)); if (IsOkToAddKeyHere(subTrack, keyTime)) @@ -1890,7 +1890,7 @@ void CUiAnimViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKe } else // A compound track { - for (int k = 0; k < pCurrTrack->GetChildCount(); ++k) + for (unsigned int k = 0; k < pCurrTrack->GetChildCount(); ++k) { CUiAnimViewTrack* pSubTrack = static_cast(pCurrTrack->GetChild(k)); if (IsOkToAddKeyHere(pSubTrack, keyTime)) @@ -1921,7 +1921,7 @@ void CUiAnimViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKe else { RecordTrackUndo(pTrack); - for (int i = 0; i < pTrack->GetChildCount(); ++i) + for (unsigned int i = 0; i < pTrack->GetChildCount(); ++i) { CUiAnimViewTrack* pSubTrack = static_cast(pTrack->GetChild(i)); if (IsOkToAddKeyHere(pSubTrack, keyTime)) @@ -1997,12 +1997,12 @@ void CUiAnimViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Ran nNumberTicks = 8; } - double start = TickSnap(timeRange.start); - double step = 1.0 / m_ticksStep; + float start = TickSnap(timeRange.start); + float step = 1.0f / static_cast(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; @@ -2021,7 +2021,7 @@ void CUiAnimViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Ran continue; } - int k = RoundFloatToInt(st * m_ticksStep); + int k = RoundFloatToInt(st * static_cast(m_ticksStep)); if (k % nNumberTicks == 0) { if (st >= start) @@ -2619,7 +2619,7 @@ void CUiAnimViewDopeSheetBase::SelectKeys(const QRect& rc, const bool bMultiSele CUiAnimViewTrackBundle tracks = pSequence->GetAllTracks(); - for (int i = 0; i < tracks.GetCount(); ++i) + for (unsigned int i = 0; i < tracks.GetCount(); ++i) { CUiAnimViewTrack* pTrack = tracks.GetTrack(i); @@ -2633,7 +2633,7 @@ void CUiAnimViewDopeSheetBase::SelectKeys(const QRect& rc, const bool bMultiSele (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++) { CUiAnimViewKeyHandle keyHandle = pTrack->GetKey(j); @@ -2700,7 +2700,7 @@ void CUiAnimViewDopeSheetBase::DrawSelectedKeyIndicators(QPainter* painter) painter->setPen(Qt::green); CUiAnimViewKeyBundle keys = pSequence->GetSelectedKeys(); - for (int i = 0; i < keys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < keys.GetKeyCount(); ++i) { CUiAnimViewKeyHandle keyHandle = keys.GetKey(i); int x = TimeToClient(keyHandle.GetTime()); @@ -2743,7 +2743,7 @@ void CUiAnimViewDopeSheetBase::ComputeFrameSteps(const Range& visRange) float nBIntermediateTicks = 5; m_fFrameLabelStep = fFact * afStepTable[nStepIdx]; - if (TimeToClient(m_fFrameLabelStep) - TimeToClient(0) > 1300) + if (TimeToClient(static_cast(m_fFrameLabelStep)) - TimeToClient(0) > 1300) { nBIntermediateTicks = 10; } @@ -2755,7 +2755,7 @@ void CUiAnimViewDopeSheetBase::ComputeFrameSteps(const Range& visRange) void CUiAnimViewDopeSheetBase::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(m_fFrameLabelStep); Range VisRange = GetVisibleRange(); const Range& timeRange = m_timeRange; @@ -2763,9 +2763,9 @@ void CUiAnimViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRe 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(m_fFrameTickStep); t += static_cast(m_fFrameTickStep)) { - double st = t; + float st = t; if (st > timeRange.end) { st = timeRange.end; @@ -2810,9 +2810,9 @@ void CUiAnimViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QR 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(step); t += static_cast(step)) { - double st = TickSnap(t); + float st = TickSnap(t); if (st > timeRange.end) { st = timeRange.end; @@ -2831,7 +2831,7 @@ void CUiAnimViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QR } int x = TimeToClient(st); - int k = RoundFloatToInt(st * m_ticksStep); + int k = RoundFloatToInt(st * static_cast(m_ticksStep)); if (k % nNumberTicks == 0) { painter->setPen(black); @@ -2951,7 +2951,7 @@ void CUiAnimViewDopeSheetBase::DrawSummary(QPainter* painter, const QRect& rcUpd // Draw a short thick line at each place where there is a key in any tracks. CUiAnimViewKeyBundle keys = pSequence->GetAllKeys(); - for (int i = 0; i < keys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < keys.GetKeyCount(); ++i) { CUiAnimViewKeyHandle keyHandle = keys.GetKey(i); int x = TimeToClient(keyHandle.GetTime()); @@ -3112,7 +3112,7 @@ void CUiAnimViewDopeSheetBase::StoreMementoForTracksWithSelectedKeys() std::set tracks; const unsigned int numKeys = selectedKeys.GetKeyCount(); - for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex) + for (unsigned int keyIndex = 0; keyIndex < numKeys; ++keyIndex) { CUiAnimViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex); tracks.insert(keyHandle.GetTrack()); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp index 820849bc93..74d2c7d4fb 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp @@ -95,88 +95,16 @@ public: } protected: - void dragMoveEvent(QDragMoveEvent* event) + void dragMoveEvent([[maybe_unused]] QDragMoveEvent* event) { // For now we do not support any drag and drop in the Nodes pane return; - - CUiAnimViewNodesCtrl::CRecord* pRecord = (CUiAnimViewNodesCtrl::CRecord*) itemAt(event->pos()); - if (!pRecord) - { - return; - } - CUiAnimViewNode* pTargetNode = pRecord->GetNode(); - - QTreeWidget::dragMoveEvent(event); - if (!event->isAccepted()) - { - return; - } - - if (pTargetNode && pTargetNode->IsGroupNode() /*&& !m_draggedNodes.DoesContain(pTargetNode)*/) - { - CUiAnimViewAnimNode* pDragTarget = static_cast(pTargetNode); - bool bAllValidReparenting = true; - QList nodes = draggedNodes(event); - Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) - { - if (!pDraggedNode->IsValidReparentingTo(pDragTarget)) - { - bAllValidReparenting = false; - break; - } - } - - if (!bAllValidReparenting) - { - event->ignore(); - } - - return; - } } - void dropEvent(QDropEvent* event) + void dropEvent([[maybe_unused]] QDropEvent* event) { // For now we do not support any drag and drop in the Nodes pane return; - - CUiAnimViewNodesCtrl::CRecord* pRecord = (CUiAnimViewNodesCtrl::CRecord*) itemAt(event->pos()); - if (!pRecord) - { - return; - } - CUiAnimViewNode* pTargetNode = pRecord->GetNode(); - - QTreeWidget::dropEvent(event); - if (!event->isAccepted()) - { - return; - } - - if (pTargetNode && pTargetNode->IsGroupNode() /*&& !m_draggedNodes.DoesContain(pTargetNode)*/) - { - CUiAnimViewAnimNode* pDragTarget = static_cast(pTargetNode); - bool bAllValidReparenting = true; - QList nodes = draggedNodes(event); - Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) - { - if (!pDraggedNode->IsValidReparentingTo(pDragTarget)) - { - bAllValidReparenting = false; - break; - } - } - - if (bAllValidReparenting) - { - UiAnimUndo undo("Drag and Drop UiAnimView Nodes"); - Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) - { - pDraggedNode->SetNewParent(pDragTarget); - } - } - } } void keyPressEvent(QKeyEvent* event) diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp index ba4893abb4..8edd13f8cc 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp @@ -667,7 +667,7 @@ void CUiAnimViewSplineCtrl::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; CUiAnimViewTrack* pTrack = m_tracks[splineIndex]; @@ -757,7 +757,7 @@ void CUiAnimViewSplineCtrl::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; CUiAnimViewTrack* pTrack = m_tracks[splineIndex]; @@ -866,16 +866,16 @@ void CUiAnimViewSplineCtrl::OnUserCommand(UINT cmd) bool CUiAnimViewSplineCtrl::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; - if (pSpline == NULL) + if (!pSpline) { continue; } - for (int i = 0; i < (int)pSpline->GetKeyCount(); i++) + for (int i = 0; i < pSpline->GetKeyCount(); i++) { // If the key is selected in any dimension... for ( diff --git a/Gems/LyShine/Code/Editor/EditorCommon.h b/Gems/LyShine/Code/Editor/EditorCommon.h index ebe5b89cfc..9af5958c67 100644 --- a/Gems/LyShine/Code/Editor/EditorCommon.h +++ b/Gems/LyShine/Code/Editor/EditorCommon.h @@ -34,8 +34,6 @@ #include #include -#pragma warning(disable: 4355) // 'this' : used in base member initializer list - class CanvasSizeToolbarSection; class CommandCanvasPropertiesChange; class CommandCanvasSizeToolbarIndex; diff --git a/Gems/LyShine/Code/Editor/QtHelpers.cpp b/Gems/LyShine/Code/Editor/QtHelpers.cpp index 8b6063a055..d9147463ed 100644 --- a/Gems/LyShine/Code/Editor/QtHelpers.cpp +++ b/Gems/LyShine/Code/Editor/QtHelpers.cpp @@ -32,8 +32,7 @@ namespace QtHelpers float GetHighDpiScaleFactor(const QWidget& widget) { - float dpiScale = QHighDpiScaling::factor(widget.windowHandle()->screen()); - return dpiScale; + return static_cast(QHighDpiScaling::factor(widget.windowHandle()->screen())); } QSize GetDpiScaledViewportSize(const QWidget& widget) @@ -41,7 +40,7 @@ namespace QtHelpers float dpiScale = GetHighDpiScaleFactor(widget); float width = ceilf(widget.size().width() * dpiScale); float height = ceilf(widget.size().height() * dpiScale); - return QSize(width, height); + return QSize(static_cast(width), static_cast(height)); } } // namespace QtHelpers diff --git a/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp b/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp index f53da64110..04f655123c 100644 --- a/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp +++ b/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp @@ -310,7 +310,7 @@ void SpriteBorderEditor::AddConfigureSection(QGridLayout* gridLayout, int& rowNu int newNumCols = numColsLineEdit->text().toInt(&colConversionSuccess); const bool positiveInputs = newNumRows > 0 && newNumCols > 0; - const bool valueChanged = m_numRows != newNumRows || m_numCols != newNumCols; + const bool valueChanged = m_numRows != static_cast(newNumRows) || m_numCols != static_cast(newNumCols); // This number of cells is just nearly unusable in the sprite editor UI. Supporting // more would likely require reworking of UX/UI and even implementation. diff --git a/Gems/LyShine/Code/Editor/ViewportIcon.cpp b/Gems/LyShine/Code/Editor/ViewportIcon.cpp index e4ada665d5..e3ad68922e 100644 --- a/Gems/LyShine/Code/Editor/ViewportIcon.cpp +++ b/Gems/LyShine/Code/Editor/ViewportIcon.cpp @@ -27,7 +27,7 @@ AZ::Vector2 ViewportIcon::GetTextureSize() const if (m_image) { AZ::RHI::Size size = m_image->GetDescriptor().m_size; - AZ::Vector2 scaledSize(size.m_width, size.m_height); + AZ::Vector2 scaledSize(static_cast(size.m_width), static_cast(size.m_height)); if (m_applyDpiScaleFactorToSize) { scaledSize *= m_dpiScaleFactor; diff --git a/Gems/LyShine/Code/Editor/ViewportWidget.cpp b/Gems/LyShine/Code/Editor/ViewportWidget.cpp index 1ce8f5b64d..e172d43b60 100644 --- a/Gems/LyShine/Code/Editor/ViewportWidget.cpp +++ b/Gems/LyShine/Code/Editor/ViewportWidget.cpp @@ -1001,7 +1001,7 @@ void ViewportWidget::RenderEditMode() // Render this canvas QSize scaledViewportSize = QtHelpers::GetDpiScaledViewportSize(*this); - AZ::Vector2 viewportSize(scaledViewportSize.width(), scaledViewportSize.height()); + AZ::Vector2 viewportSize(static_cast(scaledViewportSize.width()), static_cast(scaledViewportSize.height())); EBUS_EVENT_ID(canvasEntityId, UiEditorCanvasBus, RenderCanvasInEditorViewport, false, viewportSize); m_draw2d->SetSortKey(topLayerKey); @@ -1111,7 +1111,7 @@ void ViewportWidget::UpdatePreviewMode(float deltaTime) if (canvasEntityId.IsValid()) { QSize scaledViewportSize = QtHelpers::GetDpiScaledViewportSize(*this); - AZ::Vector2 viewportSize(scaledViewportSize.width(), scaledViewportSize.height()); + AZ::Vector2 viewportSize(static_cast(scaledViewportSize.width()), static_cast(scaledViewportSize.height())); // Get the canvas size AZ::Vector2 canvasSize = m_editorWindow->GetPreviewCanvasSize(); @@ -1153,7 +1153,7 @@ void ViewportWidget::RenderPreviewMode() if (canvasEntityId.IsValid()) { QSize scaledViewportSize = QtHelpers::GetDpiScaledViewportSize(*this); - AZ::Vector2 viewportSize(scaledViewportSize.width(), scaledViewportSize.height()); + AZ::Vector2 viewportSize(static_cast(scaledViewportSize.width()), static_cast(scaledViewportSize.height())); // Get the canvas size AZ::Vector2 canvasSize = m_editorWindow->GetPreviewCanvasSize(); @@ -1239,7 +1239,7 @@ void ViewportWidget::RenderViewportBackground() Draw2dHelper draw2d(m_draw2d.get()); draw2d.SetImageColor(backgroundColor.GetAsVector3()); - draw2d.DrawImage(image, AZ::Vector2(0.0f, 0.0f), AZ::Vector2(viewportSize.width(), viewportSize.height())); + draw2d.DrawImage(image, AZ::Vector2(0.0f, 0.0f), AZ::Vector2(static_cast(viewportSize.width()), static_cast(viewportSize.height()))); } void ViewportWidget::SetupShortcuts() diff --git a/Gems/LyShine/Code/Source/Animation/2DSpline.h b/Gems/LyShine/Code/Source/Animation/2DSpline.h index 60589e1344..b831bd669a 100644 --- a/Gems/LyShine/Code/Source/Animation/2DSpline.h +++ b/Gems/LyShine/Code/Source/Animation/2DSpline.h @@ -62,7 +62,7 @@ namespace UiSpline ILINE void flag_clr(int flag) { m_flags &= ~flag; }; ILINE int flag(int flag) { return m_flags & flag; }; - ILINE void ORT(int ort) { m_ORT = ort; }; + ILINE void ORT(int ort) { m_ORT = static_cast(ort); }; ILINE int ORT() const { return m_ORT; }; ILINE int isORT(int o) const { return (m_ORT == o); }; diff --git a/Gems/LyShine/Code/Source/Animation/AnimTrack.h b/Gems/LyShine/Code/Source/Animation/AnimTrack.h index f73cd7ede7..df0ae3a805 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimTrack.h +++ b/Gems/LyShine/Code/Source/Animation/AnimTrack.h @@ -221,6 +221,8 @@ protected: float m_lastTime; int m_flags; + static constexpr unsigned int InvalidKey = 0x7FFFFFFF; + UiAnimParamData m_componentParamData; #ifdef UI_ANIMATION_SYSTEM_SUPPORT_EDITING @@ -521,7 +523,7 @@ inline int TUiAnimTrack::GetActiveKey(float time, KeyType* key) if (nkeys == 0) { m_lastTime = time; - m_currKey = -1; + m_currKey = InvalidKey; return m_currKey; } @@ -554,7 +556,7 @@ inline int TUiAnimTrack::GetActiveKey(float time, KeyType* key) } else { - m_currKey = -1; + m_currKey = InvalidKey; } return m_currKey; } @@ -600,6 +602,6 @@ inline int TUiAnimTrack::GetActiveKey(float time, KeyType* key) break; } } - m_currKey = -1; + m_currKey = InvalidKey; return m_currKey; } diff --git a/Gems/LyShine/Code/Source/LyShineDebug.cpp b/Gems/LyShine/Code/Source/LyShineDebug.cpp index c7dccc162f..a30f816c73 100644 --- a/Gems/LyShine/Code/Source/LyShineDebug.cpp +++ b/Gems/LyShine/Code/Source/LyShineDebug.cpp @@ -115,7 +115,7 @@ static int Create2DTexture(int width, int height, byte* data, ETEX_Format format static AZ::Vector2 GetTextureSize(AZ::Data::Instance image) { AZ::RHI::Size size = image->GetDescriptor().m_size; - return AZ::Vector2(size.m_width, size.m_height); + return AZ::Vector2(static_cast(size.m_width), static_cast(size.m_height)); } #endif diff --git a/Gems/LyShine/Code/Source/LyShinePass.cpp b/Gems/LyShine/Code/Source/LyShinePass.cpp index fbf7f34e14..8245294696 100644 --- a/Gems/LyShine/Code/Source/LyShinePass.cpp +++ b/Gems/LyShine/Code/Source/LyShinePass.cpp @@ -135,7 +135,7 @@ namespace LyShine passData->m_pipelineViewTag = AZ::Name("MainCamera"); auto size = attachmentImage->GetRHIImage()->GetDescriptor().m_size; passData->m_overrideScissor = AZ::RHI::Scissor(0, 0, size.m_width, size.m_height); - passData->m_overrideViewport = AZ::RHI::Viewport(0, size.m_width, 0, size.m_height); + passData->m_overrideViewport = AZ::RHI::Viewport(0, static_cast(size.m_width), 0, static_cast(size.m_height)); passTemplate->m_passData = AZStd::move(passData); // Create a pass descriptor for the new child pass AZ::RPI::PassDescriptor childDesc; diff --git a/Gems/LyShine/Code/Source/RenderGraph.cpp b/Gems/LyShine/Code/Source/RenderGraph.cpp index b07aab78c7..51f62fc7ad 100644 --- a/Gems/LyShine/Code/Source/RenderGraph.cpp +++ b/Gems/LyShine/Code/Source/RenderGraph.cpp @@ -386,7 +386,7 @@ namespace LyShine curBaseState.m_stencilState.m_backFace = stencilOpState; // set up for stencil write - dynamicDraw->SetStencilReference(uiRenderer->GetStencilRef()); + dynamicDraw->SetStencilReference(static_cast(uiRenderer->GetStencilRef())); curBaseState.m_stencilState.m_enable = true; curBaseState.m_stencilState.m_writeMask = 0xFF; } @@ -420,7 +420,7 @@ namespace LyShine uiRenderer->DecrementStencilRef(); } - dynamicDraw->SetStencilReference(uiRenderer->GetStencilRef()); + dynamicDraw->SetStencilReference(static_cast(uiRenderer->GetStencilRef())); if (firstPass) { @@ -790,7 +790,7 @@ namespace LyShine { for (int i = 0; i < primitive->m_numVertices; ++i) { - primitive->m_vertices[i].texIndex = texUnit; + primitive->m_vertices[i].texIndex = static_cast(texUnit); } } @@ -881,8 +881,8 @@ namespace LyShine { for (int i = 0; i < primitive->m_numVertices; ++i) { - primitive->m_vertices[i].texIndex = texUnit0; - primitive->m_vertices[i].texIndex2 = texUnit1; + primitive->m_vertices[i].texIndex = aznumeric_cast(texUnit0); + primitive->m_vertices[i].texIndex2 = aznumeric_cast(texUnit1); } } diff --git a/Gems/LyShine/Code/Source/Sprite.cpp b/Gems/LyShine/Code/Source/Sprite.cpp index a097e23dfe..7f293e57a3 100644 --- a/Gems/LyShine/Code/Source/Sprite.cpp +++ b/Gems/LyShine/Code/Source/Sprite.cpp @@ -368,7 +368,7 @@ AZ::Vector2 CSprite::GetSize() } AZ::RHI::Size size = image->GetRHIImage()->GetDescriptor().m_size; - return AZ::Vector2(size.m_width, size.m_height); + return AZ::Vector2(static_cast(size.m_width), static_cast(size.m_height)); } else { diff --git a/Gems/LyShine/Code/Source/StringUtfUtils.h b/Gems/LyShine/Code/Source/StringUtfUtils.h index 40dd22dd33..9c185d48ef 100644 --- a/Gems/LyShine/Code/Source/StringUtfUtils.h +++ b/Gems/LyShine/Code/Source/StringUtfUtils.h @@ -31,7 +31,7 @@ namespace LyShine // work for cases tested but may not in general. // In the long run it would be better to eliminate // this function and use some sequence_lenght function that is not internal. - return Utf8::Internal::sequence_length(&multiByteChar); + return static_cast(Utf8::Internal::sequence_length(&multiByteChar)); } inline int GetByteLengthOfUtf8Chars(const char* utf8String, int numUtf8Chars) diff --git a/Gems/LyShine/Code/Source/UiCanvasManager.cpp b/Gems/LyShine/Code/Source/UiCanvasManager.cpp index 5f2adcd20c..d13a8f5034 100644 --- a/Gems/LyShine/Code/Source/UiCanvasManager.cpp +++ b/Gems/LyShine/Code/Source/UiCanvasManager.cpp @@ -808,7 +808,7 @@ UiCanvasComponent* UiCanvasManager::FindEditorCanvasComponentByPathname(const AZ } //////////////////////////////////////////////////////////////////////////////////////////////////// -bool UiCanvasManager::HandleInputEventForInWorldCanvases(const AzFramework::InputChannel::Snapshot& inputSnapshot, const AZ::Vector2& viewportPos) +bool UiCanvasManager::HandleInputEventForInWorldCanvases([[maybe_unused]] const AzFramework::InputChannel::Snapshot& inputSnapshot, [[maybe_unused]] const AZ::Vector2& viewportPos) { // First we need to construct a ray from the either the center of the screen or the mouse position. // This requires knowledge of the camera @@ -816,86 +816,86 @@ bool UiCanvasManager::HandleInputEventForInWorldCanvases(const AzFramework::Inpu // ToDo: Re-implement by getting the camera from Atom. LYN-3680 return false; - const CCamera cam; - - // construct a ray from the camera position in the view direction of the camera - const float rayLength = 5000.0f; - Vec3 rayOrigin(cam.GetPosition()); - Vec3 rayDirection = cam.GetViewdir() * rayLength; - - // If the mouse cursor is visible we will assume that the ray should be in the direction of the - // mouse pointer. This is a temporary solution. A better solution is to be able to configure the - // LyShine system to say how ray input should be handled. - bool isCursorVisible = false; - UiCursorBus::BroadcastResult(isCursorVisible, &UiCursorInterface::IsUiCursorVisible); - if (isCursorVisible) - { - // for some reason Unproject seems to work when given the viewport pos with (0,0) at the - // bottom left as opposed to the top left - even though that function specifically sets top left - // to (0,0). - const float viewportYInverted = cam.GetViewSurfaceZ() - viewportPos.GetY(); - - // Unproject to get the screen position in world space, use arbitrary Z that is within the depth range - Vec3 flippedViewportRayOrigin(viewportPos.GetX(), viewportYInverted, 0.f); - Vec3 flippedViewportRayForward(viewportPos.GetX(), viewportYInverted, 1.f); - - cam.Unproject(flippedViewportRayOrigin, rayOrigin); - - Vec3 unprojectedPosForward; - cam.Unproject(flippedViewportRayForward, unprojectedPosForward); - - // We want a vector relative to the camera origin - Vec3 rayVec = unprojectedPosForward - rayOrigin; - - // we want to ensure that the ray is a certain length so normalize it and scale it - rayVec.NormalizeSafe(); - rayDirection = rayVec * rayLength; - } - - - AzFramework::EntityContextId gameContextId; - AzFramework::GameEntityContextRequestBus::BroadcastResult(gameContextId, - &AzFramework::GameEntityContextRequests::GetGameEntityContextId); - - AzFramework::RenderGeometry::RayRequest request; - request.m_startWorldPosition = LYVec3ToAZVec3(rayOrigin); - request.m_endWorldPosition = LYVec3ToAZVec3(rayOrigin + rayDirection); - - AzFramework::RenderGeometry::RayResult rayResult; - AzFramework::RenderGeometry::IntersectorBus::EventResult(rayResult, gameContextId, - &AzFramework::RenderGeometry::IntersectorInterface::RayIntersect, request); - - if (rayResult) - { - AZ::EntityId hitEntity = rayResult.m_entityAndComponent.GetEntityId(); - if (hitEntity.IsValid()) - { - AZ::EntityId canvasEntityId; - UiCanvasRefBus::EventResult(canvasEntityId, hitEntity, &UiCanvasRefInterface::GetCanvas); - if (canvasEntityId.IsValid()) - { - // Checkif the UI canvas referenced by the hit entity supports automatic input - bool doesCanvasSupportInput = false; - UiCanvasBus::EventResult(doesCanvasSupportInput, canvasEntityId, &UiCanvasInterface::GetIsPositionalInputSupported); - - if (doesCanvasSupportInput) - { - // set the hit details to the hit entity, it will convert into canvas coords and send to canvas - bool handled = false; - UiCanvasOnMeshBus::EventResult(handled, hitEntity, - &UiCanvasOnMeshInterface::ProcessHitInputEvent, inputSnapshot, rayResult); - - if (handled) - { - return true; - } - } - } - } - } - - - return false; + //const CCamera cam; + // + //// construct a ray from the camera position in the view direction of the camera + //const float rayLength = 5000.0f; + //Vec3 rayOrigin(cam.GetPosition()); + //Vec3 rayDirection = cam.GetViewdir() * rayLength; + // + //// If the mouse cursor is visible we will assume that the ray should be in the direction of the + //// mouse pointer. This is a temporary solution. A better solution is to be able to configure the + //// LyShine system to say how ray input should be handled. + //bool isCursorVisible = false; + //UiCursorBus::BroadcastResult(isCursorVisible, &UiCursorInterface::IsUiCursorVisible); + //if (isCursorVisible) + //{ + // // for some reason Unproject seems to work when given the viewport pos with (0,0) at the + // // bottom left as opposed to the top left - even though that function specifically sets top left + // // to (0,0). + // const float viewportYInverted = cam.GetViewSurfaceZ() - viewportPos.GetY(); + // + // // Unproject to get the screen position in world space, use arbitrary Z that is within the depth range + // Vec3 flippedViewportRayOrigin(viewportPos.GetX(), viewportYInverted, 0.f); + // Vec3 flippedViewportRayForward(viewportPos.GetX(), viewportYInverted, 1.f); + // + // cam.Unproject(flippedViewportRayOrigin, rayOrigin); + // + // Vec3 unprojectedPosForward; + // cam.Unproject(flippedViewportRayForward, unprojectedPosForward); + // + // // We want a vector relative to the camera origin + // Vec3 rayVec = unprojectedPosForward - rayOrigin; + // + // // we want to ensure that the ray is a certain length so normalize it and scale it + // rayVec.NormalizeSafe(); + // rayDirection = rayVec * rayLength; + //} + // + // + //AzFramework::EntityContextId gameContextId; + //AzFramework::GameEntityContextRequestBus::BroadcastResult(gameContextId, + // &AzFramework::GameEntityContextRequests::GetGameEntityContextId); + // + //AzFramework::RenderGeometry::RayRequest request; + //request.m_startWorldPosition = LYVec3ToAZVec3(rayOrigin); + //request.m_endWorldPosition = LYVec3ToAZVec3(rayOrigin + rayDirection); + // + //AzFramework::RenderGeometry::RayResult rayResult; + //AzFramework::RenderGeometry::IntersectorBus::EventResult(rayResult, gameContextId, + // &AzFramework::RenderGeometry::IntersectorInterface::RayIntersect, request); + // + //if (rayResult) + //{ + // AZ::EntityId hitEntity = rayResult.m_entityAndComponent.GetEntityId(); + // if (hitEntity.IsValid()) + // { + // AZ::EntityId canvasEntityId; + // UiCanvasRefBus::EventResult(canvasEntityId, hitEntity, &UiCanvasRefInterface::GetCanvas); + // if (canvasEntityId.IsValid()) + // { + // // Checkif the UI canvas referenced by the hit entity supports automatic input + // bool doesCanvasSupportInput = false; + // UiCanvasBus::EventResult(doesCanvasSupportInput, canvasEntityId, &UiCanvasInterface::GetIsPositionalInputSupported); + // + // if (doesCanvasSupportInput) + // { + // // set the hit details to the hit entity, it will convert into canvas coords and send to canvas + // bool handled = false; + // UiCanvasOnMeshBus::EventResult(handled, hitEntity, + // &UiCanvasOnMeshInterface::ProcessHitInputEvent, inputSnapshot, rayResult); + // + // if (handled) + // { + // return true; + // } + // } + // } + // } + //} + // + // + //return false; } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LyShine/Code/Source/UiFaderComponent.cpp b/Gems/LyShine/Code/Source/UiFaderComponent.cpp index f195689a43..e7eca04c59 100644 --- a/Gems/LyShine/Code/Source/UiFaderComponent.cpp +++ b/Gems/LyShine/Code/Source/UiFaderComponent.cpp @@ -463,7 +463,7 @@ void UiFaderComponent::CreateOrResizeRenderTarget(const AZ::Vector2& pixelAligne // Create a render target that this element and its children will be rendered to AZ::EntityId canvasEntityId; EBUS_EVENT_ID_RESULT(canvasEntityId, GetEntityId(), UiElementBus, GetCanvasEntityId); - AZ::RHI::Size imageSize(renderTargetSize.GetX(), renderTargetSize.GetY(), 1); + AZ::RHI::Size imageSize(static_cast(renderTargetSize.GetX()), static_cast(renderTargetSize.GetY()), 1); EBUS_EVENT_ID_RESULT(m_attachmentImageId, canvasEntityId, LyShine::RenderToTextureRequestBus, UseRenderTarget, AZ::Name(m_renderTargetName.c_str()), imageSize); if (m_attachmentImageId.IsEmpty()) { diff --git a/Gems/LyShine/Code/Source/UiImageComponent.cpp b/Gems/LyShine/Code/Source/UiImageComponent.cpp index 83c184cfc8..d279beeee9 100644 --- a/Gems/LyShine/Code/Source/UiImageComponent.cpp +++ b/Gems/LyShine/Code/Source/UiImageComponent.cpp @@ -1666,7 +1666,7 @@ void UiImageComponent::RenderRadialFilledQuad(const AZ::Vector2* positions, cons const int numIndices = 15; uint16 indices[numIndices]; - for (int ix = 0; ix < 5; ++ix) + for (uint16 ix = 0; ix < 5; ++ix) { indices[ix * 3 + firstIndexOffset] = ix + 1; indices[ix * 3 + secondIndexOffset] = ix + 2; @@ -2268,20 +2268,20 @@ int UiImageComponent::ClipToLine(const SVF_P2F_C4B_T2F_F4B* vertices, const uint int indicesAdded = 0; if (verticesAdded == 3) { - renderIndices[renderIndexOffset] = vertexOffset - 3; - renderIndices[renderIndexOffset + 1] = vertexOffset - 2; - renderIndices[renderIndexOffset + 2] = vertexOffset - 1; + renderIndices[renderIndexOffset] = static_cast(vertexOffset - 3); + renderIndices[renderIndexOffset + 1] = static_cast(vertexOffset - 2); + renderIndices[renderIndexOffset + 2] = static_cast(vertexOffset - 1); indicesAdded = 3; } else if (verticesAdded == 4) { - renderIndices[renderIndexOffset] = vertexOffset - 4; - renderIndices[renderIndexOffset + 1] = vertexOffset - 3; - renderIndices[renderIndexOffset + 2] = vertexOffset - 2; + renderIndices[renderIndexOffset] = static_cast(vertexOffset - 4); + renderIndices[renderIndexOffset + 1] = static_cast(vertexOffset - 3); + renderIndices[renderIndexOffset + 2] = static_cast(vertexOffset - 2); - renderIndices[renderIndexOffset + 3] = vertexOffset - 4; - renderIndices[renderIndexOffset + 4] = vertexOffset - 2; - renderIndices[renderIndexOffset + 5] = vertexOffset - 1; + renderIndices[renderIndexOffset + 3] = static_cast(vertexOffset - 4); + renderIndices[renderIndexOffset + 4] = static_cast(vertexOffset - 2); + renderIndices[renderIndexOffset + 5] = static_cast(vertexOffset - 1); indicesAdded = 6; } diff --git a/Gems/LyShine/Code/Source/UiMaskComponent.cpp b/Gems/LyShine/Code/Source/UiMaskComponent.cpp index 2c1763e4ec..d6ed468deb 100644 --- a/Gems/LyShine/Code/Source/UiMaskComponent.cpp +++ b/Gems/LyShine/Code/Source/UiMaskComponent.cpp @@ -564,7 +564,7 @@ void UiMaskComponent::CreateOrResizeRenderTarget(const AZ::Vector2& pixelAligned // Create a render target that this element and its children will be rendered to AZ::EntityId canvasEntityId; EBUS_EVENT_ID_RESULT(canvasEntityId, GetEntityId(), UiElementBus, GetCanvasEntityId); - AZ::RHI::Size imageSize(renderTargetSize.GetX(), renderTargetSize.GetY(), 1); + AZ::RHI::Size imageSize(static_cast(renderTargetSize.GetX()), static_cast(renderTargetSize.GetY()), 1); EBUS_EVENT_ID_RESULT(m_contentAttachmentImageId, canvasEntityId, LyShine::RenderToTextureRequestBus, UseRenderTarget, AZ::Name(m_renderTargetName.c_str()), imageSize); if (m_contentAttachmentImageId.IsEmpty()) { @@ -762,7 +762,7 @@ void UiMaskComponent::RenderUsingGradientMask(LyShine::IRenderGraph* renderGraph { // go through all the cached vertices and update the alpha values UCol desiredPackedColor = m_cachedPrimitive.m_vertices[0].color; - desiredPackedColor.a = desiredPackedAlpha; + desiredPackedColor.a = static_cast(desiredPackedAlpha); for (int i = 0; i < m_cachedPrimitive.m_numVertices; ++i) { m_cachedPrimitive.m_vertices[i].color = desiredPackedColor; diff --git a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp index a8b678947b..0adf2fb2de 100644 --- a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp +++ b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp @@ -1825,8 +1825,8 @@ void UiParticleEmitterComponent::ResetParticleBuffers() } m_cachedPrimitive.m_indices = new uint16[numIndices]; - const int verticesPerParticle = 4; - int baseIndex = 0; + const uint16 verticesPerParticle = 4; + uint16 baseIndex = 0; for (AZ::u32 i = 0; i < numIndices; i += indicesPerParticle) { m_cachedPrimitive.m_indices[i + 0] = 0 + baseIndex; diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index 35f351a9e6..f9544a9954 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -1096,7 +1096,7 @@ UiTextComponent::InlineImage::InlineImage(const AZStd::string& texturePathname, if (m_texture) { AZ::RHI::Size size = m_texture->GetDescriptor().m_size; - m_size = AZ::Vector2(size.m_width, size.m_height); + m_size = AZ::Vector2(static_cast(size.m_width), static_cast(size.m_height)); } } @@ -2068,7 +2068,7 @@ int UiTextComponent::GetFontEffect() //////////////////////////////////////////////////////////////////////////////////////////////////// void UiTextComponent::SetFontEffect(int effectIndex) { - if (m_fontEffectIndex != effectIndex) + if (m_fontEffectIndex != static_cast(effectIndex)) { m_fontEffectIndex = effectIndex; @@ -4149,7 +4149,7 @@ void UiTextComponent::RenderDrawBatchLines( imageQuad[i] = transformToViewport * imageQuad[i]; } - static const uint32 packedColor = (255 << 24) | (255 << 16) | (255 << 8) | 255; + static const uint32 packedColor = (255u << 24) | (255u << 16) | (255u << 8) | 255u; RenderCacheImageBatch* cacheImageBatch = new RenderCacheImageBatch; diff --git a/Gems/LyShine/Code/Source/UiTextInputComponent.cpp b/Gems/LyShine/Code/Source/UiTextInputComponent.cpp index 0d9fc09063..df2d85eb74 100644 --- a/Gems/LyShine/Code/Source/UiTextInputComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextInputComponent.cpp @@ -63,7 +63,7 @@ namespace //! \brief Given a UTF8 string and index, return the raw string buffer index that maps to the UTF8 index. int GetCharArrayIndexFromUtf8CharIndex(const AZStd::string& utf8String, const uint utf8Index) { - int utfIndexIter = 0; + uint utfIndexIter = 0; int rawIndex = 0; const AZStd::string::size_type stringLength = utf8String.length(); diff --git a/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp b/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp index e7736cd30b..2e6491db5b 100644 --- a/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp +++ b/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp @@ -29,7 +29,7 @@ namespace Maestro { /*static*/ AZ::ScriptTimePoint EditorSequenceComponent::s_lastPropertyRefreshTime; /*static*/ const double EditorSequenceComponent::s_refreshPeriodMilliseconds = 200.0; // 5 Hz refresh rate - /*static*/ const int EditorSequenceComponent::s_invalidSequenceId = -1; + /*static*/ const uint32 EditorSequenceComponent::s_invalidSequenceId = std::numeric_limits::max(); namespace ClassConverters { diff --git a/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.h b/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.h index 597cd30912..83caaeea19 100644 --- a/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.h +++ b/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.h @@ -110,6 +110,6 @@ namespace Maestro static AZ::ScriptTimePoint s_lastPropertyRefreshTime; static const double s_refreshPeriodMilliseconds; // property refresh period for SetAnimatedPropertyValue events - static const int s_invalidSequenceId; + static const uint32 s_invalidSequenceId; }; } // namespace Maestro diff --git a/Gems/MessagePopup/Code/Include/MessagePopup/MessagePopupBus.h b/Gems/MessagePopup/Code/Include/MessagePopup/MessagePopupBus.h index e6f31ec08d..7dfa2ba5a8 100644 --- a/Gems/MessagePopup/Code/Include/MessagePopup/MessagePopupBus.h +++ b/Gems/MessagePopup/Code/Include/MessagePopup/MessagePopupBus.h @@ -25,7 +25,7 @@ namespace MessagePopup EPopupKind_Toaster }; - static const AZ::u32 InvalidId = -1; + static const AZ::u32 InvalidId = std::numeric_limits::max(); ////////////////////////////////////////////////////////////////////////// struct MessagePopupInfo diff --git a/Gems/Metastream/Code/Source/MetastreamGem.cpp b/Gems/Metastream/Code/Source/MetastreamGem.cpp index 2bb213662c..e8c659474d 100644 --- a/Gems/Metastream/Code/Source/MetastreamGem.cpp +++ b/Gems/Metastream/Code/Source/MetastreamGem.cpp @@ -339,10 +339,9 @@ namespace Metastream // Server already started return true; } -#endif // AZ_TRAIT_METASTREAM_USE_CIVET - - // Metastream only supported on PC +#else return false; +#endif } void Metastream::MetastreamGem::StopHTTPServer() diff --git a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja index 56ab828ffe..b89d1a2b2e 100644 --- a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja +++ b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja @@ -1568,8 +1568,7 @@ namespace {{ Component.attrib['Namespace'] }} return s_netComponentId; } -#pragma warning(push) -#pragma warning(disable: 4065) // switch statement contains 'default' but no 'case' labels + AZ_PUSH_DISABLE_WARNING(4065, "-Wunknown-warning-option") // switch statement contains 'default' but no 'case' labels bool {{ ComponentBaseName }}::HandleRpcMessage ( [[maybe_unused]] AzNetworking::IConnection* invokingConnection, @@ -1587,10 +1586,8 @@ namespace {{ Component.attrib['Namespace'] }} default: return false; } - AZ_Assert(0, "Got unhandled RpcType %d in {{ ComponentBaseName }}", static_cast(rpcType)); - return false; } -#pragma warning(pop) + AZ_POP_DISABLE_WARNING bool {{ ComponentBaseName }}::SerializeStateDeltaMessage(Multiplayer::ReplicationRecord& replicationRecord, AzNetworking::ISerializer& serializer) { diff --git a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp index 72f5aa8e1c..936f2ea92c 100644 --- a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp @@ -277,7 +277,7 @@ namespace Multiplayer input.SetClientInputId(GetLastInputId()); ScopedAlterTime scopedTime(input.GetHostFrameId(), input.GetHostTimeMs(), input.GetHostBlendFactor(), invokingConnection->GetConnectionId()); - GetNetBindComponent()->ProcessInput(input, clientInputRateSec); + GetNetBindComponent()->ProcessInput(input, static_cast(clientInputRateSec)); AZLOG(NET_Prediction, "Migrated InputId=%d", aznumeric_cast(input.GetClientInputId())); @@ -345,7 +345,7 @@ namespace Multiplayer // Reprocess the input for this frame NetworkInput& input = m_inputHistory[replayIndex]; ScopedAlterTime scopedTime(input.GetHostFrameId(), input.GetHostTimeMs(), input.GetHostBlendFactor(), invokingConnection->GetConnectionId()); - GetNetBindComponent()->ReprocessInput(input, clientInputRateSec); + GetNetBindComponent()->ReprocessInput(input, static_cast(clientInputRateSec)); AZLOG(NET_Prediction, "Replayed InputId=%d", aznumeric_cast(input.GetClientInputId())); } @@ -438,10 +438,10 @@ namespace Multiplayer input.SetHostBlendFactor(multiplayer->GetCurrentBlendFactor()); // Allow components to form the input for this frame - GetNetBindComponent()->CreateInput(input, clientInputRateSec); + GetNetBindComponent()->CreateInput(input, static_cast(clientInputRateSec)); // Process the input for this frame - GetNetBindComponent()->ProcessInput(input, clientInputRateSec); + GetNetBindComponent()->ProcessInput(input, static_cast(clientInputRateSec)); AZLOG(NET_Prediction, "Processed InputId=%d", aznumeric_cast(m_clientInputId)); @@ -464,7 +464,7 @@ namespace Multiplayer { // Clamp to oldest element if history is too small const int64_t historyIndex = AZStd::max(inputHistorySize - 1 - i, 0); - inputArray[i] = m_inputHistory[historyIndex]; + inputArray[static_cast(i)] = m_inputHistory[historyIndex]; } #ifndef AZ_RELEASE_BUILD @@ -506,7 +506,7 @@ namespace Multiplayer NetworkInput& input = m_lastInputReceived[0]; { ScopedAlterTime scopedTime(input.GetHostFrameId(), input.GetHostTimeMs(), DefaultBlendFactor, GetNetBindComponent()->GetOwningConnectionId()); - GetNetBindComponent()->ProcessInput(input, clientInputRateSec); + GetNetBindComponent()->ProcessInput(input, static_cast(clientInputRateSec)); } AZLOG(NET_Prediction, "Forced InputId=%d", aznumeric_cast(input.GetClientInputId())); diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp index 61dbf9289f..497d35db7e 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp @@ -1006,7 +1006,7 @@ namespace Multiplayer const char* addressStr = mutableAddress; const char* portStr = &(mutableAddress[portSeparator + 1]); int32_t portNumber = atol(portStr); - AZ::Interface::Get()->Connect(addressStr, portNumber); + AZ::Interface::Get()->Connect(addressStr, static_cast(portNumber)); } } AZ_CONSOLEFREEFUNC(connect, AZ::ConsoleFunctorFlags::DontReplicate, "Opens a multiplayer connection to a remote host"); diff --git a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp index d9daced995..1c3eda6709 100644 --- a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp +++ b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp @@ -43,9 +43,9 @@ TEST_F(MultiplayerCompressionTest, MultiplayerCompression_CompressTest) memset(buffer.GetBuffer(), 255, buffer.GetCapacity()); size_t maxCompressedSize = buffer.GetSize() + 32U; - size_t compressedSize = -1; - size_t uncompressedSize = -1; - size_t consumedSize = -1; + size_t compressedSize = std::numeric_limits::max(); + size_t uncompressedSize = std::numeric_limits::max(); + size_t consumedSize = std::numeric_limits::max(); char* pCompressedBuffer = new char[maxCompressedSize]; char* pDecompressedBuffer = new char[buffer.GetSize()]; diff --git a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp index 54e9619eea..ecf2bd0a54 100644 --- a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp +++ b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp @@ -525,7 +525,7 @@ namespace NvCloth const int numVertices = subMeshInfo.m_numVertices; const int firstVertex = subMeshInfo.m_verticesFirstIndex; - if (subMesh.GetVertexCount() != numVertices) + if (subMesh.GetVertexCount() != static_cast(numVertices)) { AZ_Error("ClothComponentMesh", false, "Render mesh to be modified doesn't have the same number of vertices (%d) as the cloth's submesh (%d).", diff --git a/Gems/PhysX/Code/Source/Material.h b/Gems/PhysX/Code/Source/Material.h index 8613be7461..b30b7402c8 100644 --- a/Gems/PhysX/Code/Source/Material.h +++ b/Gems/PhysX/Code/Source/Material.h @@ -89,7 +89,7 @@ namespace PhysX PxMaterialUniquePtr m_pxMaterial; AZ::Crc32 m_surfaceType = 0; - AZ::u32 m_cryEngineSurfaceId = -1; + AZ::u32 m_cryEngineSurfaceId = std::numeric_limits::max(); AZStd::string m_surfaceString; float m_density = 1000.0f; AZ::Color m_debugColor = AZ::Colors::White; diff --git a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp index bdd253d70c..a2866b5a09 100644 --- a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp +++ b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp @@ -139,8 +139,9 @@ namespace PhysX else if (auto* shapeColliderPairList = AZStd::get_if>(&shapeData)) { bool shapeAdded = false; - for (const auto& shapeColliderConfigs : *shapeColliderPairList) + if (!shapeColliderPairList->empty()) { + const auto& shapeColliderConfigs = shapeColliderPairList->front(); auto shapePtr = AZStd::make_shared(*(shapeColliderConfigs.first), *(shapeColliderConfigs.second)); AZStd::visit([shapePtr, &shapeAdded](auto&& body) { diff --git a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp index ba9cc58011..ebdfc5d417 100644 --- a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp +++ b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp @@ -251,7 +251,7 @@ namespace PhysX if (sceneItr != m_sceneList.end()) { - return AzPhysics::SceneHandle((*sceneItr)->GetId(), AZStd::distance(m_sceneList.begin(), sceneItr)); + return AzPhysics::SceneHandle((*sceneItr)->GetId(), static_cast(AZStd::distance(m_sceneList.begin(), sceneItr))); } return AzPhysics::InvalidSceneHandle; } @@ -312,7 +312,7 @@ namespace PhysX { m_sceneRemovedEvent.Signal(handle); m_sceneList[index].reset(); - m_freeSceneSlots.push(index); + m_freeSceneSlots.push(static_cast(index)); } } } diff --git a/Gems/PhysX/Code/Source/SystemComponent.cpp b/Gems/PhysX/Code/Source/SystemComponent.cpp index d8c4b47a2a..42c78d2c1d 100644 --- a/Gems/PhysX/Code/Source/SystemComponent.cpp +++ b/Gems/PhysX/Code/Source/SystemComponent.cpp @@ -396,7 +396,7 @@ namespace PhysX void SystemComponent::SetCollisionLayerName(int index, const AZStd::string& layerName) { - m_physXSystem->SetCollisionLayerName(aznumeric_cast(index), layerName); + m_physXSystem->SetCollisionLayerName(aznumeric_cast(index), layerName); } void SystemComponent::CreateCollisionGroup(const AZStd::string& groupName, const AzPhysics::CollisionGroup& group) diff --git a/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp b/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp index ff112a75dd..5b90ef0004 100644 --- a/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp +++ b/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp @@ -94,7 +94,7 @@ namespace PhysX //invalid scene handle returns empty AzPhysics::SimulatedBodyHandleList emptyBodies = sceneInterface->AddSimulatedBodies(AzPhysics::InvalidSceneHandle, configs); EXPECT_TRUE(emptyBodies.empty()); - emptyBodies = sceneInterface->AddSimulatedBodies(AzPhysics::SceneHandle(2347892347890, 7), configs); + emptyBodies = sceneInterface->AddSimulatedBodies(AzPhysics::SceneHandle(static_cast(2347892347890), AzPhysics::SceneIndex(7)), configs); EXPECT_TRUE(emptyBodies.empty()); //add some rigid bodies @@ -165,7 +165,7 @@ namespace PhysX //invalid scene handle returns null AzPhysics::SimulatedBody* nullBody = sceneInterface->GetSimulatedBodyFromHandle(AzPhysics::InvalidSceneHandle, newBodies[0]); EXPECT_TRUE(nullBody == nullptr); - nullBody = sceneInterface->GetSimulatedBodyFromHandle(AzPhysics::SceneHandle(2347892347890, 7), newBodies[0]); + nullBody = sceneInterface->GetSimulatedBodyFromHandle(AzPhysics::SceneHandle(static_cast(2347892347890), AzPhysics::SceneIndex(7)), newBodies[0]); EXPECT_TRUE(nullBody == nullptr); //invalid simulated body handle returns null diff --git a/Gems/PhysXDebug/Code/Source/SystemComponent.cpp b/Gems/PhysXDebug/Code/Source/SystemComponent.cpp index f9f5d63b2c..65115f2790 100644 --- a/Gems/PhysXDebug/Code/Source/SystemComponent.cpp +++ b/Gems/PhysXDebug/Code/Source/SystemComponent.cpp @@ -879,18 +879,18 @@ namespace PhysXDebug void SystemComponent::InitPhysXColorMappings() { AZ_PROFILE_FUNCTION(Physics); - m_colorMappings.m_defaultColor.FromU32(physx::PxDebugColor::eARGB_GREEN); - m_colorMappings.m_black.FromU32(physx::PxDebugColor::eARGB_BLACK); - m_colorMappings.m_red.FromU32(physx::PxDebugColor::eARGB_RED); - m_colorMappings.m_green.FromU32(physx::PxDebugColor::eARGB_GREEN); - m_colorMappings.m_blue.FromU32(physx::PxDebugColor::eARGB_BLUE); - m_colorMappings.m_yellow.FromU32(physx::PxDebugColor::eARGB_YELLOW); - m_colorMappings.m_magenta.FromU32(physx::PxDebugColor::eARGB_MAGENTA); - m_colorMappings.m_cyan.FromU32(physx::PxDebugColor::eARGB_CYAN); - m_colorMappings.m_white.FromU32(physx::PxDebugColor::eARGB_WHITE); - m_colorMappings.m_grey.FromU32(physx::PxDebugColor::eARGB_GREY); - m_colorMappings.m_darkRed.FromU32(physx::PxDebugColor::eARGB_DARKRED); - m_colorMappings.m_darkGreen.FromU32(physx::PxDebugColor::eARGB_DARKGREEN); - m_colorMappings.m_darkBlue.FromU32(physx::PxDebugColor::eARGB_DARKBLUE); + m_colorMappings.m_defaultColor.FromU32(static_cast(physx::PxDebugColor::eARGB_GREEN)); + m_colorMappings.m_black.FromU32(static_cast(physx::PxDebugColor::eARGB_BLACK)); + m_colorMappings.m_red.FromU32(static_cast(physx::PxDebugColor::eARGB_RED)); + m_colorMappings.m_green.FromU32(static_cast(physx::PxDebugColor::eARGB_GREEN)); + m_colorMappings.m_blue.FromU32(static_cast(physx::PxDebugColor::eARGB_BLUE)); + m_colorMappings.m_yellow.FromU32(static_cast(physx::PxDebugColor::eARGB_YELLOW)); + m_colorMappings.m_magenta.FromU32(static_cast(physx::PxDebugColor::eARGB_MAGENTA)); + m_colorMappings.m_cyan.FromU32(static_cast(physx::PxDebugColor::eARGB_CYAN)); + m_colorMappings.m_white.FromU32(static_cast(physx::PxDebugColor::eARGB_WHITE)); + m_colorMappings.m_grey.FromU32(static_cast(physx::PxDebugColor::eARGB_GREY)); + m_colorMappings.m_darkRed.FromU32(static_cast(physx::PxDebugColor::eARGB_DARKRED)); + m_colorMappings.m_darkGreen.FromU32(static_cast(physx::PxDebugColor::eARGB_DARKGREEN)); + m_colorMappings.m_darkBlue.FromU32(static_cast(physx::PxDebugColor::eARGB_DARKBLUE)); } } diff --git a/Gems/PythonAssetBuilder/Code/Source/Platform/Common/MSVC/pythonassetbuilder_tests_msvc.cmake b/Gems/PythonAssetBuilder/Code/Source/Platform/Common/MSVC/pythonassetbuilder_tests_msvc.cmake index b2c4543e99..7a325ca97e 100644 --- a/Gems/PythonAssetBuilder/Code/Source/Platform/Common/MSVC/pythonassetbuilder_tests_msvc.cmake +++ b/Gems/PythonAssetBuilder/Code/Source/Platform/Common/MSVC/pythonassetbuilder_tests_msvc.cmake @@ -5,13 +5,3 @@ # SPDX-License-Identifier: Apache-2.0 OR MIT # # - -ly_add_source_properties( - SOURCES - Tests/PythonAssetBuilderTest.cpp - Tests/PythonBuilderRegisterTest.cpp - Tests/PythonBuilderCreateJobsTest.cpp - Tests/PythonBuilderProcessJobTest.cpp - PROPERTY COMPILE_OPTIONS - VALUES -bigobj -) diff --git a/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp b/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp index 4d34725e36..a4da836aeb 100644 --- a/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp +++ b/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp @@ -109,7 +109,7 @@ protected: TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_NoDependencies) { - SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); + SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); TestSuccessCaseNoDependencies(exportProduct); } @@ -122,7 +122,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen #endif // AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS AssetBuilderSDK::ProductPathDependency expectedPathDependency(absolutePathToFile, AssetBuilderSDK::ProductPathDependencyType::SourceFile); - SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); + SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); product.m_legacyPathDependencies.push_back(absolutePathToFile); TestSuccessCase(product, &expectedPathDependency); @@ -134,7 +134,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen AssetBuilderSDK::ProductPathDependency expectedPathDependency(relativeDependencyPathToFile, AssetBuilderSDK::ProductPathDependencyType::ProductFile); - SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); + SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); product.m_legacyPathDependencies.push_back(relativeDependencyPathToFile); TestSuccessCase(product, &expectedPathDependency); @@ -150,7 +150,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen const char* absolutePathToFile = "/some/test/file.mtl"; #endif // AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS - SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); + SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); exportProduct.m_legacyPathDependencies.push_back(absolutePathToFile); exportProduct.m_legacyPathDependencies.push_back(relativeDependencyPathToFile); @@ -164,8 +164,8 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductDependency) { AZ::Uuid dependencyId = AZ::Uuid::CreateRandom(); - SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); - exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt)); + SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), AZ::u8(0), AZStd::nullopt); + exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), AZ::u8(0), AZStd::nullopt)); TestSuccessCase(exportProduct, nullptr, &dependencyId); } @@ -173,8 +173,8 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductDe TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductAndPathDependencies) { AZ::Uuid dependencyId = AZ::Uuid::CreateRandom(); - SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); - exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt)); + SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), AZ::u8(0), AZStd::nullopt); + exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), AZ::u8(0), AZStd::nullopt)); const char* relativeDependencyPathToFile = "some/test/file.mtl"; diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp index b789c2e675..e4a95d7d19 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp @@ -568,7 +568,7 @@ namespace ScriptCanvasEditor // Show the selection dialog bool createSlot = false; VariablePaletteRequests::SlotSetup selectedSlotSetup; - QPoint scenePoint(scenePos.GetX(), scenePos.GetY()); + QPoint scenePoint(static_cast(scenePos.GetX()), static_cast(scenePos.GetY())); VariablePaletteRequestBus::BroadcastResult(createSlot, &VariablePaletteRequests::ShowSlotTypeSelector, slot, scenePoint, selectedSlotSetup); bool changed = false; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp index e4569af820..4dae63d71b 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp @@ -2219,7 +2219,7 @@ namespace ScriptCanvas const_cast(this)->InitializeOverloadedStorage(Data::FromAZType(description.m_typeId), eOriginality::Copy); - if (!Data::IsValueType(m_type) && !SatisfiesTraits(description.m_traits)) + if (!Data::IsValueType(m_type) && !SatisfiesTraits(static_cast(description.m_traits))) { return AZ::Failure(AZStd::string("Attempting to convert null value to BehaviorValueParameter that expects reference or value")); } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp index 5aac3715eb..28f0519552 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp @@ -1981,7 +1981,7 @@ namespace ScriptCanvas if (slotIter == m_slots.end()) { - retVal = -1; + retVal = std::numeric_limits::max(); } return retVal; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h index 9cf5d04167..e9586ac83a 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h @@ -21,9 +21,6 @@ #include "Node.h" #include "Attributes.h" -#pragma warning( push ) -#pragma warning( disable : 5046) // 'function' : Symbol involving type with internal linkage not defined - /** * NodeFunctionGeneric.h * @@ -184,9 +181,12 @@ namespace ScriptCanvas : public Node { public: + AZ_PUSH_DISABLE_WARNING(5046, "-Wunknown-warning-option") // 'function' : Symbol involving type with internal linkage not defined AZ_RTTI(((NodeFunctionGenericMultiReturn), "{DC5B1799-6C5B-4190-8D90-EF0C2D1BCE4E}", t_Func, t_Traits), Node); AZ_COMPONENT_INTRUSIVE_DESCRIPTOR_TYPE(NodeFunctionGenericMultiReturn); AZ_COMPONENT_BASE(NodeFunctionGenericMultiReturn, Node); + AZ_POP_DISABLE_WARNING + static const char* GetNodeFunctionName() { @@ -372,5 +372,3 @@ namespace ScriptCanvas } } - -#pragma warning( pop ) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedEBusAPI.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedEBusAPI.cpp index 64553ed5e0..d33f78c8b4 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedEBusAPI.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedEBusAPI.cpp @@ -116,7 +116,7 @@ namespace ScriptCanvas auto nodeable = AZ::ScriptValue::StackRead(lua, k_nodeableIndex); AZ_Assert(nodeable, "Failed to read EBusHandler"); - const int eventIndex = lua_tointeger(lua, k_eventNameIndex); + const int eventIndex = static_cast(lua_tointeger(lua, k_eventNameIndex)); AZ_Assert(eventIndex != -1, "Event index was not found for %s", nodeable->GetEBusName().data()); // install the generic hook for the event nodeable->HandleEvent(eventIndex); @@ -143,7 +143,7 @@ namespace ScriptCanvas auto nodeable = AZ::ScriptValue::StackRead(lua, k_nodeableIndex); AZ_Assert(nodeable, "Failed to read EBusHandler"); - const int eventIndex = lua_tointeger(lua, k_eventNameIndex); + const int eventIndex = static_cast(lua_tointeger(lua, k_eventNameIndex)); AZ_Assert(eventIndex != -1, "Event index was not found for %s", nodeable->GetEBusName().data()); // install the generic hook for the event nodeable->HandleEvent(eventIndex); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/AABBNodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/AABBNodes.h index ec44953ba9..198ff0c421 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/AABBNodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/AABBNodes.h @@ -92,7 +92,7 @@ namespace ScriptCanvas AZ_INLINE AABBType FromCenterRadius(const Vector3Type center, const NumberType radius) { - return AABBType::CreateCenterRadius(center, radius); + return AABBType::CreateCenterRadius(center, static_cast(radius)); } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(FromCenterRadius, k_categoryName, "{5FEFD1BF-DC5B-4AFA-892F-082D92492548}", "returns the AABB with Min = Center - Vector3(radius, radius, radius), Max = Center + Vector3(radius, radius, radius)", "Center", "Radius"); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Math.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Math.cpp index 67c79aaa05..62ca21f1b6 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Math.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Math.cpp @@ -10,8 +10,6 @@ #include -#pragma warning (disable:4503) // decorated name length exceeded, name was truncated - namespace ScriptCanvas { namespace Nodes diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h index f2088dbf6d..8af9ee8ca2 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h @@ -55,7 +55,7 @@ namespace ScriptCanvas AZ_INLINE TransformType FromScale(NumberType scale) { - return TransformType::CreateUniformScale(scale); + return TransformType::CreateUniformScale(static_cast(scale)); } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(FromScale, k_categoryName, "{4B6454BC-015C-41BB-9C78-34ADBCF70187}", "returns a transform which applies the specified uniform Scale, but no rotation or translation", "Scale"); @@ -143,7 +143,7 @@ namespace ScriptCanvas AZ_INLINE TransformType MultiplyByUniformScale(TransformType source, NumberType scale) { - source.MultiplyByUniformScale(scale); + source.MultiplyByUniformScale(static_cast(scale)); return source; } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(MultiplyByUniformScale, k_categoryName, "{90472D62-65A8-40C1-AB08-FA66D793F689}", "returns Source multiplied uniformly by Scale", "Source", "Scale"); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h index 670c9f31a1..c815470540 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h @@ -254,7 +254,7 @@ namespace ScriptCanvas { Vector2Type r = to - from; float length = r.NormalizeWithLength(); - r.SetLength(optionalScale); + r.SetLength(static_cast(optionalScale)); return std::make_tuple(r, length); } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{49A2D7F6-6CD3-420E-8A79-D46B00DB6CED}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h index 492bc83e33..3e70d1fed7 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h @@ -340,7 +340,7 @@ namespace ScriptCanvas { Vector3Type r = to - from; float length = r.NormalizeWithLength(); - r.SetLength(optionalScale); + r.SetLength(static_cast(optionalScale)); return std::make_tuple(r, length); } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{28FBD529-4C9A-4E34-B8A0-A13B5DB3C331}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h index 14256fc969..d7bee1f940 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h @@ -225,7 +225,7 @@ namespace ScriptCanvas { Vector4Type r = to - from; float length = r.NormalizeWithLength(); - r.SetLength(optionalScale); + r.SetLength(static_cast(optionalScale)); return std::make_tuple(r, length); } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp index 4c92c9408a..d11e916d42 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp @@ -114,7 +114,7 @@ namespace ScriptCanvas::Nodeables::Spawning AZ::Vector3 rotationCopy = rotation; AZ::Quaternion rotationQuat = AZ::Quaternion::CreateFromEulerAnglesDegrees(rotationCopy); - entityTransform->SetWorldTM(AZ::Transform(translation, rotationQuat, scale)); + entityTransform->SetWorldTM(AZ::Transform(translation, rotationQuat, static_cast(scale))); } }; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp index c7842f28fd..27a1a95f37 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp @@ -82,12 +82,12 @@ namespace ScriptCanvas void DelayNodeable::Reset(Data::NumberType countdownSeconds, Data::BooleanType looping, Data::NumberType holdTime) { - InitiateCountdown(true, countdownSeconds, looping, holdTime); + InitiateCountdown(true, static_cast(countdownSeconds), looping, static_cast(holdTime)); } void DelayNodeable::Start(Data::NumberType countdownSeconds, Data::BooleanType looping, Data::NumberType holdTime) { - InitiateCountdown(false, countdownSeconds, looping, holdTime); + InitiateCountdown(false, static_cast(countdownSeconds), looping, static_cast(holdTime)); } } } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp index f7f08874db..874e25eb3d 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp @@ -47,7 +47,7 @@ namespace ScriptCanvas void DurationNodeable::Start(Data::NumberType duration) { m_elapsedTime = 0.0f; - m_duration = duration; + m_duration = static_cast(duration); AZ::TickBus::Handler::BusConnect(); } } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Utils/NodeUtils.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Utils/NodeUtils.cpp index d54e9457c1..5aa922d627 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Utils/NodeUtils.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Utils/NodeUtils.cpp @@ -77,8 +77,6 @@ namespace ScriptCanvas { return ConstructCustomNodeIdentifier(scriptCanvasNode->RTTI_GetType()); } - - return NodeTypeIdentifier(0); } NodeTypeIdentifier NodeUtils::ConstructEBusIdentifier(ScriptCanvas::EBusBusId ebusIdentifier) diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorKeyActions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorKeyActions.cpp index a20e674063..4114292938 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorKeyActions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorKeyActions.cpp @@ -30,7 +30,7 @@ namespace ScriptCanvasDeveloper #if defined(AZ_COMPILER_MSVC) INPUT osInput = { 0 }; osInput.type = INPUT_KEYBOARD; - osInput.ki.wVk = m_keyValue; + osInput.ki.wVk = static_cast(m_keyValue); switch (m_keyAction) { diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp index a5ed19a8d7..cf757af1ec 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp @@ -174,8 +174,8 @@ namespace ScriptCanvasDeveloper osInput.type = INPUT_MOUSE; osInput.mi.mouseData = 0; osInput.mi.time = 0; - osInput.mi.dx = targetPoint.x() - currentPosition.x(); - osInput.mi.dy = targetPoint.y() - currentPosition.y(); + osInput.mi.dx = static_cast(targetPoint.x() - currentPosition.x()); + osInput.mi.dy = static_cast(targetPoint.y() - currentPosition.y()); osInput.mi.dwFlags = MOUSEEVENTF_MOVE; ::SendInput(1, &osInput, sizeof(osInput)); diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/CreateElementsActions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/CreateElementsActions.cpp index 71b157e0a9..0fa3765ac3 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/CreateElementsActions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/CreateElementsActions.cpp @@ -539,8 +539,8 @@ namespace ScriptCanvasDeveloper AZ::Vector2 stepDirection = AZ::Vector2::CreateZero(); - stepDirection.SetX(jutDirection.x() * stepSize.GetX()); - stepDirection.SetY(jutDirection.y() * stepSize.GetY()); + stepDirection.SetX(static_cast(jutDirection.x() * stepSize.GetX())); + stepDirection.SetY(static_cast(jutDirection.y() * stepSize.GetY())); m_scenePoint.setX(m_scenePoint.x() + stepDirection.GetX() * 2); } diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/ElementInteractions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/ElementInteractions.cpp index 411d176356..9a8165b5e8 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/ElementInteractions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/ElementInteractions.cpp @@ -78,8 +78,8 @@ namespace ScriptCanvasDeveloper { CompoundAction* compoundAction = aznew CompoundAction(); - QPoint startPoint(m_scenePoint.x() - 5, m_scenePoint.y() - 5); - QPoint endPoint(m_scenePoint.x() + 5, m_scenePoint.y() + 5); + QPoint startPoint(static_cast(m_scenePoint.x() - 5.0), static_cast(m_scenePoint.y() - 5.0)); + QPoint endPoint(static_cast(m_scenePoint.x() + 5.0), static_cast(m_scenePoint.y() + 5.0)); QRect sceneRect = QRect(startPoint, endPoint); @@ -150,8 +150,8 @@ namespace ScriptCanvasDeveloper { CompoundAction* compoundAction = aznew CompoundAction(); - QPoint startPoint(m_scenePoint.x() - 5, m_scenePoint.y() - 5); - QPoint endPoint(m_scenePoint.x() + 5, m_scenePoint.y() + 5); + QPoint startPoint(static_cast(m_scenePoint.x() - 5.0), static_cast(m_scenePoint.y() - 5.0)); + QPoint endPoint(static_cast(m_scenePoint.x() + 5.0), static_cast(m_scenePoint.y() + 5.0)); QRect sceneRect = QRect(startPoint, endPoint); diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/WidgetActions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/WidgetActions.cpp index 5601c89c97..46c98ca48c 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/WidgetActions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/WidgetActions.cpp @@ -40,7 +40,7 @@ namespace ScriptCanvasDeveloper { ClearActionQueue(); - QPoint targetPoint = m_targetEdit->mapToGlobal(QPoint(5, m_targetEdit->height() * 0.5f)); + QPoint targetPoint = m_targetEdit->mapToGlobal(QPoint(5, static_cast(m_targetEdit->height() * 0.5f))); // Cheaty clear for right now. m_targetEdit->clear(); diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/CreateElementsStates.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/CreateElementsStates.cpp index 679cf5690e..bfb36235ef 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/CreateElementsStates.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/CreateElementsStates.cpp @@ -70,7 +70,7 @@ namespace ScriptCanvasDeveloper if (dropPoint) { - QPointF qPoint = QPoint(dropPoint->GetX(), dropPoint->GetY()); + QPointF qPoint = QPoint(static_cast(dropPoint->GetX()), static_cast(dropPoint->GetY())); m_createNodeAction = aznew CreateNodeFromPaletteAction(m_nodePaletteWidget, (*graphId), m_nodeName, qPoint); } break; @@ -218,7 +218,7 @@ namespace ScriptCanvasDeveloper if (dropPoint) { - QPointF qPoint = QPoint(dropPoint->GetX(), dropPoint->GetY()); + QPointF qPoint = QPoint(static_cast(dropPoint->GetX()), static_cast(dropPoint->GetY())); m_createNodeAction = aznew CreateNodeFromContextMenuAction((*graphId), m_nodeName, qPoint); } break; diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp index c8e82bdf90..459dc82542 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp @@ -54,7 +54,7 @@ namespace ScriptCanvasDeveloper qreal verticalPoint = boundingRect.top() + boundingRect.height() * m_offsets.m_verticalPosition; verticalPoint += m_offsets.m_verticalOffset; - AZ::Vector2 scenePoint(horizontalPoint, verticalPoint); + AZ::Vector2 scenePoint(static_cast(horizontalPoint), static_cast(verticalPoint)); GetStateModel()->SetStateData(m_outputId, scenePoint); } } @@ -92,7 +92,7 @@ namespace ScriptCanvasDeveloper qreal verticalPoint = groupBoundingBox.top() + groupBoundingBox.height() * m_offsets.m_verticalPosition; verticalPoint += m_offsets.m_verticalPosition; - AZ::Vector2 scenePoint(horizontalPoint, verticalPoint); + AZ::Vector2 scenePoint(static_cast(horizontalPoint), static_cast(verticalPoint)); GetStateModel()->SetStateData(m_outputId, scenePoint); } else diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/GroupTests.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/GroupTests.cpp index cfe5996530..0428eb6640 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/GroupTests.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/GroupTests.cpp @@ -70,8 +70,8 @@ namespace ScriptCanvasDeveloper AZ::Vector2 modifiedValue = (*position); QRectF sceneBoundingBox = nodeItem->sceneBoundingRect(); - modifiedValue.SetX(position->GetX() + sceneBoundingBox.width() * m_horizontalDimension); - modifiedValue.SetY(position->GetY() + sceneBoundingBox.height() * m_verticalDimension); + modifiedValue.SetX(position->GetX() + static_cast(sceneBoundingBox.width()) * m_horizontalDimension); + modifiedValue.SetY(position->GetY() + static_cast(sceneBoundingBox.height()) * m_verticalDimension); GetStateModel()->SetStateData(m_positionId, modifiedValue); } diff --git a/Gems/ScriptCanvasTesting/Code/CMakeLists.txt b/Gems/ScriptCanvasTesting/Code/CMakeLists.txt index 23c9627e83..29360912d8 100644 --- a/Gems/ScriptCanvasTesting/Code/CMakeLists.txt +++ b/Gems/ScriptCanvasTesting/Code/CMakeLists.txt @@ -87,8 +87,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) NAMESPACE Gem FILES_CMAKE scriptcanvastestingeditor_tests_files.cmake - PLATFORM_INCLUDE_FILES - Platform/Common/${PAL_TRAIT_COMPILER_ID}/scriptcanvastesting_editor_tests_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake INCLUDE_DIRECTORIES PRIVATE . diff --git a/Gems/ScriptCanvasTesting/Code/Platform/Common/Clang/scriptcanvastesting_editor_tests_clang.cmake b/Gems/ScriptCanvasTesting/Code/Platform/Common/Clang/scriptcanvastesting_editor_tests_clang.cmake deleted file mode 100644 index 7a325ca97e..0000000000 --- a/Gems/ScriptCanvasTesting/Code/Platform/Common/Clang/scriptcanvastesting_editor_tests_clang.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -# 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 -# -# diff --git a/Gems/ScriptCanvasTesting/Code/Platform/Common/MSVC/scriptcanvastesting_editor_tests_msvc.cmake b/Gems/ScriptCanvasTesting/Code/Platform/Common/MSVC/scriptcanvastesting_editor_tests_msvc.cmake deleted file mode 100644 index 3ea56febcb..0000000000 --- a/Gems/ScriptCanvasTesting/Code/Platform/Common/MSVC/scriptcanvastesting_editor_tests_msvc.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# -# 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 -# -# - -ly_add_source_properties( - SOURCES - Source/Framework/ScriptCanvasTestUtilities.cpp - Tests/ScriptCanvas_BehaviorContext.cpp - Tests/ScriptCanvas_ContainerSupport.cpp - Tests/ScriptCanvas_Core.cpp - Tests/ScriptCanvas_EventHandlers.cpp - Tests/ScriptCanvas_Math.cpp - Tests/ScriptCanvas_MethodOverload.cpp - Tests/ScriptCanvas_NodeGenerics.cpp - Tests/ScriptCanvas_Regressions.cpp - Tests/ScriptCanvas_RuntimeInterpreted.cpp - Tests/ScriptCanvas_Slots.cpp - Tests/ScriptCanvas_StringNodes.cpp - Tests/ScriptCanvas_UnitTesting.cpp - Tests/ScriptCanvas_Variables.cpp - Tests/ScriptCanvas_VM.cpp - PROPERTY COMPILE_OPTIONS - VALUES -bigobj -) diff --git a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp index 09ebd3d360..cbbe77fbba 100644 --- a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp +++ b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp @@ -13,9 +13,6 @@ #include -#pragma warning( push ) -#pragma warning( disable : 5046) //'function' : Symbol involving type with internal linkage not defined - using namespace ScriptCanvasTests; namespace @@ -110,7 +107,7 @@ namespace ScriptCanvas AZ_INLINE AZ::Vector3 NormalizeWithDefault(const AZ::Vector3& source, const Data::NumberType tolerance, [[maybe_unused]] const Data::BooleanType fakeValueForTestingDefault) { AZ_TracePrintf("SC", "The fake value for testing default is %s\n", fakeValueForTestingDefault ? "True" : "False"); - return source.GetNormalizedSafe(tolerance); + return source.GetNormalizedSafe(static_cast(tolerance)); } void NormalizeWithDefaultInputOverrides(Node& node) { SetDefaultValuesByIndex< 1, 2 >::_(node, 3.3, true); } @@ -163,6 +160,3 @@ TEST_F(ScriptCanvasTestFixture, NodeGenerics) delete graph->GetEntity(); } - - -#pragma warning( pop ) diff --git a/Gems/ScriptedEntityTweener/Code/Include/ScriptedEntityTweener/ScriptedEntityTweenerEnums.h b/Gems/ScriptedEntityTweener/Code/Include/ScriptedEntityTweener/ScriptedEntityTweenerEnums.h index 46bba2f1b9..4c85c18382 100644 --- a/Gems/ScriptedEntityTweener/Code/Include/ScriptedEntityTweener/ScriptedEntityTweenerEnums.h +++ b/Gems/ScriptedEntityTweener/Code/Include/ScriptedEntityTweener/ScriptedEntityTweenerEnums.h @@ -79,7 +79,7 @@ namespace ScriptedEntityTweener struct AnimationProperties { static const float UninitializedParamFloat; - static const unsigned int InvalidCallbackId; + static const int InvalidCallbackId; static const unsigned int InvalidTimelineId; EasingMethod m_easeMethod; diff --git a/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.cpp b/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.cpp index 8be0efdbdc..cd52583ff6 100644 --- a/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.cpp +++ b/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.cpp @@ -15,7 +15,7 @@ namespace ScriptedEntityTweener const AZStd::any ScriptedEntityTweenerTask::QueuedSubtaskInfo::m_emptyInitialValue; const float AnimationProperties::UninitializedParamFloat = FLT_MIN; - const unsigned int AnimationProperties::InvalidCallbackId = 0; + const int AnimationProperties::InvalidCallbackId = 0; const unsigned int AnimationProperties::InvalidTimelineId = 0; ScriptedEntityTweenerTask::ScriptedEntityTweenerTask(AZ::EntityId id) diff --git a/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.h b/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.h index 91528c08c0..a0d453c593 100644 --- a/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.h +++ b/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.h @@ -150,7 +150,7 @@ namespace ScriptedEntityTweener bool IsTimelineIdValid(int timelineId) { - return timelineId != AnimationProperties::InvalidTimelineId; + return timelineId != static_cast(AnimationProperties::InvalidTimelineId); } bool InitializeSubtask(ScriptedEntityTweenerSubtask& subtask, const AZStd::pair initData, AnimationParameters params); diff --git a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp index 5ed409cd0d..961eef2176 100644 --- a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp +++ b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp @@ -30,6 +30,7 @@ #include // OpenMesh includes +AZ_PUSH_DISABLE_WARNING(4702, "-Wunknown-warning-option") // OpenMesh\Core\Utils\Property.hh has unreachable code #include #include #include @@ -37,6 +38,7 @@ #include #include #include +AZ_POP_DISABLE_WARNING namespace OpenMesh { diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 118a515e30..02db57ca21 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -37,11 +37,6 @@ ly_append_configurations_options( # Disabling some warnings /wd4201 # nonstandard extension used: nameless struct/union. This actually became part of the C++11 std, MS has an open issue: https://developercommunity.visualstudio.com/t/warning-level-4-generates-a-bogus-warning-c4201-no/103064 - # Disabling these warnings while they get fixed - /wd4244 # conversion, possible loss of data - /wd4245 # conversion, signed/unsigned mismatch - /wd4389 # comparison, signed/unsigned mismatch - # Enabling warnings that are disabled by default from /W4 # https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=vs-2019 # /we4296 # 'operator': expression is always false @@ -118,8 +113,6 @@ endif() ly_set(LY_CXX_SYSTEM_INCLUDE_CONFIGURATION_FLAG /experimental:external # Turns on "external" headers feature for MSVC compilers /external:W0 # Set warning level in external headers to 0. This is used to suppress warnings 3rdParty libraries which uses the "system_includes" option in their json configuration - /wd4193 # Temporary workaround for the /experiment:external feature generating warning C4193: #pragma warning(pop): no matching '#pragma warning(push)' - /wd4702 # Despite we set it to W0, we found that 3rdParty::OpenMesh was issuing these warnings while using some template functions. Disabling it here does the trick ) if(NOT CMAKE_INCLUDE_SYSTEM_FLAG_CXX) ly_set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX /external:I)