Merge branch 'development' into Prefab/SaveAllPrefabs

Signed-off-by: srikappa-amzn <srikappa@amazon.com>
This commit is contained in:
srikappa-amzn
2021-09-02 23:40:54 -07:00
2357 changed files with 473642 additions and 159101 deletions
@@ -312,8 +312,7 @@ namespace AzToolsFramework
#elif defined(AZ_PLATFORM_WINDOWS)
return "pc";
#elif defined(AZ_PLATFORM_LINUX)
// set this to pc because that's what bootstrap.cfg currently defines the platform to "pc", even on Linux
return "pc";
return "linux";
#else
#error Unimplemented Host Asset Platform
#endif
@@ -5,14 +5,10 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef AZTOOLSFRAMEWORK_TOOLSAPPLICATIONAPI_H
#define AZTOOLSFRAMEWORK_TOOLSAPPLICATIONAPI_H
#include <AzCore/base.h>
#pragma once
#include <AzCore/base.h>
#include <AzCore/Debug/Budget.h>
#include <AzCore/EBus/EBus.h>
#include <AzCore/Math/Aabb.h>
#include <AzCore/Math/Uuid.h>
@@ -1089,4 +1085,5 @@ namespace AzToolsFramework
}
} // namespace AzToolsFramework
#endif // AZTOOLSFRAMEWORK_TOOLSAPPLICATIONAPI_H
AZ_DECLARE_BUDGET(AzToolsFramework);
@@ -70,7 +70,7 @@
#include <QtWidgets/QMessageBox>
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 4251: 'QFileInfo::d_ptr': class 'QSharedDataPointer<QFileInfoPrivate>' needs to have dll-interface to be used by clients of class 'QFileInfo'
#include <QDir>
AZ_POP_DISABLE_OVERRIDE_WARNING
AZ_POP_DISABLE_WARNING
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
@@ -87,11 +87,6 @@ namespace AzToolsFramework
{
namespace Internal
{
static const char* s_engineConfigFileName = "engine.json";
static const char* s_engineConfigEngineVersionKey = "O3DEVersion";
static const char* s_startupLogWindow = "Startup";
template<typename IdContainerType>
void DeleteEntities(const IdContainerType& entityIds)
{
@@ -144,7 +139,7 @@ namespace AzToolsFramework
AZ_PROFILE_SCOPE(AzToolsFramework, "Internal::DeleteEntities:UndoCaptureAndPurgeEntities");
for (const auto& entityId : entityIds)
{
AZ::Entity* entity = NULL;
AZ::Entity* entity = nullptr;
EBUS_EVENT_RESULT(entity, AZ::ComponentApplicationBus, FindEntity, entityId);
if (entity)
@@ -1242,7 +1237,7 @@ namespace AzToolsFramework
void ToolsApplication::RequestEditForFile(const char* assetPath, RequestEditResultCallback resultCallback)
{
AZ_Error("RequestEdit", resultCallback != 0, "User result callback is required.");
AZ_Error("RequestEdit", resultCallback != nullptr, "User result callback is required.");
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
if (fileIO && !fileIO->IsReadOnly(assetPath))
@@ -236,7 +236,7 @@ namespace AzToolsFramework
{
AZStd::string commandLineArgs = Platform::GetListFilesInArchiveCommand(archivePath);
auto parseOutput = [respCallback, taskHandle, &fileEntries](bool exitCode, AZStd::string consoleOutput)
auto parseOutput = [respCallback, &fileEntries](bool exitCode, AZStd::string consoleOutput)
{
Platform::ParseConsoleOutputFromListFilesInArchive(consoleOutput, fileEntries);
AZ::TickBus::QueueFunction(respCallback, exitCode, AZStd::move(consoleOutput));
@@ -97,7 +97,7 @@ namespace AzToolsFramework::AssetUtils
struct EnabledPlatformsVisitor
: AZ::SettingsRegistryInterface::Visitor
{
void Visit(AZStd::string_view path, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, AZStd::string_view value);
void Visit(AZStd::string_view path, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, AZStd::string_view value) override;
AZStd::vector<AZStd::string> m_enabledPlatforms;
};
@@ -31,10 +31,10 @@ namespace AzToolsFramework
AssetBrowserFilterModel::AssetBrowserFilterModel(QObject* parent)
: QSortFilterProxyModel(parent)
{
m_showColumn.insert(aznumeric_cast<int>(AssetBrowserEntry::Column::DisplayName));
m_shownColumns.insert(aznumeric_cast<int>(AssetBrowserEntry::Column::DisplayName));
if (ed_useNewAssetBrowserTableView)
{
m_showColumn.insert(aznumeric_cast<int>(AssetBrowserEntry::Column::Path));
m_shownColumns.insert(aznumeric_cast<int>(AssetBrowserEntry::Column::Path));
}
m_collator.setNumericMode(true);
AssetBrowserComponentNotificationBus::Handler::BusConnect();
@@ -96,7 +96,7 @@ namespace AzToolsFramework
bool AssetBrowserFilterModel::filterAcceptsColumn(int source_column, const QModelIndex&) const
{
//if the column is in the set we want to show it
return m_showColumn.find(source_column) != m_showColumn.end();
return m_shownColumns.find(source_column) != m_shownColumns.end();
}
bool AssetBrowserFilterModel::lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const
@@ -134,7 +134,7 @@ namespace AzToolsFramework
{
const auto& subFilters = compFilter->GetSubFilters();
const auto& compFilterIter = AZStd::find_if(subFilters.cbegin(), subFilters.cend(),
[subFilters](FilterConstType filter) -> bool
[](FilterConstType filter) -> bool
{
const auto assetTypeFilter = qobject_cast<QSharedPointer<const CompositeFilter>>(filter);
return !assetTypeFilter.isNull();
@@ -146,7 +146,7 @@ namespace AzToolsFramework
}
const auto& compositeStringFilterIter = AZStd::find_if(subFilters.cbegin(), subFilters.cend(),
[subFilters](FilterConstType filter) -> bool
[](FilterConstType filter) -> bool
{
// The real StringFilter is really a CompositeFilter with just one StringFilter in its subfilter list
// To know if it is actually a StringFilter we have to get that subfilter and check if it is a Stringfilter.
@@ -27,6 +27,8 @@ namespace AzToolsFramework
{
namespace AssetBrowser
{
using ShownColumnsSet = AZStd::fixed_unordered_set<int, 3, aznumeric_cast<int>(AssetBrowserEntry::Column::Count)>;
class AssetBrowserFilterModel
: public QSortFilterProxyModel
, public AssetBrowserComponentNotificationBus::Handler
@@ -61,11 +63,11 @@ namespace AzToolsFramework
void filterUpdatedSlot();
protected:
//set for filtering columns
//if the column is in the set the column is not filtered and is shown
AZStd::fixed_unordered_set<int, 3, aznumeric_cast<int>(AssetBrowserEntry::Column::Count)> m_showColumn;
// Set for filtering columns
// If the column is in the set the column is not filtered and is shown
ShownColumnsSet m_shownColumns;
bool m_alreadyRecomputingFilters = false;
//asset source name match filter
//Asset source name match filter
FilterConstType m_filter;
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 4251: class '...' needs to have dll-interface to be used by clients of class '...'
QWeakPointer<const StringFilter> m_stringFilter;
@@ -16,7 +16,6 @@ namespace AzToolsFramework
AssetBrowserTableModel::AssetBrowserTableModel(QObject* parent /* = nullptr */)
: QSortFilterProxyModel(parent)
{
setDynamicSortFilter(false);
}
void AssetBrowserTableModel::setSourceModel(QAbstractItemModel* sourceModel)
@@ -25,19 +24,47 @@ namespace AzToolsFramework
AZ_Assert(
m_filterModel,
"Error in AssetBrowserTableModel initialization, class expects source model to be an AssetBrowserFilterModel.");
connect(sourceModel, &QAbstractItemModel::rowsInserted, this, &AssetBrowserTableModel::UpdateTableModelMaps);
connect(sourceModel, &QAbstractItemModel::rowsRemoved, this, &AssetBrowserTableModel::UpdateTableModelMaps);
connect(sourceModel, &QAbstractItemModel::modelAboutToBeReset, this, &AssetBrowserTableModel::beginResetModel);
connect(
sourceModel, &QAbstractItemModel::modelReset, this,
[this]()
{
{
QSignalBlocker sb(this);
UpdateTableModelMaps();
}
endResetModel();
});
connect(sourceModel, &QAbstractItemModel::layoutChanged, this, &AssetBrowserTableModel::UpdateTableModelMaps);
connect(sourceModel, &QAbstractItemModel::dataChanged, this, &AssetBrowserTableModel::SourceDataChanged);
QSortFilterProxyModel::setSourceModel(sourceModel);
}
QModelIndex AssetBrowserTableModel::mapToSource(const QModelIndex& proxyIndex) const
{
Q_ASSERT(!proxyIndex.isValid() || proxyIndex.model() == this);
if (!proxyIndex.isValid())
Q_ASSERT(!proxyIndex.isValid() || proxyIndex.model() != this);
if (!proxyIndex.isValid() || !m_indexMap.contains(proxyIndex.row()))
{
return QModelIndex();
}
return m_indexMap[proxyIndex.row()];
}
QModelIndex AssetBrowserTableModel::mapFromSource(const QModelIndex& sourceIndex) const
{
Q_ASSERT(!sourceIndex.isValid() || sourceIndex.model() == sourceModel());
if (!sourceIndex.isValid() || !m_rowMap.contains(sourceIndex))
{
return QModelIndex();
}
return createIndex(m_rowMap[sourceIndex], sourceIndex.column());
}
QVariant AssetBrowserTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
@@ -49,20 +76,8 @@ namespace AzToolsFramework
QVariant AssetBrowserTableModel::data(const QModelIndex& index, int role) const
{
auto sourceIndex = mapToSource(index);
if (!sourceIndex.isValid())
{
return QVariant();
}
AssetBrowserEntry* entry = GetAssetEntry(sourceIndex);
if (entry == nullptr)
{
AZ_Assert(false, "AssetBrowserTableModel - QModelIndex does not reference an AssetEntry. Source model is not valid.");
return QVariant();
}
return sourceIndex.data(role);
Q_ASSERT(index.isValid() && index.model() == this);
return sourceModel()->data(mapToSource(index), role);
}
QModelIndex AssetBrowserTableModel::parent([[maybe_unused]] const QModelIndex& child) const
@@ -76,14 +91,28 @@ namespace AzToolsFramework
return QModelIndex();
}
void AssetBrowserTableModel::SourceDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight)
{
for (int row = topLeft.row(); row <= bottomRight.row(); ++row)
{
if (!m_indexMap.contains(row))
{
UpdateTableModelMaps();
return;
}
}
}
QModelIndex AssetBrowserTableModel::index(int row, int column, const QModelIndex& parent) const
{
Q_ASSERT(!parent.isValid());
return parent.isValid() ? QModelIndex() : createIndex(row, column, m_indexMap[row].internalPointer());
}
int AssetBrowserTableModel::rowCount(const QModelIndex& parent) const
{
return !parent.isValid() ? m_indexMap.size() : 0;
return !parent.isValid() ? m_indexMap.size() : sourceModel()->rowCount(parent);
}
int AssetBrowserTableModel::BuildTableModelMap(
@@ -102,14 +131,12 @@ namespace AzToolsFramework
{
QModelIndex index = model->index(currentRow, 0, parent);
AssetBrowserEntry* entry = GetAssetEntry(m_filterModel->mapToSource(index));
// We only want to see the source assets.
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source)
// We only want to see source and product assets.
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source ||
entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Product)
{
beginInsertRows(parent, row, row);
m_indexMap[row] = index;
endInsertRows();
Q_EMIT dataChanged(index, index);
m_rowMap[index] = row;
++row;
++m_displayedItemsCounter;
}
@@ -143,12 +170,8 @@ namespace AzToolsFramework
void AssetBrowserTableModel::UpdateTableModelMaps()
{
emit layoutAboutToBeChanged();
if (!m_indexMap.isEmpty())
{
beginRemoveRows(m_indexMap.first(), m_indexMap.first().row(), m_indexMap.last().row());
m_indexMap.clear();
endRemoveRows();
}
m_indexMap.clear();
m_rowMap.clear();
AzToolsFramework::EditorSettingsAPIBus::BroadcastResult(
m_numberOfItemsDisplayed, &AzToolsFramework::EditorSettingsAPIBus::Handler::GetMaxNumberOfItemsShownInSearchView);
@@ -21,8 +21,7 @@ namespace AzToolsFramework
class AssetBrowserFilterModel;
class AssetBrowserEntry;
class AssetBrowserTableModel
: public QSortFilterProxyModel
class AssetBrowserTableModel : public QSortFilterProxyModel
{
Q_OBJECT
@@ -30,12 +29,11 @@ namespace AzToolsFramework
AZ_CLASS_ALLOCATOR(AssetBrowserTableModel, AZ::SystemAllocator, 0);
explicit AssetBrowserTableModel(QObject* parent = nullptr);
void UpdateTableModelMaps();
////////////////////////////////////////////////////////////////////
// QSortFilterProxyModel
void setSourceModel(QAbstractItemModel* sourceModel) override;
QModelIndex mapToSource(const QModelIndex& proxyIndex) const override;
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override;
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
QModelIndex parent(const QModelIndex& child) const override;
@@ -45,16 +43,21 @@ namespace AzToolsFramework
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role /* = Qt::DisplayRole */) const override;
////////////////////////////////////////////////////////////////////
private:
AssetBrowserEntry* GetAssetEntry(QModelIndex index) const;
int BuildTableModelMap(const QAbstractItemModel* model, const QModelIndex& parent = QModelIndex(), int row = 0);
public slots:
void UpdateTableModelMaps();
private slots:
void SourceDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
private:
int m_numberOfItemsDisplayed = 50;
int m_displayedItemsCounter = 0;
QPointer<AssetBrowserFilterModel> m_filterModel;
QMap<int, QModelIndex> m_indexMap;
QMap<QModelIndex, int> m_rowMap;
};
} // namespace AssetBrowser
} // namespace AzToolsFramework
@@ -9,9 +9,11 @@
#include <AzCore/UserSettings/UserSettings.h>
#include <AzQtComponents/Components/DockBar.h>
#include <AzCore/Console/IConsole.h>
#include <AzToolsFramework/AssetBrowser/Views/AssetBrowserTreeView.h>
#include <AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.h>
#include <AzToolsFramework/AssetBrowser/AssetBrowserTableModel.h>
#include <AzToolsFramework/AssetBrowser/AssetBrowserModel.h>
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
#include <AzToolsFramework/AssetBrowser/AssetSelectionModel.h>
@@ -26,6 +28,11 @@ AZ_PUSH_DISABLE_WARNING(4251 4244, "-Wunknown-warning-option") // disable warnin
#include <QTimer>
AZ_POP_DISABLE_WARNING
AZ_CVAR(
bool, ed_hideAssetPickerPathColumn, false, nullptr, AZ::ConsoleFunctorFlags::Null,
"Hide AssetPicker path column for a clearer view.");
AZ_CVAR_EXTERNED(bool, ed_useNewAssetBrowserTableView);
namespace AzToolsFramework
{
namespace AssetBrowser
@@ -34,6 +41,7 @@ namespace AzToolsFramework
: QDialog(parent)
, m_ui(new Ui::AssetPickerDialogClass())
, m_filterModel(new AssetBrowserFilterModel(parent))
, m_tableModel(new AssetBrowserTableModel(parent))
, m_selection(selection)
, m_hasFilter(false)
{
@@ -97,6 +105,56 @@ namespace AzToolsFramework
m_persistentState = AZ::UserSettings::CreateFind<AzToolsFramework::QWidgetSavedState>(AZ::Crc32(("AssetBrowserTreeView_Dialog_" + name).toUtf8().data()), AZ::UserSettings::CT_GLOBAL);
m_ui->m_assetBrowserTableViewWidget->setVisible(false);
if (ed_useNewAssetBrowserTableView)
{
m_ui->m_assetBrowserTreeViewWidget->setVisible(false);
m_ui->m_assetBrowserTableViewWidget->setVisible(true);
m_tableModel->setSourceModel(m_filterModel.get());
m_ui->m_assetBrowserTableViewWidget->setModel(m_tableModel.get());
m_ui->m_assetBrowserTableViewWidget->SetName("AssetBrowserTableView_" + name);
m_ui->m_assetBrowserTableViewWidget->setDragEnabled(false);
m_ui->m_assetBrowserTableViewWidget->setSelectionMode(
selection.GetMultiselect() ? QAbstractItemView::SelectionMode::ExtendedSelection
: QAbstractItemView::SelectionMode::SingleSelection);
if (ed_hideAssetPickerPathColumn)
{
m_ui->m_assetBrowserTableViewWidget->hideColumn(1);
}
// if the current selection is invalid, disable the Ok button
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(EvaluateSelection());
connect(
m_filterModel.data(), &AssetBrowserFilterModel::filterChanged, this,
[this]()
{
m_tableModel->UpdateTableModelMaps();
});
connect(
m_ui->m_assetBrowserTableViewWidget, &AssetBrowserTableView::selectionChangedSignal, this,
[this](const QItemSelection&, const QItemSelection&)
{
AssetPickerDialog::SelectionChangedSlot();
});
connect(m_ui->m_assetBrowserTableViewWidget, &QAbstractItemView::doubleClicked, this, &AssetPickerDialog::DoubleClickedSlot);
connect(
m_ui->m_assetBrowserTableViewWidget, &AssetBrowserTableView::ClearStringFilter, m_ui->m_searchWidget,
&SearchWidget::ClearStringFilter);
connect(
m_ui->m_assetBrowserTableViewWidget, &AssetBrowserTableView::ClearTypeFilter, m_ui->m_searchWidget,
&SearchWidget::ClearTypeFilter);
m_ui->m_assetBrowserTableViewWidget->SetName("AssetBrowserTableView_main");
m_tableModel->UpdateTableModelMaps();
}
QTimer::singleShot(0, this, &AssetPickerDialog::RestoreState);
SelectionChangedSlot();
}
@@ -134,6 +192,7 @@ namespace AzToolsFramework
{
m_ui->m_assetBrowserTreeViewWidget->expandAll();
});
m_tableModel->UpdateTableModelMaps();
}
if (m_hasFilter && !hasFilter)
@@ -166,7 +225,8 @@ namespace AzToolsFramework
bool AssetPickerDialog::EvaluateSelection() const
{
auto selectedAssets = m_ui->m_assetBrowserTreeViewWidget->GetSelectedAssets();
auto selectedAssets = m_ui->m_assetBrowserTreeViewWidget->isVisible() ? m_ui->m_assetBrowserTreeViewWidget->GetSelectedAssets()
: m_ui->m_assetBrowserTableViewWidget->GetSelectedAssets();
// exactly one item must be selected, even if multi-select option is disabled, still good practice to check
if (selectedAssets.empty())
{
@@ -197,7 +257,10 @@ namespace AzToolsFramework
void AssetPickerDialog::UpdatePreview() const
{
auto selectedAssets = m_ui->m_assetBrowserTreeViewWidget->GetSelectedAssets();
auto selectedAssets = m_ui->m_assetBrowserTreeViewWidget->isVisible()
? m_ui->m_assetBrowserTreeViewWidget->GetSelectedAssets()
: m_ui->m_assetBrowserTableViewWidget->GetSelectedAssets();
;
if (selectedAssets.size() != 1)
{
m_ui->m_previewerFrame->Clear();
@@ -33,6 +33,7 @@ namespace AzToolsFramework
{
class ProductAssetBrowserEntry;
class AssetBrowserFilterModel;
class AssetBrowserTableModel;
class AssetBrowserModel;
class AssetSelectionModel;
@@ -69,6 +70,7 @@ namespace AzToolsFramework
QScopedPointer<Ui::AssetPickerDialogClass> m_ui;
AssetBrowserModel* m_assetBrowserModel = nullptr;
QScopedPointer<AssetBrowserFilterModel> m_filterModel;
QScopedPointer<AssetBrowserTableModel> m_tableModel;
AssetSelectionModel& m_selection;
bool m_hasFilter;
AZStd::unique_ptr<TreeViewState> m_filterStateSaver;
@@ -142,6 +142,9 @@
</property>
</widget>
</item>
<item>
<widget class="AzToolsFramework::AssetBrowser::AssetBrowserTableView" name="m_assetBrowserTableViewWidget"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
@@ -197,6 +200,11 @@
<header>AzToolsFramework/AssetBrowser/Previewer/PreviewerFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>AzToolsFramework::AssetBrowser::AssetBrowserTableView</class>
<extends>QTableView</extends>
<header>AzToolsFramework/AssetBrowser/Views/AssetBrowserTableView.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
@@ -81,7 +81,7 @@ namespace AzToolsFramework
mainLayout->addWidget(m_viewStack);
connect(actionGroup, &QActionGroup::triggered, this, [this, thumbnailViewAction, listViewAction, sizeComboBox](QAction* action) {
connect(actionGroup, &QActionGroup::triggered, this, [this, thumbnailViewAction, sizeComboBox](QAction* action) {
if (action == thumbnailViewAction)
{
m_viewStack->setCurrentWidget(m_thumbnailView);
@@ -53,7 +53,6 @@ namespace AzToolsFramework
// AssetBrowserComponentNotificationBus
void OnAssetBrowserComponentReady() override;
//////////////////////////////////////////////////////////////////////////
Q_SIGNALS:
void selectionChangedSignal(const QItemSelection& selected, const QItemSelection& deselected);
void ClearStringFilter();
@@ -939,6 +939,34 @@ namespace AzToolsFramework
jobinfo.m_warningCount = jobDatabaseEntry.m_warningCount;
jobinfo.m_errorCount = jobDatabaseEntry.m_errorCount;
}
bool GetDatabaseInfoResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::databaseInfoHandler handler);
bool GetScanFolderResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::scanFolderHandler handler);
bool GetSourceResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::sourceHandler handler);
bool GetSourceAndScanfolderResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::combinedSourceScanFolderHandler handler);
bool GetSourceDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::sourceFileDependencyHandler handler);
bool GetJobResultSimple(const char* name, SQLite::Statement* statement, AssetDatabaseConnection::jobHandler handler);
bool GetJobResult(
const char* callName,
SQLite::Statement* statement,
AssetDatabaseConnection::jobHandler handler,
AZ::Uuid builderGuid = AZ::Uuid::CreateNull(),
const char* jobKey = nullptr,
AssetSystem::JobStatus status = AssetSystem::JobStatus::Any);
bool GetProductResultSimple(const char* name, SQLite::Statement* statement, AssetDatabaseConnection::productHandler handler);
bool GetProductResult(
const char* callName,
SQLite::Statement* statement,
AssetDatabaseConnection::productHandler handler,
AZ::Uuid builderGuid = AZ::Uuid::CreateNull(),
const char* jobKey = nullptr,
AssetSystem::JobStatus status = AssetSystem::JobStatus::Any);
bool GetLegacySubIDsResult(const char* callname, SQLite::Statement* statement, AssetDatabaseConnection::legacySubIDsHandler handler);
bool GetProductDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::productDependencyHandler handler);
bool GetProductDependencyAndPathResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::productDependencyAndPathHandler handler);
bool GetMissingProductDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::missingProductDependencyHandler handler);
bool GetCombinedDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::combinedProductDependencyHandler handler);
bool GetFileResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::fileHandler handler);
}
//////////////////////////////////////////////////////////////////////////
@@ -65,6 +65,7 @@ namespace AzToolsFramework
AddedScanTimeSecondsSinceEpochField = 29,
ChangedSortFunctionFromQSortToStdStableSort = 30,
RemoveOutputPrefixFromScanFolders,
AddedSourceIndexForSourceDependencyTable,
//Add all new versions before this
DatabaseVersionCount,
LatestVersion = DatabaseVersionCount - 1
@@ -655,26 +656,6 @@ namespace AzToolsFramework
// before every query, since validating it essentially must makes sure it exists.
AZStd::unordered_set<AZStd::string> m_validatedTables;
};
namespace
{
//boiler plate
bool GetDatabaseInfoResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::databaseInfoHandler handler);
bool GetScanFolderResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::scanFolderHandler handler);
bool GetSourceResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::sourceHandler handler);
bool GetSourceAndScanfolderResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::combinedSourceScanFolderHandler handler);
bool GetSourceDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::sourceFileDependencyHandler handler);
bool GetJobResultSimple(const char* name, SQLite::Statement* statement, AssetDatabaseConnection::jobHandler handler);
bool GetJobResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::jobHandler handler, AZ::Uuid builderGuid = AZ::Uuid::CreateNull(), const char* jobKey = nullptr, AssetSystem::JobStatus status = AssetSystem::JobStatus::Any);
bool GetProductResultSimple(const char* name, SQLite::Statement* statement, AssetDatabaseConnection::productHandler handler);
bool GetProductResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::productHandler handler, AZ::Uuid builderGuid = AZ::Uuid::CreateNull(), const char* jobKey = nullptr, AssetSystem::JobStatus status = AssetSystem::JobStatus::Any);
bool GetLegacySubIDsResult(const char* callname, SQLite::Statement* statement, AssetDatabaseConnection::legacySubIDsHandler handler);
bool GetProductDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::productDependencyHandler handler);
bool GetProductDependencyAndPathResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::productDependencyAndPathHandler handler);
bool GetMissingProductDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::missingProductDependencyHandler handler);
bool GetCombinedDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::combinedProductDependencyHandler handler);
bool GetFileResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::fileHandler handler);
}
} // namespace AssetDatabase
}// namespace AzToolsFramework
@@ -37,6 +37,10 @@ AZ_POP_DISABLE_WARNING
#include <AzFramework/Asset/GenericAssetHandler.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzQtComponents/Components/Widgets/FileDialog.h>
#include <AzToolsFramework/UI/UICore/WidgetHelpers.h>
#include <SourceControl/SourceControlAPI.h>
#include <UI/PropertyEditor/PropertyRowWidget.hxx>
@@ -46,9 +50,6 @@ AZ_POP_DISABLE_WARNING
#include <QMessageBox>
#include <QMenu>
#include <QMenuBar>
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 'QFileInfo::d_ptr': class 'QSharedDataPointer<QFileInfoPrivate>' needs to have dll-interface to be used by clients of class 'QFileInfo'
#include <QFileDialog>
AZ_POP_DISABLE_WARNING
#include <QAction>
namespace AzToolsFramework
@@ -57,7 +58,7 @@ namespace AzToolsFramework
{
using AssetCheckoutCallback = AZStd::function<void(bool, const AZStd::string&, const AZStd::string&)>;
void AssetCheckoutCommon(const AZ::Data::AssetId& id, AZ::Data::Asset<AZ::Data::AssetData> asset, AZ::SerializeContext* serializeContext, AssetCheckoutCallback assetCheckoutAndSaveCallback)
void AssetCheckoutCommon(const AZ::Data::AssetId& id, AZ::Data::Asset<AZ::Data::AssetData> asset, [[maybe_unused]] AZ::SerializeContext* serializeContext, AssetCheckoutCallback assetCheckoutAndSaveCallback)
{
AZStd::string assetPath;
AZ::Data::AssetCatalogRequestBus::BroadcastResult(assetPath, &AZ::Data::AssetCatalogRequests::GetAssetPathById, id);
@@ -74,7 +75,7 @@ namespace AzToolsFramework
{
using SCCommandBus = SourceControlCommandBus;
SCCommandBus::Broadcast(&SCCommandBus::Events::RequestEdit, assetFullPath.c_str(), true,
[id, asset, assetFullPath, serializeContext, assetCheckoutAndSaveCallback](bool /*success*/, const SourceControlFileInfo& info)
[id, asset, assetFullPath, assetCheckoutAndSaveCallback](bool /*success*/, const SourceControlFileInfo& info)
{
if (!info.IsReadOnly())
{
@@ -360,7 +361,7 @@ namespace AzToolsFramework
if (savedCallback)
{
auto conn = AZStd::make_shared<QMetaObject::Connection>();
*conn = connect(this, &AssetEditorWidget::OnAssetSavedSignal, this, [this, conn, savedCallback]()
*conn = connect(this, &AssetEditorWidget::OnAssetSavedSignal, this, [conn, savedCallback]()
{
disconnect(*conn);
savedCallback();
@@ -414,7 +415,7 @@ namespace AzToolsFramework
filter.append(")");
}
const QString saveAs = QFileDialog::getSaveFileName(nullptr, tr("Save As..."), m_userSettings->m_lastSavePath.c_str(), filter);
const QString saveAs = AzQtComponents::FileDialog::GetSaveFileName(AzToolsFramework::GetActiveWindow(), tr("Save As..."), m_userSettings->m_lastSavePath.c_str(), filter);
return SaveImpl(asset, saveAs);
}
@@ -720,7 +721,7 @@ namespace AzToolsFramework
AZ::Data::AssetInfo assetInfo;
AZ::Data::AssetCatalogRequestBus::BroadcastResult(assetInfo, &AZ::Data::AssetCatalogRequests::GetAssetInfoById, assetId);
if (assetInfo.m_assetType == m_inMemoryAsset.GetType()
&& strstr(m_expectedAddedAssetPath.c_str(), assetInfo.m_relativePath.c_str()) != 0)
&& strstr(m_expectedAddedAssetPath.c_str(), assetInfo.m_relativePath.c_str()) != nullptr)
{
m_expectedAddedAssetPath.clear();
m_recentlyAddedAssetPath = assetInfo.m_relativePath;
@@ -902,7 +903,7 @@ namespace AzToolsFramework
statusString = QString("%1");
}
statusString = statusString.arg(m_currentAsset).arg(m_queuedAssetStatus);
statusString = statusString.arg(m_currentAsset);
if (!m_queuedAssetStatus.isEmpty())
{
@@ -920,7 +921,7 @@ namespace AzToolsFramework
void AssetEditorWidget::SetupHeader()
{
QString nameString = QString("%1").arg(m_currentAsset).arg(m_queuedAssetStatus);
QString nameString = QString("%1").arg(m_currentAsset);
m_header->setName(nameString);
@@ -52,6 +52,8 @@
#include <AzToolsFramework/AssetBrowser/AssetBrowserComponent.h>
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.h>
AZ_DEFINE_BUDGET(AzToolsFramework);
namespace AzToolsFramework
{
AzToolsFrameworkModule::AzToolsFrameworkModule()
@@ -103,7 +103,7 @@ namespace AzToolsFramework
newData.clear();
AZ::IO::ByteContainerStream<CacheLineType> ms(&newData);
AZ::SerializeContext* sc = NULL;
AZ::SerializeContext* sc = nullptr;
EBUS_EVENT_RESULT(sc, AZ::ComponentApplicationBus, GetSerializeContext);
AZ_Assert(sc, "Serialization context not found!");
@@ -34,7 +34,7 @@ namespace AzToolsFramework
void SelectionCommand::Post()
{
UndoSystem::UndoStack* undoStack = NULL;
UndoSystem::UndoStack* undoStack = nullptr;
EBUS_EVENT_RESULT(undoStack, AzToolsFramework::ToolsApplicationRequests::Bus, GetUndoStack);
if (undoStack)
@@ -262,7 +262,7 @@ namespace AzToolsFramework
m_serializeContext->EnumerateDerived<AZ::Component>(
[&typeNameList, entityType](const AZ::SerializeContext::ClassData* componentClass, const AZ::Uuid& knownType) -> bool
{
AZ_UNUSED(knownType)
AZ_UNUSED(knownType);
if (!componentClass->m_editData)
{
@@ -1324,7 +1324,7 @@ namespace AzToolsFramework
AZ::SliceComponent::EntityAncestorList::const_iterator ancestorIter = ancestors.begin();
// Skip the first, that would be a regular slice root and not a subslice root, which was already checked.
++ancestorIter;
for (ancestorIter; ancestorIter != ancestors.end(); ++ancestorIter)
for (; ancestorIter != ancestors.end(); ++ancestorIter)
{
const AZ::SliceComponent::Ancestor& ancestor = *ancestorIter;
if (!ancestor.m_entity || !SliceUtilities::IsRootEntity(*ancestor.m_entity))
@@ -98,7 +98,6 @@ namespace AzToolsFramework
void SliceEditorEntityOwnershipService::OnSlicePreInstantiate(const AZ::Data::AssetId& sliceAssetId, const AZ::SliceComponent::SliceInstanceAddress& sliceAddress)
{
AZ_PROFILE_FUNCTION(AzToolsFramework);
const AzFramework::SliceInstantiationTicket ticket = *AzFramework::SliceInstantiationResultBus::GetCurrentBusId();
// Start an undo that will wrap the entire slice instantiation event (unable to do this at a higher level since this is queued up by AzFramework and there's no undo concept at that level)
ToolsApplicationRequests::Bus::Broadcast(&ToolsApplicationRequests::Bus::Events::BeginUndoBatch, "Slice Instantiation");
@@ -158,6 +158,16 @@ namespace AzToolsFramework
SetImplementation(nullptr);
}
void QtEventToAzInputMapper::EditorQtMouseDevice::SetSystemCursorState(const AzFramework::SystemCursorState systemCursorState)
{
m_systemCursorState = systemCursorState;
}
AzFramework::SystemCursorState QtEventToAzInputMapper::EditorQtMouseDevice::GetSystemCursorState() const
{
return m_systemCursorState;
}
QtEventToAzInputMapper::QtEventToAzInputMapper(QWidget* sourceWidget, int syntheticDeviceId)
: QObject(sourceWidget)
, m_sourceWidget(sourceWidget)
@@ -210,12 +220,15 @@ namespace AzToolsFramework
if (m_capturingCursor != enabled)
{
m_capturingCursor = enabled;
if (m_capturingCursor)
{
m_mouseDevice->SetSystemCursorState(AzFramework::SystemCursorState::ConstrainedAndHidden);
qApp->setOverrideCursor(Qt::BlankCursor);
}
else
{
m_mouseDevice->SetSystemCursorState(AzFramework::SystemCursorState::UnconstrainedAndVisible);
qApp->restoreOverrideCursor();
}
}
@@ -238,10 +251,22 @@ namespace AzToolsFramework
return false;
}
// If our focus changes, go ahead and reset all input devices.
if (eventType == QEvent::FocusIn || eventType == QEvent::FocusOut)
{
// If our focus changes, go ahead and reset all input devices.
HandleFocusChange(event);
// If we focus in on the source widget and the mouse is contained in its
// bounds, refresh the cached cursor position to ensure it is up to date (this
// ensures cursor positions are refreshed correctly with context menu focus changes)
if (eventType == QEvent::FocusIn)
{
const auto widgetCursorPosition = m_sourceWidget->mapFromGlobal(QCursor::pos());
if (m_sourceWidget->geometry().contains(widgetCursorPosition))
{
HandleMouseMoveEvent(widgetCursorPosition);
}
}
}
// Map key events to input channels.
// ShortcutOverride is used in lieu of KeyPress for high priority input channels like Alt
@@ -249,7 +274,7 @@ namespace AzToolsFramework
else if (
eventType == QEvent::Type::KeyPress || eventType == QEvent::Type::KeyRelease || eventType == QEvent::Type::ShortcutOverride)
{
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
auto keyEvent = static_cast<QKeyEvent*>(event);
HandleKeyEvent(keyEvent);
}
// Map mouse events to input channels.
@@ -257,20 +282,20 @@ namespace AzToolsFramework
eventType == QEvent::Type::MouseButtonPress || eventType == QEvent::Type::MouseButtonRelease ||
eventType == QEvent::Type::MouseButtonDblClick)
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
auto mouseEvent = static_cast<QMouseEvent*>(event);
HandleMouseButtonEvent(mouseEvent);
}
// Map mouse movement to the movement input channels.
// This includes SystemCursorPosition alongside Movement::X and Movement::Y.
else if (eventType == QEvent::Type::MouseMove)
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
HandleMouseMoveEvent(mouseEvent);
auto mouseEvent = static_cast<QMouseEvent*>(event);
HandleMouseMoveEvent(mouseEvent->pos());
}
// Map wheel events to the mouse Z movement channel.
else if (eventType == QEvent::Type::Wheel)
{
QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event);
auto wheelEvent = static_cast<QWheelEvent*>(event);
HandleWheelEvent(wheelEvent);
}
@@ -345,9 +370,8 @@ namespace AzToolsFramework
return QPoint{ denormalizedX, denormalizedY };
}
void QtEventToAzInputMapper::HandleMouseMoveEvent(QMouseEvent* mouseEvent)
void QtEventToAzInputMapper::HandleMouseMoveEvent(const QPoint& cursorPosition)
{
const QPoint cursorPosition = mouseEvent->pos();
const QPoint cursorDelta = cursorPosition - m_previousCursorPosition;
m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition = WidgetPositionToNormalizedPosition(cursorPosition);
@@ -357,17 +381,14 @@ namespace AzToolsFramework
if (m_capturingCursor)
{
// Reset our cursor position to the previous point.
const QPoint targetScreenPosition = m_sourceWidget->mapToGlobal(m_previousCursorPosition);
AzQtComponents::SetCursorPos(targetScreenPosition);
// Even though we just set the cursor position, there are edge cases such as remote desktop that will leave
// the cursor position unchanged. For safety, we re-cache our last cursor position for delta generation.
const QPoint actualWidgetPosition = m_sourceWidget->mapFromGlobal(QCursor::pos());
m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition = WidgetPositionToNormalizedPosition(actualWidgetPosition);
// Reset our cursor position to the previous point
const QPoint screenCursorPosition = m_sourceWidget->mapToGlobal(m_previousCursorPosition);
AzQtComponents::SetCursorPos(screenCursorPosition);
}
else
{
m_previousCursorPosition = cursorPosition;
}
m_previousCursorPosition = cursorPosition;
}
void QtEventToAzInputMapper::HandleKeyEvent(QKeyEvent* keyEvent)
@@ -105,7 +105,14 @@ namespace AzToolsFramework
public:
EditorQtMouseDevice(AzFramework::InputDeviceId id);
// AzFramework::InputDeviceMouse overrides ...
void SetSystemCursorState(AzFramework::SystemCursorState systemCursorState) override;
AzFramework::SystemCursorState GetSystemCursorState() const override;
friend class QtEventToAzInputMapper;
private:
AzFramework::SystemCursorState m_systemCursorState = AzFramework::SystemCursorState::UnconstrainedAndVisible;
};
// Emits InputChannelUpdated if channel has transitioned in state (i.e. has gone from active to inactive or vice versa).
@@ -122,7 +129,7 @@ namespace AzToolsFramework
// Handle mouse click events.
void HandleMouseButtonEvent(QMouseEvent* mouseEvent);
// Handle mouse move events.
void HandleMouseMoveEvent(QMouseEvent* mouseEvent);
void HandleMouseMoveEvent(const QPoint& cursorPosition);
// Handles key press / release events (or ShortcutOverride events for keys listed in m_highPriorityKeys).
void HandleKeyEvent(QKeyEvent* keyEvent);
// Handles mouse wheel events.
@@ -895,7 +895,7 @@ namespace AzToolsFramework
// calculate average position of selected vertices for translation manipulator
MidpointCalculator midpointCalculator;
m_translationManipulator->Process(
[this, &midpointCalculator, fixedVertices](typename IndexedTranslationManipulator<Vertex>::VertexLookup& vertex)
[&midpointCalculator, fixedVertices](typename IndexedTranslationManipulator<Vertex>::VertexLookup& vertex)
{
Vertex v;
bool found = false;
@@ -1306,7 +1306,7 @@ namespace AzToolsFramework
void EditorVertexSelectionVariable<Vertex>::PrepareActions()
{
ActionOverride deleteAction = CreateDeleteAction(
s_deleteVerticesTitle, s_duplicateVerticesDesc,
s_deleteVerticesTitle, s_deleteVerticesDesc,
[this]()
{
DestroySelected();
@@ -650,7 +650,10 @@ namespace AzToolsFramework
AZStd::unique_ptr<AZ::Entity> Instance::DetachContainerEntity()
{
m_instanceEntityMapper->UnregisterEntity(m_containerEntity->GetId());
if (m_containerEntity)
{
m_instanceEntityMapper->UnregisterEntity(m_containerEntity->GetId());
}
return AZStd::move(m_containerEntity);
}
}
@@ -262,8 +262,6 @@ namespace AzToolsFramework
void InstanceToTemplatePropagator::AddPatchesToLink(const PrefabDom& patches, Link& link)
{
PrefabDom& linkDom = link.GetLinkDom();
PrefabDomValueReference linkPatchesReference =
PrefabDomUtils::FindPrefabDomValue(linkDom, PrefabDomUtils::PatchesName);
/*
If the original allocator the patches were created with gets destroyed, then the patches would become garbage in the
@@ -181,10 +181,10 @@ namespace AzToolsFramework
PrefabDomUtils::ApplyPatches(sourceTemplateDomCopy, targetTemplatePrefabDom.GetAllocator(), patchesReference->get());
linkedInstanceDom.CopyFrom(sourceTemplateDomCopy, targetTemplatePrefabDom.GetAllocator());
PrefabDomValueReference sourceTemplateName =
[[maybe_unused]] PrefabDomValueReference sourceTemplateName =
PrefabDomUtils::FindPrefabDomValue(sourceTemplateDomCopy, PrefabDomUtils::SourceName);
AZ_Assert(sourceTemplateName && sourceTemplateName->get().IsString(), "A valid source template name couldn't be found");
PrefabDomValueReference targetTemplateName =
[[maybe_unused]] PrefabDomValueReference targetTemplateName =
PrefabDomUtils::FindPrefabDomValue(targetTemplatePrefabDom, PrefabDomUtils::SourceName);
AZ_Assert(targetTemplateName && targetTemplateName->get().IsString(), "A valid target template name couldn't be found");
@@ -253,6 +253,15 @@ namespace AzToolsFramework
settings.m_metadata.Add(&entityIdMapper);
settings.m_metadata.Create<InstanceEntityScrubber>(newlyAddedEntities);
AZStd::string scratchBuffer;
auto issueReportingCallback = [&scratchBuffer](
AZStd::string_view message, AZ::JsonSerializationResult::ResultCode result,
AZStd::string_view path) -> AZ::JsonSerializationResult::ResultCode
{
return Internal::JsonIssueReporter(scratchBuffer, message, result, path);
};
settings.m_reporting = AZStd::move(issueReportingCallback);
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::Load(instance, prefabDom, settings);
AZ::Data::AssetManager::Instance().ResumeAssetRelease();
@@ -11,11 +11,12 @@
#include <AzCore/Component/Entity.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/Serialization/Json/JsonUtils.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/StringFunc/StringFunc.h>
#include <AzCore/Utils/Utils.h>
#include <AzFramework/Asset/AssetSystemBus.h>
#include <AzFramework/FileFunc/FileFunc.h>
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/Prefab/PrefabDomUtils.h>
@@ -147,7 +148,7 @@ namespace AzToolsFramework
}
// Read Template's prefab file from disk and parse Prefab DOM from file.
AZ::Outcome<PrefabDom, AZStd::string> readPrefabFileResult = AzFramework::FileFunc::ReadJsonFromString(fileContent);
AZ::Outcome<PrefabDom, AZStd::string> readPrefabFileResult = AZ::JsonSerializationUtils::ReadJsonString(fileContent);
if (!readPrefabFileResult.IsSuccess())
{
AZ_Error(
@@ -359,7 +360,7 @@ namespace AzToolsFramework
return false;
}
auto outcome = AzFramework::FileFunc::WriteJsonFile(domAndFilepath->first, GetFullPath(domAndFilepath->second));
auto outcome = AZ::JsonSerializationUtils::WriteJsonFile(domAndFilepath->first, GetFullPath(domAndFilepath->second).Native());
if (!outcome.IsSuccess())
{
AZ_Error(
@@ -400,7 +401,7 @@ namespace AzToolsFramework
return false;
}
auto outcome = AzFramework::FileFunc::WriteJsonFile(domAndFilepath->first, absolutePath);
auto outcome = AZ::JsonSerializationUtils::WriteJsonFile(domAndFilepath->first, absolutePath.Native());
if (!outcome.IsSuccess())
{
AZ_Error(
@@ -423,7 +424,7 @@ namespace AzToolsFramework
return false;
}
auto outcome = AzFramework::FileFunc::WriteJsonToString(domAndFilepath->first, output);
auto outcome = AZ::JsonSerializationUtils::WriteJsonString(domAndFilepath->first, output);
if (!outcome.IsSuccess())
{
AZ_Error(
@@ -1259,12 +1259,12 @@ namespace AzToolsFramework
auto& containerEntity = *containerEntityPtr.release();
auto editorPrefabComponent = containerEntity.FindComponent<EditorPrefabComponent>();
containerEntity.Deactivate();
const bool editorPrefabComponentRemoved = containerEntity.RemoveComponent(editorPrefabComponent);
[[maybe_unused]] const bool editorPrefabComponentRemoved = containerEntity.RemoveComponent(editorPrefabComponent);
AZ_Assert(editorPrefabComponentRemoved, "Remove EditorPrefabComponent failed.");
delete editorPrefabComponent;
containerEntity.Activate();
const bool containerEntityAdded = parentInstance.AddEntity(containerEntity);
[[maybe_unused]] const bool containerEntityAdded = parentInstance.AddEntity(containerEntity);
AZ_Assert(containerEntityAdded, "Add target Instance's container entity to its parent Instance failed.");
EntityIdList entityIds;
@@ -1281,7 +1281,7 @@ namespace AzToolsFramework
[&](AZStd::unique_ptr<AZ::Entity> entityPtr)
{
auto& entity = *entityPtr.release();
const bool entityAdded = parentInstance.AddEntity(entity);
[[maybe_unused]] const bool entityAdded = parentInstance.AddEntity(entity);
AZ_Assert(entityAdded, "Add target Instance's entity to its parent Instance failed.");
entityIds.emplace_back(entity.GetId());
@@ -1298,9 +1298,6 @@ namespace AzToolsFramework
command->RunRedo();
}
const auto instanceTemplateId = instancePtr->GetTemplateId();
auto parentContainerEntityId = parentInstance.GetContainerEntityId();
instancePtr->DetachNestedInstances(
[&](AZStd::unique_ptr<Instance> detachedNestedInstance)
{
@@ -463,7 +463,7 @@ namespace AzToolsFramework
linkId, templateId, templateToDelete.GetFilePath().c_str());
}
result = m_templateToLinkIdsMap.erase(templateToLinkIterator) != 0;
result = m_templateToLinkIdsMap.erase(templateToLinkIterator) != nullptr;
AZ_Assert(result,
"Prefab - PrefabSystemComponent::RemoveTemplate - "
"Failed to remove Template with Id '%llu' on file path '%s' "
@@ -858,7 +858,7 @@ namespace AzToolsFramework
PrefabDomValue& instance = instanceIterator->value;
AZ_Assert(instance.IsObject(), "Nested instance DOM provided is not a valid JSON object.");
PrefabDomValueReference sourceTemplateName = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::SourceName);
[[maybe_unused]] PrefabDomValueReference sourceTemplateName = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::SourceName);
AZ_Assert(sourceTemplateName, "Couldn't find source template name in the DOM of the nested instance while creating a link.");
AZ_Assert(
sourceTemplateName->get() == sourceTemplate.GetFilePath().c_str(),
@@ -262,7 +262,7 @@ namespace AzToolsFramework
instanceDom.CopyFrom(instanceDomRef->get(), instanceDom.GetAllocator());
//apply the patch to the template within the target
AZ::JsonSerializationResult::ResultCode result = PrefabDomUtils::ApplyPatches(instanceDom, instanceDom.GetAllocator(), patch);
[[maybe_unused]] AZ::JsonSerializationResult::ResultCode result = PrefabDomUtils::ApplyPatches(instanceDom, instanceDom.GetAllocator(), patch);
AZ_Error(
"Prefab",
@@ -65,16 +65,24 @@ namespace AzToolsFramework::Prefab::PrefabConversionUtils
AzFramework::Spawnable::EntityList& entities = spawnable->GetEntities();
for (auto it = entities.begin(); it != entities.end(); )
{
(*it)->InvalidateDependencies();
AZ::Entity::DependencySortOutcome evaluation = (*it)->EvaluateDependenciesGetDetails();
if (evaluation.IsSuccess())
if (*it)
{
++it;
(*it)->InvalidateDependencies();
AZ::Entity::DependencySortOutcome evaluation = (*it)->EvaluateDependenciesGetDetails();
if (evaluation.IsSuccess())
{
++it;
}
else
{
AZ_Error(
"Prefabs", false, "Entity '%s' %s cannot be activated for the following reason: %s", (*it)->GetName().c_str(),
(*it)->GetId().ToString().c_str(), evaluation.GetError().m_message.c_str());
it = entities.erase(it);
}
}
else
{
AZ_Error("Prefabs", false, "Entity '%s' %s cannot be activated for the following reason: %s",
(*it)->GetName().c_str(), (*it)->GetId().ToString().c_str(), evaluation.GetError().m_message.c_str());
it = entities.erase(it);
}
}
@@ -461,7 +461,7 @@ namespace AzToolsFramework
msgBox.setStandardButtons(QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Yes);
msgBox.setDetailedText(message.c_str());
const int response = msgBox.exec();
msgBox.exec();
if (msgBox.clickedButton() == moveButton)
{
@@ -2043,7 +2043,7 @@ namespace AzToolsFramework
QAction* confirmSelected = new QAction(detachMenu);
confirmationMessageBox->addAction(confirmSelected);
QObject::connect(reassignToAction, &QAction::triggered, [reassignToAction, confirmationMessageBox, selectedEntity, ancestors, currentAncestorIndex]() mutable
QObject::connect(reassignToAction, &QAction::triggered, [confirmationMessageBox, ancestors, currentAncestorIndex]() mutable
{
if (confirmationMessageBox->exec() == QDialog::Accepted)
{
@@ -4094,7 +4094,7 @@ namespace AzToolsFramework
using SCCommandBus = AzToolsFramework::SourceControlCommandBus;
SCCommandBus::Broadcast(&SCCommandBus::Events::RequestEdit, fullFilePath.c_str(), true,
[sliceEntity, fullFilePath, tmpFileName, tmpFilesaved](bool /*success*/, const AzToolsFramework::SourceControlFileInfo& info)
[fullFilePath, tmpFileName, tmpFilesaved](bool /*success*/, const AzToolsFramework::SourceControlFileInfo& info)
{
if (!info.IsReadOnly())
{
@@ -4200,8 +4200,6 @@ namespace AzToolsFramework
if (canPush)
{
AZ::Data::AssetId targetSliceAssetId = sliceAncestryToPushTo.at(0).m_sliceAddress.GetReference()->GetSliceAsset().GetId();
//remember we're trying to push to this root, so we don't try to push to any others
size_t ancestrySize = sliceAncestryToPushTo.size();
rootAncestorPushList.push_back(sliceAncestryToPushTo[ancestrySize-1].m_sliceAddress.GetReference()->GetSliceAsset().GetId());
@@ -1315,7 +1315,7 @@ namespace AzToolsFramework
void PerforceComponent::ThreadWorker()
{
m_ProcessThreadID = AZStd::this_thread::get_id();
while (1)
while (true)
{
// block until signaled:
m_WorkerSemaphore.acquire();
@@ -23,7 +23,6 @@ namespace AzToolsFramework
LoadingThumbnail::LoadingThumbnail()
: Thumbnail(MAKE_TKEY(ThumbnailKey))
, m_angle(0)
{
auto absoluteIconPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / LoadingIconPath;
m_loadingMovie.setFileName(absoluteIconPath.c_str());
@@ -37,7 +37,6 @@ namespace AzToolsFramework
void OnTick(float deltaTime, AZ::ScriptTimePoint /*time*/) override;
private:
float m_angle;
QMovie m_loadingMovie;
};
} // namespace Thumbnailer
@@ -38,7 +38,7 @@ namespace AZ
AttributeDynamicScriptValue(const DynamicSerializableField& value)
: m_value(value) {}
virtual ~AttributeDynamicScriptValue()
~AttributeDynamicScriptValue() override
{
m_value.DestroyData();
}
@@ -1031,15 +1031,15 @@ namespace AzToolsFramework
->Attribute("EditButton", "")
->Attribute("EditDescription", "Open in Lua Editor")
->Attribute("EditCallback", &ScriptEditorComponent::LaunchLuaEditor)
->DataElement(0, &ScriptEditorComponent::m_scriptComponent, "Script properties", "The script template")
->DataElement(nullptr, &ScriptEditorComponent::m_scriptComponent, "Script properties", "The script template")
->SetDynamicEditDataProvider(&ScriptEditorComponent::GetScriptPropertyEditData)
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
ec->Class<AzFramework::ScriptComponent>("Script Component", "Adding scripting functionality to the entity!")
->DataElement(0, &AzFramework::ScriptComponent::m_properties, "Properties", "Lua script properties")
->DataElement(nullptr, &AzFramework::ScriptComponent::m_properties, "Properties", "Lua script properties")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(0, &AzFramework::ScriptComponent::m_script, "Asset", "")
->DataElement(nullptr, &AzFramework::ScriptComponent::m_script, "Asset", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::Hide)
->Attribute(AZ::Edit::Attributes::SliceFlags, AZ::Edit::SliceFlags::NotPushable) // Only the editor-component's script asset needs to be slice-pushable.
;
@@ -1048,9 +1048,9 @@ namespace AzToolsFramework
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")->
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AzFramework::ScriptPropertyGroup::m_name)->
Attribute(AZ::Edit::Attributes::AutoExpand, true)->
DataElement(0, &AzFramework::ScriptPropertyGroup::m_properties, "m_properties", "Properties in this property group")->
DataElement(nullptr, &AzFramework::ScriptPropertyGroup::m_properties, "m_properties", "Properties in this property group")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
DataElement(0, &AzFramework::ScriptPropertyGroup::m_groups, "m_groups", "Subgroups in this property group")->
DataElement(nullptr, &AzFramework::ScriptPropertyGroup::m_groups, "m_groups", "Subgroups in this property group")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly);
ec->Class<AZ::ScriptProperty>("Script Property", "Base class for script properties")->
@@ -1060,50 +1060,50 @@ namespace AzToolsFramework
ec->Class<AZ::ScriptPropertyBoolean>("Script Property (bool)", "A script boolean property")->
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
DataElement(0, &AZ::ScriptPropertyBoolean::m_value, "m_value", "A boolean")->
DataElement(nullptr, &AZ::ScriptPropertyBoolean::m_value, "m_value", "A boolean")->
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name);
ec->Class<AZ::ScriptPropertyNumber>("Script Property (number)", "A script number property")->
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
DataElement(0, &AZ::ScriptPropertyNumber::m_value, "m_value", "A number")->
DataElement(nullptr, &AZ::ScriptPropertyNumber::m_value, "m_value", "A number")->
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name);
ec->Class<AZ::ScriptPropertyString>("Script Property (string)", "A script string property")->
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
DataElement(0, &AZ::ScriptPropertyString::m_value, "m_value", "A string")->
DataElement(nullptr, &AZ::ScriptPropertyString::m_value, "m_value", "A string")->
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name);
ec->Class<AZ::ScriptPropertyGenericClass>("Script Property (object)", "A script object property")->
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
DataElement(0, &AZ::ScriptPropertyGenericClass::m_value, "m_value", "An object")->
DataElement(nullptr, &AZ::ScriptPropertyGenericClass::m_value, "m_value", "An object")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly);
ec->Class<AZ::ScriptPropertyBooleanArray>("Script Property Array(bool)", "A script bool array property")->
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyBooleanArray's class attributes.")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
DataElement(0, &AZ::ScriptPropertyBooleanArray::m_values, "m_value", "An object")->
DataElement(nullptr, &AZ::ScriptPropertyBooleanArray::m_values, "m_value", "An object")->
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name);
ec->Class<AZ::ScriptPropertyNumberArray>("Script Property Array(number)", "A script number array property")->
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyNumberArray's class attributes.")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
DataElement(0, &AZ::ScriptPropertyNumberArray::m_values, "m_value", "An object")->
DataElement(nullptr, &AZ::ScriptPropertyNumberArray::m_values, "m_value", "An object")->
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name);
ec->Class<AZ::ScriptPropertyStringArray>("Script Property Array(string)", "A script string array property")->
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyStringArray's class attributes.")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
DataElement(0, &AZ::ScriptPropertyStringArray::m_values, "m_value", "An object")->
DataElement(nullptr, &AZ::ScriptPropertyStringArray::m_values, "m_value", "An object")->
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name);
ec->Class<AZ::ScriptPropertyGenericClassArray>("Script Property Array(object)", "A script object array property")->
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGenericClassArray's class attributes.")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
Attribute(AZ::Edit::Attributes::DynamicElementType, &AZ::ScriptPropertyGenericClassArray::GetElementTypeUuid)->
DataElement(0, &AZ::ScriptPropertyGenericClassArray::m_values, "m_value", "An object")->
DataElement(nullptr, &AZ::ScriptPropertyGenericClassArray::m_values, "m_value", "An object")->
ElementAttribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name);
@@ -111,9 +111,6 @@ namespace AzToolsFramework
painter, option.rect.left() - 1, option.rect.top(), option.rect.bottom(), m_layerBorderBottomColor, layerColor);
}
QModelIndex nameColumn = index.sibling(index.row(), EntityOutlinerListModel::Column::ColumnName);
QModelIndex sibling = index.sibling(index.row() + 1, index.column());
QPoint lineBottomLeft(option.rect.bottomLeft());
QPoint lineTopLeft(option.rect.topLeft());
@@ -17,21 +17,21 @@ namespace LegacyFramework
{
const char* appName()
{
const char* result = NULL;
const char* result = nullptr;
EBUS_EVENT_RESULT(result, FrameworkApplicationMessages::Bus, GetApplicationName);
return result;
}
const char* appModule()
{
const char* result = NULL;
const char* result = nullptr;
EBUS_EVENT_RESULT(result, FrameworkApplicationMessages::Bus, GetApplicationModule);
return result;
}
const char* appDir()
{
const char* result = NULL;
const char* result = nullptr;
EBUS_EVENT_RESULT(result, FrameworkApplicationMessages::Bus, GetApplicationDirectory);
return result;
}
@@ -74,7 +74,7 @@ namespace LegacyFramework
// helper function which retrieves the serialize context and asserts if its not found.
AZ::SerializeContext* GetSerializeContext()
{
AZ::SerializeContext* serializeContext = NULL;
AZ::SerializeContext* serializeContext = nullptr;
EBUS_EVENT_RESULT(serializeContext, AZ::ComponentApplicationBus, GetSerializeContext);
AZ_Assert(serializeContext, "No serialize context");
return serializeContext;
@@ -35,10 +35,8 @@
#include <AzFramework/Asset/AssetCatalogComponent.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzFramework/TargetManagement/TargetManagementComponent.h>
#include <AzFramework/Driller/RemoteDrillerInterface.h>
#include <AzCore/Driller/Driller.h>
#include <AzCore/Debug/ProfilerDriller.h>
#ifdef AZ_PLATFORM_WINDOWS
#include "shlobj.h"
@@ -50,7 +48,7 @@
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 'QFileInfo::d_ptr': class 'QSharedDataPointer<QFileInfoPrivate>' needs to have dll-interface to be used by clients of class 'QFileInfo'
#include <QFileInfo>
AZ_POP_DISABLE_OVERRIDE_WARNING
AZ_POP_DISABLE_WARNING
#include <QSharedMemory>
#include <QStandardPaths>
#include <QtWidgets/QApplication>
@@ -239,7 +237,7 @@ namespace LegacyFramework
{
m_applicationEntity->Deactivate();
delete m_applicationEntity;
m_applicationEntity = NULL;
m_applicationEntity = nullptr;
}
AZ::SystemTickBus::ExecuteQueuedEvents();
@@ -251,7 +249,7 @@ namespace LegacyFramework
#endif
delete m_ptrCommandLineParser;
m_ptrCommandLineParser = NULL;
m_ptrCommandLineParser = nullptr;
CoreMessageBus::Handler::BusDisconnect();
FrameworkApplicationMessages::Handler::BusDisconnect();
@@ -271,7 +269,7 @@ namespace LegacyFramework
{
m_applicationEntity->Deactivate();
delete m_applicationEntity;
m_applicationEntity = NULL;
m_applicationEntity = nullptr;
}
}
@@ -485,8 +483,6 @@ namespace LegacyFramework
void Application::CreateApplicationComponents()
{
EnsureComponentCreated(AzFramework::TargetManagementComponent::RTTI_Type());
EnsureComponentCreated(AzFramework::DrillerNetworkConsoleComponent::RTTI_Type());
EnsureComponentCreated(AzFramework::DrillerNetworkAgentComponent::RTTI_Type());
}
void Application::CreateSystemComponents()
@@ -507,8 +503,6 @@ namespace LegacyFramework
ComponentApplication::RegisterCoreComponents();
RegisterComponentDescriptor(AzFramework::TargetManagementComponent::CreateDescriptor());
RegisterComponentDescriptor(AzFramework::DrillerNetworkConsoleComponent::CreateDescriptor());
RegisterComponentDescriptor(AzFramework::DrillerNetworkAgentComponent::CreateDescriptor());
RegisterComponentDescriptor(AzToolsFramework::Framework::CreateDescriptor());
}
}
@@ -144,9 +144,9 @@ namespace AzToolsFramework
qInstallMessageHandler(myMessageOutput);
}
virtual ~AZQtApplication()
~AZQtApplication() override
{
qInstallMessageHandler(NULL);
qInstallMessageHandler(nullptr);
}
};
@@ -201,9 +201,9 @@ namespace AzToolsFramework
// enable the built-in stylesheet by default:
bool enableStyleSheet = true;
const AzFramework::CommandLine* comp = NULL;
const AzFramework::CommandLine* comp = nullptr;
EBUS_EVENT_RESULT(comp, LegacyFramework::FrameworkApplicationMessages::Bus, GetCommandLineParser);
if (comp != NULL)
if (comp != nullptr)
{
if (comp->HasSwitch("nostyle"))
{
@@ -275,18 +275,18 @@ namespace AzToolsFramework
// see still need to clean up:
m_ptrTicker->cancel();
QApplication::processEvents();
AZ::ComponentApplication* pApp = NULL;
AZ::ComponentApplication* pApp = nullptr;
EBUS_EVENT_RESULT(pApp, AZ::ComponentApplicationBus, GetApplication);
if (pApp)
{
pApp->Tick();
}
azdestroy(m_ptrTicker);
m_ptrTicker = NULL;
m_ptrTicker = nullptr;
}
}
Framework::~Framework(void)
Framework::~Framework()
{
AZ::SystemTickBus::Handler::BusDisconnect();
@@ -299,7 +299,7 @@ namespace AzToolsFramework
delete m_ActionChangeProject;
m_ActionChangeProject = nullptr;
pApplication = NULL;
pApplication = nullptr;
}
// once we set the project, we can then tell all our other windows to restore our state.
@@ -360,7 +360,7 @@ namespace AzToolsFramework
}
m_bTicking = true;
// Tick the component app.
AZ::ComponentApplication* pApp = NULL;
AZ::ComponentApplication* pApp = nullptr;
EBUS_EVENT_RESULT(pApp, AZ::ComponentApplicationBus, GetApplication);
if (pApp)
{
@@ -491,7 +491,7 @@ namespace AzToolsFramework
// we successfully got permission to quit!
// pump the tickbus one last time!
// QApplication::processEvents();
AZ::ComponentApplication* pApp = NULL;
AZ::ComponentApplication* pApp = nullptr;
EBUS_EVENT_RESULT(pApp, AZ::ComponentApplicationBus, GetApplication);
if (pApp)
{
@@ -501,7 +501,7 @@ namespace AzToolsFramework
m_ptrTicker->cancel();
azdestroy(m_ptrTicker);
m_ptrTicker = NULL;
m_ptrTicker = nullptr;
QApplication::quit();
}
@@ -38,7 +38,7 @@ namespace AzToolsFramework
else
{
delete m_View;
m_View = NULL;
m_View = nullptr;
}
}
void Framework::PreferencesAccepted()
@@ -59,11 +59,11 @@ namespace AzToolsFramework
if (m_View)
{
delete m_View;
m_View = NULL;
m_View = nullptr;
}
if (m_Model)
{
m_Model = NULL;
m_Model = nullptr;
}
}
@@ -61,7 +61,7 @@ namespace AzToolsFramework
, m_impl(new BaseLogPanel::Impl)
{
m_impl->storageID = 0;
this->setLayout(aznew LogPanelLayout(NULL));
this->setLayout(aznew LogPanelLayout(nullptr));
m_impl->pTabWidget = new AzQtComponents::TabWidget(this);
m_impl->pTabWidget->setObjectName(QString::fromUtf8("tabWidget"));
@@ -601,7 +601,7 @@ namespace AzToolsFramework
{
if (index >= (int)m_children.size())
{
return NULL;
return nullptr;
}
return m_children[index];
@@ -609,11 +609,11 @@ namespace AzToolsFramework
QLayoutItem* LogPanelLayout::takeAt(int index)
{
QLayoutItem* pItem = NULL;
QLayoutItem* pItem = nullptr;
if (index >= (int)m_children.size())
{
return NULL;
return nullptr;
}
pItem = m_children[index];
@@ -657,7 +657,6 @@ namespace AzToolsFramework
// if we have any elements, the last element is top right aligned:
QLayoutItem* pItem = m_children[m_children.size() - 1];
QSize lastItemSize = pItem->minimumSize();
QPoint topRight = effectiveRect.topRight();
QRect topRightCorner(effectiveRect.topRight() - QPoint(lastItemSize.width(), 0), lastItemSize);
pItem->setGeometry(topRightCorner);
}
@@ -861,7 +860,7 @@ namespace AzToolsFramework
return richLabel;
}
return NULL;
return nullptr;
}
bool LogPanelItemDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index)
@@ -322,7 +322,7 @@ namespace AzToolsFramework
actionList.removeAll(m_actionSelectAll);
}
QMenu::exec(actionList, QCursor::pos(), 0, this);
QMenu::exec(actionList, QCursor::pos(), nullptr, this);
}
void StyledLogTab::CopySelected()
@@ -43,7 +43,6 @@ AzToolsFramework--EntityOutlinerCheckBox
padding: 0;
padding-right: 2px;
line-height: 0px;
font-size: 0px;
margin: 0px;
max-height: 20px;
max-width: 18px;
@@ -59,7 +58,6 @@ AzToolsFramework--EntityOutlinerCheckBox::indicator
spacing: 0px;
padding: 0px;
line-height: 0px;
font-size: 0px;
margin: 3px 0 0 0;
max-width: 18px;
width: 18px;
@@ -1106,8 +1106,6 @@ namespace AzToolsFramework
QMimeData* EntityOutlinerListModel::mimeData(const QModelIndexList& indexes) const
{
AZ_PROFILE_FUNCTION(AzToolsFramework);
AZ::TypeId uuid1 = AZ::AzTypeInfo<AZ::Entity>::Uuid();
AZ::TypeId uuid2 = AZ::AzTypeInfo<EditorEntityIdContainer>::Uuid();
EditorEntityIdContainer entityIdList;
for (const QModelIndex& index : indexes)
@@ -1334,13 +1332,11 @@ namespace AzToolsFramework
QueueEntityUpdate(entityId);
}
void EntityOutlinerListModel::OnEntityInfoUpdatedRemoveChildBegin(AZ::EntityId parentId, AZ::EntityId childId)
void EntityOutlinerListModel::OnEntityInfoUpdatedRemoveChildBegin([[maybe_unused]] AZ::EntityId parentId, [[maybe_unused]] AZ::EntityId childId)
{
//add/remove operations trigger selection change signals which assert and break undo/redo operations in progress in inspector etc.
//so disallow selection updates until change is complete
emit EnableSelectionUpdates(false);
auto parentIndex = GetIndexFromEntity(parentId);
auto childIndex = GetIndexFromEntity(childId);
beginResetModel();
}
@@ -99,5 +99,6 @@ namespace AzToolsFramework
// Draw border at the bottom
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
painter->restore();
}
}
@@ -192,7 +192,7 @@ namespace AzToolsFramework
QAction* createAction = menu->addAction(QObject::tr("Create Prefab..."));
createAction->setToolTip(QObject::tr("Creates a prefab out of the currently selected entities."));
QObject::connect(createAction, &QAction::triggered, createAction, [this, selectedEntities] {
QObject::connect(createAction, &QAction::triggered, createAction, [selectedEntities] {
ContextMenu_CreatePrefab(selectedEntities);
});
}
@@ -206,7 +206,7 @@ namespace AzToolsFramework
instantiateAction->setToolTip(QObject::tr("Instantiates a prefab file in the scene."));
QObject::connect(
instantiateAction, &QAction::triggered, instantiateAction, [this] { ContextMenu_InstantiatePrefab(); });
instantiateAction, &QAction::triggered, instantiateAction, [] { ContextMenu_InstantiatePrefab(); });
}
menu->addSeparator();
@@ -231,7 +231,7 @@ namespace AzToolsFramework
QAction* editAction = menu->addAction(QObject::tr("Edit Prefab"));
editAction->setToolTip(QObject::tr("Edit the prefab in focus mode."));
QObject::connect(editAction, &QAction::triggered, editAction, [this, selectedEntity] {
QObject::connect(editAction, &QAction::triggered, editAction, [selectedEntity] {
ContextMenu_EditPrefab(selectedEntity);
});
@@ -248,7 +248,7 @@ namespace AzToolsFramework
QAction* saveAction = menu->addAction(QObject::tr("Save Prefab to file"));
saveAction->setToolTip(QObject::tr("Save the changes to the prefab to disk."));
QObject::connect(saveAction, &QAction::triggered, saveAction, [this, selectedEntity] {
QObject::connect(saveAction, &QAction::triggered, saveAction, [selectedEntity] {
ContextMenu_SavePrefab(selectedEntity);
});
@@ -264,7 +264,7 @@ namespace AzToolsFramework
}
QAction* deleteAction = menu->addAction(QObject::tr("Delete"));
QObject::connect(deleteAction, &QAction::triggered, deleteAction, [this] { ContextMenu_DeleteSelected(); });
QObject::connect(deleteAction, &QAction::triggered, deleteAction, [] { ContextMenu_DeleteSelected(); });
if (selectedEntities.size() == 0 ||
(selectedEntities.size() == 1 && s_prefabPublicInterface->IsLevelInstanceContainerEntity(selectedEntities[0])))
{
@@ -282,7 +282,7 @@ namespace AzToolsFramework
QAction* detachPrefabAction = menu->addAction(QObject::tr("Detach Prefab..."));
QObject::connect(
detachPrefabAction, &QAction::triggered, detachPrefabAction,
[this, selectedEntity]
[selectedEntity]
{
ContextMenu_DetachPrefab(selectedEntity);
});
@@ -1029,7 +1029,7 @@ namespace AzToolsFramework
msgBox.setStandardButtons(QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Yes);
msgBox.setDetailedText(message.c_str());
const int response = msgBox.exec();
msgBox.exec();
if (msgBox.clickedButton() == moveButton)
{
@@ -397,7 +397,7 @@ namespace AzToolsFramework
AzQtComponents::CardNotification * notification = CreateNotification(message);
const QPushButton * featureButton = notification->addButtonFeature(tr("Continue"));
connect(featureButton, &QPushButton::clicked, this, [this, notification]()
connect(featureButton, &QPushButton::clicked, this, [notification]()
{
notification->close();
});
@@ -135,7 +135,6 @@ namespace AzToolsFramework
QIcon m_warningIcon;
ReflectedPropertyEditor* m_propertyEditor = nullptr;
QVBoxLayout* m_mainLayout = nullptr;
AZ::SerializeContext* m_serializeContext;
@@ -2352,6 +2352,13 @@ namespace AzToolsFramework
{
QMenu* revertMenu = nullptr;
auto addRevertMenu = [&menu]()
{
QMenu* revertOverridesMenu = menu.addMenu(tr("Revert overrides"));
revertOverridesMenu->setToolTipsVisible(true);
return revertOverridesMenu;
};
//check for changes on selected property
if (componentClassData)
{
@@ -2372,8 +2379,7 @@ namespace AzToolsFramework
}
// Only add the "Revert overrides" menu option if it belongs to a slice
revertMenu = menu.addMenu(tr("Revert overrides"));
revertMenu->setToolTipsVisible(true);
revertMenu = addRevertMenu();
revertMenu->setEnabled(false);
if (fieldNode)
@@ -2447,6 +2453,10 @@ namespace AzToolsFramework
if (isPartOfSlice && hasSliceChanges)
{
if (!revertMenu)
{
revertMenu = addRevertMenu();
}
revertMenu->setEnabled(true);
QAction* revertComponentAction = revertMenu->addAction(tr("Component"));
@@ -2487,11 +2497,15 @@ namespace AzToolsFramework
relevantEntities.push_back(id);
}
if (!revertMenu)
{
revertMenu = addRevertMenu();
}
revertMenu->setEnabled(true);
QAction* revertAction = revertMenu->addAction(QObject::tr("Entity"));
revertAction->setToolTip(QObject::tr("This will revert all component properties on this entity to the last saved."));
QObject::connect(revertAction, &QAction::triggered, [this, relevantEntities]
QObject::connect(revertAction, &QAction::triggered, [relevantEntities]
{
SliceEditorEntityOwnershipServiceRequestBus::Broadcast(
&SliceEditorEntityOwnershipServiceRequests::ResetEntitiesToSliceDefaults, relevantEntities);
@@ -4394,7 +4408,6 @@ namespace AzToolsFramework
{
ResetDrag(event);
Qt::MouseButtons realButtons = QApplication::mouseButtons();
if (QApplication::overrideCursor() && !(event->buttons() & Qt::LeftButton))
{
QApplication::restoreOverrideCursor();
@@ -4606,7 +4619,6 @@ namespace AzToolsFramework
bool EntityPropertyEditor::GetComponentsAtDropEventPosition(QDropEvent* event, AZ::Entity::ComponentArrayType& targetComponents)
{
const QPoint globalPos(mapToGlobal(event->pos()));
const QRect globalRect(GetInflatedRectFromPoint(globalPos, kComponentEditorDropTargetPrecision));
//get component editor(s) where drop will occur
ComponentEditor* targetComponentEditor = GetReorderDropTarget(
@@ -236,7 +236,7 @@ namespace AzToolsFramework
AZ_Assert(container, "This node is NOT a container node!");
const AZ::SerializeContext::ClassElement* containerClassElement = container->GetElement(container->GetDefaultElementNameCrc());
AZ_Assert(containerClassElement != NULL, "We should have a valid default element in the container, otherwise we don't know what elements to make!");
AZ_Assert(containerClassElement != nullptr, "We should have a valid default element in the container, otherwise we don't know what elements to make!");
if (!containerClassElement)
{
return false;
@@ -261,7 +261,7 @@ namespace AzToolsFramework
AZ_Assert(newDataAddress, "Faliled to create new element for the continer!");
// cast to base type (if needed)
void* basePtr = m_context->DownCast(newDataAddress, classData->m_typeId, containerClassElement->m_typeId, classData->m_azRtti, containerClassElement->m_azRtti);
AZ_Assert(basePtr != NULL, "Can't cast container element %s to %s, make sure classes are registered in the system and not generics!", classData->m_name, containerClassElement->m_name);
AZ_Assert(basePtr != nullptr, "Can't cast container element %s to %s, make sure classes are registered in the system and not generics!", classData->m_name, containerClassElement->m_name);
*reinterpret_cast<void**>(dataAddress) = basePtr; // store the pointer in the class
/// Store the element in the container
container->StoreElement(GetInstance(i), dataAddress);
@@ -608,7 +608,7 @@ namespace AzToolsFramework
AZ_Assert(sc, "sc can't be NULL!");
AZ_Assert(m_rootInstances.size() > 0, "No root instances have been added to this hierarchy!");
m_curParentNode = NULL;
m_curParentNode = nullptr;
m_isMerging = false;
m_instances.clear();
m_children.clear();
@@ -636,7 +636,7 @@ namespace AzToolsFramework
for (size_t i = 1; i < m_rootInstances.size(); ++i)
{
m_curParentNode = NULL;
m_curParentNode = nullptr;
m_isMerging = true;
m_matched = false;
sc->EnumerateInstanceConst(
@@ -956,7 +956,7 @@ namespace AzToolsFramework
}
}
InstanceDataNode* node = NULL;
InstanceDataNode* node = nullptr;
// Extra steps need to be taken when we are merging
if (m_isMerging)
{
@@ -349,7 +349,7 @@ namespace AzToolsFramework
if (pAssetType)
{
(*pAssetType) = 0;
(*pAssetType) = nullptr;
}
if (!pData)
@@ -529,7 +529,7 @@ namespace AzToolsFramework
if (m_errorButton)
{
// If the button is already active, disconnect its pressed handler so we don't get multiple popups
disconnect(m_errorButton, &QPushButton::pressed, this, 0);
disconnect(m_errorButton, &QPushButton::pressed, this, nullptr);
}
else
{
@@ -548,7 +548,7 @@ namespace AzToolsFramework
// Connect pressed to opening the error dialog
// Must capture this for call to QObject::connect
connect(m_errorButton, &QPushButton::pressed, this, [this, errorLog]() {
connect(m_errorButton, &QPushButton::pressed, this, [errorLog]() {
// Create the dialog for the log panel, and set the layout
QDialog* logDialog = new QDialog();
logDialog->setMinimumSize(1024, 400);
@@ -93,24 +93,24 @@ namespace AzToolsFramework
void BoolPropertyComboBoxHandler::ConsumeAttribute(PropertyBoolComboBoxCtrl* GUI, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName)
{
(void)GUI;
(void)attrib;
(void)attrValue;
(void)debugName;
AZ_UNUSED(GUI);
AZ_UNUSED(attrib);
AZ_UNUSED(attrValue);
AZ_UNUSED(debugName);
}
void BoolPropertyComboBoxHandler::WriteGUIValuesIntoProperty(size_t index, PropertyBoolComboBoxCtrl* GUI, property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
bool val = GUI->value();
instance = static_cast<property_t>(val);
}
bool BoolPropertyComboBoxHandler::ReadValuesIntoGUI(size_t index, PropertyBoolComboBoxCtrl* GUI, const property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
bool val = instance;
GUI->setValue(val);
return false;
@@ -137,7 +137,7 @@ namespace AzToolsFramework
Q_UNUSED(debugName)
}
AZ::u32 U32CRCHandler::GetHandlerName(void) const
AZ::u32 U32CRCHandler::GetHandlerName() const
{
return AZ::Edit::UIHandlers::Crc;
}
@@ -173,16 +173,16 @@ namespace AzToolsFramework
void U32CRCHandler::WriteGUIValuesIntoProperty(size_t index, PropertyCRCCtrl* GUI, AZ::u32& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
AZ::u32 val = GUI->value();
instance = static_cast<property_t>(val);
}
bool U32CRCHandler::ReadValuesIntoGUI(size_t index, PropertyCRCCtrl* GUI, const AZ::u32& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
GUI->setValue(instance);
return false;
}
@@ -373,8 +373,8 @@ namespace AzToolsFramework
void AZColorPropertyHandler::WriteGUIValuesIntoProperty(size_t index, PropertyColorCtrl* GUI, property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
QColor val = GUI->value();
AZ::Color asAZColor((float)val.redF(), (float)val.greenF(), (float)val.blueF(), (float)val.alphaF());
instance = static_cast<property_t>(asAZColor);
@@ -382,8 +382,8 @@ namespace AzToolsFramework
bool AZColorPropertyHandler::ReadValuesIntoGUI(size_t index, PropertyColorCtrl* GUI, const property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
AZ::Vector4 asVector4 = static_cast<AZ::Vector4>(instance);
QColor asQColor;
asQColor.setRedF((qreal)asVector4.GetX());
@@ -410,8 +410,8 @@ namespace AzToolsFramework
}
void Vector3ColorPropertyHandler::WriteGUIValuesIntoProperty(size_t index, PropertyColorCtrl* GUI, property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
QColor val = GUI->value();
AZ::Vector3 asVector3((float)val.redF(), (float)val.greenF(), (float)val.blueF());
instance = static_cast<property_t>(asVector3);
@@ -419,8 +419,8 @@ namespace AzToolsFramework
bool Vector3ColorPropertyHandler::ReadValuesIntoGUI(size_t index, PropertyColorCtrl* GUI, const property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
AZ::Vector3 asVector3 = static_cast<AZ::Vector3>(instance);
QColor asQColor;
asQColor.setRedF((qreal)asVector3.GetX());
@@ -305,24 +305,24 @@ namespace AzToolsFramework
void doublePropertySliderHandler::WriteGUIValuesIntoProperty(size_t index, PropertyDoubleSliderCtrl* GUI, property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
double val = GUI->value();
instance = static_cast<property_t>(val);
}
void floatPropertySliderHandler::WriteGUIValuesIntoProperty(size_t index, PropertyDoubleSliderCtrl* GUI, property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
double val = GUI->value();
instance = static_cast<property_t>(val);
}
bool doublePropertySliderHandler::ReadValuesIntoGUI(size_t index, PropertyDoubleSliderCtrl* GUI, const property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
GUI->blockSignals(true);
GUI->setValue(instance);
GUI->blockSignals(false);
@@ -331,8 +331,8 @@ namespace AzToolsFramework
bool floatPropertySliderHandler::ReadValuesIntoGUI(size_t index, PropertyDoubleSliderCtrl* GUI, const property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
GUI->blockSignals(true);
GUI->setValue(instance);
GUI->blockSignals(false);
@@ -363,32 +363,32 @@ namespace AzToolsFramework
void doublePropertySpinboxHandler::WriteGUIValuesIntoProperty(size_t index, PropertyDoubleSpinCtrl* GUI, property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
double val = GUI->value() / GUI->multiplier();
instance = static_cast<property_t>(val);
}
void floatPropertySpinboxHandler::WriteGUIValuesIntoProperty(size_t index, PropertyDoubleSpinCtrl* GUI, property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
double val = GUI->value() / GUI->multiplier();
instance = static_cast<property_t>(val);
}
bool doublePropertySpinboxHandler::ReadValuesIntoGUI(size_t index, PropertyDoubleSpinCtrl* GUI, const property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
GUI->setValue(instance * GUI->multiplier());
return false;
}
bool floatPropertySpinboxHandler::ReadValuesIntoGUI(size_t index, PropertyDoubleSpinCtrl* GUI, const property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
GUI->setValue(instance * GUI->multiplier());
return false;
}
@@ -5,7 +5,10 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/base.h>
#include <AzCore/Debug/Budget.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Math/Uuid.h>
#include <AzCore/RTTI/RTTI.h>
@@ -14,8 +17,6 @@
#include <AzCore/Component/ComponentBus.h>
#include "PropertyEditorAPI_Internals.h"
#pragma once
class QWidget;
class QCheckBox;
class QLabel;
@@ -25,6 +25,8 @@ class QColor;
class QString;
class QPoint;
AZ_DECLARE_BUDGET(AzToolsFramework);
namespace AzToolsFramework
{
namespace Components
@@ -518,8 +518,8 @@ namespace AzToolsFramework
void EntityIdPropertyHandler::WriteGUIValuesIntoProperty(size_t index, PropertyEntityIdCtrl* GUI, property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
instance = GUI->GetEntityId();
}
@@ -225,7 +225,7 @@ namespace AzToolsFramework
if (!pHandlerFound)
{
// does a base class have a handler?
AZ::SerializeContext* sc = NULL;
AZ::SerializeContext* sc = nullptr;
EBUS_EVENT_RESULT(sc, AZ::ComponentApplicationBus, GetSerializeContext);
AZStd::vector<const AZ::SerializeContext::ClassData*> classes;
@@ -142,16 +142,16 @@ namespace AzToolsFramework
void StringPropertyLineEditHandler::WriteGUIValuesIntoProperty(size_t index, PropertyStringLineEditCtrl* GUI, property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
AZStd::string val = GUI->value();
instance = static_cast<property_t>(val);
}
bool StringPropertyLineEditHandler::ReadValuesIntoGUI(size_t index, PropertyStringLineEditCtrl* GUI, const property_t& instance, InstanceDataNode* node)
{
(int)index;
(void)node;
AZ_UNUSED(index);
AZ_UNUSED(node);
AZStd::string val = instance;
GUI->setValue(val);
return false;
@@ -254,9 +254,9 @@ namespace AzToolsFramework
void QueueInvalidationIfSharedData(InternalReflectedPropertyEditorEvents* sender, PropertyModificationRefreshLevel level, const AZStd::set<void*>& sourceInstanceSet) override;
// PropertyEditorGUIMessages::Bus::Handler
virtual void RequestWrite(QWidget* editorGUI) override;
virtual void AddElementsToParentContainer(QWidget* editorGUI, size_t numElements, const InstanceDataNode::FillDataClassCallback& fillDataCallback) override;
virtual void RequestRefresh(PropertyModificationRefreshLevel) override;
void RequestWrite(QWidget* editorGUI) override;
void AddElementsToParentContainer(QWidget* editorGUI, size_t numElements, const InstanceDataNode::FillDataClassCallback& fillDataCallback) override;
void RequestRefresh(PropertyModificationRefreshLevel) override;
void RequestPropertyNotify(QWidget* editorGUI) override;
void OnEditingFinished(QWidget* editorGUI) override;
};
@@ -890,7 +890,7 @@ namespace AzToolsFramework
{
instance.Build(m_impl->m_context, AZ::SerializeContext::ENUM_ACCESS_FOR_READ, m_impl->m_dynamicEditDataProvider, m_impl->m_editorParent);
m_impl->FilterNode(instance.GetRootNode(), filter);
m_impl->AddProperty(instance.GetRootNode(), NULL, 0);
m_impl->AddProperty(instance.GetRootNode(), nullptr, 0);
}
m_impl->UpdateExpansionState();
@@ -1077,7 +1077,7 @@ namespace AzToolsFramework
PropertyRowWidget* ReflectedPropertyEditor::Impl::CreateOrPullFromPool()
{
PropertyRowWidget* newWidget = NULL;
PropertyRowWidget* newWidget = nullptr;
if (m_widgetPool.empty())
{
newWidget = aznew PropertyRowWidget(m_containerWidget);
@@ -1184,7 +1184,7 @@ namespace AzToolsFramework
{
// re-create the tab order, based on vertical position in the list.
QWidget* pLastWidget = NULL;
QWidget* pLastWidget = nullptr;
for (AZStd::size_t pos = 0; pos < m_impl->m_widgetsInDisplayOrder.size(); ++pos)
{
@@ -2141,7 +2141,7 @@ namespace AzToolsFramework
AZStd::shared_ptr<void> keyToAdd(nullptr);
bool createdElement = pContainerNode->CreateContainerElement(CreateContainerElementSelectClassCallback,
[this, pContainerNode, promptForValue, &keyToAdd](void* dataPtr, const AZ::SerializeContext::ClassElement* classElement, bool noDefaultData, AZ::SerializeContext*) -> bool
[pContainerNode, promptForValue, &keyToAdd](void* dataPtr, const AZ::SerializeContext::ClassElement* classElement, bool noDefaultData, AZ::SerializeContext*) -> bool
{
bool handled = false;
@@ -195,17 +195,17 @@ namespace AzToolsFramework
, m_criteriaOperator(FilterOperatorType::Or)
, m_suppressCriteriaChanged(false)
{
m_mainLayout = new QVBoxLayout(NULL);
m_mainLayout = new QVBoxLayout(nullptr);
m_mainLayout->setSizeConstraint(QLayout::SetMinimumSize);
m_mainLayout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout* secondaryLayout = new QHBoxLayout(NULL);
QHBoxLayout* secondaryLayout = new QHBoxLayout(nullptr);
secondaryLayout->setSizeConstraint(QLayout::SetMinimumSize);
secondaryLayout->setContentsMargins(0, 0, 0, 0);
m_filterLayout = new QHBoxLayout(NULL);
m_filterLayout = new QHBoxLayout(nullptr);
m_tagLayout = new FlowLayout(nullptr);
m_tagLayout->setAlignment(Qt::AlignLeft);
QHBoxLayout* filterTextLayout = new QHBoxLayout(NULL);
QHBoxLayout* filterTextLayout = new QHBoxLayout(nullptr);
filterTextLayout->setSizeConstraint(QLayout::SetMinimumSize);
filterTextLayout->setContentsMargins(0, 0, 0, 0);
filterTextLayout->setSpacing(0);
@@ -2525,11 +2525,11 @@ namespace AzToolsFramework
{
// This is an approximate measurement of how much this slice proliferates within the currently-loaded level.
// Down the line we'll actually query the asset DB's dependency tree, summing up instances.
AZ_UNUSED(levelSlice); // Prevent unused warning in release builds
AZ_Warning("SlicePush", levelSlice, "SlicePushWidget::CalculateReferenceCount could not find root slice, displayed counts will be inaccurate!");
size_t instanceCount = 0;
AZ::Data::AssetBus::EnumerateHandlersId(assetId,
[&instanceCount, assetId, levelSlice] (AZ::Data::AssetEvents* handler) -> bool
[&instanceCount, assetId] (AZ::Data::AssetEvents* handler) -> bool
{
AZ::SliceComponent* component = azrtti_cast<AZ::SliceComponent*>(handler);
if (component)
@@ -111,7 +111,6 @@ namespace AzToolsFramework
QTreeWidget* m_sliceDependentsTree; ///< Tree widget for fields (left side)
QTreeWidget* m_sliceDependencyTree; ///< Tree widget for slice targets (right side)
QLabel* m_infoLabel; ///< Label above slice tree describing selection
QVBoxLayout* m_bottomLayout; ///< Bottom layout containing optional status messages, legend and buttons
};
@@ -41,7 +41,7 @@ namespace AzToolsFramework
{
}
virtual ~QTreeViewStateSaverData()
~QTreeViewStateSaverData() override
{
}
@@ -213,7 +213,7 @@ namespace AzToolsFramework
}
}
void ApplySnapshot(QTreeView* treeView)
void ApplySnapshot(QTreeView* treeView) override
{
Q_ASSERT(treeView && treeView->model());
@@ -132,7 +132,6 @@ namespace AzToolsFramework
QPointer<QAbstractItemModel> m_dataModel;
QPointer<QItemSelectionModel> m_selectionModel;
AZStd::intrusive_ptr<QTreeViewStateSaverData> m_data;
bool m_defaultToExpandIndexes = false;
Q_DISABLE_COPY(QTreeViewStateSaver)
};
@@ -9,8 +9,11 @@
#pragma once
#include <AzCore/Component/Entity.h>
#include <AzCore/Debug/Budget.h>
#include <AzCore/Interface/Interface.h>
AZ_DECLARE_BUDGET(AzToolsFramework);
namespace AzToolsFramework
{
namespace UndoSystem
@@ -115,7 +115,7 @@ namespace UnitTest
handled, AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
AzToolsFramework::ViewportInteraction::MouseInteractionEvent(
mouseInteraction, AzToolsFramework::ViewportInteraction::MouseEvent::Down));
mouseInteraction, AzToolsFramework::ViewportInteraction::MouseEvent::Down, /*captured=*/false));
return handled;
}
}
@@ -41,7 +41,8 @@ namespace AzToolsFramework
ViewportInteraction::QPointFromScreenPoint(mouseInteraction.m_mouseInteraction.m_mousePick.m_screenCoordinates);
// if the mouse hasn't moved, open the pop-up menu
if ((currentScreenCoords - contextMenu.m_clickPoint).manhattanLength() < ed_contextMenuDisplayThreshold)
if ((currentScreenCoords - contextMenu.m_clickPoint).manhattanLength() < ed_contextMenuDisplayThreshold &&
!mouseInteraction.m_captured)
{
QWidget* parent = nullptr;
ViewportInteraction::MainEditorViewportInteractionRequestBus::EventResult(
@@ -275,9 +275,7 @@ namespace AzToolsFramework
virtual void BeginCursorCapture() = 0;
//! Restores the cursor and ends locking it in place, allowing it to be moved freely.
virtual void EndCursorCapture() = 0;
//! Gets the most recent recorded cursor position in the viewport in screen space coordinates.
virtual AzFramework::ScreenPoint ViewportCursorScreenPosition() = 0;
//! Is mouse over viewport.
//! Is the mouse over the viewport.
virtual bool IsMouseOver() const = 0;
protected:
@@ -212,9 +212,10 @@ namespace AzToolsFramework
static void Reflect(AZ::SerializeContext& context);
//! Constructor to create a default MouseInteractionEvent
MouseInteractionEvent(MouseInteraction mouseInteraction, const MouseEvent mouseEvent)
MouseInteractionEvent(MouseInteraction mouseInteraction, const MouseEvent mouseEvent, const bool captured)
: m_mouseInteraction(std::move(mouseInteraction))
, m_mouseEvent(mouseEvent)
, m_captured(captured)
{
}
@@ -228,6 +229,7 @@ namespace AzToolsFramework
MouseInteraction m_mouseInteraction; //!< Mouse state.
MouseEvent m_mouseEvent; //!< Mouse event.
bool m_captured = false; //!< Is the mouse cursor being captured during the event.
//! Special friend function to return the mouse wheel delta (scroll amount)
//! if the event was of type MouseEvent::Wheel.
@@ -65,7 +65,8 @@ namespace UnitTest
AzToolsFramework::AssetSeedManager assetSeedManager;
AzFramework::AssetRegistry assetRegistry;
const AZStd::string assetRoot = AzToolsFramework::PlatformAddressedAssetCatalog::GetAssetRootForPlatform(AzFramework::PlatformId::PC);
const AZ::PlatformId thisPlatform = AZ::PlatformHelper::GetPlatformIdFromName(AZ::OSPlatformToDefaultAssetPlatform(AZ_TRAIT_OS_PLATFORM_CODENAME));
const AZStd::string assetRoot = AzToolsFramework::PlatformAddressedAssetCatalog::GetAssetRootForPlatform(thisPlatform);
for (int idx = 0; idx < TotalAssets; idx++)
{
@@ -113,17 +114,18 @@ namespace UnitTest
// Currently I am serializing the asset registry to disk
// and invoking the LoadCatalog API to populate the asset catalog created by the azframework app.
AZStd::string pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC);
const AZStd::string catalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(thisPlatform);
bool catalogSaved = AzFramework::AssetCatalog::SaveCatalog(pcCatalogFile.c_str(), &assetRegistry);
bool catalogSaved = AzFramework::AssetCatalog::SaveCatalog(catalogFile.c_str(), &assetRegistry);
EXPECT_TRUE(catalogSaved) << "Unable to save the asset catalog file.\n";
m_pcCatalog = new AzToolsFramework::PlatformAddressedAssetCatalog(AzFramework::PlatformId::PC);
m_catalog = new AzToolsFramework::PlatformAddressedAssetCatalog(thisPlatform);
assetSeedManager.AddSeedAsset(m_assets[0], AzFramework::PlatformFlags::Platform_PC);
assetSeedManager.AddSeedAsset(m_assets[1], AzFramework::PlatformFlags::Platform_PC);
const auto thisPlatformFlags = AZ::PlatformHelper::GetPlatformFlag(AZ::OSPlatformToDefaultAssetPlatform(AZ_TRAIT_OS_PLATFORM_CODENAME));
assetSeedManager.AddSeedAsset(m_assets[0], thisPlatformFlags);
assetSeedManager.AddSeedAsset(m_assets[1], thisPlatformFlags);
bool firstAssetFileInfoListSaved = assetSeedManager.SaveAssetFileInfo(TempFiles[FileIndex::FirstAssetFileInfoList], AzFramework::PlatformFlags::Platform_PC, {});
bool firstAssetFileInfoListSaved = assetSeedManager.SaveAssetFileInfo(TempFiles[FileIndex::FirstAssetFileInfoList], thisPlatformFlags, {});
EXPECT_TRUE(firstAssetFileInfoListSaved);
// Modify contents of asset2
@@ -156,10 +158,10 @@ namespace UnitTest
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to open asset file.\n").c_str());
}
assetSeedManager.RemoveSeedAsset(m_assets[0], AzFramework::PlatformFlags::Platform_PC);
assetSeedManager.AddSeedAsset(m_assets[5], AzFramework::PlatformFlags::Platform_PC);
assetSeedManager.RemoveSeedAsset(m_assets[0], thisPlatformFlags);
assetSeedManager.AddSeedAsset(m_assets[5], thisPlatformFlags);
bool secondAssetFileInfoListSaved = assetSeedManager.SaveAssetFileInfo(TempFiles[FileIndex::SecondAssetFileInfoList], AzFramework::PlatformFlags::Platform_PC, {});
bool secondAssetFileInfoListSaved = assetSeedManager.SaveAssetFileInfo(TempFiles[FileIndex::SecondAssetFileInfoList], thisPlatformFlags, {});
EXPECT_TRUE(secondAssetFileInfoListSaved);
}
@@ -202,7 +204,7 @@ namespace UnitTest
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
}
delete m_pcCatalog;
delete m_catalog;
m_application->Stop();
delete m_application;
@@ -754,7 +756,7 @@ namespace UnitTest
ToolsTestApplication* m_application = nullptr;
UnitTest::ScopedTemporaryDirectory m_tempDir;
AzToolsFramework::PlatformAddressedAssetCatalog* m_pcCatalog = nullptr;
AzToolsFramework::PlatformAddressedAssetCatalog* m_catalog = nullptr;
AZ::IO::FileIOStream m_fileStreams[TotalAssets];
AZ::Data::AssetId m_assets[TotalAssets];
AZStd::string m_assetsPath[TotalAssets];
@@ -219,7 +219,7 @@ namespace UnitTest
delete m_application;
}
AZ::Data::AssetInfo GetAssetInfoById(const AZ::Data::AssetId& id)
AZ::Data::AssetInfo GetAssetInfoById(const AZ::Data::AssetId& id) override
{
auto foundIter = m_assetRegistry->m_assetIdToInfo.find(id);
if (foundIter != m_assetRegistry->m_assetIdToInfo.end())
@@ -1117,7 +1117,6 @@ namespace UnitTest
const char* GetAppRoot() const override { return nullptr; }
const char* GetEngineRoot() const override { return nullptr; }
const char* GetExecutableFolder() const override { return nullptr; }
Debug::DrillerManager* GetDrillerManager() override { return nullptr; }
void EnumerateEntities(const EntityCallback& /*callback*/) override {}
void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {}
//////////////////////////////////////////////////////////////////////////
@@ -1203,7 +1202,7 @@ namespace UnitTest
AZ_COMPONENT(HiddenComponent, "{E4D2AD8B-3930-46FC-837A-8DDFCA0FB1AF}", AzToolsFramework::Components::EditorComponentBase);
static Component* s_wasDeleted;
virtual ~HiddenComponent()
~HiddenComponent() override
{
s_wasDeleted = this;
}
@@ -1579,7 +1579,7 @@ namespace UnitTest
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Given
AZ::Entity* entity = nullptr;
const AZ::EntityId entityId = CreateDefaultEditorEntity("Entity", &entity);
CreateDefaultEditorEntity("Entity", &entity);
entity->Deactivate();
const auto* entityInfoComponent = entity->CreateComponent<EditorEntityInfoRequestActivateTestComponent>();
@@ -66,7 +66,7 @@ namespace AzToolsFramework
{
}
virtual ~EntitySearch_TestComponent1() override
~EntitySearch_TestComponent1() override
{}
private:
@@ -123,7 +123,7 @@ namespace AzToolsFramework
{
}
virtual ~EntitySearch_TestComponent2() override
~EntitySearch_TestComponent2() override
{}
private:
@@ -55,7 +55,7 @@ namespace UnitTest
AzToolsFramework::EditorRequests::Bus::Handler::BusConnect();
}
~EditorRequestHandlerTest()
~EditorRequestHandlerTest() override
{
AzToolsFramework::EditorRequests::Bus::Handler::BusDisconnect();
}
@@ -67,7 +67,7 @@ namespace UnitTest
services.push_back(AZ_CRC("InspectorTestService1"));
}
virtual ~Inspector_TestComponent1() override
~Inspector_TestComponent1() override
{
}
@@ -136,7 +136,7 @@ namespace UnitTest
services.push_back(AZ_CRC("InspectorTestService2"));
}
virtual ~Inspector_TestComponent2() override
~Inspector_TestComponent2() override
{
}
@@ -205,7 +205,7 @@ namespace UnitTest
services.push_back(AZ_CRC("InspectorTestService3"));
}
virtual ~Inspector_TestComponent3() override
~Inspector_TestComponent3() override
{
}
@@ -26,26 +26,12 @@
#include <QDir>
#include <QFileInfo>
namespace AzFramework
{
namespace FileFunc
{
namespace Internal
{
AZ::Outcome<void,AZStd::string> UpdateCfgContents(AZStd::string& cfgContents, const AZStd::list<AZStd::string>& updateRules);
AZ::Outcome<void,AZStd::string> UpdateCfgContents(AZStd::string& cfgContents, const AZStd::string& header, const AZStd::string& key, const AZStd::string& value);
AZ::Outcome<void, AZStd::string> WriteJsonToStream(const rapidjson::Document& document, AZ::IO::GenericStream& stream,
WriteJsonSettings settings = WriteJsonSettings{});
}
}
}
namespace UnitTest
{
class FileFuncTest : public ScopedAllocatorSetupFixture
{
public:
void SetUp()
void SetUp() override
{
m_prevFileIO = AZ::IO::FileIOBase::GetInstance();
AZ::IO::FileIOBase::SetInstance(nullptr);
@@ -62,110 +48,6 @@ namespace UnitTest
AZ::IO::FileIOBase* m_prevFileIO;
};
TEST_F(FileFuncTest, UpdateCfgContents_InValidInput_Fail)
{
AZStd::string cfgContents = "[Foo]\n";
AZStd::list<AZStd::string> updateRules;
updateRules.push_back(AZStd::string("Foo/one*1"));
auto result = AzFramework::FileFunc::Internal::UpdateCfgContents(cfgContents, updateRules);
ASSERT_FALSE(result.IsSuccess());
}
TEST_F(FileFuncTest, UpdateCfgContents_ValidInput_Success)
{
AZStd::string cfgContents =
"[Foo]\n"
"one =2 \n"
"two= 3\n"
"three = 4\n"
"\n"
"[Bar]\n"
"four=3\n"
"five=3\n"
"six=3\n"
"eight=3\n";
AZStd::list<AZStd::string> updateRules;
updateRules.push_back(AZStd::string("Foo/one=1"));
updateRules.push_back(AZStd::string("Foo/two=2"));
updateRules.push_back(AZStd::string("three=3"));
auto result = AzFramework::FileFunc::Internal::UpdateCfgContents(cfgContents, updateRules);
EXPECT_TRUE(result.IsSuccess());
AZStd::string compareCfgContents =
"[Foo]\n"
"one =1\n"
"two= 2\n"
"three = 3\n"
"\n"
"[Bar]\n"
"four=3\n"
"five=3\n"
"six=3\n"
"eight=3\n";
bool equals = cfgContents.compare(compareCfgContents) == 0;
ASSERT_TRUE(equals);
}
TEST_F(FileFuncTest, UpdateCfgContents_ValidInputNewEntrySameHeader_Success)
{
AZStd::string cfgContents =
"[Foo]\n"
"one =2 \n"
"two= 3\n"
"three = 4\n";
AZStd::string header("[Foo]");
AZStd::string key("four");
AZStd::string value("4");
auto result = AzFramework::FileFunc::Internal::UpdateCfgContents(cfgContents, header, key, value);
EXPECT_TRUE(result.IsSuccess());
AZStd::string compareCfgContents =
"[Foo]\n"
"four=4\n"
"one =2 \n"
"two= 3\n"
"three = 4\n";
bool equals = cfgContents.compare(compareCfgContents) == 0;
ASSERT_TRUE(equals);
}
TEST_F(FileFuncTest, UpdateCfgContents_ValidInputNewEntryDifferentHeader_Success)
{
AZStd::string cfgContents =
";Sample Data\n"
"[Foo]\n"
"one =2 \n"
"two= 3\n"
"three = 4\n";
AZStd::list<AZStd::string> updateRules;
AZStd::string header("[Bar]");
AZStd::string key("four");
AZStd::string value("4");
auto result = AzFramework::FileFunc::Internal::UpdateCfgContents(cfgContents, header, key, value);
EXPECT_TRUE(result.IsSuccess());
AZStd::string compareCfgContents =
";Sample Data\n"
"[Foo]\n"
"one =2 \n"
"two= 3\n"
"three = 4\n"
"\n"
"[Bar]\n"
"four=4\n";
bool equals = cfgContents.compare(compareCfgContents) == 0;
ASSERT_TRUE(equals);
}
static bool CreateDummyFile(const QString& fullPathToFile, const QString& tempStr = {})
{
QFileInfo fi(fullPathToFile);
@@ -268,213 +150,4 @@ namespace UnitTest
ASSERT_NE(findElement, result.GetValue().end());
}
}
class JsonFileFuncTest
: public FrameworkApplicationFixture
{
protected:
void SetUp() override
{
FrameworkApplicationFixture::SetUp();
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_serializeContext = AZStd::make_unique<AZ::SerializeContext>();
m_jsonRegistrationContext = AZStd::make_unique<AZ::JsonRegistrationContext>();
m_jsonSystemComponent = AZStd::make_unique<AZ::JsonSystemComponent>();
m_serializationSettings.m_serializeContext = m_serializeContext.get();
m_serializationSettings.m_registrationContext = m_jsonRegistrationContext.get();
m_deserializationSettings.m_serializeContext = m_serializeContext.get();
m_deserializationSettings.m_registrationContext = m_jsonRegistrationContext.get();
m_jsonSystemComponent->Reflect(m_jsonRegistrationContext.get());
}
void TearDown() override
{
m_jsonRegistrationContext->EnableRemoveReflection();
m_jsonSystemComponent->Reflect(m_jsonRegistrationContext.get());
m_jsonRegistrationContext->DisableRemoveReflection();
m_jsonRegistrationContext.reset();
m_serializeContext.reset();
m_jsonSystemComponent.reset();
FrameworkApplicationFixture::TearDown();
}
AZStd::unique_ptr<AZ::SerializeContext> m_serializeContext;
AZStd::unique_ptr<AZ::JsonRegistrationContext> m_jsonRegistrationContext;
AZStd::unique_ptr<AZ::JsonSystemComponent> m_jsonSystemComponent;
AZ::JsonSerializerSettings m_serializationSettings;
AZ::JsonDeserializerSettings m_deserializationSettings;
};
TEST_F(JsonFileFuncTest, WriteJsonString_ValidJson_ExpectSuccess)
{
rapidjson::Document document;
document.SetObject();
document.AddMember("a", 1, document.GetAllocator());
document.AddMember("b", 2, document.GetAllocator());
document.AddMember("c", 3, document.GetAllocator());
AZStd::string expectedJsonText =
R"({
"a": 1,
"b": 2,
"c": 3
})";
expectedJsonText.erase(AZStd::remove_if(expectedJsonText.begin(), expectedJsonText.end(), ::isspace), expectedJsonText.end());
AZStd::string outString;
AZ::Outcome<void, AZStd::string> result = AzFramework::FileFunc::WriteJsonToString(document, outString);
EXPECT_TRUE(result.IsSuccess());
outString.erase(AZStd::remove_if(outString.begin(), outString.end(), ::isspace), outString.end());
EXPECT_EQ(expectedJsonText, outString) << "expected:\n" << expectedJsonText.c_str() << "\nactual:\n" << outString.c_str();
}
TEST_F(JsonFileFuncTest, WriteJsonStream_ValidJson_ExpectSuccess)
{
rapidjson::Document document;
document.SetObject();
document.AddMember("a", 1, document.GetAllocator());
document.AddMember("b", 2, document.GetAllocator());
document.AddMember("c", 3, document.GetAllocator());
AZStd::string expectedJsonText =
R"({
"a": 1,
"b": 2,
"c": 3
})";
expectedJsonText.erase(AZStd::remove_if(expectedJsonText.begin(), expectedJsonText.end(), ::isspace), expectedJsonText.end());
AZStd::vector<char> outBuffer;
AZ::IO::ByteContainerStream<AZStd::vector<char>> outStream{ &outBuffer };
AZ::Outcome<void, AZStd::string> result = AzFramework::FileFunc::Internal::WriteJsonToStream(document, outStream);
EXPECT_TRUE(result.IsSuccess());
outBuffer.push_back(0);
AZStd::string outString = outBuffer.data();
outString.erase(AZStd::remove_if(outString.begin(), outString.end(), ::isspace), outString.end());
EXPECT_EQ(expectedJsonText, outString) << "expected:\n" << expectedJsonText.c_str() << "\nactual:\n" << outString.c_str();
}
TEST_F(JsonFileFuncTest, WriteJsonFile_ValidJson_ExpectSuccess)
{
AZ::Test::ScopedAutoTempDirectory tempDir;
rapidjson::Document document;
document.SetObject();
document.AddMember("a", 1, document.GetAllocator());
document.AddMember("b", 2, document.GetAllocator());
document.AddMember("c", 3, document.GetAllocator());
AZStd::string expectedJsonText =
R"({
"a": 1,
"b": 2,
"c": 3
})";
expectedJsonText.erase(AZStd::remove_if(expectedJsonText.begin(), expectedJsonText.end(), ::isspace), expectedJsonText.end());
AZStd::string pathStr;
AzFramework::StringFunc::Path::ConstructFull(tempDir.GetDirectory(), "test.json", pathStr, true);
// Write the JSON to a file
AZ::IO::Path path(pathStr);
AZ::Outcome<void, AZStd::string> saveResult = AzFramework::FileFunc::WriteJsonFile(document, path);
EXPECT_TRUE(saveResult.IsSuccess());
// Verify that the contents of the file is what we expect
AZ::Outcome<AZStd::string, AZStd::string> readResult = AZ::Utils::ReadFile(pathStr);
EXPECT_TRUE(readResult.IsSuccess());
AZStd::string outString(readResult.TakeValue());
outString.erase(AZStd::remove_if(outString.begin(), outString.end(), ::isspace), outString.end());
EXPECT_EQ(outString, expectedJsonText);
// Clean up
AZ::IO::FileIOBase::GetInstance()->Remove(path.c_str());
}
TEST_F(JsonFileFuncTest, ReadJsonString_ValidJson_ExpectSuccess)
{
const char* jsonText =
R"(
{
"a": 1,
"b": 2,
"c": 3
})";
AZ::Outcome<rapidjson::Document, AZStd::string> result = AzFramework::FileFunc::ReadJsonFromString(jsonText);
EXPECT_TRUE(result.IsSuccess());
EXPECT_TRUE(result.GetValue().IsObject());
EXPECT_TRUE(result.GetValue().HasMember("a"));
EXPECT_TRUE(result.GetValue().HasMember("b"));
EXPECT_TRUE(result.GetValue().HasMember("c"));
EXPECT_EQ(result.GetValue()["a"].GetInt(), 1);
EXPECT_EQ(result.GetValue()["b"].GetInt(), 2);
EXPECT_EQ(result.GetValue()["c"].GetInt(), 3);
}
TEST_F(JsonFileFuncTest, ReadJsonString_InvalidJson_ErrorReportsLineNumber)
{
const char* jsonText =
R"(
{
"a": "This line is missing a comma"
"b": 2,
"c": 3
}
)";
AZ::Outcome<rapidjson::Document, AZStd::string> result = AzFramework::FileFunc::ReadJsonFromString(jsonText);
EXPECT_FALSE(result.IsSuccess());
EXPECT_TRUE(result.GetError().find("JSON parse error at line 4:") == 0);
}
TEST_F(JsonFileFuncTest, ReadJsonFile_ValidJson_ExpectSuccess)
{
AZ::Test::ScopedAutoTempDirectory tempDir;
const char* inputJsonText =
R"({
"a": 1,
"b": 2,
"c": 3
})";
rapidjson::Document expectedDocument;
expectedDocument.SetObject();
expectedDocument.AddMember("a", 1, expectedDocument.GetAllocator());
expectedDocument.AddMember("b", 2, expectedDocument.GetAllocator());
expectedDocument.AddMember("c", 3, expectedDocument.GetAllocator());
// Create test file
AZStd::string path;
AzFramework::StringFunc::Path::ConstructFull(tempDir.GetDirectory(), "test.json", path, true);
AZ::Outcome<void, AZStd::string> writeResult = AZ::Utils::WriteFile(inputJsonText, path);
EXPECT_TRUE(writeResult.IsSuccess());
// Read the JSON from the test file
AZ::Outcome<rapidjson::Document, AZStd::string> readResult = AzFramework::FileFunc::ReadJsonFile(path);
EXPECT_TRUE(readResult.IsSuccess());
EXPECT_EQ(expectedDocument, readResult.GetValue());
// Clean up
AZ::IO::FileIOBase::GetInstance()->Remove(path.c_str());
}
} // namespace UnitTest
@@ -104,15 +104,15 @@ namespace UnitTest
if (AZ::EditContext* edit = serializeContext->GetEditContext())
{
edit->Class<TestComponent>("Test Component", "A test component")
->DataElement(0, &TestComponent::m_float, "Float Field", "A float field")
->DataElement(0, &TestComponent::m_string, "String Field", "A string field")
->DataElement(0, &TestComponent::m_normalContainer, "Normal Container", "A container")
->DataElement(0, &TestComponent::m_pointerContainer, "Pointer Container", "A container")
->DataElement(0, &TestComponent::m_subData, "Struct Field", "A sub data type")
->DataElement(nullptr, &TestComponent::m_float, "Float Field", "A float field")
->DataElement(nullptr, &TestComponent::m_string, "String Field", "A string field")
->DataElement(nullptr, &TestComponent::m_normalContainer, "Normal Container", "A container")
->DataElement(nullptr, &TestComponent::m_pointerContainer, "Pointer Container", "A container")
->DataElement(nullptr, &TestComponent::m_subData, "Struct Field", "A sub data type")
;
edit->Class<SubData>("Test Component", "A test component")
->DataElement(0, &SubData::m_int, "Int Field", "An int")
->DataElement(nullptr, &SubData::m_int, "Int Field", "An int")
;
}
}
@@ -156,7 +156,7 @@ namespace UnitTest
{
}
~InstanceDataHierarchyBasicTest()
~InstanceDataHierarchyBasicTest() override
{
}
@@ -481,7 +481,7 @@ namespace UnitTest
{
}
~InstanceDataHierarchyCopyContainerChangesTest()
~InstanceDataHierarchyCopyContainerChangesTest() override
{
}
@@ -680,8 +680,8 @@ namespace UnitTest
;
edit->Class<EnumContainer>("Enum Container", "Test container that has an external enum")
->DataElement(0, &EnumContainer::m_enum, "Enum Field", "An enum value")
->DataElement(0, &EnumContainer::m_enumVector, "Enum Vector Field", "A vector of enum values")
->DataElement(nullptr, &EnumContainer::m_enum, "Enum Field", "An enum value")
->DataElement(nullptr, &EnumContainer::m_enumVector, "Enum Vector Field", "A vector of enum values")
;
}
}
@@ -776,21 +776,21 @@ namespace UnitTest
{
edit->Class<GroupTestComponent>("Group Test Component", "Testing normal groups and toggle groups")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->DataElement(0, &GroupTestComponent::m_float, "Float Field", "A float field")
->DataElement(nullptr, &GroupTestComponent::m_float, "Float Field", "A float field")
->ClassElement(AZ::Edit::ClassElements::Group, "Normal Group")
->DataElement(0, &GroupTestComponent::m_groupFloat, "Float Field", "A float field")
->DataElement(0, &GroupTestComponent::m_subGroupForNormal, "Struct Field", "A sub data type")
->DataElement(nullptr, &GroupTestComponent::m_groupFloat, "Float Field", "A float field")
->DataElement(nullptr, &GroupTestComponent::m_subGroupForNormal, "Struct Field", "A sub data type")
->GroupElementToggle("Group Toggle", &GroupTestComponent::m_groupToggle)
->DataElement(0, &GroupTestComponent::m_toggleGroupInt, "Normal Integer", "An Integer")
->DataElement(0, &GroupTestComponent::m_subGroupForToggle, "Struct Field", "A sub data type")
->DataElement(nullptr, &GroupTestComponent::m_toggleGroupInt, "Normal Integer", "An Integer")
->DataElement(nullptr, &GroupTestComponent::m_subGroupForToggle, "Struct Field", "A sub data type")
;
edit->Class<SubData>("SubGroup Test Component", "Testing nested normal groups and toggle groups")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->ClassElement(AZ::Edit::ClassElements::Group, "Normal SubGroup")
->DataElement(0, &SubData::m_int, "SubGroup Int Field", "An int")
->DataElement(nullptr, &SubData::m_int, "SubGroup Int Field", "An int")
->GroupElementToggle("SubGroup Toggle", &SubData::m_bool)
->DataElement(0, &SubData::m_float, "SubGroup Float Field", "An int")
->DataElement(nullptr, &SubData::m_float, "SubGroup Float Field", "An int")
;
}
}
@@ -974,7 +974,7 @@ namespace UnitTest
{
}
void InsertAndVerifyKeys(AZ::SerializeContext::IDataContainer* container, void* key, void* instance, const AZ::SerializeContext::ClassElement* classElement) const
void InsertAndVerifyKeys(AZ::SerializeContext::IDataContainer* container, void* key, void* instance, const AZ::SerializeContext::ClassElement* classElement) const override
{
T* keyContainer = reinterpret_cast<T*>(key);
for (const T& keyToInsert : keysToInsert)
@@ -1258,7 +1258,7 @@ namespace UnitTest
{
editContext->Class<UIElementContainer>("Test", "")
->UIElement("TestHandler", "UIElement")
->DataElement(0, &UIElementContainer::m_data)
->DataElement(nullptr, &UIElementContainer::m_data)
->UIElement(AZ_CRC("TestHandler2"), "UIElement2")
;
}
@@ -1322,8 +1322,8 @@ namespace UnitTest
{
// By default, DataElements accept multi-edit and UIElements do not
editContext->Class<AggregatedContainer>("Test", "")
->DataElement(0, &AggregatedContainer::m_aggregated)
->DataElement(0, &AggregatedContainer::m_notAggregated)
->DataElement(nullptr, &AggregatedContainer::m_aggregated)
->DataElement(nullptr, &AggregatedContainer::m_notAggregated)
->Attribute(AZ::Edit::Attributes::AcceptsMultiEdit, false)
->UIElement("TestHandler", "aggregatedUIElement")
->Attribute(AZ::Edit::Attributes::AcceptsMultiEdit, true)
@@ -160,9 +160,6 @@ namespace UnitTest
ASSERT_TRUE(secondRootInstance);
// Find the new instances versions of the new and referenced entities using the aliases we saved
AZ::EntityId secondNewEntityId = secondRootInstance->GetEntityId(newEntityAlias);
InstanceOptionalReference secondNestedInstance = secondRootInstance->FindNestedInstance(nestedAlias);
ASSERT_TRUE(secondNestedInstance);
AZ::EntityId secondReferencedEntityId = secondNestedInstance->get().GetEntityId(referencedEntityAlias);
@@ -33,7 +33,8 @@ namespace UnitTest
CompareInstances(*firstInstance, *secondInstance, true, false);
}
TEST_F(PrefabInstantiateTest, PrefabInstantiate_TripleNestingTemplate_InstantiateSucceeds)
// TODO: Issue #3398 will re-enable
TEST_F(PrefabInstantiateTest, DISABLED_PrefabInstantiate_TripleNestingTemplate_InstantiateSucceeds)
{
AZ::Entity* newEntity = CreateEntity("New Entity");
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
@@ -132,7 +132,7 @@ namespace UnitTest
PrefabDomUtils::FindPrefabDomValue(valueADom, PrefabDomUtils::LinkIdName);
PrefabDomValueConstReference expectedNestedInstanceDomLinkId =
PrefabDomUtils::FindPrefabDomValue(valueBDom, PrefabDomUtils::LinkIdName);
ComparePrefabDomValues(actualNestedInstanceDomLinkId, actualNestedInstanceDomLinkId);
ComparePrefabDomValues(actualNestedInstanceDomLinkId, expectedNestedInstanceDomLinkId);
}
if (shouldCompareContainerEntities)
@@ -97,7 +97,7 @@ namespace UnitTest
//apply the patch
PrefabDom& templateDomReference = m_prefabSystemComponent->FindTemplateDom(nestedTemplateId);
AZ::JsonSerializationResult::ResultCode result =
[[maybe_unused]] AZ::JsonSerializationResult::ResultCode result =
PrefabDomUtils::ApplyPatches(templateDomReference, templateDomReference.GetAllocator(), patch);
AZ_Error("Prefab", result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::Success,
@@ -99,7 +99,6 @@ namespace UnitTest
//create single entity
AZ::Entity* newEntity = CreateEntity("New Entity", false);
ASSERT_TRUE(newEntity);
AZ::EntityId entityId = newEntity->GetId();
//create a first instance where the entity will be added
AZStd::unique_ptr<Instance> testInstance = m_prefabSystemComponent->CreatePrefab({}, {}, "test/path");
@@ -73,7 +73,7 @@ namespace UnitTest
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<TestSimpleAsset>("TestSimpleAsset", "Test data block for a simple asset mock data block")
->DataElement(0, &TestSimpleAsset::m_data, "My Data", "A test bool value.")
->DataElement(nullptr, &TestSimpleAsset::m_data, "My Data", "A test bool value.")
;
}
}
@@ -171,7 +171,7 @@ namespace UnitTest
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::HideChildren)
->DataElement(AZ::Edit::UIHandlers::Default, &PropertyTreeEditorTester::m_myReadOnlyShort, "My Read Only", "A test read only node.")
->Attribute(AZ::Edit::Attributes::ReadOnly, true)
->DataElement(0, &PropertyTreeEditorTester::m_mySubBlock, "My Sub Block", "sub block test")
->DataElement(nullptr, &PropertyTreeEditorTester::m_mySubBlock, "My Sub Block", "sub block test")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->ClassElement(AZ::Edit::ClassElements::Group, "Grouped")
@@ -31,7 +31,7 @@ namespace UnitTest
{
}
~SQLiteTest() = default;
~SQLiteTest() override = default;
void SetUp() override
{
@@ -28,7 +28,7 @@ namespace UnitTest
ScriptContext* m_scriptContext;
~EntityScriptTest()
~EntityScriptTest() override
{
}
@@ -225,7 +225,7 @@ namespace UnitTest
tempAssetEntity = aznew AZ::Entity("TestEntity1");
tempAssetEntity->CreateComponent<AzToolsFramework::Components::TransformComponent>();
AZ::Data::AssetId sliceAssetId1 = SaveAsSlice(tempAssetEntity);
SaveAsSlice(tempAssetEntity);
tempAssetEntity = nullptr;
AZ::SliceComponent::EntityList slice1EntitiesA = InstantiateSlice(sliceAssetId0);
@@ -457,7 +457,7 @@ namespace UnitTest
{
AZ::Debug::TraceMessageBus::Handler::BusConnect();
}
~SliceTestWarningInterceptor()
~SliceTestWarningInterceptor() override
{
AZ::Debug::TraceMessageBus::Handler::BusDisconnect();
}
@@ -401,7 +401,7 @@ namespace AzToolsFramework
TEST_F(EditorLayerComponentTest, LayerTests_TwoLayersUniqueNames_LayerNameIsValid)
{
EntityAndLayerComponent secondLayer = CreateEntityWithLayer("UniqueLayerName");
CreateEntityWithLayer("UniqueLayerName");
bool isLayerNameValid = true;
AzToolsFramework::Layers::EditorLayerComponentRequestBus::EventResult(
isLayerNameValid,
@@ -412,7 +412,7 @@ namespace AzToolsFramework
TEST_F(EditorLayerComponentTest, LayerTests_TwoLayersConflictingNames_LayerNameIsNotValid)
{
EntityAndLayerComponent secondLayer = CreateEntityWithLayer(m_entityName);
CreateEntityWithLayer(m_entityName);
bool isLayerNameValid = true;
AzToolsFramework::Layers::EditorLayerComponentRequestBus::EventResult(
isLayerNameValid,
@@ -713,7 +713,6 @@ namespace UnitTest
TransformBus::Event(m_childId, &TransformBus::Events::SetParentRelative, AZ::EntityId());
childLocalPos;
TransformBus::EventResult(childLocalPos, m_childId, &TransformBus::Events::GetLocalTranslation);
EXPECT_TRUE(childLocalPos == expectedChildLocalPos);
@@ -413,7 +413,7 @@ namespace UnitTest
*m_completedFlag = false;
}
~UndoDestructorTest()
~UndoDestructorTest() override
{
*m_completedFlag = true;
}
@@ -28,7 +28,7 @@ namespace UnitTest
public:
ViewportUiDisplayTestFixture() = default;
void SetUp()
void SetUp() override
{
m_buttonGroup = AZStd::make_shared<ButtonGroup>();
m_buttonGroup->AddButton("");
@@ -36,7 +36,7 @@ namespace UnitTest
m_mockRenderOverlay = new QWidget();
}
void TearDown()
void TearDown() override
{
m_buttonGroup.reset();
delete m_parentWidget;
@@ -26,7 +26,7 @@ namespace UnitTest
{
public:
ViewportUiManagerTestable() = default;
~ViewportUiManagerTestable() = default;
~ViewportUiManagerTestable() override = default;
const AZStd::unordered_map<AzToolsFramework::ViewportUi::ClusterId, AZStd::shared_ptr<ButtonGroup>>& GetClusterMap()
{
@@ -84,12 +84,12 @@ namespace UnitTest
ViewportManagerWrapper m_viewportManagerWrapper;
void SetUp()
void SetUp() override
{
m_viewportManagerWrapper.Create();
}
void TearDown()
void TearDown() override
{
m_viewportManagerWrapper.Destroy();
}
@@ -168,7 +168,7 @@ namespace UnitTest
m_viewportManagerWrapper.GetMockRenderOverlay()->setVisible(true);
auto clusterId = m_viewportManagerWrapper.GetViewportManager()->CreateCluster(AzToolsFramework::ViewportUi::Alignment::TopLeft);
auto buttonId = m_viewportManagerWrapper.GetViewportManager()->CreateClusterButton(clusterId, "");
m_viewportManagerWrapper.GetViewportManager()->CreateClusterButton(clusterId, "");
m_viewportManagerWrapper.GetViewportManager()->Update();
m_viewportManagerWrapper.GetViewportManager()->SetClusterVisible(clusterId, false);