diff --git a/Code/Editor/AnimationContext.cpp b/Code/Editor/AnimationContext.cpp index 6e146faacb..fce1150878 100644 --- a/Code/Editor/AnimationContext.cpp +++ b/Code/Editor/AnimationContext.cpp @@ -628,7 +628,7 @@ void CAnimationContext::GoToFrameCmd(IConsoleCmdArgs* pArgs) float targetFrame = (float)atof(pArgs->GetArg(1)); if (pSeq->GetTimeRange().start > targetFrame || targetFrame > pSeq->GetTimeRange().end) { - gEnv->pLog->LogError("GoToFrame: requested time %f is outside the range of sequence %s (%f, %f)", targetFrame, pSeq->GetName(), pSeq->GetTimeRange().start, pSeq->GetTimeRange().end); + gEnv->pLog->LogError("GoToFrame: requested time %f is outside the range of sequence %s (%f, %f)", targetFrame, pSeq->GetName().c_str(), pSeq->GetTimeRange().start, pSeq->GetTimeRange().end); return; } GetIEditor()->GetAnimation()->m_currTime = targetFrame; diff --git a/Code/Editor/EditorPreferencesPageViewportMovement.cpp b/Code/Editor/EditorPreferencesPageViewportMovement.cpp index 988b4954d1..06bcd13c60 100644 --- a/Code/Editor/EditorPreferencesPageViewportMovement.cpp +++ b/Code/Editor/EditorPreferencesPageViewportMovement.cpp @@ -5,6 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ + #include "EditorDefs.h" #include "EditorPreferencesPageViewportMovement.h" @@ -12,44 +13,96 @@ #include // Editor -#include "Settings.h" #include "EditorViewportSettings.h" +#include "Settings.h" void CEditorPreferencesPage_ViewportMovement::Reflect(AZ::SerializeContext& serialize) { serialize.Class() - ->Version(1) - ->Field("MoveSpeed", &CameraMovementSettings::m_moveSpeed) + ->Version(2) + ->Field("TranslateSpeed", &CameraMovementSettings::m_translateSpeed) ->Field("RotateSpeed", &CameraMovementSettings::m_rotateSpeed) - ->Field("FastMoveSpeed", &CameraMovementSettings::m_fastMoveSpeed) - ->Field("WheelZoomSpeed", &CameraMovementSettings::m_wheelZoomSpeed) - ->Field("InvertYAxis", &CameraMovementSettings::m_invertYRotation) - ->Field("InvertPan", &CameraMovementSettings::m_invertPan); + ->Field("BoostMultiplier", &CameraMovementSettings::m_boostMultiplier) + ->Field("ScrollSpeed", &CameraMovementSettings::m_scrollSpeed) + ->Field("DollySpeed", &CameraMovementSettings::m_dollySpeed) + ->Field("PanSpeed", &CameraMovementSettings::m_panSpeed) + ->Field("RotateSmoothing", &CameraMovementSettings::m_rotateSmoothing) + ->Field("RotateSmoothness", &CameraMovementSettings::m_rotateSmoothness) + ->Field("TranslateSmoothing", &CameraMovementSettings::m_translateSmoothing) + ->Field("TranslateSmoothness", &CameraMovementSettings::m_translateSmoothness) + ->Field("CaptureCursorLook", &CameraMovementSettings::m_captureCursorLook) + ->Field("OrbitYawRotationInverted", &CameraMovementSettings::m_orbitYawRotationInverted) + ->Field("PanInvertedX", &CameraMovementSettings::m_panInvertedX) + ->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY); - serialize.Class() - ->Version(1) - ->Field("CameraMovementSettings", &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings); + serialize.Class()->Version(1)->Field( + "CameraMovementSettings", &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings); - - AZ::EditContext* editContext = serialize.GetEditContext(); - if (editContext) + if (AZ::EditContext* editContext = serialize.GetEditContext()) { - editContext->Class("Camera Movement Settings", "") - ->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_moveSpeed, "Camera Movement Speed", "Camera Movement Speed") - ->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_rotateSpeed, "Camera Rotation Speed", "Camera Rotation Speed") - ->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_fastMoveSpeed, "Fast Movement Scale", "Fast Movement Scale (holding shift") - ->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_wheelZoomSpeed, "Wheel Zoom Speed", "Wheel Zoom Speed") - ->DataElement(AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_invertYRotation, "Invert Y Axis", "Invert Y Rotation (holding RMB)") - ->DataElement(AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_invertPan, "Invert Pan", "Invert Pan (holding MMB)"); + editContext->Class("Camera Settings", "") + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_translateSpeed, "Camera Movement Speed", "Camera movement speed") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_rotateSpeed, "Camera Rotation Speed", "Camera rotation speed") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_boostMultiplier, "Camera Boost Multiplier", + "Camera boost multiplier to apply to movement speed") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_scrollSpeed, "Camera Scroll Speed", + "Camera movement speed while using scroll/wheel input") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_dollySpeed, "Camera Dolly Speed", + "Camera movement speed while using mouse motion to move in and out") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_panSpeed, "Camera Pan Speed", + "Camera movement speed while panning using the mouse") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_rotateSmoothing, "Camera Rotate Smoothing", + "Is camera rotation smoothing enabled or disabled") + ->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_rotateSmoothness, "Camera Rotate Smoothness", + "Amount of camera smoothing to apply while rotating the camera") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->Attribute(AZ::Edit::Attributes::Visibility, &CameraMovementSettings::RotateSmoothingVisibility) + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_translateSmoothing, "Camera Translate Smoothing", + "Is camera translation smoothing enabled or disabled") + ->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_translateSmoothness, "Camera Translate Smoothness", + "Amount of camera smoothing to apply while translating the camera") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->Attribute(AZ::Edit::Attributes::Visibility, &CameraMovementSettings::TranslateSmoothingVisibility) + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_orbitYawRotationInverted, "Camera Orbit Yaw Inverted", + "Inverted yaw rotation while orbiting") + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_panInvertedX, "Invert Pan X", + "Invert direction of pan in local X axis") + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_panInvertedY, "Invert Pan Y", + "Invert direction of pan in local Y axis") + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_captureCursorLook, "Camera Capture Look Cursor", + "Should the cursor be captured (hidden) while performing free look"); - editContext->Class("Gizmo Movement Preferences", "Gizmo Movement Preferences") + editContext->Class("Viewport Preferences", "Viewport Preferences") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20)) - ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings, "Camera Movement Settings", "Camera Movement Settings"); + ->DataElement( + AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings, + "Camera Movement Settings", "Camera Movement Settings"); } } - CEditorPreferencesPage_ViewportMovement::CEditorPreferencesPage_ViewportMovement() { InitializeSettings(); @@ -68,21 +121,36 @@ QIcon& CEditorPreferencesPage_ViewportMovement::GetIcon() void CEditorPreferencesPage_ViewportMovement::OnApply() { - SandboxEditor::SetCameraTranslateSpeed(m_cameraMovementSettings.m_moveSpeed); + SandboxEditor::SetCameraTranslateSpeed(m_cameraMovementSettings.m_translateSpeed); SandboxEditor::SetCameraRotateSpeed(m_cameraMovementSettings.m_rotateSpeed); - SandboxEditor::SetCameraBoostMultiplier(m_cameraMovementSettings.m_fastMoveSpeed); - SandboxEditor::SetCameraScrollSpeed(m_cameraMovementSettings.m_wheelZoomSpeed); - SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_invertYRotation); - SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_invertPan); - SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_invertPan); + SandboxEditor::SetCameraBoostMultiplier(m_cameraMovementSettings.m_boostMultiplier); + SandboxEditor::SetCameraScrollSpeed(m_cameraMovementSettings.m_scrollSpeed); + SandboxEditor::SetCameraDollyMotionSpeed(m_cameraMovementSettings.m_dollySpeed); + SandboxEditor::SetCameraPanSpeed(m_cameraMovementSettings.m_panSpeed); + SandboxEditor::SetCameraRotateSmoothness(m_cameraMovementSettings.m_rotateSmoothness); + SandboxEditor::SetCameraRotateSmoothingEnabled(m_cameraMovementSettings.m_rotateSmoothing); + SandboxEditor::SetCameraTranslateSmoothness(m_cameraMovementSettings.m_translateSmoothness); + SandboxEditor::SetCameraTranslateSmoothingEnabled(m_cameraMovementSettings.m_translateSmoothing); + SandboxEditor::SetCameraCaptureCursorForLook(m_cameraMovementSettings.m_captureCursorLook); + SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_orbitYawRotationInverted); + SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_panInvertedX); + SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_panInvertedY); } void CEditorPreferencesPage_ViewportMovement::InitializeSettings() { - m_cameraMovementSettings.m_moveSpeed = SandboxEditor::CameraTranslateSpeed(); + m_cameraMovementSettings.m_translateSpeed = SandboxEditor::CameraTranslateSpeed(); m_cameraMovementSettings.m_rotateSpeed = SandboxEditor::CameraRotateSpeed(); - m_cameraMovementSettings.m_fastMoveSpeed = SandboxEditor::CameraBoostMultiplier(); - m_cameraMovementSettings.m_wheelZoomSpeed = SandboxEditor::CameraScrollSpeed(); - m_cameraMovementSettings.m_invertYRotation = SandboxEditor::CameraOrbitYawRotationInverted(); - m_cameraMovementSettings.m_invertPan = SandboxEditor::CameraPanInvertedX() && SandboxEditor::CameraPanInvertedY(); + m_cameraMovementSettings.m_boostMultiplier = SandboxEditor::CameraBoostMultiplier(); + m_cameraMovementSettings.m_scrollSpeed = SandboxEditor::CameraScrollSpeed(); + m_cameraMovementSettings.m_dollySpeed = SandboxEditor::CameraDollyMotionSpeed(); + m_cameraMovementSettings.m_panSpeed = SandboxEditor::CameraPanSpeed(); + m_cameraMovementSettings.m_rotateSmoothness = SandboxEditor::CameraRotateSmoothness(); + m_cameraMovementSettings.m_rotateSmoothing = SandboxEditor::CameraRotateSmoothingEnabled(); + m_cameraMovementSettings.m_translateSmoothness = SandboxEditor::CameraTranslateSmoothness(); + m_cameraMovementSettings.m_translateSmoothing = SandboxEditor::CameraTranslateSmoothingEnabled(); + m_cameraMovementSettings.m_captureCursorLook = SandboxEditor::CameraCaptureCursorForLook(); + m_cameraMovementSettings.m_orbitYawRotationInverted = SandboxEditor::CameraOrbitYawRotationInverted(); + m_cameraMovementSettings.m_panInvertedX = SandboxEditor::CameraPanInvertedX(); + m_cameraMovementSettings.m_panInvertedY = SandboxEditor::CameraPanInvertedY(); } diff --git a/Code/Editor/EditorPreferencesPageViewportMovement.h b/Code/Editor/EditorPreferencesPageViewportMovement.h index 1373260e62..a973c34f1a 100644 --- a/Code/Editor/EditorPreferencesPageViewportMovement.h +++ b/Code/Editor/EditorPreferencesPageViewportMovement.h @@ -5,17 +5,21 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ + #pragma once #include "Include/IPreferencesPage.h" -#include -#include #include +#include +#include #include +inline AZ::Crc32 EditorPropertyVisibility(const bool enabled) +{ + return enabled ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide; +} -class CEditorPreferencesPage_ViewportMovement - : public IPreferencesPage +class CEditorPreferencesPage_ViewportMovement : public IPreferencesPage { public: AZ_RTTI(CEditorPreferencesPage_ViewportMovement, "{BC593332-7EAF-4171-8A35-1C5DE5B40909}", IPreferencesPage) @@ -25,12 +29,22 @@ public: CEditorPreferencesPage_ViewportMovement(); virtual ~CEditorPreferencesPage_ViewportMovement() = default; - virtual const char* GetCategory() override { return "Viewports"; } + virtual const char* GetCategory() override + { + return "Viewports"; + } + virtual const char* GetTitle(); virtual QIcon& GetIcon() override; virtual void OnApply() override; - virtual void OnCancel() override {} - virtual bool OnQueryCancel() override { return true; } + virtual void OnCancel() override + { + } + + virtual bool OnQueryCancel() override + { + return true; + } private: void InitializeSettings(); @@ -39,16 +53,32 @@ private: { AZ_TYPE_INFO(CameraMovementSettings, "{60B8C07E-5F48-4171-A50B-F45558B5CCA1}") - float m_moveSpeed; + float m_translateSpeed; float m_rotateSpeed; - float m_fastMoveSpeed; - float m_wheelZoomSpeed; - bool m_invertYRotation; - bool m_invertPan; + float m_scrollSpeed; + float m_dollySpeed; + float m_panSpeed; + float m_boostMultiplier; + float m_rotateSmoothness; + bool m_rotateSmoothing; + float m_translateSmoothness; + bool m_translateSmoothing; + bool m_captureCursorLook; + bool m_orbitYawRotationInverted; + bool m_panInvertedX; + bool m_panInvertedY; + + AZ::Crc32 RotateSmoothingVisibility() const + { + return EditorPropertyVisibility(m_rotateSmoothing); + } + + AZ::Crc32 TranslateSmoothingVisibility() const + { + return EditorPropertyVisibility(m_translateSmoothing); + } }; CameraMovementSettings m_cameraMovementSettings; QIcon m_icon; }; - - diff --git a/Code/Editor/Export/ExportManager.cpp b/Code/Editor/Export/ExportManager.cpp index 7601740033..220c341f5c 100644 --- a/Code/Editor/Export/ExportManager.cpp +++ b/Code/Editor/Export/ExportManager.cpp @@ -622,7 +622,7 @@ bool CExportManager::ShowFBXExportDialog() if (pivotObjectNode && !pivotObjectNode->IsGroupNode()) { - m_pivotEntityObject = static_cast(GetIEditor()->GetObjectManager()->FindObject(pivotObjectNode->GetName())); + m_pivotEntityObject = static_cast(GetIEditor()->GetObjectManager()->FindObject(pivotObjectNode->GetName().c_str())); if (m_pivotEntityObject) { @@ -807,7 +807,7 @@ void CExportManager::FillAnimTimeNode(XmlNodeRef writeNode, CTrackViewAnimNode* if (numAllTracks > 0) { - XmlNodeRef objNode = writeNode->createNode(CleanXMLText(pObjectNode->GetName()).toUtf8().data()); + XmlNodeRef objNode = writeNode->createNode(CleanXMLText(pObjectNode->GetName().c_str()).toUtf8().data()); writeNode->setAttr("time", m_animTimeExportPrimarySequenceCurrentTime); for (unsigned int trackID = 0; trackID < numAllTracks; ++trackID) @@ -818,7 +818,7 @@ void CExportManager::FillAnimTimeNode(XmlNodeRef writeNode, CTrackViewAnimNode* if (trackType == AnimParamType::Animation || trackType == AnimParamType::Sound) { - QString childName = CleanXMLText(childTrack->GetName()); + QString childName = CleanXMLText(childTrack->GetName().c_str()); if (childName.isEmpty()) { @@ -976,7 +976,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo else { // In case of exporting animation/sound times data - const QString sequenceName = pSubSequence->GetName(); + const QString sequenceName = QString::fromUtf8(pSubSequence->GetName().c_str()); XmlNodeRef subSeqNode2 = seqNode->createNode(sequenceName.toUtf8().data()); if (sequenceName == m_animTimeExportPrimarySequenceName) @@ -1253,14 +1253,14 @@ void CExportManager::SaveNodeKeysTimeToXML() m_soundKeyTimeExport = exportDialog.IsSoundExportChecked(); QString filters = "All files (*.xml)"; - QString defaultName = QString(pSequence->GetName()) + ".xml"; + QString defaultName = QString::fromUtf8(pSequence->GetName().c_str()) + ".xml"; QtUtil::QtMFCScopedHWNDCapture cap; CAutoDirectoryRestoreFileDialog dlg(QFileDialog::AcceptSave, QFileDialog::AnyFile, "xml", defaultName, filters, {}, {}, cap); if (dlg.exec()) { - m_animTimeNode = XmlHelpers::CreateXmlNode(pSequence->GetName()); - m_animTimeExportPrimarySequenceName = pSequence->GetName(); + m_animTimeNode = XmlHelpers::CreateXmlNode(pSequence->GetName().c_str()); + m_animTimeExportPrimarySequenceName = QString::fromUtf8(pSequence->GetName().c_str()); m_data.Clear(); m_animTimeExportPrimarySequenceCurrentTime = 0.0; diff --git a/Code/Editor/TrackView/TVSequenceProps.cpp b/Code/Editor/TrackView/TVSequenceProps.cpp index d4e06d0c94..0abab65645 100644 --- a/Code/Editor/TrackView/TVSequenceProps.cpp +++ b/Code/Editor/TrackView/TVSequenceProps.cpp @@ -53,7 +53,7 @@ CTVSequenceProps::~CTVSequenceProps() // CTVSequenceProps message handlers bool CTVSequenceProps::OnInitDialog() { - ui->NAME->setText(m_pSequence->GetName()); + ui->NAME->setText(m_pSequence->GetName().c_str()); int seqFlags = m_pSequence->GetFlags(); ui->ALWAYS_PLAY->setChecked((seqFlags & IAnimSequence::eSeqFlags_PlayOnReset)); @@ -141,7 +141,7 @@ void CTVSequenceProps::UpdateSequenceProps(const QString& name) ac->UpdateTimeRange(); } - QString seqName = m_pSequence->GetName(); + QString seqName = QString::fromUtf8(m_pSequence->GetName().c_str()); if (name != seqName) { // Rename sequence. diff --git a/Code/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Editor/TrackView/TrackViewAnimNode.cpp index 4b1ea688ee..2119bf849f 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.cpp +++ b/Code/Editor/TrackView/TrackViewAnimNode.cpp @@ -423,7 +423,7 @@ CTrackViewAnimNode* CTrackViewAnimNode::CreateSubNode( AZStd::string::format( "Failed to add '%s' to sequence '%s', could not find associated entity. " "Please try adding the entity associated with '%s'.", - originalNameStr.constData(), director->GetName(), originalNameStr.constData())); + originalNameStr.constData(), director->GetName().c_str(), originalNameStr.constData())); return nullptr; } @@ -472,7 +472,7 @@ CTrackViewAnimNode* CTrackViewAnimNode::CreateSubNode( { GetIEditor()->GetMovieSystem()->LogUserNotificationMsg( AZStd::string::format("'%s' already exists in sequence '%s', skipping...", - originalNameStr.constData(), director2->GetName())); + originalNameStr.constData(), director2->GetName().c_str())); return nullptr; } @@ -488,7 +488,7 @@ CTrackViewAnimNode* CTrackViewAnimNode::CreateSubNode( if (!newAnimNode) { GetIEditor()->GetMovieSystem()->LogUserNotificationMsg( - AZStd::string::format("Failed to add '%s' to sequence '%s'.", nameStr.constData(), director->GetName())); + AZStd::string::format("Failed to add '%s' to sequence '%s'.", nameStr.constData(), director->GetName().c_str())); return nullptr; } @@ -1195,7 +1195,7 @@ CTrackViewAnimNodeBundle CTrackViewAnimNode::GetAnimNodesByName(const char* pNam { CTrackViewAnimNodeBundle bundle; - QString nodeName = GetName(); + QString nodeName = QString::fromUtf8(GetName().c_str()); if (GetNodeType() == eTVNT_AnimNode && QString::compare(pName, nodeName, Qt::CaseInsensitive) == 0) { bundle.AppendAnimNode(this); @@ -1215,10 +1215,9 @@ CTrackViewAnimNodeBundle CTrackViewAnimNode::GetAnimNodesByName(const char* pNam } ////////////////////////////////////////////////////////////////////////// -const char* CTrackViewAnimNode::GetParamName(const CAnimParamType& paramType) const +AZStd::string CTrackViewAnimNode::GetParamName(const CAnimParamType& paramType) const { - const char* pName = m_animNode->GetParamName(paramType); - return pName ? pName : ""; + return m_animNode->GetParamName(paramType); } ////////////////////////////////////////////////////////////////////////// @@ -1274,7 +1273,7 @@ CTrackViewAnimNodeBundle CTrackViewAnimNode::AddSelectedEntities(const AZStd::ve if (existingNode->GetDirector() == GetDirector()) { GetIEditor()->GetMovieSystem()->LogUserNotificationMsg(AZStd::string::format( - "'%s' was already added to '%s', skipping...", entity->GetName().c_str(), GetDirector()->GetName())); + "'%s' was already added to '%s', skipping...", entity->GetName().c_str(), GetDirector()->GetName().c_str())); continue; } @@ -1377,7 +1376,7 @@ void CTrackViewAnimNode::UpdateDynamicParams() void CTrackViewAnimNode::CopyKeysToClipboard(XmlNodeRef& xmlNode, const bool bOnlySelectedKeys, const bool bOnlyFromSelectedTracks) { XmlNodeRef childNode = xmlNode->createNode("Node"); - childNode->setAttr("name", GetName()); + childNode->setAttr("name", GetName().c_str()); childNode->setAttr("type", static_cast(GetType())); for (auto iter = m_childNodes.begin(); iter != m_childNodes.end(); ++iter) @@ -1683,7 +1682,7 @@ bool CTrackViewAnimNode::IsValidReparentingTo(CTrackViewAnimNode* pNewParent) } // Check if the new parent already contains a node with this name - CTrackViewAnimNodeBundle foundNodes = pNewParent->GetAnimNodesByName(GetName()); + CTrackViewAnimNodeBundle foundNodes = pNewParent->GetAnimNodesByName(GetName().c_str()); if (foundNodes.GetCount() > 1 || (foundNodes.GetCount() == 1 && foundNodes.GetNode(0) != this)) { return false; diff --git a/Code/Editor/TrackView/TrackViewAnimNode.h b/Code/Editor/TrackView/TrackViewAnimNode.h index 466e60bcf0..aa6474ccdb 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.h +++ b/Code/Editor/TrackView/TrackViewAnimNode.h @@ -124,7 +124,7 @@ public: virtual void SetAsViewCamera(); // Name setter/getter - virtual const char* GetName() const override { return m_animNode->GetName(); } + AZStd::string GetName() const override { return m_animNode->GetName(); } virtual bool SetName(const char* pName) override; virtual bool CanBeRenamed() const override; @@ -187,7 +187,7 @@ public: // Param unsigned int GetParamCount() const; CAnimParamType GetParamType(unsigned int index) const; - const char* GetParamName(const CAnimParamType& paramType) const; + AZStd::string GetParamName(const CAnimParamType& paramType) const; bool IsParamValid(const CAnimParamType& param) const; IAnimNode::ESupportedParamFlags GetParamFlags(const CAnimParamType& paramType) const; AnimValueType GetParamValueType(const CAnimParamType& paramType) const; diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index d44d8535de..cfaa82fdb4 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -1122,7 +1122,7 @@ void CTrackViewDialog::ReloadSequencesComboBox() { CTrackViewSequence* sequence = pSequenceManager->GetSequenceByIndex(k); QString entityIdString = GetEntityIdAsString(sequence->GetSequenceComponentEntityId()); - m_sequencesComboBox->addItem(sequence->GetName(), entityIdString); + m_sequencesComboBox->addItem(QString::fromUtf8(sequence->GetName().c_str()), entityIdString); } } @@ -2030,7 +2030,7 @@ void CTrackViewDialog::UpdateTracksToolBar() continue; } - name = pAnimNode->GetParamName(paramType); + name = QString::fromUtf8(pAnimNode->GetParamName(paramType).c_str()); QString sToolTipText("Add " + name + " Track"); QIcon hIcon = m_wndNodesCtrl->GetIconForTrack(pTrack); @@ -2306,7 +2306,7 @@ void CTrackViewDialog::SaveCurrentSequenceToFBX() return; } - QString selectedSequenceFBXStr = QString(sequence->GetName()) + ".fbx"; + QString selectedSequenceFBXStr = QString::fromUtf8(sequence->GetName().c_str()) + ".fbx"; CExportManager* pExportManager = static_cast(GetIEditor()->GetExportManager()); const char szFilters[] = "FBX Files (*.fbx)"; diff --git a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp index 12af760e95..a14da0ae09 100644 --- a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp +++ b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp @@ -3446,7 +3446,7 @@ void CTrackViewDopeSheetBase::DrawNodeTrack(CTrackViewAnimNode* animNode, QPaint const QRect textRect = trackRect.adjusted(4, 0, -4, 0); - QString sAnimNodeName = animNode->GetName(); + QString sAnimNodeName = QString::fromUtf8(animNode->GetName().c_str()); const bool hasObsoleteTrack = animNode->HasObsoleteTrack(); if (hasObsoleteTrack) diff --git a/Code/Editor/TrackView/TrackViewNode.cpp b/Code/Editor/TrackView/TrackViewNode.cpp index b61f7fcf29..208210f1e7 100644 --- a/Code/Editor/TrackView/TrackViewNode.cpp +++ b/Code/Editor/TrackView/TrackViewNode.cpp @@ -622,7 +622,7 @@ bool CTrackViewNode::operator<(const CTrackViewNode& otherNode) const if (thisTypeOrder == otherTypeOrder) { // Same node type, sort by name - return azstricmp(thisAnimNode.GetName(), otherAnimNode.GetName()) < 0; + return thisAnimNode.GetName() < otherAnimNode.GetName(); } return thisTypeOrder < otherTypeOrder; @@ -634,7 +634,7 @@ bool CTrackViewNode::operator<(const CTrackViewNode& otherNode) const if (thisTrack.GetParameterType() == otherTrack.GetParameterType()) { // Same parameter type, sort by name - return azstricmp(thisTrack.GetName(), otherTrack.GetName()) < 0; + return thisTrack.GetName() < otherTrack.GetName(); } return thisTrack.GetParameterType() < otherTrack.GetParameterType(); diff --git a/Code/Editor/TrackView/TrackViewNode.h b/Code/Editor/TrackView/TrackViewNode.h index 3c005b7fd9..59df06750b 100644 --- a/Code/Editor/TrackView/TrackViewNode.h +++ b/Code/Editor/TrackView/TrackViewNode.h @@ -156,7 +156,7 @@ public: virtual ~CTrackViewNode() {} // Name - virtual const char* GetName() const = 0; + virtual AZStd::string GetName() const = 0; virtual bool SetName([[maybe_unused]] const char* pName) { return false; }; virtual bool CanBeRenamed() const { return false; } diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index ae38323cc3..e3b994c488 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -616,7 +616,7 @@ CTrackViewNodesCtrl::CRecord* CTrackViewNodesCtrl::AddAnimNodeRecord(CRecord* pP { CRecord* pNewRecord = new CRecord(animNode); - pNewRecord->setText(0, animNode->GetName()); + pNewRecord->setText(0, QString::fromUtf8(animNode->GetName().c_str())); UpdateAnimNodeRecord(pNewRecord, animNode); pParentRecord->insertChild(GetInsertPosition(pParentRecord, animNode), pNewRecord); FillNodesRec(pNewRecord, animNode); @@ -629,7 +629,7 @@ CTrackViewNodesCtrl::CRecord* CTrackViewNodesCtrl::AddTrackRecord(CRecord* pPare { CRecord* pNewTrackRecord = new CRecord(pTrack); pNewTrackRecord->setSizeHint(0, QSize(30, 18)); - pNewTrackRecord->setText(0, pTrack->GetName()); + pNewTrackRecord->setText(0, QString::fromUtf8(pTrack->GetName().c_str())); UpdateTrackRecord(pNewTrackRecord, pTrack); pParentRecord->insertChild(GetInsertPosition(pParentRecord, pTrack), pNewTrackRecord); FillNodesRec(pNewTrackRecord, pTrack); @@ -860,7 +860,7 @@ void CTrackViewNodesCtrl::OnFillItems() m_nodeToRecordMap.clear(); CRecord* pRootGroupRec = new CRecord(sequence); - pRootGroupRec->setText(0, sequence->GetName()); + pRootGroupRec->setText(0, QString::fromUtf8(sequence->GetName().c_str())); QFont f = font(); f.setBold(true); pRootGroupRec->setData(0, Qt::FontRole, f); @@ -1032,8 +1032,8 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) return; } - QString file = QString(sequence2->GetName()) + QString(".fbx"); - QString selectedSequenceFBXStr = QString(sequence2->GetName()) + ".fbx"; + QString file = QString::fromUtf8(sequence2->GetName().c_str()) + QString(".fbx"); + QString selectedSequenceFBXStr = QString::fromUtf8(sequence2->GetName().c_str()) + ".fbx"; if (numSelectedNodes > 1) { @@ -1041,7 +1041,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) } else { - file = QString(selectedNodes.GetNode(0)->GetName()) + QString(".fbx"); + file = QString::fromUtf8(selectedNodes.GetNode(0)->GetName().c_str()) + QString(".fbx"); } QString path = QFileDialog::getSaveFileName(this, tr("Export Selected Nodes To FBX File"), QString(), tr("FBX Files (*.fbx)")); @@ -1338,7 +1338,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) if (animNode || groupNode) { CTrackViewAnimNode* animNode2 = static_cast(pNode); - QString oldName = animNode2->GetName(); + QString oldName = QString::fromUtf8(animNode2->GetName().c_str()); StringDlg dlg(tr("Rename Node")); dlg.SetString(oldName); @@ -1494,7 +1494,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) if (animNode) { QString matName; - GetMatNameAndSubMtlIndexFromName(matName, animNode->GetName()); + GetMatNameAndSubMtlIndexFromName(matName, animNode->GetName().c_str()); QString newMatName; newMatName = tr("%1.[%2]").arg(matName).arg(cmd - eMI_SelectSubmaterialBase + 1); CUndo undo("Rename TrackView node"); @@ -1576,7 +1576,7 @@ CTrackViewTrack* CTrackViewNodesCtrl::GetTrackViewTrack(const Export::EntityAnim for (unsigned int trackID = 0; trackID < trackBundle.GetCount(); ++trackID) { CTrackViewTrack* pTrack = trackBundle.GetTrack(trackID); - const QString bundleTrackName = pTrack->GetAnimNode()->GetName(); + const QString bundleTrackName = QString::fromUtf8(pTrack->GetAnimNode()->GetName().c_str()); if (bundleTrackName.compare(nodeName, Qt::CaseInsensitive) != 0) { @@ -2164,7 +2164,7 @@ int CTrackViewNodesCtrl::ShowPopupMenuSingleSelection(SContextMenu& contextMenu, if (bOnNode && !pNode->IsGroupNode()) { AddMenuSeperatorConditional(contextMenu.main, bAppended); - QString string = QString("%1 Tracks").arg(animNode->GetName()); + QString string = QString("%1 Tracks").arg(animNode->GetName().c_str()); contextMenu.main.addAction(string)->setEnabled(false); bool bAppendedTrackFlag = false; @@ -2182,7 +2182,7 @@ int CTrackViewNodesCtrl::ShowPopupMenuSingleSelection(SContextMenu& contextMenu, continue; } - QAction* a = contextMenu.main.addAction(QString(" %1").arg(pTrack2->GetName())); + QAction* a = contextMenu.main.addAction(QString(" %1").arg(pTrack2->GetName().c_str())); a->setData(eMI_ShowHideBase + childIndex); a->setCheckable(true); a->setChecked(!pTrack2->IsHidden()); @@ -2348,13 +2348,12 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con continue; } } - name = animNode->GetParamName(paramType); - QStringList splittedName = name.split("/", Qt::SkipEmptyParts); + name = QString::fromUtf8(animNode->GetParamName(paramType).c_str()); + QStringList splitName = name.split("/", Qt::SkipEmptyParts); STrackMenuTreeNode* pCurrentNode = &menuAddTrack; - for (int j = 0; j < splittedName.size() - 1; ++j) + for (const QString& segment : splitName) { - const QString& segment = splittedName[j]; auto findIter = pCurrentNode->children.find(segment); if (findIter != pCurrentNode->children.end()) { @@ -2370,10 +2369,10 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con // only add tracks to the that STrackMenuTreeNode tree that haven't already been added CTrackViewTrackBundle matchedTracks = animNode->GetTracksByParam(paramType); - if (matchedTracks.GetCount() == 0) + if (matchedTracks.GetCount() == 0 && !splitName.isEmpty()) { STrackMenuTreeNode* pParamNode = new STrackMenuTreeNode; - pCurrentNode->children[splittedName.back()] = std::unique_ptr(pParamNode); + pCurrentNode->children[splitName.back()] = std::unique_ptr(pParamNode); pParamNode->paramType = paramType; bTracksToAdd = true; @@ -2464,7 +2463,7 @@ void CTrackViewNodesCtrl::FillAutoCompletionListForFilter() for (unsigned int i = 0; i < animNodeCount; ++i) { - strings << animNodes.GetNode(i)->GetName(); + strings << QString::fromUtf8(animNodes.GetNode(i)->GetName().c_str()); } } else @@ -2580,10 +2579,10 @@ void CTrackViewNodesCtrl::Update() { const CTrackViewAnimNode* track = static_cast(node); if (track) - { - record->setText(0, track->GetName()); + { + record->setText(0, QString::fromUtf8(track->GetName().c_str())); } - } + } } } } @@ -2855,7 +2854,7 @@ void CTrackViewNodesCtrl::OnNodeRenamed(CTrackViewNode* pNode, [[maybe_unused]] if (!m_bIgnoreNotifications) { CRecord* pNodeRecord = GetNodeRecord(pNode); - pNodeRecord->setText(0, pNode->GetName()); + pNodeRecord->setText(0, QString::fromUtf8(pNode->GetName().c_str())); update(); } diff --git a/Code/Editor/TrackView/TrackViewNodes.h b/Code/Editor/TrackView/TrackViewNodes.h index fc9804b4e4..64f96fee78 100644 --- a/Code/Editor/TrackView/TrackViewNodes.h +++ b/Code/Editor/TrackView/TrackViewNodes.h @@ -66,7 +66,7 @@ public: CRecord(CTrackViewNode* pNode = nullptr); CTrackViewNode* GetNode() const { return m_pNode; } bool IsGroup() const { return m_pNode->GetChildCount() != 0; } - const QString GetName() const { return m_pNode->GetName(); } + const QString GetName() const { return QString::fromUtf8(m_pNode->GetName().c_str()); } // Workaround: CXTPReportRecord::IsVisible is // unreliable after the last visible element diff --git a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp index d50060269b..72da1e0b18 100644 --- a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp +++ b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp @@ -293,8 +293,8 @@ namespace CTrackViewTrack* pTrack = pNode->GetTrackForParameter(paramType); if (!pTrack || (paramFlags & IAnimNode::eSupportedParamFlags_MultipleTracks)) { - const char* name = pNode->GetParamName(paramType); - if (_stricmp(name, paramName) == 0) + AZStd::string name = pNode->GetParamName(paramType); + if (name == paramName) { CUndo undo("Create track"); if (!pNode->CreateTrack(paramType)) diff --git a/Code/Editor/TrackView/TrackViewSequence.cpp b/Code/Editor/TrackView/TrackViewSequence.cpp index 76609ac947..519f7a44d0 100644 --- a/Code/Editor/TrackView/TrackViewSequence.cpp +++ b/Code/Editor/TrackView/TrackViewSequence.cpp @@ -892,14 +892,14 @@ bool CTrackViewSequence::SetName(const char* name) return false; } - const char* oldName = GetName(); - if (0 != strcmp(name, oldName)) + AZStd::string oldName = GetName(); + if (name != oldName) { m_pAnimSequence->SetName(name); MarkAsModified(); AzToolsFramework::ScopedUndoBatch undoBatch("Rename Sequence"); - GetSequence()->OnNodeRenamed(this, oldName); + GetSequence()->OnNodeRenamed(this, oldName.c_str()); undoBatch.MarkEntityDirty(m_pAnimSequence->GetSequenceEntityId()); } diff --git a/Code/Editor/TrackView/TrackViewSequence.h b/Code/Editor/TrackView/TrackViewSequence.h index 66412360f2..69858adf8f 100644 --- a/Code/Editor/TrackView/TrackViewSequence.h +++ b/Code/Editor/TrackView/TrackViewSequence.h @@ -102,7 +102,7 @@ public: // ITrackViewNode virtual ETrackViewNodeType GetNodeType() const override { return eTVNT_Sequence; } - virtual const char* GetName() const override { return m_pAnimSequence->GetName(); } + virtual AZStd::string GetName() const override { return m_pAnimSequence->GetName(); } virtual bool SetName(const char* pName) override; virtual bool CanBeRenamed() const override { return true; } diff --git a/Code/Editor/TrackView/TrackViewSequenceManager.cpp b/Code/Editor/TrackView/TrackViewSequenceManager.cpp index 780c8f04ce..d7c1e3c709 100644 --- a/Code/Editor/TrackView/TrackViewSequenceManager.cpp +++ b/Code/Editor/TrackView/TrackViewSequenceManager.cpp @@ -75,7 +75,7 @@ CTrackViewSequence* CTrackViewSequenceManager::GetSequenceByName(QString name) c { CTrackViewSequence* sequence = (*iter).get(); - if (sequence->GetName() == name) + if (QString::fromUtf8(sequence->GetName().c_str()) == name) { return sequence; } @@ -371,8 +371,8 @@ void CTrackViewSequenceManager::SortSequences() std::stable_sort(m_sequences.begin(), m_sequences.end(), [](const std::unique_ptr& a, const std::unique_ptr& b) -> bool { - QString aName = a.get()->GetName(); - QString bName = b.get()->GetName(); + QString aName = QString::fromUtf8(a.get()->GetName().c_str()); + QString bName = QString::fromUtf8(b.get()->GetName().c_str()); return aName < bName; }); } diff --git a/Code/Editor/TrackView/TrackViewTrack.cpp b/Code/Editor/TrackView/TrackViewTrack.cpp index 64fd252534..27d6bbee54 100644 --- a/Code/Editor/TrackView/TrackViewTrack.cpp +++ b/Code/Editor/TrackView/TrackViewTrack.cpp @@ -472,7 +472,7 @@ void CTrackViewTrack::RestoreFromMemento(const CTrackViewTrackMemento& memento) } ////////////////////////////////////////////////////////////////////////// -const char* CTrackViewTrack::GetName() const +AZStd::string CTrackViewTrack::GetName() const { CTrackViewNode* pParentNode = GetParentNode(); @@ -810,7 +810,7 @@ void CTrackViewTrack::CopyKeysToClipboard(XmlNodeRef& xmlNode, const bool bOnlyS } XmlNodeRef childNode = xmlNode->newChild("Track"); - childNode->setAttr("name", GetName()); + childNode->setAttr("name", GetName().c_str()); GetParameterType().SaveToXml(childNode); childNode->setAttr("valueType", static_cast(GetValueType())); diff --git a/Code/Editor/TrackView/TrackViewTrack.h b/Code/Editor/TrackView/TrackViewTrack.h index bbe81f6377..1eef9c60e9 100644 --- a/Code/Editor/TrackView/TrackViewTrack.h +++ b/Code/Editor/TrackView/TrackViewTrack.h @@ -80,7 +80,7 @@ public: CTrackViewAnimNode* GetAnimNode() const; // Name getter - virtual const char* GetName() const; + AZStd::string GetName() const override; // CTrackViewNode virtual ETrackViewNodeType GetNodeType() const override { return eTVNT_Track; } diff --git a/Code/Editor/TrackView/TrackViewUndo.cpp b/Code/Editor/TrackView/TrackViewUndo.cpp index c9cdc62bc3..ee31dfe2bf 100644 --- a/Code/Editor/TrackView/TrackViewUndo.cpp +++ b/Code/Editor/TrackView/TrackViewUndo.cpp @@ -75,7 +75,7 @@ CTrackViewTrack* CUndoComponentEntityTrackObject::FindTrack(CTrackViewSequence* CTrackViewTrack* curTrack = allTracks.GetTrack(trackIndex); if (curTrack->GetAnimNode() && curTrack->GetAnimNode()->GetComponentId() == m_trackComponentId) { - if (0 == azstricmp(curTrack->GetName(), m_trackName.c_str())) + if (curTrack->GetName() == m_trackName) { CTrackViewAnimNode* parentAnimNode = static_cast(curTrack->GetAnimNode()->GetParentNode()); if (parentAnimNode && parentAnimNode->GetAzEntityId() == m_entityId) diff --git a/Code/Editor/TrackViewNewSequenceDialog.cpp b/Code/Editor/TrackViewNewSequenceDialog.cpp index 287f69df47..e922f345cc 100644 --- a/Code/Editor/TrackViewNewSequenceDialog.cpp +++ b/Code/Editor/TrackViewNewSequenceDialog.cpp @@ -81,7 +81,7 @@ void CTVNewSequenceDialog::OnOK() for (unsigned int k = 0; k < GetIEditor()->GetSequenceManager()->GetCount(); ++k) { CTrackViewSequence* pSequence = GetIEditor()->GetSequenceManager()->GetSequenceByIndex(k); - QString fullname = pSequence->GetName(); + QString fullname = QString::fromUtf8(pSequence->GetName().c_str()); if (fullname.compare(m_sequenceName, Qt::CaseInsensitive) == 0) { diff --git a/Code/Editor/Util/FileUtil.cpp b/Code/Editor/Util/FileUtil.cpp index 435ec67a99..610a9c6e16 100644 --- a/Code/Editor/Util/FileUtil.cpp +++ b/Code/Editor/Util/FileUtil.cpp @@ -1221,15 +1221,14 @@ bool CFileUtil::CreatePath(const QString& strPath) if (!strDriveLetter.isEmpty()) { strCurrentDirectoryPath = strDriveLetter; - strCurrentDirectoryPath += "\\"; + strCurrentDirectoryPath += AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING; } - nTotalPathQueueElements = cstrDirectoryQueue.size(); for (nCurrentPathQueue = 0; nCurrentPathQueue < nTotalPathQueueElements; ++nCurrentPathQueue) { strCurrentDirectoryPath += cstrDirectoryQueue[static_cast(nCurrentPathQueue)]; - strCurrentDirectoryPath += "\\"; + strCurrentDirectoryPath += AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING; // The value which will go out of this loop is the result of the attempt to create the // last directory, only. @@ -2158,7 +2157,6 @@ uint32 CFileUtil::GetAttributes(const char* filename, bool bUseSourceControl /*= return SCC_FILE_ATTRIBUTE_READONLY | SCC_FILE_ATTRIBUTE_INPAK; } - const char* adjustedFile = file.GetAdjustedFilename(); if (!AZ::IO::SystemFile::Exists(adjustedFile)) { diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index c8911a6ac4..8af48e47f6 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -77,11 +77,4 @@ namespace AZ::Debug }; } // namespace AZ::Debug -#ifdef USE_PIX -// The pix3 header unfortunately brings in other Windows macros we need to undef -#undef DeleteFile -#undef LoadImage -#undef GetCurrentTime -#endif - #include diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h b/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h index 8563dc9251..d2eaa3446f 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h @@ -70,3 +70,13 @@ #if defined(GetCommandLine) #undef GetCommandLine #endif +#if defined(LoadImage) +#undef LoadImage +#endif +#if defined(DeleteFile) +#undef DeleteFile +#endif +#if defined(GetCurrentTime) +#undef GetCurrentTime +#endif + diff --git a/Code/Legacy/CryCommon/IMovieSystem.h b/Code/Legacy/CryCommon/IMovieSystem.h index ed62624871..5d878c45ec 100644 --- a/Code/Legacy/CryCommon/IMovieSystem.h +++ b/Code/Legacy/CryCommon/IMovieSystem.h @@ -376,7 +376,7 @@ struct IAnimTrack virtual int GetSubTrackCount() const = 0; // Retrieve pointer the specfied sub track. virtual IAnimTrack* GetSubTrack(int nIndex) const = 0; - virtual const char* GetSubTrackName(int nIndex) const = 0; + virtual AZStd::string GetSubTrackName(int nIndex) const = 0; virtual void SetSubTrackName(int nIndex, const char* name) = 0; ////////////////////////////////////////////////////////////////////////// @@ -623,7 +623,7 @@ public: , valueType(_valueType) , flags(_flags) {}; - const char* name; // parameter name. + AZStd::string name; // parameter name. CAnimParamType paramType; // parameter id. AnimValueType valueType; // value type, defines type of track to use for animating this parameter. ESupportedParamFlags flags; // combination of flags from ESupportedParamFlags. @@ -736,7 +736,7 @@ public: // Returns name of supported parameter of this animation node or NULL if not available // Arguments: // paramType - parameter id - virtual const char* GetParamName(const CAnimParamType& paramType) const = 0; + virtual AZStd::string GetParamName(const CAnimParamType& paramType) const = 0; // Description: // Returns the params value type diff --git a/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h b/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h index e2ea9a39c2..8d988d0df5 100644 --- a/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h +++ b/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h @@ -440,7 +440,7 @@ struct IUiAnimTrack virtual int GetSubTrackCount() const = 0; // Retrieve pointer the specfied sub track. virtual IUiAnimTrack* GetSubTrack(int nIndex) const = 0; - virtual const char* GetSubTrackName(int nIndex) const = 0; + virtual AZStd::string GetSubTrackName(int nIndex) const = 0; virtual void SetSubTrackName(int nIndex, const char* name) = 0; ////////////////////////////////////////////////////////////////////////// @@ -632,7 +632,7 @@ public: virtual void SetName(const char* name) = 0; //! Get node name. - virtual const char* GetName() = 0; + virtual AZStd::string GetName() = 0; // Get Type of this node. virtual EUiAnimNodeType GetType() const = 0; @@ -708,13 +708,13 @@ public: // Returns name of supported parameter of this animation node or NULL if not available // Arguments: // paramType - parameter id - virtual const char* GetParamName(const CUiAnimParamType& paramType) const = 0; + virtual AZStd::string GetParamName(const CUiAnimParamType& paramType) const = 0; // Description: // Returns name of supported parameter of this animation node or NULL if not available // Arguments: // paramType - parameter id - virtual const char* GetParamNameForTrack(const CUiAnimParamType& paramType, [[maybe_unused]] const IUiAnimTrack* track) const { return GetParamName(paramType); } + virtual AZStd::string GetParamNameForTrack(const CUiAnimParamType& paramType, [[maybe_unused]] const IUiAnimTrack* track) const { return GetParamName(paramType); } // Description: // Returns the params value type diff --git a/Code/Tools/GridHub/GridHub/main.cpp b/Code/Tools/GridHub/GridHub/main.cpp index bfb82efd0d..3b853910be 100644 --- a/Code/Tools/GridHub/GridHub/main.cpp +++ b/Code/Tools/GridHub/GridHub/main.cpp @@ -361,7 +361,7 @@ public: else { // remove from start up folder - DeleteFile(fullLinkName); + DeleteFileW(fullLinkName); } #endif #if AZ_TRAIT_OS_PLATFORM_APPLE diff --git a/Gems/LyShine/Code/Editor/Animation/AnimationContext.cpp b/Gems/LyShine/Code/Editor/Animation/AnimationContext.cpp index c2c05277a8..8f8864106b 100644 --- a/Gems/LyShine/Code/Editor/Animation/AnimationContext.cpp +++ b/Gems/LyShine/Code/Editor/Animation/AnimationContext.cpp @@ -521,7 +521,7 @@ void CUiAnimationContext::OnEditorNotifyEvent(EEditorNotifyEvent event) case eNotify_OnBeginLayerExport: if (m_pSequence) { - m_sequenceName = m_pSequence->GetName(); + m_sequenceName = QString::fromUtf8(m_pSequence->GetName().c_str()); } else { diff --git a/Gems/LyShine/Code/Editor/Animation/UiAVSequenceProps.cpp b/Gems/LyShine/Code/Editor/Animation/UiAVSequenceProps.cpp index db8a96830b..a2df73cf26 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAVSequenceProps.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAVSequenceProps.cpp @@ -45,7 +45,7 @@ CUiAVSequenceProps::~CUiAVSequenceProps() // CUiAVSequenceProps message handlers bool CUiAVSequenceProps::OnInitDialog() { - QString name = m_pSequence->GetName(); + QString name = QString::fromUtf8(m_pSequence->GetName().c_str()); ui->NAME->setText(name); ui->MOVE_SCALE_KEYS->setChecked(false); @@ -135,7 +135,7 @@ void CUiAVSequenceProps::OnOK() ac->UpdateTimeRange(); } - QString seqName = m_pSequence->GetName(); + QString seqName = QString::fromUtf8(m_pSequence->GetName().c_str()); if (name != seqName) { // Rename sequence. diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp index 54ea410349..41397ce265 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp @@ -1241,7 +1241,7 @@ CUiAnimViewAnimNodeBundle CUiAnimViewAnimNode::GetAnimNodesByName(const char* pN { CUiAnimViewAnimNodeBundle bundle; - QString nodeName = GetName(); + QString nodeName = QString::fromUtf8(GetName().c_str()); if (GetNodeType() == eUiAVNT_AnimNode && QString::compare(pName, nodeName, Qt::CaseInsensitive) == 0) { bundle.AppendAnimNode(this); @@ -1261,17 +1261,15 @@ CUiAnimViewAnimNodeBundle CUiAnimViewAnimNode::GetAnimNodesByName(const char* pN } ////////////////////////////////////////////////////////////////////////// -const char* CUiAnimViewAnimNode::GetParamName(const CUiAnimParamType& paramType) const +AZStd::string CUiAnimViewAnimNode::GetParamName(const CUiAnimParamType& paramType) const { - const char* pName = m_pAnimNode->GetParamName(paramType); - return pName ? pName : ""; + return m_pAnimNode->GetParamName(paramType); } ////////////////////////////////////////////////////////////////////////// -const char* CUiAnimViewAnimNode::GetParamNameForTrack(const CUiAnimParamType& paramType, const IUiAnimTrack* track) const +AZStd::string CUiAnimViewAnimNode::GetParamNameForTrack(const CUiAnimParamType& paramType, const IUiAnimTrack* track) const { - const char* pName = m_pAnimNode->GetParamNameForTrack(paramType, track); - return pName ? pName : ""; + return m_pAnimNode->GetParamNameForTrack(paramType, track); } ////////////////////////////////////////////////////////////////////////// @@ -1408,7 +1406,7 @@ void CUiAnimViewAnimNode::UpdateDynamicParams() void CUiAnimViewAnimNode::CopyKeysToClipboard(XmlNodeRef& xmlNode, const bool bOnlySelectedKeys, const bool bOnlyFromSelectedTracks) { XmlNodeRef childNode = xmlNode->createNode("Node"); - childNode->setAttr("name", GetName()); + childNode->setAttr("name", GetName().c_str()); childNode->setAttr("type", GetType()); for (auto iter = m_childNodes.begin(); iter != m_childNodes.end(); ++iter) @@ -1552,7 +1550,7 @@ bool CUiAnimViewAnimNode::IsValidReparentingTo(CUiAnimViewAnimNode* pNewParent) } // Check if the new parent already contains a node with this name - CUiAnimViewAnimNodeBundle foundNodes = pNewParent->GetAnimNodesByName(GetName()); + CUiAnimViewAnimNodeBundle foundNodes = pNewParent->GetAnimNodesByName(GetName().c_str()); if (foundNodes.GetCount() > 1 || (foundNodes.GetCount() == 1 && foundNodes.GetNode(0) != this)) { return false; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h index 72dc7344ec..abc4a84c8c 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h @@ -118,7 +118,7 @@ public: virtual bool IsActive(); // Name setter/getter - virtual const char* GetName() const override { return m_pAnimNode->GetName(); } + AZStd::string GetName() const override { return m_pAnimNode->GetName(); } virtual bool SetName(const char* pName) override; virtual bool CanBeRenamed() const override; @@ -164,8 +164,8 @@ public: // Param unsigned int GetParamCount() const; CUiAnimParamType GetParamType(unsigned int index) const; - const char* GetParamName(const CUiAnimParamType& paramType) const; - const char* GetParamNameForTrack(const CUiAnimParamType& paramType, const IUiAnimTrack* track) const; + AZStd::string GetParamName(const CUiAnimParamType& paramType) const; + AZStd::string GetParamNameForTrack(const CUiAnimParamType& paramType, const IUiAnimTrack* track) const; bool IsParamValid(const CUiAnimParamType& param) const; IUiAnimNode::ESupportedParamFlags GetParamFlags(const CUiAnimParamType& paramType) const; EUiAnimValue GetParamValueType(const CUiAnimParamType& paramType) const; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp index 16d3b2b921..a9f76cd443 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp @@ -980,7 +980,7 @@ void CUiAnimViewDialog::ReloadSequencesComboBox() for (unsigned int k = 0; k < numSequences; ++k) { CUiAnimViewSequence* pSequence = pSequenceManager->GetSequenceByIndex(k); - QString fullname = pSequence->GetName(); + QString fullname = QString::fromUtf8(pSequence->GetName().c_str()); m_sequencesComboBox->addItem(fullname); } } @@ -1120,7 +1120,7 @@ void CUiAnimViewDialog::OnSequenceChanged(CUiAnimViewSequence* pSequence) if (pSequence) { - m_currentSequenceName = pSequence->GetName(); + m_currentSequenceName = QString::fromUtf8(pSequence->GetName().c_str()); pSequence->Reset(true); SaveZoomScrollSettings(); @@ -1721,7 +1721,7 @@ void CUiAnimViewDialog::OnNodeRenamed(CUiAnimViewNode* pNode, const char* pOldNa { if (m_currentSequenceName == QString(pOldName)) { - m_currentSequenceName = pNode->GetName(); + m_currentSequenceName = QString::fromUtf8(pNode->GetName().c_str()); } ReloadSequencesComboBox(); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp index 443480ab0d..8672f539bf 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp @@ -2974,7 +2974,7 @@ void CUiAnimViewDopeSheetBase::DrawNodeTrack(CUiAnimViewAnimNode* pAnimNode, QPa const QRect textRect = trackRect.adjusted(4, 0, -4, 0); - QString sAnimNodeName = pAnimNode->GetName(); + QString sAnimNodeName = QString::fromUtf8(pAnimNode->GetName().c_str()); const bool hasObsoleteTrack = pAnimNode->HasObsoleteTrack(); if (hasObsoleteTrack) diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp index 511866db43..0b4ce7f633 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp @@ -61,8 +61,8 @@ void CUiAnimViewFindDlg::FillData() { IUiAnimNode* pNode = seq->GetNode(i); ObjName obj; - obj.m_objName = pNode->GetName(); - obj.m_directorName = pNode->HasDirectorAsParent() ? pNode->HasDirectorAsParent()->GetName() : ""; + obj.m_objName = QString::fromUtf8(pNode->GetName().c_str()); + obj.m_directorName = pNode->HasDirectorAsParent() ? QString::fromUtf8(pNode->HasDirectorAsParent()->GetName().c_str()) : ""; AZStd::string fullname = seq->GetName(); obj.m_seqName = fullname.c_str(); m_objs.push_back(obj); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp index 3dd49574fd..e7ad1b91ea 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp @@ -46,7 +46,7 @@ void CUiAVNewSequenceDialog::OnOK() for (unsigned int k = 0; k < CUiAnimViewSequenceManager::GetSequenceManager()->GetCount(); ++k) { CUiAnimViewSequence* pSequence = CUiAnimViewSequenceManager::GetSequenceManager()->GetSequenceByIndex(k); - QString fullname = pSequence->GetName(); + QString fullname = QString::fromUtf8(pSequence->GetName().c_str()); if (fullname.compare(m_sequenceName, Qt::CaseInsensitive) == 0) { diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp index 3c1292910f..fd9207bc13 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp @@ -594,7 +594,7 @@ bool CUiAnimViewNode::operator<(const CUiAnimViewNode& otherNode) const if (thisTypeOrder == otherTypeOrder) { // Same node type, sort by name - return azstricmp(thisAnimNode.GetName(), otherAnimNode.GetName()) < 0; + return thisAnimNode.GetName() < otherAnimNode.GetName(); } return thisTypeOrder < otherTypeOrder; @@ -606,7 +606,7 @@ bool CUiAnimViewNode::operator<(const CUiAnimViewNode& otherNode) const if (thisTrack.GetParameterType() == otherTrack.GetParameterType()) { // Same parameter type, sort by name - return azstricmp(thisTrack.GetName(), otherTrack.GetName()) < 0; + return thisTrack.GetName() < otherTrack.GetName(); } return thisTrack.GetParameterType() < otherTrack.GetParameterType(); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h index 0213cbb410..80946eb317 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h @@ -156,7 +156,7 @@ public: virtual ~CUiAnimViewNode() {} // Name - virtual const char* GetName() const = 0; + virtual AZStd::string GetName() const = 0; virtual bool SetName([[maybe_unused]] const char* pName) { return false; }; virtual bool CanBeRenamed() const { return false; } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp index a6c4e2424b..472100b334 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp @@ -413,7 +413,7 @@ CUiAnimViewNodesCtrl::CRecord* CUiAnimViewNodesCtrl::AddAnimNodeRecord(CRecord* { CRecord* pNewRecord = new CRecord(pAnimNode); - pNewRecord->setText(0, pAnimNode->GetName()); + pNewRecord->setText(0, QString::fromUtf8(pAnimNode->GetName().c_str())); UpdateUiAnimNodeRecord(pNewRecord, pAnimNode); pParentRecord->insertChild(GetInsertPosition(pParentRecord, pAnimNode), pNewRecord); FillNodesRec(pNewRecord, pAnimNode); @@ -426,7 +426,7 @@ CUiAnimViewNodesCtrl::CRecord* CUiAnimViewNodesCtrl::AddTrackRecord(CRecord* pPa { CRecord* pNewTrackRecord = new CRecord(pTrack); pNewTrackRecord->setSizeHint(0, QSize(30, 18)); - pNewTrackRecord->setText(0, pTrack->GetName()); + pNewTrackRecord->setText(0, QString::fromUtf8(pTrack->GetName().c_str())); UpdateTrackRecord(pNewTrackRecord, pTrack); pParentRecord->insertChild(GetInsertPosition(pParentRecord, pTrack), pNewTrackRecord); FillNodesRec(pNewTrackRecord, pTrack); @@ -576,7 +576,7 @@ void CUiAnimViewNodesCtrl::UpdateUiAnimNodeRecord(CRecord* pRecord, CUiAnimViewA int nNodeImage = GetIconIndexForNode(nodeType); assert(m_imageList.contains(nNodeImage)); - QString nodeName = pAnimNode->GetName(); + QString nodeName = QString::fromUtf8(pAnimNode->GetName().c_str()); pRecord->setIcon(0, m_imageList[nNodeImage]); @@ -635,7 +635,7 @@ void CUiAnimViewNodesCtrl::OnFillItems() m_nodeToRecordMap.clear(); CRecord* pRootGroupRec = new CRecord(pSequence); - pRootGroupRec->setText(0, pSequence->GetName()); + pRootGroupRec->setText(0, QString::fromUtf8(pSequence->GetName().c_str())); QFont f = font(); f.setBold(true); pRootGroupRec->setData(0, Qt::FontRole, f); @@ -987,7 +987,7 @@ void CUiAnimViewNodesCtrl::OnNMRclick(QPoint point) if (pAnimNode) { QString matName; - GetMatNameAndSubMtlIndexFromName(matName, pAnimNode->GetName()); + GetMatNameAndSubMtlIndexFromName(matName, pAnimNode->GetName().c_str()); QString newMatName; newMatName = QStringLiteral("%1.[%2]").arg(matName).arg(cmd - eMI_SelectSubmaterialBase + 1); UiAnimUndo undo("Rename Animation node"); @@ -1229,7 +1229,7 @@ int CUiAnimViewNodesCtrl::ShowPopupMenuSingleSelection(UiAnimContextMenu& contex if (bOnNode && !pNode->IsGroupNode()) { AddMenuSeperatorConditional(contextMenu.main, bAppended); - QString string = QString("%1 Tracks").arg(pAnimNode->GetName()); + QString string = QString("%1 Tracks").arg(QString::fromUtf8(pAnimNode->GetName().c_str())); contextMenu.main.addAction(string)->setEnabled(false); bool bAppendedTrackFlag = false; @@ -1247,7 +1247,7 @@ int CUiAnimViewNodesCtrl::ShowPopupMenuSingleSelection(UiAnimContextMenu& contex continue; } - QAction* a = contextMenu.main.addAction(QString(" %1").arg(pTrack2->GetName())); + QAction* a = contextMenu.main.addAction(QString(" %1").arg(QString::fromUtf8(pTrack2->GetName().c_str()))); a->setData(eMI_ShowHideBase + childIndex); a->setCheckable(true); a->setChecked(!pTrack2->IsHidden()); @@ -1383,7 +1383,7 @@ void CUiAnimViewNodesCtrl::FillAutoCompletionListForFilter() for (unsigned int i = 0; i < animNodeCount; ++i) { - strings << QString(animNodes.GetNode(i)->GetName()); + strings << QString::fromUtf8(animNodes.GetNode(i)->GetName().c_str()); } } else @@ -1687,7 +1687,7 @@ void CUiAnimViewNodesCtrl::OnNodeRenamed(CUiAnimViewNode* pNode, [[maybe_unused] if (!m_bIgnoreNotifications) { CRecord* pNodeRecord = GetNodeRecord(pNode); - pNodeRecord->setText(0, pNode->GetName()); + pNodeRecord->setText(0, QString::fromUtf8(pNode->GetName().c_str())); update(); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h index c7226da23f..38cc6d8384 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h @@ -56,7 +56,7 @@ public: CRecord(CUiAnimViewNode* pNode = nullptr); CUiAnimViewNode* GetNode() const { return m_pNode; } bool IsGroup() const { return m_pNode->GetChildCount() != 0; } - const QString GetName() const { return m_pNode->GetName(); } + const QString GetName() const { return QString::fromUtf8(m_pNode->GetName().c_str()); } // Workaround: CXTPReportRecord::IsVisible is // unreliable after the last visible element diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp index 9c26100bad..5d89957397 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp @@ -334,7 +334,7 @@ void CUiAnimViewSequence::OnNodeRenamed(CUiAnimViewNode* pNode, const char* pOld bool bLightAnimationSetActive = GetFlags() & IUiAnimSequence::eSeqFlags_LightAnimationSet; if (bLightAnimationSetActive) { - UpdateLightAnimationRefs(pOldName, pNode->GetName()); + UpdateLightAnimationRefs(pOldName, pNode->GetName().c_str()); } if (m_bNoNotifications) diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.h index 69c933509f..3aa8d74563 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.h @@ -86,7 +86,7 @@ public: // IUiAnimViewNode virtual EUiAnimViewNodeType GetNodeType() const override { return eUiAVNT_Sequence; } - virtual const char* GetName() const override { return m_pAnimSequence->GetName(); } + AZStd::string GetName() const override { return m_pAnimSequence->GetName(); } virtual bool SetName(const char* pName) override; virtual bool CanBeRenamed() const override { return true; } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.cpp index 7a0d637a9e..4cfeeaff6a 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.cpp @@ -58,7 +58,7 @@ CUiAnimViewSequence* CUiAnimViewSequenceManager::GetSequenceByName(QString name) { CUiAnimViewSequence* pSequence = (*iter).get(); - if (pSequence->GetName() == name) + if (QString::fromUtf8(pSequence->GetName().c_str()) == name) { return pSequence; } @@ -156,8 +156,8 @@ void CUiAnimViewSequenceManager::SortSequences() std::stable_sort(m_sequences.begin(), m_sequences.end(), [](const std::unique_ptr& a, const std::unique_ptr& b) -> bool { - QString aName = a.get()->GetName(); - QString bName = b.get()->GetName(); + QString aName = QString::fromUtf8(a.get()->GetName().c_str()); + QString bName = QString::fromUtf8(b.get()->GetName().c_str()); return aName < bName; }); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp index 382b589ac3..e071a3e631 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp @@ -28,7 +28,7 @@ public: CUndoUiAnimViewSplineCtrl(CUiAnimViewSplineCtrl* pCtrl, std::vector& splineContainer) : CUndoAnimKeySelection(CUiAnimViewSequenceManager::GetSequenceManager()->GetAnimationContext()->GetSequence()) { - m_sequenceName = CUiAnimViewSequenceManager::GetSequenceManager()->GetAnimationContext()->GetSequence()->GetName(); + m_sequenceName = QString::fromUtf8(CUiAnimViewSequenceManager::GetSequenceManager()->GetAnimationContext()->GetSequence()->GetName().c_str()); m_pCtrl = pCtrl; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp index d5983f8a40..fe120d7f33 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp @@ -405,7 +405,7 @@ void CUiAnimViewTrack::RestoreFromMemento(const CUiAnimViewTrackMemento& memento } ////////////////////////////////////////////////////////////////////////// -const char* CUiAnimViewTrack::GetName() const +AZStd::string CUiAnimViewTrack::GetName() const { CUiAnimViewNode* pParentNode = GetParentNode(); @@ -630,7 +630,7 @@ void CUiAnimViewTrack::CopyKeysToClipboard(XmlNodeRef& xmlNode, const bool bOnly EBUS_EVENT_RESULT(animationSystem, UiEditorAnimationBus, GetAnimationSystem); XmlNodeRef childNode = xmlNode->newChild("Track"); - childNode->setAttr("name", GetName()); + childNode->setAttr("name", GetName().c_str()); GetParameterType().Serialize(animationSystem, childNode, false); childNode->setAttr("valueType", GetValueType()); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h index a2e38edc51..b16dbf6dfa 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h @@ -73,7 +73,7 @@ public: CUiAnimViewAnimNode* GetAnimNode() const; // Name getter - virtual const char* GetName() const; + AZStd::string GetName() const override; // CUiAnimViewNode virtual EUiAnimViewNodeType GetNodeType() const override { return eUiAVNT_Track; } diff --git a/Gems/LyShine/Code/Source/Animation/AnimNode.cpp b/Gems/LyShine/Code/Source/Animation/AnimNode.cpp index be7ce78c9a..9086d68f01 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AnimNode.cpp @@ -56,7 +56,7 @@ int CUiAnimNode::GetTrackCount() const return static_cast(m_tracks.size()); } -const char* CUiAnimNode::GetParamName(const CUiAnimParamType& paramType) const +AZStd::string CUiAnimNode::GetParamName(const CUiAnimParamType& paramType) const { SParamInfo info; if (GetParamInfoFromType(paramType, info)) @@ -627,7 +627,7 @@ void CUiAnimNode::Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyT EUiAnimNodeType nodeType = GetType(); static_cast(GetUiAnimationSystem())->SerializeNodeType(nodeType, xmlNode, bLoading, IUiAnimSequence::kSequenceVersion, m_flags); - xmlNode->setAttr("Name", GetName()); + xmlNode->setAttr("Name", GetName().c_str()); // Don't store expanded or selected flags int flags = GetFlags() & ~(eUiAnimNodeFlags_Expanded | eUiAnimNodeFlags_EntitySelected); diff --git a/Gems/LyShine/Code/Source/Animation/AnimNode.h b/Gems/LyShine/Code/Source/Animation/AnimNode.h index dc3144dfba..6ac198a5c7 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimNode.h +++ b/Gems/LyShine/Code/Source/Animation/AnimNode.h @@ -39,7 +39,7 @@ public: , valueType(_valueType) , flags(_flags) {}; - const char* name; // parameter name. + AZStd::string name; // parameter name. CUiAnimParamType paramType; // parameter id. EUiAnimValue valueType; // value type, defines type of track to use for animating this parameter. ESupportedParamFlags flags; // combination of flags from ESupportedParamFlags. @@ -58,7 +58,7 @@ public: ////////////////////////////////////////////////////////////////////////// void SetName(const char* name) override { m_name = name; }; - const char* GetName() { return m_name.c_str(); }; + AZStd::string GetName() override { return m_name; }; void SetSequence(IUiAnimSequence* pSequence) override { m_pSequence = pSequence; } // Return Animation Sequence that owns this node. @@ -81,7 +81,7 @@ public: ////////////////////////////////////////////////////////////////////////// bool IsParamValid(const CUiAnimParamType& paramType) const; - virtual const char* GetParamName(const CUiAnimParamType& param) const; + AZStd::string GetParamName(const CUiAnimParamType& param) const override; virtual EUiAnimValue GetParamValueType(const CUiAnimParamType& paramType) const; virtual IUiAnimNode::ESupportedParamFlags GetParamFlags(const CUiAnimParamType& paramType) const; virtual unsigned int GetParamCount() const { return 0; }; diff --git a/Gems/LyShine/Code/Source/Animation/AnimSplineTrack.h b/Gems/LyShine/Code/Source/Animation/AnimSplineTrack.h index cd94277795..0bc625155a 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimSplineTrack.h +++ b/Gems/LyShine/Code/Source/Animation/AnimSplineTrack.h @@ -47,7 +47,7 @@ public: virtual int GetSubTrackCount() const { return 0; }; virtual IUiAnimTrack* GetSubTrack([[maybe_unused]] int nIndex) const { return 0; }; - virtual const char* GetSubTrackName([[maybe_unused]] int nIndex) const { return NULL; }; + AZStd::string GetSubTrackName([[maybe_unused]] int nIndex) const override { return AZStd::string(); }; virtual void SetSubTrackName([[maybe_unused]] int nIndex, [[maybe_unused]] const char* name) { assert(0); } virtual const CUiAnimParamType& GetParameterType() const { return m_nParamType; }; diff --git a/Gems/LyShine/Code/Source/Animation/AnimTrack.h b/Gems/LyShine/Code/Source/Animation/AnimTrack.h index df0ae3a805..9645572e3e 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimTrack.h +++ b/Gems/LyShine/Code/Source/Animation/AnimTrack.h @@ -32,7 +32,7 @@ public: virtual int GetSubTrackCount() const { return 0; }; virtual IUiAnimTrack* GetSubTrack([[maybe_unused]] int nIndex) const { return 0; }; - virtual const char* GetSubTrackName([[maybe_unused]] int nIndex) const { return NULL; }; + AZStd::string GetSubTrackName([[maybe_unused]] int nIndex) const override { return AZStd::string(); }; virtual void SetSubTrackName([[maybe_unused]] int nIndex, [[maybe_unused]] const char* name) { assert(0); } virtual const CUiAnimParamType& GetParameterType() const { return m_nParamType; }; diff --git a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp index b93453129e..cc4e70e010 100644 --- a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp @@ -363,7 +363,7 @@ void CUiAnimAzEntityNode::ComputeOffsetsFromElementNames() } ////////////////////////////////////////////////////////////////////////// -const char* CUiAnimAzEntityNode::GetParamName(const CUiAnimParamType& param) const +AZStd::string CUiAnimAzEntityNode::GetParamName(const CUiAnimParamType& param) const { SParamInfo info; if (GetParamInfoFromType(param, info)) @@ -381,7 +381,7 @@ const char* CUiAnimAzEntityNode::GetParamName(const CUiAnimParamType& param) con } ////////////////////////////////////////////////////////////////////////// -const char* CUiAnimAzEntityNode::GetParamNameForTrack(const CUiAnimParamType& param, const IUiAnimTrack* track) const +AZStd::string CUiAnimAzEntityNode::GetParamNameForTrack(const CUiAnimParamType& param, const IUiAnimTrack* track) const { // for Az Component Fields we use the name from the ClassElement if (param == eUiAnimParamType_AzComponentField) diff --git a/Gems/LyShine/Code/Source/Animation/AzEntityNode.h b/Gems/LyShine/Code/Source/Animation/AzEntityNode.h index 56680f1094..9771ac7be3 100644 --- a/Gems/LyShine/Code/Source/Animation/AzEntityNode.h +++ b/Gems/LyShine/Code/Source/Animation/AzEntityNode.h @@ -91,8 +91,8 @@ public: ////////////////////////////////////////////////////////////////////////// virtual unsigned int GetParamCount() const; virtual CUiAnimParamType GetParamType(unsigned int nIndex) const; - virtual const char* GetParamName(const CUiAnimParamType& param) const; - const char* GetParamNameForTrack(const CUiAnimParamType& param, const IUiAnimTrack* track) const override; + AZStd::string GetParamName(const CUiAnimParamType& param) const override; + AZStd::string GetParamNameForTrack(const CUiAnimParamType& param, const IUiAnimTrack* track) const override; static int GetParamCountStatic(); static bool GetParamInfoStatic(int nIndex, SParamInfo& info); diff --git a/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.cpp b/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.cpp index dee96ee22a..a9b7dde6cd 100644 --- a/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.cpp +++ b/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.cpp @@ -386,10 +386,10 @@ IUiAnimTrack* UiCompoundSplineTrack::GetSubTrack(int nIndex) const } ////////////////////////////////////////////////////////////////////////// -const char* UiCompoundSplineTrack::GetSubTrackName(int nIndex) const +AZStd::string UiCompoundSplineTrack::GetSubTrackName(int nIndex) const { assert(nIndex >= 0 && nIndex < m_nDimensions); - return m_subTrackNames[nIndex].c_str(); + return m_subTrackNames[nIndex]; } diff --git a/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h b/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h index 3ae230d4e4..127b6593fb 100644 --- a/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h +++ b/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h @@ -37,7 +37,7 @@ public: virtual int GetSubTrackCount() const { return m_nDimensions; }; virtual IUiAnimTrack* GetSubTrack(int nIndex) const; - virtual const char* GetSubTrackName(int nIndex) const; + AZStd::string GetSubTrackName(int nIndex) const override; virtual void SetSubTrackName(int nIndex, const char* name); virtual EUiAnimCurveType GetCurveType() { return eUiAnimCurveType_BezierFloat; }; diff --git a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp index ace82c4944..012eaacd1b 100644 --- a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp +++ b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp @@ -735,7 +735,7 @@ void UiAnimationSystem::ShowPlayedSequencesDebug() //f32 purple[4] = {1, 0, 1, 1}; //f32 white[4] = {1, 1, 1, 1}; float y = 10.0f; - std::vector names; + AZStd::vector names; for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); ++it) { @@ -756,23 +756,18 @@ void UiAnimationSystem::ShowPlayedSequencesDebug() { // Checks nodes which happen to be in several sequences. // Those can be a bug, since several sequences may try to control the same entity. - const char* name = playingSequence.sequence->GetNode(i)->GetName(); + AZStd::string name = playingSequence.sequence->GetNode(i)->GetName(); bool alreadyThere = false; - for (size_t k = 0; k < names.size(); ++k) + if (AZStd::find(names.begin(), names.end(), name) != names.end()) { - if (strcmp(names[k], name) == 0) - { - alreadyThere = true; - break; - } + alreadyThere = true; } - - if (alreadyThere == false) + else { 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); + //gEnv->pRenderer->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; diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h b/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h index 5ad3ab6f94..43f49e8b80 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h @@ -152,14 +152,14 @@ private: { m_displayName = other.m_displayName; m_animNodeParamInfo.paramType = other.m_displayName; - m_animNodeParamInfo.name = &m_displayName[0]; + m_animNodeParamInfo.name = m_displayName; } BehaviorPropertyInfo& operator=(const AZStd::string& str) { // TODO: clean this up - this weird memory sharing was copied from legacy Cry - could be better. m_displayName = str; m_animNodeParamInfo.paramType = str; // set type to AnimParamType::ByString by assigning a string - m_animNodeParamInfo.name = &m_displayName[0]; + m_animNodeParamInfo.name = m_displayName; return *this; } diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp index 828e5ad20f..c141dc51c8 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp @@ -77,7 +77,7 @@ int CAnimNode::GetTrackCount() const return static_cast(m_tracks.size()); } -const char* CAnimNode::GetParamName(const CAnimParamType& paramType) const +AZStd::string CAnimNode::GetParamName(const CAnimParamType& paramType) const { SParamInfo info; if (GetParamInfoFromType(paramType, info)) diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimNode.h b/Gems/Maestro/Code/Source/Cinematics/AnimNode.h index 418d667c34..7c56d8f641 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimNode.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimNode.h @@ -86,7 +86,7 @@ public: ////////////////////////////////////////////////////////////////////////// bool IsParamValid(const CAnimParamType& paramType) const; - virtual const char* GetParamName(const CAnimParamType& param) const; + AZStd::string GetParamName(const CAnimParamType& param) const override; virtual AnimValueType GetParamValueType(const CAnimParamType& paramType) const; virtual IAnimNode::ESupportedParamFlags GetParamFlags(const CAnimParamType& paramType) const; virtual unsigned int GetParamCount() const { return 0; }; diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimSplineTrack.h b/Gems/Maestro/Code/Source/Cinematics/AnimSplineTrack.h index 5167a8e7b1..46dcb63daa 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimSplineTrack.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimSplineTrack.h @@ -54,7 +54,7 @@ public: virtual int GetSubTrackCount() const { return 0; }; virtual IAnimTrack* GetSubTrack([[maybe_unused]] int nIndex) const { return 0; }; - virtual const char* GetSubTrackName([[maybe_unused]] int nIndex) const { return NULL; }; + AZStd::string GetSubTrackName([[maybe_unused]] int nIndex) const { return AZStd::string(); }; virtual void SetSubTrackName([[maybe_unused]] int nIndex, [[maybe_unused]] const char* name) { assert(0); } void SetNode(IAnimNode* node) override { m_node = node; } diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h b/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h index b65dad1323..e16f64c7c1 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h @@ -37,7 +37,7 @@ public: virtual int GetSubTrackCount() const { return 0; }; virtual IAnimTrack* GetSubTrack([[maybe_unused]] int nIndex) const { return 0; }; - virtual const char* GetSubTrackName([[maybe_unused]] int nIndex) const { return NULL; }; + AZStd::string GetSubTrackName([[maybe_unused]] int nIndex) const override { return AZStd::string(); }; virtual void SetSubTrackName([[maybe_unused]] int nIndex, [[maybe_unused]] const char* name) { assert(0); } virtual const CAnimParamType& GetParameterType() const { return m_nParamType; }; diff --git a/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.cpp b/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.cpp index 884a90b200..d134d5f0f7 100644 --- a/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.cpp @@ -346,10 +346,10 @@ IAnimTrack* CCompoundSplineTrack::GetSubTrack(int nIndex) const } ////////////////////////////////////////////////////////////////////////// -const char* CCompoundSplineTrack::GetSubTrackName(int nIndex) const +AZStd::string CCompoundSplineTrack::GetSubTrackName(int nIndex) const { assert(nIndex >= 0 && nIndex < m_nDimensions); - return m_subTrackNames[nIndex].c_str(); + return m_subTrackNames[nIndex]; } diff --git a/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.h b/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.h index b0a2733316..443bad584b 100644 --- a/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.h +++ b/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.h @@ -38,7 +38,7 @@ public: virtual int GetSubTrackCount() const { return m_nDimensions; }; virtual IAnimTrack* GetSubTrack(int nIndex) const; - virtual const char* GetSubTrackName(int nIndex) const; + AZStd::string GetSubTrackName(int nIndex) const; virtual void SetSubTrackName(int nIndex, const char* name); virtual EAnimCurveType GetCurveType() { return eAnimCurveType_BezierFloat; }; diff --git a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp index 74b0fb1063..9a54b21d7f 100644 --- a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp @@ -217,7 +217,7 @@ bool CAnimMaterialNode::GetParamInfoFromType(const CAnimParamType& paramId, SPar } ////////////////////////////////////////////////////////////////////////// -const char* CAnimMaterialNode::GetParamName(const CAnimParamType& param) const +AZStd::string CAnimMaterialNode::GetParamName(const CAnimParamType& param) const { if (param.GetType() == AnimParamType::ByString) { diff --git a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.h b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.h index 003312c426..63f287f513 100644 --- a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.h +++ b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.h @@ -37,7 +37,7 @@ public: ////////////////////////////////////////////////////////////////////////// virtual unsigned int GetParamCount() const; virtual CAnimParamType GetParamType(unsigned int nIndex) const; - virtual const char* GetParamName(const CAnimParamType& paramType) const; + AZStd::string GetParamName(const CAnimParamType& paramType) const override; virtual void GetKeyValueRange(float& fMin, float& fMax) const { fMin = m_fMinKeyValue; fMax = m_fMaxKeyValue; }; virtual void SetKeyValueRange(float fMin, float fMax){ m_fMinKeyValue = fMin; m_fMaxKeyValue = fMax; }; diff --git a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp index 961eef2176..7e96c83810 100644 --- a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp +++ b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp @@ -40,6 +40,8 @@ AZ_PUSH_DISABLE_WARNING(4702, "-Wunknown-warning-option") // OpenMesh\Core\Utils #include AZ_POP_DISABLE_WARNING +AZ_DECLARE_BUDGET(AzToolsFramework); + namespace OpenMesh { template<> diff --git a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp index cbde5f4f4b..ff4961a55c 100644 --- a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp +++ b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp @@ -11,6 +11,8 @@ #include #include +AZ_DECLARE_BUDGET(AzToolsFramework); + namespace WhiteBox { void DrawEdges( diff --git a/cmake/PAL.cmake b/cmake/PAL.cmake index 341df79f1a..67ed17b6d4 100644 --- a/cmake/PAL.cmake +++ b/cmake/PAL.cmake @@ -112,7 +112,8 @@ function(read_engine_restricted_path output_restricted_path) # Set manifest path to path in the user home directory set(manifest_path ${LY_ROOT_FOLDER}/engine.json) if(EXISTS ${manifest_path}) - o3de_restricted_path(${manifest_path} output_restricted_path) + o3de_restricted_path(${manifest_path} read_restricted_path) + set(${output_restricted_path} ${read_restricted_path} PARENT_SCOPE) endif() endfunction() @@ -133,16 +134,17 @@ ly_set(PAL_HOST_PLATFORM_NAME_LOWERCASE ${PAL_HOST_PLATFORM_NAME_LOWERCASE}) set(PAL_RESTRICTED_PLATFORMS) -string(LENGTH "${O3DE_ENGINE_RESTRICTED_PATH}" engine_restricted_length) file(GLOB pal_restricted_files ${O3DE_ENGINE_RESTRICTED_PATH}/*/cmake/PAL_*.cmake) foreach(pal_restricted_file ${pal_restricted_files}) - string(FIND ${pal_restricted_file} "/cmake/PAL" end) - if(${end} GREATER -1) - math(EXPR platform_length "${end} - ${engine_restricted_length} - 1") - math(EXPR platform_start "${engine_restricted_length} + 1") - string(SUBSTRING ${pal_restricted_file} ${platform_start} ${platform_length} platform) - list(APPEND PAL_RESTRICTED_PLATFORMS "${platform}") - endif() + # Get relative path from restricted root directory + cmake_path(RELATIVE_PATH pal_restricted_file BASE_DIRECTORY ${O3DE_ENGINE_RESTRICTED_PATH} OUTPUT_VARIABLE relative_pal_restricted_file) + # Split relative restricted path into path segments + string(REPLACE "/" ";" pal_restricted_segments ${relative_pal_restricted_file}) + # Retrieve the first path segment which should be the restricted platform + list(GET pal_restricted_segments 0 platform) + # Append the new restricted platform + string(TOLOWER ${platform} platform_lower) + list(APPEND PAL_RESTRICTED_PLATFORMS ${platform_lower}) endforeach() ly_set(PAL_RESTRICTED_PLATFORMS ${PAL_RESTRICTED_PLATFORMS}) @@ -186,11 +188,17 @@ function(ly_get_absolute_pal_filename out_name in_name) # Remove one path segment from the end of the current_object_path and prepend it to the list path_segments cmake_path(GET current_object_path PARENT_PATH parent_path) cmake_path(GET current_object_path FILENAME path_segment) - list(PREPEND path_segments_visited path_segment) + list(PREPEND path_segments_visited ${path_segment}) cmake_path(COMPARE current_object_path NOT_EQUAL parent_path is_prev_path_segment) cmake_path(SET current_object_path "${parent_path}") + set(is_prev_path_segment TRUE) while(is_prev_path_segment) + # Remove one path segment from the end of the current_object_path and prepend it to the list path_segments + cmake_path(GET current_object_path PARENT_PATH parent_path) + cmake_path(GET current_object_path FILENAME path_segment) + cmake_path(COMPARE current_object_path NOT_EQUAL parent_path is_prev_path_segment) + cmake_path(SET current_object_path "${parent_path}") # The Path is in a PAL structure # Decompose the path into sections before "Platform" and after "Platform" if(path_segment STREQUAL "Platform") @@ -205,21 +213,17 @@ function(ly_get_absolute_pal_filename out_name in_name) break() endif() - # Remove one path segment from the end of the current_object_path and prepend it to the list path_segments - cmake_path(GET current_object_path PARENT_PATH parent_path) - cmake_path(GET current_object_path FILENAME path_segment) - list(PREPEND path_segments_visited path_segment) - cmake_path(COMPARE current_object_path NOT_EQUAL parent_path is_prev_path_segment) - cmake_path(SET current_object_path "${parent_path}") + list(PREPEND path_segments_visited ${path_segment}) endwhile() # Compose a candidate restricted path and examine if it exists - cmake_path(APPEND object_restricted_path ${pre_platform_paths} "Platform" ${post_platform_paths} + cmake_path(APPEND ${pre_platform_paths} "Platform" ${post_platform_paths} OUTPUT_VARIABLE candidate_PAL_path) if(NOT EXISTS ${candidate_PAL_path}) - if("${candidate_platform_name}" IN_LIST PAL_RESTRICTED_PLATFORMS) + string(TOLOWER ${candidate_platform_name} candidate_platform_name_lower) + if("${candidate_platform_name_lower}" IN_LIST PAL_RESTRICTED_PLATFORMS) cmake_path(APPEND object_restricted_path ${candidate_platform_name} ${object_name} - ${pre_platform_paths} ${post_platform_paths} OUTPUT_VARIABLE candidate_PAL_path) + ${pre_platform_paths} OUTPUT_VARIABLE candidate_PAL_path) endif() endif() if(EXISTS ${candidate_PAL_path}) @@ -227,6 +231,7 @@ function(ly_get_absolute_pal_filename out_name in_name) endif() endif() endif() + cmake_path(ABSOLUTE_PATH full_name BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) set(${out_name} ${full_name} PARENT_SCOPE) endfunction()