Gems/LytShine
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -135,7 +135,7 @@ private:
|
||||
std::vector<int> keySelectionFlags;
|
||||
_smart_ptr<ISplineBackup> undo;
|
||||
_smart_ptr<ISplineBackup> redo;
|
||||
string id;
|
||||
AZStd::string id;
|
||||
ISplineInterpolator* pSpline;
|
||||
};
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ class QRubberBand;
|
||||
class ISplineSet
|
||||
{
|
||||
public:
|
||||
virtual ISplineInterpolator* GetSplineFromID(const string& id) = 0;
|
||||
virtual string GetIDFromSpline(ISplineInterpolator* pSpline) = 0;
|
||||
virtual ISplineInterpolator* GetSplineFromID(const AZStd::string& id) = 0;
|
||||
virtual AZStd::string GetIDFromSpline(ISplineInterpolator* pSpline) = 0;
|
||||
virtual int GetSplineCount() const = 0;
|
||||
virtual int GetKeyCountAtTime(float time, float threshold) const = 0;
|
||||
};
|
||||
|
||||
@@ -1100,7 +1100,7 @@ bool CUiAnimViewAnimNode::SetName(const char* pName)
|
||||
}
|
||||
}
|
||||
|
||||
string oldName = GetName();
|
||||
AZStd::string oldName = GetName();
|
||||
m_pAnimNode->SetName(pName);
|
||||
|
||||
if (UiAnimUndo::IsRecording())
|
||||
@@ -1108,7 +1108,7 @@ bool CUiAnimViewAnimNode::SetName(const char* pName)
|
||||
UiAnimUndo::Record(new CUndoAnimNodeRename(this, oldName));
|
||||
}
|
||||
|
||||
GetSequence()->OnNodeRenamed(this, oldName);
|
||||
GetSequence()->OnNodeRenamed(this, oldName.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -992,7 +992,7 @@ void CUiAnimViewDialog::ReloadSequencesComboBox()
|
||||
for (int k = 0; k < numSequences; ++k)
|
||||
{
|
||||
CUiAnimViewSequence* pSequence = pSequenceManager->GetSequenceByIndex(k);
|
||||
QString fullname = QtUtil::ToQString(pSequence->GetName());
|
||||
QString fullname = pSequence->GetName();
|
||||
m_sequencesComboBox->addItem(fullname);
|
||||
}
|
||||
}
|
||||
@@ -1132,7 +1132,7 @@ void CUiAnimViewDialog::OnSequenceChanged(CUiAnimViewSequence* pSequence)
|
||||
|
||||
if (pSequence)
|
||||
{
|
||||
m_currentSequenceName = QtUtil::ToQString(pSequence->GetName());
|
||||
m_currentSequenceName = pSequence->GetName();
|
||||
|
||||
pSequence->Reset(true);
|
||||
SaveZoomScrollSettings();
|
||||
@@ -1733,7 +1733,7 @@ void CUiAnimViewDialog::OnNodeRenamed(CUiAnimViewNode* pNode, const char* pOldNa
|
||||
{
|
||||
if (m_currentSequenceName == QString(pOldName))
|
||||
{
|
||||
m_currentSequenceName = QtUtil::ToQString(pNode->GetName());
|
||||
m_currentSequenceName = pNode->GetName();
|
||||
}
|
||||
|
||||
ReloadSequencesComboBox();
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "UiAnimViewSequenceManager.h"
|
||||
|
||||
#include <LyShine/Animation/IUiAnimation.h>
|
||||
#include <StringUtils.h>
|
||||
#include <QtUtilWin.h>
|
||||
|
||||
#include <QListWidgetItem>
|
||||
@@ -64,7 +63,7 @@ void CUiAnimViewFindDlg::FillData()
|
||||
ObjName obj;
|
||||
obj.m_objName = pNode->GetName();
|
||||
obj.m_directorName = pNode->HasDirectorAsParent() ? pNode->HasDirectorAsParent()->GetName() : "";
|
||||
string fullname = seq->GetName();
|
||||
AZStd::string fullname = seq->GetName();
|
||||
obj.m_seqName = fullname.c_str();
|
||||
m_objs.push_back(obj);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void CUiAVNewSequenceDialog::OnOK()
|
||||
for (int k = 0; k < CUiAnimViewSequenceManager::GetSequenceManager()->GetCount(); ++k)
|
||||
{
|
||||
CUiAnimViewSequence* pSequence = CUiAnimViewSequenceManager::GetSequenceManager()->GetSequenceByIndex(k);
|
||||
QString fullname = QtUtil::ToQString(pSequence->GetName());
|
||||
QString fullname = pSequence->GetName();
|
||||
|
||||
if (fullname.compare(m_sequenceName, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
|
||||
@@ -486,7 +486,7 @@ CUiAnimViewNodesCtrl::CRecord* CUiAnimViewNodesCtrl::AddAnimNodeRecord(CRecord*
|
||||
{
|
||||
CRecord* pNewRecord = new CRecord(pAnimNode);
|
||||
|
||||
pNewRecord->setText(0, QtUtil::ToQString(pAnimNode->GetName()));
|
||||
pNewRecord->setText(0, pAnimNode->GetName());
|
||||
UpdateUiAnimNodeRecord(pNewRecord, pAnimNode);
|
||||
pParentRecord->insertChild(GetInsertPosition(pParentRecord, pAnimNode), pNewRecord);
|
||||
FillNodesRec(pNewRecord, pAnimNode);
|
||||
@@ -499,7 +499,7 @@ CUiAnimViewNodesCtrl::CRecord* CUiAnimViewNodesCtrl::AddTrackRecord(CRecord* pPa
|
||||
{
|
||||
CRecord* pNewTrackRecord = new CRecord(pTrack);
|
||||
pNewTrackRecord->setSizeHint(0, QSize(30, 18));
|
||||
pNewTrackRecord->setText(0, QtUtil::ToQString(pTrack->GetName()));
|
||||
pNewTrackRecord->setText(0, pTrack->GetName());
|
||||
UpdateTrackRecord(pNewTrackRecord, pTrack);
|
||||
pParentRecord->insertChild(GetInsertPosition(pParentRecord, pTrack), pNewTrackRecord);
|
||||
FillNodesRec(pNewTrackRecord, pTrack);
|
||||
@@ -708,7 +708,7 @@ void CUiAnimViewNodesCtrl::OnFillItems()
|
||||
m_nodeToRecordMap.clear();
|
||||
|
||||
CRecord* pRootGroupRec = new CRecord(pSequence);
|
||||
pRootGroupRec->setText(0, QtUtil::ToQString(pSequence->GetName()));
|
||||
pRootGroupRec->setText(0, pSequence->GetName());
|
||||
QFont f = font();
|
||||
f.setBold(true);
|
||||
pRootGroupRec->setData(0, Qt::FontRole, f);
|
||||
@@ -1323,7 +1323,7 @@ int CUiAnimViewNodesCtrl::ShowPopupMenuSingleSelection(UiAnimContextMenu& contex
|
||||
continue;
|
||||
}
|
||||
|
||||
QAction* a = contextMenu.main.addAction(QString(" %1").arg(QtUtil::ToQString(pTrack2->GetName())));
|
||||
QAction* a = contextMenu.main.addAction(QString(" %1").arg(pTrack2->GetName()));
|
||||
a->setData(eMI_ShowHideBase + childIndex);
|
||||
a->setCheckable(true);
|
||||
a->setChecked(!pTrack2->IsHidden());
|
||||
@@ -1459,7 +1459,7 @@ void CUiAnimViewNodesCtrl::FillAutoCompletionListForFilter()
|
||||
|
||||
for (unsigned int i = 0; i < animNodeCount; ++i)
|
||||
{
|
||||
strings << QtUtil::ToQString(animNodes.GetNode(i)->GetName());
|
||||
strings << QString(animNodes.GetNode(i)->GetName());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1512,7 +1512,7 @@ int CUiAnimViewNodesCtrl::GetMatNameAndSubMtlIndexFromName(QString& matName, con
|
||||
if (const char* pCh = strstr(nodeName, ".["))
|
||||
{
|
||||
char matPath[MAX_PATH];
|
||||
azstrcpy(matPath, nodeName, (size_t)(pCh - nodeName));
|
||||
azstrncpy(matPath, nodeName, (size_t)(pCh - nodeName));
|
||||
matName = matPath;
|
||||
pCh += 2;
|
||||
if ((*pCh) != 0)
|
||||
@@ -1763,7 +1763,7 @@ void CUiAnimViewNodesCtrl::OnNodeRenamed(CUiAnimViewNode* pNode, [[maybe_unused]
|
||||
if (!m_bIgnoreNotifications)
|
||||
{
|
||||
CRecord* pNodeRecord = GetNodeRecord(pNode);
|
||||
pNodeRecord->setText(0, QtUtil::ToQString(pNode->GetName()));
|
||||
pNodeRecord->setText(0, pNode->GetName());
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -683,7 +683,7 @@ bool CUiAnimViewSequence::SetName(const char* pName)
|
||||
return false;
|
||||
}
|
||||
|
||||
string oldName = GetName();
|
||||
AZStd::string oldName = GetName();
|
||||
m_pAnimSequence->SetName(pName);
|
||||
|
||||
if (UiAnimUndo::IsRecording())
|
||||
@@ -691,7 +691,7 @@ bool CUiAnimViewSequence::SetName(const char* pName)
|
||||
UiAnimUndo::Record(new CUndoAnimNodeRename(this, oldName));
|
||||
}
|
||||
|
||||
GetSequence()->OnNodeRenamed(this, oldName);
|
||||
GetSequence()->OnNodeRenamed(this, oldName.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -893,7 +893,7 @@ std::deque<CUiAnimViewTrack*> CUiAnimViewSequence::GetMatchingTracks(CUiAnimView
|
||||
{
|
||||
std::deque<CUiAnimViewTrack*> matchingTracks;
|
||||
|
||||
const string trackName = trackNode->getAttr("name");
|
||||
const AZStd::string trackName = trackNode->getAttr("name");
|
||||
|
||||
IUiAnimationSystem* animationSystem = nullptr;
|
||||
EBUS_EVENT_RESULT(animationSystem, UiEditorAnimationBus, GetAnimationSystem);
|
||||
@@ -956,11 +956,11 @@ void CUiAnimViewSequence::GetMatchedPasteLocationsRec(std::vector<TMatchedTrackL
|
||||
for (unsigned int nodeIndex = 0; nodeIndex < numChildNodes; ++nodeIndex)
|
||||
{
|
||||
XmlNodeRef xmlChildNode = clipboardNode->getChild(nodeIndex);
|
||||
const string tagName = xmlChildNode->getTag();
|
||||
const AZStd::string tagName = xmlChildNode->getTag();
|
||||
|
||||
if (tagName == "Node")
|
||||
{
|
||||
const string nodeName = xmlChildNode->getAttr("name");
|
||||
const AZStd::string nodeName = xmlChildNode->getAttr("name");
|
||||
|
||||
int nodeType = eUiAnimNodeType_Invalid;
|
||||
xmlChildNode->getAttr("type", nodeType);
|
||||
@@ -982,7 +982,7 @@ void CUiAnimViewSequence::GetMatchedPasteLocationsRec(std::vector<TMatchedTrackL
|
||||
}
|
||||
else if (tagName == "Track")
|
||||
{
|
||||
const string trackName = xmlChildNode->getAttr("name");
|
||||
const AZStd::string trackName = xmlChildNode->getAttr("name");
|
||||
|
||||
IUiAnimationSystem* animationSystem = nullptr;
|
||||
EBUS_EVENT_RESULT(animationSystem, UiEditorAnimationBus, GetAnimationSystem);
|
||||
|
||||
@@ -546,7 +546,7 @@ void CUndoAnimNodeReparent::AddParentsInChildren(CUiAnimViewAnimNode* pCurrentNo
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CUndoAnimNodeRename::CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const string& oldName)
|
||||
CUndoAnimNodeRename::CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const AZStd::string& oldName)
|
||||
: m_pNode(pNode)
|
||||
, m_newName(pNode->GetName())
|
||||
, m_oldName(oldName)
|
||||
@@ -556,13 +556,13 @@ CUndoAnimNodeRename::CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const strin
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CUndoAnimNodeRename::Undo([[maybe_unused]] bool bUndo)
|
||||
{
|
||||
m_pNode->SetName(m_oldName);
|
||||
m_pNode->SetName(m_oldName.c_str());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CUndoAnimNodeRename::Redo()
|
||||
{
|
||||
m_pNode->SetName(m_newName);
|
||||
m_pNode->SetName(m_newName.c_str());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -304,7 +304,7 @@ class CUndoAnimNodeRename
|
||||
: public UiAnimUndoObject
|
||||
{
|
||||
public:
|
||||
CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const string& oldName);
|
||||
CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const AZStd::string& oldName);
|
||||
|
||||
protected:
|
||||
virtual int GetSize() override { return sizeof(*this); };
|
||||
@@ -315,8 +315,8 @@ protected:
|
||||
|
||||
private:
|
||||
CUiAnimViewAnimNode* m_pNode;
|
||||
string m_newName;
|
||||
string m_oldName;
|
||||
AZStd::string m_newName;
|
||||
AZStd::string m_oldName;
|
||||
};
|
||||
|
||||
/** Base class for track event transactions
|
||||
|
||||
@@ -75,7 +75,7 @@ void AssetTreeEntry::Insert(const AZStd::string& path, const AZStd::string& menu
|
||||
AZStd::string folderName;
|
||||
AZStd::string remainderPath;
|
||||
size_t separator = path.find('/');
|
||||
if (separator == string::npos)
|
||||
if (separator == AZStd::string::npos)
|
||||
{
|
||||
folderName = path;
|
||||
}
|
||||
|
||||
@@ -724,7 +724,7 @@ void EditorWindow::AddMenu_View_LanguageSetting(QMenu* viewMenu)
|
||||
// Iterate through the subdirectories of the localization folder. Each
|
||||
// directory corresponds to a different language containing localization
|
||||
// translations for that language.
|
||||
string fullLocPath(string(gEnv->pFileIO->GetAlias("@assets@")) + "/" + string(m_startupLocFolderName.toUtf8().constData()));
|
||||
AZStd::string fullLocPath(AZStd::string(gEnv->pFileIO->GetAlias("@assets@")) + "/" + AZStd::string(m_startupLocFolderName.toUtf8().constData()));
|
||||
QDir locDir(fullLocPath.c_str());
|
||||
locDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
locDir.setSorting(QDir::Name);
|
||||
|
||||
@@ -788,7 +788,7 @@ void PropertiesContainer::Update()
|
||||
}
|
||||
else // more than one entity selected
|
||||
{
|
||||
displayName = ToString(selectedEntitiesAmount) + " elements selected";
|
||||
displayName = (ToString(selectedEntitiesAmount) + " elements selected").c_str();
|
||||
}
|
||||
|
||||
// Update the selected element display name
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "PropertyHandlerChar.h"
|
||||
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
|
||||
QWidget* PropertyHandlerChar::CreateGUI(QWidget* pParent)
|
||||
{
|
||||
AzToolsFramework::PropertyStringLineEditCtrl* ctrl = aznew AzToolsFramework::PropertyStringLineEditCtrl(pParent);
|
||||
@@ -29,12 +31,8 @@ void PropertyHandlerChar::WriteGUIValuesIntoProperty(size_t index, AzToolsFramew
|
||||
{
|
||||
(int)index;
|
||||
AZStd::string str = GUI->value();
|
||||
uint32_t character = '\0';
|
||||
if (!str.empty())
|
||||
{
|
||||
Unicode::CIterator<const char*, false> pChar(str.c_str());
|
||||
character = *pChar;
|
||||
}
|
||||
wchar_t character = '\0';
|
||||
AZStd::to_wstring(&character, 1, str.c_str());
|
||||
instance = character;
|
||||
}
|
||||
|
||||
@@ -47,7 +45,8 @@ bool PropertyHandlerChar::ReadValuesIntoGUI(size_t index, AzToolsFramework::Prop
|
||||
// NOTE: this assumes the uint32_t can be interpreted as a wchar_t, it seems to
|
||||
// work for cases tested but may not in general.
|
||||
wchar_t wcharString[2] = { static_cast<wchar_t>(instance), 0 };
|
||||
AZStd::string val(CryStringUtils::WStrToUTF8(wcharString));
|
||||
AZStd::string val;
|
||||
AZStd::to_string(val, wcharString);
|
||||
GUI->setValue(val);
|
||||
}
|
||||
GUI->blockSignals(false);
|
||||
|
||||
@@ -93,7 +93,7 @@ AzToolsFramework::AssetBrowser::AssetSelectionModel PropertyAssetDirectorySelect
|
||||
|
||||
void PropertyAssetDirectorySelectionCtrl::SetFolderSelection(const AZStd::string& folderPath)
|
||||
{
|
||||
string strFolderPath = folderPath.c_str();
|
||||
AZStd::string strFolderPath = folderPath.c_str();
|
||||
if (strFolderPath.empty())
|
||||
{
|
||||
m_folderPath.clear();
|
||||
@@ -106,12 +106,14 @@ void PropertyAssetDirectorySelectionCtrl::SetFolderSelection(const AZStd::string
|
||||
// the project folder, which we need to omit since file IO routines
|
||||
// seem to assume this anyways.
|
||||
strFolderPath = strFolderPath.substr(strFolderPath.find('/') + 1);
|
||||
m_folderPath = PathUtil::MakeGamePath(strFolderPath).MakeLower();
|
||||
m_folderPath = PathUtil::MakeGamePath(strFolderPath);
|
||||
AZStd::to_lower(m_folderPath.begin(), m_folderPath.end());
|
||||
}
|
||||
// For paths in gems, absolute paths are returned
|
||||
else
|
||||
{
|
||||
m_folderPath = Path::FullPathToGamePath(strFolderPath.c_str()).MakeLower();
|
||||
m_folderPath = Path::FullPathToGamePath(strFolderPath.c_str());
|
||||
AZStd::to_lower(m_folderPath.begin(), m_folderPath.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -921,7 +921,7 @@ void SpriteBorderEditor::AddButtonsSection(QGridLayout* gridLayout, int& rowNum)
|
||||
// The texture is guaranteed to exist so use that to get the full path.
|
||||
QString fullTexturePath = Path::GamePathToFullPath(m_sprite->GetTexturePathname().c_str());
|
||||
const char* const spriteExtension = "sprite";
|
||||
string fullSpritePath = PathUtil::ReplaceExtension(fullTexturePath.toUtf8().data(), spriteExtension);
|
||||
AZStd::string fullSpritePath = PathUtil::ReplaceExtension(fullTexturePath.toUtf8().data(), spriteExtension);
|
||||
|
||||
FileHelpers::SourceControlAddOrEdit(fullSpritePath.c_str(), QApplication::activeWindow());
|
||||
|
||||
|
||||
@@ -80,10 +80,10 @@ void CUiAnimSequence::SetName(const char* name)
|
||||
return; // should never happen, null pointer guard
|
||||
}
|
||||
|
||||
string originalName = GetName();
|
||||
AZStd::string originalName = GetName();
|
||||
|
||||
m_name = name;
|
||||
m_pUiAnimationSystem->OnSequenceRenamed(originalName, m_name.c_str());
|
||||
m_pUiAnimationSystem->OnSequenceRenamed(originalName.c_str(), m_name.c_str());
|
||||
|
||||
if (GetOwner())
|
||||
{
|
||||
|
||||
@@ -146,7 +146,7 @@ private:
|
||||
|
||||
uint32 m_id;
|
||||
AZStd::string m_name;
|
||||
mutable string m_fullNameHolder;
|
||||
mutable AZStd::string m_fullNameHolder;
|
||||
Range m_timeRange;
|
||||
UiTrackEvents m_events;
|
||||
|
||||
|
||||
@@ -278,8 +278,8 @@ const AZ::SerializeContext::ClassElement* CUiAnimAzEntityNode::ComputeOffsetFrom
|
||||
|
||||
if (mismatch)
|
||||
{
|
||||
string warnMsg = "Data mismatch reading animation data for type ";
|
||||
warnMsg += classData->m_typeId.ToString<string>();
|
||||
AZStd::string warnMsg = "Data mismatch reading animation data for type ";
|
||||
warnMsg += classData->m_typeId.ToString<AZStd::string>();
|
||||
warnMsg += ". The field \"";
|
||||
warnMsg += paramData.GetName();
|
||||
if (!element)
|
||||
|
||||
@@ -170,14 +170,14 @@ private:
|
||||
|
||||
struct SScriptPropertyParamInfo
|
||||
{
|
||||
string variableName;
|
||||
string displayName;
|
||||
AZStd::string variableName;
|
||||
AZStd::string displayName;
|
||||
bool isVectorTable;
|
||||
SParamInfo animNodeParamInfo;
|
||||
};
|
||||
|
||||
std::vector< SScriptPropertyParamInfo > m_entityScriptPropertiesParamInfos;
|
||||
typedef AZStd::unordered_map< string, size_t, stl::hash_string_caseless<string>, stl::equality_string_caseless<string> > TScriptPropertyParamInfoMap;
|
||||
typedef AZStd::unordered_map<AZStd::string, size_t, stl::hash_string_caseless<AZStd::string>, stl::equality_string_caseless<AZStd::string> > TScriptPropertyParamInfoMap;
|
||||
TScriptPropertyParamInfoMap m_nameToScriptPropertyParamInfo;
|
||||
#ifdef CHECK_FOR_TOO_MANY_ONPROPERTY_SCRIPT_CALLS
|
||||
uint32 m_OnPropertyCalls;
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
|
||||
virtual int NextKeyByTime(int key) const;
|
||||
|
||||
void SetSubTrackName(const int i, const string& name) { assert (i < MAX_SUBTRACKS); m_subTrackNames[i] = name; }
|
||||
void SetSubTrackName(const int i, const AZStd::string& name) { assert (i < MAX_SUBTRACKS); m_subTrackNames[i] = name; }
|
||||
|
||||
#ifdef UI_ANIMATION_SYSTEM_SUPPORT_EDITING
|
||||
virtual ColorB GetCustomColor() const
|
||||
|
||||
@@ -27,19 +27,19 @@
|
||||
// Serialization for anim nodes & param types
|
||||
#define REGISTER_NODE_TYPE(name) assert(g_animNodeEnumToStringMap.find(eUiAnimNodeType_ ## name) == g_animNodeEnumToStringMap.end()); \
|
||||
g_animNodeEnumToStringMap[eUiAnimNodeType_ ## name] = STRINGIFY(name); \
|
||||
g_animNodeStringToEnumMap[string(STRINGIFY(name))] = eUiAnimNodeType_ ## name;
|
||||
g_animNodeStringToEnumMap[AZStd::string(STRINGIFY(name))] = eUiAnimNodeType_ ## name;
|
||||
|
||||
#define REGISTER_PARAM_TYPE(name) assert(g_animParamEnumToStringMap.find(eUiAnimParamType_ ## name) == g_animParamEnumToStringMap.end()); \
|
||||
g_animParamEnumToStringMap[eUiAnimParamType_ ## name] = STRINGIFY(name); \
|
||||
g_animParamStringToEnumMap[string(STRINGIFY(name))] = eUiAnimParamType_ ## name;
|
||||
g_animParamStringToEnumMap[AZStd::string(STRINGIFY(name))] = eUiAnimParamType_ ## name;
|
||||
|
||||
namespace
|
||||
{
|
||||
AZStd::unordered_map<int, string> g_animNodeEnumToStringMap;
|
||||
StaticInstance<std::map<string, EUiAnimNodeType, stl::less_stricmp<string> >> g_animNodeStringToEnumMap;
|
||||
AZStd::unordered_map<int, AZStd::string> g_animNodeEnumToStringMap;
|
||||
StaticInstance<std::map<AZStd::string, EUiAnimNodeType, stl::less_stricmp<AZStd::string> >> g_animNodeStringToEnumMap;
|
||||
|
||||
AZStd::unordered_map<int, string> g_animParamEnumToStringMap;
|
||||
StaticInstance<std::map<string, EUiAnimParamType, stl::less_stricmp<string> >> g_animParamStringToEnumMap;
|
||||
AZStd::unordered_map<int, AZStd::string> g_animParamEnumToStringMap;
|
||||
StaticInstance<std::map<AZStd::string, EUiAnimParamType, stl::less_stricmp<AZStd::string> >> g_animParamStringToEnumMap;
|
||||
|
||||
// If you get an assert in this function, it means two node types have the same enum value.
|
||||
void RegisterNodeTypes()
|
||||
@@ -1189,7 +1189,7 @@ void UiAnimationSystem::SerializeNodeType(EUiAnimNodeType& animNodeType, XmlNode
|
||||
{
|
||||
const char* pTypeString = "Invalid";
|
||||
assert(g_animNodeEnumToStringMap.find(animNodeType) != g_animNodeEnumToStringMap.end());
|
||||
pTypeString = g_animNodeEnumToStringMap[animNodeType];
|
||||
pTypeString = g_animNodeEnumToStringMap[animNodeType].c_str();
|
||||
xmlNode->setAttr(kType, pTypeString);
|
||||
}
|
||||
}
|
||||
@@ -1273,7 +1273,7 @@ void UiAnimationSystem::SerializeParamType(CUiAnimParamType& animParamType, XmlN
|
||||
else
|
||||
{
|
||||
assert(g_animParamEnumToStringMap.find(animParamType.m_type) != g_animParamEnumToStringMap.end());
|
||||
pTypeString = g_animParamEnumToStringMap[animParamType.m_type];
|
||||
pTypeString = g_animParamEnumToStringMap[animParamType.m_type].c_str();
|
||||
}
|
||||
|
||||
xmlNode->setAttr(kParamType, pTypeString);
|
||||
@@ -1341,7 +1341,7 @@ const char* UiAnimationSystem::GetParamTypeName(const CUiAnimParamType& animPara
|
||||
{
|
||||
if (g_animParamEnumToStringMap.find(animParamType.m_type) != g_animParamEnumToStringMap.end())
|
||||
{
|
||||
return g_animParamEnumToStringMap[animParamType.m_type];
|
||||
return g_animParamEnumToStringMap[animParamType.m_type].c_str();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ AZ::EntityId CLyShine::CreateCanvas()
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZ::EntityId CLyShine::LoadCanvas(const string& assetIdPathname)
|
||||
AZ::EntityId CLyShine::LoadCanvas(const AZStd::string& assetIdPathname)
|
||||
{
|
||||
return m_uiCanvasManager->LoadCanvas(assetIdPathname.c_str());
|
||||
}
|
||||
@@ -299,7 +299,7 @@ AZ::EntityId CLyShine::CreateCanvasInEditor(UiEntityContext* entityContext)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZ::EntityId CLyShine::LoadCanvasInEditor(const string& assetIdPathname, const string& sourceAssetPathname, UiEntityContext* entityContext)
|
||||
AZ::EntityId CLyShine::LoadCanvasInEditor(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname, UiEntityContext* entityContext)
|
||||
{
|
||||
return m_uiCanvasManager->LoadCanvasInEditor(assetIdPathname, sourceAssetPathname, entityContext);
|
||||
}
|
||||
@@ -317,7 +317,7 @@ AZ::EntityId CLyShine::FindCanvasById(LyShine::CanvasId id)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZ::EntityId CLyShine::FindLoadedCanvasByPathName(const string& assetIdPathname)
|
||||
AZ::EntityId CLyShine::FindLoadedCanvasByPathName(const AZStd::string& assetIdPathname)
|
||||
{
|
||||
return m_uiCanvasManager->FindLoadedCanvasByPathName(assetIdPathname.c_str());
|
||||
}
|
||||
@@ -335,13 +335,13 @@ void CLyShine::ReleaseCanvasDeferred(AZ::EntityId canvas)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
ISprite* CLyShine::LoadSprite(const string& pathname)
|
||||
ISprite* CLyShine::LoadSprite(const AZStd::string& pathname)
|
||||
{
|
||||
return CSprite::LoadSprite(pathname);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
ISprite* CLyShine::CreateSprite(const string& renderTargetName)
|
||||
ISprite* CLyShine::CreateSprite(const AZStd::string& renderTargetName)
|
||||
{
|
||||
return CSprite::CreateSprite(renderTargetName);
|
||||
}
|
||||
|
||||
@@ -56,18 +56,18 @@ public:
|
||||
IDraw2d* GetDraw2d() override;
|
||||
|
||||
AZ::EntityId CreateCanvas() override;
|
||||
AZ::EntityId LoadCanvas(const string& assetIdPathname) override;
|
||||
AZ::EntityId LoadCanvas(const AZStd::string& assetIdPathname) override;
|
||||
AZ::EntityId CreateCanvasInEditor(UiEntityContext* entityContext) override;
|
||||
AZ::EntityId LoadCanvasInEditor(const string& assetIdPathname, const string& sourceAssetPathname, UiEntityContext* entityContext) override;
|
||||
AZ::EntityId LoadCanvasInEditor(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname, UiEntityContext* entityContext) override;
|
||||
AZ::EntityId ReloadCanvasFromXml(const AZStd::string& xmlString, UiEntityContext* entityContext) override;
|
||||
AZ::EntityId FindCanvasById(LyShine::CanvasId id) override;
|
||||
AZ::EntityId FindLoadedCanvasByPathName(const string& assetIdPathname) override;
|
||||
AZ::EntityId FindLoadedCanvasByPathName(const AZStd::string& assetIdPathname) override;
|
||||
|
||||
void ReleaseCanvas(AZ::EntityId canvas, bool forEditor) override;
|
||||
void ReleaseCanvasDeferred(AZ::EntityId canvas) override;
|
||||
|
||||
ISprite* LoadSprite(const string& pathname) override;
|
||||
ISprite* CreateSprite(const string& renderTargetName) override;
|
||||
ISprite* LoadSprite(const AZStd::string& pathname) override;
|
||||
ISprite* CreateSprite(const AZStd::string& renderTargetName) override;
|
||||
bool DoesSpriteTextureAssetExist(const AZStd::string& pathname) override;
|
||||
|
||||
void PostInit() override;
|
||||
|
||||
@@ -995,7 +995,7 @@ static AZ::Entity* CreateButton(const char* name, bool atRoot, AZ::EntityId pare
|
||||
EBUS_EVENT_ID(buttonId, UiInteractableStatesBus, SetStateColor, UiInteractableStatesInterface::StatePressed, buttonId, pressedColor);
|
||||
EBUS_EVENT_ID(buttonId, UiInteractableStatesBus, SetStateAlpha, UiInteractableStatesInterface::StatePressed, buttonId, pressedColor.GetA());
|
||||
|
||||
string pathname = "Textures/Basic/Button_Sliced_Normal.sprite";
|
||||
AZStd::string pathname = "Textures/Basic/Button_Sliced_Normal.sprite";
|
||||
ISprite* sprite = gEnv->pLyShine->LoadSprite(pathname);
|
||||
|
||||
EBUS_EVENT_ID(buttonId, UiImageBus, SetSprite, sprite);
|
||||
@@ -1094,7 +1094,7 @@ static AZ::Entity* CreateTextInput(const char* name, bool atRoot, AZ::EntityId p
|
||||
EBUS_EVENT_ID(textInputId, UiInteractableStatesBus, SetStateColor, UiInteractableStatesInterface::StatePressed, textInputId, pressedColor);
|
||||
EBUS_EVENT_ID(textInputId, UiInteractableStatesBus, SetStateAlpha, UiInteractableStatesInterface::StatePressed, textInputId, pressedColor.GetA());
|
||||
|
||||
string pathname = "Textures/Basic/Button_Sliced_Normal.sprite";
|
||||
AZStd::string pathname = "Textures/Basic/Button_Sliced_Normal.sprite";
|
||||
ISprite* sprite = gEnv->pLyShine->LoadSprite(pathname);
|
||||
|
||||
EBUS_EVENT_ID(textInputId, UiImageBus, SetSprite, sprite);
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace LyShine
|
||||
AZ::EntityId LyShineLoadScreenComponent::loadFromCfg(const char* pathVarName, const char* autoPlayVarName)
|
||||
{
|
||||
ICVar* pathVar = gEnv->pConsole->GetCVar(pathVarName);
|
||||
string path = pathVar ? pathVar->GetString() : "";
|
||||
AZStd::string path = pathVar ? pathVar->GetString() : "";
|
||||
if (path.empty())
|
||||
{
|
||||
// No canvas specified.
|
||||
@@ -238,7 +238,7 @@ namespace LyShine
|
||||
EBUS_EVENT_ID(canvasId, UiCanvasBus, SetDrawOrder, std::numeric_limits<int>::max());
|
||||
|
||||
ICVar* autoPlayVar = gEnv->pConsole->GetCVar(autoPlayVarName);
|
||||
string sequence = autoPlayVar ? autoPlayVar->GetString() : "";
|
||||
AZStd::string sequence = autoPlayVar ? autoPlayVar->GetString() : "";
|
||||
if (sequence.empty())
|
||||
{
|
||||
// Nothing to auto-play.
|
||||
@@ -253,7 +253,7 @@ namespace LyShine
|
||||
return canvasId;
|
||||
}
|
||||
|
||||
animSystem->PlaySequence(sequence, nullptr, false, false);
|
||||
animSystem->PlaySequence(sequence.c_str(), nullptr, false, false);
|
||||
|
||||
return canvasId;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "UiClipboard.h"
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
|
||||
bool UiClipboard::SetText(const AZStd::string& text)
|
||||
{
|
||||
@@ -19,7 +20,8 @@ bool UiClipboard::SetText(const AZStd::string& text)
|
||||
{
|
||||
if (text.length() > 0)
|
||||
{
|
||||
auto wstr = CryStringUtils::UTF8ToWStr(text.c_str());
|
||||
AZStd::wstring wstr;
|
||||
AZStd::to_wstring(wstr, text.c_str());
|
||||
const SIZE_T buffSize = (wstr.size() + 1) * sizeof(WCHAR);
|
||||
if (HGLOBAL hBuffer = GlobalAlloc(GMEM_MOVEABLE, buffSize))
|
||||
{
|
||||
@@ -45,7 +47,7 @@ AZStd::string UiClipboard::GetText()
|
||||
if (HANDLE hText = GetClipboardData(CF_UNICODETEXT))
|
||||
{
|
||||
const WCHAR* text = static_cast<const WCHAR*>(GlobalLock(hText));
|
||||
outText = CryStringUtils::WStrToUTF8(text);
|
||||
AZStd::to_string(outText, text);
|
||||
GlobalUnlock(hText);
|
||||
}
|
||||
CloseClipboard();
|
||||
|
||||
@@ -146,9 +146,9 @@ namespace
|
||||
{
|
||||
if (ser.IsReading())
|
||||
{
|
||||
string stringVal;
|
||||
AZStd::string stringVal;
|
||||
ser.Value(attributeName, stringVal);
|
||||
stringVal.replace(',', ' ');
|
||||
AZ::StringFunc::Replace(stringVal, ',', ' ');
|
||||
char* pEnd = nullptr;
|
||||
float uVal = strtof(stringVal.c_str(), &pEnd);
|
||||
float vVal = strtof(pEnd, nullptr);
|
||||
@@ -202,13 +202,13 @@ CSprite::~CSprite()
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const string& CSprite::GetPathname() const
|
||||
const AZStd::string& CSprite::GetPathname() const
|
||||
{
|
||||
return m_pathname;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const string& CSprite::GetTexturePathname() const
|
||||
const AZStd::string& CSprite::GetTexturePathname() const
|
||||
{
|
||||
return m_texturePathname;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ void CSprite::Serialize(TSerialize ser)
|
||||
m_spriteSheetCells.push_back(SpriteSheetCell());
|
||||
}
|
||||
|
||||
string aliasTemp;
|
||||
AZStd::string aliasTemp;
|
||||
if (ser.IsReading())
|
||||
{
|
||||
ser.Value("alias", aliasTemp);
|
||||
@@ -318,7 +318,7 @@ void CSprite::Serialize(TSerialize ser)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool CSprite::SaveToXml(const string& pathname)
|
||||
bool CSprite::SaveToXml(const AZStd::string& pathname)
|
||||
{
|
||||
// NOTE: The input pathname has to be a path that can used to save - so not an Asset ID
|
||||
// because of this we do not store the pathname
|
||||
@@ -331,7 +331,7 @@ bool CSprite::SaveToXml(const string& pathname)
|
||||
ser.Value(spriteVersionNumberTag, spriteFileVersionNumber);
|
||||
Serialize(ser);
|
||||
|
||||
return root->saveToFile(pathname);
|
||||
return root->saveToFile(pathname.c_str());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -629,7 +629,7 @@ void CSprite::Shutdown()
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CSprite* CSprite::LoadSprite(const string& pathname)
|
||||
CSprite* CSprite::LoadSprite(const AZStd::string& pathname)
|
||||
{
|
||||
AZStd::string spritePath;
|
||||
AZStd::string texturePath;
|
||||
@@ -691,7 +691,7 @@ CSprite* CSprite::LoadSprite(const string& pathname)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CSprite* CSprite::CreateSprite(const string& renderTargetName)
|
||||
CSprite* CSprite::CreateSprite(const AZStd::string& renderTargetName)
|
||||
{
|
||||
// test if the sprite is already loaded, if so return loaded sprite
|
||||
auto result = s_loadedSprites->find(renderTargetName);
|
||||
|
||||
@@ -32,13 +32,13 @@ public: // member functions
|
||||
|
||||
~CSprite() override;
|
||||
|
||||
const string& GetPathname() const override;
|
||||
const string& GetTexturePathname() const override;
|
||||
const AZStd::string& GetPathname() const override;
|
||||
const AZStd::string& GetTexturePathname() const override;
|
||||
Borders GetBorders() const override;
|
||||
void SetBorders(Borders borders) override;
|
||||
void SetCellBorders(int cellIndex, Borders borders) override;
|
||||
void Serialize(TSerialize ser) override;
|
||||
bool SaveToXml(const string& pathname) override;
|
||||
bool SaveToXml(const AZStd::string& pathname) override;
|
||||
bool AreBordersZeroWidth() const override;
|
||||
bool AreCellBordersZeroWidth(int index) const override;
|
||||
AZ::Vector2 GetSize() override;
|
||||
@@ -72,8 +72,8 @@ public: // static member functions
|
||||
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
static CSprite* LoadSprite(const string& pathname);
|
||||
static CSprite* CreateSprite(const string& renderTargetName);
|
||||
static CSprite* LoadSprite(const AZStd::string& pathname);
|
||||
static CSprite* CreateSprite(const AZStd::string& renderTargetName);
|
||||
static bool DoesSpriteTextureAssetExist(const AZStd::string& pathname);
|
||||
|
||||
//! Replaces baseSprite with newSprite with proper ref-count handling and null-checks.
|
||||
@@ -96,7 +96,7 @@ protected: // member functions
|
||||
bool CellIndexWithinRange(int cellIndex) const;
|
||||
|
||||
private: // types
|
||||
typedef AZStd::unordered_map<string, CSprite*, stl::hash_string_caseless<string>, stl::equality_string_caseless<string> > CSpriteHashMap;
|
||||
typedef AZStd::unordered_map<AZStd::string, CSprite*, stl::hash_string_caseless<AZStd::string>, stl::equality_string_caseless<AZStd::string> > CSpriteHashMap;
|
||||
|
||||
private: // member functions
|
||||
bool LoadFromXmlFile();
|
||||
@@ -109,8 +109,8 @@ private: // data
|
||||
|
||||
SpriteSheetCellContainer m_spriteSheetCells; //!< Stores information for each cell defined within the sprite-sheet.
|
||||
|
||||
string m_pathname;
|
||||
string m_texturePathname;
|
||||
AZStd::string m_pathname;
|
||||
AZStd::string m_texturePathname;
|
||||
Borders m_borders;
|
||||
AZ::Data::Instance<AZ::RPI::Image> m_image;
|
||||
int m_numSpriteSheetCellTags; //!< Number of Cell child-tags in sprite XML; unfortunately needed to help with serialization.
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
|
||||
namespace LyShine
|
||||
{
|
||||
//! \brief Returns the number of UTF8 characters in a string.
|
||||
@@ -16,15 +18,9 @@ namespace LyShine
|
||||
//! character in the string.
|
||||
inline int GetUtf8StringLength(const AZStd::string& utf8String)
|
||||
{
|
||||
int utf8StrLen = 0;
|
||||
Unicode::CIterator<const char*, false> pChar(utf8String.c_str());
|
||||
while (uint32_t ch = *pChar)
|
||||
{
|
||||
++pChar;
|
||||
++utf8StrLen;
|
||||
}
|
||||
|
||||
return utf8StrLen;
|
||||
AZStd::wstring utf8StringW;
|
||||
AZStd::to_wstring(utf8StringW, utf8String.c_str());
|
||||
return static_cast<int>(utf8StringW.size());
|
||||
}
|
||||
|
||||
//! \brief Returns the number of bytes of the size of the given multi-byte char.
|
||||
@@ -34,17 +30,16 @@ namespace LyShine
|
||||
// NOTE: this assumes the uint32_t can be interpreted as a wchar_t, it seems to
|
||||
// work for cases tested but may not in general.
|
||||
// In the long run it would be better to eliminate
|
||||
// this function and use Unicode::CIterator<>::Position instead.
|
||||
wchar_t wcharString[2] = { static_cast<wchar_t>(multiByteChar), 0 };
|
||||
AZStd::string utf8String(CryStringUtils::WStrToUTF8(wcharString));
|
||||
int utf8Length = utf8String.length();
|
||||
return utf8Length;
|
||||
// this function and use some sequence_lenght function that is not internal.
|
||||
return Utf8::Internal::sequence_length(&multiByteChar);
|
||||
}
|
||||
|
||||
inline int GetByteLengthOfUtf8Chars(const char* utf8String, int numUtf8Chars)
|
||||
{
|
||||
AZStd::wstring utf8StringW;
|
||||
AZStd::to_wstring(utf8StringW, utf8String);
|
||||
AZStd::wstring::const_iterator pChar = utf8StringW.begin();
|
||||
int byteStrlen = 0;
|
||||
Unicode::CIterator<const char*, false> pChar(utf8String);
|
||||
for (int i = 0; i < numUtf8Chars; i++)
|
||||
{
|
||||
uint32_t ch = *pChar;
|
||||
|
||||
@@ -3508,7 +3508,7 @@ void UiTextComponent::UnitTestLocalization(CLyShine* lyshine, IConsoleCmdArgs* /
|
||||
{
|
||||
ILocalizationManager* pLocMan = GetISystem()->GetLocalizationManager();
|
||||
|
||||
string localizationXml("libs/localization/localization.xml");
|
||||
AZStd::string localizationXml("libs/localization/localization.xml");
|
||||
|
||||
bool initLocSuccess = false;
|
||||
|
||||
|
||||
@@ -162,7 +162,8 @@ namespace
|
||||
}
|
||||
else if (AZStd::string(key) == "color")
|
||||
{
|
||||
AZStd::string colorValue(string(value).Trim());
|
||||
AZStd::string colorValue(value);
|
||||
AZ::StringFunc::TrimWhiteSpace(colorValue, true, true);
|
||||
AZStd::string::size_type ExpectedNumChars = 7;
|
||||
if (ExpectedNumChars == colorValue.size() && '#' == colorValue.at(0))
|
||||
{
|
||||
|
||||
@@ -177,11 +177,11 @@ namespace
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// test if the given text file starts with the given text string
|
||||
bool TestFileStartString(const string& pathname, const char* expectedStart)
|
||||
bool TestFileStartString(const AZStd::string& pathname, const char* expectedStart)
|
||||
{
|
||||
// Open the file using CCryFile, this supports it being in the pak file or a standalone file
|
||||
CCryFile file;
|
||||
if (!file.Open(pathname, "r"))
|
||||
if (!file.Open(pathname.c_str(), "r"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ namespace
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Check if the given file was saved using AZ serialization
|
||||
bool IsValidAzSerializedFile(const string& pathname)
|
||||
bool IsValidAzSerializedFile(const AZStd::string& pathname)
|
||||
{
|
||||
return TestFileStartString(pathname, "<ObjectStream");
|
||||
}
|
||||
@@ -573,7 +573,7 @@ AZ::EntityId UiCanvasComponent::FindInteractableToHandleEvent(AZ::Vector2 point)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool UiCanvasComponent::SaveToXml(const string& assetIdPathname, const string& sourceAssetPathname)
|
||||
bool UiCanvasComponent::SaveToXml(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname)
|
||||
{
|
||||
PrepareAnimationSystemForCanvasSave();
|
||||
|
||||
@@ -3601,7 +3601,7 @@ void UiCanvasComponent::RenderCanvasToTexture()
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool UiCanvasComponent::SaveCanvasToFile(const string& pathname, AZ::DataStream::StreamType streamType)
|
||||
bool UiCanvasComponent::SaveCanvasToFile(const AZStd::string& pathname, AZ::DataStream::StreamType streamType)
|
||||
{
|
||||
// Note: This is ok for saving in tools, but we should use the streamer to write objects directly (no memory store)
|
||||
AZStd::vector<AZ::u8> dstData;
|
||||
@@ -3884,7 +3884,7 @@ UiCanvasComponent* UiCanvasComponent::CreateCanvasInternal(UiEntityContext* enti
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
UiCanvasComponent* UiCanvasComponent::LoadCanvasInternal(const string& pathnameToOpen, bool forEditor, const string& assetIdPathname, UiEntityContext* entityContext,
|
||||
UiCanvasComponent* UiCanvasComponent::LoadCanvasInternal(const AZStd::string& pathnameToOpen, bool forEditor, const AZStd::string& assetIdPathname, UiEntityContext* entityContext,
|
||||
const AZ::SliceComponent::EntityIdToEntityIdMap* previousRemapTable, AZ::EntityId previousCanvasId)
|
||||
{
|
||||
UiCanvasComponent* canvasComponent = nullptr;
|
||||
|
||||
@@ -99,7 +99,7 @@ public: // member functions
|
||||
LyShine::EntityArray PickElements(const AZ::Vector2& bound0, const AZ::Vector2& bound1) override;
|
||||
AZ::EntityId FindInteractableToHandleEvent(AZ::Vector2 point) override;
|
||||
|
||||
bool SaveToXml(const string& assetIdPathname, const string& sourceAssetPathname) override;
|
||||
bool SaveToXml(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname) override;
|
||||
void FixupCreatedEntities(LyShine::EntityArray topLevelEntities, bool makeUniqueNamesAndIds, AZ::Entity* optionalInsertionPoint) override;
|
||||
void AddElement(AZ::Entity* element, AZ::Entity* parent, AZ::Entity* insertBefore) override;
|
||||
void ReinitializeElements() override;
|
||||
@@ -307,7 +307,7 @@ public: // static member functions
|
||||
static void Shutdown();
|
||||
|
||||
static UiCanvasComponent* CreateCanvasInternal(UiEntityContext* entityContext, bool forEditor);
|
||||
static UiCanvasComponent* LoadCanvasInternal(const string& pathToOpen, bool forEditor, const string& assetIdPathname, UiEntityContext* entityContext,
|
||||
static UiCanvasComponent* LoadCanvasInternal(const AZStd::string& pathToOpen, bool forEditor, const AZStd::string& assetIdPathname, UiEntityContext* entityContext,
|
||||
const AZ::SliceComponent::EntityIdToEntityIdMap* previousRemapTable = nullptr, AZ::EntityId previousCanvasId = AZ::EntityId());
|
||||
static UiCanvasComponent* FixupReloadedCanvasForEditorInternal(AZ::Entity* newCanvasEntity,
|
||||
AZ::Entity* rootSliceEntity, UiEntityContext* entityContext,
|
||||
@@ -403,7 +403,7 @@ private: // member functions
|
||||
void DestroyRenderTarget();
|
||||
void RenderCanvasToTexture();
|
||||
|
||||
bool SaveCanvasToFile(const string& pathname, AZ::DataStream::StreamType streamType);
|
||||
bool SaveCanvasToFile(const AZStd::string& pathname, AZ::DataStream::StreamType streamType);
|
||||
bool SaveCanvasToStream(AZ::IO::GenericStream& stream, AZ::DataStream::StreamType streamType);
|
||||
|
||||
//! Notify elements that their canvas space rect has changed since the last update, and recompute invalid layouts
|
||||
|
||||
@@ -342,7 +342,7 @@ void UiCanvasManager::OnCatalogAssetChanged(const AZ::Data::AssetId& assetId)
|
||||
|
||||
// reload canvas with the same entity IDs (except for new entities, deleted entities etc)
|
||||
UiGameEntityContext* entityContext = new UiGameEntityContext();
|
||||
string pathname(assetPath.c_str());
|
||||
AZStd::string pathname(assetPath.c_str());
|
||||
UiCanvasComponent* newCanvasComponent = UiCanvasComponent::LoadCanvasInternal(pathname, false, "", entityContext, &existingRemapTable, existingCanvasEntityId);
|
||||
|
||||
if (!newCanvasComponent)
|
||||
@@ -393,7 +393,7 @@ AZ::EntityId UiCanvasManager::CreateCanvasInEditor(UiEntityContext* entityContex
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZ::EntityId UiCanvasManager::LoadCanvasInEditor(const string& assetIdPathname, const string& sourceAssetPathname, UiEntityContext* entityContext)
|
||||
AZ::EntityId UiCanvasManager::LoadCanvasInEditor(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname, UiEntityContext* entityContext)
|
||||
{
|
||||
return LoadCanvasInternal(assetIdPathname.c_str(), true, sourceAssetPathname.c_str(), entityContext);
|
||||
}
|
||||
@@ -1064,10 +1064,10 @@ void UiCanvasManager::DebugDisplayCanvasData(int setting) const
|
||||
for (auto canvas : m_loadedCanvases)
|
||||
{
|
||||
// Name
|
||||
const string pathname = canvas->GetPathname().c_str();
|
||||
const AZStd::string pathname = canvas->GetPathname().c_str();
|
||||
size_t lastDot = pathname.find_last_of(".");
|
||||
size_t lastSlash = pathname.find_last_of("/");
|
||||
string leafName = pathname;
|
||||
AZStd::string leafName = pathname;
|
||||
if (lastDot > lastSlash)
|
||||
{
|
||||
leafName = pathname.substr(lastSlash+1, lastDot-lastSlash-1);
|
||||
@@ -1209,10 +1209,10 @@ void UiCanvasManager::DebugDisplayDrawCallData() const
|
||||
for (auto canvas : m_loadedCanvases)
|
||||
{
|
||||
// Name
|
||||
const string pathname = canvas->GetPathname().c_str();
|
||||
const AZStd::string pathname = canvas->GetPathname().c_str();
|
||||
size_t lastDot = pathname.find_last_of(".");
|
||||
size_t lastSlash = pathname.find_last_of("/");
|
||||
string leafName = pathname;
|
||||
AZStd::string leafName = pathname;
|
||||
if (lastDot > lastSlash)
|
||||
{
|
||||
leafName = pathname.substr(lastSlash+1, lastDot-lastSlash-1);
|
||||
@@ -1373,7 +1373,7 @@ void UiCanvasManager::DebugReportDrawCalls(const AZStd::string& name) const
|
||||
}
|
||||
|
||||
// Name of canvas
|
||||
const string pathname = canvas->GetPathname().c_str();
|
||||
const AZStd::string pathname = canvas->GetPathname().c_str();
|
||||
logLine = "\r\n=====================================================================================\r\n";
|
||||
AZ::IO::LocalFileIO::GetInstance()->Write(logHandle, logLine.c_str(), logLine.size());
|
||||
logLine = AZStd::string::format("Canvas: %s\r\n", pathname.c_str());
|
||||
@@ -1461,7 +1461,7 @@ void UiCanvasManager::DebugReportDrawCalls(const AZStd::string& name) const
|
||||
{
|
||||
if (!loggedCanvasHeader)
|
||||
{
|
||||
const string pathname = canvas->GetPathname().c_str();
|
||||
const AZStd::string pathname = canvas->GetPathname().c_str();
|
||||
logLine = AZStd::string::format("\r\nCanvas: %s\r\n\r\n", pathname.c_str());
|
||||
AZ::IO::LocalFileIO::GetInstance()->Write(logHandle, logLine.c_str(), logLine.size());
|
||||
loggedCanvasHeader = true;
|
||||
|
||||
@@ -68,7 +68,7 @@ public: // member functions
|
||||
// ~AssetCatalogEventBus::Handler
|
||||
|
||||
AZ::EntityId CreateCanvasInEditor(UiEntityContext* entityContext);
|
||||
AZ::EntityId LoadCanvasInEditor(const string& assetIdPathname, const string& sourceAssetPathname, UiEntityContext* entityContext);
|
||||
AZ::EntityId LoadCanvasInEditor(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname, UiEntityContext* entityContext);
|
||||
AZ::EntityId ReloadCanvasFromXml(const AZStd::string& xmlString, UiEntityContext* entityContext);
|
||||
|
||||
void ReleaseCanvas(AZ::EntityId canvas, bool forEditor);
|
||||
|
||||
@@ -826,7 +826,8 @@ AZ::Outcome<void, AZStd::string> UiDropdownComponent::ValidatePotentialExpandedP
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZ::FailureValue<AZStd::string> FailureMessage(string message) {
|
||||
AZ::FailureValue<AZStd::string> FailureMessage(AZStd::string message)
|
||||
{
|
||||
return AZ::Failure(AZStd::string(message));
|
||||
}
|
||||
|
||||
|
||||
@@ -575,7 +575,7 @@ void UiInteractableStateFont::SetFontPathname(const AZStd::string& pathname)
|
||||
fontFamily = gEnv->pCryFont->LoadFontFamily(fileName.c_str());
|
||||
if (!fontFamily)
|
||||
{
|
||||
string errorMsg = "Error loading a font from ";
|
||||
AZStd::string errorMsg = "Error loading a font from ";
|
||||
errorMsg += fileName.c_str();
|
||||
errorMsg += ".";
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, errorMsg.c_str());
|
||||
|
||||
@@ -623,12 +623,14 @@ namespace
|
||||
|
||||
int batchCurChar = 0;
|
||||
|
||||
Unicode::CIterator<const char*, false> pChar(drawBatch.text.c_str());
|
||||
Utf8::Unchecked::octet_iterator pChar(drawBatch.text.data());
|
||||
uint32_t prevCh = 0;
|
||||
while (uint32_t ch = *pChar)
|
||||
{
|
||||
char codepoint[5];
|
||||
Unicode::Convert(codepoint, ch);
|
||||
size_t maxSize = 5;
|
||||
char codepoint[5] = { 0 };
|
||||
char* codepointPtr = codepoint;
|
||||
Utf8::Unchecked::octet_iterator<AZStd::string::iterator>::to_utf8_sequence(ch, codepointPtr, maxSize);
|
||||
|
||||
float curCharWidth = drawBatch.font->GetTextSize(codepoint, true, ctx).x;
|
||||
|
||||
@@ -652,15 +654,15 @@ namespace
|
||||
lastSpaceIndexInBatch = batchCurChar;
|
||||
lastSpaceBatch = &drawBatch;
|
||||
lastSpaceWidth = curLineWidth + curCharWidth;
|
||||
pLastSpace = pChar.GetPosition();
|
||||
pLastSpace = pChar.base();
|
||||
assert(*pLastSpace == ' ');
|
||||
}
|
||||
|
||||
bool prevCharWasNewline = false;
|
||||
const bool isFirstChar = pChar.GetPosition() == drawBatch.text.c_str();
|
||||
const bool isFirstChar = pChar.base() == drawBatch.text.c_str();
|
||||
if (ch && !isFirstChar)
|
||||
{
|
||||
const char* pPrevCharStr = pChar.GetPosition() - 1;
|
||||
const char* pPrevCharStr = pChar.base() - 1;
|
||||
prevCharWasNewline = pPrevCharStr[0] == '\n';
|
||||
}
|
||||
else if (isFirstChar)
|
||||
@@ -705,12 +707,12 @@ namespace
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* pBuf = pChar.GetPosition();
|
||||
char* pBuf = pChar.base();
|
||||
AZStd::string::size_type bytesProcessed = pBuf - drawBatch.text.c_str();
|
||||
drawBatch.text.insert(bytesProcessed, "\n"); // Insert the newline, this invalidates the iterator
|
||||
pBuf = drawBatch.text.c_str() + bytesProcessed; // In case reallocation occurs, we ensure we are inside the new buffer
|
||||
pBuf = drawBatch.text.data() + bytesProcessed; // In case reallocation occurs, we ensure we are inside the new buffer
|
||||
assert(*pBuf == '\n');
|
||||
pChar.SetPosition(pBuf); // pChar once again points inside the target string, at the current character
|
||||
pChar = Utf8::Unchecked::octet_iterator(pBuf); // pChar once again points inside the target string, at the current character
|
||||
assert(*pChar == ch);
|
||||
++pChar;
|
||||
++curChar;
|
||||
@@ -1189,7 +1191,7 @@ void UiTextComponent::DrawBatch::CalculateSize(const STextDrawContext& ctx, bool
|
||||
if (displayString.length() > 0)
|
||||
{
|
||||
AZStd::string::size_type endpos = displayString.find_last_not_of(" \t\n\v\f\r");
|
||||
if ((endpos != string::npos) && (endpos != displayString.length() - 1))
|
||||
if ((endpos != AZStd::string::npos) && (endpos != displayString.length() - 1))
|
||||
{
|
||||
displayString.erase(endpos + 1);
|
||||
}
|
||||
@@ -1295,12 +1297,14 @@ bool UiTextComponent::DrawBatch::GetOverflowInfo(const STextDrawContext& ctx,
|
||||
|
||||
float maxEffectOffsetX = font->GetMaxEffectOffset(ctx.m_fxIdx).x;
|
||||
|
||||
Unicode::CIterator<const char*, false> pChar(text.c_str());
|
||||
Utf8::Unchecked::octet_iterator pChar(text.data());
|
||||
uint32_t prevCh = 0;
|
||||
while (uint32_t ch = *pChar)
|
||||
{
|
||||
char codepoint[5];
|
||||
Unicode::Convert(codepoint, ch);
|
||||
size_t maxSize = 5;
|
||||
char codepoint[5] = { 0 };
|
||||
char* codepointPtr = codepoint;
|
||||
Utf8::Unchecked::octet_iterator<AZStd::string::iterator>::to_utf8_sequence(ch, codepointPtr, maxSize);
|
||||
|
||||
float curCharWidth = font->GetTextSize(codepoint, true, ctx).x;
|
||||
if (prevCh)
|
||||
@@ -2274,7 +2278,7 @@ int UiTextComponent::GetCharIndexFromCanvasSpacePoint(AZ::Vector2 point, bool mu
|
||||
// Iterate across the line
|
||||
for (const DrawBatch& drawBatch : batchLine.drawBatchList)
|
||||
{
|
||||
Unicode::CIterator<const char*, false> pChar(drawBatch.text.c_str());
|
||||
Utf8::Unchecked::octet_iterator pChar(drawBatch.text.data());
|
||||
while (uint32_t ch = *pChar)
|
||||
{
|
||||
++pChar;
|
||||
@@ -4827,14 +4831,16 @@ int UiTextComponent::GetStartEllipseIndexInDrawBatch(const DrawBatch* drawBatchT
|
||||
{
|
||||
float overflowStringSize = 0.0f;
|
||||
int ellipsisCharPos = 0;
|
||||
Unicode::CIterator<const char*, false> pChar(drawBatchToEllipse->text.c_str());
|
||||
Utf8::Unchecked::octet_iterator pChar(drawBatchToEllipse->text.data());
|
||||
uint32_t stringBufferIndex = 0;
|
||||
uint32_t prevCh = 0;
|
||||
while (uint32_t ch = *pChar)
|
||||
{
|
||||
++pChar;
|
||||
char codepoint[5];
|
||||
Unicode::Convert(codepoint, ch);
|
||||
size_t maxSize = 5;
|
||||
char codepoint[5] = { 0 };
|
||||
char* codepointPtr = codepoint;
|
||||
Utf8::Unchecked::octet_iterator<AZStd::string::iterator>::to_utf8_sequence(ch, codepointPtr, maxSize);
|
||||
|
||||
overflowStringSize += drawBatchToEllipse->font->GetTextSize(codepoint, true, ctx).x;
|
||||
|
||||
@@ -4925,7 +4931,7 @@ AZ::Vector2 UiTextComponent::GetTextSizeFromDrawBatchLines(const UiTextComponent
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZStd::string UiTextComponent::GetLocalizedText([[maybe_unused]] const AZStd::string& text)
|
||||
{
|
||||
string locText;
|
||||
AZStd::string locText;
|
||||
LocalizationManagerRequestBus::Broadcast(&LocalizationManagerRequestBus::Events::LocalizeString_ch, m_text.c_str(), locText, false);
|
||||
return locText.c_str();
|
||||
}
|
||||
@@ -5110,7 +5116,7 @@ int UiTextComponent::GetLineNumberFromCharIndex(const DrawBatchLines& drawBatchL
|
||||
|
||||
for (const DrawBatch& drawBatch : batchLine.drawBatchList)
|
||||
{
|
||||
Unicode::CIterator<const char*, false> pChar(drawBatch.text.c_str());
|
||||
Utf8::Unchecked::octet_iterator pChar(drawBatch.text.data());
|
||||
while (uint32_t ch = *pChar)
|
||||
{
|
||||
++pChar;
|
||||
|
||||
@@ -30,7 +30,7 @@ void UiTextComponentOffsetsSelector::ParseBatchLine(const UiTextComponent::DrawB
|
||||
{
|
||||
// Iterate character by character over DrawBatch string contents,
|
||||
// looking for m_firstIndex and m_lastIndex.
|
||||
Unicode::CIterator<const char*, false> pChar(drawBatch.text.c_str());
|
||||
Utf8::Unchecked::octet_iterator pChar(drawBatch.text.data());
|
||||
while (uint32_t ch = *pChar)
|
||||
{
|
||||
++pChar;
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace
|
||||
if (stringLength > 0 && stringLength >= utf8Index)
|
||||
{
|
||||
// Iterate over the string until the given index is found.
|
||||
Unicode::CIterator<const char*, false> pChar(utf8String.c_str());
|
||||
Utf8::Unchecked::octet_iterator pChar(utf8String.data());
|
||||
while (uint32_t ch = *pChar)
|
||||
{
|
||||
if (utf8Index == utfIndexIter)
|
||||
@@ -1185,7 +1185,8 @@ void UiTextInputComponent::UpdateDisplayedTextFunction()
|
||||
// NOTE: this assumes the uint32_t can be interpreted as a wchar_t, it seems to
|
||||
// work for cases tested but may not in general.
|
||||
wchar_t wcharString[2] = { static_cast<wchar_t>(this->GetReplacementCharacter()), 0 };
|
||||
AZStd::string replacementCharString(CryStringUtils::WStrToUTF8(wcharString));
|
||||
AZStd::string replacementCharString;
|
||||
AZStd::to_string(replacementCharString, wcharString, 1);
|
||||
|
||||
int numReplacementChars = LyShine::GetUtf8StringLength(originalText);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user