Merge branch 'development' into profiler_capture_api
Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
@@ -16,9 +16,12 @@
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
|
||||
struct ICVar;
|
||||
|
||||
class CVarMenu
|
||||
: public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
// CVar that can be toggled on and off
|
||||
struct CVarToggle
|
||||
|
||||
+87
-95
@@ -19,10 +19,9 @@ namespace Config
|
||||
|
||||
CConfigGroup::~CConfigGroup()
|
||||
{
|
||||
for (TConfigVariables::const_iterator it = m_vars.begin();
|
||||
it != m_vars.end(); ++it)
|
||||
for (IConfigVar* var : m_vars)
|
||||
{
|
||||
delete (*it);
|
||||
delete var;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,17 +30,15 @@ namespace Config
|
||||
m_vars.push_back(var);
|
||||
}
|
||||
|
||||
uint32 CConfigGroup::GetVarCount()
|
||||
AZ::u32 CConfigGroup::GetVarCount()
|
||||
{
|
||||
return static_cast<uint32>(m_vars.size());
|
||||
return aznumeric_cast<AZ::u32>(m_vars.size());
|
||||
}
|
||||
|
||||
IConfigVar* CConfigGroup::GetVar(const char* szName)
|
||||
{
|
||||
for (TConfigVariables::const_iterator it = m_vars.begin();
|
||||
it != m_vars.end(); ++it)
|
||||
for (IConfigVar* var : m_vars)
|
||||
{
|
||||
IConfigVar* var = (*it);
|
||||
if (0 == _stricmp(szName, var->GetName().c_str()))
|
||||
{
|
||||
return var;
|
||||
@@ -53,20 +50,19 @@ namespace Config
|
||||
|
||||
const IConfigVar* CConfigGroup::GetVar(const char* szName) const
|
||||
{
|
||||
for (TConfigVariables::const_iterator it = m_vars.begin();
|
||||
it != m_vars.end(); ++it)
|
||||
for (const IConfigVar* var : m_vars)
|
||||
{
|
||||
IConfigVar* var = (*it);
|
||||
if (0 == _stricmp(szName, var->GetName().c_str()))
|
||||
{
|
||||
return var;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IConfigVar* CConfigGroup::GetVar(uint index)
|
||||
IConfigVar* CConfigGroup::GetVar(AZ::u32 index)
|
||||
{
|
||||
if (index < m_vars.size())
|
||||
{
|
||||
@@ -76,7 +72,7 @@ namespace Config
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const IConfigVar* CConfigGroup::GetVar(uint index) const
|
||||
const IConfigVar* CConfigGroup::GetVar(AZ::u32 index) const
|
||||
{
|
||||
if (index < m_vars.size())
|
||||
{
|
||||
@@ -89,114 +85,110 @@ namespace Config
|
||||
void CConfigGroup::SaveToXML(XmlNodeRef node)
|
||||
{
|
||||
// save only values that don't have default values
|
||||
for (TConfigVariables::const_iterator it = m_vars.begin();
|
||||
it != m_vars.end(); ++it)
|
||||
for (const IConfigVar* var : m_vars)
|
||||
{
|
||||
IConfigVar* var = (*it);
|
||||
if (!var->IsFlagSet(IConfigVar::eFlag_DoNotSave))
|
||||
if (var->IsFlagSet(IConfigVar::eFlag_DoNotSave) || var->IsDefault())
|
||||
{
|
||||
if (!var->IsDefault())
|
||||
{
|
||||
const char* szName = var->GetName().c_str();
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (var->GetType())
|
||||
{
|
||||
case IConfigVar::eType_BOOL:
|
||||
{
|
||||
bool currentValue = false;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue);
|
||||
break;
|
||||
}
|
||||
const char* szName = var->GetName().c_str();
|
||||
|
||||
case IConfigVar::eType_INT:
|
||||
{
|
||||
int currentValue = 0;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue);
|
||||
break;
|
||||
}
|
||||
switch (var->GetType())
|
||||
{
|
||||
case IConfigVar::eType_BOOL:
|
||||
{
|
||||
bool currentValue = false;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue);
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_FLOAT:
|
||||
{
|
||||
float currentValue = 0;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue);
|
||||
break;
|
||||
}
|
||||
case IConfigVar::eType_INT:
|
||||
{
|
||||
int currentValue = 0;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue);
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_STRING:
|
||||
{
|
||||
AZStd::string currentValue;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
case IConfigVar::eType_FLOAT:
|
||||
{
|
||||
float currentValue = 0;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue);
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_STRING:
|
||||
{
|
||||
AZStd::string currentValue;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CConfigGroup::LoadFromXML(XmlNodeRef node)
|
||||
{
|
||||
// save only values that don't have default values
|
||||
for (TConfigVariables::const_iterator it = m_vars.begin();
|
||||
it != m_vars.end(); ++it)
|
||||
// load values that are save-able
|
||||
for (IConfigVar* var : m_vars)
|
||||
{
|
||||
IConfigVar* var = (*it);
|
||||
if (!var->IsFlagSet(IConfigVar::eFlag_DoNotSave))
|
||||
if (var->IsFlagSet(IConfigVar::eFlag_DoNotSave))
|
||||
{
|
||||
const char* szName = var->GetName().c_str();
|
||||
continue;
|
||||
}
|
||||
const char* szName = var->GetName().c_str();
|
||||
|
||||
switch (var->GetType())
|
||||
switch (var->GetType())
|
||||
{
|
||||
case IConfigVar::eType_BOOL:
|
||||
{
|
||||
bool currentValue = false;
|
||||
var->GetDefault(¤tValue);
|
||||
if (node->getAttr(szName, currentValue))
|
||||
{
|
||||
case IConfigVar::eType_BOOL:
|
||||
{
|
||||
bool currentValue = false;
|
||||
var->GetDefault(¤tValue);
|
||||
if (node->getAttr(szName, currentValue))
|
||||
{
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_INT:
|
||||
case IConfigVar::eType_INT:
|
||||
{
|
||||
int currentValue = 0;
|
||||
var->GetDefault(¤tValue);
|
||||
if (node->getAttr(szName, currentValue))
|
||||
{
|
||||
int currentValue = 0;
|
||||
var->GetDefault(¤tValue);
|
||||
if (node->getAttr(szName, currentValue))
|
||||
{
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_FLOAT:
|
||||
case IConfigVar::eType_FLOAT:
|
||||
{
|
||||
float currentValue = 0;
|
||||
var->GetDefault(¤tValue);
|
||||
if (node->getAttr(szName, currentValue))
|
||||
{
|
||||
float currentValue = 0;
|
||||
var->GetDefault(¤tValue);
|
||||
if (node->getAttr(szName, currentValue))
|
||||
{
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfigVar::eType_STRING:
|
||||
case IConfigVar::eType_STRING:
|
||||
{
|
||||
AZStd::string currentValue;
|
||||
var->GetDefault(¤tValue);
|
||||
QString readValue(currentValue.c_str());
|
||||
if (node->getAttr(szName, readValue))
|
||||
{
|
||||
AZStd::string currentValue;
|
||||
var->GetDefault(¤tValue);
|
||||
QString readValue(currentValue.c_str());
|
||||
if (node->getAttr(szName, readValue))
|
||||
{
|
||||
currentValue = readValue.toUtf8().data();
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
currentValue = readValue.toUtf8().data();
|
||||
var->Set(¤tValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
-69
@@ -8,8 +8,12 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
#ifndef CRYINCLUDE_EDITOR_CONFIGGROUP_H
|
||||
#define CRYINCLUDE_EDITOR_CONFIGGROUP_H
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
struct ICVar;
|
||||
class XmlNodeRef;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
@@ -32,7 +36,7 @@ namespace Config
|
||||
eFlag_DoNotSave = 1 << 2,
|
||||
};
|
||||
|
||||
IConfigVar(const char* szName, const char* szDescription, EType varType, uint8 flags)
|
||||
IConfigVar(const char* szName, const char* szDescription, EType varType, AZ::u8 flags)
|
||||
: m_name(szName)
|
||||
, m_description(szDescription)
|
||||
, m_type(varType)
|
||||
@@ -42,22 +46,22 @@ namespace Config
|
||||
|
||||
virtual ~IConfigVar() = default;
|
||||
|
||||
ILINE EType GetType() const
|
||||
AZ_FORCE_INLINE EType GetType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
ILINE const AZStd::string& GetName() const
|
||||
AZ_FORCE_INLINE const AZStd::string& GetName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
ILINE const AZStd::string& GetDescription() const
|
||||
AZ_FORCE_INLINE const AZStd::string& GetDescription() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
ILINE bool IsFlagSet(EFlags flag) const
|
||||
AZ_FORCE_INLINE bool IsFlagSet(EFlags flag) const
|
||||
{
|
||||
return 0 != (m_flags & flag);
|
||||
}
|
||||
@@ -68,73 +72,28 @@ namespace Config
|
||||
virtual void GetDefault(void* outPtr) const = 0;
|
||||
virtual void Reset() = 0;
|
||||
|
||||
static EType TranslateType(const bool&) { return eType_BOOL; }
|
||||
static EType TranslateType(const int&) { return eType_INT; }
|
||||
static EType TranslateType(const float&) { return eType_FLOAT; }
|
||||
static EType TranslateType(const AZStd::string&) { return eType_STRING; }
|
||||
static constexpr EType TranslateType(const bool&) { return eType_BOOL; }
|
||||
static constexpr EType TranslateType(const int&) { return eType_INT; }
|
||||
static constexpr EType TranslateType(const float&) { return eType_FLOAT; }
|
||||
static constexpr EType TranslateType(const AZStd::string&) { return eType_STRING; }
|
||||
|
||||
protected:
|
||||
EType m_type;
|
||||
uint8 m_flags;
|
||||
AZ::u8 m_flags;
|
||||
AZStd::string m_name;
|
||||
AZStd::string m_description;
|
||||
void* m_ptr;
|
||||
ICVar* m_pCVar;
|
||||
};
|
||||
|
||||
// Typed wrapper for config variable
|
||||
template<class T>
|
||||
class TConfigVar
|
||||
: public IConfigVar
|
||||
{
|
||||
private:
|
||||
T m_default;
|
||||
|
||||
public:
|
||||
TConfigVar(const char* szName, const char* szDescription, uint8 flags, T& ptr, const T& defaultValue)
|
||||
: IConfigVar(szName, szDescription, IConfigVar::TranslateType(ptr), flags)
|
||||
, m_default(defaultValue)
|
||||
{
|
||||
m_ptr = &ptr;
|
||||
|
||||
// reset to default value on initializations
|
||||
ptr = defaultValue;
|
||||
}
|
||||
|
||||
virtual void Get(void* outPtr) const
|
||||
{
|
||||
*reinterpret_cast<T*>(outPtr) = *reinterpret_cast<const T*>(m_ptr);
|
||||
}
|
||||
|
||||
virtual void Set(const void* ptr)
|
||||
{
|
||||
*reinterpret_cast<T*>(m_ptr) = *reinterpret_cast<const T*>(ptr);
|
||||
}
|
||||
|
||||
virtual void Reset()
|
||||
{
|
||||
*reinterpret_cast<T*>(m_ptr) = m_default;
|
||||
}
|
||||
|
||||
virtual void GetDefault(void* outPtr) const
|
||||
{
|
||||
*reinterpret_cast<T*>(outPtr) = m_default;
|
||||
}
|
||||
|
||||
virtual bool IsDefault() const
|
||||
{
|
||||
return *reinterpret_cast<const T*>(m_ptr) == m_default;
|
||||
}
|
||||
};
|
||||
|
||||
// Group of configuration variables with optional mapping to CVars
|
||||
class CConfigGroup
|
||||
{
|
||||
private:
|
||||
typedef std::vector<IConfigVar*> TConfigVariables;
|
||||
using TConfigVariables = AZStd::vector<IConfigVar*> ;
|
||||
TConfigVariables m_vars;
|
||||
|
||||
typedef std::vector<ICVar*> TConsoleVariables;
|
||||
using TConsoleVariables = AZStd::vector<ICVar*>;
|
||||
TConsoleVariables m_consoleVars;
|
||||
|
||||
public:
|
||||
@@ -142,20 +101,13 @@ namespace Config
|
||||
virtual ~CConfigGroup();
|
||||
|
||||
void AddVar(IConfigVar* var);
|
||||
uint32 GetVarCount();
|
||||
AZ::u32 GetVarCount();
|
||||
IConfigVar* GetVar(const char* szName);
|
||||
IConfigVar* GetVar(uint index);
|
||||
IConfigVar* GetVar(AZ::u32 index);
|
||||
const IConfigVar* GetVar(const char* szName) const;
|
||||
const IConfigVar* GetVar(uint index) const;
|
||||
const IConfigVar* GetVar(AZ::u32 index) const;
|
||||
|
||||
void SaveToXML(XmlNodeRef node);
|
||||
void LoadFromXML(XmlNodeRef node);
|
||||
|
||||
template<class T>
|
||||
void AddVar(const char* szName, const char* szDescription, T& var, const T& defaultValue, uint8 flags = 0)
|
||||
{
|
||||
AddVar(new TConfigVar<T>(szName, szDescription, flags, var, defaultValue));
|
||||
}
|
||||
};
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_CONFIGGROUP_H
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_UTILS_PROPERTYMISCCTRL_H
|
||||
#define CRYINCLUDE_EDITOR_UTILS_PROPERTYMISCCTRL_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
@@ -53,6 +51,7 @@ private:
|
||||
|
||||
class UserPopupWidgetHandler : public QObject, public AzToolsFramework::PropertyHandler < CReflectedVarUser, UserPropertyEditor>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(UserPopupWidgetHandler, AZ::SystemAllocator, 0);
|
||||
bool IsDefaultHandler() const override { return false; }
|
||||
@@ -67,6 +66,7 @@ public:
|
||||
|
||||
class FloatCurveHandler : public QObject, public AzToolsFramework::PropertyHandler < CReflectedVarSpline, CSplineCtrl>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(FloatCurveHandler, AZ::SystemAllocator, 0);
|
||||
bool IsDefaultHandler() const override { return false; }
|
||||
@@ -80,5 +80,3 @@ public:
|
||||
|
||||
void OnSplineChange(CSplineCtrl*);
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_UTILS_PROPERTYMISCCTRL_H
|
||||
|
||||
@@ -58,17 +58,9 @@ private:
|
||||
void OnClicked() override
|
||||
{
|
||||
QString tempValue("");
|
||||
QString ext("");
|
||||
if (m_path.isEmpty() == false)
|
||||
if (!m_path.isEmpty() && !Path::GetExt(m_path).isEmpty())
|
||||
{
|
||||
if (Path::GetExt(m_path) == "")
|
||||
{
|
||||
tempValue = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
tempValue = m_path;
|
||||
}
|
||||
tempValue = m_path;
|
||||
}
|
||||
|
||||
AssetSelectionModel selection;
|
||||
|
||||
@@ -99,6 +99,7 @@ class FileResourceSelectorWidgetHandler
|
||||
: QObject
|
||||
, public AzToolsFramework::PropertyHandler < CReflectedVarResource, FileResourceSelectorWidget >
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(FileResourceSelectorWidgetHandler, AZ::SystemAllocator, 0);
|
||||
|
||||
|
||||
@@ -446,41 +446,54 @@ void ReflectedVarUserAdapter::SetVariable(IVariable *pVariable)
|
||||
m_reflectedVar.reset(new CReflectedVarUser( pVariable->GetHumanName().toUtf8().data()));
|
||||
}
|
||||
|
||||
void ReflectedVarUserAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
|
||||
void ReflectedVarUserAdapter::SyncReflectedVarToIVar(IVariable* pVariable)
|
||||
{
|
||||
QString value;
|
||||
pVariable->Get(value);
|
||||
m_reflectedVar->m_value = value.toUtf8().data();
|
||||
|
||||
//extract the list of custom items from the IVariable user data
|
||||
IVariable::IGetCustomItems* pGetCustomItems = static_cast<IVariable::IGetCustomItems*> (pVariable->GetUserData().value<void *>());
|
||||
if (pGetCustomItems != nullptr)
|
||||
{
|
||||
std::vector<IVariable::IGetCustomItems::SItem> items;
|
||||
QString dlgTitle;
|
||||
// call the user supplied callback to fill-in items and get dialog title
|
||||
bool bShowIt = pGetCustomItems->GetItems(pVariable, items, dlgTitle);
|
||||
if (bShowIt) // if func didn't veto, show the dialog
|
||||
{
|
||||
m_reflectedVar->m_enableEdit = true;
|
||||
m_reflectedVar->m_useTree = pGetCustomItems->UseTree();
|
||||
m_reflectedVar->m_treeSeparator = pGetCustomItems->GetTreeSeparator();
|
||||
m_reflectedVar->m_dialogTitle = dlgTitle.toUtf8().data();
|
||||
m_reflectedVar->m_itemNames.resize(items.size());
|
||||
m_reflectedVar->m_itemDescriptions.resize(items.size());
|
||||
|
||||
QByteArray ba;
|
||||
int i = -1;
|
||||
std::generate(m_reflectedVar->m_itemNames.begin(), m_reflectedVar->m_itemNames.end(), [&items, &i, &ba]() { ++i; ba = items[i].name.toUtf8(); return ba.data(); });
|
||||
i = -1;
|
||||
std::generate(m_reflectedVar->m_itemDescriptions.begin(), m_reflectedVar->m_itemDescriptions.end(), [&items, &i, &ba]() { ++i; ba = items[i].desc.toUtf8(); return ba.data(); });
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
// extract the list of custom items from the IVariable user data
|
||||
IVariable::IGetCustomItems* pGetCustomItems = static_cast<IVariable::IGetCustomItems*>(pVariable->GetUserData().value<void*>());
|
||||
if (pGetCustomItems == nullptr)
|
||||
{
|
||||
m_reflectedVar->m_enableEdit = false;
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<IVariable::IGetCustomItems::SItem> items;
|
||||
QString dlgTitle;
|
||||
// call the user supplied callback to fill-in items and get dialog title
|
||||
bool bShowIt = pGetCustomItems->GetItems(pVariable, items, dlgTitle);
|
||||
if (!bShowIt) // if func vetoed it, don't show the dialog
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_reflectedVar->m_enableEdit = true;
|
||||
m_reflectedVar->m_useTree = pGetCustomItems->UseTree();
|
||||
m_reflectedVar->m_treeSeparator = pGetCustomItems->GetTreeSeparator();
|
||||
m_reflectedVar->m_dialogTitle = dlgTitle.toUtf8().data();
|
||||
m_reflectedVar->m_itemNames.resize(items.size());
|
||||
m_reflectedVar->m_itemDescriptions.resize(items.size());
|
||||
|
||||
QByteArray ba;
|
||||
int i = -1;
|
||||
AZStd::generate(
|
||||
m_reflectedVar->m_itemNames.begin(), m_reflectedVar->m_itemNames.end(),
|
||||
[&items, &i, &ba]()
|
||||
{
|
||||
++i;
|
||||
ba = items[i].name.toUtf8();
|
||||
return ba.data();
|
||||
});
|
||||
i = -1;
|
||||
AZStd::generate(
|
||||
m_reflectedVar->m_itemDescriptions.begin(), m_reflectedVar->m_itemDescriptions.end(),
|
||||
[&items, &i, &ba]()
|
||||
{
|
||||
++i;
|
||||
ba = items[i].desc.toUtf8();
|
||||
return ba.data();
|
||||
});
|
||||
}
|
||||
|
||||
void ReflectedVarUserAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
|
||||
|
||||
@@ -126,7 +126,6 @@ void TimelineWidget::DrawTicks(QPainter* painter)
|
||||
const QPen pOldPen = painter->pen();
|
||||
|
||||
const QPen ltgray(QColor(110, 110, 110));
|
||||
const QPen black(palette().color(QPalette::Normal, QPalette::Text));
|
||||
const QPen redpen(QColor(255, 0, 255));
|
||||
|
||||
// Draw time ticks every tick step seconds.
|
||||
@@ -598,7 +597,6 @@ void TimelineWidget::DrawSecondTicks(QPainter* painter)
|
||||
{
|
||||
const QPen ltgray(QColor(110, 110, 110));
|
||||
const QPen black(palette().color(QPalette::Normal, QPalette::Text));
|
||||
const QPen redpen(QColor(255, 0, 255));
|
||||
|
||||
for (int gx = m_grid.firstGridLine.x(); gx < m_grid.firstGridLine.x() + m_grid.numGridLines.x() + 1; gx++)
|
||||
{
|
||||
|
||||
@@ -4137,7 +4137,15 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[])
|
||||
AzQtComponents::Utilities::HandleDpiAwareness(AzQtComponents::Utilities::SystemDpiAware);
|
||||
Editor::EditorQtApplication* app = Editor::EditorQtApplication::newInstance(argc, argv);
|
||||
|
||||
if (app->arguments().contains("-autotest_mode"))
|
||||
QStringList qArgs = app->arguments();
|
||||
const bool is_automated_test = AZStd::any_of(qArgs.begin(), qArgs.end(),
|
||||
[](const QString& elem)
|
||||
{
|
||||
return elem.endsWith("autotest_mode") || elem.endsWith("runpythontest");
|
||||
}
|
||||
);
|
||||
|
||||
if (is_automated_test)
|
||||
{
|
||||
// Nullroute all stdout to null for automated tests, this way we make sure
|
||||
// that the test result output is not polluted with unrelated output data.
|
||||
|
||||
@@ -431,6 +431,7 @@ public:
|
||||
class CCrySingleDocTemplate
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
explicit CCrySingleDocTemplate(const QMetaObject* pDocClass)
|
||||
: QObject()
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
// Notice : Refer to ViewportTitleDlg.cpp for a use case.
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_CUSTOMRESOLUTIONDLG_H
|
||||
#define CRYINCLUDE_EDITOR_CUSTOMRESOLUTIONDLG_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
@@ -28,6 +26,7 @@ namespace Ui
|
||||
class CCustomResolutionDlg
|
||||
: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CCustomResolutionDlg(int w, int h, QWidget* pParent = nullptr);
|
||||
~CCustomResolutionDlg();
|
||||
@@ -42,5 +41,3 @@ protected:
|
||||
|
||||
QScopedPointer<Ui::CustomResolutionDlg> m_ui;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_CUSTOMRESOLUTIONDLG_H
|
||||
|
||||
@@ -211,9 +211,9 @@ public:
|
||||
|
||||
void Reset(QAction& action)
|
||||
{
|
||||
emit beginResetModel();
|
||||
beginResetModel();
|
||||
m_action = &action;
|
||||
emit endResetModel();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -266,7 +266,7 @@ QStringList CustomizeKeyboardDialog::BuildModels(QWidget* parent)
|
||||
categories.append(category);
|
||||
|
||||
QMenu* menu = menuAction->menu();
|
||||
m_menuActions[category] = GetAllActionsForMenu(menu, QStringLiteral(""));
|
||||
m_menuActions[category] = GetAllActionsForMenu(menu, QString());
|
||||
}
|
||||
|
||||
return categories;
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace SandboxEditor
|
||||
connect(m_ui->okButton, &QPushButton::clicked, this, &ErrorDialog::OnOK);
|
||||
connect(
|
||||
m_ui->messages,
|
||||
SIGNAL(itemSelectionChanged()),
|
||||
&QTreeWidget::itemSelectionChanged,
|
||||
this,
|
||||
SLOT(MessageSelectionChanged()));
|
||||
&ErrorDialog::MessageSelectionChanged);
|
||||
}
|
||||
|
||||
ErrorDialog::~ErrorDialog()
|
||||
|
||||
@@ -240,7 +240,7 @@ QJsonObject KeyboardCustomizationSettings::ExportGroup()
|
||||
|
||||
void KeyboardCustomizationSettings::ImportFromFile(QWidget* parent)
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(parent, QObject::tr("Export Keyboard Shortcuts"), QStringLiteral(""), QObject::tr("Keyboard Settings (*.keys)"));
|
||||
QString fileName = QFileDialog::getOpenFileName(parent, QObject::tr("Export Keyboard Shortcuts"), QString(), QObject::tr("Keyboard Settings (*.keys)"));
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -419,7 +419,7 @@ void MemoryStatusItem::updateStatus()
|
||||
GeneralStatusItem::GeneralStatusItem(QString name, MainStatusBar* parent)
|
||||
: StatusBarItem(name, parent)
|
||||
{
|
||||
connect(parent, SIGNAL(messageChanged(QString)), this, SLOT(update()));
|
||||
connect(parent, &MainStatusBar::messageChanged, this, [this](const QString&) { update(); });
|
||||
}
|
||||
|
||||
QString GeneralStatusItem::CurrentText() const
|
||||
|
||||
@@ -100,9 +100,10 @@ CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=nullptr*/)
|
||||
m_level = "";
|
||||
// First of all, keyboard focus is related to widget tab order, and the default tab order is based on the order in which
|
||||
// widgets are constructed. Therefore, creating more widgets changes the keyboard focus. That is why setFocus() is called last.
|
||||
// Secondly, using singleShot() allows setFocus() slot of the QLineEdit instance to be invoked right after the event system
|
||||
// is ready to do so. Therefore, it is better to use singleShot() than directly call setFocus().
|
||||
QTimer::singleShot(0, ui->LEVEL, SLOT(OnStartup()));
|
||||
// in OnStartup()
|
||||
// Secondly, using singleShot() allows OnStartup() slot of the QLineEdit instance to be invoked right after the event system
|
||||
// is ready to do so. Therefore, it is better to use singleShot() than directly call OnStartup().
|
||||
QTimer::singleShot(0, this, &CNewLevelDialog::OnStartup);
|
||||
|
||||
ReloadLevelFolder();
|
||||
}
|
||||
|
||||
@@ -168,6 +168,11 @@ namespace AZ
|
||||
|
||||
//! Rotation modifiers
|
||||
//! @{
|
||||
//! Set the world rotation matrix using the composition of rotations around
|
||||
//! the principle axes in the order of z-axis first and y-axis and then x-axis.
|
||||
//! @param eulerRadianAngles A Vector3 denoting radian angles of the rotations around each principle axis.
|
||||
virtual void SetWorldRotation([[maybe_unused]] const AZ::Vector3& eulerAnglesRadian) {}
|
||||
|
||||
//! Sets the entity's rotation in the world in quaternion notation.
|
||||
//! The origin of the axes is the entity's position in world space.
|
||||
//! @param quaternion A quaternion that represents the rotation to use for the entity.
|
||||
|
||||
@@ -323,6 +323,13 @@ namespace AzFramework
|
||||
return localZ;
|
||||
}
|
||||
|
||||
void TransformComponent::SetWorldRotation(const AZ::Vector3& eulerAnglesRadian)
|
||||
{
|
||||
AZ::Transform newWorldTransform = m_worldTM;
|
||||
newWorldTransform.SetRotation(AZ::Quaternion::CreateFromEulerAnglesRadians(eulerAnglesRadian));
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::SetWorldRotationQuaternion(const AZ::Quaternion& quaternion)
|
||||
{
|
||||
AZ::Transform newWorldTransform = m_worldTM;
|
||||
|
||||
@@ -108,6 +108,7 @@ namespace AzFramework
|
||||
float GetLocalZ() override;
|
||||
|
||||
// Rotation modifiers
|
||||
void SetWorldRotation(const AZ::Vector3& eulerAnglesRadian) override;
|
||||
void SetWorldRotationQuaternion(const AZ::Quaternion& quaternion) override;
|
||||
|
||||
AZ::Vector3 GetWorldRotation() override;
|
||||
|
||||
+67
-1
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
namespace AzPhysics
|
||||
{
|
||||
@@ -28,6 +29,71 @@ namespace AzPhysics
|
||||
->Field("ChildLocalPosition", &JointConfiguration::m_childLocalPosition)
|
||||
->Field("StartSimulationEnabled", &JointConfiguration::m_startSimulationEnabled)
|
||||
;
|
||||
|
||||
if (auto* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<JointConfiguration>("Joint Configuration", "Joint configuration.")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &JointConfiguration::m_parentLocalRotation,
|
||||
"Parent local rotation", "Parent joint frame relative to parent body.")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, &JointConfiguration::GetParentLocalRotationVisibility)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &JointConfiguration::m_parentLocalPosition,
|
||||
"Parent local position", "Joint position relative to parent body.")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, &JointConfiguration::GetParentLocalPositionVisibility)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &JointConfiguration::m_childLocalRotation,
|
||||
"Child local rotation", "Child joint frame relative to child body.")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, &JointConfiguration::GetChildLocalRotationVisibility)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &JointConfiguration::m_childLocalPosition,
|
||||
"Child local position", "Joint position relative to child body.")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, &JointConfiguration::GetChildLocalPositionVisibility)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &JointConfiguration::m_startSimulationEnabled,
|
||||
"Start simulation enabled", "When active, the joint will be enabled when the simulation begins.")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, &JointConfiguration::GetStartSimulationEnabledVisibility)
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Crc32 JointConfiguration::GetPropertyVisibility(JointConfiguration::PropertyVisibility property) const
|
||||
{
|
||||
return (m_propertyVisibilityFlags & property) != 0 ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide;
|
||||
}
|
||||
|
||||
void JointConfiguration::SetPropertyVisibility(JointConfiguration::PropertyVisibility property, bool isVisible)
|
||||
{
|
||||
if (isVisible)
|
||||
{
|
||||
m_propertyVisibilityFlags |= property;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_propertyVisibilityFlags &= ~property;
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Crc32 JointConfiguration::GetParentLocalRotationVisibility() const
|
||||
{
|
||||
return GetPropertyVisibility(JointConfiguration::PropertyVisibility::ParentLocalRotation);
|
||||
}
|
||||
|
||||
AZ::Crc32 JointConfiguration::GetParentLocalPositionVisibility() const
|
||||
{
|
||||
return GetPropertyVisibility(JointConfiguration::PropertyVisibility::ParentLocalPosition);
|
||||
}
|
||||
|
||||
AZ::Crc32 JointConfiguration::GetChildLocalRotationVisibility() const
|
||||
{
|
||||
return GetPropertyVisibility(JointConfiguration::PropertyVisibility::ChildLocalRotation);
|
||||
}
|
||||
|
||||
AZ::Crc32 JointConfiguration::GetChildLocalPositionVisibility() const
|
||||
{
|
||||
return GetPropertyVisibility(JointConfiguration::PropertyVisibility::ChildLocalPosition);
|
||||
}
|
||||
|
||||
AZ::Crc32 JointConfiguration::GetStartSimulationEnabledVisibility() const
|
||||
{
|
||||
return GetPropertyVisibility(JointConfiguration::PropertyVisibility::StartSimulationEnabled);
|
||||
}
|
||||
} // namespace AzPhysics
|
||||
|
||||
@@ -31,6 +31,25 @@ namespace AzPhysics
|
||||
JointConfiguration() = default;
|
||||
virtual ~JointConfiguration() = default;
|
||||
|
||||
// Visibility helpers for use in the Editor when reflected.
|
||||
enum PropertyVisibility : AZ::u8
|
||||
{
|
||||
ParentLocalRotation = 1 << 0, //!< Whether the parent local rotation is visible.
|
||||
ParentLocalPosition = 1 << 1, //!< Whether the parent local position is visible.
|
||||
ChildLocalRotation = 1 << 2, //!< Whether the child local rotation is visible.
|
||||
ChildLocalPosition = 1 << 3, //!< Whether the child local position is visible.
|
||||
StartSimulationEnabled = 1 << 4 //!< Whether the start simulation enabled setting is visible.
|
||||
};
|
||||
|
||||
AZ::Crc32 GetPropertyVisibility(PropertyVisibility property) const;
|
||||
void SetPropertyVisibility(PropertyVisibility property, bool isVisible);
|
||||
|
||||
AZ::Crc32 GetParentLocalRotationVisibility() const;
|
||||
AZ::Crc32 GetParentLocalPositionVisibility() const;
|
||||
AZ::Crc32 GetChildLocalRotationVisibility() const;
|
||||
AZ::Crc32 GetChildLocalPositionVisibility() const;
|
||||
AZ::Crc32 GetStartSimulationEnabledVisibility() const;
|
||||
|
||||
// Entity/object association.
|
||||
void* m_customUserData = nullptr;
|
||||
|
||||
@@ -40,8 +59,11 @@ namespace AzPhysics
|
||||
AZ::Quaternion m_childLocalRotation = AZ::Quaternion::CreateIdentity(); ///< Child joint frame relative to child body.
|
||||
AZ::Vector3 m_childLocalPosition = AZ::Vector3::CreateZero(); ///< Joint position relative to child body.
|
||||
bool m_startSimulationEnabled = true;
|
||||
|
||||
|
||||
// For debugging/tracking purposes only.
|
||||
AZStd::string m_debugName;
|
||||
|
||||
// Default all visibility settings to invisible, since most joint configurations don't need to display these.
|
||||
AZ::u8 m_propertyVisibilityFlags = 0;
|
||||
};
|
||||
}
|
||||
|
||||
+11
-3
@@ -1387,7 +1387,10 @@ namespace AzToolsFramework
|
||||
QDataStream stream(&pixmapBytes, QIODevice::ReadOnly);
|
||||
QPixmap pixmap;
|
||||
stream >> pixmap;
|
||||
GUI->SetBrowseButtonIcon(pixmap);
|
||||
if (!pixmap.isNull())
|
||||
{
|
||||
GUI->SetBrowseButtonIcon(pixmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1417,6 +1420,8 @@ namespace AzToolsFramework
|
||||
}
|
||||
else if (attrib == AZ_CRC_CE("ThumbnailIcon"))
|
||||
{
|
||||
GUI->SetCustomThumbnailEnabled(false);
|
||||
|
||||
AZStd::string iconPath;
|
||||
if (attrValue->Read<AZStd::string>(iconPath) && !iconPath.empty())
|
||||
{
|
||||
@@ -1434,8 +1439,11 @@ namespace AzToolsFramework
|
||||
QDataStream stream(&pixmapBytes, QIODevice::ReadOnly);
|
||||
QPixmap pixmap;
|
||||
stream >> pixmap;
|
||||
GUI->SetCustomThumbnailEnabled(true);
|
||||
GUI->SetCustomThumbnailPixmap(pixmap);
|
||||
if (!pixmap.isNull())
|
||||
{
|
||||
GUI->SetCustomThumbnailEnabled(true);
|
||||
GUI->SetCustomThumbnailPixmap(pixmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-10
@@ -67,16 +67,9 @@ namespace AzToolsFramework
|
||||
|
||||
void ThumbnailPropertyCtrl::SetThumbnailKey(Thumbnailer::SharedThumbnailKey key, const char* contextName)
|
||||
{
|
||||
if (m_customThumbnailEnabled)
|
||||
{
|
||||
ClearThumbnail();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_key = key;
|
||||
m_thumbnail->SetThumbnailKey(m_key, contextName);
|
||||
m_thumbnailEnlarged->SetThumbnailKey(m_key, contextName);
|
||||
}
|
||||
m_key = key;
|
||||
m_thumbnail->SetThumbnailKey(m_key, contextName);
|
||||
m_thumbnailEnlarged->SetThumbnailKey(m_key, contextName);
|
||||
UpdateVisibility();
|
||||
}
|
||||
|
||||
|
||||
@@ -301,6 +301,7 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
HighlightBorderSize + ViewportUiOverlayMargin, HighlightBorderSize + ViewportUiOverlayMargin);
|
||||
m_componentModeBorderText.setVisible(true);
|
||||
m_componentModeBorderText.setText(borderTitle.c_str());
|
||||
UpdateUiOverlayGeometry();
|
||||
}
|
||||
|
||||
void ViewportUiDisplay::RemoveViewportBorder()
|
||||
|
||||
@@ -115,17 +115,20 @@ CViewSystem::CViewSystem(ISystem* pSystem)
|
||||
, m_useDeferredViewSystemUpdate(false)
|
||||
, m_bControlsAudioListeners(true)
|
||||
{
|
||||
#if !defined(_RELEASE) && !defined(DEDICATED_SERVER)
|
||||
if (!s_debugCamera)
|
||||
#if !defined(_RELEASE)
|
||||
if (!gEnv->IsDedicated())
|
||||
{
|
||||
s_debugCamera = new DebugCamera;
|
||||
}
|
||||
if (!s_debugCamera)
|
||||
{
|
||||
s_debugCamera = new DebugCamera;
|
||||
}
|
||||
|
||||
REGISTER_COMMAND("debugCameraToggle", ToggleDebugCamera, VF_DEV_ONLY, "Toggle the debug camera.\n");
|
||||
REGISTER_COMMAND("debugCameraInvertY", ToggleDebugCameraInvertY, VF_DEV_ONLY, "Toggle debug camera Y-axis inversion.\n");
|
||||
REGISTER_COMMAND("debugCameraMove", DebugCameraMove, VF_DEV_ONLY, "Move the debug camera the specified distance (x y z).\n");
|
||||
gEnv->pConsole->CreateKeyBind("ctrl_keyboard_key_punctuation_backslash", "debugCameraToggle");
|
||||
gEnv->pConsole->CreateKeyBind("alt_keyboard_key_punctuation_backslash", "debugCameraInvertY");
|
||||
REGISTER_COMMAND("debugCameraToggle", ToggleDebugCamera, VF_DEV_ONLY, "Toggle the debug camera.\n");
|
||||
REGISTER_COMMAND("debugCameraInvertY", ToggleDebugCameraInvertY, VF_DEV_ONLY, "Toggle debug camera Y-axis inversion.\n");
|
||||
REGISTER_COMMAND("debugCameraMove", DebugCameraMove, VF_DEV_ONLY, "Move the debug camera the specified distance (x y z).\n");
|
||||
gEnv->pConsole->CreateKeyBind("ctrl_keyboard_key_punctuation_backslash", "debugCameraToggle");
|
||||
gEnv->pConsole->CreateKeyBind("alt_keyboard_key_punctuation_backslash", "debugCameraInvertY");
|
||||
}
|
||||
#endif
|
||||
|
||||
REGISTER_CVAR2("cl_camera_noise", &m_fCameraNoise, -1, 0,
|
||||
@@ -167,6 +170,21 @@ CViewSystem::~CViewSystem()
|
||||
{
|
||||
m_pSystem->GetILevelSystem()->RemoveListener(this);
|
||||
}
|
||||
|
||||
#if !defined(_RELEASE)
|
||||
if (!gEnv->IsDedicated())
|
||||
{
|
||||
UNREGISTER_COMMAND("debugCameraToggle");
|
||||
UNREGISTER_COMMAND("debugCameraInvertY");
|
||||
UNREGISTER_COMMAND("debugCameraMove");
|
||||
|
||||
if (s_debugCamera)
|
||||
{
|
||||
delete s_debugCamera;
|
||||
s_debugCamera = nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
@@ -47,6 +47,10 @@ ly_add_target(
|
||||
AZ::AssetBundlerBatch.Static
|
||||
)
|
||||
|
||||
# Adds a specialized .setreg to identify gems enabled in the active project.
|
||||
# This associates the AssetBundlerBatch target with the .Builders gem variants.
|
||||
ly_set_gem_variant_to_load(TARGETS AssetBundlerBatch VARIANTS Builders)
|
||||
|
||||
# AssetBundler - Qt GUI Application
|
||||
ly_add_target(
|
||||
NAME AssetBundler ${PAL_TRAIT_BUILD_ASSETBUNDLER_APPLICATION_TYPE}
|
||||
@@ -73,6 +77,10 @@ ly_add_target(
|
||||
${additional_dependencies}
|
||||
)
|
||||
|
||||
# Adds a specialized .setreg to identify gems enabled in the active project.
|
||||
# This associates the AssetBundler target with the .Builders gem variants.
|
||||
ly_set_gem_variant_to_load(TARGETS AssetBundler VARIANTS Builders)
|
||||
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
|
||||
ly_add_target(
|
||||
|
||||
@@ -54,7 +54,12 @@ namespace AssetBundler
|
||||
bool ApplicationManager::Init()
|
||||
{
|
||||
AZ::Debug::TraceMessageBus::Handler::BusConnect();
|
||||
Start(AzFramework::Application::Descriptor());
|
||||
|
||||
ComponentApplication::StartupParameters startupParameters;
|
||||
// The AssetBundler does not need to load gems
|
||||
startupParameters.m_loadDynamicModules = false;
|
||||
Start(AzFramework::Application::Descriptor(), startupParameters);
|
||||
|
||||
AZ::SerializeContext* context;
|
||||
EBUS_EVENT_RESULT(context, AZ::ComponentApplicationBus, GetSerializeContext);
|
||||
AZ_Assert(context, "No serialize context");
|
||||
|
||||
@@ -71,7 +71,11 @@ namespace AssetBundler
|
||||
|
||||
|
||||
m_data->m_applicationManager.reset(aznew MockApplicationManagerTest(0, 0));
|
||||
m_data->m_applicationManager->Start(AzFramework::Application::Descriptor());
|
||||
|
||||
AZ::ComponentApplication::StartupParameters startupParameters;
|
||||
// The AssetBundler does not need to load gems
|
||||
startupParameters.m_loadDynamicModules = false;
|
||||
m_data->m_applicationManager->Start(AzFramework::Application::Descriptor(), startupParameters);
|
||||
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
|
||||
@@ -4447,7 +4447,9 @@ AssetBuilderSDK::AssetBuilderDesc MockBuilderInfoHandler::CreateBuilderDesc(cons
|
||||
|
||||
void FingerprintTest::SetUp()
|
||||
{
|
||||
AZ_Printf("FingerprintTest", "SetUp start");
|
||||
AssetProcessorManagerTest::SetUp();
|
||||
AZ_Printf("FingerprintTest", "SetUp self");
|
||||
|
||||
// We don't want the mock application manager to provide builder descriptors, mockBuilderInfoHandler will provide our own
|
||||
m_mockApplicationManager->BusDisconnect();
|
||||
@@ -4466,18 +4468,23 @@ void FingerprintTest::SetUp()
|
||||
});
|
||||
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(m_absolutePath, ""));
|
||||
AZ_Printf("FingerprintTest", "SetUp end");
|
||||
}
|
||||
|
||||
void FingerprintTest::TearDown()
|
||||
{
|
||||
AZ_Printf("FingerprintTest", "TearDown start");
|
||||
m_jobResults = AZStd::vector<AssetProcessor::JobDetails>{};
|
||||
m_mockBuilderInfoHandler = {};
|
||||
|
||||
AZ_Printf("FingerprintTest", "TearDown parent");
|
||||
AssetProcessorManagerTest::TearDown();
|
||||
AZ_Printf("FingerprintTest", "TearDown end");
|
||||
}
|
||||
|
||||
void FingerprintTest::RunFingerprintTest(QString builderFingerprint, QString jobFingerprint, bool expectedResult)
|
||||
{
|
||||
AZ_Printf("FingerprintTest", "Fingerprint Test Start");
|
||||
m_mockBuilderInfoHandler.m_builderDesc.m_analysisFingerprint = builderFingerprint.toUtf8().data();
|
||||
m_mockBuilderInfoHandler.m_jobFingerprint = jobFingerprint;
|
||||
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, m_absolutePath));
|
||||
@@ -4486,6 +4493,7 @@ void FingerprintTest::RunFingerprintTest(QString builderFingerprint, QString job
|
||||
ASSERT_EQ(m_mockBuilderInfoHandler.m_createJobsCount, 1);
|
||||
ASSERT_EQ(m_jobResults.size(), 1);
|
||||
ASSERT_EQ(m_jobResults[0].m_autoFail, expectedResult);
|
||||
AZ_Printf("FingerprintTest", "Fingerprint Test End");
|
||||
}
|
||||
|
||||
TEST_F(FingerprintTest, FingerprintChecking_JobFingerprint_NoBuilderFingerprint)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#endif
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <AzCore/UnitTest/UnitTest.h>
|
||||
|
||||
//! These macros can be used for checking your unit tests,
|
||||
//! you can check AssetScannerUnitTest.cpp for usage
|
||||
@@ -155,6 +156,7 @@ namespace UnitTestUtils
|
||||
|
||||
bool OnPreWarning([[maybe_unused]] const char* window, [[maybe_unused]] const char* fileName, [[maybe_unused]] int line, [[maybe_unused]] const char* func, [[maybe_unused]] const char* message) override
|
||||
{
|
||||
UnitTest::ColoredPrintf(UnitTest::COLOR_YELLOW, message);
|
||||
++m_numWarningsAbsorbed;
|
||||
if (m_debugMessages)
|
||||
{
|
||||
@@ -165,6 +167,7 @@ namespace UnitTestUtils
|
||||
|
||||
bool OnPreAssert([[maybe_unused]] const char* fileName, [[maybe_unused]] int line, [[maybe_unused]] const char* func, [[maybe_unused]] const char* message) override
|
||||
{
|
||||
UnitTest::ColoredPrintf(UnitTest::COLOR_YELLOW, message);
|
||||
++m_numAssertsAbsorbed;
|
||||
if (m_debugMessages)
|
||||
{
|
||||
@@ -175,6 +178,7 @@ namespace UnitTestUtils
|
||||
|
||||
bool OnPreError([[maybe_unused]] const char* window, [[maybe_unused]] const char* fileName, [[maybe_unused]] int line, [[maybe_unused]] const char* func, [[maybe_unused]] const char* message) override
|
||||
{
|
||||
UnitTest::ColoredPrintf(UnitTest::COLOR_YELLOW, message);
|
||||
++m_numErrorsAbsorbed;
|
||||
if (m_debugMessages)
|
||||
{
|
||||
@@ -183,8 +187,9 @@ namespace UnitTestUtils
|
||||
return true; // I handled this, do not forward it
|
||||
}
|
||||
|
||||
bool OnPrintf(const char* /*window*/, const char* /*message*/) override
|
||||
bool OnPrintf(const char* /*window*/, const char* message) override
|
||||
{
|
||||
UnitTest::ColoredPrintf(UnitTest::COLOR_YELLOW, message);
|
||||
++m_numMessagesAbsorbed;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,7 @@ namespace O3DE::ProjectManager
|
||||
return AZ::Success(QStringList{ ProjectCMakeCommand,
|
||||
"-B", targetBuildPath,
|
||||
"-S", m_projectInfo.m_path,
|
||||
QString("-DLY_3RDPARTY_PATH=").append(thirdPartyPath),
|
||||
"-DLY_UNITY_BUILD=ON" } );
|
||||
QString("-DLY_3RDPARTY_PATH=").append(thirdPartyPath) } );
|
||||
}
|
||||
|
||||
AZ::Outcome<QStringList, QString> ProjectBuilderWorker::ConstructCmakeBuildCommandArguments() const
|
||||
|
||||
@@ -242,11 +242,15 @@ QTabBar::tab:focus {
|
||||
|
||||
/************** Project Settings **************/
|
||||
#projectSettings {
|
||||
margin-top:42px;
|
||||
margin-top:30px;
|
||||
}
|
||||
|
||||
#projectPreviewLabel {
|
||||
margin: 10px 0 5px 0;
|
||||
}
|
||||
|
||||
#projectTemplate {
|
||||
margin: 55px 0 0 50px;
|
||||
margin: 25px 0 0 50px;
|
||||
}
|
||||
#projectTemplateLabel {
|
||||
font-size:16px;
|
||||
|
||||
@@ -11,19 +11,28 @@
|
||||
#include <FormFolderBrowseEditWidget.h>
|
||||
#include <PythonBindingsInterface.h>
|
||||
#include <PathValidator.h>
|
||||
#include <AzQtComponents/Utilities/DesktopUtilities.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QScrollArea>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
EngineSettingsScreen::EngineSettingsScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
auto* layout = new QVBoxLayout();
|
||||
QScrollArea* scrollArea = new QScrollArea(this);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
|
||||
QWidget* scrollWidget = new QWidget(this);
|
||||
scrollArea->setWidget(scrollWidget);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(scrollWidget);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
scrollWidget->setLayout(layout);
|
||||
|
||||
setObjectName("engineSettingsScreen");
|
||||
|
||||
@@ -39,9 +48,18 @@ namespace O3DE::ProjectManager
|
||||
formTitleLabel->setObjectName("formTitleLabel");
|
||||
layout->addWidget(formTitleLabel);
|
||||
|
||||
m_engineVersion = new FormLineEditWidget(tr("Engine Version"), engineInfo.m_version, this);
|
||||
m_engineVersion->lineEdit()->setReadOnly(true);
|
||||
layout->addWidget(m_engineVersion);
|
||||
FormLineEditWidget* engineName = new FormLineEditWidget(tr("Engine Name"), engineInfo.m_name, this);
|
||||
engineName->lineEdit()->setReadOnly(true);
|
||||
layout->addWidget(engineName);
|
||||
|
||||
FormLineEditWidget* engineVersion = new FormLineEditWidget(tr("Engine Version"), engineInfo.m_version, this);
|
||||
engineVersion->lineEdit()->setReadOnly(true);
|
||||
layout->addWidget(engineVersion);
|
||||
|
||||
FormBrowseEditWidget* engineFolder = new FormBrowseEditWidget(tr("Engine Folder"), engineInfo.m_path, this);
|
||||
engineFolder->lineEdit()->setReadOnly(true);
|
||||
connect( engineFolder, &FormBrowseEditWidget::OnBrowse, [engineInfo]{ AzQtComponents::ShowFileOnDesktop(engineInfo.m_path); });
|
||||
layout->addWidget(engineFolder);
|
||||
|
||||
m_thirdParty = new FormFolderBrowseEditWidget(tr("3rd Party Software Folder"), engineInfo.m_thirdPartyPath, this);
|
||||
m_thirdParty->lineEdit()->setValidator(new PathValidator(PathValidator::PathMode::ExistingFolder, this));
|
||||
@@ -71,7 +89,11 @@ namespace O3DE::ProjectManager
|
||||
connect(m_defaultProjectTemplates->lineEdit(), &QLineEdit::textChanged, this, &EngineSettingsScreen::OnTextChanged);
|
||||
layout->addWidget(m_defaultProjectTemplates);
|
||||
|
||||
setLayout(layout);
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout();
|
||||
mainLayout->setAlignment(Qt::AlignTop);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->addWidget(scrollArea);
|
||||
setLayout(mainLayout);
|
||||
}
|
||||
|
||||
ProjectManagerScreen EngineSettingsScreen::GetScreenEnum()
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace O3DE::ProjectManager
|
||||
void OnTextChanged();
|
||||
|
||||
private:
|
||||
FormLineEditWidget* m_engineVersion;
|
||||
FormBrowseEditWidget* m_thirdParty;
|
||||
FormBrowseEditWidget* m_defaultProjects;
|
||||
FormBrowseEditWidget* m_defaultGems;
|
||||
|
||||
@@ -20,7 +20,8 @@ namespace O3DE::ProjectManager
|
||||
setObjectName("formBrowseEditWidget");
|
||||
|
||||
QPushButton* browseButton = new QPushButton(this);
|
||||
connect(browseButton, &QPushButton::pressed, this, &FormBrowseEditWidget::HandleBrowseButton);
|
||||
connect( browseButton, &QPushButton::pressed, [this]{ emit OnBrowse(); });
|
||||
connect( this, &FormBrowseEditWidget::OnBrowse, this, &FormBrowseEditWidget::HandleBrowseButton);
|
||||
m_frameLayout->addWidget(browseButton);
|
||||
}
|
||||
|
||||
@@ -34,7 +35,7 @@ namespace O3DE::ProjectManager
|
||||
int key = event->key();
|
||||
if (key == Qt::Key_Return || key == Qt::Key_Enter)
|
||||
{
|
||||
HandleBrowseButton();
|
||||
emit OnBrowse();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,13 @@ namespace O3DE::ProjectManager
|
||||
explicit FormBrowseEditWidget(const QString& labelText = "", QWidget* parent = nullptr);
|
||||
~FormBrowseEditWidget() = default;
|
||||
|
||||
signals:
|
||||
void OnBrowse();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
protected slots:
|
||||
virtual void HandleBrowseButton() = 0;
|
||||
virtual void HandleBrowseButton() {};
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace O3DE::ProjectManager
|
||||
|
||||
void GemCatalogScreen::ReinitForProject(const QString& projectPath)
|
||||
{
|
||||
m_gemModel->clear();
|
||||
m_gemModel->Clear();
|
||||
m_gemsToRegisterWithProject.clear();
|
||||
FillModel(projectPath);
|
||||
|
||||
@@ -145,10 +145,11 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
}
|
||||
|
||||
void GemCatalogScreen::OnGemStatusChanged(const QModelIndex& modelIndex, uint32_t numChangedDependencies)
|
||||
void GemCatalogScreen::OnGemStatusChanged(const QString& gemName, uint32_t numChangedDependencies)
|
||||
{
|
||||
if (m_notificationsEnabled)
|
||||
{
|
||||
QModelIndex modelIndex = m_gemModel->FindIndexByNameString(gemName);
|
||||
bool added = GemModel::IsAdded(modelIndex);
|
||||
bool dependency = GemModel::IsAddedDependency(modelIndex);
|
||||
|
||||
@@ -233,7 +234,11 @@ namespace O3DE::ProjectManager
|
||||
const QVector<GemInfo> allRepoGemInfos = allRepoGemInfosResult.GetValue();
|
||||
for (const GemInfo& gemInfo : allRepoGemInfos)
|
||||
{
|
||||
m_gemModel->AddGem(gemInfo);
|
||||
// do not add gems that have already been downloaded
|
||||
if (!m_gemModel->FindIndexByNameString(gemInfo.m_name).isValid())
|
||||
{
|
||||
m_gemModel->AddGem(gemInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -257,7 +262,8 @@ namespace O3DE::ProjectManager
|
||||
GemModel::SetWasPreviouslyAdded(*m_gemModel, modelIndex, true);
|
||||
GemModel::SetIsAdded(*m_gemModel, modelIndex, true);
|
||||
}
|
||||
else
|
||||
// ${Name} is a special name used in templates and is not really an error
|
||||
else if (enabledGemName != "${Name}")
|
||||
{
|
||||
AZ_Warning("ProjectManager::GemCatalog", false,
|
||||
"Cannot find entry for gem with name '%s'. The CMake target name probably does not match the specified name in the gem.json.",
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace O3DE::ProjectManager
|
||||
DownloadController* GetDownloadController() const { return m_downloadController; }
|
||||
|
||||
public slots:
|
||||
void OnGemStatusChanged(const QModelIndex& modelIndex, uint32_t numChangedDependencies);
|
||||
void OnGemStatusChanged(const QString& gemName, uint32_t numChangedDependencies);
|
||||
void OnAddGemClicked();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -27,6 +27,14 @@ namespace O3DE::ProjectManager
|
||||
|
||||
void GemModel::AddGem(const GemInfo& gemInfo)
|
||||
{
|
||||
if (FindIndexByNameString(gemInfo.m_name).isValid())
|
||||
{
|
||||
// do not add gems with duplicate names
|
||||
// this can happen by mistake or when a gem repo has a gem with the same name as a local gem
|
||||
AZ_TracePrintf("GemModel", "Ignoring duplicate gem: %s", gemInfo.m_name.toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
QStandardItem* item = new QStandardItem();
|
||||
|
||||
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
@@ -60,6 +68,7 @@ namespace O3DE::ProjectManager
|
||||
void GemModel::Clear()
|
||||
{
|
||||
clear();
|
||||
m_nameToIndexMap.clear();
|
||||
}
|
||||
|
||||
void GemModel::UpdateGemDependencies()
|
||||
@@ -276,9 +285,11 @@ namespace O3DE::ProjectManager
|
||||
|
||||
void GemModel::SetIsAdded(QAbstractItemModel& model, const QModelIndex& modelIndex, bool isAdded)
|
||||
{
|
||||
// get the gemName first, because the modelIndex data change after adding because of filters
|
||||
QString gemName = modelIndex.data(RoleName).toString();
|
||||
model.setData(modelIndex, isAdded, RoleIsAdded);
|
||||
|
||||
UpdateDependencies(model, modelIndex);
|
||||
UpdateDependencies(model, gemName, isAdded);
|
||||
}
|
||||
|
||||
bool GemModel::HasDependentGems(const QModelIndex& modelIndex) const
|
||||
@@ -294,15 +305,17 @@ namespace O3DE::ProjectManager
|
||||
return false;
|
||||
}
|
||||
|
||||
void GemModel::UpdateDependencies(QAbstractItemModel& model, const QModelIndex& modelIndex)
|
||||
void GemModel::UpdateDependencies(QAbstractItemModel& model, const QString& gemName, bool isAdded)
|
||||
{
|
||||
GemModel* gemModel = GetSourceModel(&model);
|
||||
AZ_Assert(gemModel, "Failed to obtain GemModel");
|
||||
|
||||
QModelIndex modelIndex = gemModel->FindIndexByNameString(gemName);
|
||||
|
||||
QVector<QModelIndex> dependencies = gemModel->GatherGemDependencies(modelIndex);
|
||||
uint32_t numChangedDependencies = 0;
|
||||
|
||||
if (IsAdded(modelIndex))
|
||||
if (isAdded)
|
||||
{
|
||||
for (const QModelIndex& dependency : dependencies)
|
||||
{
|
||||
@@ -324,7 +337,7 @@ namespace O3DE::ProjectManager
|
||||
bool hasDependentGems = gemModel->HasDependentGems(modelIndex);
|
||||
if (IsAddedDependency(modelIndex) != hasDependentGems)
|
||||
{
|
||||
SetIsAddedDependency(model, modelIndex, hasDependentGems);
|
||||
SetIsAddedDependency(*gemModel, modelIndex, hasDependentGems);
|
||||
}
|
||||
|
||||
for (const QModelIndex& dependency : dependencies)
|
||||
@@ -343,7 +356,7 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
}
|
||||
|
||||
gemModel->emit gemStatusChanged(modelIndex, numChangedDependencies);
|
||||
gemModel->emit gemStatusChanged(gemName, numChangedDependencies);
|
||||
}
|
||||
|
||||
void GemModel::SetIsAddedDependency(QAbstractItemModel& model, const QModelIndex& modelIndex, bool isAdded)
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace O3DE::ProjectManager
|
||||
static bool NeedsToBeAdded(const QModelIndex& modelIndex, bool includeDependencies = false);
|
||||
static bool NeedsToBeRemoved(const QModelIndex& modelIndex, bool includeDependencies = false);
|
||||
static bool HasRequirement(const QModelIndex& modelIndex);
|
||||
static void UpdateDependencies(QAbstractItemModel& model, const QModelIndex& modelIndex);
|
||||
static void UpdateDependencies(QAbstractItemModel& model, const QString& gemName, bool isAdded);
|
||||
static void SetDownloadStatus(QAbstractItemModel& model, const QModelIndex& modelIndex, GemInfo::DownloadStatus status);
|
||||
|
||||
bool DoGemsToBeAddedHaveRequirements() const;
|
||||
@@ -78,7 +78,7 @@ namespace O3DE::ProjectManager
|
||||
int TotalAddedGems(bool includeDependencies = false) const;
|
||||
|
||||
signals:
|
||||
void gemStatusChanged(const QModelIndex& modelIndex, uint32_t numChangedDependencies);
|
||||
void gemStatusChanged(const QString& gemName, uint32_t numChangedDependencies);
|
||||
|
||||
private:
|
||||
void FindGemDisplayNamesByNameStrings(QStringList& inOutGemNames);
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace O3DE::ProjectManager
|
||||
|
||||
QLabel* projectPreviewLabel = new QLabel(tr("Select an image (PNG). Minimum %1 x %2 pixels.")
|
||||
.arg(QString::number(ProjectPreviewImageWidth), QString::number(ProjectPreviewImageHeight)));
|
||||
projectPreviewLabel->setObjectName("projectPreviewLabel");
|
||||
previewExtrasLayout->addWidget(projectPreviewLabel);
|
||||
|
||||
m_projectPreviewImage = new QLabel(this);
|
||||
|
||||
Reference in New Issue
Block a user