Merge branch 'stabilization/2106' into cpack/2106-3p-manifest

This commit is contained in:
scottr
2021-06-22 09:57:11 -07:00
37 changed files with 714 additions and 671 deletions
@@ -79,8 +79,6 @@ class TestBasicEditorWorkflows(EditorTestHelper):
grp_box = new_level_dlg.findChild(QtWidgets.QGroupBox, "STATIC_GROUP1")
level_name = grp_box.findChild(QtWidgets.QLineEdit, "LEVEL")
level_name.setText(self.args["level"])
level_folders = grp_box.findChild(QtWidgets.QComboBox, "LEVEL_FOLDERS")
level_folders.setCurrentText("Levels/")
button_box = new_level_dlg.findChild(QtWidgets.QDialogButtonBox, "buttonBox")
button_box.button(QtWidgets.QDialogButtonBox.Ok).click()
@@ -57,7 +57,13 @@ namespace AZ
//! Determines if a component can be created from the asset type
//! This will be called before attempting to create a component from an asset (drag&drop, etc)
//! You can use this to filter by subIds or do your own validation here if needed
virtual bool CanCreateComponent(const AZ::Data::AssetId& /*assetId*/) const { return true; }
virtual bool CanCreateComponent([[maybe_unused]] const AZ::Data::AssetId& assetId) const { return true; }
//! Determines if other products conflict with the given one when multiple are generated from a source asset.
//! This will be called before attempting to create a component from an asset (drag&drop, etc)
//! You can use this to filter by conflicting product types or in case you want to skip for UX reasons.
//! @param[in] productAssetTypes Asset types of all generated products, including the one for our given type in this bus.
virtual bool HasConflictingProducts([[maybe_unused]] const AZStd::vector<AZ::Data::AssetType>& productAssetTypes) const { return false; }
};
using AssetTypeInfoBus = AZ::EBus<AssetTypeInfo>;
@@ -1206,7 +1206,7 @@ namespace JsonSerializationTests
if (this->m_features.m_enableInitializationTest)
{
auto instance = this->m_description.CreateDefaultInstance();
typename TypeParam::Type compare = typename TypeParam::Type{};
AZStd::remove_cvref_t<typename TypeParam::Type> compare;
if (!this->m_description.AreEqual(*instance, compare))
{
auto serializer = this->m_description.CreateSerializer();
@@ -75,6 +75,8 @@ namespace AzFramework
// Add a fullscreen button in the upper right of the title bar.
[m_nativeWindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
m_nativeWindow.tabbingMode = NSWindowTabbingModeDisallowed;
// Make the window active
[m_nativeWindow makeKeyAndOrderFront:nil];
m_nativeWindow.title = m_windowTitle;
@@ -56,7 +56,8 @@ namespace AzAssetBrowserRequestHandlerPrivate
using namespace AzToolsFramework;
using namespace AzToolsFramework::AssetBrowser;
// return true ONLY if we can handle the drop request in the viewport.
bool CanSpawnEntityForProduct(const ProductAssetBrowserEntry* product)
bool CanSpawnEntityForProduct(const ProductAssetBrowserEntry* product,
AZStd::optional<const AZStd::vector<AZ::Data::AssetType>> optionalProductAssetTypes = AZStd::nullopt)
{
if (!product)
{
@@ -70,7 +71,6 @@ namespace AzAssetBrowserRequestHandlerPrivate
bool canCreateComponent = false;
AZ::AssetTypeInfoBus::EventResult(canCreateComponent, product->GetAssetType(), &AZ::AssetTypeInfo::CanCreateComponent, product->GetAssetId());
if (!canCreateComponent)
{
return false;
@@ -78,16 +78,25 @@ namespace AzAssetBrowserRequestHandlerPrivate
AZ::Uuid componentTypeId = AZ::Uuid::CreateNull();
AZ::AssetTypeInfoBus::EventResult(componentTypeId, product->GetAssetType(), &AZ::AssetTypeInfo::GetComponentTypeId);
if (!componentTypeId.IsNull())
if (componentTypeId.IsNull())
{
// we have a component type that handles this asset.
return true;
return false;
}
if (optionalProductAssetTypes.has_value())
{
bool hasConflictingProducts = false;
AZ::AssetTypeInfoBus::EventResult(hasConflictingProducts, product->GetAssetType(), &AZ::AssetTypeInfo::HasConflictingProducts, optionalProductAssetTypes.value());
if (hasConflictingProducts)
{
return false;
}
}
// additional operations can be added here.
return false;
return true;
}
void SpawnEntityAtPoint(const ProductAssetBrowserEntry* product, AzQtComponents::ViewportDragContext* viewportDragContext, EntityIdList& spawnList, AzFramework::SliceInstantiationTicket& spawnTicket)
@@ -511,9 +520,16 @@ void AzAssetBrowserRequestHandler::Drop(QDropEvent* event, AzQtComponents::DragA
}
// Handle products
AZStd::vector<AZ::Data::AssetType> productAssetTypes;
productAssetTypes.reserve(products.size());
for (const AzToolsFramework::AssetBrowser::ProductAssetBrowserEntry* entry : products)
{
productAssetTypes.emplace_back(entry->GetAssetType());
}
for (const ProductAssetBrowserEntry* product : products)
{
if (CanSpawnEntityForProduct(product))
if (CanSpawnEntityForProduct(product, productAssetTypes))
{
SpawnEntityAtPoint(product, viewportDragContext, spawnedEntities, spawnTicket);
}
+1
View File
@@ -128,6 +128,7 @@ ly_add_target(
Legacy::EditorCore
RUNTIME_DEPENDENCIES
Gem::AtomViewportDisplayInfo
Legacy::EditorCommon
)
ly_add_source_properties(
SOURCES CryEdit.cpp
+9 -38
View File
@@ -208,22 +208,9 @@ WelcomeScreenDialog QLabel
margin: 0;
}
WelcomeScreenDialog QLabel#titleLabel
WelcomeScreenDialog QLabel#currentProjectLabel
{
font-size: 22px;
line-height: 32px;
}
WelcomeScreenDialog QLabel#bodyLabel
{
font-size: 14px;
line-height: 20px;
}
WelcomeScreenDialog QLabel[fontStyle="sectionTitle"], QLabel#titleLabel[fontStyle="sectionTitle"], QLabel#documentationLink
{
font-size: 16px;
line-height: 24px;
margin-top: 10px;
}
WelcomeScreenDialog QPushButton
@@ -232,36 +219,20 @@ WelcomeScreenDialog QPushButton
line-height: 16px;
}
WelcomeScreenDialog QFrame#viewContainer
{
background-color: transparent;
}
WelcomeScreenDialog QFrame#viewContainer[articleStyle="pinned"]
{
background: rgba(180,139,255,5%);
border: 1px solid #B48BFF;
box-shadow: 0 0 4px 0 rgba(0,0,0,50%);
}
WelcomeScreenDialog QWidget#articleViewContainerRoot
{
background: #111111;
background: #444444;
}
WelcomeScreenDialog QScrollArea#previewArea
WelcomeScreenDialog QWidget#levelViewFTUEContainer
{
background-color: transparent;
background: #282828;
}
WelcomeScreenDialog QWidget#articleViewContents
{
background-color: transparent;
}
WelcomeScreenDialog QFrame#imageFrame
{
background-color: transparent;
QTableWidget#recentLevelTable::item {
background-color: rgb(64,64,64);
margin-bottom: 4px;
margin-top: 4px;
}
/* Particle Editor */
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:263e95489560dac6e5944ef3caba13e598f83ddead324b943ad7735ba015e1a9
size 70727
@@ -15,7 +15,8 @@
#include "WelcomeScreenDialog.h"
// Qt
#include <QStringListModel>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QToolTip>
#include <QMenu>
#include <QDesktopServices>
@@ -24,6 +25,7 @@
#include <QScreen>
#include <QDesktopWidget>
#include <QTimer>
#include <QDateTime>
#include <AzCore/Utils/Utils.h>
@@ -74,65 +76,39 @@ static int GetSmallestScreenHeight()
WelcomeScreenDialog::WelcomeScreenDialog(QWidget* pParent)
: QDialog(new WindowDecorationWrapper(WindowDecorationWrapper::OptionAutoAttach | WindowDecorationWrapper::OptionAutoTitleBarButtons, pParent), Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowTitleHint)
, ui(new Ui::WelcomeScreenDialog)
, m_pRecentListModel(new QStringListModel(this))
, m_pRecentList(nullptr)
{
ui->setupUi(this);
// Make our welcome screen checkboxes appear as toggle switches
AzQtComponents::CheckBox::applyToggleSwitchStyle(ui->autoLoadLevel);
AzQtComponents::CheckBox::applyToggleSwitchStyle(ui->showOnStartup);
ui->recentLevelTable->setColumnCount(3);
ui->recentLevelTable->setMouseTracking(true);
ui->recentLevelTable->setContextMenuPolicy(Qt::CustomContextMenu);
ui->recentLevelTable->horizontalHeader()->hide();
ui->recentLevelTable->verticalHeader()->hide();
ui->recentLevelTable->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->recentLevelTable->setSelectionMode(QAbstractItemView::SingleSelection);
ui->recentLevelTable->setIconSize(QSize(20, 20));
installEventFilter(this);
ui->autoLoadLevel->setChecked(gSettings.bAutoloadLastLevelAtStartup);
ui->showOnStartup->setChecked(!gSettings.bShowDashboardAtStartup);
ui->recentLevelList->setModel(m_pRecentListModel);
ui->recentLevelList->setMouseTracking(true);
ui->recentLevelList->setContextMenuPolicy(Qt::CustomContextMenu);
auto currentProjectButtonMenu = new QMenu();
ui->currentProjectButton->setMenu(currentProjectButtonMenu);
auto projectName = AZ::Utils::GetProjectName();
ui->currentProjectButton->setText(projectName.c_str());
ui->currentProjectButton->adjustSize();
ui->currentProjectButton->setMinimumWidth(ui->currentProjectButton->width() + 40);
ui->currentProjectName->setText(projectName.c_str());
ui->documentationLink->setCursor(Qt::PointingHandCursor);
ui->documentationLink->installEventFilter(this);
ui->newLevelButton->setDefault(true);
connect(ui->recentLevelList, &QWidget::customContextMenuRequested, this, &WelcomeScreenDialog::OnShowContextMenu);
// Hide these buttons until the new functionality is added
ui->gridButton->hide();
ui->objectListButton->hide();
ui->switchProjectButton->hide();
connect(ui->recentLevelList, &QListView::entered, this, &WelcomeScreenDialog::OnShowToolTip);
connect(ui->recentLevelList, &QListView::clicked, this, &WelcomeScreenDialog::OnRecentLevelListItemClicked);
connect(ui->recentLevelTable, &QWidget::customContextMenuRequested, this, &WelcomeScreenDialog::OnShowContextMenu);
connect(ui->recentLevelTable, &QTableWidget::entered, this, &WelcomeScreenDialog::OnShowToolTip);
connect(ui->recentLevelTable, &QTableWidget::clicked, this, &WelcomeScreenDialog::OnRecentLevelTableItemClicked);
connect(ui->newLevelButton, &QPushButton::clicked, this, &WelcomeScreenDialog::OnNewLevelBtnClicked);
connect(ui->levelFileLabel, &QLabel::linkActivated, this, &WelcomeScreenDialog::OnNewLevelLabelClicked);
connect(ui->openLevelButton, &QPushButton::clicked, this, &WelcomeScreenDialog::OnOpenLevelBtnClicked);
connect(ui->newSliceButton, &QPushButton::clicked, this, &WelcomeScreenDialog::OnNewSliceBtnClicked);
connect(ui->openSliceButton, &QPushButton::clicked, this, &WelcomeScreenDialog::OnOpenSliceBtnClicked);
connect(ui->documentationButton, &QPushButton::clicked, this, &WelcomeScreenDialog::OnDocumentationBtnClicked);
connect(ui->showOnStartup, &QCheckBox::clicked, this, &WelcomeScreenDialog::OnShowOnStartupBtnClicked);
connect(ui->autoLoadLevel, &QCheckBox::clicked, this, &WelcomeScreenDialog::OnAutoLoadLevelBtnClicked);
m_manifest = new News::ResourceManifest(
std::bind(&WelcomeScreenDialog::SyncSuccess, this),
std::bind(&WelcomeScreenDialog::SyncFail, this, std::placeholders::_1),
std::bind(&WelcomeScreenDialog::SyncUpdate, this, std::placeholders::_1, std::placeholders::_2));
m_articleViewContainer = new News::ArticleViewContainer(this, *m_manifest);
connect(m_articleViewContainer, &News::ArticleViewContainer::scrolled,
this, &WelcomeScreenDialog::previewAreaScrolled);
ui->articleViewContainerRoot->layout()->addWidget(m_articleViewContainer);
m_manifest->Sync();
#ifndef ENABLE_SLICE_EDITOR
ui->newSliceButton->hide();
ui->openSliceButton->hide();
#endif
// Adjust the height, if need be
// Do it in the constructor so that the WindowDecoratorWrapper handles it correctly
int smallestHeight = GetSmallestScreenHeight();
@@ -153,16 +129,10 @@ WelcomeScreenDialog::WelcomeScreenDialog(QWidget* pParent)
WelcomeScreenDialog::~WelcomeScreenDialog()
{
delete ui;
delete m_manifest;
}
void WelcomeScreenDialog::done(int result)
{
if (m_waitingOnAsync)
{
m_manifest->Abort();
}
QDialog::done(result);
}
@@ -173,13 +143,11 @@ const QString& WelcomeScreenDialog::GetLevelPath()
bool WelcomeScreenDialog::eventFilter(QObject *watched, QEvent *event)
{
if (watched == ui->documentationLink)
if (event->type() == QEvent::Show)
{
if (event->type() == QEvent::MouseButtonRelease)
{
OnDocumentationBtnClicked(false);
return true;
}
ui->recentLevelTable->horizontalHeader()->resizeSection(0, ui->nameLabel->width());
ui->recentLevelTable->horizontalHeader()->resizeSection(1, ui->modifiedLabel->width());
ui->recentLevelTable->horizontalHeader()->resizeSection(2, ui->typeLabel->width());
}
return QDialog::eventFilter(watched, event);
@@ -207,7 +175,9 @@ void WelcomeScreenDialog::SetRecentFileList(RecentFileList* pList)
int nCurDir = sCurDir.length();
int recentListSize = pList->GetSize();
for (int i = 0; i < recentListSize; ++i)
int currentRow = 0;
ui->recentLevelTable->setRowCount(recentListSize);
for (int i = 0; i < recentListSize; ++i)
{
const QString& recentFile = pList->m_arrNames[i];
if (recentFile.endsWith(m_levelExtension))
@@ -218,7 +188,7 @@ void WelcomeScreenDialog::SetRecentFileList(RecentFileList* pList)
if (sCurEntryDir.compare(sCurDir, Qt::CaseInsensitive) == 0)
{
QString fullPath = recentFile;
QString name = Path::GetFileName(fullPath);
const QString name = Path::GetFile(fullPath);
Path::ConvertSlashToBackSlash(fullPath);
fullPath = Path::ToUnixPath(fullPath.toLower());
@@ -226,18 +196,34 @@ void WelcomeScreenDialog::SetRecentFileList(RecentFileList* pList)
if (fullPath.contains(gamePath))
{
m_pRecentListModel->setStringList(m_pRecentListModel->stringList() << QString(name));
if (gSettings.prefabSystem)
{
QIcon icon;
icon.addFile(QString::fromUtf8(":/Level/level.svg"), QSize(), QIcon::Normal, QIcon::Off);
ui->recentLevelTable->setItem(currentRow, 0, new QTableWidgetItem(icon, name));
}
else
{
ui->recentLevelTable->setItem(currentRow, 0, new QTableWidgetItem(name));
}
QFileInfo file(recentFile);
QDateTime dateTime = file.lastModified();
QString date = QLocale::system().toString(dateTime.date(), QLocale::ShortFormat) + " " +
QLocale::system().toString(dateTime.time(), QLocale::LongFormat);
ui->recentLevelTable->setItem(currentRow, 1, new QTableWidgetItem(date));
ui->recentLevelTable->setItem(currentRow++, 2, new QTableWidgetItem(tr("Level")));
m_levels.push_back(std::make_pair(name, recentFile));
}
}
}
}
}
ui->recentLevelTable->setRowCount(currentRow);
ui->recentLevelTable->setMinimumHeight(currentRow * ui->recentLevelTable->verticalHeader()->defaultSectionSize());
ui->recentLevelTable->setMaximumHeight(currentRow * ui->recentLevelTable->verticalHeader()->defaultSectionSize());
ui->levelFileLabel->setVisible(currentRow ? false : true);
ui->recentLevelList->setCurrentIndex(QModelIndex());
int rowSize = ui->recentLevelList->sizeHintForRow(0) + ui->recentLevelList->spacing() * 2;
ui->recentLevelList->setMinimumHeight(m_pRecentListModel->rowCount() * rowSize);
ui->recentLevelList->setMaximumHeight(m_pRecentListModel->rowCount() * rowSize);
ui->recentLevelTable->setCurrentIndex(QModelIndex());
}
@@ -245,7 +231,7 @@ void WelcomeScreenDialog::RemoveLevelEntry(int index)
{
TNamePathPair levelPath = m_levels[index];
m_pRecentListModel->removeRow(index);
ui->recentLevelTable->removeRow(index);
m_levels.erase(m_levels.begin() + index);
@@ -284,21 +270,18 @@ void WelcomeScreenDialog::OnShowToolTip(const QModelIndex& index)
{
const QString& fullPath = m_levels[index.row()].second;
//TEMPORARY:Begin This can be put back once the main window is in Qt
//QRect itemRect = ui->recentLevelList->visualRect(index);
QToolTip::showText(QCursor::pos(), QString("Open level: %1").arg(fullPath) /*, ui->recentLevelList, itemRect*/);
//TEMPORARY:END
QToolTip::showText(QCursor::pos(), QString("Open level: %1").arg(fullPath));
}
void WelcomeScreenDialog::OnShowContextMenu(const QPoint& pos)
{
QModelIndex index = ui->recentLevelList->indexAt(pos);
QModelIndex index = ui->recentLevelTable->indexAt(pos);
if (index.isValid())
{
QString level = m_pRecentListModel->data(index, 0).toString();
QString level = ui->recentLevelTable->itemAt(pos)->text();
QPoint globalPos = ui->recentLevelList->viewport()->mapToGlobal(pos);
QPoint globalPos = ui->recentLevelTable->viewport()->mapToGlobal(pos);
QMenu contextMenu;
contextMenu.addAction(QString("Remove " + level + " from recent list"));
@@ -310,13 +293,16 @@ void WelcomeScreenDialog::OnShowContextMenu(const QPoint& pos)
}
}
void WelcomeScreenDialog::OnNewLevelBtnClicked([[maybe_unused]] bool checked)
{
m_levelPath = "new";
accept();
}
void WelcomeScreenDialog::OnNewLevelLabelClicked([[maybe_unused]] const QString& path)
{
OnNewLevelBtnClicked(true);
}
void WelcomeScreenDialog::OnOpenLevelBtnClicked([[maybe_unused]] bool checked)
{
@@ -329,27 +315,7 @@ void WelcomeScreenDialog::OnOpenLevelBtnClicked([[maybe_unused]] bool checked)
}
}
void WelcomeScreenDialog::OnNewSliceBtnClicked([[maybe_unused]] bool checked)
{
m_levelPath = "new slice";
accept();
}
void WelcomeScreenDialog::OnOpenSliceBtnClicked(bool)
{
QString fileName = QFileDialog::getOpenFileName(MainWindow::instance(),
tr("Open Slice"),
Path::GetEditingGameDataFolder().c_str(),
tr("Slice (*.slice)"));
if (!fileName.isEmpty())
{
m_levelPath = fileName;
accept();
}
}
void WelcomeScreenDialog::OnRecentLevelListItemClicked(const QModelIndex& modelIndex)
void WelcomeScreenDialog::OnRecentLevelTableItemClicked(const QModelIndex& modelIndex)
{
int index = modelIndex.row();
@@ -365,45 +331,6 @@ void WelcomeScreenDialog::OnCloseBtnClicked([[maybe_unused]] bool checked)
accept();
}
void WelcomeScreenDialog::OnAutoLoadLevelBtnClicked(bool checked)
{
gSettings.bAutoloadLastLevelAtStartup = checked;
gSettings.Save();
}
void WelcomeScreenDialog::OnShowOnStartupBtnClicked(bool checked)
{
gSettings.bShowDashboardAtStartup = !checked;
gSettings.Save();
if (gSettings.bShowDashboardAtStartup == false)
{
QMessageBox msgBox(AzToolsFramework::GetActiveWindow());
msgBox.setWindowTitle(QObject::tr("Skip the Welcome dialog on startup"));
msgBox.setText(QObject::tr("You may re-enable the Welcome dialog at any time by going to Edit > Editor Settings > Global Preferences in the menu bar."));
msgBox.exec();
}
}
void WelcomeScreenDialog::OnDocumentationBtnClicked([[maybe_unused]] bool checked)
{
QString webLink = tr("https://aws.amazon.com/lumberyard/support/");
QDesktopServices::openUrl(QUrl(webLink));
}
void WelcomeScreenDialog::SyncFail([[maybe_unused]] News::ErrorCode error)
{
m_articleViewContainer->AddErrorMessage();
m_waitingOnAsync = false;
}
void WelcomeScreenDialog::SyncSuccess()
{
m_articleViewContainer->PopulateArticles();
m_waitingOnAsync = false;
}
void WelcomeScreenDialog::previewAreaScrolled()
{
//this should only be reported once per session
@@ -52,13 +52,9 @@ private:
Ui::WelcomeScreenDialog* ui;
QString m_levelPath;
QStringListModel* m_pRecentListModel;
TNameFullPathArray m_levels;
RecentFileList* m_pRecentList;
News::ResourceManifest* m_manifest = nullptr;
News::ArticleViewContainer* m_articleViewContainer = nullptr;
const char* m_levelExtension = nullptr;
bool m_waitingOnAsync = true;
bool m_messageScrollReported = false;
void RemoveLevelEntry(int index);
@@ -66,19 +62,11 @@ private:
void OnShowToolTip(const QModelIndex& index);
void OnShowContextMenu(const QPoint& point);
void OnNewLevelBtnClicked(bool checked);
void OnNewLevelLabelClicked(const QString& checked);
void OnOpenLevelBtnClicked(bool checked);
void OnNewSliceBtnClicked(bool checked);
void OnOpenSliceBtnClicked(bool checked);
void OnRecentLevelListItemClicked(const QModelIndex& index);
void OnGettingStartedBtnClicked(bool checked);
void OnTutorialsBtnClicked(bool checked);
void OnDocumentationBtnClicked(bool checked);
void OnForumsBtnClicked(bool checked);
void OnAutoLoadLevelBtnClicked(bool checked);
void OnShowOnStartupBtnClicked(bool checked);
void OnRecentLevelTableItemClicked(const QModelIndex& index);
void OnCloseBtnClicked(bool checked);
void SyncUpdate(const QString& /* message */, News::LogType /* logType */) {}
void SyncFail(News::ErrorCode error);
void SyncSuccess();
@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="WelcomeScreenDialog">
<file>WelcomeScreenDialogHeader.png</file>
<file>DefaultActiveProject.png</file>
</qresource>
</RCC>
@@ -2,12 +2,15 @@
<ui version="4.0">
<class>WelcomeScreenDialog</class>
<widget class="QWidget" name="WelcomeScreenDialog">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
<width>945</width>
<height>639</height>
</rect>
</property>
<property name="sizePolicy">
@@ -18,21 +21,21 @@
</property>
<property name="minimumSize">
<size>
<width>800</width>
<height>600</height>
<width>945</width>
<height>639</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>800</width>
<height>16777215</height>
<width>945</width>
<height>639</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="windowTitle">
<string>Welcome to Open 3D Engine</string>
<string>Welcome to O3DE</string>
</property>
<property name="styleSheet">
<string notr="true"/>
@@ -53,100 +56,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="projectViewContainer" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>36</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>36</height>
</size>
</property>
<layout class="QHBoxLayout" name="projectViewContainer_layout" stretch="0,0,1,0,0">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>16</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>12</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="currentProjectLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Current project:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="currentProjectButton">
<property name="text">
<string>Current Project Name</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>1</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color: &quot;black&quot;</string>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="bodyContainer">
<property name="spacing">
@@ -165,20 +74,26 @@
<number>0</number>
</property>
<item>
<widget class="QWidget" name="levelViewFTUEContainer" native="true">
<widget class="QWidget" name="articleViewContainerRoot" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<width>183</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<width>183</width>
<height>16777215</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
<layout class="QVBoxLayout" name="newsContainerLayout">
<property name="spacing">
<number>0</number>
</property>
@@ -191,6 +106,143 @@
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>15</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="currentProjectLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Active project</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="activeProjectIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>126</width>
<height>167</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>126</width>
<height>167</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="WelcomeScreenDialog.qrc">:/WelcomeScreenDialog/DefaultActiveProject.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="currentProjectName">
<property name="text">
<string>MyGame</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>15</number>
</property>
<property name="rightMargin">
<number>15</number>
</property>
<item>
<widget class="QPushButton" name="switchProjectButton">
<property name="text">
<string>Switch project...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="levelViewFTUEContainer" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>762</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>762</width>
<height>16777215</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>20</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>20</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
@@ -227,7 +279,7 @@
</size>
</property>
<property name="text">
<string>Open or create a level</string>
<string>Recent Files</string>
</property>
<property name="indent">
<number>-1</number>
@@ -255,16 +307,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QListView" name="recentLevelList">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="spacing">
<number>4</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -310,8 +352,26 @@
</property>
<item>
<widget class="QPushButton" name="newLevelButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>156</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>156</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>New level...</string>
<string>Create new...</string>
</property>
</widget>
</item>
@@ -333,8 +393,67 @@
</item>
<item>
<widget class="QPushButton" name="openLevelButton">
<property name="minimumSize">
<size>
<width>156</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>156</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Open level...</string>
<string>Open...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="objectListButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../Framework/AzQtComponents/AzQtComponents/Components/resources.qrc">
<normaloff>:/stylesheet/img/UI20/toolbar/Object_list.svg</normaloff>:/stylesheet/img/UI20/toolbar/Object_list.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="gridButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../Framework/AzQtComponents/AzQtComponents/Components/resources.qrc">
<normaloff>:/stylesheet/img/UI20/toolbar/Grid.svg</normaloff>:/stylesheet/img/UI20/toolbar/Grid.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
@@ -358,65 +477,130 @@
</spacer>
</item>
<item>
<widget class="QWidget" name="horizontalWidget_2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="2,2,1">
<property name="leftMargin">
<number>6</number>
</property>
<layout class="QHBoxLayout" name="sliceControlContainer">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="newSliceButton">
<property name="text">
<string>New slice...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>24</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="openSliceButton">
<property name="text">
<string>Open slice...</string>
</property>
</widget>
</item>
</layout>
</widget>
<item>
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="modifiedLabel">
<property name="text">
<string>Last modified</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="typeLabel">
<property name="text">
<string>Type</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7" stretch="0,0,0">
<property name="leftMargin">
<number>16</number>
</property>
<property name="topMargin">
<number>16</number>
</property>
<property name="rightMargin">
<number>16</number>
</property>
<item>
<widget class="QLabel" name="levelFileLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>No level file created yet for this project. &lt;a href=&quot;#&quot;&gt;Create one&lt;/a&gt; now.</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="recentLevelTable">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="columnCount">
<number>3</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>1</number>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>48</number>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column/>
<column/>
<column/>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_4">
<property name="maximumSize">
@@ -439,205 +623,16 @@
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QWidget" name="documentationLinkContainer" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>48</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="documentationButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string>info</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/stylesheet/img/UI20/Info.svg</normaloff>:/stylesheet/img/UI20/Info.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="documentationLink">
<property name="text">
<string>Documentation and tutorials</string>
</property>
<property name="class" stdset="0">
<string>link</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="maximumSize">
<size>
<width>1</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color: &quot;black&quot;</string>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="articleViewContainerRoot" native="true">
<property name="minimumSize">
<size>
<width>480</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="newsContainerLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>1</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color: &quot;black&quot;</string>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QWidget" name="optionsViewContainer" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>36</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>36</height>
</size>
</property>
<layout class="QHBoxLayout" name="optionsViewContainer_layout">
<property name="spacing">
<number>30</number>
</property>
<property name="leftMargin">
<number>16</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>16</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="autoLoadLevel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Auto-load last opened level on startup</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showOnStartup">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Skip this dialog on startup</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="WelcomeScreenDialog.qrc"/>
<include location="../../../Framework/AzQtComponents/AzQtComponents/Components/resources.qrc"/>
</resources>
<connections/>
</ui>
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:53b846352880d940621b14b1ea9514e0a4c95aa6ead4d00234a98684c061c04f
size 29505
@@ -1765,16 +1765,8 @@ namespace LUAEditor
return false;
}
//name has the full path in it, we need to convert it to an asset name
AZStd::string projectRoot, databaseRoot, databasePath, databaseFile, fileExtension;
if (!AzFramework::StringFunc::AssetDatabasePath::Split(name.toUtf8().data(), &projectRoot, &databaseRoot, &databasePath, &databaseFile, &fileExtension))
{
AZ_Warning("LUAEditorMainWindow", false, AZStd::string::format("<span severity=\"err\">Path is invalid: '%s'</span>", name.toUtf8().data()).c_str());
return false;
}
AzFramework::StringFunc::Path::Split(name.toUtf8().data(), nullptr, &m_lastOpenFilePath);
AzFramework::StringFunc::AssetDatabasePath::Join(databasePath.c_str(), databaseFile.c_str(), newAssetName);
newAssetName = name.toUtf8().data();
return true;
}
@@ -1015,7 +1015,7 @@
{
"id": "pdo",
"displayName": "Pixel Depth Offset",
"description": "Whether to enable the pixel depth offset feature.",
"description": "Enable PDO to offset the original pixel depths. This will affect any shaders using depth, for example, when receiving shadows.",
"type": "Bool",
"defaultValue": false,
"connection": {
@@ -417,7 +417,7 @@
{
"id": "pdo",
"displayName": "Pixel Depth Offset",
"description": "Whether to enable the pixel depth offset feature.",
"description": "Enable PDO to offset the original pixel depths. This will affect any shaders using depth, for example, when receiving shadows.",
"type": "Bool",
"defaultValue": false,
"connection": {
@@ -956,7 +956,7 @@
{
"id": "pdo",
"displayName": "Pixel Depth Offset",
"description": "Whether to enable the pixel depth offset feature.",
"description": "Enable PDO to offset the original pixel depths. This will affect any shaders using depth, for example, when receiving shadows.",
"type": "Bool",
"defaultValue": false,
"connection": {
@@ -21,7 +21,7 @@
"SlotType": "Output",
"ScopeAttachmentUsage": "RenderTarget",
"LoadStoreAction": {
"LoadAction": "Load"
"LoadAction": "DontCare"
}
}
],
@@ -35,7 +35,6 @@ namespace AZ
{
m_device = device;
m_srgLayout = srgLayout;
m_srgPool = srgPool;
m_constantBufferSize = srgLayout->GetConstantDataSize();
if (m_constantBufferSize)
@@ -93,9 +92,6 @@ namespace AZ
//Attach the constant buffer
AttachConstantBuffer();
m_samplerCache = [[NSCache alloc]init];
[m_samplerCache setName:@"SamplerCache"];
}
}
}
@@ -211,8 +207,8 @@ namespace AZ
}
else
{
RHI::Ptr<Memory> nullMtlBufferMemPtr = m_device->GetNullDescriptorManager().GetNullImage(shaderInputImage.m_type).GetMemory();
mtlTextures[imageArrayLen] = nullMtlBufferMemPtr->GetGpuAddress<id<MTLTexture>>();
RHI::Ptr<Memory> nullMtlImagePtr = m_device->GetNullDescriptorManager().GetNullImage(shaderInputImage.m_type).GetMemory();
mtlTextures[imageArrayLen] = nullMtlImagePtr->GetGpuAddress<id<MTLTexture>>();
}
imageArrayLen++;
}
@@ -345,15 +341,20 @@ namespace AZ
m_device->GetArgumentBufferAllocator().DeAllocate(m_argumentBuffer);
}
#endif
m_argumentBuffer = {};
m_constantBuffer = {};
[m_samplerCache removeAllObjects];
[m_samplerCache release];
m_samplerCache = nil;
if(m_argumentBuffer.IsValid())
{
m_device->QueueForRelease(m_argumentBuffer);
}
if(m_constantBuffer.IsValid())
{
m_device->QueueForRelease(m_constantBuffer);
}
[m_argumentEncoder release];
m_argumentEncoder = nil;
Base::Shutdown();
}
@@ -374,23 +375,22 @@ namespace AZ
id<MTLSamplerState> ArgumentBuffer::GetMtlSampler(MTLSamplerDescriptor* samplerDesc)
{
id<MTLSamplerState> mtlSamplerState = [m_samplerCache objectForKey:samplerDesc];
const NSCache* samplerCache = m_device->GetSamplerCache();
id<MTLSamplerState> mtlSamplerState = [samplerCache objectForKey:samplerDesc];
if(mtlSamplerState == nil)
{
mtlSamplerState = [m_device->GetMtlDevice() newSamplerStateWithDescriptor:samplerDesc];
[m_samplerCache setObject:mtlSamplerState forKey:samplerDesc];
[samplerCache setObject:mtlSamplerState forKey:samplerDesc];
}
return mtlSamplerState;
}
void ArgumentBuffer::AddUntrackedResourcesToEncoder(id<MTLCommandEncoder> commandEncoder, const ShaderResourceGroupVisibility& srgResourcesVisInfo) const
void ArgumentBuffer::CollectUntrackedResources(id<MTLCommandEncoder> commandEncoder,
const ShaderResourceGroupVisibility& srgResourcesVisInfo,
ComputeResourcesToMakeResidentMap& resourcesToMakeResidentCompute,
GraphicsResourcesToMakeResidentMap& resourcesToMakeResidentGraphics) const
{
//Map to cache all the resources based on the usage as we can batch all the resources for a given usage
ComputeResourcesToMakeResidentMap resourcesToMakeResidentCompute;
//Map to cache all the resources based on the usage and shader stage as we can batch all the resources for a given usage/shader usage
GraphicsResourcesToMakeResidentMap resourcesToMakeResidentGraphics;
//Cache the constant buffer associated with a srg
if (m_constantBufferSize)
{
@@ -434,25 +434,6 @@ namespace AZ
}
}
}
//Call UseResource on all resources for Compute stage
for (const auto& key : resourcesToMakeResidentCompute)
{
AZStd::vector<id <MTLResource>> resourcesToProcessVec(key.second.begin(), key.second.end());
[static_cast<id<MTLComputeCommandEncoder>>(commandEncoder) useResources: &resourcesToProcessVec[0]
count: resourcesToProcessVec.size()
usage: key.first];
}
//Call UseResource on all resources for Vertex and Fragment stages
for (const auto& key : resourcesToMakeResidentGraphics)
{
AZStd::vector<id <MTLResource>> resourcesToProcessVec(key.second.begin(), key.second.end());
[static_cast<id<MTLRenderCommandEncoder>>(commandEncoder) useResources: &resourcesToProcessVec[0]
count: resourcesToProcessVec.size()
usage: key.first.first
stages: key.first.second];
}
}
void ArgumentBuffer::CollectResourcesForCompute(id<MTLCommandEncoder> encoder,
@@ -97,7 +97,15 @@ namespace AZ
id<MTLBuffer> GetArgEncoderBuffer() const;
size_t GetOffset() const;
void AddUntrackedResourcesToEncoder(id<MTLCommandEncoder> commandEncoder, const ShaderResourceGroupVisibility& srgResourcesVisInfo) const;
//Map to cache all the resources based on the usage as we can batch all the resources for a given usage.
using ComputeResourcesToMakeResidentMap = AZStd::unordered_map<MTLResourceUsage, AZStd::unordered_set<id <MTLResource>>>;
//Map to cache all the resources based on the usage and shader stage as we can batch all the resources for a given usage/shader usage.
using GraphicsResourcesToMakeResidentMap = AZStd::unordered_map<AZStd::pair<MTLResourceUsage,MTLRenderStages>, AZStd::unordered_set<id <MTLResource>>>;
void CollectUntrackedResources(id<MTLCommandEncoder> commandEncoder,
const ShaderResourceGroupVisibility& srgResourcesVisInfo,
ComputeResourcesToMakeResidentMap& resourcesToMakeResidentCompute,
GraphicsResourcesToMakeResidentMap& resourcesToMakeResidentGraphics) const;
void ClearResourceTracking();
@@ -120,11 +128,7 @@ namespace AZ
ResourceBindingsMap m_resourceBindings;
static const int MaxEntriesInArgTable = 31;
//Map to cache all the resources based on the usage as we can batch all the resources for a given usage.
using ComputeResourcesToMakeResidentMap = AZStd::unordered_map<MTLResourceUsage, AZStd::unordered_set<id <MTLResource>>>;
//Map to cache all the resources based on the usage and shader stage as we can batch all the resources for a given usage/shader usage.
using GraphicsResourcesToMakeResidentMap = AZStd::unordered_map<AZStd::pair<MTLResourceUsage,MTLRenderStages>, AZStd::unordered_set<id <MTLResource>>>;
void CollectResourcesForCompute(id<MTLCommandEncoder> encoder,
const ResourceBindingsSet& resourceBindingData,
ComputeResourcesToMakeResidentMap& resourcesToMakeResidentMap) const;
@@ -153,9 +157,6 @@ namespace AZ
MemoryView m_argumentBuffer;
MemoryView m_constantBuffer;
#endif
ShaderResourceGroupPool* m_srgPool = nullptr;
NSCache* m_samplerCache;
};
}
}
@@ -40,7 +40,7 @@ namespace AZ
buffer->m_pendingResolves++;
uploadRequest.m_attachmentBuffer = buffer;
uploadRequest.m_byteOffset = buffer->GetMemoryView().GetOffset() + request.m_byteOffset;
uploadRequest.m_byteOffset = request.m_byteOffset;
uploadRequest.m_stagingBuffer = stagingBuffer;
return stagingBuffer->GetMemoryView().GetCpuAddress();
@@ -51,6 +51,12 @@ namespace AZ
void BufferPoolResolver::Compile()
{
for (BufferUploadPacket& packet : m_uploadPackets)
{
Buffer* stagingBuffer = packet.m_stagingBuffer.get();
//Inform the GPU that the CPU has modified the staging buffer.
Platform::SynchronizeBufferOnCPU(stagingBuffer->GetMemoryView().GetGpuAddress<id<MTLBuffer>>(), stagingBuffer->GetMemoryView().GetOffset(), stagingBuffer->GetMemoryView().GetSize());
}
}
void BufferPoolResolver::Resolve(CommandList& commandList) const
@@ -62,15 +68,12 @@ namespace AZ
Buffer* destBuffer = packet.m_attachmentBuffer;
AZ_Assert(stagingBuffer, "Staging Buffer is null.");
AZ_Assert(destBuffer, "Attachment Buffer is null.");
//Inform the GPU that the CPU has modified the staging buffer.
Platform::SynchronizeBufferOnCPU(stagingBuffer->GetMemoryView().GetGpuAddress<id<MTLBuffer>>(), stagingBuffer->GetMemoryView().GetOffset(), stagingBuffer->GetMemoryView().GetSize());
RHI::CopyBufferDescriptor copyDescriptor;
copyDescriptor.m_sourceBuffer = stagingBuffer;
copyDescriptor.m_sourceOffset = stagingBuffer->GetMemoryView().GetOffset();
copyDescriptor.m_destinationBuffer = destBuffer;
copyDescriptor.m_destinationOffset = static_cast<uint32_t>(packet.m_byteOffset);
copyDescriptor.m_destinationOffset = destBuffer->GetMemoryView().GetOffset() + static_cast<uint32_t>(packet.m_byteOffset);
copyDescriptor.m_size = stagingBuffer->GetMemoryView().GetSize();
commandList.Submit(RHI::CopyItem(copyDescriptor));
@@ -85,6 +85,7 @@ namespace AZ
destinationOffset:descriptor.m_destinationOffset
size:descriptor.m_size];
Platform::SynchronizeBufferOnGPU(blitEncoder, destinationBuffer->GetMemoryView().GetGpuAddress<id<MTLBuffer>>());
break;
}
case RHI::CopyItemType::Image:
@@ -114,6 +115,8 @@ namespace AZ
destinationSlice: descriptor.m_destinationSubresource.m_arraySlice
destinationLevel: descriptor.m_destinationSubresource.m_mipSlice
destinationOrigin: destinationOrigin];
Platform::SynchronizeTextureOnGPU(blitEncoder, destinationImage->GetMemoryView().GetGpuAddress<id<MTLTexture>>());
break;
}
case RHI::CopyItemType::BufferToImage:
@@ -266,6 +269,11 @@ namespace AZ
mtlVertexArgBufferOffsets.fill(0);
mtlFragmentOrComputeArgBufferOffsets.fill(0);
//Map to cache all the resources based on the usage as we can batch all the resources for a given usage
ArgumentBuffer::ComputeResourcesToMakeResidentMap resourcesToMakeResidentCompute;
//Map to cache all the resources based on the usage and shader stage as we can batch all the resources for a given usage/shader usage
ArgumentBuffer::GraphicsResourcesToMakeResidentMap resourcesToMakeResidentGraphics;
for (uint32_t slot = 0; slot < RHI::Limits::Pipeline::ShaderResourceGroupCountMax; ++slot)
{
const ShaderResourceGroup* shaderResourceGroup = bindings.m_srgsBySlot[slot];
@@ -291,7 +299,6 @@ namespace AZ
//For graphics and compute shader stages, cache all the argument buffers, offsets and track the min/max indices
if(m_commandEncoderType == CommandEncoderType::Render)
{
id<MTLRenderCommandEncoder> renderEncoder = GetEncoder<id<MTLRenderCommandEncoder>>();
uint8_t numBitsSet = RHI::CountBitsSet(static_cast<uint64_t>(srgVisInfo));
if( numBitsSet > 1 || srgVisInfo == RHI::ShaderStageMask::Vertex)
{
@@ -334,11 +341,11 @@ namespace AZ
//format compatible with the appropriate metal function.
if(m_commandEncoderType == CommandEncoderType::Render)
{
shaderResourceGroup->AddUntrackedResourcesToEncoder(m_encoder, srgResourcesVisInfo);
shaderResourceGroup->CollectUntrackedResources(m_encoder, srgResourcesVisInfo, resourcesToMakeResidentCompute, resourcesToMakeResidentGraphics);
}
else if(m_commandEncoderType == CommandEncoderType::Compute)
{
shaderResourceGroup->AddUntrackedResourcesToEncoder(m_encoder, srgResourcesVisInfo);
shaderResourceGroup->CollectUntrackedResources(m_encoder, srgResourcesVisInfo, resourcesToMakeResidentCompute, resourcesToMakeResidentGraphics);
}
}
}
@@ -368,6 +375,32 @@ namespace AZ
mtlFragmentOrComputeArgBufferOffsets);
}
id<MTLRenderCommandEncoder> renderEncoder = GetEncoder<id<MTLRenderCommandEncoder>>();
id<MTLComputeCommandEncoder> computeEncoder = GetEncoder<id<MTLComputeCommandEncoder>>();
//Call UseResource on all resources for Compute stage
for (const auto& key : resourcesToMakeResidentCompute)
{
AZStd::vector<id <MTLResource>> resourcesToProcessVec(key.second.begin(), key.second.end());
[computeEncoder useResources: &resourcesToProcessVec[0]
count: resourcesToProcessVec.size()
usage: key.first];
}
//Call UseResource on all resources for Vertex and Fragment stages
for (const auto& key : resourcesToMakeResidentGraphics)
{
AZStd::vector<id <MTLResource>> resourcesToProcessVec(key.second.begin(), key.second.end());
[renderEncoder useResources: &resourcesToProcessVec[0]
count: resourcesToProcessVec.size()
usage: key.first.first
stages: key.first.second];
}
return true;
}
@@ -83,7 +83,7 @@ namespace AZ
for (id<MTLHeap> residentHeap : *m_residentHeaps)
{
[renderEncoder useHeap : residentHeap
stages : MTLRenderStageFragment];
stages : MTLRenderStageVertex | MTLRenderStageFragment];
}
break;
}
@@ -80,6 +80,9 @@ namespace AZ
m_nullDescriptorManager.Init(*this);
m_samplerCache = [[NSCache alloc]init];
[m_samplerCache setName:@"SamplerCache"];
return RHI::ResultCode::Success;
}
@@ -101,6 +104,10 @@ namespace AZ
m_releaseQueue.Shutdown();
m_pipelineLayoutCache.Shutdown();
[m_samplerCache removeAllObjects];
[m_samplerCache release];
m_samplerCache = nil;
for (AZ::u32 i = 0; i < CommandEncoderTypeCount; ++i)
{
m_commandListPools[i].Shutdown();
@@ -144,6 +144,11 @@ namespace AZ
return m_asyncUploadQueue;
}
const NSCache* GetSamplerCache() const
{
return m_samplerCache;
}
BufferMemoryAllocator& GetArgBufferConstantBufferAllocator() { return m_argumentBufferConstantsAllocator;}
BufferMemoryAllocator& GetArgumentBufferAllocator() { return m_argumentBufferAllocator;}
@@ -194,6 +199,7 @@ namespace AZ
RHI::HeapMemoryUsage m_argumentBufferAllocatorMemoryUsage;
NullDescriptorManager m_nullDescriptorManager;
NSCache* m_samplerCache;
};
}
}
@@ -11,6 +11,7 @@
*/
#include "Atom_RHI_Metal_precompiled.h"
#include <RHI/ArgumentBuffer.h>
#include <RHI/ImageView.h>
#include <RHI/ShaderResourceGroup.h>
@@ -33,10 +34,12 @@ namespace AZ
return *m_compiledArgBuffers[m_compiledDataIndex];
}
void ShaderResourceGroup::AddUntrackedResourcesToEncoder(id<MTLCommandEncoder> commandEncoder,
const ShaderResourceGroupVisibility& srgResourcesVisInfo) const
void ShaderResourceGroup::CollectUntrackedResources(id<MTLCommandEncoder> commandEncoder,
const ShaderResourceGroupVisibility& srgResourcesVisInfo,
ArgumentBuffer::ComputeResourcesToMakeResidentMap& resourcesToMakeResidentCompute,
ArgumentBuffer::GraphicsResourcesToMakeResidentMap& resourcesToMakeResidentGraphics) const
{
GetCompiledArgumentBuffer().AddUntrackedResourcesToEncoder(commandEncoder, srgResourcesVisInfo);
GetCompiledArgumentBuffer().CollectUntrackedResources(commandEncoder, srgResourcesVisInfo, resourcesToMakeResidentCompute, resourcesToMakeResidentGraphics);
}
}
}
@@ -47,7 +47,10 @@ namespace AZ
const ImageView* GetImageView(const int index) const;
void UpdateCompiledDataIndex();
const ArgumentBuffer& GetCompiledArgumentBuffer() const;
void AddUntrackedResourcesToEncoder(id<MTLCommandEncoder> commandEncoder, const ShaderResourceGroupVisibility& srgResourcesVisInfo) const;
void CollectUntrackedResources(id<MTLCommandEncoder> commandEncoder,
const ShaderResourceGroupVisibility& srgResourcesVisInfo,
ArgumentBuffer::ComputeResourcesToMakeResidentMap& resourcesToMakeResidentCompute,
ArgumentBuffer::GraphicsResourcesToMakeResidentMap& resourcesToMakeResidentGraphics) const;
private:
ShaderResourceGroup() = default;
@@ -30,6 +30,7 @@ namespace AZ
//! It does this by recursively creating Compute Passes to write to each mip using the Compute Shader.
class DownsampleMipChainPass
: public ParentPass
, private ShaderReloadNotificationBus::Handler
{
AZ_RPI_PASS(DownsampleMipChainPass);
@@ -39,6 +40,7 @@ namespace AZ
//! Creates a new pass without a PassTemplate
static Ptr<DownsampleMipChainPass> Create(const PassDescriptor& descriptor);
virtual ~DownsampleMipChainPass();
protected:
explicit DownsampleMipChainPass(const PassDescriptor& descriptor);
@@ -49,6 +51,11 @@ namespace AZ
void BuildInternal() override;
void FrameBeginInternal(FramePrepareParams params) override;
// ShaderReloadNotificationBus::Handler overrides...
void OnShaderReinitialized(const Shader& shader) override;
void OnShaderAssetReinitialized(const Data::Asset<ShaderAsset>& shaderAsset) override;
void OnShaderVariantReinitialized(const ShaderVariant& shaderVariant) override;
private:
// Gets target height, width and mip levels from the input/output image attachment
@@ -103,10 +103,14 @@ namespace AZ
AZStd::size_t CalculateTriangleCount() const;
};
class ModelAssetHandler : public AssetHandler<ModelAsset>
class ModelAssetHandler
: public AssetHandler<ModelAsset>
{
public:
AZ_RTTI(ModelAssetHandler, "{993B8CE3-1BBF-4712-84A0-285DB9AE808F}", AssetHandler<ModelAsset>);
// AZ::AssetTypeInfoBus::Handler overrides
bool HasConflictingProducts(const AZStd::vector<AZ::Data::AssetType>& productAssetTypes) const override;
};
} //namespace RPI
} // namespace AZ
@@ -54,8 +54,14 @@ namespace AZ
}
m_passData = *passData;
ShaderReloadNotificationBus::Handler::BusConnect(passData->m_shaderReference.m_assetId);
}
DownsampleMipChainPass::~DownsampleMipChainPass()
{
ShaderReloadNotificationBus::Handler::BusDisconnect();
}
void DownsampleMipChainPass::ResetInternal()
{
RemoveChildren();
@@ -206,5 +212,19 @@ namespace AZ
ParentPass::FrameBeginInternal(params);
}
void DownsampleMipChainPass::OnShaderReinitialized([[maybe_unused]] const Shader& shader)
{
m_needToUpdateChildren = true;
}
void DownsampleMipChainPass::OnShaderAssetReinitialized([[maybe_unused]] const Data::Asset<ShaderAsset>& shaderAsset)
{
m_needToUpdateChildren = true;
}
void DownsampleMipChainPass::OnShaderVariantReinitialized([[maybe_unused]] const ShaderVariant& shaderVariant)
{
m_needToUpdateChildren = true;
}
} // namespace RPI
} // namespace AZ
@@ -315,5 +315,26 @@ namespace AZ
return modelTriangleCount;
}
} //namespace RPI
bool ModelAssetHandler::HasConflictingProducts(const AZStd::vector<AZ::Data::AssetType>& productAssetTypes) const
{
size_t modelAssetCount = 0;
size_t actorAssetCount = 0;
for (const AZ::Data::AssetType& assetType : productAssetTypes)
{
if (assetType == azrtti_typeid<ModelAsset>())
{
modelAssetCount++;
}
else if (assetType == AZ::Data::AssetType("{F67CC648-EA51-464C-9F5D-4A9CE41A7F86}")) // ActorAsset
{
actorAssetCount++;
}
}
// When dropping a well-defined character, consisting of a mesh and a skeleton/actor,
// do not create an entity with a mesh component.
return modelAssetCount == 1 && actorAssetCount == 1;
}
} // namespace RPI
} // namespace AZ
@@ -10,6 +10,9 @@
*
*/
#include <QApplication>
#include <QWidget>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Component/TransformBus.h>
#include <AzCore/Math/Matrix4x4.h>
@@ -223,7 +226,12 @@ namespace MaterialEditor
}
else if (inputChannelId == InputDeviceKeyboard::Key::AlphanumericZ && (m_keys & Ctrl) == None)
{
Reset();
// only reset camera if no other widget besides viewport is in focus
const auto focus = QApplication::focusWidget();
if (!focus || focus->objectName() == "Viewport")
{
Reset();
}
}
break;
case InputChannel::State::Updated:
@@ -8,12 +8,3 @@
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
add_custom_command(TARGET LmbrCentral.Editor POST_BUILD
COMMAND "${CMAKE_COMMAND}" -P "${LY_ROOT_FOLDER}/cmake/Platform/Mac/RPathChange.cmake"
"$<TARGET_FILE_DIR:LmbrCentral.Editor>/lrelease"
@loader_path/../lib
"${QT_PATH}/lib"
COMMENT "Patching lrelease..."
VERBATIM
)
@@ -8,19 +8,3 @@
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
add_custom_command(TARGET LmbrCentral.Editor POST_BUILD
COMMAND "${CMAKE_COMMAND}"
-DLY_TIMESTAMP_REFERENCE=$<TARGET_FILE_DIR:LmbrCentral.Editor>/lrelease.exe
-DLY_LOCK_FILE=$<TARGET_FILE_DIR:LmbrCentral.Editor>/qtdeploy.lock
-P ${LY_ROOT_FOLDER}/cmake/CommandExecution.cmake
EXEC_COMMAND "${CMAKE_COMMAND}" -E
env PATH="${QT_PATH}/bin"
${WINDEPLOYQT_EXECUTABLE}
$<$<CONFIG:Debug>:--pdb>
--verbose 0
--no-compiler-runtime
$<TARGET_FILE_DIR:LmbrCentral.Editor>/lrelease.exe
COMMENT "Patching lrelease..."
VERBATIM
)
@@ -23,7 +23,7 @@ ly_associate_package(PACKAGE_NAME lux_core-2.2-rev5-multiplatform TARGETS lux
# platform-specific:
ly_associate_package(PACKAGE_NAME freetype-2.10.4.14-android TARGETS freetype PACKAGE_HASH 74dd75382688323c3a2a5090f473840b5d7e9d2aed1a4fcdff05ed2a09a664f2)
ly_associate_package(PACKAGE_NAME tiff-4.2.0.14-android TARGETS tiff PACKAGE_HASH a9b30a1980946390c2fad0ed94562476a1d7ba8c1f36934ae140a89c54a8efd0)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.7.167-rev3-android TARGETS AWSNativeSDK PACKAGE_HASH e2192157534cc8c4e22769545d88dff03ec6c1031599716ef63de3ebbb8c9a44)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.7.167-rev4-android TARGETS AWSNativeSDK PACKAGE_HASH 9d163696591a836881fc22dac3c94e57b0278771b6c6cec807ff6a5e96f2669d)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev5-android TARGETS Lua PACKAGE_HASH 1f638e94a17a87fe9e588ea456d5893876094b4db191234380e4c4eb9e06c300)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev3-android TARGETS PhysX PACKAGE_HASH b8cb6aa46b2a21671f6cb1f6a78713a3ba88824d0447560ff5ce6c01014b9f43)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-android TARGETS mikkelsen PACKAGE_HASH 075e8e4940884971063b5a9963014e2e517246fa269c07c7dc55b8cf2cd99705)
@@ -105,12 +105,10 @@ if(@target_file_dir@ MATCHES ".app/Contents/MacOS")
endif()
endif()
if(anything_new)
unset(fixup_bundle_ignore)
# LYN-4505: Patch dxc, is configured in the wrong folder in 3p
if(EXISTS ${bundle_path}/Contents/MacOS/Builders/DirectXShaderCompiler/bin/dxc-3.7)
# we copy to not invalidate the copy check from above
file(COPY ${bundle_path}/Contents/MacOS/Builders/DirectXShaderCompiler/lib/libdxcompiler.3.7.dylib
DESTINATION ${bundle_path}/Contents/MacOS/Builders/DirectXShaderCompiler/bin
)
list(APPEND fixup_bundle_ignore dxc-3.7)
endif()
# Python.framework being copied by fixup_bundle
#if(EXISTS ${bundle_path}/Contents/Frameworks/Python.framework)
@@ -139,8 +137,17 @@ if(@target_file_dir@ MATCHES ".app/Contents/MacOS")
#endif()
list(REMOVE_DUPLICATES plugin_libs)
list(REMOVE_DUPLICATES plugin_dirs)
fixup_bundle("${bundle_path}" "${plugin_libs}" "${plugin_dirs}")
fixup_bundle("${bundle_path}" "${plugin_libs}" "${plugin_dirs}" IGNORE_ITEM ${fixup_bundle_ignore})
file(TOUCH "${bundle_path}")
file(TOUCH "${fixup_timestamp_file}")
# fixup bundle ends up removing the rpath of dxc (despite we exclude it)
if(EXISTS ${bundle_path}/Contents/MacOS/Builders/DirectXShaderCompiler/bin/dxc-3.7)
find_program(LY_INSTALL_NAME_TOOL install_name_tool)
if (NOT LY_INSTALL_NAME_TOOL)
message(FATAL_ERROR "Unable to locate 'install_name_tool'")
endif()
execute_process(COMMAND ${LY_INSTALL_NAME_TOOL} -add_rpath @executable_path/../lib ${bundle_path}/Contents/MacOS/Builders/DirectXShaderCompiler/bin/dxc-3.7)
endif()
endif()
endif()
+68
View File
@@ -0,0 +1,68 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
import sys
import azlmbr
from pathlib import Path
def fixup_current_level(threshold):
nonUniformScaleComponentId = azlmbr.editor.EditorNonUniformScaleComponentTypeId
# iterate over all entities in the level
entityIdList = azlmbr.entity.SearchBus(azlmbr.bus.Broadcast, 'SearchEntities', azlmbr.entity.SearchFilter())
for entityId in entityIdList:
name = azlmbr.editor.EditorEntityInfoRequestBus(azlmbr.bus.Event, 'GetName', entityId)
local = azlmbr.components.TransformBus(azlmbr.bus.Event, 'GetLocalScale', entityId)
# only process entities where the non-uniformity is greater than the threshold
local_max = max(local.x, local.y, local.z)
local_min = min(local.x, local.y, local.z)
if local_max / local_min > 1 + threshold:
# check if there is already a Non-uniform Scale component
getComponentOutcome = azlmbr.editor.EditorComponentAPIBus(azlmbr.bus.Broadcast, 'GetComponentOfType', entityId, nonUniformScaleComponentId)
if getComponentOutcome.IsSuccess():
print(f"skipping {name} as it already has a Non-uniform Scale component")
else:
# add Non-uniform Scale component and set it to the non-uniform part of the local scale
azlmbr.editor.EditorComponentAPIBus(azlmbr.bus.Broadcast,'AddComponentsOfType', entityId, [nonUniformScaleComponentId])
vec = azlmbr.math.Vector3(local.x / local_max, local.y / local_max, local.z / local_max)
azlmbr.entity.NonUniformScaleRequestBus(azlmbr.bus.Event, 'SetScale', entityId, vec)
print(f"added non-uniform scale component for {name}: {local.x}, {local.y}, {local.z}")
if __name__ == '__main__':
# handle the arguments manually since argparse causes problems when run through EditorPythonBindings
process_all_levels = "--all" in sys.argv
# ignore entities where the relative difference between the min and max scale values is less than this threshold
threshold = 0.001
for i in range(len(sys.argv) - 1):
if sys.argv[i] == "--threshold":
try:
threshold = float(sys.argv[i + 1])
except ValueError:
print(f"invalid threshold value {sys.argv[i + 1]}, using default value {threshold}")
pass
if process_all_levels:
game_folder = Path(azlmbr.legacy.general.get_game_folder())
level_folder = game_folder / 'Levels'
levels = [str(level) for level in level_folder.rglob('*.ly')] + [str(level) for level in level_folder.rglob('*.cry')]
for level in levels:
if "_savebackup" not in level:
print(f'loading level {level}')
azlmbr.legacy.general.open_level_no_prompt(level)
azlmbr.legacy.general.idle_wait(2.0)
fixup_current_level(threshold)
azlmbr.legacy.general.save_level()
else:
fixup_current_level(threshold)