Merge branch 'stabilization/2106' of https://github.com/o3de/o3de into cgalvan/FixLCGraphNotOpeningOnEdit

This commit is contained in:
Chris Galvan
2021-07-06 10:15:32 -05:00
634 changed files with 8648 additions and 14565 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice,
CAboutDialog > QLabel#link { text-decoration: underline; color: #94D2FF; }");
// Prepare background image
QImage backgroundImage(QStringLiteral(":/StartupLogoDialog/splashscreen_background_gradient.jpg"));
QImage backgroundImage(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg"));
m_backgroundImage = QPixmap::fromImage(backgroundImage.scaled(m_enforcedWidth, m_enforcedHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
// Draw the Open 3D Engine logo from svg
+11 -2
View File
@@ -22,7 +22,9 @@ AZ_PUSH_DISABLE_WARNING(4251 4355 4996, "-Wunknown-warning-option")
AZ_POP_DISABLE_WARNING
// AzCore
#include <AzCore/IO/Path/Path.h>
#include <AzCore/JSON/document.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
// AzFramework
#include <AzFramework/Terrain/TerrainDataRequestBus.h>
@@ -195,8 +197,15 @@ CEditorImpl::CEditorImpl()
m_pAssetBrowserRequestHandler = nullptr;
m_assetEditorRequestsHandler = nullptr;
AZ::IO::SystemFile::CreateDir("SessionStatus");
QFile::setPermissions(m_crashLogFileName, QFileDevice::ReadOther | QFileDevice::WriteOther);
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
{
if (AZ::IO::FixedMaxPath crashLogPath; settingsRegistry->Get(crashLogPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_ProjectUserPath))
{
crashLogPath /= m_crashLogFileName;
AZ::IO::SystemFile::CreateDir(crashLogPath.ParentPath().FixedMaxPathString().c_str());
QFile::setPermissions(crashLogPath.c_str(), QFileDevice::ReadOther | QFileDevice::WriteOther);
}
}
}
void CEditorImpl::Initialize()
@@ -1,21 +0,0 @@
<RCC>
<qresource prefix="/">
<file alias="sort_a_to_z.svg">Icons/sort_a_to_z.svg</file>
<file alias="sort_manually.svg">Icons/sort_manually.svg</file>
<file alias="sort_z_to_a.svg">Icons/sort_z_to_a.svg</file>
<file alias="visibility_default.svg">Icons/visibility_default.svg</file>
<file alias="visibility_default_hover.svg">Icons/visibility_default_hover.svg</file>
<file alias="visibility_default_transparent.svg">Icons/visibility_default_transparent.svg</file>
<file alias="visibility_on.svg">Icons/visibility_on.svg</file>
<file alias="visibility_on_hover.svg">Icons/visibility_on_hover.svg</file>
<file alias="visibility_on_transparent.svg">Icons/visibility_on_transparent.svg</file>
<file alias="lock_default.svg">Icons/lock_default.svg</file>
<file alias="lock_default_hover.svg">Icons/lock_default_hover.svg</file>
<file alias="lock_default_transparent.svg">Icons/lock_default_transparent.svg</file>
<file alias="lock_on.svg">Icons/lock_on.svg</file>
<file alias="lock_on_hover.svg">Icons/lock_on_hover.svg</file>
<file alias="lock_on_transparent.svg">Icons/lock_on_transparent.svg</file>
</qresource>
</RCC>
@@ -93,37 +93,37 @@ OutlinerCheckBox#VisibilityMixed::indicator:checked
OutlinerCheckBox#Visibility::indicator:checked
, OutlinerCheckBox#VisibilityMixed::indicator:checked
{
image: url(:/visibility_default.svg);
image: url(:/Outliner/visibility_default.svg);
}
OutlinerCheckBox#Visibility::indicator:unchecked
, OutlinerCheckBox#VisibilityMixed::indicator:unchecked
{
image: url(:/visibility_on.svg);
image: url(:/Outliner/visibility_on.svg);
}
OutlinerCheckBox#VisibilityLayerOverride::indicator:checked
{
image: url(:/visibility_default_transparent.svg);
image: url(:/Outliner/visibility_default_transparent.svg);
}
OutlinerCheckBox#VisibilityLayerOverride::indicator:unchecked
{
image: url(:/visibility_on_transparent.svg);
image: url(:/Outliner/visibility_on_transparent.svg);
}
OutlinerCheckBox#VisibilityHover::indicator:checked
, OutlinerCheckBox#VisibilityMixedHover::indicator:checked
, OutlinerCheckBox#VisibilityLayerOverrideHover::indicator:checked
{
image: url(:/visibility_default_hover.svg);
image: url(:/Outliner/visibility_default_hover.svg);
}
OutlinerCheckBox#VisibilityHover::indicator:unchecked
, OutlinerCheckBox#VisibilityMixedHover::indicator:unchecked
, OutlinerCheckBox#VisibilityLayerOverrideHover::indicator:unchecked
{
image: url(:/visibility_on_hover.svg);
image: url(:/Outliner/visibility_on_hover.svg);
}
@@ -132,35 +132,35 @@ OutlinerCheckBox#VisibilityHover::indicator:unchecked
OutlinerCheckBox#Lock::indicator:checked
, OutlinerCheckBox#LockMixed::indicator:checked
{
image: url(:/lock_on.svg);
image: url(:/Outliner/lock_on.svg);
}
OutlinerCheckBox#Lock::indicator:unchecked
, OutlinerCheckBox#LockMixed::indicator:unchecked
{
image: url(:/lock_default.svg);
image: url(:/Outliner/lock_default.svg);
}
OutlinerCheckBox#LockLayerOverride::indicator:checked
{
image: url(:/lock_on_transparent.svg);
image: url(:/Outliner/lock_on_transparent.svg);
}
OutlinerCheckBox#LockLayerOverride::indicator:unchecked
{
image: url(:/lock_default_transparent.svg);
image: url(:/Outliner/lock_default_transparent.svg);
}
OutlinerCheckBox#LockHover::indicator:checked
, OutlinerCheckBox#LockMixedHover::indicator:checked
, OutlinerCheckBox#LockLayerOverrideHover::indicator:checked
{
image: url(:/lock_on_hover.svg);
image: url(:/Outliner/lock_on_hover.svg);
}
OutlinerCheckBox#LockHover::indicator:unchecked
, OutlinerCheckBox#LockMixedHover::indicator:unchecked
, OutlinerCheckBox#LockLayerOverrideHover::indicator:unchecked
{
image: url(:/lock_default_hover.svg);
image: url(:/Outliner/lock_default_hover.svg);
}
@@ -16,15 +16,15 @@ namespace EntityOutliner
DisplayOptionsMenu::DisplayOptionsMenu(QWidget* parent)
: QMenu(parent)
{
auto sortManually = addAction(QIcon(QStringLiteral(":/sort_manually.svg")), tr("Sort: Manually"));
auto sortManually = addAction(QIcon(QStringLiteral(":/Outliner/sort_manually.svg")), tr("Sort: Manually"));
sortManually->setData(static_cast<int>(DisplaySortMode::Manually));
sortManually->setCheckable(true);
auto sortAtoZ = addAction(QIcon(QStringLiteral(":/sort_a_to_z.svg")), tr("Sort: A to Z"));
auto sortAtoZ = addAction(QIcon(QStringLiteral(":/Outliner/sort_a_to_z.svg")), tr("Sort: A to Z"));
sortAtoZ->setData(static_cast<int>(DisplaySortMode::AtoZ));
sortAtoZ->setCheckable(true);
auto sortZtoA = addAction(QIcon(QStringLiteral(":/sort_z_to_a.svg")), tr("Sort: Z to A"));
auto sortZtoA = addAction(QIcon(QStringLiteral(":/Outliner/sort_z_to_a.svg")), tr("Sort: Z to A"));
sortZtoA->setData(static_cast<int>(DisplaySortMode::ZtoA));
sortZtoA->setCheckable(true);
@@ -32,21 +32,31 @@ namespace AzQtComponents
{
}
bool OutlinerSearchTypeSelector::filterItemOut(int unfilteredDataIndex, bool itemMatchesFilter, bool categoryMatchesFilter)
bool OutlinerSearchTypeSelector::filterItemOut(const QModelIndex& sourceIndex, bool filteredByBase)
{
bool unfilteredIndexInvalid = (unfilteredDataIndex >= static_cast<int>(OutlinerSearchWidget::GlobalSearchCriteria::FirstRealFilter));
return SearchTypeSelector::filterItemOut(unfilteredDataIndex, itemMatchesFilter, categoryMatchesFilter) && unfilteredIndexInvalid;
auto* currItem = m_model->itemFromIndex(sourceIndex);
if (currItem != nullptr)
{
int unfilteredIndex = getUnfilteredDataIndex(currItem);
if (unfilteredIndex >= 0 && unfilteredIndex < aznumeric_cast<int>(OutlinerSearchWidget::GlobalSearchCriteria::FirstRealFilter))
{
// never filter out the categories before FirstRealFilter (unlocked/locked, visible/hidden, etc.)
return false;
}
}
// no special case, return the result of the base filter
return filteredByBase;
}
void OutlinerSearchTypeSelector::initItem(QStandardItem* item, const SearchTypeFilter& filter, int unfilteredDataIndex)
{
if (filter.displayName != "--------")
SearchTypeSelector::initItem(item, filter, unfilteredDataIndex);
if (filter.displayName == "--------")
{
item->setCheckable(true);
item->setCheckState(filter.enabled ? Qt::Checked : Qt::Unchecked);
item->setCheckable(false);
}
if (unfilteredDataIndex < static_cast<int>(OutlinerSearchWidget::GlobalSearchCriteria::FirstRealFilter))
if (unfilteredDataIndex >= 0 && unfilteredDataIndex < static_cast<int>(OutlinerSearchWidget::GlobalSearchCriteria::FirstRealFilter))
{
item->setIcon(OutlinerIcons::GetInstance().GetIcon(unfilteredDataIndex));
}
@@ -37,8 +37,8 @@ namespace AzQtComponents
OutlinerSearchTypeSelector(QWidget* parent = nullptr);
protected:
// can be used to override the logic when adding items in RepopulateDataModel
bool filterItemOut(int unfilteredDataIndex, bool itemMatchesFilter, bool categoryMatchesFilter) override;
// override the logic of accepting filter categories
bool filterItemOut(const QModelIndex& sourceIndex, bool filteredByBase) override;
void initItem(QStandardItem* item, const SearchTypeFilter& filter, int unfilteredDataIndex) override;
int GetNumFixedItems() override;
};
@@ -12,7 +12,6 @@ set(FILES
SandboxIntegration.h
SandboxIntegration.cpp
ComponentEntityEditorPlugin_precompiled.h
UI/ComponentEntityEditorOutlinerWindow.qrc
UI/QComponentEntityEditorMainWindow.h
UI/QComponentEntityEditorMainWindow.cpp
UI/QComponentLevelEntityEditorMainWindow.h
+2 -2
View File
@@ -36,11 +36,11 @@ CStartupLogoDialog::CStartupLogoDialog(QString versionText, QString richTextCopy
s_pLogoWindow = this;
m_backgroundImage = QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_gradient.jpg"));
m_backgroundImage = QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg"));
setFixedSize(QSize(600, 300));
// Prepare background image
QImage backgroundImage(QStringLiteral(":/StartupLogoDialog/splashscreen_background_gradient.jpg"));
QImage backgroundImage(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg"));
m_backgroundImage = QPixmap::fromImage(backgroundImage.scaled(m_enforcedWidth, m_enforcedHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
// Draw the Open 3D Engine logo from svg
+1 -1
View File
@@ -1,6 +1,6 @@
<RCC>
<qresource prefix="/StartupLogoDialog">
<file>o3de_logo.svg</file>
<file>splashscreen_background_gradient.jpg</file>
<file>splashscreen_background_developer_preview.jpg</file>
</qresource>
</RCC>
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:263e95489560dac6e5944ef3caba13e598f83ddead324b943ad7735ba015e1a9
size 70727
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1cf8339fb51f82a68d2ab475c0476960e75a79d96d239c5b7cd272fbe4990ffe
size 2770
@@ -75,6 +75,21 @@ WelcomeScreenDialog::WelcomeScreenDialog(QWidget* pParent)
{
ui->setupUi(this);
// Set the project preview image
QString projectPreviewPath = QDir(AZ::Utils::GetProjectPath().c_str()).filePath("preview.png");
QFileInfo projectPreviewPathInfo(projectPreviewPath);
if (!projectPreviewPathInfo.exists() || !projectPreviewPathInfo.isFile())
{
projectPreviewPath = ":/WelcomeScreenDialog/DefaultProjectImage.png";
}
ui->activeProjectIcon->setPixmap(
QPixmap(projectPreviewPath).scaled(
ui->activeProjectIcon->size(),
Qt::KeepAspectRatioByExpanding,
Qt::SmoothTransformation
)
);
ui->recentLevelTable->setColumnCount(3);
ui->recentLevelTable->setMouseTracking(true);
ui->recentLevelTable->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="WelcomeScreenDialog">
<file>DefaultActiveProject.png</file>
<file>DefaultProjectImage.png</file>
</qresource>
</RCC>
@@ -158,11 +158,8 @@
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="WelcomeScreenDialog.qrc">:/WelcomeScreenDialog/DefaultActiveProject.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignHCenter | Qt::AlignVCenter</set>
</property>
</widget>
</item>
-1
View File
@@ -229,7 +229,6 @@ set(FILES
res/warning16x16.ico
res/water.bmp
res/work_in_progress_icon.ico
res/LegacyLogo.bmp
res/MannFileManagerImageList.bmp
res/infobar/CameraCollision-default.svg
res/infobar/GotoLocation-default.svg
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:97f4004da6ec1bf07d522d6675f814e53e36923a45084ff5d7e4113e293d4fec
size 117656
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7105ec99477f124a8ac8d588f2dfc4ee7bb54f39386c8131b7703c86754c0cb8
size 248690
@@ -689,6 +689,81 @@ namespace AZ
return 1;
}
int Class__IndexAllowNil(lua_State* l)
{
LSV_BEGIN(l, 1);
// calling format __index(table,key)
lua_getmetatable(l, -2); // load the userdata metatable
int metaTableIndex = lua_gettop(l);
// Check if the key is string, if so we expect it to be a function or property name
// otherwise we allow users to provide custom index handlers
// Technically we can allow strings too, but it will clash with function/property names and it be hard to figure
// out what is going on from with in the system.
if (lua_type(l, -2) == LUA_TSTRING)
{
lua_pushvalue(l, -2); // duplicate the key
lua_rawget(l, -2); // load the value at this index
}
else
{
lua_pushliteral(l, "__AZ_Index");
lua_rawget(l, -2); // check if the user provided custom Index method in the class metatable
if (lua_isnil(l, -1)) // if not report an error
{
lua_rawgeti(l, -2, AZ_LUA_CLASS_METATABLE_NAME_INDEX); // load the class name for a better error
if (!lua_isstring(l, -1)) // if we failed it means we are the base metatable
{
lua_pop(l, 1);
lua_rawgeti(l, 1, AZ_LUA_CLASS_METATABLE_NAME_INDEX);
}
ScriptContext::FromNativeContext(l)->Error(ScriptContext::ErrorType::Warning, true, "Invalid index type [], should be string! '%s:%s'!", lua_tostring(l, -1), lua_tostring(l, -4));
}
else
{
// if we have custom index handler
lua_pushvalue(l, -4); // duplicate the table (class pointer)
lua_pushvalue(l, -4); // duplicate the index value for the call
lua_call(l, 2, 1); // call the function
}
lua_remove(l, metaTableIndex); // remove the metatable
return 1;
}
if (!lua_isnil(l, -1))
{
if (lua_tocfunction(l, -1) == &Internal::LuaPropertyTagHelper) // if it's a property
{
lua_getupvalue(l, -1, 1); // push on the stack the getter function
lua_remove(l, -2); // remove property object
if (lua_isnil(l, -1))
{
lua_rawgeti(l, -2, AZ_LUA_CLASS_METATABLE_NAME_INDEX); // load the class name for a better error
if (!lua_isstring(l, -1)) // if we failed it means we are the base metatable
{
lua_pop(l, 1);
lua_rawgeti(l, 1, AZ_LUA_CLASS_METATABLE_NAME_INDEX);
}
ScriptContext::FromNativeContext(l)->Error(ScriptContext::ErrorType::Warning, true, "Property '%s:%s' is write only", lua_tostring(l, -1), lua_tostring(l, -4));
lua_pop(l, 1); // pop class name
}
else
{
lua_pushvalue(l, -4); // copy the user data to be passed as a this pointer.
lua_call(l, 1, 1); // call a function with one argument (this pointer) and 1 result
}
}
}
lua_remove(l, metaTableIndex); // remove the metatable
return 1;
}
//=========================================================================
// Class__NewIndex
// [3/22/2012]
@@ -826,30 +901,6 @@ namespace AZ
return 1;
}
//=========================================================================
// ClassMetatable__Index
// [3/24/2012]
//=========================================================================
int ClassMetatable__Index(lua_State* l)
{
// since the Class__Index is generic function (ask for the class metatable)
// we can reuse the code for the base metatable (which is a metatable
// of the class metatable)
return Class__Index(l);
}
//=========================================================================
// ClassMetatable__NewIndex
// [3/30/2012]
//=========================================================================
int ClassMetatable__NewIndex(lua_State* l)
{
// since the Class__NewIndex is generic function (ask for the class metatable)
// we can reuse the code for the base metatable (which is a metatable
// of the class metatable)
return Class__NewIndex(l);
}
inline size_t BufferStringCopy(const char* source, char* destination, size_t destinationSize)
{
size_t srcLen = strlen(source);
@@ -5053,9 +5104,20 @@ LUA_API const Node* lua_getDummyNode()
lua_pushcclosure(m_lua, &DefaultBehaviorCaller::Destroy, 0);
lua_rawset(m_lua, -3);
lua_pushliteral(m_lua, "__index");
lua_pushcclosure(m_lua, &Internal::Class__Index, 0);
lua_rawset(m_lua, -3);
{
lua_pushliteral(m_lua, "__index");
if (FindAttribute(Script::Attributes::UseClassIndexAllowNil, behaviorClass->m_attributes))
{
lua_pushcclosure(m_lua, &Internal::Class__IndexAllowNil, 0);
}
else
{
lua_pushcclosure(m_lua, &Internal::Class__Index, 0);
}
lua_rawset(m_lua, -3);
}
lua_pushliteral(m_lua, "__newindex");
lua_pushcclosure(m_lua, &Internal::Class__NewIndex, 0);
@@ -16,19 +16,20 @@ namespace AZ
{
namespace Attributes
{
const static AZ::Crc32 Ignore = AZ_CRC("ScriptIgnore", 0xeb7615e1); ///< Don't use the element in the script reflection
const static AZ::Crc32 ClassNameOverride = AZ_CRC("ScriptClassNameOverride", 0x891238a3); ///< Provide a custom name for script reflection, that doesn't match the behavior Context name
const static AZ::Crc32 MethodOverride = AZ_CRC("ScriptFunctionOverride", 0xf89a7882); ///< Use a custom function in the attribute instead of the function
const static AZ::Crc32 ConstructorOverride = AZ_CRC("ConstructorOverride", 0xef5ce4aa); ///< You can provide a custom constructor to be called when created from Lua script
const static AZ::Crc32 EventHandlerCreationFunction = AZ_CRC_CE("EventHandlerCreationFunction"); ///< helps create a handler for any script target so that script functions can be used for AZ::Event signals
const static AZ::Crc32 GenericConstructorOverride = AZ_CRC("GenericConstructorOverride", 0xe6a1698e); ///< You can provide a custom constructor to be called when creating a script
const static AZ::Crc32 ReaderWriterOverride = AZ_CRC("ReaderWriterOverride", 0x1ad9ce2a); ///< paired with \ref ScriptContext::CustomReaderWriter allows you to customize read/write to Lua VM
const static AZ::Crc32 ConstructibleFromNil = AZ_CRC("ConstructibleFromNil", 0x23908169); ///< Applied to classes. Value (bool) specifies if the class be default constructed when nil is provided.
const static AZ::Crc32 ToolTip = AZ_CRC("ToolTip", 0xa1b95fb0); ///< Add a tooltip for a method/event/property
const static AZ::Crc32 Category = AZ_CRC("Category", 0x064c19c1); ///< Provide a category to allow for partitioning/sorting/ordering of the element
const static AZ::Crc32 Deprecated = AZ_CRC("Deprecated", 0xfe49a138); ///< Marks a reflected class, method, EBus or property as deprecated.
const static AZ::Crc32 DisallowBroadcast = AZ_CRC("DisallowBroadcast", 0x389b0ac7); ///< Marks a reflected EBus as not allowing Broadcasts, only Events.
const static AZ::Crc32 ClassConstantValue = AZ_CRC_CE("ClassConstantValue"); ///< Indicates the property is backed by a constant value
static constexpr AZ::Crc32 Ignore = AZ_CRC_CE("ScriptIgnore"); ///< Don't use the element in the script reflection
static constexpr AZ::Crc32 ClassNameOverride = AZ_CRC_CE("ScriptClassNameOverride"); ///< Provide a custom name for script reflection, that doesn't match the behavior Context name
static constexpr AZ::Crc32 MethodOverride = AZ_CRC_CE("ScriptFunctionOverride"); ///< Use a custom function in the attribute instead of the function
static constexpr AZ::Crc32 ConstructorOverride = AZ_CRC_CE("ConstructorOverride"); ///< You can provide a custom constructor to be called when created from Lua script
static constexpr AZ::Crc32 EventHandlerCreationFunction = AZ_CRC_CE("EventHandlerCreationFunction"); ///< helps create a handler for any script target so that script functions can be used for AZ::Event signals
static constexpr AZ::Crc32 GenericConstructorOverride = AZ_CRC_CE("GenericConstructorOverride"); ///< You can provide a custom constructor to be called when creating a script
static constexpr AZ::Crc32 ReaderWriterOverride = AZ_CRC_CE("ReaderWriterOverride"); ///< paired with \ref ScriptContext::CustomReaderWriter allows you to customize read/write to Lua VM
static constexpr AZ::Crc32 ConstructibleFromNil = AZ_CRC_CE("ConstructibleFromNil"); ///< Applied to classes. Value (bool) specifies if the class be default constructed when nil is provided.
static constexpr AZ::Crc32 ToolTip = AZ_CRC_CE("ToolTip"); ///< Add a tooltip for a method/event/property
static constexpr AZ::Crc32 Category = AZ_CRC_CE("Category"); ///< Provide a category to allow for partitioning/sorting/ordering of the element
static constexpr AZ::Crc32 Deprecated = AZ_CRC_CE("Deprecated"); ///< Marks a reflected class, method, EBus or property as deprecated.
static constexpr AZ::Crc32 DisallowBroadcast = AZ_CRC_CE("DisallowBroadcast"); ///< Marks a reflected EBus as not allowing Broadcasts, only Events.
static constexpr AZ::Crc32 ClassConstantValue = AZ_CRC_CE("ClassConstantValue"); ///< Indicates the property is backed by a constant value
static constexpr AZ::Crc32 UseClassIndexAllowNil = AZ_CRC_CE("UseClassIndexAllowNil"); ///< Use the Class__IndexAllowNil method, which will not report an error on accessing undeclared values (allows for nil)
//! Attribute which stores BehaviorAzEventDescription structure which contains
//! the script name of an AZ::Event and the name of it's parameter arguments
@@ -39,11 +40,11 @@ namespace AZ
static constexpr AZ::Crc32 EventParameterTypes = AZ_CRC_CE("EventParameterTypes");
///< Recommends that the Lua runtime look up the member function in the meta table of the first argument, rather than in the original table
const static AZ::Crc32 TreatAsMemberFunction = AZ_CRC("TreatAsMemberFunction", 0x64be831a);
static constexpr AZ::Crc32 TreatAsMemberFunction = AZ_CRC_CE("TreatAsMemberFunction");
///< This attribute can be attached to the EditContext Attribute of a reflected class, the BehaviorContext Attribute of a reflected class, method, ebus or property.
///< ExcludeFlags can be used to prevent elements from appearing in List, Documentation, etc...
const static AZ::Crc32 ExcludeFrom = AZ_CRC("ExcludeFrom", 0xa98972fe);
static constexpr AZ::Crc32 ExcludeFrom = AZ_CRC_CE("ExcludeFrom");
enum ExcludeFlags : AZ::u64
{
List = 1 << 0, //< The reflected item will be excluded from any list (e.g. node palette)
@@ -54,7 +55,7 @@ namespace AZ
};
//! Used to specify the usage of a Behavior Context element (e.g. Class or EBus) designed for automation scripts
const static AZ::Crc32 Scope = AZ_CRC("Scope", 0x00af55d3);
static constexpr AZ::Crc32 Scope = AZ_CRC_CE("Scope");
enum class ScopeFlags : AZ::u64
{
Launcher = 1 << 0, //< a type meant for game run-time Launcher client (default value)
@@ -63,15 +64,15 @@ namespace AZ
};
//! Provide a partition hierarchy in a string dotted notation to namespace a script element
const static AZ::Crc32 Module = AZ_CRC("Module", 0x0c242628);
static constexpr AZ::Crc32 Module = AZ_CRC_CE("Module");
//! Provide an alternate name for script elements such as helpful PEP8 Python methods and property aliases
const static AZ::Crc32 Alias = AZ_CRC("Alias", 0xe16c6b94);
static constexpr AZ::Crc32 Alias = AZ_CRC_CE("Alias");
const static AZ::Crc32 EnableAsScriptEventParamType = AZ_CRC("ScriptEventParam", 0xa41e4cb0);
const static AZ::Crc32 EnableAsScriptEventReturnType = AZ_CRC("ScriptEventReturn", 0xf89b5337);
static constexpr AZ::Crc32 EnableAsScriptEventParamType = AZ_CRC_CE("ScriptEventParam");
static constexpr AZ::Crc32 EnableAsScriptEventReturnType = AZ_CRC_CE("ScriptEventReturn");
const static AZ::Crc32 Storage = AZ_CRC("ScriptStorage", 0xcd95b44d);
static constexpr AZ::Crc32 Storage = AZ_CRC_CE("ScriptStorage");
enum class StorageType
{
ScriptOwn, // default, Host allocated memory, Lua will destruct object, Lua will free host-memory via host-supplied function
@@ -79,7 +80,7 @@ namespace AZ
Value, // Object is Lua allocated memory, Lua will destruct object, Lua will free Lua-memory
};
const static AZ::Crc32 Operator = AZ_CRC("ScriptOperator", 0xfee681b6);
static constexpr AZ::Crc32 Operator = AZ_CRC_CE("ScriptOperator");
enum class OperatorType
{
// note storage policy can be T*,T (only if we store raw pointers), shared_ptr<T>, intrusive pointer<T>
@@ -100,7 +101,7 @@ namespace AZ
IndexWrite, // given a key/index and a value, you can store it in the class
};
const static AZ::Crc32 AssetType = AZ_CRC("AssetType", 0xabbf8d5f); ///< Provide an asset type for a generic AssetId method
static constexpr AZ::Crc32 AssetType = AZ_CRC_CE("AssetType"); ///< Provide an asset type for a generic AssetId method
} // Attributes
} // Script
@@ -24,7 +24,6 @@ namespace AZ
//=========================================================================
AZStd::string ExtractUserMessage(const ScriptDataContext& dc)
{
AZStd::string userMessage = "Condition failed";
const int argCount = dc.GetNumArguments();
if (argCount > 0 && dc.IsString(argCount - 1))
{
@@ -33,12 +32,12 @@ namespace AZ
{
if (value)
{
userMessage = value;
return value;
}
}
}
return userMessage;
return "ExtractUserMessage from print/Debug.Log/Warn/Error/Assert failed. Consider wrapping your argument in tostring().";
}
//=========================================================================
@@ -90,6 +90,15 @@ namespace AzFramework
*/
virtual void DestroyGameEntity(const AZ::EntityId& /*id*/) = 0;
/**
* Destroys an entity only in slice mode (when prefabs are disabled). This request is only added as a stop-gap solution
* to prevent the editor from crashing when prefabs are enabled and must only be called through the BehaviorContext binding
* for 'DestroyGameEntity'. No code should be written to directly call this method. This will be removed soon.
*
* @param id The ID of the entity to destroy.
*/
virtual void DestroyGameEntityOnlyInSliceMode(const AZ::EntityId& /*id*/) = 0;
/**
* Destroys an entity and all of its descendants.
* The entity and its descendants are immediately deactivated and will be
@@ -98,6 +107,15 @@ namespace AzFramework
*/
virtual void DestroyGameEntityAndDescendants(const AZ::EntityId& /*id*/) = 0;
/**
* Destroys an entity and its descendants only in slice mode (when prefabs are disabled). This request is only added as a stop-gap
* solution to prevent the editor from crashing when prefabs are enabled and must only be called through the BehaviorContext
* binding for 'DestroyGameEntityAndDescendants'.No code should be written to directly call this method. This will be removed soon.
*
* @param id The ID of the entity to destroy.
*/
virtual void DestroyGameEntityAndDescendantsOnlyInSliceMode(const AZ::EntityId& /*id*/) = 0;
/**
* Activates the game entity.
* @param id The ID of the entity to activate.
@@ -46,8 +46,9 @@ namespace AzFramework
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Event("CreateGameEntity", &GameEntityContextRequestBus::Events::CreateGameEntityForBehaviorContext)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Event("DestroyGameEntity", &GameEntityContextRequestBus::Events::DestroyGameEntity)
->Event("DestroyGameEntityAndDescendants", &GameEntityContextRequestBus::Events::DestroyGameEntityAndDescendants)
->Event("DestroyGameEntity", &GameEntityContextRequestBus::Events::DestroyGameEntityOnlyInSliceMode)
->Event(
"DestroyGameEntityAndDescendants", &GameEntityContextRequestBus::Events::DestroyGameEntityAndDescendantsOnlyInSliceMode)
->Event("ActivateGameEntity", &GameEntityContextRequestBus::Events::ActivateGameEntity)
->Event("DeactivateGameEntity", &GameEntityContextRequestBus::Events::DeactivateGameEntity)
->Attribute(AZ::ScriptCanvasAttributes::DeactivatesInputEntity, true)
@@ -247,6 +248,23 @@ namespace AzFramework
DestroyGameEntityInternal(id, false);
}
void GameEntityContextComponent::DestroyGameEntityOnlyInSliceMode(const AZ::EntityId& id)
{
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (!isPrefabSystemEnabled)
{
DestroyGameEntityInternal(id, false);
}
else
{
AZ_Error(
"GameEntityContextComponent", false,
"Destroying a game entity is temporarily disabled until the Spawnable system can support this.");
}
}
//=========================================================================
// GameEntityContextComponent::DestroyGameEntityAndDescendantsById
//=========================================================================
@@ -255,6 +273,24 @@ namespace AzFramework
DestroyGameEntityInternal(id, true);
}
void GameEntityContextComponent::DestroyGameEntityAndDescendantsOnlyInSliceMode(const AZ::EntityId& id)
{
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (!isPrefabSystemEnabled)
{
DestroyGameEntityInternal(id, true);
}
else
{
AZ_Error(
"GameEntityContextComponent", false,
"Destroying a game entity and its descendants is temporarily disabled until the Spawnable system can support this.");
}
}
//=========================================================================
// GameEntityContextComponent::DestroyGameEntityInternal
//=========================================================================
@@ -89,6 +89,12 @@ namespace AzFramework
}
private:
//////////////////////////////////////////////////////////////////////////
// GameEntityContextRequestBus
void DestroyGameEntityOnlyInSliceMode(const AZ::EntityId&) override;
void DestroyGameEntityAndDescendantsOnlyInSliceMode(const AZ::EntityId&) override;
/////////////////////////////////////////////////////////////////////////
AzFramework::EntityVisibilityBoundsUnionSystem m_entityVisibilityBoundsUnionSystem;
};
} // namespace AzFramework
@@ -188,7 +188,7 @@ namespace AzPhysics
AZ::Transform m_start = AZ::Transform::CreateIdentity(); //!< World space start position. Assumes only rotation + translation (no scaling).
AZ::Vector3 m_direction = AZ::Vector3::CreateZero(); //!< World space direction (Should be normalized)
AZStd::shared_ptr<Physics::ShapeConfiguration> m_shapeConfiguration; //!< Shape information.
SceneQuery::HitFlags m_hitFlags = SceneQuery::HitFlags::Default; //!< Query behavior flags
SceneQuery::HitFlags m_hitFlags = SceneQuery::HitFlags::Default | SceneQuery::HitFlags::MTD; //!< Query behavior flags. MTD Is On by default to correctly report objects that are initially in contact with the start pose.
SceneQuery::FilterCallback m_filterCallback = nullptr; //!< Hit filtering function
bool m_reportMultipleHits = false; //!< flag to have the cast stop after the first hit or return all hits along the query.
};
@@ -135,7 +135,6 @@ namespace AzQtComponents
SearchTypeSelector::SearchTypeSelector(QWidget* parent /* = nullptr */)
: QMenu(parent)
, m_unfilteredData(nullptr)
{
Q_ASSERT(parent != nullptr);
@@ -196,7 +195,17 @@ namespace AzQtComponents
itemLayout->addWidget(m_tree);
m_model = new QStandardItemModel(this);
m_tree->setModel(m_model);
m_filterModel = new SearchTypeSelectorFilterModel(this);
m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
m_filterModel->setRecursiveFilteringEnabled(true);
m_filterModel->setSourceModel(m_model);
// make sure all entries enter the view expanded
connect(m_filterModel, &QAbstractItemModel::rowsInserted, this, [this]()
{
m_tree->expandAll();
});
m_tree->setModel(m_filterModel);
m_tree->setHeaderHidden(true);
connect(m_model, &QStandardItemModel::itemChanged, this, [this](QStandardItem* item)
@@ -205,11 +214,6 @@ namespace AzQtComponents
if (!m_settingUp)
{
int index = item->data().toInt();
if (index < m_filteredItemIndices.size())
{
index = m_filteredItemIndices[item->data().toInt()];
}
bool enabled = item->checkState() == Qt::Checked;
emit TypeToggled(index, enabled);
}
@@ -228,169 +232,116 @@ namespace AzQtComponents
QMenu::showEvent(e);
}
void SearchTypeSelector::resetData()
{
m_estimatedTableHeight = 0;
m_estimatedTableWidth = 0;
m_filteredItemIndices.clear();
m_model->clear();
}
void SearchTypeSelector::initItem(QStandardItem* item, const SearchTypeFilter& filter, int unfilteredDataIndex)
{
Q_UNUSED(filter);
Q_UNUSED(unfilteredDataIndex);
item->setData(unfilteredDataIndex);
item->setEditable(false);
item->setCheckable(true);
item->setCheckState(filter.enabled ? Qt::Checked : Qt::Unchecked);
}
bool SearchTypeSelector::filterItemOut(int unfilteredDataIndex, bool itemMatchesFilter, bool categoryMatchesFilter)
int SearchTypeSelector::getUnfilteredDataIndex(QStandardItem* item)
{
Q_UNUSED(unfilteredDataIndex);
return !itemMatchesFilter && !categoryMatchesFilter;
const QVariant itemData = item->data();
if (itemData.isValid())
{
return item->data().toInt();
}
return -1;
}
void SearchTypeSelector::RepopulateDataModel()
void SearchTypeSelector::RepopulateDataModel(const SearchTypeFilterList& unfilteredData)
{
resetData();
if (!m_unfilteredData)
{
return;
}
bool amFiltering = !m_filterString.isEmpty();
m_estimatedTableHeight = 0;
m_estimatedTableWidth = 0;
m_model->clear();
m_filterModel->setNoResultsMessageRow(-1); // reset the index for the "no results" message
QScopedValueRollback<bool> setupGuard(m_settingUp, true);
QMap<QString, QStandardItem*> categories;
QStandardItem* firstCategory = nullptr;
QStandardItem* firstItem = nullptr;
int numCategories = 0;
int numItems = 0;
int numItemsAdded = 0;
QVector<QString> categoriesInOrder; // categories in originally specified order
QMap<QString, QList<QStandardItem*>> categoryToEntryItems; // category name to sub-items that will be added
for (int unfilteredDataIndex = 0, length = m_unfilteredData->length(); unfilteredDataIndex < length; ++unfilteredDataIndex)
const int numItems = unfilteredData.length();
for (int unfilteredDataIndex = 0; unfilteredDataIndex < numItems; ++unfilteredDataIndex)
{
const SearchTypeFilter& filter = m_unfilteredData->at(unfilteredDataIndex);
bool addItem = true;
bool itemMatchesFilter = true;
bool categoryMatchesFilter = true;
if (amFiltering)
{
itemMatchesFilter = filter.displayName.contains(m_filterString, Qt::CaseSensitivity::CaseInsensitive);
categoryMatchesFilter = filter.category.contains(m_filterString, Qt::CaseSensitivity::CaseInsensitive);
}
if (filterItemOut(unfilteredDataIndex, itemMatchesFilter, categoryMatchesFilter))
{
addItem = false;
}
QStandardItem* categoryItem = nullptr;
if (categories.contains(filter.category))
{
categoryItem = categories[filter.category];
}
else
{
if (categoryMatchesFilter || addItem)
{
categoryItem = new QStandardItem(filter.category);
categories[filter.category] = categoryItem;
m_model->appendRow(categoryItem);
categoryItem->setEditable(false);
numCategories++;
if (!firstCategory)
{
firstCategory = firstCategory ? firstCategory : categoryItem;
}
}
}
// count the item even if we filter it out, so that the estimated height includes what it could be if the filter changes
numItems++;
if (!addItem)
{
continue;
}
numItemsAdded++;
m_filteredItemIndices.append(unfilteredDataIndex);
const SearchTypeFilter& filter = unfilteredData.at(unfilteredDataIndex);
// create each item, but don't add them yet, as we don't know if we will be adding to the category items,
// or to the model directly
QStandardItem* item = new QStandardItem(filter.displayName);
item->setData(unfilteredDataIndex);
item->setEditable(false);
initItem(item, filter, unfilteredDataIndex);
if (categoryItem)
categoryToEntryItems[filter.category].push_back(item);
if (categoriesInOrder.indexOf(filter.category) == -1)
{
categoryItem->appendRow(item);
}
else
{
m_model->appendRow(item);
// need to add these category items as they are first encountered so
// that the original category ordering is maintained
categoriesInOrder.push_back(filter.category);
}
int textWidth = fontMetrics().horizontalAdvance(filter.displayName);
if (textWidth > m_estimatedTableWidth)
{
m_estimatedTableWidth = textWidth;
m_estimatedTableWidth = textWidth;
}
}
const int numCategories = categoriesInOrder.size();
if (!firstItem)
// If there is only one category and its name is empty, discard it,
// and add its children directly to the model as one big column of N rows
if (numCategories == 1 && categoriesInOrder[0].isEmpty())
{
auto& entryItems = categoryToEntryItems.begin().value();
m_model->appendColumn(entryItems);
}
else
{
for (int categoryIndex = 0; categoryIndex < numCategories; ++categoryIndex)
{
firstItem = item;
const QString& currCategory = categoriesInOrder[categoryIndex];
QStandardItem* categoryItem = new QStandardItem(currCategory);
auto& entryItems = categoryToEntryItems[currCategory];
categoryItem->appendColumn(entryItems);
m_model->appendRow(categoryItem); // add the parent last, so the model just gets one row add per category
}
}
if (numItemsAdded == GetNumFixedItems())
{
QStandardItem* item = new QStandardItem(QObject::tr("<i>No result found.</i>"));
m_model->appendRow(item);
item->setEditable(false);
++numItems;
}
// add a special row that indicates that no categories (other than the fixed ones) match the filter
// this row itself will be filtered out when there are other matching categories
m_filterModel->setNoResultsMessageRow(m_model->rowCount());
QStandardItem* noResultsMessage = new QStandardItem(QObject::tr("<i>No result found.</i>"));
noResultsMessage->setEditable(false);
m_model->appendRow(new QStandardItem(QObject::tr("<i>No result found.</i>")));
// If there is only one category and its name is empty, let put everything at root.
if (categories.count() == 1 && categories.begin().key().isEmpty())
{
m_tree->setRootIndex(categories.begin().value()->index());
numCategories = 0;
}
estimateTableHeight(firstCategory, numCategories, firstItem, numItems);
estimateTableHeight(numCategories, numItems);
}
void SearchTypeSelector::estimateTableHeight(QStandardItem* firstCategory, int numCategories, QStandardItem* firstItem, int numItems)
void SearchTypeSelector::estimateTableHeight(int numCategories, int numItems)
{
m_tree->expandAll();
int totalCategoryHeight = 0;
int totalItemHeight = 0;
if (firstItem)
auto* theModel = m_tree->model();
QModelIndex firstIndex(theModel->index(0, 0));
QModelIndex firstChild(theModel->index(0, 0, firstIndex));
if (firstIndex.isValid())
{
QModelIndex index = m_model->indexFromItem(firstItem);
int itemHeight = m_tree->fetchRowHeight(index);
int itemHeight = m_tree->fetchRowHeight(firstIndex);
totalItemHeight += (itemHeight * numItems);
}
if (firstCategory)
if (firstChild.isValid())
{
QModelIndex index = m_model->indexFromItem(firstCategory);
int categoryHeight = m_tree->fetchRowHeight(index);
int categoryHeight = m_tree->fetchRowHeight(firstChild);
totalCategoryHeight += (categoryHeight * numCategories);
}
@@ -504,10 +455,7 @@ namespace AzQtComponents
void SearchTypeSelector::Setup(const SearchTypeFilterList& searchTypes)
{
m_unfilteredData = &searchTypes;
RepopulateDataModel();
RepopulateDataModel(searchTypes);
setFixedWidth(m_estimatedTableWidth + FilterWindowWidthPadding);
}
@@ -578,8 +526,75 @@ namespace AzQtComponents
void SearchTypeSelector::FilterTextChanged(const QString& newFilter)
{
m_filterString = newFilter;
m_filterModel->setFilterWildcard(m_filterString);
}
RepopulateDataModel();
SearchTypeSelectorFilterModel::SearchTypeSelectorFilterModel(SearchTypeSelector* searchTypeSelector)
: QSortFilterProxyModel(searchTypeSelector), m_searchTypeSelector(searchTypeSelector)
{
// use queued connections so that the normal sort/filter operations get a chance to finish the index remapping before we act
connect(this, &QAbstractItemModel::rowsInserted, this, &SearchTypeSelectorFilterModel::onRowCountChanged, Qt::QueuedConnection);
connect(this, &QAbstractItemModel::rowsRemoved, this, &SearchTypeSelectorFilterModel::onRowCountChanged, Qt::QueuedConnection);
}
void SearchTypeSelectorFilterModel::setNoResultsMessageRow(int row)
{
m_noResultsRow = row;
invalidateFilter();
}
void SearchTypeSelectorFilterModel::onRowCountChanged()
{
// see if we need to hide or show the "no results" message item
const int numLeafNodes = getNumLeafNodes();
// check if we're down to the (never filtered) fixed items, and should show the "no results" message,
// or if we were already showing that message, check if we have more than the fixed items plus the message itself
const bool hasResultsChanged = (m_showingNoResultsMessage ? numLeafNodes > m_searchTypeSelector->GetNumFixedItems() + 1
: numLeafNodes <= m_searchTypeSelector->GetNumFixedItems());
if (hasResultsChanged)
{
m_showingNoResultsMessage = !m_showingNoResultsMessage;
QModelIndex noResultsMessageIndex = sourceModel()->index(m_noResultsRow, 0);
// The no results row is in the source model, so trigger dataChanged to allow us to re-filter it
emit sourceModel()->dataChanged(noResultsMessageIndex, noResultsMessageIndex);
}
}
bool SearchTypeSelectorFilterModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
{
// if we're considering the "no results" item, accept it only if we're m_showingNoResultsMessage
if (!source_parent.isValid() && source_row == m_noResultsRow)
{
return m_showingNoResultsMessage;
}
const bool filteredByBase = ! QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
// allow searchTypeSelector to make the final decision whether to filter out this item
return !(m_searchTypeSelector->filterItemOut(m_searchTypeSelector->m_model->index(source_row, 0, source_parent), filteredByBase));
}
int SearchTypeSelectorFilterModel::getNumLeafNodes(const QModelIndex& theIndex)
{
// count the number of leaf nodes descending from this index, not including itself
int numLeafNodes = 0;
for (int childRow = 0, numChildRows = rowCount(theIndex); childRow < numChildRows; ++childRow)
{
QModelIndex childIndex = index(childRow, 0, theIndex);
if (rowCount(childIndex) == 0)
{
++numLeafNodes;
}
else
{
numLeafNodes += getNumLeafNodes(childIndex);
}
}
return numLeafNodes;
}
FilteredSearchWidget::Config FilteredSearchWidget::loadConfig(QSettings& settings)
@@ -929,7 +944,7 @@ namespace AzQtComponents
{
{
QSignalBlocker blocker(this);
ConfigHelpers::GroupGuard(&settings, widgetName);
ConfigHelpers::GroupGuard guard(&settings, widgetName);
const auto textFilter = settings.value(g_textFilterKey);
if (textFilter.isValid())
{
@@ -953,7 +968,7 @@ namespace AzQtComponents
void FilteredSearchWidget::writeSettings(QSettings& settings, const QString& widgetName)
{
ConfigHelpers::GroupGuard(&settings, widgetName);
ConfigHelpers::GroupGuard guard(&settings, widgetName);
settings.setValue(g_textFilterKey, textFilter());
const int size = m_typeFilters.size();
@@ -17,6 +17,8 @@
#include <QVariant>
#include <QMenu>
#include <QTimer>
#include <QSortFilterProxyModel>
#include <QStandardItem>
#include <AzCore/std/chrono/chrono.h>
#endif
@@ -28,9 +30,7 @@ namespace Ui
class FlowLayout;
class QTreeView;
class QSortFilterProxyModel;
class QStandardItemModel;
class QStandardItem;
class QSettings;
class QLineEdit;
class QToolButton;
@@ -43,6 +43,7 @@ namespace AzQtComponents
{
class Style;
class FilteredSearchItemDelegate;
class SearchTypeSelectorFilterModel;
class AZ_QT_COMPONENTS_API FilterCriteriaButton
: public QFrame
@@ -160,28 +161,27 @@ namespace AzQtComponents
void FilterTextChanged(const QString& newFilter);
protected:
void estimateTableHeight(QStandardItem* firstCategory, int numCategories, QStandardItem* firstItem, int numItems);
void resetData();
void estimateTableHeight(int numCategories, int numItems);
// can be used to override the logic when adding items in RepopulateDataModel
virtual bool filterItemOut(int index, bool itemMatchesFilter, bool categoryMatchesFilter);
// allows child classes to override the logic of accepting filter categories
virtual bool filterItemOut(const QModelIndex& sourceIndex, bool filteredByBase) { Q_UNUSED(sourceIndex); return filteredByBase; }
virtual void initItem(QStandardItem* item, const SearchTypeFilter& filter, int unfilteredDataIndex);
int getUnfilteredDataIndex(QStandardItem* item); // get the original filter index from the item itself
// Returns the number of items that always appear in the list, regardless of the filtering.
virtual int GetNumFixedItems() { return 0; }
void showEvent(QShowEvent* e) override;
virtual void RepopulateDataModel();
void RepopulateDataModel(const SearchTypeFilterList& unfilteredData);
void maximizeGeometryToFitScreen();
SearchTypeSelectorTreeView* m_tree;
QStandardItemModel* m_model;
const SearchTypeFilterList* m_unfilteredData;
AZ_PUSH_DISABLE_WARNING(4127 4251, "-Wunknown-warning-option") // conditional expression is constant, needs to have dll-interface to be used by clients of class 'AzQtComponents::SearchTypeSelector'
QVector<int> m_filteredItemIndices;
AZ_POP_DISABLE_WARNING
QString m_filterString;
friend class SearchTypeSelectorFilterModel;
SearchTypeSelectorFilterModel* m_filterModel;
QString m_filterString;
bool m_settingUp = false;
int m_fixedWidth = 256;
QLineEdit* m_searchField = nullptr;
@@ -193,6 +193,26 @@ namespace AzQtComponents
bool m_lineEditSearchVisible = true;
};
class SearchTypeSelectorFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
SearchTypeSelectorFilterModel(SearchTypeSelector* searchTypeSelector);
void setNoResultsMessageRow(int row); // row of specialized "no results" message in the source model
protected slots:
void onRowCountChanged();
protected:
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
int getNumLeafNodes(const QModelIndex& theIndex = QModelIndex()); // gets the number of leaf node descendants of current index. Current index is *not* considered
SearchTypeSelector* m_searchTypeSelector = nullptr;
int m_noResultsRow = -1; // row of specialized "no results" message in the source model
bool m_showingNoResultsMessage = false;
};
class AZ_QT_COMPONENTS_API FilteredSearchWidget
: public QFrame
{
@@ -109,13 +109,13 @@ namespace AzQtComponents
void ReadColorGridConfig(QSettings& settings, const QString& name, ColorPicker::ColorGridConfig& colorGrid)
{
ConfigHelpers::GroupGuard(&settings, name);
ConfigHelpers::GroupGuard guard(&settings, name);
ConfigHelpers::read<QSize>(settings, QStringLiteral("MinimumSize"), colorGrid.minimumSize);
}
void ReadDialoButtonsConfig(QSettings& settings, const QString& name, ColorPicker::DialogButtonsConfig& dialogButtons)
{
ConfigHelpers::GroupGuard(&settings, name);
ConfigHelpers::GroupGuard guard(&settings, name);
ConfigHelpers::read<int>(settings, QStringLiteral("TopPadding"), dialogButtons.topPadding);
}

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -10,11 +10,6 @@
<qresource prefix="/Level">
<file alias="level.svg">Level/level.svg</file>
</qresource>
<qresource prefix="/Notifications">
<file alias="checkmark.svg">Notifications/checkmark.svg</file>
<file alias="download.svg">Notifications/download.svg</file>
<file alias="link.svg">Notifications/link.svg</file>
</qresource>
<qresource prefix="/Menu">
<file alias="resolution.svg">Menu/resolution.svg</file>
<file alias="debug.svg">Menu/debug.svg</file>
@@ -31,4 +26,26 @@
<file alias="menu.svg">Menu/menu.svg</file>
<file alias="helpers.svg">Menu/helpers.svg</file>
</qresource>
<qresource prefix="/Notifications">
<file alias="checkmark.svg">Notifications/checkmark.svg</file>
<file alias="download.svg">Notifications/download.svg</file>
<file alias="link.svg">Notifications/link.svg</file>
</qresource>
<qresource prefix="/Outliner">
<file alias="sort_a_to_z.svg">Outliner/sort_a_to_z.svg</file>
<file alias="sort_manually.svg">Outliner/sort_manually.svg</file>
<file alias="sort_z_to_a.svg">Outliner/sort_z_to_a.svg</file>
<file alias="visibility_default.svg">Outliner/visibility_default.svg</file>
<file alias="visibility_default_hover.svg">Outliner/visibility_default_hover.svg</file>
<file alias="visibility_default_transparent.svg">Outliner/visibility_default_transparent.svg</file>
<file alias="visibility_on.svg">Outliner/visibility_on.svg</file>
<file alias="visibility_on_hover.svg">Outliner/visibility_on_hover.svg</file>
<file alias="visibility_on_transparent.svg">Outliner/visibility_on_transparent.svg</file>
<file alias="lock_default.svg">Outliner/lock_default.svg</file>
<file alias="lock_default_hover.svg">Outliner/lock_default_hover.svg</file>
<file alias="lock_default_transparent.svg">Outliner/lock_default_transparent.svg</file>
<file alias="lock_on.svg">Outliner/lock_on.svg</file>
<file alias="lock_on_hover.svg">Outliner/lock_on_hover.svg</file>
<file alias="lock_on_transparent.svg">Outliner/lock_on_transparent.svg</file>
</qresource>
</RCC>
@@ -1,145 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "ConditionGroupWidget.h"
#include "ConditionWidget.h"
#include <QGridLayout>
#include <QToolButton>
#include <QWidgetItem>
#include <QLayoutItem>
#include <QPaintEvent>
#include <QPainter>
#include <QStyleOptionToolButton>
enum Action {
ActionAdd,
ActionRemove
};
class ActionButton : public QToolButton
{
public:
explicit ActionButton(QWidget *parent = nullptr)
: QToolButton(parent)
{
setAttribute(Qt::WA_Hover);
}
void paintEvent(QPaintEvent *)
{
QStyleOptionToolButton opt;
initStyleOption(&opt);
auto state = (opt.state & QStyle::State_Sunken) ? QIcon::Active
: ((opt.state & QStyle::State_MouseOver) ? QIcon::Selected
: QIcon::Normal);
QPixmap pix = icon().pixmap(QSize(16, 16), state);
QPainter p(this);
QRect pixRect = pix.rect();
pixRect.moveCenter(rect().center());
pixRect.adjust(-2, 1, -2, 1);
p.drawPixmap(pixRect , pix);
}
};
ConditionGroupWidget::ConditionGroupWidget(QWidget *parent)
: QWidget(parent)
, m_layout(new QGridLayout(this))
{
m_addIcon.addPixmap(QPixmap(":/stylesheet/img/condition_add.png"), QIcon::Normal);
m_addIcon.addPixmap(QPixmap(":/stylesheet/img/condition_add_hover.png"), QIcon::Selected);
m_addIcon.addPixmap(QPixmap(":/stylesheet/img/condition_add_pressed.png"), QIcon::Active);
m_delIcon.addPixmap(QPixmap(":/stylesheet/img/condition_remove.png"), QIcon::Normal);
m_delIcon.addPixmap(QPixmap(":/stylesheet/img/condition_remove_hover.png"), QIcon::Selected);
m_delIcon.addPixmap(QPixmap(":/stylesheet/img/condition_remove_pressed.png"), QIcon::Active);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
m_layout->setHorizontalSpacing(0);
// Lets have at least one condition
appendCondition();
}
void ConditionGroupWidget::appendCondition()
{
auto cond = new ConditionWidget();
connect(cond, SIGNAL(geometryChanged()), this, SLOT(update()));
m_layout->addWidget(cond, count(), 0);
m_layout->addWidget(new ActionButton(), count() - 1, 1);
updateButtons();
}
void ConditionGroupWidget::removeCondition(int n)
{
if (n >= 0 && n < count() && count() > 1) {
m_layout->removeItem(m_layout->itemAtPosition(n, 0));
m_layout->removeItem(m_layout->itemAtPosition(n, 1));
updateButtons();
}
}
int ConditionGroupWidget::count() const
{
return m_layout->rowCount();
}
void ConditionGroupWidget::paintEvent(QPaintEvent *)
{
const int c = count();
for (int i = 0; i < c - 1; ++i) {
ConditionWidget *cond1 = conditionAt(i);
ConditionWidget *cond2 = conditionAt(i + 1);
if (!cond1 || !cond2)
continue; // defensive, doesn't happen
const int separatorHeight = 3;
const int y = ((cond1->geometry().bottom() + cond2->y()) / 2) - (separatorHeight / 2);
QPainter p(this);
p.setPen(QColor(50, 52, 53));
p.setBrush(QColor(94, 96, 96));
p.drawRoundedRect(QRect(0, y, width() - 1, separatorHeight), 1, 1);
}
}
ConditionWidget *ConditionGroupWidget::conditionAt(int row) const
{
if (row < 0 || row >= count())
return nullptr;
if (auto item = m_layout->itemAtPosition(row, 0))
return qobject_cast<ConditionWidget*>(item->widget());
return nullptr;
}
void ConditionGroupWidget::updateButtons()
{
update();
const int n = count();
for (int i = 0; i < n; ++i) {
if (auto item = m_layout->itemAtPosition(i, 1)) {
if (auto button = qobject_cast<QToolButton*>(item->widget())) {
bool isLast = i == n - 1;
button->setCheckable(true);
button->setChecked(true);
button->setIcon(isLast ? m_addIcon : m_delIcon);
button->disconnect();
if (isLast) {
connect(button, &QToolButton::clicked, this, &ConditionGroupWidget::appendCondition);
} else {
connect(button, &QToolButton::clicked, this, [this, i] {
removeCondition(i);
});
}
}
}
}
}
#include "StyleGallery/moc_ConditionGroupWidget.cpp"
@@ -1,36 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef CONDITIONGROUPWIDGET_H
#define CONDITIONGROUPWIDGET_H
#if !defined(Q_MOC_RUN)
#include <QWidget>
#include <QIcon>
#endif
class QGridLayout;
class ConditionWidget;
class ConditionGroupWidget : public QWidget
{
Q_OBJECT
public:
explicit ConditionGroupWidget(QWidget *parent = nullptr);
void appendCondition();
void removeCondition(int n);
int count() const;
void paintEvent(QPaintEvent *) override;
private:
ConditionWidget* conditionAt(int row) const;
void updateButtons();
QGridLayout *const m_layout;
QIcon m_addIcon;
QIcon m_delIcon;
};
#endif
@@ -1,51 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "ConditionWidget.h"
#include <QHBoxLayout>
#include <QComboBox>
#include <QCheckBox>
#include <QLineEdit>
ConditionWidget::ConditionWidget(QWidget *parent)
: QWidget(parent)
{
auto layout = new QHBoxLayout(this);
auto checkbox = new QCheckBox();
auto combo1 = new QComboBox();
combo1->addItem(QStringLiteral("Asset Type"));
combo1->addItem(QStringLiteral("Asset Name"));
combo1->setProperty("class", "condition");
auto combo2 = new QComboBox();
combo2->setFixedWidth(88);
combo2->setProperty("class", "condition");
combo2->addItem(QStringLiteral("is"));
combo2->addItem(QStringLiteral("is not"));
auto lineedit = new QLineEdit();
layout->addWidget(checkbox);
layout->addWidget(combo1);
layout->addWidget(combo2);
layout->addWidget(lineedit);
layout->setSpacing(5);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
}
void ConditionWidget::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
emit geometryChanged();
}
void ConditionWidget::moveEvent(QMoveEvent *event)
{
QWidget::moveEvent(event);
emit geometryChanged();
}
#include "StyleGallery/moc_ConditionWidget.cpp"
@@ -1,30 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef CONDITIONWIDGET_H
#define CONDITIONWIDGET_H
#if !defined(Q_MOC_RUN)
#include <QWidget>
#endif
class ConditionWidget : public QWidget
{
Q_OBJECT
public:
explicit ConditionWidget(QWidget *parent = nullptr);
signals:
void geometryChanged();
protected:
void resizeEvent(QResizeEvent *event) override;
void moveEvent(QMoveEvent *event) override;
};
#endif
@@ -1,57 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "DeploymentsWidget.h"
#include <AzQtComponents/Components/StyledDockWidget.h>
#include <QPainter>
#include <QInputDialog>
using namespace AzQtComponents;
DeploymentsWidget::DeploymentsWidget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::DeploymentsWidget())
{
setFixedSize(263, 238);
ui->setupUi(this);
ui->titlebar->setWindowTitleOverride(tr("Deployments"));
//ui->titlebar->setFrameHackEnabled(true);
ui->titlebar->setForceInactive(true);
ui->deploymentOk->setProperty("class", "Primary");
ui->contents->setAttribute(Qt::WA_TranslucentBackground);
ui->blueLabel->setProperty("class", "addDeployment"); // Should this label style be more generic ?
ui->blueLabel->installEventFilter(this);
ui->blueLabel->setCursor(Qt::PointingHandCursor);
}
void DeploymentsWidget::paintEvent(QPaintEvent *)
{
QPainter p(this);
StyledDockWidget::drawFrame(p, rect(), false);
p.setPen(QColor(35, 36, 37));
p.drawLine(1, height()-51, width() - 2, height() - 51);
p.setPen(QColor(66, 67, 68));
p.drawLine(1, height()-50, width() - 2, height() - 50);
}
bool DeploymentsWidget::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::MouseButtonRelease) {
addDeployment();
return true;
}
return QWidget::eventFilter(watched, event);
}
void DeploymentsWidget::addDeployment()
{
QInputDialog::getText(this, tr("Enter deployment name"), QString());
}
#include "StyleGallery/moc_DeploymentsWidget.cpp"
@@ -1,30 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef DEPLOYMENTSWIDGET_H
#define DEPLOYMENTSWIDGET_H
#if !defined(Q_MOC_RUN)
#include <AzQtComponents/StyleGallery/ui_deploymentswidget.h>
#include <QWidget>
#include <QScopedPointer>
#endif
class DeploymentsWidget : public QWidget
{
Q_OBJECT
public:
explicit DeploymentsWidget(QWidget *parent = 0);
void paintEvent(QPaintEvent *event) override;
bool eventFilter(QObject *watched, QEvent *event) override;
void addDeployment();
private:
QScopedPointer<Ui::DeploymentsWidget> ui;
};
#endif
@@ -1,15 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "MyCombo.h"
MyComboBox::MyComboBox(QWidget *parent)
: QComboBox(parent)
{
}
#include "StyleGallery/moc_MyCombo.cpp"
@@ -1,22 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef MY_COMBO_H
#define MY_COMBO_H
#if !defined(Q_MOC_RUN)
#include <QComboBox>
#endif
class MyComboBox : public QComboBox
{
Q_OBJECT
public:
explicit MyComboBox(QWidget *parent = nullptr);
};
#endif
@@ -1,69 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
// Description : CViewportTitleDlg implementation file
#include "ViewportTitleDlg.h"
#include <AzQtComponents/StyleGallery/ui_ViewportTitleDlg.h>
#include <QAction>
ViewportTitleDlg::ViewportTitleDlg(QWidget* pParent)
: QWidget(pParent),
m_ui(new Ui::ViewportTitleDlg)
{
m_ui->setupUi(this);
OnInitDialog();
m_ui->m_viewportSearch->setIcon(QIcon(":/stylesheet/img/16x16/Search.png"));
auto clearAction = new QAction(this);
clearAction->setIcon(QIcon(":/stylesheet/img/16x16/lineedit-clear.png"));
m_ui->m_viewportSearch->setFixedWidth(190);
}
ViewportTitleDlg::~ViewportTitleDlg()
{
}
void ViewportTitleDlg::OnInitDialog()
{
m_ui->m_titleBtn->setText(m_title);
m_ui->m_sizeStaticCtrl->setText(QString());
connect(m_ui->m_maxBtn, &QToolButton::clicked, this, &ViewportTitleDlg::OnMaximize);
connect(m_ui->m_toggleHelpersBtn, &QToolButton::clicked, this, &ViewportTitleDlg::OnToggleHelpers);
connect(m_ui->m_toggleDisplayInfoBtn, &QToolButton::clicked, this, &ViewportTitleDlg::OnToggleDisplayInfo);
m_ui->m_maxBtn->setProperty("class", "big");
m_ui->m_toggleHelpersBtn->setProperty("class", "big");
m_ui->m_toggleDisplayInfoBtn->setProperty("class", "big");
}
void ViewportTitleDlg::SetTitle( const QString &title )
{
m_title = title;
m_ui->m_titleBtn->setText(m_title);
m_ui->m_viewportSearch->setVisible(title == QLatin1String("Perspective"));
}
void ViewportTitleDlg::OnMaximize()
{
}
void ViewportTitleDlg::OnToggleHelpers()
{
}
void ViewportTitleDlg::OnToggleDisplayInfo()
{
}
#include "StyleGallery/moc_ViewportTitleDlg.cpp"
@@ -1,36 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <QWidget>
#endif
namespace Ui
{
class ViewportTitleDlg;
}
class ViewportTitleDlg : public QWidget
{
Q_OBJECT
public:
ViewportTitleDlg(QWidget* pParent = nullptr);
virtual ~ViewportTitleDlg();
protected slots:
void OnMaximize();
void OnToggleHelpers();
void OnToggleDisplayInfo();
private:
void OnInitDialog();
void SetTitle(const QString &title);
QString m_title = QLatin1String("Perspective");
QScopedPointer<Ui::ViewportTitleDlg> m_ui;
};
@@ -1,225 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ViewportTitleDlg</class>
<widget class="QWidget" name="ViewportTitleDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>574</width>
<height>29</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,2,0,0,0,0,0,0,0,0,0,0,0">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="m_titleBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Static</string>
</property>
</widget>
</item>
<item>
<widget class="AzQtComponents::ToolButtonLineEdit" name="m_viewportSearch">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>147</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>147</width>
<height>22</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>FOV:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_fovStaticCtrl">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>120°</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Ratio:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_ratioStaticCtrl">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>000:000</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_sizeStaticCtrl">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>0000 x 0000</string>
</property>
</widget>
</item>
<item>
<widget class="AzQtComponents::ButtonDivider" name="divider1" native="true"/>
</item>
<item>
<widget class="QToolButton" name="m_toggleDisplayInfoBtn">
<property name="toolTip">
<string>Toggle display info</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/stylesheet/img/UI20/Info.svg</normaloff>:/stylesheet/img/UI20/Info.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="m_toggleHelpersBtn">
<property name="toolTip">
<string>Toggle display helpers</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/stylesheet/img/UI20/Helpers.svg</normaloff>:/stylesheet/img/UI20/Helpers.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="AzQtComponents::ButtonDivider" name="divider2" native="true"/>
</item>
<item>
<widget class="QToolButton" name="m_maxBtn">
<property name="icon">
<iconset>
<normaloff>:/stylesheet/img/16x16/Maximize.png</normaloff>:/stylesheet/img/16x16/Maximize.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="rightSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AzQtComponents::ToolButtonLineEdit</class>
<extends>QLineEdit</extends>
<header>AzQtComponents/Components/ToolButtonLineEdit.h</header>
</customwidget>
<customwidget>
<class>AzQtComponents::ButtonDivider</class>
<extends>QWidget</extends>
<header>AzQtComponents/Components/ButtonDivider.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -1,179 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="4.0527225mm"
height="4.0527225mm"
viewBox="0 0 14.36004 14.36004"
id="svg3348"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="assets.svg">
<defs
id="defs3350">
<linearGradient
inkscape:collect="always"
id="linearGradient4232">
<stop
style="stop-color:#7b7b7b;stop-opacity:1"
offset="0"
id="stop4234" />
<stop
style="stop-color:#666666;stop-opacity:1"
offset="1"
id="stop4236" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4232"
id="linearGradient4238"
x1="13.081557"
y1="1055.9957"
x2="13.081557"
y2="1070.327"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="25.755391"
inkscape:cx="19.18662"
inkscape:cy="25.784244"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata3353">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-0.31998014,-1037.6822)">
<ellipse
style="opacity:0;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#4e413a;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3356"
cx="27.955313"
cy="1029.9979"
rx="18.015646"
ry="19.879333" />
<ellipse
style="opacity:0;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#4e413a;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3358"
cx="26.091625"
cy="1032.4829"
rx="27.334084"
ry="23.606709" />
<ellipse
style="opacity:0;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#4e413a;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3360"
cx="6.2122917"
cy="1006.3912"
rx="41.001125"
ry="44.7285" />
<ellipse
style="opacity:0;fill:#417176;fill-opacity:0.44148937;fill-rule:evenodd;stroke:#4e413a;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4162"
cx="24.849167"
cy="1026.8918"
rx="16.773188"
ry="41.622353" />
<circle
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#3675dd;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4164"
cx="-4.3371701"
cy="1029.7621"
r="6.6800199"
inkscape:export-xdpi="94.010872"
inkscape:export-ydpi="94.010872"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/radio-hover.png" />
<ellipse
style="opacity:1;fill:#3675dd;fill-opacity:1;fill-rule:evenodd;stroke:#3675dd;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4164-1"
cx="24.819975"
cy="1043.5323"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/radio-selected.png"
rx="7.4999924"
ry="7.4999919" />
<circle
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#3675dd;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4164-5"
cx="26.94738"
cy="1025.5796"
r="7.4999933"
inkscape:export-xdpi="90.000015"
inkscape:export-ydpi="90.000015"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/radio-unselected.png" />
<circle
style="opacity:1;fill:url(#linearGradient4238);fill-opacity:1;fill-rule:evenodd;stroke:#3675dd;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4164-5-7"
cx="12.839327"
cy="1063.1339"
r="7.4999924"
inkscape:export-xdpi="90.000015"
inkscape:export-ydpi="90.000015"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/radio-disabled.png" />
<ellipse
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#3675dd;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4259"
cx="24.819977"
cy="1043.6315"
rx="2.9999933"
ry="3.139528"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/radio-selected.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<rect
style="fill:#4285f4;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4263"
width="10.999988"
height="10.999988"
x="7.7876616"
y="1014.0333"
rx="2.1999974"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/combo-checked.png"
inkscape:export-xdpi="90.000015"
inkscape:export-ydpi="90.000015" />
<path
style="fill:none;fill-rule:evenodd;stroke:#eeeeee;stroke-width:1.09999859;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 9.6716909,1020.2265 2.4883481,2.5829 c 4.574398,-6.5447 4.574398,-6.5447 4.574398,-6.5447"
id="path4269"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/combo-checked.png"
inkscape:export-xdpi="90.000015"
inkscape:export-ydpi="90.000015" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 7.3 KiB

@@ -1,176 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeploymentsWidget</class>
<widget class="QWidget" name="DeploymentsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>263</width>
<height>238</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>263</width>
<height>238</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>263</width>
<height>238</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<item>
<widget class="AzQtComponents::TitleBar" name="titlebar" native="true"/>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="contents" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>12</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>You must select a default deployment where
you would like to add these resurces.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="blueLabel">
<property name="text">
<string>Add a deployment</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>New deployment name 3</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>Deployment name 2</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_3">
<property name="text">
<string>Deployment name 1</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<item>
<widget class="QPushButton" name="deploymentO2">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="deploymentOk">
<property name="text">
<string>Ok</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AzQtComponents::TitleBar</class>
<extends>QWidget</extends>
<header>AzQtComponents/Components/Titlebar.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -1,300 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "mainwidget.h"
#include <AzCore/Component/ComponentApplication.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzQtComponents/Components/StyledDockWidget.h>
#include <AzQtComponents/Components/ToolButtonComboBox.h>
#include <AzQtComponents/Components/ToolButtonLineEdit.h>
#include <AzQtComponents/Components/WindowDecorationWrapper.h>
#include <AzQtComponents/Components/O3DEStylesheet.h>
#include "MyCombo.h"
#include <QPushButton>
#include <QDebug>
#include <QApplication>
#include <QStyleFactory>
#include <QMainWindow>
#include <QAction>
#include <QMenuBar>
#include <QToolBar>
#include <QDockWidget>
#include <QTextEdit>
#include <QComboBox>
#include <QToolButton>
#include <QVBoxLayout>
#include <QSettings>
#include <QDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <AzQtComponents/Components/StyledDetailsTableView.h>
#include <AzQtComponents/Components/StyledDetailsTableModel.h>
using namespace AzQtComponents;
QToolBar * toolBar()
{
auto t = new QToolBar(QString());
QAction *a = nullptr;
QMenu *menu = nullptr;
auto but = new QToolButton();
menu = new QMenu();
but->setMenu(menu);
but->setCheckable(true);
but->setPopupMode(QToolButton::MenuButtonPopup);
but->setDefaultAction(new QAction(QStringLiteral("Test"), but));
but->setIcon(QIcon(":/stylesheet/img/undo.png"));
t->addWidget(but);
a = t->addAction(QIcon(":/stylesheet/img/select.png"), QString());
a->setCheckable(true);
t->addSeparator();
auto tbcb = new AzQtComponents::ToolButtonComboBox();
tbcb->setIcon(QIcon(":/stylesheet/img/angle.png"));
tbcb->comboBox()->addItem("1");
tbcb->comboBox()->addItem("2");
tbcb->comboBox()->addItem("3");
tbcb->comboBox()->addItem("4");
t->addWidget(tbcb);
auto tble = new AzQtComponents::ToolButtonLineEdit();
tble->setFixedWidth(130);
tble->setIcon(QIcon(":/stylesheet/img/16x16/Search.png"));
t->addWidget(tble);
auto combo = new QComboBox();
combo->addItem("Test1");
combo->addItem("Test3");
combo->addItem("Selection,Area");
t->addWidget(combo);
const QStringList iconNames = {
"Align_object_to_surface",
"Align_to_grid",
"Align_to_Object",
"Angle",
"Asset_Browser",
"Audio",
"Database_view",
"Delete_named_selection",
"Follow_terrain",
"Freeze",
"Gepetto",
"Get_physics_state",
"Grid",
"layer_editor",
"layers",
"LIghting",
"lineedit-clear",
"LOD_generator",
"LUA",
"Material",
"Maximize",
"Measure",
"Move",
"Object_follow_terrain",
"Object_list",
"Redo",
"Reset_physics_state",
"Scale",
"select_object",
"Select",
"Select_terrain",
"Simulate_Physics_on_selected_objects",
"Substance",
"Terrain",
"Terrain_Texture",
"Texture_browser",
"Time_of_Day",
"Trackview",
"Translate",
"UI_editor",
"undo",
"Unfreeze_all",
"Vertex_snapping" };
for (auto name : iconNames) {
auto a2 = t->addAction(QIcon(QString(":/stylesheet/img/16x16/%1.png").arg(name)), nullptr);
a2->setToolTip(name);
a2->setDisabled(name == "Audio");
}
combo = new MyComboBox();
combo->addItem("Test1");
combo->addItem("Test3");
combo->addItem("Selection,Area");
t->addWidget(combo);
return t;
}
class MainWindow : public QMainWindow
{
public:
explicit MainWindow(QWidget *parent = nullptr)
: QMainWindow(parent)
, m_settings("org", "app")
{
setAttribute(Qt::WA_DeleteOnClose);
QVariant geoV = m_settings.value("geo");
if (geoV.isValid()) {
restoreGeometry(geoV.toByteArray());
}
}
~MainWindow()
{
qDebug() << "Deleted mainwindow";
auto geo = saveGeometry();
m_settings.setValue("geo", geo);
}
private:
QSettings m_settings;
};
static void addMenu(QMainWindow *w, const QString &name)
{
auto action = w->menuBar()->addAction(name);
auto menu = new QMenu();
action->setMenu(menu);
menu->addAction("Item 1");
menu->addAction("Item 2");
menu->addAction("Item 3");
menu->addAction("Longer item 4");
menu->addAction("Longer item 5");
}
int main(int argc, char **argv)
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
QApplication app(argc, argv);
AzQtComponents::O3DEStylesheet stylesheet(&app);
AZ::IO::FixedMaxPath engineRootPath;
{
AZ::ComponentApplication componentApplication(argc, argv);
auto settingsRegistry = AZ::SettingsRegistry::Get();
settingsRegistry->Get(engineRootPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder);
}
stylesheet.initialize(&app, engineRootPath);
auto wrapper = new AzQtComponents::WindowDecorationWrapper();
QMainWindow *w = new MainWindow();
w->setWindowTitle("Component Gallery");
auto widget = new MainWidget(w);
w->resize(550, 900);
w->setMinimumWidth(500);
wrapper->setGuest(w);
wrapper->enableSaveRestoreGeometry("app", "org", "windowGeometry");
w->setCentralWidget(widget);
w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnTopHint);
w->show();
auto action = w->menuBar()->addAction("Menu 1");
auto fileMenu = new QMenu();
action->setMenu(fileMenu);
auto openDock = fileMenu->addAction("Open dockwidget");
QObject::connect(openDock, &QAction::triggered, w, [&w] {
auto dock = new AzQtComponents::StyledDockWidget(QLatin1String("O3DE"), w);
auto button = new QPushButton("Click to dock");
auto wid = new QWidget();
auto widLayout = new QVBoxLayout(wid);
widLayout->addWidget(button);
wid->resize(300, 200);
QObject::connect(button, &QPushButton::clicked, dock, [dock]{
dock->setFloating(!dock->isFloating());
});
w->addDockWidget(Qt::BottomDockWidgetArea, dock);
dock->setWidget(wid);
dock->resize(300, 200);
dock->setFloating(true);
dock->show();
});
QAction* newAction = fileMenu->addAction("Test StyledDetailsTableView");
newAction->setShortcut(QKeySequence::Delete);
QObject::connect(newAction, &QAction::triggered, w, [w]() {
QDialog temp(w);
temp.setWindowTitle("StyleTableWidget Test");
QVBoxLayout* layout = new QVBoxLayout(&temp);
AzQtComponents::StyledDetailsTableModel* tableModel = new AzQtComponents::StyledDetailsTableModel();
tableModel->AddColumn("Status", AzQtComponents::StyledDetailsTableModel::StatusIcon);
tableModel->AddColumn("Platform");
tableModel->AddColumn("Message");
tableModel->AddColumnAlias("message", "Message");
tableModel->AddPrioritizedKey("Data3");
tableModel->AddDeprioritizedKey("Data1");
auto table = new AzQtComponents::StyledDetailsTableView();
table->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
table->setModel(tableModel);
{
AzQtComponents::StyledDetailsTableModel::TableEntry entry;
entry.Add("Message", "A very very long first message. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus et maximus tortor, ac commodo ante. Maecenas porta posuere mauris, vel consectetur arcu ornare interdum. Praesent rhoncus consequat neque, non volutpat mauris cursus a. Proin a nisl quis dui consectetur malesuada a et diam. Integer finibus luctus nibh nec cursus.");
entry.Add("Platform", "PC");
entry.Add("Status", AzQtComponents::StyledDetailsTableModel::StatusSuccess);
tableModel->AddEntry(entry);
}
{
AzQtComponents::StyledDetailsTableModel::TableEntry entry;
entry.Add("Message", "Second message. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus et maximus tortor, ac commodo ante. Maecenas porta posuere mauris, vel consectetur arcu ornare interdum. Praesent rhoncus consequat neque, non volutpat mauris cursus a. Proin a nisl quis dui consectetur malesuada a et diam. Integer finibus luctus nibh nec cursus.");
entry.Add("Platform", "PC");
entry.Add("Status", AzQtComponents::StyledDetailsTableModel::StatusError);
entry.Add("Data1", "Deprioritized item.");
entry.Add("Data3", "Prioritized item.");
tableModel->AddEntry(entry);
}
for (int i = 0; i < 4; i++)
{
AzQtComponents::StyledDetailsTableModel::TableEntry entry;
entry.Add("message", "Third message");
entry.Add("Status", AzQtComponents::StyledDetailsTableModel::StatusWarning);
entry.Add("Platform", "PC");
entry.Add("Index1", "A smaller detail.");
entry.Add("Index2", "Another small detail.");
entry.Add("Index3", "A final small detail.");
tableModel->AddEntry(entry);
}
layout->addWidget(table);
temp.exec();
});
QAction* refreshAction = fileMenu->addAction("Refresh Stylesheet");
QObject::connect(refreshAction, &QAction::triggered, refreshAction, [&stylesheet]() {
stylesheet.Refresh();
});
addMenu(w, "Menu 2");
addMenu(w, "Menu 3");
addMenu(w, "Menu 4");
w->addToolBar(toolBar());
QObject::connect(widget, &MainWidget::reloadCSS, widget, [] {
qDebug() << "Reloading CSS";
qApp->setStyleSheet(QString());
qApp->setStyleSheet("file:///style.qss");
});
return app.exec();
}
@@ -1,275 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "mainwidget.h"
#include <AzQtComponents/StyleGallery/ui_mainwidget.h>
#include <AzQtComponents/Components/ButtonStripe.h>
#include <AzQtComponents/Components/DockBarButton.h>
#include <QButtonGroup>
#include <QMenu>
#include <QMouseEvent>
#include <QStringList>
#include <QStandardItemModel>
#include <QMainWindow>
#include <QMenuBar>
#include <QDebug>
using namespace AzQtComponents;
MainWidget::MainWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::MainWidget)
{
ui->setupUi(this);
QStringList stripeButtonsNames = QStringList();
stripeButtonsNames << "Controls" << "ItemViews" << "Styles" << "Layouts";
ui->buttonStripe->addButtons(stripeButtonsNames, ui->stackedWidget->currentIndex());
connect(ui->buttonStripe, &AzQtComponents::ButtonStripe::buttonClicked,
ui->stackedWidget, &QStackedWidget::setCurrentIndex);
initializeControls();
initializeItemViews();
connect(ui->button1, &QPushButton::clicked, this, []{
auto mainwindow = new QMainWindow();
auto menu = new QMenu("File");
auto mb = new QMenuBar();
menu->addAction("Action1");
menu->addAction("Action2");
menu->addAction("Action3");
mb->addMenu(menu);
mb->addAction("Edit");
mb->addMenu("Create");
mb->addMenu("Select");
mb->addMenu("Modify");
mb->addMenu("Display");
mainwindow->setMenuBar(mb);
mainwindow->resize(400, 400);
mainwindow->show();
mainwindow->raise();
});
}
MainWidget::~MainWidget()
{
delete ui;
qDebug() << "Deleted main widget";
}
void MainWidget::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::MiddleButton) {
emit reloadCSS();
}
}
void MainWidget::initializeControls()
{
auto menu = new QMenu();
menu->addAction("Test 1");
menu->addAction("Test 2");
ui->button3->setMenu(menu);
auto menu2 = new QMenu();
menu2->addAction("Test 1");
menu2->addAction("Test 2");
ui->disabledButton3->setMenu(menu2);
ui->selectedCheckBox->setCheckState(Qt::Checked);
ui->enabledCheckBox->setCheckState(Qt::Unchecked);
ui->tristateCheckBox->setCheckState(Qt::PartiallyChecked);
// TODO: Move these into subclass, can't be done from .css
// Nicolas: or do it in the proxy style
// Sergio: css doesn't work well with proxy style , says Qt's docs.
ui->progressBar->setFormat(QString());
ui->progressBar->setMaximumHeight(8);
ui->progressBarFull->setFormat(QString());
ui->progressBarFull->setMaximumHeight(8);
ui->button2->setProperty("class", "Primary");
ui->disabledButton1->setProperty("class", "Primary");
ui->invalidLineEdit->setFlavor(AzQtComponents::StyledLineEdit::Invalid);
ui->validLineEdit->setFlavor(AzQtComponents::StyledLineEdit::Valid);
ui->questionLineEdit->setFlavor(AzQtComponents::StyledLineEdit::Question);
ui->infoLineEdit->setFlavor(AzQtComponents::StyledLineEdit::Information);
// In order to try out validator impact on flavor
ui->invalidLineEdit->setPlaceholderText("Enter 4 digits");
ui->invalidLineEdit->setValidator(new QRegExpValidator(QRegExp("[1-9]\\d{3,3}")));
ui->disabledVectorEdit->setColors(qRgb(84, 190, 93), qRgb(226, 82, 67), qRgb(66, 133, 244));
ui->vectorEdit->setColors(qRgb(84, 190, 93), qRgb(226, 82, 67), qRgb(66, 133, 244));
ui->unknownVectorEdit->setColors(qRgb(84, 190, 93), qRgb(226, 82, 67), qRgb(66, 133, 244));
ui->warningVectorEdit->setColors(qRgb(84, 190, 93), qRgb(226, 82, 67), qRgb(66, 133, 244));
ui->warningVectorEdit->setFlavor(AzQtComponents::VectorEditElement::Invalid);
QStringList rpy = {tr("R"), tr("P"), tr("Y")};
ui->disabledRPYVectorEdit->setLabels(rpy);
ui->rPYVectorEdit->setLabels(rpy);
ui->unknownRPYVectorEdit->setLabels(rpy);
ui->warningRPYVectorEdit->setLabels(rpy);
ui->filterNameLineEdit->setClearButtonEnabled(true);
ui->comboBox_4->setEnabled(false);
for (int i = 0; i < 10; ++i) {
ui->comboBox->addItem(QStringLiteral("combo 0: Item %1").arg(i));
ui->comboBox_2->addItem(QStringLiteral("combo 2: Item %1").arg(i));
ui->comboBox_3->addItem(QStringLiteral("combo 3: Item %1").arg(i));
ui->comboBox_4->addItem(QStringLiteral("combo 4: Item %1").arg(i));
ui->comboBox_5->addItem(QStringLiteral("combo 5: Item %1").arg(i));
ui->comboBox_6->addItem(QStringLiteral("combo 6: Item %1").arg(i));
}
ui->allCombo->setProperty("class", "condition");
ui->allCombo->setFixedWidth(37);
ui->allCombo->setFixedHeight(21);
ui->allCombo->addItem("all");
ui->allCombo->addItem("any");
// Construct the available tag list.
const int numAvailableTags = 128;
QVector<QString> availableTags;
availableTags.reserve(numAvailableTags+8);
availableTags.push_back("Healthy");
availableTags.push_back("Tired");
availableTags.push_back("Laughing");
availableTags.push_back("Happy");
availableTags.push_back("Smiling");
availableTags.push_back("Weapon Left");
availableTags.push_back("Weapon Right");
availableTags.push_back("Loooooooooooooooooong Tag");
for (const QString& tag : availableTags)
{
ui->searchWidget->AddTypeFilter("Foo", tag);
}
for (int i = 0; i < numAvailableTags; ++i)
{
QString tagName = "tag" + QString::number(i + 1);
availableTags.push_back(tagName);
if (i < 10)
{
ui->searchWidget->AddTypeFilter("Bar", tagName);
}
}
ui->tagSelector->Reinit(availableTags);
// Pre-select some of the tags.
ui->tagSelector->SelectTag("Healthy");
ui->tagSelector->SelectTag("Laughing");
ui->tagSelector->SelectTag("Smiling");
ui->tagSelector->SelectTag("Happy");
ui->tagSelector->SelectTag("Weapon Left");
ui->toolButton->setProperty("class", "QToolBar");
ui->toolButton_2->setProperty("class", "QToolBar");
ui->toolButton_3->setProperty("class", "QToolBar");
ui->toolButton_4->setProperty("class", "QToolBar");
ui->toolButton_5->setProperty("class", "QToolBar");
ui->toolButton_6->setProperty("class", "QToolBar");
ui->toolButton_7->setProperty("class", "QToolBar");
ui->toolButton_8->setProperty("class", "QToolBar");
ui->toolButton_9->setProperty("class", "QToolBar");
ui->toolButton_10->setProperty("class", "QToolBar");
ui->toolButton_11->setProperty("class", "QToolBar");
ui->toolButton_12->setProperty("class", "QToolBar");
ui->conditionGroup->appendCondition();
// place the viewportTitle menu into the place holder we prepared in the ui file
/*ViewportTitleDlg* viewPortTitleDlg = new ViewportTitleDlg(ui->ViewportTitle);
auto viewPortTitleLayout = new QHBoxLayout();
viewPortTitleLayout->addWidget(viewPortTitleDlg);
ui->ViewportTitle->setLayout(viewPortTitleLayout);*/
QStringList fontSizeMockup = {"8pt", "9pt", "10pt", "11pt", "12pt", "14pt", "16pt", "18pt", "24pt", "30pt",};
QStringList viewZoomMockup = {"20", "32", "40", "80", "160", "240"};
const auto tbcbList = ui->toolButtonsComboBoxWidget->findChildren<AzQtComponents::ToolButtonComboBox*>();
foreach (auto tbcb, tbcbList) {
if (tbcb->objectName().contains("1")) {
tbcb->setIcon(QIcon(QStringLiteral(":/stylesheet/img/16x16/Font_text.png")));
tbcb->comboBox()->addItems(fontSizeMockup);
} else if (tbcb->objectName().contains("2")) {
tbcb->setIcon(QIcon(QStringLiteral(":/stylesheet/img/16x16/Picture_view.png")));
tbcb->comboBox()->addItems(viewZoomMockup);
} else if (tbcb->objectName().contains("3")) {
tbcb->setIcon(QIcon(QStringLiteral(":/stylesheet/img/16x16/List_view.png")));
tbcb->comboBox()->addItems(fontSizeMockup);
}
}
ui->WidgetHeader1->setForceInactive(true);
ui->WidgetHeader1->setButtons({ AzQtComponents::DockBarButton::DividerButton, AzQtComponents::DockBarButton::MaximizeButton,
AzQtComponents::DockBarButton::DividerButton, AzQtComponents::DockBarButton::CloseButton });
ui->WidgetHeader1->setWindowTitleOverride("Widget Header");
ui->WidgetHeader2->setButtons({AzQtComponents::DockBarButton::DividerButton, AzQtComponents::DockBarButton::MaximizeButton,
AzQtComponents::DockBarButton::DividerButton, AzQtComponents::DockBarButton::CloseButton});
ui->WidgetHeader2->setWindowTitleOverride("Widget Header");
ui->NonDockableWidget1->setForceInactive(true);
ui->NonDockableWidget1->setWindowTitleOverride("Non-Dockable Widget");
ui->NonDockableWidget1->setButtons({ AzQtComponents::DockBarButton::CloseButton });
ui->NonDockableWidget1->setTearEnabled(false);
ui->NonDockableWidget1->setDragEnabled(false);
ui->NonDockableWidget2->setWindowTitleOverride("Non-Dockable Widget");
ui->NonDockableWidget2->setButtons({ AzQtComponents::DockBarButton::CloseButton });
ui->NonDockableWidget2->setTearEnabled(false);
ui->NonDockableWidget2->setDragEnabled(false);
const auto rpbList = ui->RoundedButtonWidget->findChildren<QPushButton*>();
foreach (auto rpb, rpbList) {
if (rpb->objectName().contains("Small"))
rpb->setProperty("class", "smallRounded");
else
rpb->setProperty("class", "rounded");
}
ui->buttonOrange1->setProperty("class", "Primary");
ui->buttonOrange2->setProperty("class", "Primary");
ui->tabWidget->tabBar()->setTabsClosable(true);
connect(ui->tabWidget->tabBar(), &QTabBar::tabCloseRequested, this, [this](int index) {
ui->tabWidget->removeTab(index);
});
}
void MainWidget::initializeItemViews()
{
auto model = new QStandardItemModel(this);
model->setHorizontalHeaderLabels({QString(), tr("Priority"), tr("State"), tr("ID"), tr("Completed"), tr("Platform")});
for (int i = 0; i < 20; ++i) {
auto col0Item = new QStandardItem();
col0Item->setCheckState(Qt::Checked);
col0Item->setData(QVariant(QSize(10, 20)), Qt::SizeHintRole);
col0Item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
auto col1Item = new QStandardItem((i < 10) ? tr("Top"): "");
model->appendRow({
col0Item,
col1Item,
new QStandardItem(i == 0 ? tr("Running") : (i < 10 ? tr("Failed") : tr("Waiting"))),
new QStandardItem("Environnment/Sky/Cloud/Cloudy-cloud"),
new QStandardItem(QString::number(i)),
new QStandardItem(i % 2 ? tr("Android") : tr("iPhone"))
});
}
ui->treeView->setModel(model);
ui->treeView->setSortingEnabled(true);
ui->treeView->setColumnWidth(0, 50);
}
#include "StyleGallery/moc_mainwidget.cpp"
@@ -1,40 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef MAINWIDGET_H
#define MAINWIDGET_H
#if !defined(Q_MOC_RUN)
#include <QWidget>
#endif
namespace Ui {
class MainWidget;
}
class MainWidget : public QWidget
{
Q_OBJECT
public:
explicit MainWidget(QWidget *parent = 0);
~MainWidget();
protected:
void mouseReleaseEvent(QMouseEvent *event) override;
private:
void initializeControls();
void initializeItemViews();
signals:
void reloadCSS();
private:
Ui::MainWidget *ui;
};
#endif // MAINWIDGET_H
File diff suppressed because it is too large Load Diff
@@ -1,138 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
viewBox="0 0 744.09448819 1052.3622047"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="triangles.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="31.678384"
inkscape:cx="175.07984"
inkscape:cy="551.37808"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="58"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
sodipodi:type="star"
style="fill:#cccccc;fill-rule:evenodd;stroke:#9d9e9f;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1;opacity:1"
id="path3344"
sodipodi:sides="3"
sodipodi:cx="380"
sodipodi:cy="403.79077"
sodipodi:r1="243.10912"
sodipodi:r2="121.55456"
sodipodi:arg1="0.51623067"
sodipodi:arg2="1.5634282"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 591.42857,523.79077 380.89562,525.34203 170.36266,526.89329 274.28571,343.79077 378.20876,160.68825 484.81867,342.23951 Z"
inkscape:transform-center-x="0.016954397"
inkscape:transform-center-y="0.65189465"
transform="matrix(-0.01892764,0,0,-0.01086489,180.59057,495.21492)"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
sodipodi:type="star"
style="opacity:1;fill:#737475;fill-opacity:1;fill-rule:evenodd;stroke:#575859;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path3344-5"
sodipodi:sides="3"
sodipodi:cx="380"
sodipodi:cy="403.79077"
sodipodi:r1="243.10912"
sodipodi:r2="121.55456"
sodipodi:arg1="0.51623067"
sodipodi:arg2="1.5634282"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 591.42857,523.79077 380.89562,525.34203 170.36266,526.89329 274.28571,343.79077 378.20876,160.68825 484.81867,342.23951 Z"
inkscape:transform-center-x="0.016954397"
inkscape:transform-center-y="0.65189465"
transform="matrix(-0.01892764,0,0,-0.01086489,185.09108,503.38349)"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
sodipodi:type="star"
style="opacity:1;fill:#323334;fill-opacity:1;fill-rule:evenodd;stroke:#959595;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path3344-5-8"
sodipodi:sides="3"
sodipodi:cx="380"
sodipodi:cy="403.79077"
sodipodi:r1="243.10912"
sodipodi:r2="121.55456"
sodipodi:arg1="0.51623067"
sodipodi:arg2="1.5634282"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 591.42857,523.79077 380.89562,525.34203 170.36266,526.89329 274.28571,343.79077 378.20876,160.68825 484.81867,342.23951 Z"
inkscape:transform-center-x="0.016954397"
inkscape:transform-center-y="0.65189465"
transform="matrix(-0.01892764,0,0,-0.01086489,170.507,509.8342)"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
inkscape:export-filename="C:\d\projects\amazon-style\img\triangle3.png" />
<path
sodipodi:type="star"
style="opacity:1;fill:#323334;fill-opacity:1;fill-rule:evenodd;stroke:#959595;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path3344-5-1"
sodipodi:sides="3"
sodipodi:cx="380"
sodipodi:cy="403.79077"
sodipodi:r1="243.10912"
sodipodi:r2="121.55456"
sodipodi:arg1="0.51623067"
sodipodi:arg2="1.5634282"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 591.42857,523.79077 380.89562,525.34203 170.36266,526.89329 274.28571,343.79077 378.20876,160.68825 484.81867,342.23951 Z"
inkscape:transform-center-x="-0.0169559"
inkscape:transform-center-y="-0.65188753"
transform="matrix(0.01892764,0,0,0.01086489,156.12199,496.40855)"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
inkscape:export-filename="C:\d\projects\amazon-style\img\double_triangles.png" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.2 KiB

@@ -1,25 +0,0 @@
#
# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
set(FILES
StyleGallery/ConditionGroupWidget.cpp
StyleGallery/ConditionGroupWidget.h
StyleGallery/ConditionWidget.cpp
StyleGallery/ConditionWidget.h
StyleGallery/DeploymentsWidget.cpp
StyleGallery/DeploymentsWidget.h
StyleGallery/deploymentswidget.ui
StyleGallery/main.cpp
StyleGallery/mainwidget.cpp
StyleGallery/mainwidget.h
StyleGallery/mainwidget.ui
StyleGallery/MyCombo.cpp
StyleGallery/MyCombo.h
StyleGallery/ViewportTitleDlg.cpp
StyleGallery/ViewportTitleDlg.h
StyleGallery/ViewportTitleDlg.ui
)
+1 -19
View File
@@ -40,26 +40,8 @@ ly_add_target(
AZ::AzCore
)
# DEPRECATED: this target was marked as deprecated in the VS filter
ly_add_target(
NAME AmazonStyle APPLICATION
NAMESPACE AZ
AUTOMOC
AUTOUIC
FILES_CMAKE
AzQtComponents/azqtcomponents_style_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
.
AzQtComponents
BUILD_DEPENDENCIES
PRIVATE
3rdParty::Qt::Widgets
AZ::AzQtComponents
)
ly_add_target(
NAME AmazonQtControlGallery APPLICATION
NAME O3DEQtControlGallery APPLICATION
NAMESPACE AZ
AUTOMOC
AUTOUIC
@@ -45,6 +45,7 @@
#include <AzToolsFramework/UI/UICore/QTreeViewStateSaver.hxx>
#include <AzToolsFramework/UI/UICore/QWidgetSavedState.h>
#include <AzToolsFramework/UI/UICore/ProgressShield.hxx>
#include <AzToolsFramework/UI/UICore/WidgetHelpers.h>
#include <AzToolsFramework/Slice/SliceUtilities.h>
#include <AzToolsFramework/ToolsComponents/EditorInspectorComponent.h>
#include <AzToolsFramework/API/ComponentEntityObjectBus.h>
@@ -1589,7 +1590,13 @@ namespace AzToolsFramework
// Multiple changes to the same entity are just split between different undo nodes.
for (AZ::EntityId entityId : m_dirtyEntities)
{
prefabPublicInterface->GenerateUndoNodesForEntityChangeAndUpdateCache(entityId, m_currentBatchUndo);
auto outcome = prefabPublicInterface->GenerateUndoNodesForEntityChangeAndUpdateCache(entityId, m_currentBatchUndo);
if (!outcome.IsSuccess())
{
QMessageBox::warning(
AzToolsFramework::GetActiveWindow(), QString("Error"), QString(outcome.GetError().c_str()), QMessageBox::Ok, QMessageBox::Ok);
}
}
}
}
@@ -587,21 +587,21 @@ namespace AzToolsFramework
return AZ::Success(entityId);
}
void PrefabPublicHandler::GenerateUndoNodesForEntityChangeAndUpdateCache(
PrefabOperationResult PrefabPublicHandler::GenerateUndoNodesForEntityChangeAndUpdateCache(
AZ::EntityId entityId, UndoSystem::URSequencePoint* parentUndoBatch)
{
// Create Undo node on entities if they belong to an instance
InstanceOptionalReference owningInstance = m_instanceEntityMapperInterface->FindOwningInstance(entityId);
if (!owningInstance.has_value())
{
return;
return AZ::Success();
}
AZ::Entity* entity = GetEntityById(entityId);
if (!entity)
{
m_prefabUndoCache.PurgeCache(entityId);
return;
return AZ::Success();
}
PrefabDom beforeState;
@@ -633,6 +633,41 @@ namespace AzToolsFramework
(&beforeOwningInstance->get() != &afterOwningInstance->get()))
{
isNewParentOwnedByDifferentInstance = true;
// Detect loops. Assert if an instance has been reparented in such a way to generate circular dependencies.
AZStd::vector<Instance*> instancesInvolved;
if (isInstanceContainerEntity)
{
instancesInvolved.push_back(&owningInstance->get());
}
else
{
// Retrieve all nested instances that are part of the subtree under the current entity.
EntityList entities;
RetrieveAndSortPrefabEntitiesAndInstances({ entity }, beforeOwningInstance->get(), entities, instancesInvolved);
}
for (Instance* instance : instancesInvolved)
{
const PrefabDom& templateDom =
m_prefabSystemComponentInterface->FindTemplateDom(instance->GetTemplateId());
AZStd::unordered_set<AZ::IO::Path> templatePaths;
PrefabDomUtils::GetTemplateSourcePaths(templateDom, templatePaths);
if (IsCyclicalDependencyFound(afterOwningInstance->get(), templatePaths))
{
// Cancel the operation by restoring the previous parent
AZ::TransformBus::Event(entityId, &AZ::TransformBus::Events::SetParent, beforeParentId);
m_prefabUndoCache.UpdateCache(entityId);
// Skip the creation of an undo node
return AZ::Failure(AZStd::string::format(
"Reparent Prefab operation aborted - Cyclical dependency detected\n(%s depends on %s).",
instance->GetTemplateSourcePath().Native().c_str(),
afterOwningInstance->get().GetTemplateSourcePath().Native().c_str()));
}
}
}
}
@@ -673,6 +708,8 @@ namespace AzToolsFramework
}
m_prefabUndoCache.UpdateCache(entityId);
return AZ::Success();
}
void PrefabPublicHandler::Internal_HandleContainerOverride(
@@ -46,7 +46,7 @@ namespace AzToolsFramework
PrefabOperationResult SavePrefab(AZ::IO::Path filePath) override;
PrefabEntityResult CreateEntity(AZ::EntityId parentId, const AZ::Vector3& position) override;
void GenerateUndoNodesForEntityChangeAndUpdateCache(AZ::EntityId entityId, UndoSystem::URSequencePoint* parentUndoBatch) override;
PrefabOperationResult GenerateUndoNodesForEntityChangeAndUpdateCache(AZ::EntityId entityId, UndoSystem::URSequencePoint* parentUndoBatch) override;
bool IsInstanceContainerEntity(AZ::EntityId entityId) const override;
bool IsLevelInstanceContainerEntity(AZ::EntityId entityId) const override;
@@ -79,8 +79,9 @@ namespace AzToolsFramework
*
* @param entityId The entity to patch.
* @param parentUndoBatch The undo batch the undo nodes should be parented to.
* @return Returns Success if the node was generated correctly, or an error message otherwise.
*/
virtual void GenerateUndoNodesForEntityChangeAndUpdateCache(
virtual PrefabOperationResult GenerateUndoNodesForEntityChangeAndUpdateCache(
AZ::EntityId entityId, UndoSystem::URSequencePoint* parentUndoBatch) = 0;
/**
@@ -46,10 +46,11 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
}
}
template<typename EntityPtr>
void OrganizeEntitiesForSorting(
AzFramework::Spawnable::EntityList& entities,
AZStd::vector<EntityPtr>& entities,
AZStd::unordered_set<AZ::EntityId>& existingEntityIds,
AZStd::unordered_map<AZ::EntityId, AzFramework::Spawnable::EntityList>& parentIdToChildren,
AZStd::unordered_map<AZ::EntityId, AZStd::vector<EntityPtr>>& parentIdToChildren,
AZStd::vector<AZ::EntityId>& candidateIds,
size_t& removedEntitiesCount)
{
@@ -90,7 +91,7 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
// entities with no transform component will be treated like entities with no parent.
AZ::EntityId parentId;
if (AZ::TransformInterface* transformInterface =
AZ::EntityUtils::FindFirstDerivedComponent<AZ::TransformInterface>(entity.get()))
AZ::EntityUtils::FindFirstDerivedComponent<AZ::TransformInterface>(&(*entity)))
{
parentId = transformInterface->GetParentId();
if (parentId == entityId)
@@ -104,8 +105,7 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
}
auto& children = parentIdToChildren[parentId];
children.emplace_back(nullptr);
children.back().swap(entity);
children.emplace_back(AZStd::move(entity));
}
// clear 'entities', we'll refill it in sorted order.
@@ -125,9 +125,10 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
}
template<typename EntityPtr>
void TraceParentingLoop(
const AZ::EntityId& parentFromLoopId,
const AZStd::unordered_map<AZ::EntityId, AzFramework::Spawnable::EntityList>& parentIdToChildren)
const AZStd::unordered_map<AZ::EntityId, AZStd::vector<EntityPtr>>& parentIdToChildren)
{
// Find name to use in warning message
@@ -153,16 +154,22 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
parentFromLoopId.ToString().c_str());
}
void SortEntitiesByTransformHierarchy(AzFramework::Spawnable& spawnable)
{
auto& entities = spawnable.GetEntities();
SortEntitiesByTransformHierarchy(spawnable.GetEntities());
}
template<typename EntityPtr>
void SortEntitiesByTransformHierarchy(AZStd::vector<EntityPtr>& entities)
{
const size_t originalEntityCount = entities.size();
// IDs of those present in 'entities'. Does not include parent ID if parent not found in 'entities'
AZStd::unordered_set<AZ::EntityId> existingEntityIds;
// map children by their parent ID (even if parent not found in 'entities')
AZStd::unordered_map<AZ::EntityId, AzFramework::Spawnable::EntityList> parentIdToChildren;
AZStd::unordered_map<AZ::EntityId, AZStd::vector<EntityPtr>> parentIdToChildren;
// use 'candidateIds' to track the parent IDs we're going to process next.
AZStd::vector<AZ::EntityId> candidateIds;
@@ -199,8 +206,7 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
for (auto& child : foundChildren->second)
{
candidateIds.push_back(child->GetId());
entities.emplace_back(nullptr);
entities.back().swap(child);
entities.emplace_back(AZStd::move(child));
}
parentIdToChildren.erase(foundChildren);
@@ -217,4 +223,7 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
}
// Explicit specializations of SortEntitiesByTransformHierarchy (have to be in cpp due to clang errors)
template void SortEntitiesByTransformHierarchy(AZStd::vector<AZ::Entity*>& entities);
template void SortEntitiesByTransformHierarchy(AZStd::vector<AZStd::unique_ptr<AZ::Entity>>& entities);
} // namespace AzToolsFramework::Prefab::SpawnableUtils
@@ -16,4 +16,8 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
bool CreateSpawnable(AzFramework::Spawnable& spawnable, const PrefabDom& prefabDom, AZStd::vector<AZ::Data::Asset<AZ::Data::AssetData>>& referencedAssets);
void SortEntitiesByTransformHierarchy(AzFramework::Spawnable& spawnable);
template <typename EntityPtr>
void SortEntitiesByTransformHierarchy(AZStd::vector<EntityPtr>& entities);
} // namespace AzToolsFramework::Prefab::SpawnableUtils
@@ -87,24 +87,24 @@ AzToolsFramework--EntityOutlinerCheckBox#VisibilityMixed::indicator:checked
AzToolsFramework--EntityOutlinerCheckBox#Visibility::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityMixed::indicator:checked
{
image: url(:/visibility_default.svg);
image: url(:/Outliner/visibility_default.svg);
}
AzToolsFramework--EntityOutlinerCheckBox#Visibility::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityMixed::indicator:unchecked
{
image: url(:/visibility_on.svg);
image: url(:/Outliner/visibility_on.svg);
margin-top: 3px;
}
AzToolsFramework--EntityOutlinerCheckBox#VisibilityOverridden::indicator:checked
{
image: url(:/visibility_default_transparent.svg);
image: url(:/Outliner/visibility_default_transparent.svg);
}
AzToolsFramework--EntityOutlinerCheckBox#VisibilityOverridden::indicator:unchecked
{
image: url(:/visibility_on_transparent.svg);
image: url(:/Outliner/visibility_on_transparent.svg);
margin-top: 3px;
}
@@ -112,7 +112,7 @@ AzToolsFramework--EntityOutlinerCheckBox#VisibilityHover::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityMixedHover::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityOverriddenHover::indicator:checked
{
image: url(:/visibility_default_hover.svg);
image: url(:/Outliner/visibility_default_hover.svg);
margin-top: 3px;
}
@@ -120,7 +120,7 @@ AzToolsFramework--EntityOutlinerCheckBox#VisibilityHover::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityMixedHover::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityOverriddenHover::indicator:unchecked
{
image: url(:/visibility_on_hover.svg);
image: url(:/Outliner/visibility_on_hover.svg);
margin-top: 3px;
}
@@ -130,24 +130,24 @@ AzToolsFramework--EntityOutlinerCheckBox#VisibilityHover::indicator:unchecked
AzToolsFramework--EntityOutlinerCheckBox#Lock::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#LockMixed::indicator:checked
{
image: url(:/lock_on.svg);
image: url(:/Outliner/lock_on.svg);
margin-top: 1px;
}
AzToolsFramework--EntityOutlinerCheckBox#Lock::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#LockMixed::indicator:unchecked
{
image: url(:/lock_default.svg);
image: url(:/Outliner/lock_default.svg);
}
AzToolsFramework--EntityOutlinerCheckBox#LockOverridden::indicator:checked
{
image: url(:/lock_on_transparent.svg);
image: url(:/Outliner/lock_on_transparent.svg);
}
AzToolsFramework--EntityOutlinerCheckBox#LockOverridden::indicator:unchecked
{
image: url(:/lock_default_transparent.svg);
image: url(:/Outliner/lock_default_transparent.svg);
margin-top: 1px;
}
@@ -155,7 +155,7 @@ AzToolsFramework--EntityOutlinerCheckBox#LockHover::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#LockMixedHover::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#LockOverriddenHover::indicator:checked
{
image: url(:/lock_on_hover.svg);
image: url(:/Outliner/lock_on_hover.svg);
margin-top: 1px;
}
@@ -163,6 +163,6 @@ AzToolsFramework--EntityOutlinerCheckBox#LockHover::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#LockMixedHover::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#LockOverriddenHover::indicator:unchecked
{
image: url(:/lock_default_hover.svg);
image: url(:/Outliner/lock_default_hover.svg);
margin-top: 1px;
}
@@ -17,15 +17,15 @@ namespace AzToolsFramework
DisplayOptionsMenu::DisplayOptionsMenu(QWidget* parent)
: QMenu(parent)
{
auto sortManually = addAction(QIcon(QStringLiteral(":/sort_manually.svg")), tr("Sort: Manually"));
auto sortManually = addAction(QIcon(QStringLiteral(":/Outliner/sort_manually.svg")), tr("Sort: Manually"));
sortManually->setData(static_cast<int>(DisplaySortMode::Manually));
sortManually->setCheckable(true);
auto sortAtoZ = addAction(QIcon(QStringLiteral(":/sort_a_to_z.svg")), tr("Sort: A to Z"));
auto sortAtoZ = addAction(QIcon(QStringLiteral(":/Outliner/sort_a_to_z.svg")), tr("Sort: A to Z"));
sortAtoZ->setData(static_cast<int>(DisplaySortMode::AtoZ));
sortAtoZ->setCheckable(true);
auto sortZtoA = addAction(QIcon(QStringLiteral(":/sort_z_to_a.svg")), tr("Sort: Z to A"));
auto sortZtoA = addAction(QIcon(QStringLiteral(":/Outliner/sort_z_to_a.svg")), tr("Sort: Z to A"));
sortZtoA->setData(static_cast<int>(DisplaySortMode::ZtoA));
sortZtoA->setCheckable(true);
@@ -36,18 +36,29 @@ namespace AzToolsFramework
{
}
bool EntityOutlinerSearchTypeSelector::filterItemOut(int unfilteredDataIndex, bool itemMatchesFilter, bool categoryMatchesFilter)
bool EntityOutlinerSearchTypeSelector::filterItemOut(const QModelIndex& sourceIndex, bool filteredByBase)
{
bool unfilteredIndexInvalid = (unfilteredDataIndex >= aznumeric_cast<int>(EntityOutlinerSearchWidget::GlobalSearchCriteria::FirstRealFilter));
return SearchTypeSelector::filterItemOut(unfilteredDataIndex, itemMatchesFilter, categoryMatchesFilter) && unfilteredIndexInvalid;
auto* currItem = m_model->itemFromIndex(sourceIndex);
if (currItem != nullptr)
{
int unfilteredIndex = getUnfilteredDataIndex(currItem);
if (unfilteredIndex >= 0 && unfilteredIndex < aznumeric_cast<int>(EntityOutlinerSearchWidget::GlobalSearchCriteria::FirstRealFilter))
{
// never filter out the categories before FirstRealFilter (unlocked/locked, visible/hidden, etc.)
return false;
}
}
// no special case, return the result of the base filter
return filteredByBase;
}
void EntityOutlinerSearchTypeSelector::initItem(QStandardItem* item, const AzQtComponents::SearchTypeFilter& filter, int unfilteredDataIndex)
{
if (filter.displayName != "--------")
SearchTypeSelector::initItem(item, filter, unfilteredDataIndex);
if (filter.displayName == "--------")
{
item->setCheckable(true);
item->setCheckState(filter.enabled ? Qt::Checked : Qt::Unchecked);
SearchTypeSelector::initItem(item, filter, unfilteredDataIndex);
item->setCheckable(false);
}
if (unfilteredDataIndex < aznumeric_cast<int>(EntityOutlinerSearchWidget::GlobalSearchCriteria::FirstRealFilter))
@@ -39,8 +39,8 @@ namespace AzToolsFramework
EntityOutlinerSearchTypeSelector(QWidget* parent = nullptr);
protected:
// can be used to override the logic when adding items in RepopulateDataModel
bool filterItemOut(int unfilteredDataIndex, bool itemMatchesFilter, bool categoryMatchesFilter) override;
// override the logic of accepting filter categories
bool filterItemOut(const QModelIndex& sourceIndex, bool filteredByBase) override;
void initItem(QStandardItem* item, const AzQtComponents::SearchTypeFilter& filter, int unfilteredDataIndex) override;
int GetNumFixedItems() override;
};
@@ -48,6 +48,12 @@
#include <AzToolsFramework/UI/Outliner/ui_EntityOutlinerWidget.h>
// This has to live outside of any namespaces due to issues on Linux with calls to Q_INIT_RESOURCE if they are inside a namespace
void initEntityOutlinerWidgetResources()
{
Q_INIT_RESOURCE(resources);
}
namespace
{
const int queuedChangeDelay = 16; // milliseconds
@@ -143,6 +149,8 @@ namespace AzToolsFramework
, m_sortContentQueued(false)
, m_dropOperationInProgress(false)
{
initEntityOutlinerWidgetResources();
m_gui = new Ui::EntityOutlinerWidgetUI();
m_gui->setupUi(this);
@@ -20,14 +20,6 @@ struct IUiAnimationSystem;
class UiCanvasInterface
: public AZ::ComponentBus
{
public: // types
enum class ErrorCode
{
NoError,
PrefabContainsExternalEntityRefs
};
public: // member functions
//! Deleting a canvas will delete all its child elements recursively and all of their components
@@ -110,23 +102,6 @@ public: // member functions
//! \return true if no error
virtual bool SaveToXml(const string& assetIdPathname, const string& sourceAssetPathname) = 0;
//! Save the given UI element entity to the given path as a prefab
//! \param pathname the path to save the prefab to
//! \param entity pointer to the entity to save as a prefab
//! \return true if no error
virtual bool SaveAsPrefab(const string& pathname, AZ::Entity* entity) = 0;
//! Check if it is OK to save the given UI element entity to the given path as a prefab
//! \param entity pointer to the entity to save as a prefab
//! \return errorCode which is NoError if OK to save
virtual ErrorCode CheckElementValidToSaveAsPrefab(AZ::Entity* entity) = 0;
//! Load a prefab element from the given file and optionally insert as child of given entity
//! \return the top level entity created
virtual AZ::Entity* LoadFromPrefab(const string& pathname,
bool makeUniqueName,
AZ::Entity* optionalInsertionPoint) = 0;
//! Initialize a set of entities that have been added to the canvas
//! Used when instantiating a slice or for undo/redo, copy/paste
//! \param topLevelEntities - The elements that were created
@@ -2548,7 +2548,7 @@ namespace AssetProcessor
jobdetail.m_jobParam[AZ_CRC(AutoFailReasonKey)] = AZStd::string::format(
"Source file ( %s ) contains non ASCII characters.\n"
"Open 3D Engine currently only supports file paths having ASCII characters and therefore asset processor will not be able to process this file.\n"
"O3DE currently only supports file paths having ASCII characters and therefore asset processor will not be able to process this file.\n"
"Please rename the source file to fix this error.\n",
normalizedPath.toUtf8().data());
@@ -10,6 +10,7 @@
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UserSettings/UserSettingsComponent.h>
#include <AzCore/IO/FileIOEventBus.h>
#include <AzCore/Utils/Utils.h>
#include "BaseAssetProcessorTest.h"
#include <native/utilities/BatchApplicationManager.h>
@@ -67,11 +68,19 @@ namespace AssetProcessor
static char** paramStringArray = &namePtr;
auto registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
auto bootstrapKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey);
auto projectPathKey = bootstrapKey + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
// Forcing the branch token into settings registry before starting the application manager.
// This avoids writing the asset_processor.setreg file which can cause fileIO errors.
AZ::IO::FixedMaxPathString enginePath = AZ::Utils::GetEnginePath();
auto branchTokenKey = bootstrapKey + "/assetProcessor_branch_token";
AZStd::string token;
AzFramework::StringFunc::AssetPath::CalculateBranchToken(enginePath.c_str(), token);
registry->Set(branchTokenKey, token.c_str());
m_application.reset(new UnitTestAppManager(&numParams, &paramStringArray));
ASSERT_EQ(m_application->BeforeRun(), ApplicationManager::Status_Success);
ASSERT_TRUE(m_application->PrepareForTests());
@@ -84,7 +93,10 @@ namespace AssetProcessor
AssetProcessorTest::TearDown();
}
void OnError([[maybe_unused]] const AZ::IO::SystemFile* file, const char* fileName, int errorCode) override
void OnError(
[[maybe_unused]] const AZ::IO::SystemFile* file,
[[maybe_unused]] const char* fileName,
[[maybe_unused]] int errorCode) override
{
AZ_Error("LegacyTestAdapter", false, "File error detected with %s with code %d", fileName, errorCode);
}
@@ -17,7 +17,7 @@
</size>
</property>
<property name="windowTitle">
<string>Asset Processor</string>
<string>O3DE Asset Processor</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout_1" stretch="0,1">
@@ -446,7 +446,7 @@ void ApplicationManager::PopulateApplicationDependencies()
// any of those should cause AP to drop.
for (const QString& pathName : { "CrySystem",
"SceneCore", "SceneData",
"FbxSceneBuilder", "AzQtComponents"
"SceneBuilder", "AzQtComponents"
})
{
QString pathWithPlatformExtension = pathName + QString(AZ_DYNAMIC_LIBRARY_EXTENSION);
@@ -478,7 +478,7 @@ void ApplicationManagerBase::InitConnectionManager()
result = QObject::connect(GetRCController(), &AssetProcessor::RCController::JobStarted, this,
[](QString inputFile, QString platform)
{
QString msg = QCoreApplication::translate("Asset Processor", "Processing %1 (%2)...\n", "%1 is the name of the file, and %2 is the platform to process it for").arg(inputFile, platform);
QString msg = QCoreApplication::translate("O3DE Asset Processor", "Processing %1 (%2)...\n", "%1 is the name of the file, and %2 is the platform to process it for").arg(inputFile, platform);
AZ_Printf(AssetProcessor::ConsoleChannel, "%s", msg.toUtf8().constData());
AssetNotificationMessage message(inputFile.toUtf8().constData(), AssetNotificationMessage::JobStarted, AZ::Data::s_invalidAssetType, platform.toUtf8().constData());
EBUS_EVENT(AssetProcessor::ConnectionBus, SendPerPlatform, 0, message, platform);
@@ -7,4 +7,5 @@
set(FILES
Python_linux.cpp
ProjectBuilderWorker_linux.cpp
)
@@ -0,0 +1,19 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <ProjectBuilderWorker.h>
namespace O3DE::ProjectManager
{
AZ::Outcome<void, QString> ProjectBuilderWorker::BuildProjectForPlatform()
{
QString error = tr("Automatic building on Linux not currently supported!");
QStringToAZTracePrint(error);
return AZ::Failure(error);
}
} // namespace O3DE::ProjectManager
@@ -7,4 +7,5 @@
set(FILES
Python_mac.cpp
ProjectBuilderWorker_mac.cpp
)
@@ -0,0 +1,19 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <ProjectBuilderWorker.h>
namespace O3DE::ProjectManager
{
AZ::Outcome<void, QString> ProjectBuilderWorker::BuildProjectForPlatform()
{
QString error = tr("Automatic building on MacOS not currently supported!");
QStringToAZTracePrint(error);
return AZ::Failure(error);
}
} // namespace O3DE::ProjectManager
@@ -7,4 +7,5 @@
set(FILES
Python_windows.cpp
ProjectBuilderWorker_windows.cpp
)
@@ -0,0 +1,175 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <ProjectBuilderWorker.h>
#include <ProjectManagerDefs.h>
#include <PythonBindingsInterface.h>
#include <QDir>
#include <QFile>
#include <QProcess>
#include <QProcessEnvironment>
#include <QTextStream>
#include <QThread>
namespace O3DE::ProjectManager
{
AZ::Outcome<void, QString> ProjectBuilderWorker::BuildProjectForPlatform()
{
// Check if we are trying to cancel task
if (QThread::currentThread()->isInterruptionRequested())
{
QStringToAZTracePrint(BuildCancelled);
return AZ::Failure(BuildCancelled);
}
QFile logFile(GetLogFilePath());
if (!logFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate))
{
QString error = tr("Failed to open log file.");
QStringToAZTracePrint(error);
return AZ::Failure(error);
}
EngineInfo engineInfo;
AZ::Outcome<EngineInfo> engineInfoResult = PythonBindingsInterface::Get()->GetEngineInfo();
if (engineInfoResult.IsSuccess())
{
engineInfo = engineInfoResult.GetValue();
}
else
{
QString error = tr("Failed to get engine info.");
QStringToAZTracePrint(error);
return AZ::Failure(error);
}
QTextStream logStream(&logFile);
if (QThread::currentThread()->isInterruptionRequested())
{
logFile.close();
QStringToAZTracePrint(BuildCancelled);
return AZ::Failure(BuildCancelled);
}
// Show some kind of progress with very approximate estimates
UpdateProgress(++m_progressEstimate);
QProcessEnvironment currentEnvironment(QProcessEnvironment::systemEnvironment());
// Append cmake path to PATH incase it is missing
QDir cmakePath(engineInfo.m_path);
cmakePath.cd("cmake/runtime/bin");
QString pathValue = currentEnvironment.value("PATH");
pathValue += ";" + cmakePath.path();
currentEnvironment.insert("PATH", pathValue);
m_configProjectProcess = new QProcess(this);
m_configProjectProcess->setProcessChannelMode(QProcess::MergedChannels);
m_configProjectProcess->setWorkingDirectory(m_projectInfo.m_path);
m_configProjectProcess->setProcessEnvironment(currentEnvironment);
m_configProjectProcess->start(
"cmake",
QStringList{ "-B", QDir(m_projectInfo.m_path).filePath(ProjectBuildPathPostfix), "-S", m_projectInfo.m_path, "-G",
"Visual Studio 16", "-DLY_3RDPARTY_PATH=" + engineInfo.m_thirdPartyPath });
if (!m_configProjectProcess->waitForStarted())
{
QString error = tr("Configuring project failed to start.");
QStringToAZTracePrint(error);
return AZ::Failure(error);
}
bool containsGeneratingDone = false;
while (m_configProjectProcess->waitForReadyRead(MaxBuildTimeMSecs))
{
QString configOutput = m_configProjectProcess->readAllStandardOutput();
if (configOutput.contains("Generating done"))
{
containsGeneratingDone = true;
}
logStream << configOutput;
logStream.flush();
UpdateProgress(qMin(++m_progressEstimate, 19));
if (QThread::currentThread()->isInterruptionRequested())
{
logFile.close();
m_configProjectProcess->close();
QStringToAZTracePrint(BuildCancelled);
return AZ::Failure(BuildCancelled);
}
}
if (m_configProjectProcess->exitCode() != 0 || !containsGeneratingDone)
{
QString error = tr("Configuring project failed. See log for details.");
QStringToAZTracePrint(error);
return AZ::Failure(error);
}
UpdateProgress(++m_progressEstimate);
m_buildProjectProcess = new QProcess(this);
m_buildProjectProcess->setProcessChannelMode(QProcess::MergedChannels);
m_buildProjectProcess->setWorkingDirectory(m_projectInfo.m_path);
m_buildProjectProcess->setProcessEnvironment(currentEnvironment);
m_buildProjectProcess->start(
"cmake",
QStringList{ "--build", QDir(m_projectInfo.m_path).filePath(ProjectBuildPathPostfix), "--target",
m_projectInfo.m_projectName + ".GameLauncher", "Editor", "--config", "profile" });
if (!m_buildProjectProcess->waitForStarted())
{
QString error = tr("Building project failed to start.");
QStringToAZTracePrint(error);
return AZ::Failure(error);
}
// There are a lot of steps when building so estimate around 800 more steps ((100 - 20) * 10) remaining
m_progressEstimate = 200;
while (m_buildProjectProcess->waitForReadyRead(MaxBuildTimeMSecs))
{
logStream << m_buildProjectProcess->readAllStandardOutput();
logStream.flush();
// Show 1% progress for every 10 steps completed
UpdateProgress(qMin(++m_progressEstimate / 10, 99));
if (QThread::currentThread()->isInterruptionRequested())
{
// QProcess is unable to kill its child processes so we need to ask the operating system to do that for us
QProcess killBuildProcess;
killBuildProcess.setProcessChannelMode(QProcess::MergedChannels);
killBuildProcess.start(
"cmd.exe", QStringList{ "/C", "taskkill", "/pid", QString::number(m_buildProjectProcess->processId()), "/f", "/t" });
killBuildProcess.waitForFinished();
logStream << "Killing Project Build.";
logStream << killBuildProcess.readAllStandardOutput();
m_buildProjectProcess->kill();
logFile.close();
QStringToAZTracePrint(BuildCancelled);
return AZ::Failure(BuildCancelled);
}
}
if (m_configProjectProcess->exitCode() != 0)
{
QString error = tr("Building project failed. See log for details.");
QStringToAZTracePrint(error);
return AZ::Failure(error);
}
return AZ::Success();
}
} // namespace O3DE::ProjectManager
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:342c3eaccf68a178dfd8c2b1792a93a8c9197c8184dca11bf90706d7481df087
size 1611268
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7088e902885d98953f6a1715efab319c063a4ab8918fd0e810251c8ed82b8514
size 542983
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:797794816e4b1702f1ae1f32b408c95c79eb1f8a95aba43cfad9cccc181b0bda
size 1135182
@@ -26,12 +26,13 @@
<file>o3de.svg</file>
<file>menu.svg</file>
<file>menu_hover.svg</file>
<file>Backgrounds/FirstTimeBackgroundImage.jpg</file>
<file>ArrowDownLine.svg</file>
<file>ArrowUpLine.svg</file>
<file>CarrotArrowDown.svg</file>
<file>Summary.svg</file>
<file>WindowClose.svg</file>
<file>Warning.svg</file>
<file>Backgrounds/DefaultBackground.jpg</file>
<file>Backgrounds/FtueBackground.jpg</file>
</qresource>
</RCC>
@@ -11,7 +11,6 @@
#include <ProjectInfo.h>
#endif
// due to current limitations, customizing template Gems is disabled
#define TEMPLATE_GEM_CONFIGURATION_ENABLED
QT_FORWARD_DECLARE_CLASS(QStackedWidget)
@@ -61,8 +61,8 @@ namespace O3DE::ProjectManager
{
switch (origin)
{
case O3DEFoundation:
return "Open 3D Foundation";
case Open3DEEngine:
return "Open 3D Engine";
case Local:
return "Local";
default:
@@ -43,7 +43,7 @@ namespace O3DE::ProjectManager
enum GemOrigin
{
O3DEFoundation = 1 << 0,
Open3DEEngine = 1 << 0,
Local = 1 << 1,
NumGemOrigins = 2
};
@@ -99,7 +99,13 @@ namespace O3DE::ProjectManager
painter->drawText(gemCreatorRect, Qt::TextSingleLine, gemCreator);
// Gem summary
const QSize summarySize = QSize(contentRect.width() - s_summaryStartX - s_buttonWidth - s_itemMargins.right() * 3, contentRect.height());
// In case there are feature tags displayed at the bottom, decrease the size of the summary text field.
const QStringList featureTags = GemModel::GetFeatures(modelIndex);
const int summaryHeight = contentRect.height() - (!featureTags.empty() * 30);
const QSize summarySize = QSize(contentRect.width() - s_summaryStartX - s_buttonWidth - s_itemMargins.right() * 3,
summaryHeight);
const QRect summaryRect = QRect(/*topLeft=*/QPoint(contentRect.left() + s_summaryStartX, contentRect.top()), summarySize);
painter->setFont(standardFont);
@@ -108,9 +114,9 @@ namespace O3DE::ProjectManager
const QString summary = GemModel::GetSummary(modelIndex);
painter->drawText(summaryRect, Qt::AlignLeft | Qt::TextWordWrap, summary);
DrawButton(painter, contentRect, modelIndex);
DrawPlatformIcons(painter, contentRect, modelIndex);
DrawFeatureTags(painter, contentRect, featureTags, standardFont, summaryRect);
painter->restore();
}
@@ -131,6 +137,17 @@ namespace O3DE::ProjectManager
return false;
}
if (event->type() == QEvent::KeyPress)
{
auto keyEvent = static_cast<const QKeyEvent*>(event);
if (keyEvent->key() == Qt::Key_Space)
{
const bool isAdded = GemModel::IsAdded(modelIndex);
GemModel::SetIsAdded(*model, modelIndex, !isAdded);
return true;
}
}
if (event->type() == QEvent::MouseButtonPress)
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
@@ -195,6 +212,46 @@ namespace O3DE::ProjectManager
}
}
void GemItemDelegate::DrawFeatureTags(QPainter* painter, const QRect& contentRect, const QStringList& featureTags, const QFont& standardFont, const QRect& summaryRect) const
{
QFont gemFeatureTagFont(standardFont);
gemFeatureTagFont.setPixelSize(s_featureTagFontSize);
gemFeatureTagFont.setBold(false);
painter->setFont(gemFeatureTagFont);
int x = s_summaryStartX;
for (const QString& featureTag : featureTags)
{
QRect featureTagRect = GetTextRect(gemFeatureTagFont, featureTag, s_featureTagFontSize);
featureTagRect.moveTo(contentRect.left() + x + s_featureTagBorderMarginX,
contentRect.top() + 47);
featureTagRect = painter->boundingRect(featureTagRect, Qt::TextSingleLine, featureTag);
QRect backgroundRect = featureTagRect;
backgroundRect = backgroundRect.adjusted(/*left=*/-s_featureTagBorderMarginX,
/*top=*/-s_featureTagBorderMarginY,
/*right=*/s_featureTagBorderMarginX,
/*bottom=*/s_featureTagBorderMarginY);
// Skip drawing all following feature tags as there is no more space available.
if (backgroundRect.right() > summaryRect.right())
{
break;
}
// Draw border.
painter->setPen(m_textColor);
painter->setBrush(Qt::NoBrush);
painter->drawRect(backgroundRect);
// Draw text within the border.
painter->setPen(m_textColor);
painter->drawText(featureTagRect, Qt::TextSingleLine, featureTag);
x += backgroundRect.width() + s_featureTagSpacing;
}
}
void GemItemDelegate::DrawButton(QPainter* painter, const QRect& contentRect, const QModelIndex& modelIndex) const
{
painter->save();
@@ -57,12 +57,19 @@ namespace O3DE::ProjectManager
inline constexpr static int s_buttonCircleRadius = s_buttonBorderRadius - 2;
inline constexpr static qreal s_buttonFontSize = 10.0;
// Feature tags
inline constexpr static int s_featureTagFontSize = 10;
inline constexpr static int s_featureTagBorderMarginX = 3;
inline constexpr static int s_featureTagBorderMarginY = 3;
inline constexpr static int s_featureTagSpacing = 7;
protected:
void CalcRects(const QStyleOptionViewItem& option, QRect& outFullRect, QRect& outItemRect, QRect& outContentRect) const;
QRect GetTextRect(QFont& font, const QString& text, qreal fontSize) const;
QRect CalcButtonRect(const QRect& contentRect) const;
void DrawPlatformIcons(QPainter* painter, const QRect& contentRect, const QModelIndex& modelIndex) const;
void DrawButton(QPainter* painter, const QRect& contentRect, const QModelIndex& modelIndex) const;
void DrawFeatureTags(QPainter* painter, const QRect& contentRect, const QStringList& featureTags, const QFont& standardFont, const QRect& summaryRect) const;
QAbstractItemModel* m_model = nullptr;
@@ -97,10 +97,21 @@ namespace O3DE::ProjectManager
{
m_templates = templatesResult.GetValue();
// sort alphabetically by display name because they could be in any order
// sort alphabetically by display name (but putting Standard first) because they could be in any order
std::sort(m_templates.begin(), m_templates.end(), [](const ProjectTemplateInfo& arg1, const ProjectTemplateInfo& arg2)
{
return arg1.m_displayName.toLower() < arg2.m_displayName.toLower();
if (arg1.m_displayName == "Standard")
{
return true;
}
else if (arg2.m_displayName == "Standard")
{
return false;
}
else
{
return arg1.m_displayName.toLower() < arg2.m_displayName.toLower();
}
});
for (int index = 0; index < m_templates.size(); ++index)
@@ -19,6 +19,7 @@ QT_FORWARD_DECLARE_CLASS(QFrame)
namespace O3DE::ProjectManager
{
QT_FORWARD_DECLARE_CLASS(TagContainerWidget)
class NewProjectSettingsScreen
: public ProjectSettingsScreen
{
@@ -1,244 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <ProjectBuilder.h>
#include <ProjectManagerDefs.h>
#include <ProjectButtonWidget.h>
#include <PythonBindingsInterface.h>
#include <QProcess>
#include <QFile>
#include <QTextStream>
#include <QMessageBox>
#include <QDesktopServices>
#include <QUrl>
#include <QDir>
#include <QProcessEnvironment>
//#define MOCK_BUILD_PROJECT true
namespace O3DE::ProjectManager
{
// QProcess::waitForFinished uses -1 to indicate that the process should not timeout
constexpr int MaxBuildTimeMSecs = -1;
ProjectBuilderWorker::ProjectBuilderWorker(const ProjectInfo& projectInfo)
: QObject()
, m_projectInfo(projectInfo)
{
}
void ProjectBuilderWorker::BuildProject()
{
#ifdef MOCK_BUILD_PROJECT
for (int i = 0; i < 10; ++i)
{
QThread::sleep(1);
UpdateProgress(i * 10);
}
Done(m_projectPath);
#else
EngineInfo engineInfo;
AZ::Outcome<EngineInfo> engineInfoResult = PythonBindingsInterface::Get()->GetEngineInfo();
if (engineInfoResult.IsSuccess())
{
engineInfo = engineInfoResult.GetValue();
}
else
{
emit Done(tr("Failed to get engine info."));
return;
}
// Show some kind of progress with very approximate estimates
UpdateProgress(1);
QProcessEnvironment currentEnvironment(QProcessEnvironment::systemEnvironment());
// Append cmake path to PATH incase it is missing
QDir cmakePath(engineInfo.m_path);
cmakePath.cd("cmake/runtime/bin");
QString pathValue = currentEnvironment.value("PATH");
pathValue += ";" + cmakePath.path();
currentEnvironment.insert("PATH", pathValue);
QProcess configProjectProcess;
configProjectProcess.setProcessChannelMode(QProcess::MergedChannels);
configProjectProcess.setWorkingDirectory(m_projectInfo.m_path);
configProjectProcess.setProcessEnvironment(currentEnvironment);
configProjectProcess.start(
"cmake",
QStringList
{
"-B",
QDir(m_projectInfo.m_path).filePath(ProjectBuildPathPostfix),
"-S",
m_projectInfo.m_path,
"-G",
"Visual Studio 16",
"-DLY_3RDPARTY_PATH=" + engineInfo.m_thirdPartyPath
});
if (!configProjectProcess.waitForStarted())
{
emit Done(tr("Configuring project failed to start."));
return;
}
if (!configProjectProcess.waitForFinished(MaxBuildTimeMSecs))
{
WriteErrorLog(configProjectProcess.readAllStandardOutput());
emit Done(tr("Configuring project timed out. See log for details"));
return;
}
QString configProjectOutput(configProjectProcess.readAllStandardOutput());
if (configProjectProcess.exitCode() != 0 || !configProjectOutput.contains("Generating done"))
{
WriteErrorLog(configProjectOutput);
emit Done(tr("Configuring project failed. See log for details."));
return;
}
UpdateProgress(20);
QProcess buildProjectProcess;
buildProjectProcess.setProcessChannelMode(QProcess::MergedChannels);
buildProjectProcess.setWorkingDirectory(m_projectInfo.m_path);
buildProjectProcess.setProcessEnvironment(currentEnvironment);
buildProjectProcess.start(
"cmake",
QStringList
{
"--build",
QDir(m_projectInfo.m_path).filePath(ProjectBuildPathPostfix),
"--target",
m_projectInfo.m_projectName + ".GameLauncher",
"Editor",
"--config",
"profile"
});
if (!buildProjectProcess.waitForStarted())
{
emit Done(tr("Building project failed to start."));
return;
}
if (!buildProjectProcess.waitForFinished(MaxBuildTimeMSecs))
{
WriteErrorLog(configProjectProcess.readAllStandardOutput());
emit Done(tr("Building project timed out. See log for details"));
return;
}
QString buildProjectOutput(buildProjectProcess.readAllStandardOutput());
if (configProjectProcess.exitCode() != 0)
{
WriteErrorLog(buildProjectOutput);
emit Done(tr("Building project failed. See log for details."));
}
else
{
emit Done("");
}
#endif
}
QString ProjectBuilderWorker::LogFilePath() const
{
QDir logFilePath(m_projectInfo.m_path);
logFilePath.cd(ProjectBuildPathPostfix);
return logFilePath.filePath(ProjectBuildErrorLogPathPostfix);
}
void ProjectBuilderWorker::WriteErrorLog(const QString& log)
{
QFile logFile(LogFilePath());
// Overwrite file with truncate
if (logFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
{
QTextStream output(&logFile);
output << log;
logFile.close();
}
}
ProjectBuilderController::ProjectBuilderController(const ProjectInfo& projectInfo, ProjectButton* projectButton, QWidget* parent)
: QObject()
, m_projectInfo(projectInfo)
, m_projectButton(projectButton)
, m_parent(parent)
{
m_worker = new ProjectBuilderWorker(m_projectInfo);
m_worker->moveToThread(&m_workerThread);
connect(&m_workerThread, &QThread::finished, m_worker, &ProjectBuilderWorker::deleteLater);
connect(&m_workerThread, &QThread::started, m_worker, &ProjectBuilderWorker::BuildProject);
connect(m_worker, &ProjectBuilderWorker::Done, this, &ProjectBuilderController::HandleResults);
connect(m_worker, &ProjectBuilderWorker::UpdateProgress, this, &ProjectBuilderController::UpdateUIProgress);
}
ProjectBuilderController::~ProjectBuilderController()
{
m_workerThread.quit();
m_workerThread.wait();
}
void ProjectBuilderController::Start()
{
m_workerThread.start();
UpdateUIProgress(0);
}
void ProjectBuilderController::SetProjectButton(ProjectButton* projectButton)
{
m_projectButton = projectButton;
}
QString ProjectBuilderController::GetProjectPath() const
{
return m_projectInfo.m_path;
}
void ProjectBuilderController::UpdateUIProgress(int progress)
{
if (m_projectButton)
{
m_projectButton->SetButtonOverlayText(QString("%1 (%2%)\n\n").arg(tr("Building Project..."), QString::number(progress)));
m_projectButton->SetProgressBarValue(progress);
}
}
void ProjectBuilderController::HandleResults(const QString& result)
{
if (!result.isEmpty())
{
if (result.contains(tr("log")))
{
QMessageBox::StandardButton openLog = QMessageBox::critical(
m_parent,
tr("Project Failed to Build!"),
result + tr("\n\nWould you like to view log?"),
QMessageBox::No | QMessageBox::Yes);
if (openLog == QMessageBox::Yes)
{
// Open application assigned to this file type
QDesktopServices::openUrl(QUrl("file:///" + m_worker->LogFilePath()));
}
}
else
{
QMessageBox::critical(m_parent, tr("Project Failed to Build!"), result);
}
}
emit Done();
}
} // namespace O3DE::ProjectManager
@@ -0,0 +1,121 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <ProjectBuilderController.h>
#include <ProjectBuilderWorker.h>
#include <ProjectButtonWidget.h>
#include <QMessageBox>
#include <QDesktopServices>
#include <QUrl>
namespace O3DE::ProjectManager
{
ProjectBuilderController::ProjectBuilderController(const ProjectInfo& projectInfo, ProjectButton* projectButton, QWidget* parent)
: QObject()
, m_projectInfo(projectInfo)
, m_projectButton(projectButton)
, m_lastProgress(0)
, m_parent(parent)
{
m_worker = new ProjectBuilderWorker(m_projectInfo);
m_worker->moveToThread(&m_workerThread);
connect(&m_workerThread, &QThread::finished, m_worker, &ProjectBuilderWorker::deleteLater);
connect(&m_workerThread, &QThread::started, m_worker, &ProjectBuilderWorker::BuildProject);
connect(m_worker, &ProjectBuilderWorker::Done, this, &ProjectBuilderController::HandleResults);
connect(m_worker, &ProjectBuilderWorker::UpdateProgress, this, &ProjectBuilderController::UpdateUIProgress);
}
ProjectBuilderController::~ProjectBuilderController()
{
m_workerThread.requestInterruption();
m_workerThread.quit();
m_workerThread.wait();
}
void ProjectBuilderController::Start()
{
m_workerThread.start();
UpdateUIProgress(0);
}
void ProjectBuilderController::SetProjectButton(ProjectButton* projectButton)
{
m_projectButton = projectButton;
if (projectButton)
{
projectButton->SetProjectButtonAction(tr("Cancel Build"), [this] { HandleCancel(); });
if (m_lastProgress != 0)
{
UpdateUIProgress(m_lastProgress);
}
}
}
const ProjectInfo& ProjectBuilderController::GetProjectInfo() const
{
return m_projectInfo;
}
void ProjectBuilderController::UpdateUIProgress(int progress)
{
m_lastProgress = progress;
if (m_projectButton)
{
m_projectButton->SetButtonOverlayText(QString("%1 (%2%)\n\n").arg(tr("Building Project..."), QString::number(progress)));
m_projectButton->SetProgressBarValue(progress);
}
}
void ProjectBuilderController::HandleResults(const QString& result)
{
if (!result.isEmpty())
{
if (result.contains(tr("log")))
{
QMessageBox::StandardButton openLog = QMessageBox::critical(
m_parent,
tr("Project Failed to Build!"),
result + tr("\n\nWould you like to view log?"),
QMessageBox::No | QMessageBox::Yes);
if (openLog == QMessageBox::Yes)
{
// Open application assigned to this file type
QDesktopServices::openUrl(QUrl("file:///" + m_worker->GetLogFilePath()));
}
m_projectInfo.m_buildFailed = true;
m_projectInfo.m_logUrl = QUrl("file:///" + m_worker->GetLogFilePath());
emit NotifyBuildProject(m_projectInfo);
}
else
{
QMessageBox::critical(m_parent, tr("Project Failed to Build!"), result);
m_projectInfo.m_buildFailed = true;
m_projectInfo.m_logUrl = QUrl();
emit NotifyBuildProject(m_projectInfo);
}
emit Done(false);
return;
}
emit Done(true);
}
void ProjectBuilderController::HandleCancel()
{
m_workerThread.quit();
emit Done(false);
}
} // namespace O3DE::ProjectManager

Some files were not shown because too many files have changed in this diff Show More