SPEC-2513 Last warnings to get to Warning Level 4

This commit is contained in:
Esteban Papp
2021-08-19 12:23:52 -07:00
committed by GitHub
429 changed files with 1447 additions and 1830 deletions
+42 -38
View File
@@ -70,9 +70,9 @@ static void OnMenuGrid()
inline Vec3 SnapToSize(Vec3 v, double size)
{
Vec3 snapped;
snapped.x = floor((v.x / size) + 0.5) * size;
snapped.y = floor((v.y / size) + 0.5) * size;
snapped.z = floor((v.z / size) + 0.5) * size;
snapped.x = static_cast<f32>(floor((v.x / size) + 0.5) * size);
snapped.y = static_cast<f32>(floor((v.y / size) + 0.5) * size);
snapped.z = static_cast<f32>(floor((v.z / size) + 0.5) * size);
return snapped;
}
@@ -479,8 +479,8 @@ void Q2DViewport::SetZoom(float fZoomFactor, const QPoint& center)
SetZoomFactor(fZoomFactor);
// Calculate new offset to center zoom on mouse.
float x2 = center.x();
float y2 = m_rcClient.height() - center.y();
float x2 = static_cast<float>(center.x());
float y2 = static_cast<float>(m_rcClient.height() - center.y());
ofsx = -(x2 / s2 - x2 / s1 - ofsx);
ofsy = -(y2 / s2 - y2 / s1 - ofsy);
SetScrollOffset(ofsx, ofsy, true);
@@ -544,21 +544,21 @@ void Q2DViewport::Update()
QPoint Q2DViewport::WorldToView(const Vec3& wp) const
{
Vec3 sp = m_screenTM.TransformPoint(wp);
QPoint p = QPoint(sp.x, sp.y);
QPoint p = QPoint(static_cast<int>(sp.x), static_cast<int>(sp.y));
return p;
}
//////////////////////////////////////////////////////////////////////////
QPoint Q2DViewport::WorldToViewParticleEditor(const Vec3& wp, [[maybe_unused]] int width, [[maybe_unused]] int height) const //Eric@conffx implement for the children class of IDisplayViewport
{
Vec3 sp = m_screenTM.TransformPoint(wp);
QPoint p = QPoint(sp.x, sp.y);
QPoint p = QPoint(static_cast<int>(sp.x), static_cast<int>(sp.y));
return p;
}
//////////////////////////////////////////////////////////////////////////
Vec3 Q2DViewport::ViewToWorld(const QPoint& vp, [[maybe_unused]] bool* collideWithTerrain, [[maybe_unused]] bool onlyTerrain, [[maybe_unused]] bool bSkipVegetation, [[maybe_unused]] bool bTestRenderMesh, [[maybe_unused]] bool* collideWithObject) const
{
Vec3 wp = m_screenTM_Inverted.TransformPoint(Vec3(vp.x(), vp.y(), 0));
Vec3 wp = m_screenTM_Inverted.TransformPoint(Vec3(static_cast<f32>(vp.x()), static_cast<f32>(vp.y()), 0.0f));
switch (m_axis)
{
case VPA_XY:
@@ -694,10 +694,10 @@ void Q2DViewport::DrawGrid(DisplayContext& dc, bool bNoXNumbers)
Matrix34 viewTM = GetViewTM().GetInverted() * m_screenTM_Inverted;
Matrix34 viewTM_Inv = m_screenTM * GetViewTM();
Vec3 viewP0 = viewTM.TransformPoint(Vec3(0, 0, 0));
Vec3 viewP1 = viewTM.TransformPoint(Vec3(m_rcClient.width(), m_rcClient.height(), 0));
Vec3 viewP0 = viewTM.TransformPoint(Vec3(0.0f, 0.0f, 0.0f));
Vec3 viewP1 = viewTM.TransformPoint(Vec3(static_cast<f32>(m_rcClient.width()), static_cast<f32>(m_rcClient.height()), 0.0f));
Vec3 viewP_Text = viewTM.TransformPoint(Vec3(0, m_rcClient.height(), 0));
Vec3 viewP_Text = viewTM.TransformPoint(Vec3(0.0f, static_cast<f32>(m_rcClient.height()), 0.0f));
if (m_bShowMinorGridLines && (!m_bAutoAdjustGrids || pixelsPerGrid > 5))
{
@@ -806,8 +806,8 @@ void Q2DViewport::DrawGrid(DisplayContext& dc, bool bNoXNumbers)
{
Vec3 org = m_screenTM.TransformPoint(Vec3(0, 0, 0));
dc.SetColor(AXIS_GRID_COLOR);
dc.DrawLine(Vec3(org.x, 0, fZ), Vec3(org.x, height, fZ));
dc.DrawLine(Vec3(0, org.y, fZ), Vec3(width, org.y, fZ));
dc.DrawLine(Vec3(org.x, 0.0f, fZ), Vec3(org.x, static_cast<f32>(height), fZ));
dc.DrawLine(Vec3(0.0f, org.y, fZ), Vec3(static_cast<f32>(width), org.y, fZ));
}
//////////////////////////////////////////////////////////////////////////
}
@@ -860,18 +860,18 @@ void Q2DViewport::DrawAxis(DisplayContext& dc)
int height = m_rcClient.height();
int size = 25;
Vec3 pos(30, height - 15, 1);
Vec3 pos(30.0f, static_cast<f32>(height - 15), 1.0f);
dc.SetColor(colx.x, colx.y, colx.z, 1);
dc.DrawLine(pos, pos + Vec3(size, 0, 0));
dc.DrawLine(pos, pos + Vec3(static_cast<f32>(size), 0.0f, 0.0f));
dc.SetColor(coly.x, coly.y, coly.z, 1);
dc.DrawLine(pos, pos - Vec3(0, size, 0));
dc.SetColor(coly.x, coly.y, coly.z, 1.0f);
dc.DrawLine(pos, pos - Vec3(0.0f, static_cast<f32>(size), 0.0f));
dc.SetColor(m_colorAxisText);
pos.x -= 3;
pos.y -= 4;
pos.z = 2;
pos.x -= 3.0f;
pos.y -= 4.0f;
pos.z = 2.0f;
dc.Draw2dTextLabel(pos.x + size + 4, pos.y - 2, 1, xstr);
dc.Draw2dTextLabel(pos.x + 3, pos.y - size, 1, ystr);
dc.Draw2dTextLabel(pos.x - 5, pos.y + 5, 1, zstr);
@@ -910,10 +910,14 @@ void Q2DViewport::DrawSelection(DisplayContext& dc)
dc.SetColor(SELECTION_RECT_COLOR.x, SELECTION_RECT_COLOR.y, SELECTION_RECT_COLOR.z, 1);
QPoint p1(m_selectedRect.left(), m_selectedRect.top());
QPoint p2(m_selectedRect.right() + 1, m_selectedRect.bottom() +1);
dc.DrawLine(Vec3(p1.x(), p1.y(), 0), Vec3(p2.x(), p1.y(), 0));
dc.DrawLine(Vec3(p1.x(), p2.y(), 0), Vec3(p2.x(), p2.y(), 0));
dc.DrawLine(Vec3(p1.x(), p1.y(), 0), Vec3(p1.x(), p2.y(), 0));
dc.DrawLine(Vec3(p2.x(), p1.y(), 0), Vec3(p2.x(), p2.y(), 0));
dc.DrawLine(
Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p1.y()), 0.0f), Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p1.y()), 0.0f));
dc.DrawLine(
Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p2.y()), 0.0f), Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p2.y()), 0.0f));
dc.DrawLine(
Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p1.y()), 0.0f), Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p2.y()), 0.0f));
dc.DrawLine(
Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p1.y()), 0.0f), Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p2.y()), 0.0f));
}
}
@@ -1038,16 +1042,16 @@ AABB Q2DViewport::GetWorldBounds(const QPoint& pnt1, const QPoint& pnt2)
{
case VPA_XY:
case VPA_YX:
box.min.z = -maxSize;
box.max.z = maxSize;
box.min.z = static_cast<f32>(-maxSize);
box.max.z = static_cast<f32>(maxSize);
break;
case VPA_XZ:
box.min.y = -maxSize;
box.max.y = maxSize;
box.min.y = static_cast<f32>(-maxSize);
box.max.y = static_cast<f32>(maxSize);
break;
case VPA_YZ:
box.min.x = -maxSize;
box.max.x = maxSize;
box.min.x = static_cast<f32>(-maxSize);
box.max.x = static_cast<f32>(maxSize);
break;
}
return box;
@@ -1076,32 +1080,32 @@ void Q2DViewport::OnDragSelectRectangle(const QRect &rect, [[maybe_unused]] bool
switch (m_axis)
{
case VPA_XY:
box.min.z = -maxSize;
box.max.z = maxSize;
box.min.z = static_cast<f32>(-maxSize);
box.max.z = static_cast<f32>(maxSize);
w = box.max.x - box.min.x;
h = box.max.y - box.min.y;
sprintf_s(szNewStatusText, "X:%g Y:%g W:%g H:%g", org.x, org.y, w, h);
break;
case VPA_YX:
box.min.z = -maxSize;
box.max.z = maxSize;
box.min.z = static_cast<f32>(-maxSize);
box.max.z = static_cast<f32>(maxSize);
w = box.max.y - box.min.y;
h = box.max.x - box.min.x;
sprintf_s(szNewStatusText, "X:%g Y:%g W:%g H:%g", org.x, org.y, w, h);
break;
case VPA_XZ:
box.min.y = -maxSize;
box.max.y = maxSize;
box.min.y = static_cast<f32>(-maxSize);
box.max.y = static_cast<f32>(maxSize);
w = box.max.x - box.min.x;
h = box.max.z - box.min.z;
sprintf_s(szNewStatusText, "X:%g Z:%g W:%g H:%g", org.x, org.z, w, h);
break;
case VPA_YZ:
box.min.x = -maxSize;
box.max.x = maxSize;
box.min.x = static_cast<f32>(-maxSize);
box.max.x = static_cast<f32>(maxSize);
w = box.max.y - box.min.y;
h = box.max.z - box.min.z;
+2 -2
View File
@@ -43,7 +43,7 @@ public:
//evaluate size
XmlString xmlStr = m_undoCtx.node->getXML();
m_size = sizeof(CUndoBaseLibraryItem);
m_size += xmlStr.GetAllocatedMemory();
m_size += static_cast<int>(xmlStr.GetAllocatedMemory());
m_size += m_itemPath.length();
m_size += m_description.length();
}
@@ -87,7 +87,7 @@ protected:
libItem->Serialize(m_redoCtx);
XmlString xmlStr = m_redoCtx.node->getXML();
m_size += xmlStr.GetAllocatedMemory();
m_size += static_cast<int>(xmlStr.GetAllocatedMemory());
}
//load previous saved data
+1 -1
View File
@@ -73,7 +73,7 @@ public:
virtual IDataBaseLibrary* AddLibrary(const QString& library, bool bIsLevelLibrary = false, bool bIsLoading = true) override;
virtual void DeleteLibrary(const QString& library, bool forceDeleteLevel = false) override;
//! Get number of libraries.
virtual int GetLibraryCount() const override { return m_libs.size(); };
virtual int GetLibraryCount() const override { return static_cast<int>(m_libs.size()); };
//! Get number of modified libraries.
virtual int GetModifiedLibraryCount() const override;
+2 -2
View File
@@ -529,8 +529,8 @@ QString CEditorCommandManager::ExecuteAndLogReturn(CCommand* pCommand, const CCo
void CEditorCommandManager::GetArgsFromString(const AZStd::string& argsTxt, CCommand::CArgs& argList)
{
const char quoteSymbol = '\'';
int curPos = 0;
int prevPos = 0;
size_t curPos = 0;
size_t prevPos = 0;
AZStd::vector<AZStd::string> tokens;
AZ::StringFunc::Tokenize(argsTxt, tokens, ' ');
for(AZStd::string& arg : tokens)
+1 -1
View File
@@ -33,7 +33,7 @@ namespace Config
uint32 CConfigGroup::GetVarCount()
{
return m_vars.size();
return static_cast<uint32>(m_vars.size());
}
IConfigVar* CConfigGroup::GetVar(const char* szName)
+1 -6
View File
@@ -72,7 +72,7 @@ void CColorGradientCtrl::resizeEvent(QResizeEvent* event)
m_grid.rect = m_rcGradient;
if (m_bNoZoom)
{
m_grid.zoom.x = m_grid.rect.width();
m_grid.zoom.x = static_cast<f32>(m_grid.rect.width());
}
m_rcKeys = rc;
@@ -106,11 +106,6 @@ QPoint CColorGradientCtrl::KeyToPoint(int nKey)
QPoint CColorGradientCtrl::TimeToPoint(float time)
{
return QPoint(m_grid.WorldToClient(Vec2(time, 0)).x(), m_rcGradient.height() / 2);
QPoint point;
point.rx() = (time - m_fMinTime) * (m_rcGradient.width() / (m_fMaxTime - m_fMinTime)) + m_rcGradient.left();
point.ry() = m_rcGradient.height() / 2;
return point;
}
//////////////////////////////////////////////////////////////////////////
+6 -6
View File
@@ -220,7 +220,7 @@ void ConsoleLineEdit::keyPressEvent(QKeyEvent* ev)
}
// If a history command was reused directly via up arrow enter, do not reset history index
if (m_history.size() > 0 && m_historyIndex < m_history.size() && m_history[m_historyIndex] == str)
if (m_history.size() > 0 && m_historyIndex < static_cast<unsigned int>(m_history.size()) && m_history[m_historyIndex] == str)
{
m_bReusedHistory = true;
}
@@ -833,15 +833,15 @@ static void SetEditorRange(EditorType* editor, IVariable* var)
// If this variable has custom limits set, then use that as the min/max
// Otherwise, the min/max for the input box will be bounded by the type
// limit, but the slider will be constricted to a smaller default range
static const double defaultMin = -100.0f;
static const double defaultMax = 100.0f;
static const float defaultMin = -100.0f;
static const float defaultMax = 100.0f;
if (var->HasCustomLimits())
{
editor->setRange(min, max);
editor->setRange(static_cast<typename EditorType::value_type>(min), static_cast<typename EditorType::value_type>(max));
}
else
{
editor->setSoftRange(defaultMin, defaultMax);
editor->setSoftRange(static_cast<typename EditorType::value_type>(defaultMin), static_cast<typename EditorType::value_type>(defaultMax));
}
// Set the step size. The default variable step is 0, so if it's
@@ -850,7 +850,7 @@ static void SetEditorRange(EditorType* editor, IVariable* var)
// use that for the int values
if (step > 0)
{
editor->spinbox()->setSingleStep(step);
editor->spinbox()->setSingleStep(static_cast<int>(step));
}
else if (auto doubleSpinBox = qobject_cast<AzQtComponents::DoubleSpinBox*>(editor->spinbox()))
{
+12 -12
View File
@@ -175,7 +175,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
penSpikes = penColor;
painter.setPen(Qt::black);
painter.setBrush(Qt::white);
rcGraph = QRect(QPoint(m_graphMargin, m_graphMargin), QPoint(abs(rc.width() - m_graphMargin), abs(rc.height() * m_graphHeightPercent)));
rcGraph = QRect(QPoint(m_graphMargin, m_graphMargin), QPoint(abs(rc.width() - m_graphMargin), static_cast<int>(abs(rc.height() * m_graphHeightPercent))));
painter.drawRect(rcGraph);
painter.setPen(penSpikes);
@@ -193,7 +193,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
{
float scale = 0;
i = ((float)x / graphWidth) * (kNumColorLevels - 1);
i = static_cast<int>(((float)x / graphWidth) * (kNumColorLevels - 1));
i = CLAMP(i, 0, kNumColorLevels - 1);
switch (m_drawMode)
@@ -244,8 +244,8 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
}
}
crtX = rcGraph.left() + x + 1;
painter.drawLine(crtX, graphBottom, crtX, graphBottom - scale * graphHeight);
crtX = static_cast<int>(rcGraph.left() + x + 1);
painter.drawLine(crtX, graphBottom, crtX, static_cast<int>(graphBottom - scale * graphHeight));
}
}
else
@@ -258,9 +258,9 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x)
{
i = ((float)x / graphWidth) * (kNumColorLevels - 1);
i = static_cast<int>(((float)x / graphWidth) * (kNumColorLevels - 1));
i = CLAMP(i, 0, kNumColorLevels - 1);
crtX = rcGraph.left() + x + 1;
crtX = static_cast<UINT>(rcGraph.left() + x + 1);
scaleR = scaleG = scaleB = scaleA = 0;
if (m_maxCount[0])
@@ -283,10 +283,10 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
scaleA = (float)m_count[3][i] / m_maxCount[3];
}
heightR = graphBottom - scaleR * graphHeight;
heightG = graphBottom - scaleG * graphHeight;
heightB = graphBottom - scaleB * graphHeight;
heightA = graphBottom - scaleA * graphHeight;
heightR = static_cast<int>(graphBottom - scaleR * graphHeight);
heightG = static_cast<int>(graphBottom - scaleG * graphHeight);
heightB = static_cast<int>(graphBottom - scaleB * graphHeight);
heightA = static_cast<int>(graphBottom - scaleA * graphHeight);
if (lastHeight[0] == INT_MAX)
{
@@ -350,7 +350,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x)
{
pos = (float)x / graphWidth;
i = (float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels;
i = static_cast<int>((float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels);
i = CLAMP(i, 0, kNumColorLevels - 1);
scale = 0;
@@ -385,7 +385,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
}
painter.setPen(pPen);
painter.drawLine(rcGraph.left() + x + 1, graphBottom, rcGraph.left() + x + 1, graphBottom - scale * graphHeight);
painter.drawLine(rcGraph.left() + static_cast<int>(x) + 1, graphBottom, rcGraph.left() + static_cast<int>(x) + 1, static_cast<int>(graphBottom - scale * graphHeight));
}
// then draw 3 lines so we separate the channels
@@ -422,7 +422,7 @@ void QBitmapPreviewDialogImp::paintEvent(QPaintEvent* e)
curr_x = histogramRect.left() + x + 1;
int i = ((float)x / (graphWidth - 1)) * (CImageHistogram::kNumColorLevels - 1);
int i = static_cast<int>(((float)x / (graphWidth - 1)) * (CImageHistogram::kNumColorLevels - 1));
if (m_histrogramMode == eHistogramMode_SplitRGB)
{
// Filter out to area which we are interested
@@ -446,7 +446,7 @@ void QBitmapPreviewDialogImp::paintEvent(QPaintEvent* e)
scale = (float)m_histogram.m_count[c][i] / m_histogram.m_maxCount[c];
}
int height = graphBottom - graphHeight * scale;
int height = static_cast<int>(graphBottom - graphHeight * scale);
if (last_height == INT_MAX)
{
last_height = height;
@@ -56,8 +56,8 @@ CReflectedVarAnimation AnimationPropertyCtrl::value() const
void AnimationPropertyCtrl::OnApplyClicked()
{
QStringList cSelectedAnimations;
size_t nTotalAnimations(0);
size_t nCurrentAnimation(0);
int nTotalAnimations(0);
int nCurrentAnimation(0);
QString combinedString = GetIEditor()->GetResourceSelectorHost()->GetGlobalSelection("animation");
SplitString(combinedString, cSelectedAnimations, ',');
@@ -203,7 +203,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlo
outBlockPtr = new CVarBlock;
for (size_t i = 0, iGroupCount(node->getChildCount()); i < iGroupCount; ++i)
{
XmlNodeRef groupNode = node->getChild(i);
XmlNodeRef groupNode = node->getChild(static_cast<int>(i));
if (groupNode->haveAttr("hidden"))
{
@@ -308,7 +308,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlo
int nMin(0), nMax(0);
if (child->getAttr("min", nMin) && child->getAttr("max", nMax))
{
intVar->SetLimits(nMin, nMax);
intVar->SetLimits(static_cast<float>(nMin), static_cast<float>(nMax));
}
}
else if (!azstricmp(type, "float"))
@@ -560,7 +560,7 @@ void ReflectedPropertyControl::RequestPropertyContextMenu(AzToolsFramework::Inst
// Popup Menu with Event selection.
QMenu menu;
UINT i = 0;
unsigned int i = 0;
const int ePPA_CustomItemBase = 10; // reserved from 10 to 99
const int ePPA_CustomPopupBase = 100; // reserved from 100 to x*100+100 where x is size of m_customPopupMenuPopups
@@ -595,12 +595,12 @@ void ReflectedPropertyControl::RequestPropertyContextMenu(AzToolsFramework::Inst
action->setData(ePPA_CustomItemBase + i);
}
for (UINT j = 0; j < m_customPopupMenuPopups.size(); ++j)
for (unsigned int j = 0; j < m_customPopupMenuPopups.size(); ++j)
{
SCustomPopupMenu* pMenuInfo = &m_customPopupMenuPopups[j];
QMenu* pSubMenu = menu.addMenu(pMenuInfo->m_text);
for (UINT k = 0; k < pMenuInfo->m_subMenuText.size(); ++k)
for (UINT k = 0; k < static_cast<UINT>(pMenuInfo->m_subMenuText.size()); ++k)
{
const UINT uID = ePPA_CustomPopupBase + ePPA_CustomPopupBase * j + k;
QAction *action = pSubMenu->addAction(pMenuInfo->m_subMenuText[k]);
@@ -39,20 +39,20 @@ namespace {
hardMin = desc.m_bHardMin;
hardMax = desc.m_bHardMax;
}
reflectedVar->m_softMinVal = min;
reflectedVar->m_softMaxVal = max;
reflectedVar->m_softMinVal = static_cast<R>(min);
reflectedVar->m_softMaxVal = static_cast<R>(max);
if (hardMin)
{
reflectedVar->m_minVal = min;
reflectedVar->m_minVal = static_cast<R>(min);
}
else
{
reflectedVar->m_minVal = std::numeric_limits<int>::lowest();
reflectedVar->m_minVal = std::numeric_limits<R>::lowest();
}
if (hardMax)
{
reflectedVar->m_maxVal = max;
reflectedVar->m_maxVal = static_cast<R>(max);
}
else
{
@@ -64,9 +64,9 @@ namespace {
../Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp:59:38: error: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Werror,-Wimplicit-int-float-conversion]
reflectedVar->m_maxVal = std::numeric_limits<int>::max();
*/
reflectedVar->m_maxVal = static_cast<float>(std::numeric_limits<int>::max());
reflectedVar->m_maxVal = static_cast<R>(std::numeric_limits<int>::max());
}
reflectedVar->m_stepSize = step;
reflectedVar->m_stepSize = static_cast<R>(step);
}
}
@@ -95,9 +95,9 @@ void ReflectedVarIntAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
{
int intValue;
pVariable->Get(intValue);
value = intValue;
value = static_cast<float>(intValue);
}
m_reflectedVar->m_value = std::round(value * m_valueMultiplier);
m_reflectedVar->m_value = static_cast<int>(std::round(value * m_valueMultiplier));
}
void ReflectedVarIntAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
@@ -362,14 +362,14 @@ void ReflectedVarColorAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
Vec3 v(0, 0, 0);
pVariable->Get(v);
const QColor col = ColorLinearToGamma(ColorF(v.x, v.y, v.z));
m_reflectedVar->m_color.Set(col.redF(), col.greenF(), col.blueF());
m_reflectedVar->m_color.Set(static_cast<float>(col.redF()), static_cast<float>(col.greenF()), static_cast<float>(col.blueF()));
}
else
{
int col(0);
pVariable->Get(col);
const QColor qcolor = ColorToQColor((uint32)col);
m_reflectedVar->m_color.Set(qcolor.redF(), qcolor.greenF(), qcolor.blueF());
m_reflectedVar->m_color.Set(static_cast<float>(qcolor.redF()), static_cast<float>(qcolor.greenF()), static_cast<float>(qcolor.blueF()));
}
}
@@ -382,9 +382,9 @@ void ReflectedVarColorAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
}
else
{
int ir = m_reflectedVar->m_color.GetX() * 255.0f;
int ig = m_reflectedVar->m_color.GetY() * 255.0f;
int ib = m_reflectedVar->m_color.GetZ() * 255.0f;
int ir = static_cast<int>(m_reflectedVar->m_color.GetX() * 255.0f);
int ig = static_cast<int>(m_reflectedVar->m_color.GetY() * 255.0f);
int ib = static_cast<int>(m_reflectedVar->m_color.GetZ() * 255.0f);
pVariable->Set(static_cast<int>(RGB(ir, ig, ib)));
}
+2 -2
View File
@@ -86,13 +86,13 @@ QPoint CSplineCtrl::KeyToPoint(int nKey)
QPoint CSplineCtrl::TimeToPoint(float time)
{
QPoint point;
point.setX((time - m_fMinTime) * (m_rcSpline.width() / (m_fMaxTime - m_fMinTime)) + m_rcSpline.left());
point.setX(static_cast<int>((time - m_fMinTime) * (m_rcSpline.width() / (m_fMaxTime - m_fMinTime)) + m_rcSpline.left()));
float val = 0;
if (m_pSpline)
{
m_pSpline->InterpolateFloat(time, val);
}
point.setY((floor((m_fMaxValue - val) * (m_rcSpline.height() / (m_fMaxValue - m_fMinValue)) + 0.5f) + m_rcSpline.top()));
point.setY(static_cast<int>((floor((m_fMaxValue - val) * (m_rcSpline.height() / (m_fMaxValue - m_fMinValue)) + 0.5f) + m_rcSpline.top())));
return point;
}
+28 -28
View File
@@ -641,7 +641,7 @@ QPoint AbstractSplineWidget::TimeToPoint(float time, ISplineInterpolator* pSplin
//////////////////////////////////////////////////////////////////////////
float AbstractSplineWidget::TimeToXOfs(float x)
{
return WorldToClient(Vec2(float(x), 0.0f)).x();
return static_cast<float>(WorldToClient(Vec2(float(x), 0.0f)).x());
}
//////////////////////////////////////////////////////////////////////////
@@ -832,8 +832,8 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float
int nTotalNumberOfDimensions(0);
int nCurrentDimension(0);
int left = TimeToXOfs(startTime);//rcClip.left;
int right = TimeToXOfs(endTime);//rcClip.right;
int left = static_cast<int>(TimeToXOfs(startTime));//rcClip.left;
int right = static_cast<int>(TimeToXOfs(endTime));//rcClip.right;
QPoint p0 = TimeToPoint(pSpline->GetKeyTime(0), pSpline);
QPoint p1 = TimeToPoint(pSpline->GetKeyTime(pSpline->GetKeyCount() - 1), pSpline);
@@ -898,7 +898,7 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float
if ((x == right && pointsInLine >= 0) || (pointsInLine > 0 && fabs(lineStart.y() + gradient * (pt.x() - lineStart.x()) - pt.y()) > 1.0f))
{
lineStart = QPoint(pt.x() - 1, lineStart.y() + gradient * (pt.x() - 1 - lineStart.x()));
lineStart = QPoint(pt.x() - 1, static_cast<int>(lineStart.y() + gradient * (pt.x() - 1 - lineStart.x())));
path.lineTo(lineStart);
gradient = float(pt.y() - lineStart.y()) / (pt.x() - lineStart.x());
pointsInLine = 1;
@@ -1063,7 +1063,7 @@ void SplineWidget::DrawTimeMarker(QPainter* painter)
float x = TimeToXOfs(m_fTimeMarker);
if (x >= m_rcSpline.left() && x <= m_rcSpline.right() + 1)
{
painter->drawLine(x, m_rcSpline.top(), x, m_rcSpline.bottom() + 1);
painter->drawLine(static_cast<int>(x), m_rcSpline.top(), static_cast<int>(x), m_rcSpline.bottom() + 1);
}
painter->setPen(pOldPen);
}
@@ -1583,7 +1583,7 @@ bool AbstractSplineWidget::IsKeySelected(ISplineInterpolator* pSpline, int nKey,
int AbstractSplineWidget::GetNumSelected()
{
int nSelected = 0;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
if (ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline)
{
@@ -1818,7 +1818,7 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point
}
// For each Spline...
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
ISplineInterpolator* pDetailSpline = m_splines[splineIndex].pDetailSpline;
@@ -1856,7 +1856,7 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point
// Check tangent handles first.
{
QPoint incomingHandlePt, outgoingHandlePt, pt;
if (GetTangentHandlePts(incomingHandlePt, pt, outgoingHandlePt, splineIndex, i, nCurrentDimension))
if (GetTangentHandlePts(incomingHandlePt, pt, outgoingHandlePt, static_cast<int>(splineIndex), static_cast<int>(i), nCurrentDimension))
{
// For the incoming handle
if (abs(incomingHandlePt.x() - point.x()) < 4 && abs(incomingHandlePt.y() - point.y()) < 4)
@@ -1973,7 +1973,7 @@ void AbstractSplineWidget::ScaleAmplitudeKeys(float time, float startValue, floa
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2077,7 +2077,7 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT
float affectedRangeMin = FLT_MAX;
float affectedRangeMax = -FLT_MAX;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2145,8 +2145,8 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT
}
}
int rangeMin = TimeToXOfs(affectedRangeMin);
int rangeMax = TimeToXOfs(affectedRangeMax);
int rangeMin = static_cast<int>(TimeToXOfs(affectedRangeMin));
int rangeMax = static_cast<int>(TimeToXOfs(affectedRangeMax));
if (m_timeRange.start == affectedRangeMin)
{
@@ -2184,7 +2184,7 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue)
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2223,7 +2223,7 @@ void AbstractSplineWidget::MoveSelectedKeys(Vec2 offset, bool copyKeys)
}
// For each spline...
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2298,7 +2298,7 @@ void AbstractSplineWidget::RemoveSelectedKeys()
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2338,7 +2338,7 @@ void AbstractSplineWidget::RemoveSelectedKeyTimesImpl()
StoreUndo();
SendNotifyEvent(SPLN_BEFORE_CHANGE);
for (int splineIndex = 0, end = m_splines.size(); splineIndex < end; ++splineIndex)
for (size_t splineIndex = 0, end = m_splines.size(); splineIndex < end; ++splineIndex)
{
std::vector<KeyTime>::iterator itTime = m_keyTimes.begin(), endTime = m_keyTimes.end();
for (int keyIndex = 0, endIndex = m_splines[splineIndex].pSpline->GetKeyCount(); keyIndex < endIndex; )
@@ -2376,9 +2376,9 @@ void AbstractSplineWidget::RedrawWindowAroundMarker()
{
UpdateKeyTimes();
std::vector<KeyTime>::iterator itKeyTime = std::lower_bound(m_keyTimes.begin(), m_keyTimes.end(), KeyTime(m_fTimeMarker, 0));
int keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size());
int redrawRangeStart = (keyTimeIndex >= 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time) : m_rcSpline.left());
int redrawRangeEnd = (keyTimeIndex < int(m_keyTimes.size()) - 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time) : m_rcSpline.right() + 1);
size_t keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size());
int redrawRangeStart = (keyTimeIndex >= 2 ? static_cast<int>(TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time)) : m_rcSpline.left());
int redrawRangeEnd = (keyTimeIndex < m_keyTimes.size() - 2 ? static_cast<int>(TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time)) : m_rcSpline.right() + 1);
QRect rc(QPoint(redrawRangeStart, m_rcSpline.top()), QPoint(redrawRangeEnd, m_rcSpline.bottom() + 1) - QPoint(1, 1));
rc = rc.normalized().intersected(m_rcSpline);
@@ -2478,7 +2478,7 @@ void AbstractSplineWidget::ClearSelection()
{
ConditionalStoreUndo();
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2521,7 +2521,7 @@ void AbstractSplineWidget::StoreUndo()
if (CUndo::IsRecording() && !m_pCurrentUndo)
{
std::vector<ISplineInterpolator*> splines(m_splines.size());
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
splines[splineIndex] = m_splines[splineIndex].pSpline;
}
@@ -2564,7 +2564,7 @@ void AbstractSplineWidget::DuplicateSelectedKeys()
using KeysToAddContainer = std::vector<CKeyCopyInfo>;
KeysToAddContainer keysToInsert;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2664,7 +2664,7 @@ void AbstractSplineWidget::KeyAll()
//////////////////////////////////////////////////////////////////////////
void AbstractSplineWidget::SelectAll()
{
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -2815,7 +2815,7 @@ void AbstractSplineWidget::SelectRectangle(const QRect& rc, bool bSelect)
{
std::swap(t0, t1);
}
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
ISplineInterpolator* pDetailSpline = m_splines[splineIndex].pDetailSpline;
@@ -3031,7 +3031,7 @@ void AbstractSplineWidget::ModifySelectedKeysFlags(int nRemoveFlags, int nAddFla
SendNotifyEvent(SPLN_BEFORE_CHANGE);
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -3188,7 +3188,7 @@ void AbstractSplineWidget::GotoNextKey(bool previousKey)
{
bool boFoundTheSelectedKey(false);
for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
for (int i = 0; i < pSpline->GetKeyCount(); i++)
@@ -3230,7 +3230,7 @@ void AbstractSplineWidget::GotoNextKey(bool previousKey)
}
else
{
for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
@@ -3281,7 +3281,7 @@ void AbstractSplineWidget::RemoveAllKeysButThis()
{
std::vector<int> keys;
for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
+1 -1
View File
@@ -98,7 +98,7 @@ public:
void AddSpline(ISplineInterpolator * pSpline, ISplineInterpolator * pDetailSpline, QColor anColorArray[4]);
void RemoveSpline(ISplineInterpolator* pSpline);
void RemoveAllSplines();
int GetSplineCount() const { return m_splines.size(); }
int GetSplineCount() const { return static_cast<int>(m_splines.size()); }
ISplineInterpolator* GetSpline(int nIndex) const { return m_splines[nIndex].pSpline; }
void SetTimeMarker(float fTime);
+1 -1
View File
@@ -53,7 +53,7 @@ void CTextEditorCtrl::LoadFile(const QString& sFileName)
size_t length = file.GetLength();
QByteArray text;
text.resize(length);
text.resize(static_cast<int>(length));
file.ReadRaw(text.data(), length);
setPlainText(text);
+7 -7
View File
@@ -25,9 +25,9 @@ static const QColor ltgrayCol = QColor(110, 110, 110);
QColor InterpolateColor(const QColor& c1, const QColor& c2, float fraction)
{
const int r = (c2.red() - c1.red()) * fraction + c1.red();
const int g = (c2.green() - c1.green()) * fraction + c1.green();
const int b = (c2.blue() - c1.blue()) * fraction + c1.blue();
const int r = static_cast<int>(static_cast<float>(c2.red() - c1.red()) * fraction + c1.red());
const int g = static_cast<int>(static_cast<float>(c2.green() - c1.green()) * fraction + c1.green());
const int b = static_cast<int>(static_cast<float>(c2.blue() - c1.blue()) * fraction + c1.blue());
return QColor(r, g, b);
}
@@ -120,7 +120,7 @@ float TimelineWidget::SnapTime(float time)
{
double t = floor((double)time * m_ticksStep + 0.5);
t = t / m_ticksStep;
return t;
return static_cast<float>(t);
}
//////////////////////////////////////////////////////////////////////////
@@ -153,10 +153,10 @@ void TimelineWidget::DrawTicks(QPainter* painter)
painter->setPen(redpen);
int x = TimeToClient(m_fTimeMarker);
painter->setBrush(Qt::NoBrush);
painter->drawRect(QRect(QPoint(x - 3, rc.top()), QPoint(x + 2, rc.bottom())));
painter->drawRect(QRect(QPoint(x - 3, static_cast<int>(rc.top())), QPoint(x + 2, static_cast<int>(rc.bottom()))));
painter->setPen(redpen);
painter->drawLine(x, rc.top(), x, rc.bottom());
painter->drawLine(x, static_cast<int>(rc.top()), x, static_cast<int>(rc.bottom()));
painter->setBrush(Qt::NoBrush);
// Draw vertical line showing current time.
@@ -190,7 +190,7 @@ void TimelineWidget::DrawTicks(QPainter* painter)
float keyTime = (m_pKeyTimeSet ? m_pKeyTimeSet->GetKeyTime(keyTimeIndex) : 0.0f);
int x2 = TimeToClient(keyTime);
painter->drawRect(QRect(QPoint(x2 - 1, rc.top()), QPoint(x2 + 2, rc.bottom())));
painter->drawRect(QRect(QPoint(x2 - 1, static_cast<int>(rc.top())), QPoint(x2 + 2, static_cast<int>(rc.bottom()))));
}
painter->setPen(pOldPen);
+4 -4
View File
@@ -613,7 +613,7 @@ public:
}
// Get boolean options
const int numOptions = options.size();
const int numOptions = static_cast<int>(options.size());
for (int i = 0; i < numOptions; ++i)
{
options[i].second = parser.isSet(options[i].first);
@@ -3240,7 +3240,7 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
{
QFileInfo info(fullyQualifiedLevelName);
const AZStd::string rawProjectDirectory = Path::GetEditingGameDataFolder();
const QString projectDirectory = QDir::toNativeSeparators(QString::fromUtf8(rawProjectDirectory.data(), rawProjectDirectory.size()));
const QString projectDirectory = QDir::toNativeSeparators(QString::fromUtf8(rawProjectDirectory.data(), static_cast<int>(rawProjectDirectory.size())));
const QString elidedLevelName = QStringLiteral("%1...%2").arg(levelName.left(10)).arg(levelName.right(10));
const QString elidedLevelFileName = QStringLiteral("%1...%2").arg(info.fileName().left(10)).arg(info.fileName().right(10));
const QString message = QObject::tr(
@@ -3380,7 +3380,7 @@ CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* lpszFileName)
void CCryEditApp::OnResourcesReduceworkingset()
{
#ifdef WIN32 // no such thing on macOS
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
SetProcessWorkingSetSize(GetCurrentProcess(), std::numeric_limits<SIZE_T>::max(), std::numeric_limits<SIZE_T>::max());
#endif
}
@@ -3922,7 +3922,7 @@ void CCryEditApp::OpenLUAEditor(const char* files)
void CCryEditApp::PrintAlways(const AZStd::string& output)
{
m_stdoutRedirection.WriteBypassingRedirect(output.c_str(), output.size());
m_stdoutRedirection.WriteBypassingRedirect(output.c_str(), static_cast<unsigned int>(output.size()));
}
QString CCryEditApp::GetRootEnginePath() const
+2 -2
View File
@@ -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<int>(entitySaveBuffer.size()));
// Save XML archive to pak file.
bool bSaved = xmlAr.SaveToPak(Path::GetPath(tempSaveFile), pakFile);
@@ -2055,7 +2055,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
}
// QVariant will not convert a void * to int, so do it manually.
int nKey = reinterpret_cast<intptr_t>(pVar->GetUserData().value<void*>());
int nKey = static_cast<int>(reinterpret_cast<intptr_t>(pVar->GetUserData().value<void*>()));
int nGroup = (nKey & 0xFFFF0000) >> 16;
int nChild = (nKey & 0x0000FFFF);
+3 -3
View File
@@ -46,7 +46,7 @@ void CDisplaySettings::SaveRegistry()
SaveValue("Settings", "RenderFlags", m_renderFlags);
SaveValue("Settings", "DisplayFlags", m_flags & SETTINGS_SERIALIZABLE_FLAGS_MASK);
SaveValue("Settings", "DebugFlags", m_debugFlags);
SaveValue("Settings", "LabelsDistance", m_labelsDistance);
SaveValue("Settings", "LabelsDistance", static_cast<int>(m_labelsDistance));
}
void CDisplaySettings::LoadRegistry()
@@ -56,9 +56,9 @@ void CDisplaySettings::LoadRegistry()
LoadValue("Settings", "DisplayFlags", m_flags);
m_flags &= SETTINGS_SERIALIZABLE_FLAGS_MASK;
LoadValue("Settings", "DebugFlags", m_debugFlags);
int temp = m_labelsDistance;
int temp = static_cast<int>(m_labelsDistance);
LoadValue("Settings", "LabelsDistance", temp);
m_labelsDistance = temp;
m_labelsDistance = static_cast<float>(temp);
gSettings.objectHideMask = m_objectHideMask;
}
@@ -44,14 +44,14 @@ bool SubObjectSelectionReferenceFrameCalculator::GetFrame(Matrix34& refFrame)
if (this->nNormals > 0)
{
this->normal = this->normal / this->nNormals;
this->normal = this->normal / static_cast<float>(this->nNormals);
if (!this->normal.IsZero())
{
this->normal.Normalize();
}
// Average position.
this->pos = this->pos / this->nNormals;
this->pos = this->pos / static_cast<float>(this->nNormals);
refFrame.SetTranslation(this->pos);
}
-12
View File
@@ -33,18 +33,6 @@
#include <Include/SandboxAPI.h>
#include <Include/EditorCoreAPI.h>
// Warnings in STL
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters in the debug information.
#pragma warning (disable : 4244) // conversion from 'long' to 'float', possible loss of data
#pragma warning (disable : 4018) // signed/unsigned mismatch
// Disable warning when a function returns a value inside an __asm block
#pragma warning (disable : 4035)
//////////////////////////////////////////////////////////////////////////
// 64-bits related warnings.
#pragma warning (disable : 4267) // conversion from 'size_t' to 'int', possible loss of data
//////////////////////////////////////////////////////////////////////////
// Simple type definitions.
//////////////////////////////////////////////////////////////////////////
@@ -201,20 +201,24 @@ void CEditorPreferencesPage_ViewportGeneral::OnApply()
ds->SetLabelsDistance(m_textLabels.m_labelsDistance);
gSettings.objectColorSettings.fChildGeomAlpha = m_selectionPreviewColor.m_childObjectGeomAlpha;
gSettings.objectColorSettings.entityHighlight = QColor(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f,
m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f,
m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f);
gSettings.objectColorSettings.groupHighlight = QColor(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f,
m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f,
m_selectionPreviewColor.m_colorGroupBBox.GetB() * 255.0f);
gSettings.objectColorSettings.entityHighlight = QColor(
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f));
gSettings.objectColorSettings.groupHighlight = QColor(
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetB() * 255.0f));
gSettings.objectColorSettings.fBBoxAlpha = m_selectionPreviewColor.m_fBBoxAlpha;
gSettings.objectColorSettings.fGeomAlpha = m_selectionPreviewColor.m_fgeomAlpha;
gSettings.objectColorSettings.geometryHighlightColor = QColor(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f,
m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f,
m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f);
gSettings.objectColorSettings.solidBrushGeometryColor = QColor(m_selectionPreviewColor.m_solidBrushGeometryColor.GetR() * 255.0f,
m_selectionPreviewColor.m_solidBrushGeometryColor.GetG() * 255.0f,
m_selectionPreviewColor.m_solidBrushGeometryColor.GetB() * 255.0f);
gSettings.objectColorSettings.geometryHighlightColor = QColor(
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f));
gSettings.objectColorSettings.solidBrushGeometryColor = QColor(
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetR() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetG() * 255.0f),
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetB() * 255.0f));
}
void CEditorPreferencesPage_ViewportGeneral::InitializeSettings()
@@ -252,10 +256,10 @@ void CEditorPreferencesPage_ViewportGeneral::InitializeSettings()
m_textLabels.m_labelsDistance = ds->GetLabelsDistance();
m_selectionPreviewColor.m_childObjectGeomAlpha = gSettings.objectColorSettings.fChildGeomAlpha;
m_selectionPreviewColor.m_colorEntityBBox.Set(gSettings.objectColorSettings.entityHighlight.redF(), gSettings.objectColorSettings.entityHighlight.greenF(), gSettings.objectColorSettings.entityHighlight.blueF(), 1.0f);
m_selectionPreviewColor.m_colorGroupBBox.Set(gSettings.objectColorSettings.groupHighlight.redF(), gSettings.objectColorSettings.groupHighlight.greenF(), gSettings.objectColorSettings.groupHighlight.blueF(), 1.0f);
m_selectionPreviewColor.m_colorEntityBBox.Set(static_cast<float>(gSettings.objectColorSettings.entityHighlight.redF()), static_cast<float>(gSettings.objectColorSettings.entityHighlight.greenF()), static_cast<float>(gSettings.objectColorSettings.entityHighlight.blueF()), 1.0f);
m_selectionPreviewColor.m_colorGroupBBox.Set(static_cast<float>(gSettings.objectColorSettings.groupHighlight.redF()), static_cast<float>(gSettings.objectColorSettings.groupHighlight.greenF()), static_cast<float>(gSettings.objectColorSettings.groupHighlight.blueF()), 1.0f);
m_selectionPreviewColor.m_fBBoxAlpha = gSettings.objectColorSettings.fBBoxAlpha;
m_selectionPreviewColor.m_fgeomAlpha = gSettings.objectColorSettings.fGeomAlpha;
m_selectionPreviewColor.m_geometryHighlightColor.Set(gSettings.objectColorSettings.geometryHighlightColor.redF(), gSettings.objectColorSettings.geometryHighlightColor.greenF(), gSettings.objectColorSettings.geometryHighlightColor.blueF(), 1.0f);
m_selectionPreviewColor.m_solidBrushGeometryColor.Set(gSettings.objectColorSettings.solidBrushGeometryColor.redF(), gSettings.objectColorSettings.solidBrushGeometryColor.greenF(), gSettings.objectColorSettings.solidBrushGeometryColor.blueF(), 1.0f);
m_selectionPreviewColor.m_geometryHighlightColor.Set(static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.redF()), static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.greenF()), static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.blueF()), 1.0f);
m_selectionPreviewColor.m_solidBrushGeometryColor.Set(static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.redF()), static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.greenF()), static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.blueF()), 1.0f);
}
+27 -21
View File
@@ -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<int>(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<int>(m_safeFrame.left() + widthDifference * 0.5f));
m_safeFrame.setRight(static_cast<int>(m_safeFrame.right() - widthDifference * 0.5f));
}
else
{
float maxSafeFrameHeight = m_safeFrame.width() / targetAspectRatio;
float heightDifference = m_safeFrame.height() - maxSafeFrameHeight;
m_safeFrame.setTop(m_safeFrame.top() + heightDifference * 0.5);
m_safeFrame.setBottom(m_safeFrame.bottom() - heightDifference * 0.5);
m_safeFrame.setTop(static_cast<int>(m_safeFrame.top() + heightDifference * 0.5f));
m_safeFrame.setBottom(static_cast<int>(m_safeFrame.bottom() - heightDifference * 0.5f));
}
m_safeFrame.adjust(0, 0, -1, -1); // <-- aesthetic improvement.
const float SAFE_ACTION_SCALE_FACTOR = 0.05f;
m_safeAction = m_safeFrame;
m_safeAction.adjust(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR,
-m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, -m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR);
m_safeAction.adjust(
static_cast<int>(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR),
static_cast<int>(m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR),
static_cast<int>(-m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR),
static_cast<int>(-m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR));
const float SAFE_TITLE_SCALE_FACTOR = 0.1f;
m_safeTitle = m_safeFrame;
m_safeTitle.adjust(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR,
-m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, -m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR);
m_safeTitle.adjust(
static_cast<int>(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR),
static_cast<int>(m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR),
static_cast<int>(-m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR),
static_cast<int>(-m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR));
}
//////////////////////////////////////////////////////////////////////////
@@ -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<float>(frame.left() + i), static_cast<float>(frame.top() + i), 0.0f);
AZ::Vector3 bottomRight(static_cast<float>(frame.right() - i), static_cast<float>(frame.bottom() - i), 0.0f);
m_debugDisplay->DrawWireBox(topLeft, bottomRight);
}
}
@@ -1494,7 +1500,7 @@ bool EditorViewportWidget::AddCameraMenuItems(QMenu* menu)
Camera::CameraBus::BroadcastResult(getCameraResults, &Camera::CameraRequests::GetCameras);
QVector<QAction*> additionalCameras;
additionalCameras.reserve(getCameraResults.values.size());
additionalCameras.reserve(static_cast<int>(getCameraResults.values.size()));
for (const AZ::EntityId& entityId : getCameraResults.values)
{
@@ -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<uint32>(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<float>(QHighDpiScaling::factor(windowHandle()->screen()));
out.y /= static_cast<float>(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<int>((x / 100) * width);
p.ry() = static_cast<int>((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<float>(screenPosition.m_x);
*sy = static_cast<float>(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<float>(vp.x()), static_cast<float>(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<float>(vp.x()), static_cast<float>(rc.bottom() - vp.y()), 1.0f, &wx, &wy, &wz);
if (!_finite(wx) || !_finite(wy) || !_finite(wz))
{
return;
+4 -4
View File
@@ -45,7 +45,7 @@ bool GetPositionFromString(QString er, float* x, float* y, float* z)
}
if (ind > 0)
{
*x = er.mid(0, ind).toDouble();
*x = er.mid(0, ind).toFloat();
er = er.mid(ind);
er.remove(QRegExp("^[ ,]*"));
@@ -57,12 +57,12 @@ bool GetPositionFromString(QString er, float* x, float* y, float* z)
}
if (ind > 0)
{
*y = er.mid(0, ind).toDouble();
*y = er.mid(0, ind).toFloat();
er = er.mid(ind);
er.remove(QRegExp("^[ ,]*"));
if (er.length())
{
*z = er.toDouble();
*z = er.toFloat();
return true;
}
}
@@ -119,7 +119,7 @@ void CErrorReportTableModel::setErrorReport(CErrorReport* report)
int CErrorReportTableModel::rowCount(const QModelIndex& parent) const
{
return parent.isValid() ? 0 : m_errorRecords.size();
return parent.isValid() ? 0 : static_cast<int>(m_errorRecords.size());
}
int CErrorReportTableModel::columnCount(const QModelIndex& parent) const
+4 -13
View File
@@ -40,15 +40,6 @@
namespace
{
void SetTexture(Export::TPath& outName, IRenderShaderResources* pRes, int nSlot)
{
SEfResTexture* pTex = pRes->GetTextureResource(nSlot);
if (pTex)
{
azstrcat(outName, AZ_ARRAY_SIZE(outName), Path::GamePathToFullPath(pTex->m_Name.c_str()).toUtf8().data());
}
}
inline Export::Vector3D Vec3ToVector3D(const Vec3& vec)
{
Export::Vector3D ret;
@@ -302,7 +293,7 @@ void CExportManager::ProcessEntityAnimationTrack(
return;
}
for (int trackNumber = 0; trackNumber < pEntityTrack->GetChildCount(); ++trackNumber)
for (unsigned int trackNumber = 0; trackNumber < pEntityTrack->GetChildCount(); ++trackNumber)
{
CTrackViewTrack* pSubTrack = static_cast<CTrackViewTrack*>(pEntityTrack->GetChild(trackNumber));
@@ -964,7 +955,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo
}
const uint numKeys = pSequenceTrack->GetKeyCount();
for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex)
for (uint keyIndex = 0; keyIndex < numKeys; ++keyIndex)
{
const CTrackViewKeyHandle& keyHandle = pSequenceTrack->GetKey(keyIndex);
ISequenceKey sequenceKey;
@@ -1043,7 +1034,7 @@ bool CExportManager::AddSelectedRegionObjects()
std::vector<CBaseObject*> objects;
GetIEditor()->GetObjectManager()->FindObjectsInAABB(box, objects);
int numObjects = objects.size();
const size_t numObjects = objects.size();
if (numObjects > m_data.m_objects.size())
{
m_data.m_objects.reserve(numObjects + 1); // +1 for terrain
@@ -1164,7 +1155,7 @@ bool CExportManager::Export(const char* defaultName, const char* defaultExt, con
// Export the whole sequence with baked keys
if (ShowFBXExportDialog())
{
m_numberOfExportFrames = pSequence->GetTimeRange().end * m_FBXBakedExportFPS;
m_numberOfExportFrames = static_cast<int>(pSequence->GetTimeRange().end * m_FBXBakedExportFPS);
if (!m_bExportOnlyPrimaryCamera)
{
+12 -12
View File
@@ -36,7 +36,7 @@ namespace Export
public:
CMesh();
virtual int GetFaceCount() const { return m_faces.size(); }
virtual int GetFaceCount() const { return static_cast<int>(m_faces.size()); }
virtual const Face* GetFaceBuffer() const { return m_faces.size() ? &m_faces[0] : 0; }
private:
@@ -53,22 +53,22 @@ namespace Export
public:
CObject(const char* pName);
virtual int GetVertexCount() const { return m_vertices.size(); }
virtual const Vector3D* GetVertexBuffer() const{ return m_vertices.size() ? &m_vertices[0] : 0; }
int GetVertexCount() const override { return static_cast<int>(m_vertices.size()); }
const Vector3D* GetVertexBuffer() const override { return m_vertices.size() ? &m_vertices[0] : nullptr; }
virtual int GetNormalCount() const { return m_normals.size(); }
virtual const Vector3D* GetNormalBuffer() const { return m_normals.size() ? &m_normals[0] : 0; }
int GetNormalCount() const override { return static_cast<int>(m_normals.size()); }
const Vector3D* GetNormalBuffer() const override { return m_normals.size() ? &m_normals[0] : nullptr; }
virtual int GetTexCoordCount() const { return m_texCoords.size(); }
virtual const UV* GetTexCoordBuffer() const { return m_texCoords.size() ? &m_texCoords[0] : 0; }
int GetTexCoordCount() const override { return static_cast<int>(m_texCoords.size()); }
const UV* GetTexCoordBuffer() const override { return m_texCoords.size() ? &m_texCoords[0] : nullptr; }
virtual int GetMeshCount() const { return m_meshes.size(); }
virtual Mesh* GetMesh(int index) const { return m_meshes[index]; }
int GetMeshCount() const override { return static_cast<int>(m_meshes.size()); }
Mesh* GetMesh(int index) const override { return m_meshes[index]; }
virtual size_t MeshHash() const{return m_MeshHash; }
size_t MeshHash() const override{return m_MeshHash; }
void SetMaterialName(const char* pName);
virtual int GetEntityAnimationDataCount() const {return m_entityAnimData.size(); }
virtual int GetEntityAnimationDataCount() const {return static_cast<int>(m_entityAnimData.size()); }
virtual const EntityAnimData* GetEntityAnimationData(int index) const {return &m_entityAnimData[index]; }
virtual void SetEntityAnimationData(EntityAnimData entityData){ m_entityAnimData.push_back(entityData); };
void SetLastPtr(CBaseObject* pObject){m_pLastObject = pObject; };
@@ -92,7 +92,7 @@ namespace Export
: public IData
{
public:
virtual int GetObjectCount() const { return m_objects.size(); }
virtual int GetObjectCount() const { return static_cast<int>(m_objects.size()); }
virtual Object* GetObject(int index) const { return m_objects[index]; }
virtual Object* AddObject(const char* objectName);
void Clear();
+2 -2
View File
@@ -227,7 +227,7 @@ QString COBJExporter::MakeRelativePath(const char* pMainFileName, const char* pF
const char* ch = strrchr(pMainFileName, '\\');
if (ch)
{
if (strlen(pFileName) > ch - pMainFileName && !_strnicmp(pMainFileName, pFileName, ch - pMainFileName))
if (strlen(pFileName) > static_cast<size_t>(ch - pMainFileName) && !_strnicmp(pMainFileName, pFileName, ch - pMainFileName))
{
return QString(pFileName + (ch - pMainFileName) + 1);
}
@@ -256,7 +256,7 @@ const char* COBJExporter::TrimFloat(float fValue) const
++nCurBuf;
sprintf_s(pBuf, bufSize, "%f", fValue);
for (int i = strlen(pBuf) - 1; i > 0; --i)
for (int i = static_cast<int>(strlen(pBuf)) - 1; i > 0; --i)
{
if (pBuf[i] == '0')
{
+6 -6
View File
@@ -215,7 +215,7 @@ bool COCMExporter::ExportToFile(const char* filename, const Export::IData* pExpo
for (size_t a = 0; a < MeshCount; a++)
{
SOCMeshInfo MeshInfo;
MeshInfo.m_MeshHash = pExportData->GetObject(a)->MeshHash();
MeshInfo.m_MeshHash = pExportData->GetObject(static_cast<int>(a))->MeshHash();
const tdMeshOffset::iterator it = std::find(MeshOffsets.begin(), MeshOffsets.end(), MeshInfo);
if (it != MeshOffsets.end())
{
@@ -223,15 +223,15 @@ bool COCMExporter::ExportToFile(const char* filename, const Export::IData* pExpo
}
else
{
MeshInfo.m_Offset = Offset;
Offset += SaveMesh(Writer, pExportData->GetObject(a), MeshInfo.m_OBBMat);
MeshInfo.m_Offset = static_cast<uint32>(Offset);
Offset += SaveMesh(Writer, pExportData->GetObject(static_cast<int>(a)), MeshInfo.m_OBBMat);
}
MeshOffsets.push_back(MeshInfo);
}
OffsetInstances = Offset;
OffsetInstances = static_cast<uint32>(Offset);
for (size_t a = 0; a < InstCount; a++)
{
SaveInstance(Writer, pExportData->GetObject(a), MeshOffsets[a]);
SaveInstance(Writer, pExportData->GetObject(static_cast<int>(a)), MeshOffsets[a]);
}
Writer.Seek(4);
Writer.Write(static_cast<uint32>(MeshOffsets.size()));
@@ -263,7 +263,7 @@ const char* COCMExporter::TrimFloat(float fValue) const
++nCurBuf;
sprintf_s(pBuf, bufSize, "%f", fValue);
for (int i = strlen(pBuf) - 1; i > 0; --i)
for (int i = static_cast<int>(strlen(pBuf)) - 1; i > 0; --i)
{
if (pBuf[i] == '0')
{
+2 -2
View File
@@ -20,7 +20,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
namespace
{
const uint kDefaultFPS = 30.0f;
const uint kDefaultFPS = 30u;
}
CFBXExporterDialog::CFBXExporterDialog(bool bDisplayOnlyFPSSetting, QWidget* pParent)
@@ -43,7 +43,7 @@ CFBXExporterDialog::~CFBXExporterDialog()
float CFBXExporterDialog::GetFPS() const
{
return m_ui->m_fpsCombo->currentText().toDouble();
return m_ui->m_fpsCombo->currentText().toFloat();
}
bool CFBXExporterDialog::GetExportCoordsLocalToTheSelectedObject() const
+7 -7
View File
@@ -252,11 +252,11 @@ void CGameExporter::ExportOcclusionMesh(const char* pszGamePath)
{
CMemoryBlock Temp;
const size_t Size = FileIn.size();
Temp.Allocate(Size);
Temp.Allocate(static_cast<int>(Size));
FileIn.read(reinterpret_cast<char*>(Temp.GetBuffer()), Size);
FileIn.close();
CCryMemFile FileOut;
FileOut.Write(Temp.GetBuffer(), Size);
FileOut.Write(Temp.GetBuffer(), static_cast<int>(Size));
m_levelPak.m_pakFile.UpdateFile(levelDataFile.toUtf8().data(), FileOut);
}
}
@@ -281,13 +281,13 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/
QString levelDataFile = path + "LevelData.xml";
XmlString xmlData = root->getXML();
CCryMemFile file;
file.Write(xmlData.c_str(), xmlData.length());
file.Write(xmlData.c_str(), static_cast<unsigned int>(xmlData.length()));
m_levelPak.m_pakFile.UpdateFile(levelDataFile.toUtf8().data(), file);
QString levelDataActionFile = path + "LevelDataAction.xml";
XmlString xmlDataAction = rootAction->getXML();
CCryMemFile fileAction;
fileAction.Write(xmlDataAction.c_str(), xmlDataAction.length());
fileAction.Write(xmlDataAction.c_str(), static_cast<unsigned int>(xmlDataAction.length()));
m_levelPak.m_pakFile.UpdateFile(levelDataActionFile.toUtf8().data(), fileAction);
AZStd::vector<char> entitySaveBuffer;
@@ -298,7 +298,7 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/
{
QString entitiesFile;
entitiesFile = QStringLiteral("%1%2.entities_xml").arg(path, "Mission0");
m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), entitySaveBuffer.size());
m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), static_cast<int>(entitySaveBuffer.size()));
}
}
@@ -329,7 +329,7 @@ void CGameExporter::ExportLevelInfo(const QString& path)
XmlString xmlData = root->getXML();
CCryMemFile file;
file.Write(xmlData.c_str(), xmlData.length());
file.Write(xmlData.c_str(), static_cast<unsigned int>(xmlData.length()));
m_levelPak.m_pakFile.UpdateFile(filename.toUtf8().data(), file);
}
@@ -342,7 +342,7 @@ void CGameExporter::ExportLevelResourceList(const QString& path)
CCryMemFile memFile;
for (const char* filename = pResList->GetFirst(); filename; filename = pResList->GetNext())
{
memFile.Write(filename, strlen(filename));
memFile.Write(filename, static_cast<unsigned int>(strlen(filename)));
memFile.Write("\n", 1);
}
+2 -19
View File
@@ -97,7 +97,7 @@ void CGameResourcesExporter::Save(const QString& outputDirectory)
{
// Save this file in target folder.
QString trgFilename = Path::Make(outputDirectory, srcFilename);
int fsize = file.GetLength();
int fsize = static_cast<int>(file.GetLength());
if (fsize > data.GetSize())
{
data.Allocate(fsize + 16);
@@ -123,23 +123,6 @@ void CGameResourcesExporter::Save(const QString& outputDirectory)
m_files.clear();
}
#if defined(WIN64) || defined(APPLE) || defined(AZ_PLATFORM_LINUX)
template <class Container1, class Container2>
void Append(Container1& a, const Container2& b)
{
a.reserve (a.size() + b.size());
for (auto it = b.begin(); it != b.end(); ++it)
{
a.insert(a.end(), *it);
}
}
#else
template <class Container1, class Container2>
void Append(Container1& a, const Container2& b)
{
a.insert (a.end(), b.begin(), b.end());
}
#endif
//////////////////////////////////////////////////////////////////////////
//
// Go through all editor objects and gathers files from thier properties.
@@ -150,5 +133,5 @@ void CGameResourcesExporter::GetFilesFromObjects()
CUsedResources rs;
GetIEditor()->GetObjectManager()->GatherUsedResources(rs);
Append(m_files, rs.files);
AZStd::copy(rs.files.begin(), rs.files.end(), AZStd::back_inserter(m_files));
}
+11 -11
View File
@@ -201,7 +201,7 @@ void CTriMesh::SetFromMesh(CMesh& mesh)
face.v [j] = numv;
face.uv[j] = numv;
face.n [j] = mesh.m_pNorms[idx].GetN();
face.MatID = subset.nMatID;
face.MatID = static_cast<unsigned char>(subset.nMatID);
face.flags = 0;
numv++;
@@ -269,7 +269,7 @@ void CTriMesh::SharePositions()
for (int i = 0; i < 3; i++)
{
const Vec3& v = pVertices[face.v[i]].pos;
uint8 nHash = RoundFloatToInt((v.x + v.y + v.z) * fHashScale);
uint8 nHash = static_cast<uint8>(RoundFloatToInt((v.x + v.y + v.z) * fHashScale));
int find = FindVertexInHash(v, pNewVerts, arrHashTable[nHash], fEpsilon);
if (find < 0)
@@ -320,7 +320,7 @@ void CTriMesh::ShareUV()
for (int i = 0; i < 3; i++)
{
const Vec2 uv = pUV[face.uv[i]].GetUV();
uint8 nHash = RoundFloatToInt((uv.x + uv.y) * fHashScale);
uint8 nHash = static_cast<uint8>(RoundFloatToInt((uv.x + uv.y) * fHashScale));
int find = FindTexCoordInHash(pUV[face.uv[i]], pNewUV, arrHashTable[nHash], fEpsilon);
if (find < 0)
@@ -380,7 +380,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
// To find really used materials
std::vector<int> usedMaterialIds;
uint16 MatIdToSubset[MAX_SUB_MATERIALS];
int nLastSubsetId = 0;
uint16 nLastSubsetId = 0;
memset(MatIdToSubset, 0, sizeof(MatIdToSubset));
//////////////////////////////////////////////////////////////////////////
@@ -398,7 +398,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
MatIdToSubset[face.MatID] = 1 + nLastSubsetId++;
usedMaterialIds.push_back(face.MatID); // Order of material ids in usedMaterialIds correspond to the indices of chunks.
}
meshFace.nSubset = MatIdToSubset[face.MatID] - 1;
meshFace.nSubset = static_cast<unsigned char>(MatIdToSubset[face.MatID] - 1);
for (int j = 0; j < 3; ++j)
{
@@ -420,7 +420,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
pIndexedMesh->SetBBox(bb);
pIndexedMesh->SetSubSetCount(usedMaterialIds.size());
pIndexedMesh->SetSubSetCount(static_cast<int>(usedMaterialIds.size()));
for (int i = 0; i < usedMaterialIds.size(); i++)
{
pIndexedMesh->SetSubsetMaterialId(i, usedMaterialIds[i]);
@@ -677,11 +677,11 @@ void CTriMesh::GetEdgesByVertex(MeshElementsArray& inVertices, MeshElementsArray
std::sort(inVertices.begin(), inVertices.end());
for (int i = 0; i < GetEdgeCount(); i++)
{
if (stl::binary_find(inVertices.begin(), inVertices.end(), pEdges[i].v[0]) != inVertices.end())
if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pEdges[i].v[0])) != inVertices.end())
{
outEdges.push_back(i);
}
else if (stl::binary_find(inVertices.begin(), inVertices.end(), pEdges[i].v[1]) != inVertices.end())
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pEdges[i].v[1])) != inVertices.end())
{
outEdges.push_back(i);
}
@@ -696,15 +696,15 @@ void CTriMesh::GetFacesByVertex(MeshElementsArray& inVertices, MeshElementsArray
std::sort(inVertices.begin(), inVertices.end());
for (int i = 0; i < GetFacesCount(); i++)
{
if (stl::binary_find(inVertices.begin(), inVertices.end(), pFaces[i].v[0]) != inVertices.end())
if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[0])) != inVertices.end())
{
outFaces.push_back(i);
}
else if (stl::binary_find(inVertices.begin(), inVertices.end(), pFaces[i].v[1]) != inVertices.end())
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[1])) != inVertices.end())
{
outFaces.push_back(i);
}
else if (stl::binary_find(inVertices.begin(), inVertices.end(), pFaces[i].v[2]) != inVertices.end())
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[2])) != inVertices.end())
{
outFaces.push_back(i);
}
+1 -1
View File
@@ -86,7 +86,7 @@ void GotoPositionDialog::OnChangeEdit()
const QStringList parts = m_transform.split(QRegularExpression("[\\s,;\\t]"), Qt::SkipEmptyParts);
for (int i = 0; i < argCount && i < parts.count(); ++i)
{
transform[i] = parts[i].toDouble();
transform[i] = parts[i].toFloat();
}
m_ui->m_dymX->setValue(transform[0]);
+1 -1
View File
@@ -477,7 +477,7 @@ bool CLevelFileDialog::ValidateLevelPath(const QString& levelPath) const
QString currentPath = (Path::GetEditingGameDataFolder() + "/" + kLevelsFolder).c_str();
for (size_t i = 0; i < splittedPath.size() - 1; ++i)
{
currentPath += "/" + splittedPath[i];
currentPath += "/" + splittedPath[static_cast<int>(i)];
if (CFileUtil::FileExists(currentPath) || CheckLevelFolder(currentPath))
{
+1 -1
View File
@@ -504,7 +504,7 @@ static inline QString CopyAndRemoveColorCode(const char* sText)
*d++ = *s++;
}
ret.resize(d - ret.data());
ret.resize(static_cast<int>(d - ret.data()));
return QString::fromLatin1(ret);
}
+1 -1
View File
@@ -1672,7 +1672,7 @@ void MainWindow::OnUpdateConnectionStatus()
tooltip += m_connectionListener->LastAssetProcessorTask().c_str();
tooltip += "\n";
AZStd::set<AZStd::string> failedJobs = m_connectionListener->FailedJobsList();
int failureCount = failedJobs.size();
int failureCount = static_cast<int>(failedJobs.size());
if (failureCount)
{
tooltip += "\n Failed Jobs\n";
+21 -21
View File
@@ -840,8 +840,8 @@ void CBaseObject::DrawDefault(DisplayContext& dc, const QColor& labelColor)
{
dc.DrawLine(GetParentAttachPointWorldTM().GetTranslation(), wp, IsFrozen() ? kLinkColorGray : kLinkColorParent, IsFrozen() ? kLinkColorGray : kLinkColorChild);
}
int nChildCount = GetChildCount();
for (int i = 0; i < nChildCount; ++i)
size_t nChildCount = GetChildCount();
for (size_t i = 0; i < nChildCount; ++i)
{
const CBaseObject* pChild = GetChild(i);
dc.DrawLine(pChild->GetParentAttachPointWorldTM().GetTranslation(), pChild->GetWorldPos(), pChild->IsFrozen() ? kLinkColorGray : kLinkColorParent, pChild->IsFrozen() ? kLinkColorGray : kLinkColorChild);
@@ -1022,10 +1022,10 @@ void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& l
if (camDist < dc.settings->GetLabelsDistance() || (dc.flags & DISPLAY_SELECTION_HELPERS))
{
float range = maxDist / 2.0f;
Vec3 c(labelColor.redF(), labelColor.greenF(), labelColor.redF());
Vec3 c(static_cast<f32>(labelColor.redF()), static_cast<f32>(labelColor.greenF()), static_cast<f32>(labelColor.redF()));
if (IsSelected())
{
c = Vec3(dc.GetSelectedColor().redF(), dc.GetSelectedColor().greenF(), dc.GetSelectedColor().blueF());
c = Vec3(static_cast<f32>(dc.GetSelectedColor().redF()), static_cast<f32>(dc.GetSelectedColor().greenF()), static_cast<f32>(dc.GetSelectedColor().blueF()));
}
float col[4] = { c.x, c.y, c.z, 1 };
@@ -1033,7 +1033,7 @@ void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& l
{
if (IsHighlighted())
{
c = Vec3(dc.GetSelectedColor().redF(), dc.GetSelectedColor().greenF(), dc.GetSelectedColor().blueF());
c = Vec3(static_cast<f32>(dc.GetSelectedColor().redF()), static_cast<f32>(dc.GetSelectedColor().greenF()), static_cast<f32>(dc.GetSelectedColor().blueF()));
}
col[0] = c.x;
col[1] = c.y;
@@ -1263,9 +1263,9 @@ int CBaseObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint&
if (event == eMouseWheel)
{
double angle = 1;
float angle = 1;
Quat rot = GetRotation();
rot.SetRotationXYZ(Ang3(0, 0, rot.GetRotZ() + DEG2RAD(flags > 0 ? angle * (-1) : angle)));
rot.SetRotationXYZ(Ang3(0.f, 0.f, rot.GetRotZ() + DEG2RAD(flags > 0 ? angle * (-1) : angle)));
SetRotation(rot);
}
return MOUSECREATE_CONTINUE;
@@ -1375,7 +1375,7 @@ bool CBaseObject::IsHiddenBySpec() const
return false;
}
return (m_nMinSpec != 0 && gSettings.editorConfigSpec != 0 && m_nMinSpec > gSettings.editorConfigSpec);
return (m_nMinSpec != 0 && gSettings.editorConfigSpec != 0 && m_nMinSpec > static_cast<uint32>(gSettings.editorConfigSpec));
}
//////////////////////////////////////////////////////////////////////////
@@ -1857,10 +1857,10 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box)
const int kMaxSizeOfEdgeList0(4);
Edge2D edgelist0[kMaxSizeOfEdgeList0] = {
Edge2D(Vec2(hc.rect.left(), hc.rect.top()), Vec2(hc.rect.right(), hc.rect.top())),
Edge2D(Vec2(hc.rect.right(), hc.rect.top()), Vec2(hc.rect.right(), hc.rect.bottom())),
Edge2D(Vec2(hc.rect.right(), hc.rect.bottom()), Vec2(hc.rect.left(), hc.rect.bottom())),
Edge2D(Vec2(hc.rect.left(), hc.rect.bottom()), Vec2(hc.rect.left(), hc.rect.top()))
Edge2D(Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.top())), Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.top()))),
Edge2D(Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.top())), Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.bottom()))),
Edge2D(Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.bottom())), Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.bottom()))),
Edge2D(Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.bottom())), Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.top())))
};
const int kMaxSizeOfEdgeList1(8);
@@ -1888,12 +1888,12 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box)
pointsForRegion1.reserve(kMaxSizeOfEdgeList1);
for (int i = 0; i < kMaxSizeOfEdgeList1; ++i)
{
pointsForRegion1.push_back(Vec3(obb_p[i].x(), obb_p[i].y(), 0));
pointsForRegion1.push_back(Vec3(static_cast<f32>(obb_p[i].x()), static_cast<f32>(obb_p[i].y()), 0.0f));
}
std::vector<Vec3> convexHullForRegion1;
ConvexHull2D(convexHullForRegion1, pointsForRegion1);
nEdgeList1Count = convexHullForRegion1.size();
nEdgeList1Count = static_cast<int>(convexHullForRegion1.size());
if (nEdgeList1Count < 3 || nEdgeList1Count > kMaxSizeOfEdgeList1)
{
return true;
@@ -1978,8 +1978,8 @@ bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos)
{
float fScreenScale = hc.view->GetScreenScaleFactor(pos);
iconSizeX *= OBJECT_TEXTURE_ICON_SCALE / fScreenScale;
iconSizeY *= OBJECT_TEXTURE_ICON_SCALE / fScreenScale;
iconSizeX = static_cast<int>(static_cast<float>(iconSizeX) * OBJECT_TEXTURE_ICON_SCALE / fScreenScale);
iconSizeY = static_cast<int>(static_cast<float>(iconSizeY) * OBJECT_TEXTURE_ICON_SCALE / fScreenScale);
}
// Hit Test icon of this object.
@@ -2062,7 +2062,7 @@ void CBaseObject::GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj
{
const CBaseObject* pBaseObj = pObj ? pObj : this;
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == nullptr)
@@ -2078,7 +2078,7 @@ void CBaseObject::GetAllChildren(DynArray< _smart_ptr<CBaseObject> >& outAllChil
{
const CBaseObject* pBaseObj = pObj ? pObj : this;
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == nullptr)
@@ -2094,7 +2094,7 @@ void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* p
{
const CBaseObject* pBaseObj = pObj ? pObj : this;
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == nullptr)
@@ -2114,7 +2114,7 @@ void CBaseObject::CloneChildren(CBaseObject* pFromObject)
return;
}
for (int i = 0, nChildCount(pFromObject->GetChildCount()); i < nChildCount; ++i)
for (size_t i = 0, nChildCount(pFromObject->GetChildCount()); i < nChildCount; ++i)
{
CBaseObject* pFromChildObject = pFromObject->GetChild(i);
@@ -2729,7 +2729,7 @@ void CBaseObject::SetMinSpec(uint32 nSpec, bool bSetChildren)
// Set min spec for all childs.
if (bSetChildren)
{
for (int i = m_childs.size() - 1; i >= 0; --i)
for (size_t i = m_childs.size() - 1; i >= 0; --i)
{
m_childs[i]->SetMinSpec(nSpec, true);
}
+5 -5
View File
@@ -83,12 +83,12 @@ struct SANDBOX_API DisplayContext
// Draw functions
//////////////////////////////////////////////////////////////////////////
//! Set current materialc color.
void SetColor(float r, float g, float b, float a = 1) { m_color4b = ColorB(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f), int(a * 255.0f)); };
void SetColor(const Vec3& color, float a = 1) { m_color4b = ColorB(int(color.x * 255.0f), int(color.y * 255.0f), int(color.z * 255.0f), int(a * 255.0f)); };
void SetColor(const QColor& rgb, float a) { m_color4b = ColorB(rgb.red(), rgb.green(), rgb.blue(), int(a * 255.0f)); };
void SetColor(const QColor& color) { m_color4b = ColorB(color.red(), color.green(), color.blue(), color.alpha()); };
void SetColor(float r, float g, float b, float a = 1) { m_color4b = ColorB(static_cast<uint8>(r * 255.0f), static_cast<uint8>(g * 255.0f), static_cast<uint8>(b * 255.0f), static_cast<uint8>(a * 255.0f)); };
void SetColor(const Vec3& color, float a = 1) { m_color4b = ColorB(static_cast<uint8>(color.x * 255.0f), static_cast<uint8>(color.y * 255.0f), static_cast<uint8>(color.z * 255.0f), static_cast<uint8>(a * 255.0f)); };
void SetColor(const QColor& rgb, float a) { m_color4b = ColorB(static_cast<uint8>(rgb.red()), static_cast<uint8>(rgb.green()), static_cast<uint8>(rgb.blue()), static_cast<uint8>(a * 255.0f)); };
void SetColor(const QColor& color) { m_color4b = ColorB(static_cast<uint8>(color.red()), static_cast<uint8>(color.green()), static_cast<uint8>(color.blue()), static_cast<uint8>(color.alpha())); };
void SetColor(const ColorB& color) { m_color4b = color; };
void SetAlpha(float a = 1) { m_color4b.a = int(a * 255.0f); };
void SetAlpha(float a = 1) { m_color4b.a = static_cast<uint8>(a * 255.0f); };
ColorB GetColor() const { return m_color4b; }
void SetSelectedColor(float fAlpha = 1);
+5 -2
View File
@@ -63,7 +63,7 @@ void DisplayContext::InternalDrawLine(const Vec3& v0, const ColorB& colV0, const
//////////////////////////////////////////////////////////////////////////
void DisplayContext::DrawPoint(const Vec3& p, int nSize)
{
pRenderAuxGeom->DrawPoint(ToWorldSpacePosition(p), m_color4b, nSize);
pRenderAuxGeom->DrawPoint(ToWorldSpacePosition(p), m_color4b, static_cast<uint8>(nSize));
}
//////////////////////////////////////////////////////////////////////////
@@ -856,7 +856,10 @@ void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const ColorF& col1
//////////////////////////////////////////////////////////////////////////
void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const QColor& rgb1, const QColor& rgb2)
{
InternalDrawLine(ToWorldSpacePosition(p1), ColorB(rgb1.red(), rgb1.green(), rgb1.blue(), 255), ToWorldSpacePosition(p2), ColorB(rgb2.red(), rgb2.green(), rgb2.blue(), 255));
InternalDrawLine(ToWorldSpacePosition(p1),
ColorB(static_cast<uint8>(rgb1.red()), static_cast<uint8>(rgb1.green()), static_cast<uint8>(rgb1.blue()), 255),
ToWorldSpacePosition(p2),
ColorB(static_cast<uint8>(rgb2.red()), static_cast<uint8>(rgb2.green()), static_cast<uint8>(rgb2.blue()), 255));
}
//////////////////////////////////////////////////////////////////////////
+16 -16
View File
@@ -63,7 +63,7 @@ protected:
void Undo([[maybe_unused]] bool bUndo) override
{
for (int i = 0, iLinkSize(m_Links.size()); i < iLinkSize; ++i)
for (int i = 0, iLinkSize = static_cast<int>(m_Links.size()); i < iLinkSize; ++i)
{
SLink& link = m_Links[i];
CBaseObject* pObj = GetIEditor()->GetObjectManager()->FindObject(link.entityID);
@@ -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<bool>(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<int>(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<int>(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<int>(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<int>(m_eventTargets.size());
for (int i = 0; i < numTargets; i++)
{
if (m_eventTargets[i].target == target)
{
RemoveEventTarget(i);
numTargets = m_eventTargets.size();
numTargets = static_cast<int>(m_eventTargets.size());
i--;
}
}
}
else if (event == CBaseObject::ON_PREDELETE)
{
int numTargets = m_links.size();
int numTargets = static_cast<int>(m_links.size());
for (int i = 0; i < numTargets; i++)
{
if (m_links[i].target == target)
{
RemoveEntityLink(i);
numTargets = m_eventTargets.size();
numTargets = static_cast<int>(m_eventTargets.size());
i--;
}
}
@@ -1589,7 +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<int>(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<int>(m_links.size() - 1);
}
//////////////////////////////////////////////////////////////////////////
bool CEntityObject::EntityLinkExists(const QString& name, GUID targetEntityId)
{
for (int i = 0, num = m_links.size(); i < num; ++i)
for (size_t i = 0, num = m_links.size(); i < num; ++i)
{
if (m_links[i].targetId == targetEntityId && name.compare(m_links[i].name, Qt::CaseInsensitive) == 0)
{
+4 -4
View File
@@ -126,7 +126,7 @@ void CObjectArchive::ResolveObjects()
//////////////////////////////////////////////////////////////////////////
// Serialize All Objects from XML.
//////////////////////////////////////////////////////////////////////////
int numObj = m_loadedObjects.size();
int numObj = static_cast<int>(m_loadedObjects.size());
for (i = 0; i < numObj; i++)
{
if (m_bProgressBarEnabled)
@@ -143,7 +143,7 @@ void CObjectArchive::ResolveObjects()
m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
// Objects can be added to the list here (from Groups).
numObj = m_loadedObjects.size();
numObj = static_cast<int>(m_loadedObjects.size());
}
m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
//////////////////////////////////////////////////////////////////////////
@@ -221,7 +221,7 @@ void CObjectArchive::ResolveObjects()
//////////////////////////////////////////////////////////////////////////
// Serialize All Objects from XML.
//////////////////////////////////////////////////////////////////////////
int numObj = m_loadedObjects.size();
int numObj = static_cast<int>(m_loadedObjects.size());
for (i = 0; i < numObj; i++)
{
if (m_bProgressBarEnabled)
@@ -246,7 +246,7 @@ void CObjectArchive::ResolveObjects()
// Call PostLoad on all these objects.
//////////////////////////////////////////////////////////////////////////
{
int numObj = m_loadedObjects.size();
int numObj = static_cast<int>(m_loadedObjects.size());
for (i = 0; i < numObj; i++)
{
SLoadedObjectInfo& obj = m_loadedObjects[i];
+7 -7
View File
@@ -746,7 +746,7 @@ void CObjectManager::ChangeObjectName(CBaseObject* obj, const QString& newName)
//////////////////////////////////////////////////////////////////////////
int CObjectManager::GetObjectCount() const
{
return m_objects.size();
return static_cast<int>(m_objects.size());
}
//////////////////////////////////////////////////////////////////////////
@@ -765,7 +765,7 @@ void CObjectManager::GetObjects(DynArray<CBaseObject*>& objects) const
CBaseObjectsArray objectArray;
GetObjects(objectArray);
objects.clear();
for (int i = 0, iCount(objectArray.size()); i < iCount; ++i)
for (size_t i = 0, iCount(objectArray.size()); i < iCount; ++i)
{
objects.push_back(objectArray[i]);
}
@@ -1336,11 +1336,11 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
bbox.max.zero();
pDispayedViewObjects->ClearObjects();
pDispayedViewObjects->Reserve(m_visibleObjects.size());
pDispayedViewObjects->Reserve(static_cast<int>(m_visibleObjects.size()));
if (dc.flags & DISPLAY_2D)
{
int numVis = m_visibleObjects.size();
int numVis = static_cast<int>(m_visibleObjects.size());
for (int i = 0; i < numVis; i++)
{
CBaseObject* obj = m_visibleObjects[i];
@@ -1374,7 +1374,7 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
pSelection->GetObject(0)->CBaseObject::DrawDimensions(dc, &mergedAABB);
}
int numVis = m_visibleObjects.size();
int numVis = static_cast<int>(m_visibleObjects.size());
for (int i = 0; i < numVis; i++)
{
CBaseObject* obj = m_visibleObjects[i];
@@ -2016,7 +2016,7 @@ void CObjectManager::GetClassCategories(QStringList& categories)
}
}
categories.clear();
categories.reserve(cset.size());
categories.reserve(static_cast<int>(cset.size()));
for (std::set<QString>::iterator cit = cset.begin(); cit != cset.end(); ++cit)
{
categories.push_back(*cit);
@@ -2629,7 +2629,7 @@ void CObjectManager::EnteredComponentMode(const AZStd::vector<AZ::Uuid>& /*compo
const size_t gizmoCount = static_cast<size_t>(gizmoManager->GetGizmoCount());
for (size_t i = 0; i < gizmoCount; ++i)
{
gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(i));
gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(static_cast<int>(i)));
}
}
+3 -3
View File
@@ -109,7 +109,7 @@ bool CSelectionGroup::SameObjectType()
//////////////////////////////////////////////////////////////////////////
int CSelectionGroup::GetCount() const
{
return m_objects.size();
return static_cast<int>(m_objects.size());
}
//////////////////////////////////////////////////////////////////////////
@@ -157,7 +157,7 @@ Vec3 CSelectionGroup::GetCenter() const
}
if (GetCount() > 0)
{
c /= GetCount();
c /= static_cast<f32>(GetCount());
}
return c;
}
@@ -632,7 +632,7 @@ void CSelectionGroup::IndicateSnappingVertex(DisplayContext& dc) const
void CSelectionGroup::FinishChanges()
{
Objects selectedObjects(m_objects);
int iObjectSize(selectedObjects.size());
int iObjectSize = static_cast<int>(selectedObjects.size());
for (int i = 0; i < iObjectSize; ++i)
{
CBaseObject* pObject = selectedObjects[i];
@@ -5,8 +5,3 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
ly_add_source_properties(
SOURCES MainWindow.cpp CryEdit.cpp
PROPERTY COMPILE_OPTIONS
VALUES -bigobj
)
+1 -1
View File
@@ -136,7 +136,7 @@ IClassDesc* CClassFactory::FindClass(const char* pClassName) const
return nullptr;
}
QString name = QString(pClassName).left(pSubClassName - pClassName);
QString name = QString(pClassName).left(static_cast<int>(pSubClassName - pClassName));
return stl::find_in_map(m_nameToClass, name, (IClassDesc*)nullptr);
}
+1 -1
View File
@@ -262,7 +262,7 @@ void CPluginManager::RegisterPlugin(QLibrary* dllHandle, IPlugin* pPlugin)
entry.hLibrary = dllHandle;
entry.pPlugin = pPlugin;
m_plugins.push_back(entry);
m_uuidPluginMap[m_currentUUID] = pPlugin;
m_uuidPluginMap[static_cast<unsigned char>(m_currentUUID)] = pPlugin;
++m_currentUUID;
}
@@ -661,8 +661,8 @@ bool CComponentEntityObject::HitHelperTest(HitContext& hc)
if (IsEntityIconVisible())
{
const QPoint entityScreenPos = hc.view->WorldToView(GetWorldPos());
const float screenPosX = entityScreenPos.x();
const float screenPosY = entityScreenPos.y();
const float screenPosX = static_cast<float>(entityScreenPos.x());
const float screenPosY = static_cast<float>(entityScreenPos.y());
const float iconRange = static_cast<float>(s_kIconSize / 2);
if ((hc.point2d.x() >= screenPosX - iconRange && hc.point2d.x() <= screenPosX + iconRange)
@@ -626,7 +626,7 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con
{
view->GetDimensions(&width, &height);
}
m_contextMenuViewPoint.Set(width / 2, height / 2);
m_contextMenuViewPoint.Set(static_cast<float>(width / 2), static_cast<float>(height / 2));
}
else
{
@@ -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<int>(point.GetX()), static_cast<int>(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<int>(m_contextMenuViewPoint.GetX()), static_cast<int>(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<int>(m_contextMenuViewPoint.GetX()), static_cast<int>(m_contextMenuViewPoint.GetY()));
sliceWorldTransform = AZ::Transform::CreateTranslation(LYVec3ToAZVec3(view->SnapToGrid(view->ViewToWorld(viewPoint))));
}
@@ -472,7 +472,7 @@ void AssetCatalogModel::LoadDatabase()
{
m_fileCacheCurrentIndex = 0;
Q_EMIT UpdateProgress(0);
Q_EMIT SetTotalProgress(m_fileCache.size());
Q_EMIT SetTotalProgress(static_cast<int>(m_fileCache.size()));
};
EBUS_EVENT(AZ::Data::AssetCatalogRequestBus, EnumerateAssets, startCB, enumerateCB, endCB);
@@ -262,7 +262,7 @@ QModelIndex ComponentDataModel::parent([[maybe_unused]] const QModelIndex &child
int ComponentDataModel::rowCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const
{
return m_componentList.size();
return static_cast<int>(m_componentList.size());
}
int ComponentDataModel::columnCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const
@@ -2476,10 +2476,10 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
auto backgroundBoxRect = option.rect;
backgroundBoxRect.setX(backgroundBoxRect.x() + 0.5);
backgroundBoxRect.setY(backgroundBoxRect.y() + 2.5);
backgroundBoxRect.setWidth(backgroundBoxRect.width() - 1.0);
backgroundBoxRect.setHeight(backgroundBoxRect.height() - 1.0);
backgroundBoxRect.setX(static_cast<int>(backgroundBoxRect.x() + 0.5f));
backgroundBoxRect.setY(static_cast<int>(backgroundBoxRect.y() + 2.5f));
backgroundBoxRect.setWidth(static_cast<int>(backgroundBoxRect.width() - 1.0f));
backgroundBoxRect.setHeight(static_cast<int>(backgroundBoxRect.height() - 1.0f));
const qreal sliceBorderHeight = 0.8f;
@@ -2513,7 +2513,7 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
else
{
auto newRect = option.rect;
newRect.setHeight(newRect.height() - 1.0);
newRect.setHeight(static_cast<int>(newRect.height() - 1.0f));
path.addRect(newRect);
}
@@ -2597,7 +2597,7 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
QString htmlStripped = layerInfoString;
htmlStripped.remove(htmlMarkupRegex);
const float layerInfoPadding = 1.2f;
textWidthAvailable -= fontMetrics.horizontalAdvance(htmlStripped) * layerInfoPadding;
textWidthAvailable -= static_cast<int>(fontMetrics.horizontalAdvance(htmlStripped) * layerInfoPadding);
}
entityNameRichText = fontMetrics.elidedText(optionV4.text, Qt::TextElideMode::ElideRight, textWidthAvailable);
@@ -274,8 +274,8 @@ void OutlinerTreeView::drawBranches(QPainter* painter, const QRect& rect, const
// if the item has children offset the drawn line to compensate for drawn expander buttons
bool hasChildren = previousIndex.model()->index(0, 0, previousIndex).isValid();
int horizontalLineY = rect.top() + rectHalfHeight;
int horizontalLineLeft = rect.right() - indentation() * 1.5f;
int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : (lineBaseX - indentation() * 0.5f);
int horizontalLineLeft = static_cast<int>(rect.right() - indentation() * 1.5f);
int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : static_cast<int>(lineBaseX - indentation() * 0.5f);
painter->drawLine(horizontalLineLeft, horizontalLineY, horizontalLineRight, horizontalLineY);
}
@@ -284,7 +284,7 @@ void OutlinerTreeView::drawBranches(QPainter* painter, const QRect& rect, const
bool hasNext = previousIndex.sibling(previousIndex.row() + 1, previousIndex.column()).isValid();
if (hasNext || previousIndex == index)
{
int verticalLineX = lineBaseX - indentation() * 1.5f;
int verticalLineX = static_cast<int>(lineBaseX - indentation() * 1.5f);
int verticalLineTop = rect.top();
int verticalLineBottom = hasNext ? rect.bottom() : rect.bottom() - rectHalfHeight;
painter->drawLine(verticalLineX, verticalLineTop, verticalLineX, verticalLineBottom);
@@ -500,10 +500,10 @@ void AssetImporterWindow::SetTitle(const char* filePath)
AZStd::string extension;
if (AzFramework::StringFunc::Path::GetExtension(filePath, extension, false))
{
extension[0] = toupper(extension[0]);
extension[0] = static_cast<char>(toupper(extension[0]));
for (size_t i = 1; i < extension.size(); ++i)
{
extension[i] = tolower(extension[i]);
extension[i] = static_cast<char>(tolower(extension[i]));
}
}
else
@@ -9,8 +9,6 @@
#include "platform.h"
#pragma warning(disable: 4266) // disabled warning from afk overrides
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
#include <afxwin.h>
#include <vector>
@@ -30,13 +28,10 @@
#include "QtUtil.h"
// ugly dependencies:
#pragma warning(push)
#pragma warning(disable: 4244) // warning C4244: 'argument' : conversion from 'A' to 'B', possible loss of data
#include "Functor.h"
class CXmlArchive;
#include <IRenderer.h>
#include "Util/PathUtil.h"
#pragma warning(pop)
// ^^^
// ---------------------------------------------------------------------------
+1 -1
View File
@@ -89,7 +89,7 @@ REFGUID CStdPreferencesClassDesc::ClassID()
//////////////////////////////////////////////////////////////////////////
int CStdPreferencesClassDesc::GetPagesCount()
{
return m_pageCreators.size();
return static_cast<int>(m_pageCreators.size());
}
IPreferencesPage* CStdPreferencesClassDesc::CreateEditorPreferencesPage(int index)
+3 -5
View File
@@ -76,7 +76,7 @@ namespace
}
else if (pCVar->GetType() == CVAR_FLOAT)
{
PySetCVarFromFloat(pName, std::stod(pValue));
PySetCVarFromFloat(pName, static_cast<float>(std::stod(pValue)));
}
else if (pCVar->GetType() != CVAR_STRING)
{
@@ -152,11 +152,11 @@ namespace
}
else if (pCVar->GetType() == CVAR_INT)
{
PySetCVarFromInt(pName, AZStd::any_cast<AZ::s64>(value));
PySetCVarFromInt(pName, static_cast<int>(AZStd::any_cast<AZ::s64>(value)));
}
else if (pCVar->GetType() == CVAR_FLOAT)
{
PySetCVarFromFloat(pName, AZStd::any_cast<double>(value));
PySetCVarFromFloat(pName, static_cast<float>(AZStd::any_cast<double>(value)));
}
else if (pCVar->GetType() == CVAR_STRING)
{
@@ -548,13 +548,11 @@ namespace
if (title.empty())
{
throw std::runtime_error("Incorrect title argument passed in. ");
return result;
}
if (values.size() == 0)
{
throw std::runtime_error("Empty value list passed in. ");
return result;
}
QStringList list;
+1 -1
View File
@@ -31,7 +31,7 @@ int PixmapLabelPreview::heightForWidth(int width) const
return width;
}
return ((qreal)m_pixmap.height() * width) / m_pixmap.width();
return static_cast<int>(((qreal)m_pixmap.height() * width) / m_pixmap.width());
}
+3 -3
View File
@@ -184,7 +184,7 @@ bool QtViewPane::CloseInstance(QDockWidget* dockWidget, CloseModes closeModes)
const int numTopLevel = topLevelWidgets.size();
for (size_t i = 0; i < numTopLevel; ++i)
{
QWidget* widget = topLevelWidgets[i];
QWidget* widget = topLevelWidgets[static_cast<int>(i)];
if (widget->isModal() && widget->isVisible())
{
widget->activateWindow();
@@ -1102,7 +1102,7 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
entityInspectorViewPane->m_dockWidget->setFloating(false);
static const float tabWidgetWidthPercentage = 0.2f;
int newWidth = (float)screenWidth * tabWidgetWidthPercentage;
int newWidth = static_cast<int>((float)screenWidth * tabWidgetWidthPercentage);
if (levelInspectorPane)
{
@@ -1139,7 +1139,7 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
// so that they get an appropriate default width since the minimum sizes have
// been removed from these widgets
static const float entityOutlinerWidthPercentage = 0.15f;
int newWidth = (float)screenWidth * entityOutlinerWidthPercentage;
int newWidth = static_cast<int>((float)screenWidth * entityOutlinerWidthPercentage);
m_mainWindow->resizeDocks({ entityOutlinerViewPane->m_dockWidget }, { newWidth }, Qt::Horizontal);
}
+2 -2
View File
@@ -394,7 +394,7 @@ void SEditorSettings::LoadValue(const char* sSection, const char* sKey, float& v
{
const SettingsGroup sg(sSection);
const QString defaultVal = s_editorSettings()->value(sKey, QString::number(value)).toString();
value = defaultVal.toDouble();
value = defaultVal.toFloat();
if (GetIEditor()->GetSettingsManager())
{
@@ -1061,7 +1061,7 @@ void SEditorSettings::ConvertPath(const AZStd::string_view sourcePath, AZStd::st
// The reason for the difference is to have this API be consistent with the path syntax in Open 3D Engine Python APIs.
// Find the last pipe separator ("|") in the path
int lastSeparator = sourcePath.find_last_of("|");
size_t lastSeparator = sourcePath.find_last_of("|");
// Everything before the last separator is the category (since only the category is hierarchical)
category = sourcePath.substr(0, lastSeparator);
+3 -6
View File
@@ -60,7 +60,7 @@ void CToolBoxCommand::Execute() const
// Toggle the variable.
float val = GetIEditor()->GetConsoleVar(m_text.toUtf8().data());
bool bOn = val != 0;
GetIEditor()->SetConsoleVar(m_text.toUtf8().data(), (bOn) ? 0 : 1);
GetIEditor()->SetConsoleVar(m_text.toUtf8().data(), (bOn) ? 0.0f : 1.0f);
}
else
{
@@ -186,7 +186,6 @@ const CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox) const
assert(0 <= iIndex && iIndex < m_shelveMacros.size());
return m_shelveMacros[iIndex];
}
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -202,7 +201,6 @@ CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox)
assert(0 <= iIndex && iIndex < m_shelveMacros.size());
return m_shelveMacros[iIndex];
}
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -237,7 +235,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in
{
if (bToolbox)
{
const int macroCount = m_macros.size();
const int macroCount = static_cast<int>(m_macros.size());
if (macroCount > ID_TOOL_LAST - ID_TOOL_FIRST + 1)
{
return nullptr;
@@ -261,7 +259,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in
}
else
{
const int shelveMacroCount = m_shelveMacros.size();
const int shelveMacroCount = static_cast<int>(m_shelveMacros.size());
if (shelveMacroCount > ID_TOOL_SHELVE_LAST - ID_TOOL_SHELVE_FIRST + 1)
{
return nullptr;
@@ -275,7 +273,6 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in
m_shelveMacros.push_back(pNewTool);
return pNewTool;
}
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -503,7 +503,7 @@ void ToolbarManager::InitializeStandardToolbars()
{
auto macroToolbars = GetIEditor()->GetToolBoxManager()->GetToolbars();
m_standardToolbars.reserve(5 + macroToolbars.size());
m_standardToolbars.reserve(static_cast<int>(5 + macroToolbars.size()));
m_standardToolbars.push_back(GetEditModeToolbar());
m_standardToolbars.push_back(GetObjectToolbar());
m_standardToolbars.push_back(GetPlayConsoleToolbar());
+1 -1
View File
@@ -840,7 +840,7 @@ void CToolsConfigPage::FillScriptCmds()
{
EditorPythonConsoleInterface::GlobalFunctionCollection globalFunctionCollection;
editorPythonConsoleInterface->GetGlobalFunctionList(globalFunctionCollection);
commands.reserve(globalFunctionCollection.size());
commands.reserve(static_cast<int>(globalFunctionCollection.size()));
for (const EditorPythonConsoleInterface::GlobalFunction& globalFunction : globalFunctionCollection)
{
const QString fullCmd = QString("%1.%2()").arg(globalFunction.m_moduleName.data()).arg(globalFunction.m_functionName.data());
@@ -122,7 +122,7 @@ void CCommentKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle& sel
for (size_t keyIndex = 0, num = selectedKeys.GetKeyCount(); keyIndex < num; keyIndex++)
{
CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex);
CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(static_cast<unsigned int>(keyIndex));
CAnimParamType paramType = keyHandle.GetTrack()->GetParameterType();
if (paramType == AnimParamType::CommentText)
@@ -128,7 +128,7 @@ void CScreenFaderKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle&
for (size_t keyIndex = 0, num = selectedKeys.GetKeyCount(); keyIndex < num; ++keyIndex)
{
CTrackViewKeyHandle selectedKey = selectedKeys.GetKey(keyIndex);
CTrackViewKeyHandle selectedKey = selectedKeys.GetKey(static_cast<unsigned int>(keyIndex));
CAnimParamType paramType = selectedKey.GetTrack()->GetParameterType();
if (paramType == AnimParamType::ScreenFader)
@@ -93,7 +93,7 @@ static void UpdateAtomOutputFrameCaptureView(TrackView::AtomOutputFrameCapture&
const AZ::EntityId activeCameraEntityId = TrackView::ActiveCameraEntityId();
atomOutputFrameCapture.UpdateView(
TrackView::TransformFromEntityId(activeCameraEntityId),
TrackView::ProjectionFromCameraEntityId(activeCameraEntityId, width, height));
TrackView::ProjectionFromCameraEntityId(activeCameraEntityId, static_cast<float>(width), static_cast<float>(height)));
}
CSequenceBatchRenderDialog::CSequenceBatchRenderDialog(float fps, QWidget* pParent /* = nullptr */)
@@ -170,10 +170,10 @@ void CSequenceBatchRenderDialog::OnInitDialog()
connect(m_ui->m_endFrame, editingFinished, this, &CSequenceBatchRenderDialog::OnEndFrameChange);
connect(m_ui->m_imageFormatCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &CSequenceBatchRenderDialog::OnImageFormatChange);
const float bigEnoughNumber = 1000000.0f;
m_ui->m_startFrame->setRange(0.0f, bigEnoughNumber);
const int bigEnoughNumber = 1000000;
m_ui->m_startFrame->setRange(0, bigEnoughNumber);
m_ui->m_endFrame->setRange(0.0f, bigEnoughNumber);
m_ui->m_endFrame->setRange(0, bigEnoughNumber);
// Fill the sequence combo box.
bool activeSequenceWasSet = false;
@@ -301,8 +301,8 @@ void CSequenceBatchRenderDialog::OnRenderItemSelChange()
}
}
// frame range
m_ui->m_startFrame->setValue(item.frameRange.start * m_fpsForTimeToFrameConversion);
m_ui->m_endFrame->setValue(item.frameRange.end * m_fpsForTimeToFrameConversion);
m_ui->m_startFrame->setValue(static_cast<int>(item.frameRange.start * m_fpsForTimeToFrameConversion));
m_ui->m_endFrame->setValue(static_cast<int>(item.frameRange.end * m_fpsForTimeToFrameConversion));
// folder
m_ui->m_destinationEdit->setText(item.folder);
// fps
@@ -357,7 +357,7 @@ void CSequenceBatchRenderDialog::OnRenderItemSelChange()
QString cvarsText;
for (size_t i = 0; i < item.cvars.size(); ++i)
{
cvarsText += item.cvars[i];
cvarsText += item.cvars[static_cast<int>(i)];
cvarsText += "\r\n";
}
m_ui->m_cvarsEdit->setPlainText(cvarsText);
@@ -580,12 +580,12 @@ void CSequenceBatchRenderDialog::OnSequenceSelected()
// Adjust the frame range.
float sFrame = pSequence->GetTimeRange().start * m_fpsForTimeToFrameConversion;
float eFrame = pSequence->GetTimeRange().end * m_fpsForTimeToFrameConversion;
m_ui->m_startFrame->setRange(0.0f, eFrame);
m_ui->m_endFrame->setRange(0.0f, eFrame);
m_ui->m_startFrame->setRange(0, static_cast<int>(eFrame));
m_ui->m_endFrame->setRange(0, static_cast<int>(eFrame));
// Set the default start/end frames properly.
m_ui->m_startFrame->setValue(sFrame);
m_ui->m_endFrame->setValue(eFrame);
m_ui->m_startFrame->setValue(static_cast<int>(sFrame));
m_ui->m_endFrame->setValue(static_cast<int>(eFrame));
m_ui->m_shotCombo->clear();
// Fill the shot combo box with the names of director nodes.
@@ -894,7 +894,7 @@ void CSequenceBatchRenderDialog::CaptureItemStart()
// Set up the custom config cvars for this item.
for (size_t i = 0; i < renderItem.cvars.size(); ++i)
{
GetIEditor()->GetSystem()->GetIConsole()->ExecuteString(renderItem.cvars[i].toUtf8().data());
GetIEditor()->GetSystem()->GetIConsole()->ExecuteString(renderItem.cvars[static_cast<int>(i)].toUtf8().data());
}
// Set specific capture options for this item.
@@ -1519,7 +1519,7 @@ void CSequenceBatchRenderDialog::OnSaveBatch()
// cvars
for (size_t k = 0; k < item.cvars.size(); ++k)
{
itemNode->newChild("cvar")->setContent(item.cvars[k].toUtf8().data());
itemNode->newChild("cvar")->setContent(item.cvars[static_cast<int>(k)].toUtf8().data());
}
}
@@ -84,7 +84,7 @@ bool CSequenceKeyUIControls::OnKeySelectionChange(CTrackViewKeyBundle& selectedK
mv_sequence->AddEnumItem(QObject::tr("<None>"), CTrackViewDialog::GetEntityIdAsString(AZ::EntityId(AZ::EntityId::InvalidEntityId)));
const CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager();
for (int i = 0; i < pSequenceManager->GetCount(); ++i)
for (unsigned int i = 0; i < pSequenceManager->GetCount(); ++i)
{
CTrackViewSequence* pCurrentSequence = pSequenceManager->GetSequenceByIndex(i);
bool bNotMe = pCurrentSequence != pSequence;
@@ -367,7 +367,7 @@ bool CTVCustomizeTrackColorsDlg::Import(const QString& fullPath)
{
return entry.paramType == paramType;
});
int entryIndex = pEntry - g_trackEntries;
int entryIndex = static_cast<int>(pEntry - g_trackEntries);
if (entryIndex >= arraysize(g_trackEntries)) // If not found, skip this.
{
continue;
@@ -56,7 +56,7 @@ private:
inline void GetQColorFromXmlNode(QColor& colorOut, const XmlNodeRef& xmlNode) const
{
QRgb rgb = -1;
QRgb rgb = std::numeric_limits<unsigned int>::max();
xmlNode->getAttr("color", rgb);
colorOut.setRgb(rgb);
};
+1 -1
View File
@@ -363,7 +363,7 @@ int TVEventsModel::GetNumberOfUsageAndFirstTimeUsed(const char* eventName, float
{
CTrackViewTrack* pTrack = tracks.GetTrack(currentTrack);
for (int currentKey = 0; currentKey < pTrack->GetKeyCount(); ++currentKey)
for (unsigned int currentKey = 0; currentKey < pTrack->GetKeyCount(); ++currentKey)
{
CTrackViewKeyHandle keyHandle = pTrack->GetKey(currentKey);
+6 -6
View File
@@ -106,8 +106,8 @@ void CTVSequenceProps::MoveScaleKeys()
// Move/Rescale the sequence to a new time range.
Range timeRangeOld = m_pSequence->GetTimeRange();
Range timeRangeNew;
timeRangeNew.start = ui->START_TIME->value();
timeRangeNew.end = ui->END_TIME->value();
timeRangeNew.start = static_cast<float>(ui->START_TIME->value());
timeRangeNew.end = static_cast<float>(ui->END_TIME->value());
if (!(timeRangeNew == timeRangeOld))
{
@@ -123,14 +123,14 @@ void CTVSequenceProps::UpdateSequenceProps(const QString& name)
}
Range timeRange;
timeRange.start = ui->START_TIME->value();
timeRange.end = ui->END_TIME->value();
timeRange.start = static_cast<float>(ui->START_TIME->value());
timeRange.end = static_cast<float>(ui->END_TIME->value());
if (m_timeUnit == Frames)
{
float invFPS = 1.0f / m_FPS;
timeRange.start = ui->START_TIME->value() * invFPS;
timeRange.end = ui->END_TIME->value() * invFPS;
timeRange.start = static_cast<float>(ui->START_TIME->value()) * invFPS;
timeRange.end = static_cast<float>(ui->END_TIME->value()) * invFPS;
}
m_pSequence->SetTimeRange(timeRange);
+3 -3
View File
@@ -452,7 +452,7 @@ CTrackViewAnimNode* CTrackViewAnimNode::CreateSubNode(
{
// Check for a duplicates
CTrackViewAnimNodeBundle azEntityNodesFound = director2->GetAnimNodesByType(AnimNodeType::AzEntity);
for (int x = 0; x < azEntityNodesFound.GetCount(); x++)
for (unsigned int x = 0; x < azEntityNodesFound.GetCount(); x++)
{
if (azEntityNodesFound.GetNode(x)->GetAzEntityId() == owner)
{
@@ -1477,7 +1477,7 @@ bool CTrackViewAnimNode::PasteNodesFromClipboard(QWidget* context)
AZStd::map<int, IAnimNode*> copiedIdToNodeMap;
const unsigned int numNodes = animNodesRoot->getChildCount();
for (int i = 0; i < numNodes; ++i)
for (unsigned int i = 0; i < numNodes; ++i)
{
XmlNodeRef xmlNode = animNodesRoot->getChild(i);
@@ -2123,7 +2123,7 @@ bool CTrackViewAnimNode::ContainsComponentWithId(AZ::ComponentId componentId) co
if (GetType() == AnimNodeType::AzEntity)
{
// search for a matching componentId on all children
for (int i = 0; i < GetChildCount(); i++)
for (unsigned int i = 0; i < GetChildCount(); i++)
{
CTrackViewNode* childNode = GetChild(i);
if (childNode->GetNodeType() == eTVNT_AnimNode)
@@ -145,7 +145,7 @@ void CTrackViewCurveEditor::UpdateSplines()
std::set<CTrackViewTrack*> newTracks;
if (selectedTracks.AreAllOfSameType())
{
for (int i = 0; i < selectedTracks.GetCount(); i++)
for (unsigned int i = 0; i < selectedTracks.GetCount(); i++)
{
CTrackViewTrack* pTrack = selectedTracks.GetTrack(i);
+8 -8
View File
@@ -782,7 +782,7 @@ void CTrackViewDialog::UpdateActions()
}
bool allSelectedTracksUseMute = true;
for (int i = 0; i < selectedTrackCount; i++)
for (unsigned int i = 0; i < selectedTrackCount; i++)
{
CTrackViewTrack* pTrack = selectedTracks.GetTrack(i);
if (pTrack && !pTrack->UsesMute())
@@ -1121,7 +1121,7 @@ void CTrackViewDialog::ReloadSequencesComboBox()
CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager();
const unsigned int numSequences = pSequenceManager->GetCount();
for (int k = 0; k < numSequences; ++k)
for (unsigned int k = 0; k < numSequences; ++k)
{
CTrackViewSequence* sequence = pSequenceManager->GetSequenceByIndex(k);
QString entityIdString = GetEntityIdAsString(sequence->GetSequenceComponentEntityId());
@@ -1559,7 +1559,7 @@ void CTrackViewDialog::OnAddSelectedNode()
selectedEntitiesCount, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntitiesCount);
// check to make sure all nodes were added and notify user if they weren't
if (addedNodes.GetCount() != selectedEntitiesCount)
if (addedNodes.GetCount() != static_cast<unsigned int>(selectedEntitiesCount))
{
IMovieSystem* movieSystem = GetIEditor()->GetMovieSystem();
@@ -1765,7 +1765,7 @@ void CTrackViewDialog::OnSnapFPS()
if (ok)
{
m_wndDopeSheet->SetSnapFPS(fps);
m_wndCurveEditor->SetFPS(fps);
m_wndCurveEditor->SetFPS(static_cast<float>(fps));
SetCursorPosText(GetIEditor()->GetAnimation()->GetTime());
}
@@ -1799,7 +1799,7 @@ void CTrackViewDialog::SaveMiscSettings() const
settings.setValue(s_kFrameSnappingFPSEntry, fps);
settings.setValue(s_kTickDisplayModeEntry, static_cast<int>(m_wndDopeSheet->GetTickDisplayMode()));
settings.setValue(s_kDefaultTracksEntry, QByteArray(reinterpret_cast<const char*>(m_defaultTracksForEntityNode.data()),
m_defaultTracksForEntityNode.size() * sizeof(AnimParamType)));
static_cast<int>(m_defaultTracksForEntityNode.size() * sizeof(AnimParamType))));
}
//////////////////////////////////////////////////////////////////////////
@@ -1828,7 +1828,7 @@ void CTrackViewDialog::ReadMiscSettings()
if (settings.contains(s_kFrameSnappingFPSEntry))
{
float fps = settings.value(s_kFrameSnappingFPSEntry).toDouble();
float fps = settings.value(s_kFrameSnappingFPSEntry).toFloat();
if (fps >= s_kMinimumFrameSnappingFPS && fps <= s_kMaximumFrameSnappingFPS)
{
m_wndDopeSheet->SetSnapFPS(FloatToIntRet(fps));
@@ -1991,7 +1991,7 @@ void CTrackViewDialog::UpdateTracksToolBar()
&Maestro::EditorSequenceComponentRequestBus::Events::GetAllAnimatablePropertiesForComponent,
animatableProperties, azEntityId, pAnimNode->GetComponentId());
paramCount = animatableProperties.size();
paramCount = static_cast<int>(animatableProperties.size());
}
}
else
@@ -2317,7 +2317,7 @@ void CTrackViewDialog::SaveCurrentSequenceToFBX()
CTrackViewTrackBundle allTracks = sequence->GetAllTracks();
for (int trackID = 0; trackID < allTracks.GetCount(); ++trackID)
for (unsigned int trackID = 0; trackID < allTracks.GetCount(); ++trackID)
{
CTrackViewTrack* pCurrentTrack = allTracks.GetTrack(trackID);
@@ -146,8 +146,7 @@ CTrackViewDopeSheetBase::~CTrackViewDopeSheetBase()
//////////////////////////////////////////////////////////////////////////
int CTrackViewDopeSheetBase::TimeToClient(float time) const
{
int x = m_leftOffset - m_scrollOffset.x() + (time * m_timeScale);
return x;
return static_cast<int>(m_leftOffset - m_scrollOffset.x() + (time * m_timeScale));
}
//////////////////////////////////////////////////////////////////////////
@@ -193,7 +192,7 @@ void CTrackViewDopeSheetBase::SetTimeRange(float start, float end)
m_timeRange.Set(start, end);
SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale - m_leftOffset);
SetHorizontalExtent(-m_leftOffset, static_cast<int>(m_timeRange.end * m_timeScale - m_leftOffset));
}
//////////////////////////////////////////////////////////////////////////
@@ -258,12 +257,12 @@ void CTrackViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime)
while (fPixelsPerTick >= 12.0 && steps < 100);
float fCurrentOffset = -fAnchorTime * m_timeScale;
m_scrollOffset.rx() += fOldOffset - fCurrentOffset;
m_scrollOffset.rx() += static_cast<int>(fOldOffset - fCurrentOffset);
m_scrollBar->setValue(m_scrollOffset.x());
update();
SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale);
SetHorizontalExtent(-m_leftOffset, static_cast<int>(m_timeRange.end * m_timeScale));
ComputeFrameSteps(GetVisibleRange());
@@ -353,15 +352,15 @@ float CTrackViewDopeSheetBase::TickSnap(float time) const
double tickTime = GetTickTime();
double t = floor(((double)time / tickTime) + 0.5);
t *= tickTime;
return t;
return static_cast<float>(t);
}
//////////////////////////////////////////////////////////////////////////
float CTrackViewDopeSheetBase::TimeFromPoint(const QPoint& point) const
{
int x = point.x() - m_leftOffset + m_scrollOffset.x();
double t = (double)x / m_timeScale;
return (float)TickSnap(t);
float t = static_cast<float>(x) / m_timeScale;
return TickSnap(t);
}
//////////////////////////////////////////////////////////////////////////
@@ -369,7 +368,7 @@ float CTrackViewDopeSheetBase::TimeFromPointUnsnapped(const QPoint& point) const
{
int x = point.x() - m_leftOffset + m_scrollOffset.x();
double t = (double)x / m_timeScale;
return t;
return static_cast<float>(t);
}
void CTrackViewDopeSheetBase::mousePressEvent(QMouseEvent* event)
@@ -1028,12 +1027,12 @@ void CTrackViewDopeSheetBase::SelectAllKeysWithinTimeFrame(const QRect& rc, cons
CTrackViewTrackBundle tracks = sequence->GetAllTracks();
CTrackViewSequenceNotificationContext context(sequence);
for (int i = 0; i < tracks.GetCount(); ++i)
for (unsigned int i = 0; i < tracks.GetCount(); ++i)
{
CTrackViewTrack* pTrack = tracks.GetTrack(i);
// Check which keys we intersect.
for (int j = 0; j < pTrack->GetKeyCount(); j++)
for (unsigned int j = 0; j < pTrack->GetKeyCount(); j++)
{
CTrackViewKeyHandle keyHandle = pTrack->GetKey(j);
const float time = keyHandle.GetTime();
@@ -1429,7 +1428,7 @@ bool CTrackViewDopeSheetBase::IsOkToAddKeyHere(const CTrackViewTrack* pTrack, fl
{
const float timeEpsilon = 0.05f;
for (int i = 0; i < pTrack->GetKeyCount(); ++i)
for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i)
{
const CTrackViewKeyConstHandle& keyHandle = pTrack->GetKey(i);
@@ -1556,7 +1555,7 @@ void CTrackViewDopeSheetBase::MouseMoveMove(const QPoint& p, [[maybe_unused]] Qt
const TrackMemento& trackMemento = iter->second;
pTrack->RestoreFromMemento(trackMemento.m_memento);
const unsigned int numKeys = trackMemento.m_keySelectionStates.size();
const unsigned int numKeys = static_cast<unsigned int>(trackMemento.m_keySelectionStates.size());
for (unsigned int i = 0; i < numKeys; ++i)
{
pTrack->GetKey(i).Select(trackMemento.m_keySelectionStates[i]);
@@ -1764,7 +1763,7 @@ float CTrackViewDopeSheetBase::MagnetSnap(float newTime, const CTrackViewAnimNod
newTime = keys.GetKey(0).GetTime();
// But if there is an in-range key in a sibling track, use it instead.
// Here a 'sibling' means a track that belongs to a same node.
for (int i = 0; i < keys.GetKeyCount(); ++i)
for (unsigned int i = 0; i < keys.GetKeyCount(); ++i)
{
CTrackViewKeyHandle keyHandle = keys.GetKey(i);
if (keyHandle.GetTrack()->GetAnimNode() == pNode)
@@ -1783,7 +1782,7 @@ float CTrackViewDopeSheetBase::FrameSnap(float time) const
{
double t = floor((double)time / m_snapFrameTime + 0.5);
t = t * m_snapFrameTime;
return t;
return static_cast<float>(t);
}
//////////////////////////////////////////////////////////////////////////
@@ -1946,7 +1945,7 @@ void CTrackViewDopeSheetBase::ChangeSequenceTrackSelection(CTrackViewSequence* s
CTrackViewTrackBundle prevSelectedTracks;
prevSelectedTracks = sequenceWithTrack->GetSelectedTracks();
for (int i = 0; i < prevSelectedTracks.GetCount(); i++)
for (unsigned int i = 0; i < prevSelectedTracks.GetCount(); i++)
{
CTrackViewTrack* prevSelectedTrack = prevSelectedTracks.GetTrack(i);
if (prevSelectedTrack != trackToSelect)
@@ -2003,9 +2002,10 @@ bool CTrackViewDopeSheetBase::CreateColorKey(CTrackViewTrack* pTrack, float keyT
Vec3 vColor(0, 0, 0);
pTrack->GetValue(keyTime, vColor);
const AZ::Color defaultColor(clamp_tpl<AZ::u8>(FloatToIntRet(vColor.x), 0, 255),
clamp_tpl<AZ::u8>(FloatToIntRet(vColor.y), 0, 255),
clamp_tpl<AZ::u8>(FloatToIntRet(vColor.z), 0, 255),
const AZ::Color defaultColor(
clamp_tpl<AZ::u8>(static_cast<AZ::u8>(FloatToIntRet(vColor.x)), 0, 255),
clamp_tpl<AZ::u8>(static_cast<AZ::u8>(FloatToIntRet(vColor.y)), 0, 255),
clamp_tpl<AZ::u8>(static_cast<AZ::u8>(FloatToIntRet(vColor.z)), 0, 255),
255);
AzQtComponents::ColorPicker dlg(AzQtComponents::ColorPicker::Configuration::RGB, QString(), this);
dlg.setWindowTitle(tr("Select Color"));
@@ -2023,7 +2023,7 @@ bool CTrackViewDopeSheetBase::CreateColorKey(CTrackViewTrack* pTrack, float keyT
AzToolsFramework::ScopedUndoBatch undoBatch("Set Key");
const unsigned int numChildNodes = pTrack->GetChildCount();
for (int i = 0; i < numChildNodes; ++i)
for (unsigned int i = 0; i < numChildNodes; ++i)
{
CTrackViewTrack* subTrack = static_cast<CTrackViewTrack*>(pTrack->GetChild(i));
if (IsOkToAddKeyHere(subTrack, keyTime))
@@ -2054,7 +2054,7 @@ void CTrackViewDopeSheetBase::OnCurrentColorChange(const AZ::Color& color)
void CTrackViewDopeSheetBase::UpdateColorKey(const QColor& color, bool addToUndo)
{
ColorF colArray(color.red(), color.green(), color.blue(), color.alpha());
ColorF colArray(static_cast<f32>(color.redF()), static_cast<f32>(color.greenF()), static_cast<f32>(color.blueF()), static_cast<f32>(color.alphaF()));
CTrackViewSequence* sequence = m_colorUpdateTrack->GetSequence();
if (nullptr != sequence)
@@ -2083,7 +2083,7 @@ void CTrackViewDopeSheetBase::UpdateColorKey(const QColor& color, bool addToUndo
void CTrackViewDopeSheetBase::UpdateColorKeyHelper(const ColorF& color)
{
const unsigned int numChildNodes = m_colorUpdateTrack->GetChildCount();
for (int i = 0; i < numChildNodes; ++i)
for (unsigned int i = 0; i < numChildNodes; ++i)
{
CTrackViewTrack* subTrack = static_cast<CTrackViewTrack*>(m_colorUpdateTrack->GetChild(i));
CTrackViewKeyHandle subTrackKey = subTrack->GetKeyByTime(m_colorUpdateKeyTime);
@@ -2119,9 +2119,10 @@ void CTrackViewDopeSheetBase::EditSelectedColorKey(CTrackViewTrack* pTrack)
Vec3 color;
pTrack->GetValue(m_colorUpdateKeyTime, color);
const AZ::Color defaultColor(clamp_tpl<AZ::u8>(FloatToIntRet(color.x), 0, 255),
clamp_tpl<AZ::u8>(FloatToIntRet(color.y), 0, 255),
clamp_tpl<AZ::u8>(FloatToIntRet(color.z), 0, 255),
const AZ::Color defaultColor(
clamp_tpl(static_cast<AZ::u8>(FloatToIntRet(color.x)), AZ::u8(0), AZ::u8(255)),
clamp_tpl(static_cast<AZ::u8>(FloatToIntRet(color.y)), AZ::u8(0), AZ::u8(255)),
clamp_tpl(static_cast<AZ::u8>(FloatToIntRet(color.z)), AZ::u8(0), AZ::u8(255)),
255);
AzQtComponents::ColorPicker picker(AzQtComponents::ColorPicker::Configuration::RGB);
@@ -2258,7 +2259,7 @@ void CTrackViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKey
}
else // A compound track
{
for (int k = 0; k < pCurrTrack->GetChildCount(); ++k)
for (unsigned int k = 0; k < pCurrTrack->GetChildCount(); ++k)
{
CTrackViewTrack* pSubTrack = static_cast<CTrackViewTrack*>(pCurrTrack->GetChild(k));
if (IsOkToAddKeyHere(pSubTrack, keyTime))
@@ -2293,7 +2294,7 @@ void CTrackViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKey
else
{
AzToolsFramework::ScopedUndoBatch undoBatch("Create Key");
for (int i = 0; i < pTrack->GetChildCount(); ++i)
for (unsigned int i = 0; i < pTrack->GetChildCount(); ++i)
{
CTrackViewTrack* pSubTrack = static_cast<CTrackViewTrack*>(pTrack->GetChild(i));
if (IsOkToAddKeyHere(pSubTrack, keyTime))
@@ -2369,12 +2370,12 @@ void CTrackViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Rang
nNumberTicks = 8;
}
double start = TickSnap(timeRange.start);
double step = 1.0 / m_ticksStep;
float start = TickSnap(timeRange.start);
float step = 1.0f / static_cast<float>(m_ticksStep);
for (double t = 0.0f; t <= timeRange.end + step; t += step)
for (float t = 0.0f; t <= timeRange.end + step; t += step)
{
double st = TickSnap(t);
float st = TickSnap(t);
if (st > timeRange.end)
{
st = timeRange.end;
@@ -2393,7 +2394,7 @@ void CTrackViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Rang
continue;
}
int k = RoundFloatToInt(st * m_ticksStep);
int k = RoundFloatToInt(st * static_cast<float>(m_ticksStep));
if (k % nNumberTicks == 0)
{
if (st >= start)
@@ -3094,7 +3095,7 @@ void CTrackViewDopeSheetBase::SelectKeys(const QRect& rc, const bool bMultiSelec
// note the tracks to select for the keyHandles selected
CTrackViewTrackBundle tracksToSelect;
for (int i = 0; i < tracks.GetCount(); ++i)
for (unsigned int i = 0; i < tracks.GetCount(); ++i)
{
CTrackViewTrack* pTrack = tracks.GetTrack(i);
@@ -3108,7 +3109,7 @@ void CTrackViewDopeSheetBase::SelectKeys(const QRect& rc, const bool bMultiSelec
(rc.bottom() >= trackRect.top() && rc.bottom() <= trackRect.bottom()))
{
// Check which keys we intersect.
for (int j = 0; j < pTrack->GetKeyCount(); j++)
for (unsigned int j = 0; j < pTrack->GetKeyCount(); j++)
{
CTrackViewKeyHandle keyHandle = pTrack->GetKey(j);
@@ -3175,7 +3176,7 @@ void CTrackViewDopeSheetBase::DrawSelectedKeyIndicators(QPainter* painter)
painter->setPen(Qt::green);
CTrackViewKeyBundle keys = pSequence->GetSelectedKeys();
for (int i = 0; i < keys.GetKeyCount(); ++i)
for (unsigned int i = 0; i < keys.GetKeyCount(); ++i)
{
const CTrackViewKeyHandle& keyHandle = keys.GetKey(i);
int x = TimeToClient(keyHandle.GetTime());
@@ -3218,7 +3219,7 @@ void CTrackViewDopeSheetBase::ComputeFrameSteps(const Range& visRange)
float nBIntermediateTicks = 5;
m_fFrameLabelStep = fFact * afStepTable[nStepIdx];
if (TimeToClient(m_fFrameLabelStep) - TimeToClient(0) > 1300)
if (TimeToClient(static_cast<float>(m_fFrameLabelStep)) - TimeToClient(0.0f) > 1300)
{
nBIntermediateTicks = 10;
}
@@ -3230,7 +3231,7 @@ void CTrackViewDopeSheetBase::ComputeFrameSteps(const Range& visRange)
void CTrackViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRect& rc, [[maybe_unused]] const QColor& lineCol, const QColor& textCol, [[maybe_unused]] double step)
{
float fFramesPerSec = 1.0f / m_snapFrameTime;
float fInvFrameLabelStep = 1.0f / m_fFrameLabelStep;
float fInvFrameLabelStep = 1.0f / static_cast<float>(m_fFrameLabelStep);
Range VisRange = GetVisibleRange();
const Range& timeRange = m_timeRange;
@@ -3238,9 +3239,9 @@ void CTrackViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRec
const QPen ltgray(QColor(90, 90, 90));
const QPen black(textCol);
for (double t = TickSnap(timeRange.start); t <= timeRange.end + m_fFrameTickStep; t += m_fFrameTickStep)
for (float t = TickSnap(timeRange.start); t <= timeRange.end + static_cast<float>(m_fFrameTickStep); t += static_cast<float>(m_fFrameTickStep))
{
double st = t;
float st = t;
if (st > timeRange.end)
{
st = timeRange.end;
@@ -3285,9 +3286,9 @@ void CTrackViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QRe
const QPen ltgray(QColor(90, 90, 90));
const QPen black(textCol);
for (double t = TickSnap(timeRange.start); t <= timeRange.end + step; t += step)
for (float t = TickSnap(timeRange.start); t <= timeRange.end + static_cast<float>(step); t += static_cast<float>(step))
{
double st = TickSnap(t);
float st = TickSnap(t);
if (st > timeRange.end)
{
st = timeRange.end;
@@ -3306,7 +3307,7 @@ void CTrackViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QRe
}
int x = TimeToClient(st);
int k = RoundFloatToInt(st * m_ticksStep);
int k = RoundFloatToInt(st * static_cast<float>(m_ticksStep));
if (k % nNumberTicks == 0)
{
painter->setPen(black);
@@ -3423,7 +3424,7 @@ void CTrackViewDopeSheetBase::DrawSummary(QPainter* painter, const QRect& rcUpda
// Draw a short thick line at each place where there is a key in any tracks.
CTrackViewKeyBundle keys = pSequence->GetAllKeys();
for (int i = 0; i < keys.GetKeyCount(); ++i)
for (unsigned int i = 0; i < keys.GetKeyCount(); ++i)
{
const CTrackViewKeyHandle& keyHandle = keys.GetKey(i);
int x = TimeToClient(keyHandle.GetTime());
@@ -3635,7 +3636,7 @@ void CTrackViewDopeSheetBase::StoreMementoForTracksWithSelectedKeys()
std::set<CTrackViewTrack*> tracks;
const unsigned int numKeys = selectedKeys.GetKeyCount();
for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex)
for (unsigned int keyIndex = 0; keyIndex < numKeys; ++keyIndex)
{
CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex);
tracks.insert(keyHandle.GetTrack());
+1 -1
View File
@@ -86,7 +86,7 @@ void CTrackViewKeyHandle::SetTime(float time, bool notifyListeners)
if (!m_pTrack->IsSortMarkerKey(m_keyIndex))
{
CTrackViewKeyBundle allKeys = m_pTrack->GetAllKeys();
for (int x = 0; x < allKeys.GetKeyCount(); x++)
for (unsigned int x = 0; x < allKeys.GetKeyCount(); x++)
{
unsigned int curIndex = allKeys.GetKey(x).GetIndex();
if (m_pTrack->IsSortMarkerKey(curIndex))
+6 -6
View File
@@ -1113,7 +1113,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point)
selectedEntitiesCount, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntitiesCount);
// check to make sure all nodes were added and notify user if they weren't
if (addedNodes.GetCount() != selectedEntitiesCount)
if (addedNodes.GetCount() != static_cast<unsigned int>(selectedEntitiesCount))
{
IMovieSystem* movieSystem = GetIEditor()->GetMovieSystem();
@@ -1419,7 +1419,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point)
{
if (animNode)
{
UINT_PTR menuId = cmd - eMI_AddTrackBase;
unsigned int menuId = cmd - eMI_AddTrackBase;
if (animNode->GetType() != AnimNodeType::AzEntity)
{
@@ -1765,7 +1765,7 @@ void CTrackViewNodesCtrl::ImportFromFBX()
pSpline->SetKeyInTangent(keyIndex, inTangent);
}
if (keyIndex < (pTrack->GetKeyCount() - 1))
if (keyIndex < static_cast<int>(pTrack->GetKeyCount() - 1))
{
CTrackViewKeyHandle nextKey = key.GetNextKey();
if (nextKey.IsValid())
@@ -2306,7 +2306,7 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con
&Maestro::EditorSequenceComponentRequestBus::Events::GetAllAnimatablePropertiesForComponent,
animatableProperties, azEntityId, animNode->GetComponentId());
paramCount = animatableProperties.size();
paramCount = static_cast<int>(animatableProperties.size());
}
}
else
@@ -2352,7 +2352,7 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con
QStringList splittedName = name.split("/", Qt::SkipEmptyParts);
STrackMenuTreeNode* pCurrentNode = &menuAddTrack;
for (unsigned int j = 0; j < splittedName.size() - 1; ++j)
for (int j = 0; j < splittedName.size() - 1; ++j)
{
const QString& segment = splittedName[j];
auto findIter = pCurrentNode->children.find(segment);
@@ -2652,7 +2652,7 @@ void CTrackViewNodesCtrl::CreateSetAnimationLayerPopupMenu(QMenu& menuSetLayer,
CTrackViewTrackBundle animationTracks = pTrack->GetAnimNode()->GetTracksByParam(AnimParamType::Animation);
const unsigned int numAnimationTracks = animationTracks.GetCount();
for (int i = 0; i < numAnimationTracks; ++i)
for (unsigned int i = 0; i < numAnimationTracks; ++i)
{
CTrackViewTrack* pAnimationTrack = animationTracks.GetTrack(i);
if (pAnimationTrack)
@@ -113,7 +113,7 @@ namespace
AZStd::string PyTrackViewGetSequenceName(unsigned int index)
{
if (index < PyTrackViewGetNumSequences())
if (static_cast<int>(index) < PyTrackViewGetNumSequences())
{
const CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager();
return pSequenceManager->GetSequenceByIndex(index)->GetName();
@@ -378,7 +378,7 @@ namespace
}
CTrackViewAnimNodeBundle foundNodes = pParentDirector->GetAllAnimNodes();
if (index < 0 || index >= foundNodes.GetCount())
if (index < 0 || index >= static_cast<int>(foundNodes.GetCount()))
{
throw std::runtime_error("Invalid node index");
}
+5 -5
View File
@@ -455,7 +455,7 @@ void CTrackViewSequence::OnNodeChanged(CTrackViewNode* node, ITrackViewSequenceL
// Make sure to deselect any keys
CTrackViewKeyBundle keys = node->GetAllKeys();
for (int key = 0; key < keys.GetKeyCount(); key++)
for (unsigned int key = 0; key < keys.GetKeyCount(); key++)
{
CTrackViewKeyHandle keyHandle = keys.GetKey(key);
if (keyHandle.IsSelected())
@@ -1249,7 +1249,7 @@ void CTrackViewSequence::DeselectAllKeys()
CTrackViewSequenceNotificationContext context(this);
CTrackViewKeyBundle selectedKeys = GetSelectedKeys();
for (int i = 0; i < selectedKeys.GetKeyCount(); ++i)
for (unsigned int i = 0; i < selectedKeys.GetKeyCount(); ++i)
{
CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(i);
keyHandle.Select(false);
@@ -1403,7 +1403,7 @@ float CTrackViewSequence::ClipTimeOffsetForSliding(const float timeOffset)
for (pTrackIter = tracks.begin(); pTrackIter != tracks.end(); ++pTrackIter)
{
CTrackViewTrack* pTrack = *pTrackIter;
for (int i = 0; i < pTrack->GetKeyCount(); ++i)
for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i)
{
const CTrackViewKeyHandle& keyHandle = pTrack->GetKey(i);
@@ -1486,7 +1486,7 @@ void CTrackViewSequence::CloneSelectedKeys()
std::vector<float> selectedKeyTimes;
for (size_t k = 0; k < selectedKeys.GetKeyCount(); ++k)
{
CTrackViewKeyHandle skey = selectedKeys.GetKey(k);
CTrackViewKeyHandle skey = selectedKeys.GetKey(static_cast<unsigned int>(k));
if (pTrack != skey.GetTrack())
{
pTrack = skey.GetTrack();
@@ -1498,7 +1498,7 @@ void CTrackViewSequence::CloneSelectedKeys()
// Now, do the actual cloning.
for (size_t k = 0; k < selectedKeyTimes.size(); ++k)
{
CTrackViewKeyHandle skey = selectedKeys.GetKey(k);
CTrackViewKeyHandle skey = selectedKeys.GetKey(static_cast<unsigned int>(k));
skey = skey.GetTrack()->GetKeyByTime(selectedKeyTimes[k]);
assert(skey.IsValid());
@@ -227,7 +227,7 @@ void CTrackViewSequenceManager::AddTrackViewSequence(CTrackViewSequence* sequenc
////////////////////////////////////////////////////////////////////////////
void CTrackViewSequenceManager::DeleteSequence(CTrackViewSequence* sequence)
{
const int numSequences = m_sequences.size();
const int numSequences = static_cast<int>(m_sequences.size());
for (int sequenceIndex = 0; sequenceIndex < numSequences; ++sequenceIndex)
{
if (m_sequences[sequenceIndex].get() == sequence)
@@ -246,7 +246,7 @@ void CTrackViewSequenceManager::DeleteSequence(CTrackViewSequence* sequence)
{
AZ::ComponentTypeList requiredComponents;
AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(requiredComponents, &AzToolsFramework::EditorEntityContextRequestBus::Events::GetRequiredComponentTypes);
const int numComponentToDeleteEntity = requiredComponents.size() + 1;
const int numComponentToDeleteEntity = static_cast<int>(requiredComponents.size() + 1);
AZ::Entity::ComponentArrayType entityComponents = entity->GetComponents();
if (entityComponents.size() == numComponentToDeleteEntity)
@@ -413,9 +413,9 @@ void CTrackViewSequenceManager::OnDataBaseItemEvent([[maybe_unused]] IDataBaseIt
{
if (event != EDataBaseItemEvent::EDB_ITEM_EVENT_ADD)
{
const uint numSequences = m_sequences.size();
const size_t numSequences = m_sequences.size();
for (uint i = 0; i < numSequences; ++i)
for (size_t i = 0; i < numSequences; ++i)
{
m_sequences[i]->UpdateDynamicParams();
}
@@ -706,7 +706,7 @@ void CTrackViewSplineCtrl::mouseMoveEvent(QMouseEvent* event)
QString tipText;
bool boFoundTheSelectedKey(false);
for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
CTrackViewTrack* pTrack = m_tracks[splineIndex];
@@ -796,7 +796,7 @@ void CTrackViewSplineCtrl::AdjustTCB(float d_tension, float d_continuity, float
SendNotifyEvent(SPLN_BEFORE_CHANGE);
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
CTrackViewTrack* pTrack = m_tracks[splineIndex];
@@ -892,7 +892,7 @@ void CTrackViewSplineCtrl::OnUserCommand(UINT cmd)
bool CTrackViewSplineCtrl::IsUnifiedKeyCurrentlySelected() const
{
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline;
+1 -1
View File
@@ -70,7 +70,7 @@ CTrackViewTrack* CUndoComponentEntityTrackObject::FindTrack(CTrackViewSequence*
CTrackViewTrack* track = nullptr;
CTrackViewTrackBundle allTracks = sequence->GetAllTracks();
for (int trackIndex = 0; trackIndex < allTracks.GetCount(); trackIndex++)
for (unsigned int trackIndex = 0; trackIndex < allTracks.GetCount(); trackIndex++)
{
CTrackViewTrack* curTrack = allTracks.GetTrack(trackIndex);
if (curTrack->GetAnimNode() && curTrack->GetAnimNode()->GetComponentId() == m_trackComponentId)
+1 -1
View File
@@ -78,7 +78,7 @@ void CTVNewSequenceDialog::OnOK()
return;
}
for (int k = 0; k < GetIEditor()->GetSequenceManager()->GetCount(); ++k)
for (unsigned int k = 0; k < GetIEditor()->GetSequenceManager()->GetCount(); ++k)
{
CTrackViewSequence* pSequence = GetIEditor()->GetSequenceManager()->GetSequenceByIndex(k);
QString fullname = pSequence->GetName();
+4 -4
View File
@@ -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<int>(m_undoStack.size());
}
//////////////////////////////////////////////////////////////////////////
int CUndoManager::GetRedoStackLen() const
{
return m_redoStack.size();
return static_cast<int>(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<unsigned int>(m_undoStack.size()), static_cast<unsigned int>(m_redoStack.size()));
}
}
+3 -3
View File
@@ -68,7 +68,7 @@ public:
return 0;
}
return m_stackNames.size();
return static_cast<int>(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<int>(fresh.size()), static_cast<int>(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<int>(m_stackNames.size()), static_cast<int>(fresh.size() - 1));
m_stackNames = fresh;
endInsertRows();
}
+23 -25
View File
@@ -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<float>(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<float>((mat[Z][Y] - mat[Y][Z]) * s);
qu.y = static_cast<float>((mat[X][Z] - mat[Z][X]) * s);
qu.z = static_cast<float>((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<float>(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<float>((mat[I][J] + mat[J][I]) * s); \
qu.k = static_cast<float>((mat[K][I] + mat[I][K]) * s); \
qu.w = static_cast<float>((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<float>(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<float>(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<float>(s * (b + tau * a));
U[j][q] += static_cast<float>(s * (a - tau * b));
}
}
}
}
kv.x = Diag[X];
kv.y = Diag[Y];
kv.z = Diag[Z];
kv.w = 1.0;
kv.x = static_cast<float>(Diag[X]);
kv.y = static_cast<float>(Diag[Y]);
kv.z = static_cast<float>(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<float>(-qp.z / t), static_cast<float>(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<float>(sgn(neg[ii], 0.5f));
}
}
cycle(ka, par)
}
else
{ /*big*/
pa[hi] = sgn(neg[hi], 1.0);
pa[hi] = static_cast<float>(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<float>(sgn(neg[hi], 1.0f));
}
}
p.x = -pa[0];
-1
View File
@@ -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
{
+14 -14
View File
@@ -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<int>(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<int>(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<int>(nCurrent)]);
QString targetName = targetDir.absoluteFilePath(cFiles[static_cast<int>(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<int>(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<int>(nCurrent)]);
QString targetName = targetDir.absoluteFilePath(cDirectories[static_cast<int>(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<int>(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<int>(nCurrent)]));
QString targetName(targetDir.absoluteFilePath(cFiles[static_cast<int>(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<int>(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<int>(nCurrent)]));
QString targetName(targetDir.absoluteFilePath(cDirectories[static_cast<int>(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<int>(nCurrent)]),
QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
switch (ret) {
+4 -45
View File
@@ -15,43 +15,6 @@
#include <QPainter>
#include <QMessageBox>
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<float>(aColor.red()) * aScale;
const float g = static_cast<float>(aColor.green()) * aScale;
const float b = static_cast<float>(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<int>(r), 0, 255), CLAMP(static_cast<int>(g), 0, 255), CLAMP(static_cast<int>(b), 0, 255));
}
CAlphaBitmap::CAlphaBitmap()
-10
View File
@@ -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
+8 -8
View File
@@ -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<unsigned char>(d[0]);
guid.Data4[1] = static_cast<unsigned char>(d[1]);
guid.Data4[2] = static_cast<unsigned char>(d[2]);
guid.Data4[3] = static_cast<unsigned char>(d[3]);
guid.Data4[4] = static_cast<unsigned char>(d[4]);
guid.Data4[5] = static_cast<unsigned char>(d[5]);
guid.Data4[6] = static_cast<unsigned char>(d[6]);
guid.Data4[7] = static_cast<unsigned char>(d[7]);
return guid;
}
+4 -4
View File
@@ -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<float>(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<float>(0.0f, static_cast<float>(atof(token)));
// If this is a location we specifically don't have data for, set it to 0.
if (pixelValue == nodataValue)
+3 -3
View File
@@ -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<long>(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<uint8>(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<uint8>(OutCode[i]));
}
OutCount = 0;
+1 -1
View File
@@ -220,5 +220,5 @@ void CImageHistogram::ComputeStatisticsForChannel(int aIndex)
}
}
m_median[aIndex] = median;
m_median[aIndex] = static_cast<float>(median);
}
+9 -9
View File
@@ -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<uint32>(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<uint32>(off);
break;
case SEEK_CUR:
memImage->offset += off;
memImage->offset += static_cast<uint32>(off);
break;
case SEEK_END:
memImage->offset = memImage->size - off;
memImage->offset = static_cast<uint32>(memImage->size - off);
break;
default:
memImage->offset = off;
memImage->offset = static_cast<uint32>(off);
break;
}
@@ -119,7 +119,7 @@ bool CImageTIF::Load(const QString& fileName, CImageEx& outImage)
std::vector<uint8> data;
memImage.size = file.GetLength();
memImage.size = static_cast<uint32>(file.GetLength());
data.resize(memImage.size);
memImage.buffer = &data[0];
@@ -210,7 +210,7 @@ bool CImageTIF::Load(const QString& fileName, CFloatImage& outImage)
std::vector<uint8> data;
memImage.size = file.GetLength();
memImage.size = static_cast<int>(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<uint32>(TIFFScanlineSize(tif));
uint8* linebuf = static_cast<uint8*>(_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<uint32>(file.GetLength());
data.resize(memImage.size);
memImage.buffer = &data[0];
+3 -3
View File
@@ -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<DWORD>(image.GetWidth() - 1) || y >= static_cast<DWORD>(image.GetHeight() - 1))
{
return image.ValueAt(x, y); // border is not filtered, 255 to get in range 0..1
}
+2 -2
View File
@@ -190,7 +190,7 @@ bool SearchForBestSplitPos(CKDTree::ESplitAxis axis, const std::vector<CKDTree::
outBestSplitPos = 0;
int nSizeOfIndices(indices.size());
int nSizeOfIndices = static_cast<int>(indices.size());
for (int i = 0; i < nSizeOfIndices; ++i)
{
@@ -329,7 +329,7 @@ bool CKDTree::Build(IStatObj* pStatObj)
entireBoundBox.Reset();
std::vector<uint32> indices;
for (int i = 0, iStatObjSize(m_StatObjectList.size()); i < iStatObjSize; ++i)
for (int i = 0, iStatObjSize = static_cast<uint32>(m_StatObjectList.size()); i < iStatObjSize; ++i)
{
IIndexedMesh* pMesh = m_StatObjectList[i].pStatObj->GetIndexedMesh(true);
if (pMesh == nullptr)
+1 -1
View File
@@ -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<unsigned long>(m_uncompressedSize));
}
//////////////////////////////////////////////////////////////////////////
+3 -3
View File
@@ -158,7 +158,7 @@ bool CNamedData::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
int iSize = m_blocks.size();
int iSize = static_cast<int>(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<int>(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<uint32>(cfile.GetLength());
if (fileSize > 0)
{
// Read uncompressed data size.
+1 -1
View File
@@ -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<int>(file.GetLength());
UpdateFile(filename, file.GetMemPtr(), nSize, bCompress);
file.Close();

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