Merge branch 'main' into ly-as-sdk/LYN-2948
This commit is contained in:
@@ -118,12 +118,12 @@ ly_add_target(
|
||||
Gem::LmbrCentral.Static
|
||||
Legacy::NewsShared
|
||||
AZ::AWSNativeSDKInit
|
||||
Legacy::CryCommonTools
|
||||
AZ::AtomCore
|
||||
Gem::Atom_RPI.Edit
|
||||
Gem::Atom_RPI.Public
|
||||
Gem::Atom_Feature_Common.Static
|
||||
Gem::AtomToolsFramework.Static
|
||||
Gem::AtomViewportDisplayInfo
|
||||
${additional_dependencies}
|
||||
PUBLIC
|
||||
3rdParty::AWSNativeSDK::Core
|
||||
@@ -244,7 +244,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
AZ::AzToolsFramework
|
||||
Legacy::EditorLib
|
||||
Gem::LmbrCentral
|
||||
Legacy::CryCommonTools
|
||||
)
|
||||
ly_add_googletest(
|
||||
NAME Legacy::EditorLib.Tests
|
||||
|
||||
@@ -424,7 +424,6 @@ AZ::Outcome<void, AZStd::string> CGameEngine::Init(
|
||||
sip.pLogCallback = &m_logFile;
|
||||
sip.sLogFileName = "@log@/Editor.log";
|
||||
sip.pUserCallback = m_pSystemUserCallback;
|
||||
sip.pValidator = GetIEditor()->GetErrorReport(); // Assign validator from Editor.
|
||||
|
||||
if (sInCmdLine)
|
||||
{
|
||||
|
||||
@@ -106,8 +106,7 @@ void CGotoPositionDlg::OnChangeEdit()
|
||||
{
|
||||
const int lengthInSw = 8;
|
||||
const int strNum = 6;
|
||||
TArray< float > pos(strNum);
|
||||
pos.Set(0);
|
||||
AZStd::vector<float> pos(strNum);
|
||||
|
||||
m_sPos = m_ui->m_posEdit->text();
|
||||
const QStringList parts = m_sPos.split(QRegularExpression("[\\s,;\\t]"), Qt::SkipEmptyParts);
|
||||
|
||||
@@ -779,36 +779,6 @@ bool GraphicsSettingsDialog::CVarChanged(AZStd::any val, const char* cvarName, i
|
||||
m_cVarTracker[cvarName].fileVals[specLevel].editedValue = val;
|
||||
}
|
||||
|
||||
// If changing cvar from the platform cfg file currently running, set cvar
|
||||
if (GetISystem()->GetConfigPlatform() == m_currentPlatform && GetISystem()->GetConfigSpec() == specLevel + 1)
|
||||
{
|
||||
if (ICVar* cvar = gEnv->pConsole->GetCVar(cvarName))
|
||||
{
|
||||
int type = cvar->GetType();
|
||||
if (type == CVAR_INT)
|
||||
{
|
||||
int newValue;
|
||||
if (AZStd::any_numeric_cast<int>(&val, newValue))
|
||||
{
|
||||
cvar->Set(newValue);
|
||||
}
|
||||
}
|
||||
else if (type == CVAR_FLOAT)
|
||||
{
|
||||
float newValue;
|
||||
if (AZStd::any_numeric_cast<float>(&val, newValue))
|
||||
{
|
||||
cvar->Set(newValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::string* currValue = AZStd::any_cast<AZStd::string>(&val);
|
||||
cvar->Set(currValue->c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Checking if the newly edited value is equal to the overwritten value
|
||||
cvarInfo = AZStd::make_pair(azcvarName, m_cVarTracker[cvarName]);
|
||||
if (CheckCVarStatesForDiff(&cvarInfo, specLevel, EDITED_OVERWRITTEN_COMPARE))
|
||||
|
||||
@@ -92,7 +92,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#ifdef _RELEASE
|
||||
#undef _RELEASE
|
||||
#endif
|
||||
#include <CrtDebugStats.h>
|
||||
|
||||
#include "Core/QtEditorApplication.h" // for Editor::EditorQtApplication
|
||||
|
||||
@@ -1585,16 +1584,9 @@ void CEditorImpl::AddUIEnums()
|
||||
m_pUIEnumsDatabase->SetEnumStrings("ShadowMinResPercent", types);
|
||||
}
|
||||
|
||||
void CEditorImpl::SetEditorConfigSpec(ESystemConfigSpec spec, ESystemConfigPlatform platform)
|
||||
void CEditorImpl::SetEditorConfigSpec(ESystemConfigSpec spec, [[maybe_unused]]ESystemConfigPlatform platform)
|
||||
{
|
||||
gSettings.editorConfigSpec = spec;
|
||||
if (m_pSystem->GetConfigSpec(true) != spec || m_pSystem->GetConfigPlatform() != platform)
|
||||
{
|
||||
m_pSystem->SetConfigSpec(spec, platform, true);
|
||||
gSettings.editorConfigSpec = m_pSystem->GetConfigSpec(true);
|
||||
GetObjectManager()->SendEvent(EVENT_CONFIG_SPEC_CHANGE);
|
||||
AzToolsFramework::EditorEvents::Bus::Broadcast(&AzToolsFramework::EditorEvents::OnEditorSpecChange);
|
||||
}
|
||||
}
|
||||
|
||||
ESystemConfigSpec CEditorImpl::GetEditorConfigSpec() const
|
||||
|
||||
@@ -1019,13 +1019,16 @@ void MainWindow::InitActions()
|
||||
.SetApplyHoverEffect()
|
||||
.SetCheckable(true)
|
||||
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdatePlayGame);
|
||||
am->AddAction(ID_TOOLBAR_WIDGET_PLAYCONSOLE_LABEL, tr("Play Console"))
|
||||
.SetText(tr("Play Console"));
|
||||
am->AddAction(ID_TOOLBAR_WIDGET_PLAYCONSOLE_LABEL, tr("Play Controls"))
|
||||
.SetText(tr("Play Controls"));
|
||||
am->AddAction(ID_SWITCH_PHYSICS, tr("Simulate"))
|
||||
.SetIcon(QIcon(":/stylesheet/img/UI20/toolbar/Simulate_Physics.svg"))
|
||||
.SetShortcut(tr("Ctrl+P"))
|
||||
.SetToolTip(tr("Simulate (Ctrl+P)"))
|
||||
.SetCheckable(true)
|
||||
.SetStatusTip(tr("Enable processing of Physics and AI."))
|
||||
.SetApplyHoverEffect()
|
||||
.SetCheckable(true)
|
||||
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnSwitchPhysicsUpdate);
|
||||
am->AddAction(ID_GAME_SYNCPLAYER, tr("Move Player and Camera Separately")).SetCheckable(true)
|
||||
.SetStatusTip(tr("Move Player and Camera Separately"))
|
||||
|
||||
@@ -609,13 +609,15 @@ AmazonToolbar ToolbarManager::GetObjectToolbar() const
|
||||
|
||||
AmazonToolbar ToolbarManager::GetPlayConsoleToolbar() const
|
||||
{
|
||||
AmazonToolbar t = AmazonToolbar("PlayConsole", QObject::tr("Play Console"));
|
||||
AmazonToolbar t = AmazonToolbar("PlayConsole", QObject::tr("Play Controls"));
|
||||
t.SetMainToolbar(true);
|
||||
|
||||
t.AddAction(ID_TOOLBAR_WIDGET_SPACER_RIGHT, ORIGINAL_TOOLBAR_VERSION);
|
||||
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
|
||||
t.AddAction(ID_TOOLBAR_WIDGET_PLAYCONSOLE_LABEL, ORIGINAL_TOOLBAR_VERSION);
|
||||
t.AddAction(ID_VIEW_SWITCHTOGAME, TOOLBARS_WITH_PLAY_GAME);
|
||||
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
|
||||
t.AddAction(ID_SWITCH_PHYSICS, TOOLBARS_WITH_PLAY_GAME);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
@@ -2734,9 +2734,6 @@ void CTrackViewDopeSheetBase::DrawKeys(CTrackViewTrack* pTrack, QPainter* painte
|
||||
const int kDefaultWidthForDescription = 200;
|
||||
const int kSmallMargin = 10;
|
||||
|
||||
FixedDynArray<float> drawnKeyTimes;
|
||||
drawnKeyTimes.set(ArrayT((float*)alloca(numKeys * sizeof(float)), numKeys));
|
||||
|
||||
AZStd::vector<CTrackViewKeyHandle> sortedKeys;
|
||||
sortedKeys.reserve(numKeys);
|
||||
for (int i = 0; i < numKeys; ++i)
|
||||
@@ -2751,11 +2748,6 @@ void CTrackViewDopeSheetBase::DrawKeys(CTrackViewTrack* pTrack, QPainter* painte
|
||||
CTrackViewKeyHandle keyHandle = sortedKeys[i];
|
||||
|
||||
const float time = keyHandle.GetTime();
|
||||
if (!stl::push_back_unique(drawnKeyTimes, time))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int x = TimeToClient(time);
|
||||
if (x - kSmallMargin > rect.right())
|
||||
{
|
||||
|
||||
@@ -440,7 +440,6 @@ bool CImageTIF::SaveRAW(const QString& fileName, const void* pData, int width, i
|
||||
{
|
||||
size_t offset = h * pitch;
|
||||
int err = TIFFWriteScanline(tif, raster + offset, h, 0);
|
||||
assert(CryMemory::IsHeapValid());
|
||||
if (err < 0)
|
||||
{
|
||||
bRet = false;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
|
||||
#include "FileUtil.h"
|
||||
#include "STLPoolAllocator.h"
|
||||
#include <functional>
|
||||
|
||||
class CIndexedFiles
|
||||
@@ -117,15 +116,8 @@ private:
|
||||
std::vector <std::function<void()> > m_updateCallbacks;
|
||||
IFileUtil::FileArray m_files;
|
||||
std::map<QString, int> m_pathToIndex;
|
||||
#if defined(_DEBUG) || defined(AZ_COMPILER_CLANG)
|
||||
// In debug, the validation phase of the pool allocator when destructed takes so much time,
|
||||
// and using the STLPoolAllocator causes a strange issue when compiling with clang
|
||||
typedef std::set<int, std::less<int> > int_set;
|
||||
typedef std::map<QString, int_set, std::less<QString> > TagTable;
|
||||
#else
|
||||
typedef std::set<int, std::less<int>, stl::STLPoolAllocator<int> > int_set;
|
||||
typedef std::map<QString, int_set, std::less<QString>, stl::STLPoolAllocator<std::pair<const QString, int_set> > > TagTable;
|
||||
#endif
|
||||
TagTable m_tags;
|
||||
QString m_rootPath;
|
||||
|
||||
|
||||
@@ -272,21 +272,6 @@ namespace Path
|
||||
return str;
|
||||
}
|
||||
|
||||
//! Set the current mod NAME for editing purposes. After doing this the above functions will take this into account
|
||||
//! name only, please!
|
||||
void SetModName(const char* input)
|
||||
{
|
||||
if (
|
||||
(!input) ||
|
||||
((gEnv) && (gEnv->pSystem) && (!gEnv->pSystem->IsMODValid(input))) // we can only validate
|
||||
)
|
||||
{
|
||||
AZ_Warning("PathUtil", false, "Invalid mod name supplied to SetModName: %s - ignored.", input ? input : "(NULL)");
|
||||
return;
|
||||
}
|
||||
g_currentModName = input;
|
||||
}
|
||||
|
||||
//! Get the root folder (in source control or other writable assets) where you should save root data.
|
||||
AZStd::string GetEditingRootFolder()
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMONTOOLS_STRINGHELPERS_H
|
||||
#define CRYINCLUDE_CRYCOMMONTOOLS_STRINGHELPERS_H
|
||||
#pragma once
|
||||
|
||||
#include <CryString.h>
|
||||
|
||||
namespace StringHelpers
|
||||
{
|
||||
// compares two strings to see if they are the same or different, case sensitive
|
||||
// returns 0 if the strings are the same, a -1 if the first string is bigger, or a 1 if the second string is bigger
|
||||
int Compare(const string& str0, const string& str1);
|
||||
int Compare(const wstring& str0, const wstring& str1);
|
||||
|
||||
// compares two strings to see if they are the same or different, case is ignored
|
||||
// returns 0 if the strings are the same, a -1 if the first string is bigger, or a 1 if the second string is bigger
|
||||
int CompareIgnoreCase(const string& str0, const string& str1);
|
||||
int CompareIgnoreCase(const wstring& str0, const wstring& str1);
|
||||
|
||||
// compares two strings to see if they are the same, case senstive
|
||||
// returns true if they are the same or false if they are different
|
||||
bool Equals(const string& str0, const string& str1);
|
||||
bool Equals(const wstring& str0, const wstring& str1);
|
||||
|
||||
// compares two strings to see if they are the same, case is ignored
|
||||
// returns true if they are the same or false if they are different
|
||||
bool EqualsIgnoreCase(const string& str0, const string& str1);
|
||||
bool EqualsIgnoreCase(const wstring& str0, const wstring& str1);
|
||||
|
||||
// checks to see if a string starts with a specified string, case sensitive
|
||||
// returns true if the string does start with a specified string or false if it does not
|
||||
bool StartsWith(const string& str, const string& pattern);
|
||||
bool StartsWith(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string starts with a specified string, case is ignored
|
||||
// returns true if the string does start with a specified string or false if it does not
|
||||
bool StartsWithIgnoreCase(const string& str, const string& pattern);
|
||||
bool StartsWithIgnoreCase(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string ends with a specified string, case sensitive
|
||||
// returns true if the string does end with a specified string or false if it does not
|
||||
bool EndsWith(const string& str, const string& pattern);
|
||||
bool EndsWith(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string ends with a specified string, case is ignored
|
||||
// returns true if the string does end with a specified string or false if it does not
|
||||
bool EndsWithIgnoreCase(const string& str, const string& pattern);
|
||||
bool EndsWithIgnoreCase(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string contains a specified string, case sensitive
|
||||
// returns true if the string does contain the specified string or false if it does not
|
||||
bool Contains(const string& str, const string& pattern);
|
||||
bool Contains(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string contains a specified string, case is ignored
|
||||
// returns true if the string does contain the specified string or false if it does not
|
||||
bool ContainsIgnoreCase(const string& str, const string& pattern);
|
||||
bool ContainsIgnoreCase(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string contains a wildcard string pattern, case sensitive
|
||||
// returns true if the string does match the wildcard string pattern or false if it does not
|
||||
bool MatchesWildcards(const string& str, const string& wildcards);
|
||||
bool MatchesWildcards(const wstring& str, const wstring& wildcards);
|
||||
|
||||
// checks to see if a string contains a wildcard string pattern, case is ignored
|
||||
// returns true if the string does match the wildcard string pattern or false if it does not
|
||||
bool MatchesWildcardsIgnoreCase(const string& str, const string& wildcards);
|
||||
bool MatchesWildcardsIgnoreCase(const wstring& str, const wstring& wildcards);
|
||||
|
||||
bool MatchesWildcardsIgnoreCaseExt(const string& str, const string& wildcards, std::vector<string>& wildcardMatches);
|
||||
bool MatchesWildcardsIgnoreCaseExt(const wstring& str, const wstring& wildcards, std::vector<wstring>& wildcardMatches);
|
||||
|
||||
string TrimLeft(const string& s);
|
||||
wstring TrimLeft(const wstring& s);
|
||||
|
||||
string TrimRight(const string& s);
|
||||
wstring TrimRight(const wstring& s);
|
||||
|
||||
string Trim(const string& s);
|
||||
wstring Trim(const wstring& s);
|
||||
|
||||
string RemoveDuplicateSpaces(const string& s);
|
||||
wstring RemoveDuplicateSpaces(const wstring& s);
|
||||
|
||||
// converts a string with upper case characters to be all lower case
|
||||
// returns the string in all lower case
|
||||
string MakeLowerCase(const string& s);
|
||||
wstring MakeLowerCase(const wstring& s);
|
||||
|
||||
// converts a string with lower case characters to be all upper case
|
||||
// returns the string in all upper case
|
||||
string MakeUpperCase(const string& s);
|
||||
wstring MakeUpperCase(const wstring& s);
|
||||
|
||||
// replace a specified character in a string with a specified replacement character
|
||||
// returns string with specified character replaced
|
||||
string Replace(const string& s, char oldChar, char newChar);
|
||||
wstring Replace(const wstring& s, wchar_t oldChar, wchar_t newChar);
|
||||
|
||||
void ConvertStringByRef(string& out, const string& in);
|
||||
void ConvertStringByRef(wstring& out, const string& in);
|
||||
void ConvertStringByRef(string& out, const wstring& in);
|
||||
void ConvertStringByRef(wstring& out, const wstring& in);
|
||||
|
||||
template <typename O, typename I>
|
||||
O ConvertString(const I& in)
|
||||
{
|
||||
O out;
|
||||
ConvertStringByRef(out, in);
|
||||
return out;
|
||||
}
|
||||
|
||||
void Split(const string& str, const string& separator, bool bReturnEmptyPartsToo, std::vector<string>& outParts);
|
||||
void Split(const wstring& str, const wstring& separator, bool bReturnEmptyPartsToo, std::vector<wstring>& outParts);
|
||||
|
||||
void SplitByAnyOf(const string& str, const string& separators, bool bReturnEmptyPartsToo, std::vector<string>& outParts);
|
||||
void SplitByAnyOf(const wstring& str, const wstring& separators, bool bReturnEmptyPartsToo, std::vector<wstring>& outParts);
|
||||
|
||||
string FormatVA(const char* const format, va_list parg);
|
||||
wstring FormatVA(const wchar_t* const format, va_list parg);
|
||||
|
||||
inline string Format(const char* const format, ...)
|
||||
{
|
||||
if ((format == 0) || (format[0] == 0))
|
||||
{
|
||||
return string();
|
||||
}
|
||||
va_list parg;
|
||||
va_start(parg, format);
|
||||
const string result = FormatVA(format, parg);
|
||||
va_end(parg);
|
||||
return result;
|
||||
}
|
||||
|
||||
inline wstring Format(const wchar_t* const format, ...)
|
||||
{
|
||||
if ((format == 0) || (format[0] == 0))
|
||||
{
|
||||
return wstring();
|
||||
}
|
||||
va_list parg;
|
||||
va_start(parg, format);
|
||||
const wstring result = FormatVA(format, parg);
|
||||
va_end(parg);
|
||||
return result;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SafeCopy(char* const pDstBuffer, const size_t dstBufferSizeInBytes, const char* const pSrc);
|
||||
void SafeCopy(wchar_t* const pDstBuffer, const size_t dstBufferSizeInBytes, const wchar_t* const pSrc);
|
||||
|
||||
void SafeCopyPadZeros(char* const pDstBuffer, const size_t dstBufferSizeInBytes, const char* const pSrc);
|
||||
void SafeCopyPadZeros(wchar_t* const pDstBuffer, const size_t dstBufferSizeInBytes, const wchar_t* const pSrc);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ASCII
|
||||
// ANSI (system default Windows ANSI code page)
|
||||
// UTF-8
|
||||
// UTF-16
|
||||
|
||||
// ASCII -> UTF-16
|
||||
|
||||
bool Utf16ContainsAsciiOnly(const wchar_t* wstr);
|
||||
string ConvertAsciiUtf16ToAscii(const wchar_t* wstr);
|
||||
wstring ConvertAsciiToUtf16(const char* str);
|
||||
|
||||
// UTF-8 <-> UTF-16
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
wstring ConvertUtf8ToUtf16(const char* str);
|
||||
string ConvertUtf16ToUtf8(const wchar_t* wstr);
|
||||
|
||||
inline string ConvertUtfToUtf8(const char* str)
|
||||
{
|
||||
return string(str);
|
||||
}
|
||||
|
||||
inline string ConvertUtfToUtf8(const wchar_t* wstr)
|
||||
{
|
||||
return ConvertUtf16ToUtf8(wstr);
|
||||
}
|
||||
|
||||
inline wstring ConvertUtfToUtf16(const char* str)
|
||||
{
|
||||
return ConvertUtf8ToUtf16(str);
|
||||
}
|
||||
|
||||
inline wstring ConvertUtfToUtf16(const wchar_t* wstr)
|
||||
{
|
||||
return wstring(wstr);
|
||||
}
|
||||
|
||||
// ANSI <-> UTF-8, UTF-16
|
||||
|
||||
wstring ConvertAnsiToUtf16(const char* str);
|
||||
string ConvertUtf16ToAnsi(const wchar_t* wstr, char badChar);
|
||||
|
||||
inline string ConvertAnsiToUtf8(const char* str)
|
||||
{
|
||||
return ConvertUtf16ToUtf8(ConvertAnsiToUtf16(str).c_str());
|
||||
}
|
||||
inline string ConvertUtf8ToAnsi(const char* str, char badChar)
|
||||
{
|
||||
return ConvertUtf16ToAnsi(ConvertUtf8ToUtf16(str).c_str(), badChar);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ANSI -> ASCII
|
||||
string ConvertAnsiToAscii(const char* str, char badChar);
|
||||
}
|
||||
#endif // CRYINCLUDE_CRYCOMMONTOOLS_STRINGHELPERS_H
|
||||
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMONTOOLS_UTIL_H
|
||||
#define CRYINCLUDE_CRYCOMMONTOOLS_UTIL_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <cstring> // memset()
|
||||
|
||||
#ifndef BIT
|
||||
#define BIT(x) (1 << (x))
|
||||
#endif
|
||||
|
||||
|
||||
union IntOrPtr
|
||||
{
|
||||
int m_int;
|
||||
unsigned int m_uint;
|
||||
void* m_pVoid;
|
||||
char* m_pChar;
|
||||
|
||||
void setZero()
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
}
|
||||
|
||||
bool operator==(const IntOrPtr& a) const
|
||||
{
|
||||
return memcmp(this, &a, sizeof(*this)) == 0;
|
||||
}
|
||||
|
||||
bool operator!=(const IntOrPtr& a) const
|
||||
{
|
||||
return memcmp(this, &a, sizeof(*this)) != 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
namespace Util
|
||||
{
|
||||
// note: names 'getMin' and 'getMax' (instead of usual 'min' and 'max') are
|
||||
// used to avoid conflicts with global and/or user's #define of 'min' and 'max'
|
||||
|
||||
template<class T>
|
||||
inline const T& getMin(const T& a, const T& b)
|
||||
{
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline const T& getMax(const T& a, const T& b)
|
||||
{
|
||||
return (a < b) ? b : a;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline const T& getMin(const T& a, const T& b, const T& c)
|
||||
{
|
||||
return (a < b)
|
||||
? ((a < c) ? a : c)
|
||||
: ((b < c) ? b : c);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline const T& getMax(const T& a, const T& b, const T& c)
|
||||
{
|
||||
return (a < b)
|
||||
? ((b < c) ? c : b)
|
||||
: ((a < c) ? c : a);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T& getClamped(const T& a, const T& a_min, const T& a_max)
|
||||
{
|
||||
if (a < a_min)
|
||||
{
|
||||
return a_min;
|
||||
}
|
||||
if (a_max < a)
|
||||
{
|
||||
return a_max;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
// note: name 'clampMinMax' (instead of usual 'clamp') is used
|
||||
// to avoid conflicts with global and/or user's #define of 'clamp'
|
||||
template<class T>
|
||||
inline void clampMinMax(T& a, const T& a_min, const T& a_max)
|
||||
{
|
||||
if (a < a_min)
|
||||
{
|
||||
a = a_min;
|
||||
}
|
||||
else if (a_max < a)
|
||||
{
|
||||
a = a_max;
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void clampMin(T& a, const T& a_min)
|
||||
{
|
||||
if (a < a_min)
|
||||
{
|
||||
a = a_min;
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void clampMax(T& a, const T& a_max)
|
||||
{
|
||||
if (a_max < a)
|
||||
{
|
||||
a = a_max;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class TInteger>
|
||||
inline bool isPowerOfTwo(TInteger x)
|
||||
{
|
||||
return (x & (x - 1)) == 0;
|
||||
}
|
||||
|
||||
|
||||
template <class TInteger>
|
||||
inline TInteger getCeiledPowerOfTwo(TInteger x)
|
||||
{
|
||||
x = x - 1;
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4293)
|
||||
if (sizeof(TInteger) > 0)
|
||||
{
|
||||
x |= x >> 1;
|
||||
}
|
||||
if (sizeof(TInteger) > 0)
|
||||
{
|
||||
x |= x >> 2;
|
||||
}
|
||||
if (sizeof(TInteger) > 0)
|
||||
{
|
||||
x |= x >> 4;
|
||||
}
|
||||
if (sizeof(TInteger) > 1)
|
||||
{
|
||||
x |= x >> 8;
|
||||
}
|
||||
if (sizeof(TInteger) > 2)
|
||||
{
|
||||
x |= x >> 16;
|
||||
}
|
||||
if (sizeof(TInteger) > 4)
|
||||
{
|
||||
x |= x >> 32;
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
return x + 1;
|
||||
}
|
||||
|
||||
|
||||
template <class TInteger>
|
||||
inline TInteger getFlooredPowerOfTwo(TInteger x)
|
||||
{
|
||||
if (!isPowerOfTwo(x))
|
||||
{
|
||||
x = getCeiledPowerOfTwo(x) >> 1;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
inline T square(T x)
|
||||
{
|
||||
return x * x;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
inline T cube(T x)
|
||||
{
|
||||
return x * x * x;
|
||||
}
|
||||
} // namespace Util
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMONTOOLS_UTIL_H
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
// Description : CViewportTitleDlg implementation file
|
||||
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "ViewportTitleDlg.h"
|
||||
@@ -36,10 +36,13 @@
|
||||
#include "UsedResources.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
|
||||
#include <AtomLyIntegration/AtomViewportDisplayInfo/AtomViewportInfoDisplayBus.h>
|
||||
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include "ui_ViewportTitleDlg.h"
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#endif //!defined(Q_MOC_RUN)
|
||||
|
||||
|
||||
// CViewportTitleDlg dialog
|
||||
@@ -63,6 +66,32 @@ inline namespace Helpers
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
class CViewportTitleDlgDisplayInfoHelper
|
||||
: public QObject
|
||||
, public AZ::AtomBridge::AtomViewportInfoDisplayNotificationBus::Handler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CViewportTitleDlgDisplayInfoHelper(CViewportTitleDlg* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
AZ::AtomBridge::AtomViewportInfoDisplayNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
signals:
|
||||
void ViewportInfoStatusUpdated(int newIndex);
|
||||
|
||||
private:
|
||||
void OnViewportInfoDisplayStateChanged(AZ::AtomBridge::ViewportInfoDisplayState state)
|
||||
{
|
||||
emit ViewportInfoStatusUpdated(static_cast<int>(state));
|
||||
}
|
||||
};
|
||||
} //end anonymous namespace
|
||||
|
||||
CViewportTitleDlg::CViewportTitleDlg(QWidget* pParent)
|
||||
: QWidget(pParent)
|
||||
, m_ui(new Ui::ViewportTitleDlg)
|
||||
@@ -115,14 +144,11 @@ void CViewportTitleDlg::OnInitDialog()
|
||||
|
||||
m_ui->m_toggleHelpersBtn->setChecked(GetIEditor()->GetDisplaySettings()->IsDisplayHelpers());
|
||||
|
||||
ICVar* pDisplayInfo(gEnv->pConsole->GetCVar("r_displayInfo"));
|
||||
if (pDisplayInfo)
|
||||
{
|
||||
SFunctor oFunctor;
|
||||
oFunctor.Set(OnChangedDisplayInfo, pDisplayInfo, m_ui->m_toggleDisplayInfoBtn);
|
||||
m_displayInfoCallbackIndex = pDisplayInfo->AddOnChangeFunctor(oFunctor);
|
||||
OnChangedDisplayInfo(pDisplayInfo, m_ui->m_toggleDisplayInfoBtn);
|
||||
}
|
||||
|
||||
// Add a child parented to us that listens for r_displayInfo changes.
|
||||
auto displayInfoHelper = new CViewportTitleDlgDisplayInfoHelper(this);
|
||||
connect(displayInfoHelper, &CViewportTitleDlgDisplayInfoHelper::ViewportInfoStatusUpdated, this, &CViewportTitleDlg::UpdateDisplayInfo);
|
||||
UpdateDisplayInfo();
|
||||
|
||||
connect(m_ui->m_toggleHelpersBtn, &QToolButton::clicked, this, &CViewportTitleDlg::OnToggleHelpers);
|
||||
connect(m_ui->m_toggleDisplayInfoBtn, &QToolButton::clicked, this, &CViewportTitleDlg::OnToggleDisplayInfo);
|
||||
@@ -156,6 +182,29 @@ void CViewportTitleDlg::OnToggleHelpers()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CViewportTitleDlg::OnToggleDisplayInfo()
|
||||
{
|
||||
AZ::AtomBridge::ViewportInfoDisplayState state = AZ::AtomBridge::ViewportInfoDisplayState::NoInfo;
|
||||
AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::BroadcastResult(
|
||||
state,
|
||||
&AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::GetDisplayState
|
||||
);
|
||||
state = aznumeric_cast<AZ::AtomBridge::ViewportInfoDisplayState>(
|
||||
(aznumeric_cast<int>(state)+1) % aznumeric_cast<int>(AZ::AtomBridge::ViewportInfoDisplayState::Invalid));
|
||||
// SetDisplayState will fire OnViewportInfoDisplayStateChanged and notify us, no need to call UpdateDisplayInfo.
|
||||
AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Broadcast(
|
||||
&AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::SetDisplayState,
|
||||
state
|
||||
);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CViewportTitleDlg::UpdateDisplayInfo()
|
||||
{
|
||||
AZ::AtomBridge::ViewportInfoDisplayState state = AZ::AtomBridge::ViewportInfoDisplayState::NoInfo;
|
||||
AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::BroadcastResult(
|
||||
state,
|
||||
&AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::GetDisplayState
|
||||
);
|
||||
m_ui->m_toggleDisplayInfoBtn->setChecked(state != AZ::AtomBridge::ViewportInfoDisplayState::NoInfo);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -544,10 +593,6 @@ void CViewportTitleDlg::UpdateCustomPresets(const QString& text, QStringList& cu
|
||||
}
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::OnChangedDisplayInfo([[maybe_unused]] ICVar* pDisplayInfo, [[maybe_unused]] QAbstractButton* pDisplayInfoButton)
|
||||
{
|
||||
}
|
||||
|
||||
bool CViewportTitleDlg::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
bool consumeEvent = false;
|
||||
@@ -609,4 +654,5 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
#include "ViewportTitleDlg.moc"
|
||||
#include <moc_ViewportTitleDlg.cpp>
|
||||
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
static void LoadCustomPresets(const QString& section, const QString& keyName, QStringList& outCustompresets);
|
||||
static void SaveCustomPresets(const QString& section, const QString& keyName, const QStringList& custompresets);
|
||||
static void UpdateCustomPresets(const QString& text, QStringList& custompresets);
|
||||
static void OnChangedDisplayInfo(ICVar* pDisplayInfo, QAbstractButton* pDisplayInfoButton);
|
||||
|
||||
bool eventFilter(QObject* object, QEvent* event) override;
|
||||
|
||||
@@ -77,6 +76,7 @@ protected:
|
||||
void OnMaximize();
|
||||
void OnToggleHelpers();
|
||||
void OnToggleDisplayInfo();
|
||||
void UpdateDisplayInfo();
|
||||
|
||||
QString m_title;
|
||||
|
||||
@@ -87,8 +87,6 @@ protected:
|
||||
QStringList m_customFOVPresets;
|
||||
QStringList m_customAspectRatioPresets;
|
||||
|
||||
uint64 m_displayInfoCallbackIndex;
|
||||
|
||||
void OnMenuFOVCustom();
|
||||
|
||||
void CreateFOVMenu();
|
||||
|
||||
@@ -760,10 +760,13 @@ set(FILES
|
||||
Util/PakFile.h
|
||||
Util/PredefinedAspectRatios.cpp
|
||||
Util/PredefinedAspectRatios.h
|
||||
Util/StringHelpers.cpp
|
||||
Util/StringHelpers.h
|
||||
Util/StringNoCasePredicate.h
|
||||
Util/TRefCountBase.h
|
||||
Util/Triangulate.cpp
|
||||
Util/Triangulate.h
|
||||
Util/Util.h
|
||||
Util/XmlArchive.cpp
|
||||
Util/XmlArchive.h
|
||||
Util/XmlHistoryManager.cpp
|
||||
|
||||
@@ -609,14 +609,6 @@ void CComponentEntityObject::InvalidateTM(int nWhyFlags)
|
||||
{
|
||||
Matrix34 worldTransform = GetWorldTM();
|
||||
EBUS_EVENT_ID(m_entityId, AZ::TransformBus, SetWorldTM, LYTransformToAZTransform(worldTransform));
|
||||
|
||||
// When transformed via the editor, make sure the entity is marked dirty for undo capture.
|
||||
EBUS_EVENT(AzToolsFramework::ToolsApplicationRequests::Bus, AddDirtyEntity, m_entityId);
|
||||
|
||||
if (CheckFlags(OBJFLAG_SELECTED))
|
||||
{
|
||||
EBUS_EVENT(AzToolsFramework::ToolsApplicationEvents::Bus, InvalidatePropertyDisplay, AzToolsFramework::Refresh_Values);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user