Fix clang 13 compilation problems (#5791)

* Fix clang 13 compilation problems

Re-instated ShowPlayedSequencesDebug logic by introducing no-op lambda
which replaces missing `Draw2dLabel` functionality ( added TODO marker
there )

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* apply review suggestions

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Fix type in assert message

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
This commit is contained in:
Artur K
2021-11-25 10:24:39 +01:00
committed by GitHub
parent 0883921eb3
commit eca2e36687
48 changed files with 180 additions and 413 deletions
@@ -32,10 +32,9 @@ namespace ImageProcessingAtom
return;
}
uint32 dwWidth, dwHeight, dwMips;
uint32 dwWidth, dwHeight;
dwWidth = Get()->GetWidth(0);
dwHeight = Get()->GetHeight(0);
dwMips = Get()->GetMipCount();
//if the output image size doesn't work the desired pixel format. set to fallback format
const PixelFormatInfo* dstFmtInfo = CPixelFormats::GetInstance().GetPixelFormatInfo(fmtDst);
@@ -99,11 +99,9 @@ namespace ImageProcessingAtom
return pRet;
}
const char* pFormatText;
if (dwBitsPerChannel == 8)
{
// R8, GR8, BGR8, BGRA8
pFormatText = "8-bit";
pRet = Load8BitImageFromTIFF(tif);
}
else if (dwBitsPerChannel == 16)
@@ -111,19 +109,16 @@ namespace ImageProcessingAtom
// A/L/R16, R16F, GR16, GR16f, ARGB16, ARGB16f
if (dwFormat == SAMPLEFORMAT_IEEEFP)
{
pFormatText = "16-bit float";
pRet = Load16BitHDRImageFromTIFF(tif);
}
else
{
pFormatText = "16-bit int";
pRet = Load16BitImageFromTIFF(tif);
}
}
else if (dwBitsPerChannel == 32 && dwFormat == SAMPLEFORMAT_IEEEFP)
{
// A/L/R32f, GR32f, ARGB32f
pFormatText = "32-bit float";
pRet = Load32BitHDRImageFromTIFF(tif);
}
else
@@ -1438,15 +1438,12 @@ namespace ImageProcessingAtom
int32 a_Channel2Src, int32 a_Channel3Src )
{
int32 iFace, iMipLevel, u, v, k;
int32 size;
CP_ITYPE texelData[4];
int32 channelSrcArray[4];
//since output is being modified, terminate any active filtering threads
TerminateActiveThreads();
size = m_OutputSize;
channelSrcArray[0] = a_Channel0Src;
channelSrcArray[1] = a_Channel1Src;
channelSrcArray[2] = a_Channel2Src;
@@ -561,12 +561,10 @@ uint32_t AZ::FFont::GetNumQuadsForText(const char* str, const bool asciiMultiLin
++numQuads;
}
uint32_t nextCh = 0;
const wchar_t* pChar = strW.c_str();
while (uint32_t ch = *pChar)
{
++pChar;
nextCh = *pChar;
switch (ch)
{
@@ -290,14 +290,22 @@ namespace AZ
menuButton->setAutoRaise(true);
menuButton->setIcon(QIcon(":/Cards/img/UI20/Cards/menu_ico.svg"));
menuButton->setVisible(true);
QObject::connect(menuButton, &QToolButton::clicked, &dialog, [&]() {
QAction* action = nullptr;
QMenu menu(&dialog);
action = menu.addAction("Clear", [&] { inspector->SetUvNameMap(RPI::MaterialModelUvOverrideMap()); });
action = menu.addAction("Revert", [&] { inspector->SetUvNameMap(matModUvOverrides);; });
menu.exec(QCursor::pos());
});
QObject::connect(
menuButton, &QToolButton::clicked, &dialog, [&]()
{
QMenu menu(&dialog);
menu.addAction(
"Clear", [&]
{
inspector->SetUvNameMap(RPI::MaterialModelUvOverrideMap());
});
menu.addAction(
"Revert", [&]
{
inspector->SetUvNameMap(matModUvOverrides);
});
menu.exec(QCursor::pos());
});
QDialogButtonBox* buttonBox = new QDialogButtonBox(&dialog);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
@@ -194,7 +194,6 @@ namespace AZ
const uint32_t originalVertex = sourceOriginalVertex[vertexIndex + vertexStart];
const uint32_t influenceCount = AZStd::GetMin<uint32_t>(MaxSupportedSkinInfluences, static_cast<uint32_t>(sourceSkinningInfo->GetNumInfluences(originalVertex)));
uint32_t influenceIndex = 0;
float weightError = 1.0f;
AZStd::vector<uint32_t> localIndices;
for (; influenceIndex < influenceCount; ++influenceIndex)
@@ -202,7 +201,6 @@ namespace AZ
EMotionFX::SkinInfluence* influence = sourceSkinningInfo->GetInfluence(originalVertex, influenceIndex);
localIndices.push_back(static_cast<uint32_t>(influence->GetNodeNr()));
blendWeightBufferData[atomVertexBufferOffset + vertexIndex][influenceIndex] = influence->GetWeight();
weightError -= blendWeightBufferData[atomVertexBufferOffset + vertexIndex][influenceIndex];
}
// Zero out any unused ids/weights
@@ -169,11 +169,9 @@ namespace AudioControls
if (parent.isValid())
{
bool bChildValid = false;
bool bHasChildren = false;
QModelIndex child = parent.model()->index(0, 0, parent);
for (int i = 1; child.isValid(); ++i)
{
bHasChildren = true;
if (ApplyFilter(child))
{
bChildValid = true;
@@ -27,9 +27,9 @@ namespace AudioControls
//-------------------------------------------------------------------------------------------//
QConnectionsWidget::QConnectionsWidget(QWidget* parent)
: QWidget(parent)
, m_control(nullptr)
, m_notFoundColor(QColor(0xf3, 0x81, 0x1d))
, m_localizedColor(QColor(0x42, 0x85, 0xf4))
, m_control(nullptr)
{
setupUi(this);
@@ -37,7 +37,6 @@ namespace AudioControls
m_connectionList->installEventFilter(this);
connect(m_connectionList, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(ShowConnectionContextMenu(const QPoint&)));
connect(m_connectionList, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedConnectionChanged()));
}
//-------------------------------------------------------------------------------------------//
@@ -101,27 +100,6 @@ namespace AudioControls
contextMenu.exec(m_connectionList->mapToGlobal(pos));
}
//-------------------------------------------------------------------------------------------//
void QConnectionsWidget::SelectedConnectionChanged()
{
TConnectionPtr connection;
EACEControlType controlType = AudioControls::eACET_NUM_TYPES;
if (m_control)
{
QList<QListWidgetItem*> selected = m_connectionList->selectedItems();
if (selected.length() == 1)
{
QListWidgetItem* currentItem = selected[0];
if (currentItem)
{
const CID externalId = currentItem->data(eMDR_ID).toInt();
connection = m_control->GetConnection(externalId);
controlType = m_control->GetType();
}
}
}
}
//-------------------------------------------------------------------------------------------//
void QConnectionsWidget::MakeConnectionTo(IAudioSystemControl* middlewareControl)
{
@@ -38,7 +38,6 @@ namespace AudioControls
private slots:
void ShowConnectionContextMenu(const QPoint& pos);
void SelectedConnectionChanged();
void CurrentConnectionModified();
void RemoveSelectedConnection();
@@ -343,17 +343,6 @@ namespace Audio
{
if (CVars::s_debugDrawOptions.AreAllFlagsActive(DebugDraw::Options::FileCacheInfo))
{
EATLDataScope dataScope = eADS_ALL;
if (CVars::s_fcmDrawOptions.AreAllFlagsActive(FileCacheManagerDebugDraw::Options::Global))
{
dataScope = eADS_GLOBAL;
}
else if (CVars::s_fcmDrawOptions.AreAllFlagsActive(FileCacheManagerDebugDraw::Options::LevelSpecific))
{
dataScope = eADS_LEVEL_SPECIFIC;
}
const auto frameTime = AZStd::chrono::system_clock::now();
const float entryDrawSize = 1.5f;
@@ -552,14 +552,6 @@ namespace EMotionFX
motionNode->CreateMotionInstance(animGraphInstance->GetActorInstance(), this);
}
// get the id of the currently used the motion set
MotionSet* motionSet = animGraphInstance->GetMotionSet();
uint32 motionSetID = MCORE_INVALIDINDEX32;
if (motionSet)
{
motionSetID = motionSet->GetID();
}
// update the internally stored playback info
motionNode->UpdatePlayBackInfo(animGraphInstance);
@@ -412,11 +412,9 @@ namespace EMStudio
if (!nodesByAnimGraph.empty())
{
MCore::CommandGroup commandGroup("Delete anim graph nodes");
AZ::u32 numNodes = 0;
for (const AZStd::pair<EMotionFX::AnimGraph*, AZStd::vector<EMotionFX::AnimGraphNode*>>& animGraphAndNodes : nodesByAnimGraph)
{
numNodes += static_cast<AZ::u32>(animGraphAndNodes.second.size());
CommandSystem::DeleteNodes(&commandGroup, animGraphAndNodes.first, animGraphAndNodes.second, true);
}
@@ -482,16 +482,6 @@ namespace EMStudio
QMenu menu(this);
menu.setToolTipsVisible(true);
bool actorSelected = false;
for (const QTreeWidgetItem* item : items)
{
if (item->parent() == nullptr)
{
actorSelected = true;
break;
}
}
bool instanceSelected = false;
const int selectedItemCount = items.count();
for (int i = 0; i < selectedItemCount; ++i)
@@ -2152,13 +2152,6 @@ namespace EMStudio
float startTime = copyElement.m_startTime + offset;
float endTime = copyElement.m_endTime + offset;
// calculate the duration of the motion event
float duration = 0.0f;
if (MCore::Compare<float>::CheckIfIsClose(startTime, endTime, MCore::Math::epsilon) == false)
{
duration = endTime - startTime;
}
CommandSystem::CommandHelperAddMotionEvent(trackName.c_str(), startTime, endTime, copyElement.m_eventDatas, &commandGroup);
}
@@ -276,6 +276,11 @@ namespace GraphCanvas
m_subTitleWidget->SetLabel(subtitle);
updateLayout = true;
}
if (updateLayout)
{
UpdateLayout();
}
}
void GeneralNodeTitleGraphicsWidget::SetTitle(const AZStd::string& title)
@@ -463,13 +468,6 @@ namespace GraphCanvas
{
GRAPH_CANVAS_DETAILED_PROFILE_FUNCTION();
Styling::PaletteStyle style = m_styleHelper.GetAttribute(Styling::Attribute::PaletteStyle, Styling::PaletteStyle::Solid);
if (m_paletteOverride)
{
style = m_paletteOverride->GetAttribute(Styling::Attribute::PaletteStyle, Styling::PaletteStyle::Solid);
}
// Background
QRectF bounds = boundingRect();
@@ -188,9 +188,7 @@ namespace GraphCanvas
void GeneralSlotLayoutGraphicsWidget::LinearSlotGroupWidget::DisplaySlot(const AZ::EntityId& slotId)
{
ConnectionType connectionType = ConnectionType::CT_Invalid;
SlotRequestBus::EventResult(connectionType, slotId, &SlotRequests::GetConnectionType);
int layoutOrder = 0;
SlotRequestBus::EventResult(connectionType, slotId, &SlotRequests::GetConnectionType);
SlotLayoutInfo slotInfo(slotId);
@@ -199,14 +197,14 @@ namespace GraphCanvas
SlotUINotificationBus::MultiHandler::BusConnect(slotId);
m_inputSlotSet.insert(slotId);
layoutOrder = LayoutSlot(m_inputs, m_inputSlots, slotInfo);
LayoutSlot(m_inputs, m_inputSlots, slotInfo);
}
else if (connectionType == CT_Output)
{
SlotUINotificationBus::MultiHandler::BusConnect(slotId);
m_outputSlotSet.insert(slotId);
LayoutSlot(m_outputs, m_outputSlots, slotInfo);
LayoutSlot(m_outputs, m_outputSlots, slotInfo);
}
else
{
@@ -2182,18 +2182,6 @@ void AbstractSplineWidget::MoveSelectedKeys(Vec2 offset, bool copyKeys)
}
}
int rangeMin = aznumeric_cast<int>(TimeToXOfs(affectedRangeMin));
int rangeMax = aznumeric_cast<int>(TimeToXOfs(affectedRangeMax));
if (m_timeRange.start == affectedRangeMin)
{
rangeMin = m_rcSpline.left();
}
if (m_timeRange.end == affectedRangeMax)
{
rangeMax = m_rcSpline.right();
}
if (m_pTimelineCtrl)
{
m_pTimelineCtrl->update();
@@ -1866,24 +1866,22 @@ void CUiAnimViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKe
if (pTrack && inRange)
{
bool keyCreated = false;
if (bTryAddKeysInGroup && pNode->GetParentNode()) // Add keys in group
if (bTryAddKeysInGroup && pNode->GetParentNode()) // Add keys in group
{
CUiAnimViewTrackBundle tracksInGroup = pNode->GetTracksByParam(pTrack->GetParameterType());
for (int i = 0; i < (int)tracksInGroup.GetCount(); ++i)
{
CUiAnimViewTrack* pCurrTrack = tracksInGroup.GetTrack(i);
if (pCurrTrack->GetChildCount() == 0) // A simple track
if (pCurrTrack->GetChildCount() == 0) // A simple track
{
if (IsOkToAddKeyHere(pCurrTrack, keyTime))
{
RecordTrackUndo(pCurrTrack);
pCurrTrack->CreateKey(keyTime);
keyCreated = true;
}
}
else // A compound track
else // A compound track
{
for (unsigned int k = 0; k < pCurrTrack->GetChildCount(); ++k)
{
@@ -1892,26 +1890,24 @@ void CUiAnimViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKe
{
RecordTrackUndo(pSubTrack);
pSubTrack->CreateKey(keyTime);
keyCreated = true;
}
}
}
}
}
else if (pTrack->GetChildCount() == 0) // A simple track
else if (pTrack->GetChildCount() == 0) // A simple track
{
if (IsOkToAddKeyHere(pTrack, keyTime))
{
RecordTrackUndo(pTrack);
pTrack->CreateKey(keyTime);
keyCreated = true;
}
}
else // A compound track
else // A compound track
{
if (pTrack->GetValueType() == eUiAnimValue_RGB)
{
keyCreated = CreateColorKey(pTrack, keyTime);
CreateColorKey(pTrack, keyTime);
}
else
{
@@ -1922,7 +1918,6 @@ void CUiAnimViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKe
if (IsOkToAddKeyHere(pSubTrack, keyTime))
{
pSubTrack->CreateKey(keyTime);
keyCreated = true;
}
}
}
@@ -2236,7 +2231,6 @@ void CUiAnimViewDopeSheetBase::DrawSelectTrack(const Range& timeRange, QPainter*
void CUiAnimViewDopeSheetBase::DrawBoolTrack(const Range& timeRange, QPainter* painter, CUiAnimViewTrack* pTrack, const QRect& rc)
{
int x0 = TimeToClient(timeRange.start);
float t0 = timeRange.start;
const QBrush prevBrush = painter->brush();
painter->setBrush(m_visibilityBrush);
@@ -2267,7 +2261,6 @@ void CUiAnimViewDopeSheetBase::DrawBoolTrack(const Range& timeRange, QPainter* p
painter->fillRect(QRect(QPoint(x0, rc.top() + 4), QPoint(x, rc.bottom() - 4)), gradient);
}
t0 = time;
x0 = x;
}
int x = TimeToClient(timeRange.end);
@@ -726,24 +726,27 @@ void UiAnimationSystem::StillUpdate()
//////////////////////////////////////////////////////////////////////////
void UiAnimationSystem::ShowPlayedSequencesDebug()
{
//f32 green[4] = {0, 1, 0, 1};
//f32 purple[4] = {1, 0, 1, 1};
//f32 white[4] = {1, 1, 1, 1};
constexpr f32 green[4] = {0, 1, 0, 1};
constexpr f32 purple[4] = {1, 0, 1, 1};
constexpr f32 white[4] = {1, 1, 1, 1};
float y = 10.0f;
AZStd::vector<AZStd::string> names;
//TODO: needs an implementation
auto Draw2dLabel = [](float /*x*/,float /*y*/,float /*depth*/,const f32* /*color*/,bool /*center*/, const char* /*fmt*/, ...) {};
for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); ++it)
{
PlayingUIAnimSequence& playingSequence = *it;
if (playingSequence.sequence == NULL)
if (playingSequence.sequence == nullptr)
{
continue;
}
AZ_Assert(false,"gEnv->pRenderer is always null so it can't be used here");
//const char* fullname = playingSequence.sequence->GetName();
//gEnv->pRenderer->Draw2dLabel(1.0f, y, 1.3f, green, false, "Sequence %s : %f (x %f)", fullname, playingSequence.currentTime, playingSequence.currentSpeed);
const char* fullname = playingSequence.sequence->GetName();
Draw2dLabel(1.0f, y, 1.3f, green, false, "Sequence %s : %f (x %f)", fullname, playingSequence.currentTime, playingSequence.currentSpeed);
y += 16.0f;
@@ -762,7 +765,7 @@ void UiAnimationSystem::ShowPlayedSequencesDebug()
names.push_back(name);
}
//gEnv->pRenderer->Draw2dLabel((21.0f + 100.0f * i), ((i % 2) ? (y + 8.0f) : y), 1.0f, alreadyThere ? white : purple, false, "%s", name.c_str());
Draw2dLabel((21.0f + 100.0f * i), ((i % 2) ? (y + 8.0f) : y), 1.0f, alreadyThere ? white : purple, false, "%s", name.c_str());
}
y += 32.0f;
@@ -3510,17 +3510,9 @@ void UiTextComponent::UnitTestLocalization(CLyShine* lyshine, IConsoleCmdArgs* /
AZStd::string localizationXml("libs/localization/localization.xml");
bool initLocSuccess = false;
if (pLocMan)
if (!pLocMan || !pLocMan->InitLocalizationData(localizationXml.c_str()) || !pLocMan->LoadLocalizationDataByTag("init"))
{
if (pLocMan->InitLocalizationData(localizationXml.c_str()))
{
if (pLocMan->LoadLocalizationDataByTag("init"))
{
initLocSuccess = true;
}
}
AZ_Assert(false, "Failed to load localization");
}
ComponentGetSetTextTestsLoc(lyshine);
@@ -206,19 +206,16 @@ UiCanvasFileObject* UiCanvasFileObject::LoadCanvasEntitiesFromOldFormatFile(cons
// Do a sanity check that the buffer does start with the prefix that we will remove
// Also, determine how newlines are represented in the file.
bool useCarriageReturnNewline = false;
const char* suffixToRemove = nullptr;
size_t prefixToRemoveLen = 0;
if (strncmp(buffer, prefixToRemove1, strlen(prefixToRemove1)) == 0)
{
useCarriageReturnNewline = false;
prefixToRemoveLen = strlen(prefixToRemove1);
suffixToRemove = suffixToRemove1;
}
else if (strncmp(buffer, prefixToRemove2, strlen(prefixToRemove2)) == 0)
{
useCarriageReturnNewline = true;
prefixToRemoveLen = strlen(prefixToRemove2);
suffixToRemove = suffixToRemove2;
}
@@ -257,7 +254,6 @@ UiCanvasFileObject* UiCanvasFileObject::LoadCanvasEntitiesFromOldFormatFile(cons
{
++p;
suffixToRemove = suffixToRemove2;
useCarriageReturnNewline = true;
}
if (*p == '\n')
{
@@ -598,7 +598,6 @@ namespace
int curChar = 0;
float curLineWidth = 0.0f;
float biggestLineWidth = 0.0f;
float widthSum = 0.0f;
// When iterating over batches, we need to know the previous
// character, which we can only obtain if we keep track of the last
@@ -690,7 +689,6 @@ namespace
{
// Reset the current line width to account for newline
curLineWidth = curCharWidth;
widthSum += curLineWidth;
}
else if ((lastSpace > 0) && ((curChar - lastSpace) < 16) && (curChar - lastSpace >= 0)) // 16 is the default threshold
{
@@ -703,7 +701,6 @@ namespace
}
curLineWidth = curLineWidth - lastSpaceWidth + curCharWidth;
widthSum += curLineWidth;
}
else
{
@@ -723,7 +720,6 @@ namespace
biggestLineWidth = curLineWidth;
}
widthSum += curLineWidth;
curLineWidth = curCharWidth;
}
@@ -40,12 +40,12 @@ CAnimSequence::CAnimSequence(IMovieSystem* pMovieSystem, uint32 id, SequenceType
m_nextGenId = 1;
m_pMovieSystem = pMovieSystem;
m_flags = 0;
m_pParentSequence = NULL;
m_pParentSequence = nullptr;
m_timeRange.Set(0, 10);
m_bPaused = false;
m_bActive = false;
m_legacySequenceObject = nullptr;
m_activeDirector = NULL;
m_activeDirector = nullptr;
m_activeDirectorNodeId = -1;
m_precached = false;
m_bResetting = false;
@@ -271,7 +271,7 @@ IAnimNode* CAnimSequence::CreateNodeInternal(AnimNodeType nodeType, uint32 nNode
return nullptr; // should never happen, null pointer guard
}
CAnimNode* animNode = NULL;
CAnimNode* animNode = nullptr;
if (nNodeId == -1)
{
@@ -331,7 +331,7 @@ IAnimNode* CAnimSequence::CreateNodeInternal(AnimNodeType nodeType, uint32 nNode
if (AddNode(animNode))
{
// If there isn't an active director, set it now.
if (m_activeDirector == NULL && animNode->GetType() == AnimNodeType::Director)
if (m_activeDirector == nullptr && animNode->GetType() == AnimNodeType::Director)
{
SetActiveDirector(animNode);
}
@@ -352,7 +352,7 @@ IAnimNode* CAnimSequence::CreateNode(XmlNodeRef node)
{
if (!GetMovieSystem())
{
return 0; // should never happen, null pointer guard
return nullptr; // should never happen, null pointer guard
}
AnimNodeType type;
@@ -361,13 +361,13 @@ IAnimNode* CAnimSequence::CreateNode(XmlNodeRef node)
XmlString name;
if (!node->getAttr("Name", name))
{
return 0;
return nullptr;
}
IAnimNode* pNewNode = CreateNode(type);
if (!pNewNode)
{
return 0;
return nullptr;
}
pNewNode->SetName(name);
@@ -377,7 +377,7 @@ IAnimNode* CAnimSequence::CreateNode(XmlNodeRef node)
// Make sure de-serializing this node didn't just create an id conflict. This can happen sometimes
// when copy/pasting nodes from a different sequence to this one.
for (auto curNode : m_nodes)
for (const auto& curNode : m_nodes)
{
CAnimNode* animNode = static_cast<CAnimNode*>(curNode.get());
if (animNode->GetId() == newAnimNode->GetId() && animNode != newAnimNode)
@@ -413,7 +413,7 @@ void CAnimSequence::RemoveNode(IAnimNode* node, bool removeChildRelationships)
}
if (removeChildRelationships && m_nodes[i]->GetParent() == node)
{
m_nodes[i]->SetParent(0);
m_nodes[i]->SetParent(nullptr);
}
i++;
@@ -423,7 +423,7 @@ void CAnimSequence::RemoveNode(IAnimNode* node, bool removeChildRelationships)
if (m_activeDirector == node)
{
// Clear the active one.
m_activeDirector = NULL;
m_activeDirector = nullptr;
m_activeDirectorNodeId = -1;
// If there is another director node, set it as active.
@@ -445,7 +445,7 @@ void CAnimSequence::RemoveAll()
stl::free_container(m_nodes);
stl::free_container(m_events);
stl::free_container(m_nodesNeedToRender);
m_activeDirector = NULL;
m_activeDirector = nullptr;
m_activeDirectorNodeId = -1;
}
@@ -462,9 +462,9 @@ void CAnimSequence::Reset(bool bSeekToStart)
if (!bSeekToStart)
{
for (AnimNodes::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
for (const auto& it :m_nodes)
{
IAnimNode* animNode = it->get();
IAnimNode* animNode = it.get();
static_cast<CAnimNode*>(animNode)->OnReset();
}
m_bResetting = false;
@@ -1091,7 +1091,7 @@ int CAnimSequence::GetTrackEventsCount() const
//////////////////////////////////////////////////////////////////////////
char const* CAnimSequence::GetTrackEvent(int iIndex) const
{
char const* szResult = NULL;
char const* szResult = nullptr;
const bool bValid = (iIndex >= 0 && iIndex < GetTrackEventsCount());
CRY_ASSERT(bValid);
@@ -1153,7 +1153,7 @@ IAnimNode* CAnimSequence::FindNodeById(int nNodeId)
return animNode;
}
}
return 0;
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -1172,7 +1172,7 @@ IAnimNode* CAnimSequence::FindNodeByName(const char* sNodeName, const IAnimNode*
}
}
}
return 0;
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -1352,9 +1352,9 @@ bool CAnimSequence::IsAncestorOf(const IAnimSequence* sequence) const
return false; // should never happen, null pointer guard
}
for (AnimNodes::const_iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
for (const auto& it :m_nodes)
{
IAnimNode* pNode = it->get();
IAnimNode* pNode = it.get();
if (pNode->GetType() == AnimNodeType::Director)
{
IAnimTrack* pSequenceTrack = pNode->GetTrackForParameter(AnimParamType::Sequence);
@@ -57,8 +57,6 @@ void CLayerNode::Initialize()
//-----------------------------------------------------------------------------
void CLayerNode::Animate(SAnimContext& ec)
{
bool bVisibilityModified = false;
int trackCount = NumTracks();
for (int paramIndex = 0; paramIndex < trackCount; paramIndex++)
{
@@ -93,14 +91,12 @@ void CLayerNode::Animate(SAnimContext& ec)
if (visible != m_bPreVisibility)
{
m_bPreVisibility = visible;
bVisibilityModified = true;
}
}
else
{
m_bInit = true;
m_bPreVisibility = visible;
bVisibilityModified = true;
}
}
break;
+71 -58
View File
@@ -785,60 +785,60 @@ bool CMovieSystem::InternalStopSequence(IAnimSequence* sequence, bool bAbort, bo
{
assert(sequence != 0);
bool bRet = false;
PlayingSequences::iterator it;
if (FindSequence(sequence, it))
if (!FindSequence(sequence, it))
{
if (bAnimate && sequence->IsActivated())
{
if (m_sequenceStopBehavior == eSSB_GotoEndTime)
{
SAnimContext ac;
ac.singleFrame = true;
ac.time = sequence->GetTimeRange().end;
sequence->Animate(ac);
}
else if (m_sequenceStopBehavior == eSSB_GotoStartTime)
{
SAnimContext ac;
ac.singleFrame = true;
ac.time = sequence->GetTimeRange().start;
sequence->Animate(ac);
}
sequence->Deactivate();
}
// If this sequence is cut scene end it.
if (sequence->GetFlags() & IAnimSequence::eSeqFlags_CutScene)
{
if (!gEnv->IsEditing() || !m_bCutscenesPausedInEditor)
{
if (m_pUser)
{
m_pUser->EndCutScene(sequence, sequence->GetCutSceneFlags(true));
}
}
sequence->SetParentSequence(NULL);
}
// tell all interested listeners
NotifyListeners(sequence, bAbort ? IMovieListener::eMovieEvent_Aborted : IMovieListener::eMovieEvent_Stopped);
// erase the sequence after notifying listeners so if they choose to they can get the ending time of this sequence
if (FindSequence(sequence, it))
{
m_playingSequences.erase(it);
}
sequence->Resume();
static_cast<CAnimSequence*>(sequence)->OnStop();
bRet = true;
return false;
}
return bRet;
if (bAnimate && sequence->IsActivated())
{
if (m_sequenceStopBehavior == eSSB_GotoEndTime)
{
SAnimContext ac;
ac.singleFrame = true;
ac.time = sequence->GetTimeRange().end;
sequence->Animate(ac);
}
else if (m_sequenceStopBehavior == eSSB_GotoStartTime)
{
SAnimContext ac;
ac.singleFrame = true;
ac.time = sequence->GetTimeRange().start;
sequence->Animate(ac);
}
sequence->Deactivate();
}
// If this sequence is cut scene end it.
if (sequence->GetFlags() & IAnimSequence::eSeqFlags_CutScene)
{
if (!gEnv->IsEditing() || !m_bCutscenesPausedInEditor)
{
if (m_pUser)
{
m_pUser->EndCutScene(sequence, sequence->GetCutSceneFlags(true));
}
}
sequence->SetParentSequence(NULL);
}
// tell all interested listeners
NotifyListeners(sequence, bAbort ? IMovieListener::eMovieEvent_Aborted : IMovieListener::eMovieEvent_Stopped);
// erase the sequence after notifying listeners so if they choose to they can get the ending time of this sequence
if (FindSequence(sequence, it))
{
m_playingSequences.erase(it);
}
sequence->Resume();
static_cast<CAnimSequence*>(sequence)->OnStop();
return true;
}
//////////////////////////////////////////////////////////////////////////
@@ -906,7 +906,7 @@ void CMovieSystem::Reset(bool bPlayOnReset, bool bSeekToStart)
InternalStopAllSequences(true, false);
// Reset all sequences.
for (Sequences::iterator iter = m_sequences.begin(); iter != m_sequences.end(); ++iter)
for (Sequences::const_iterator iter = m_sequences.cbegin(); iter != m_sequences.cend(); ++iter)
{
IAnimSequence* pCurrentSequence = iter->get();
NotifyListeners(pCurrentSequence, IMovieListener::eMovieEvent_Started);
@@ -940,7 +940,7 @@ void CMovieSystem::Reset(bool bPlayOnReset, bool bSeekToStart)
//////////////////////////////////////////////////////////////////////////
void CMovieSystem::PlayOnLoadSequences()
{
for (Sequences::iterator sit = m_sequences.begin(); sit != m_sequences.end(); ++sit)
for (Sequences::const_iterator sit = m_sequences.cbegin(); sit != m_sequences.cend(); ++sit)
{
IAnimSequence* sequence = sit->get();
if (sequence->GetFlags() & IAnimSequence::eSeqFlags_PlayOnReset)
@@ -984,16 +984,27 @@ void CMovieSystem::ShowPlayedSequencesDebug()
{
float y = 10.0f;
std::vector<const char*> names;
std::vector<float> rows;
constexpr f32 green[4] = {0, 1, 0, 1};
constexpr f32 purple[4] = {1, 0, 1, 1};
constexpr f32 white[4] = {1, 1, 1, 1};
//TODO: needs an implementation
auto Draw2dLabel = [](float /*x*/,float /*y*/,float /*depth*/,const f32* /*color*/,bool /*center*/, const char* /*fmt*/, ...) {};
for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); ++it)
{
PlayingSequence& playingSequence = *it;
if (playingSequence.sequence == NULL)
if (playingSequence.sequence == nullptr)
{
continue;
}
const char* fullname = playingSequence.sequence->GetName();
Draw2dLabel(1.0f, y, 1.3f, green, false, "Sequence %s : %f (x %f)", fullname, playingSequence.currentTime, playingSequence.currentSpeed);
y += 16.0f;
for (int i = 0; i < playingSequence.sequence->GetNodeCount(); ++i)
@@ -1014,9 +1025,10 @@ void CMovieSystem::ShowPlayedSequencesDebug()
if (alreadyThere == false)
{
names.push_back(name);
}
}
}
Draw2dLabel((21.0f + 100.0f * i), ((i % 2) ? (y + 8.0f) : y), 1.0f, alreadyThere ? white : purple, false, "%s", name);
}
y += 32.0f;
}
}
@@ -1088,7 +1100,8 @@ void CMovieSystem::UpdateInternal(const float deltaTime, const bool bPreUpdate)
// Skip sequence if current update does not apply
const bool bSequenceEarlyUpdate = (playingSequence.sequence->GetFlags() & IAnimSequence::eSeqFlags_EarlyMovieUpdate) != 0;
if (bPreUpdate && !bSequenceEarlyUpdate || !bPreUpdate && bSequenceEarlyUpdate)
if ((bPreUpdate && !bSequenceEarlyUpdate ) || (!bPreUpdate && bSequenceEarlyUpdate)
)
{
continue;
}
@@ -1263,7 +1276,7 @@ void CMovieSystem::PauseCutScenes()
{
m_bCutscenesPausedInEditor = true;
if (m_pUser != NULL)
if (m_pUser != nullptr)
{
for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); ++it)
{
@@ -1285,7 +1298,7 @@ void CMovieSystem::ResumeCutScenes()
m_bCutscenesPausedInEditor = false;
if (m_pUser != NULL)
if (m_pUser != nullptr)
{
for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); ++it)
{
@@ -1475,7 +1488,7 @@ void CMovieSystem::ListSequencesCmd([[maybe_unused]] IConsoleCmdArgs* pArgs)
void CMovieSystem::PlaySequencesCmd(IConsoleCmdArgs* pArgs)
{
const char* sequenceName = pArgs->GetArg(1);
gEnv->pMovieSystem->PlaySequence(sequenceName, NULL, false, false);
gEnv->pMovieSystem->PlaySequence(sequenceName, nullptr, false, false);
}
#endif //#if !defined(_RELEASE)
@@ -197,8 +197,8 @@ CAnimSceneNode::CAnimSceneNode(const int id)
m_lastCaptureKey = -1;
m_bLastCapturingEnded = true;
m_captureFrameCount = 0;
m_pCamNodeOnHoldForInterp = 0;
m_CurrentSelectTrack = 0;
m_pCamNodeOnHoldForInterp = nullptr;
m_CurrentSelectTrack = nullptr;
m_CurrentSelectTrackKeyNumber = 0;
m_lastPrecachePoint = -1.f;
SetName("Scene");
@@ -335,12 +335,12 @@ void CAnimSceneNode::Animate(SAnimContext& ec)
return;
}
CSelectTrack* cameraTrack = NULL;
CEventTrack* pEventTrack = NULL;
CSequenceTrack* pSequenceTrack = NULL;
CConsoleTrack* pConsoleTrack = NULL;
CGotoTrack* pGotoTrack = NULL;
CCaptureTrack* pCaptureTrack = NULL;
CSelectTrack* cameraTrack = nullptr;
CEventTrack* pEventTrack = nullptr;
CSequenceTrack* pSequenceTrack = nullptr;
CConsoleTrack* pConsoleTrack = nullptr;
CGotoTrack* pGotoTrack = nullptr;
CCaptureTrack* pCaptureTrack = nullptr;
/*
bool bTimeJump = false;
if (ec.time < m_time)
@@ -449,7 +449,7 @@ void CAnimSceneNode::Animate(SAnimContext& ec)
// Check if a camera override is set by CVar
const char* overrideCamName = gEnv->pMovieSystem->GetOverrideCamName();
AZ::EntityId overrideCamId;
if (overrideCamName != 0 && strlen(overrideCamName) > 0)
if (overrideCamName != nullptr && strlen(overrideCamName) > 0)
{
// overriding with a Camera Component entity is done by entityId (as names are not unique among AZ::Entities) - try to convert string to u64 to see if it's an id
AZ::u64 u64Id = strtoull(overrideCamName, nullptr, /*base (radix)*/ 10);
@@ -784,7 +784,7 @@ void CAnimSceneNode::ApplyCameraKey(ISelectKey& key, SAnimContext& ec)
if (!bInterpolateCamera && m_pCamNodeOnHoldForInterp)
{
m_pCamNodeOnHoldForInterp->SetSkipInterpolatedCameraNode(false);
m_pCamNodeOnHoldForInterp = 0;
m_pCamNodeOnHoldForInterp = nullptr;
}
SCameraParams cameraParams;
@@ -861,9 +861,9 @@ void CAnimSceneNode::ApplyCameraKey(ISelectKey& key, SAnimContext& ec)
}
IAnimNode* prevCameraAnimNode = m_pSequence->FindNodeByName(prevKey.szSelection.c_str(), this);
if (prevCameraAnimNode == NULL)
if (prevCameraAnimNode == nullptr)
{
prevCameraAnimNode = m_pSequence->FindNodeByName(prevKey.szSelection.c_str(), NULL);
prevCameraAnimNode = m_pSequence->FindNodeByName(prevKey.szSelection.c_str(), nullptr);
}
if (prevCameraAnimNode && prevCameraAnimNode->GetType() == AnimNodeType::Camera && prevCameraAnimNode->GetTrackForParameter(AnimParamType::FOV))
@@ -930,35 +930,33 @@ void CAnimSceneNode::ApplyAudioKey(char const* const sTriggerName, bool const bP
//////////////////////////////////////////////////////////////////////////
void CAnimSceneNode::ApplySequenceKey(IAnimTrack* pTrack, [[maybe_unused]] int nPrevKey, int nCurrKey, ISequenceKey& key, SAnimContext& ec)
{
if (nCurrKey >= 0)
if (nCurrKey < 0)
{
IAnimSequence* pSequence = GetSequenceFromSequenceKey(key);
if (pSequence)
{
float startTime = -FLT_MAX;
float endTime = -FLT_MAX;
return;
}
IAnimSequence* pSequence = GetSequenceFromSequenceKey(key);
if (!pSequence)
{
return;
}
if (key.bOverrideTimes)
{
key.fDuration = (key.fEndTime - key.fStartTime) > 0.0f ? (key.fEndTime - key.fStartTime) : 0.0f;
startTime = key.fStartTime;
endTime = key.fEndTime;
}
else
{
key.fDuration = pSequence->GetTimeRange().Length();
}
if (key.bOverrideTimes)
{
key.fDuration = (key.fEndTime - key.fStartTime) > 0.0f ? (key.fEndTime - key.fStartTime) : 0.0f;
}
else
{
key.fDuration = pSequence->GetTimeRange().Length();
}
pTrack->SetKey(nCurrKey, &key);
pTrack->SetKey(nCurrKey, &key);
SAnimContext newAnimContext = ec;
newAnimContext.time = std::min(ec.time - key.time + key.fStartTime, key.fDuration + key.fStartTime);
SAnimContext newAnimContext = ec;
newAnimContext.time = std::min(ec.time - key.time + key.fStartTime, key.fDuration + key.fStartTime);
if (static_cast<CAnimSequence*>(pSequence)->GetTime() != newAnimContext.time)
{
pSequence->Animate(newAnimContext);
}
}
if (static_cast<CAnimSequence*>(pSequence)->GetTime() != newAnimContext.time)
{
pSequence->Animate(newAnimContext);
}
}
+1 -4
View File
@@ -144,10 +144,7 @@ namespace UnitTest
{
m_cloth->GetClothConfigurator()->SetTransform(m_clothTransform);
static float time = 0.0f;
static float velocity = 1.0f;
time += deltaTime;
constexpr float velocity = 1.0f;
for (auto& sphere : m_sphereColliders)
{
+2 -1
View File
@@ -1225,10 +1225,10 @@ namespace PhysX
AZ_PROFILE_DATAPOINT(Physics, stats.getNbBroadPhaseRemoves(), RootCategory, BroadphaseSubCategory, "BroadPhaseRemoves");
// Compute pair stats for all geometry types
#if AZ_PROFILE_DATAPOINT
AZ::u32 ccdPairs = 0;
AZ::u32 modifiedPairs = 0;
AZ::u32 triggerPairs = 0;
for (AZ::u32 i = 0; i < PxGeometryType::eGEOMETRY_COUNT; i++)
{
// stat[i][j] = stat[j][i], hence, discarding the symmetric entries
@@ -1241,6 +1241,7 @@ namespace PhysX
triggerPairs += stats.getRbPairStats(physx::PxSimulationStatistics::eTRIGGER_PAIRS, firstGeom, secondGeom);
}
}
#endif
[[maybe_unused]] const char* CollisionsSubCategory = "Collisions";
AZ_PROFILE_DATAPOINT(Physics, ccdPairs, RootCategory, CollisionsSubCategory, "CCDPairs");
@@ -51,8 +51,6 @@ namespace Twitch
void TwitchSystemComponent::SetApplicationID(const AZStd::string& twitchApplicationID)
{
bool success = false;
/*
** THIS CAN ONLY BE SET ONCE!!!!!!
*/
@@ -62,7 +60,6 @@ namespace Twitch
if (IsValidTwitchAppID(twitchApplicationID))
{
m_applicationID = twitchApplicationID;
success = true;
}
else
{