Remove I3DEngine CryCommon Interface (#567)

Delete:

- I3DEngine
- Missions
- Time of day
- GameEffectsSystem Gem
- ImageProcessing Gem
- SVOGI Gem
- Various other things that don't do anything now that the legacy renderer has been removed.
This commit is contained in:
bosnichd
2021-05-05 09:07:28 -06:00
committed by GitHub
parent 24df655d8b
commit d7b796fd73
222 changed files with 124 additions and 26474 deletions
@@ -50,8 +50,6 @@
#include "Include/IObjectManager.h"
#include "CryEditDoc.h"
#include "QtViewPaneManager.h"
#include "AzAssetBrowser/Preview/LegacyPreviewerFactory.h"
namespace AzAssetBrowserRequestHandlerPrivate
{
@@ -230,18 +228,15 @@ namespace AzAssetBrowserRequestHandlerPrivate
}
AzAssetBrowserRequestHandler::AzAssetBrowserRequestHandler()
: m_previewerFactory(aznew LegacyPreviewerFactory)
{
using namespace AzToolsFramework::AssetBrowser;
AssetBrowserInteractionNotificationBus::Handler::BusConnect();
AzQtComponents::DragAndDropEventsBus::Handler::BusConnect(AzQtComponents::DragAndDropContexts::EditorViewport);
AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler::BusConnect();
}
AzAssetBrowserRequestHandler::~AzAssetBrowserRequestHandler()
{
AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler::BusDisconnect();
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler::BusDisconnect();
AzQtComponents::DragAndDropEventsBus::Handler::BusDisconnect();
}
@@ -527,15 +522,6 @@ void AzAssetBrowserRequestHandler::Drop(QDropEvent* event, AzQtComponents::DragA
}
}
const AzToolsFramework::AssetBrowser::PreviewerFactory* AzAssetBrowserRequestHandler::GetPreviewerFactory(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const
{
if (m_previewerFactory->IsEntrySupported(entry))
{
return m_previewerFactory.get();
}
return nullptr;
}
void AzAssetBrowserRequestHandler::AddSourceFileOpeners(const char* fullSourceFileName, const AZ::Uuid& sourceUUID, AzToolsFramework::AssetBrowser::SourceFileOpenerList& openers)
{
using namespace AzToolsFramework;
@@ -37,12 +37,9 @@ namespace AzToolsFramework
}
}
class LegacyPreviewerFactory;
class AzAssetBrowserRequestHandler
: protected AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler
, protected AzQtComponents::DragAndDropEventsBus::Handler
, protected AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler
{
public:
AzAssetBrowserRequestHandler();
@@ -66,16 +63,8 @@ protected:
void DragLeave(QDragLeaveEvent* event) override;
void Drop(QDropEvent* event, AzQtComponents::DragAndDropContextBase& context) override;
//////////////////////////////////////////////////////////////////////////
// PreviewerRequestBus::Handler
//////////////////////////////////////////////////////////////////////////
const AzToolsFramework::AssetBrowser::PreviewerFactory* GetPreviewerFactory(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const override;
bool CanAcceptDragAndDropEvent(
QDropEvent* event, AzQtComponents::DragAndDropContextBase& context,
AZStd::optional<AZStd::vector<const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry*>*> outSources = AZStd::nullopt,
AZStd::optional<AZStd::vector<const AzToolsFramework::AssetBrowser::ProductAssetBrowserEntry*>*> outProducts = AZStd::nullopt) const;
private:
AZStd::unique_ptr<const LegacyPreviewerFactory> m_previewerFactory;
};
@@ -1,409 +0,0 @@
/*
* 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.
*
*/
#include "EditorDefs.h"
#include "LegacyPreviewer.h"
// AzToolsFramework
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h>
#include <AzToolsFramework/AssetBrowser/EBusFindAssetTypeByName.h>
// Editor
#include "Util/Image.h"
#include "Util/ImageUtil.h"
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <AzAssetBrowser/Preview/ui_LegacyPreviewer.h>
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
static const int s_CharWidth = 6;
const QString LegacyPreviewer::Name{ QStringLiteral("LegacyPreviewer") };
LegacyPreviewer::LegacyPreviewer(QWidget* parent)
: Previewer(parent)
, m_ui(new Ui::LegacyPreviewerClass())
, m_textureType(TextureType::RGB)
{
m_ui->setupUi(this);
m_ui->m_comboBoxRGB->addItems(QStringList() << "RGB" << "RGBA" << "Alpha");
m_ui->m_previewCtrl->SetAspectRatio(4.0f / 3.0f);
connect(m_ui->m_comboBoxRGB, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated), this,
[=](int index)
{
m_textureType = static_cast<TextureType>(index);
UpdateTextureType();
});
Clear();
}
LegacyPreviewer::~LegacyPreviewer()
{
}
void LegacyPreviewer::Clear() const
{
m_ui->m_previewCtrl->ReleaseObject();
m_ui->m_modelPreviewWidget->hide();
m_ui->m_texturePreviewWidget->hide();
m_ui->m_fileInfoCtrl->hide();
}
void LegacyPreviewer::Display(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry)
{
using namespace AzToolsFramework::AssetBrowser;
if (!entry)
{
Clear();
return;
}
switch (entry->GetEntryType())
{
case AssetBrowserEntry::AssetEntryType::Source:
{
const SourceAssetBrowserEntry* sourceEntry = azrtti_cast<const SourceAssetBrowserEntry*>(entry);
DisplaySource(sourceEntry);
break;
}
case AssetBrowserEntry::AssetEntryType::Product:
DisplayProduct(static_cast<const ProductAssetBrowserEntry*>(entry));
break;
default:
Clear();
}
}
const QString& LegacyPreviewer::GetName() const
{
return Name;
}
void LegacyPreviewer::resizeEvent(QResizeEvent* /*event*/)
{
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
}
bool LegacyPreviewer::DisplayProduct(const AzToolsFramework::AssetBrowser::ProductAssetBrowserEntry* product)
{
m_ui->m_fileInfoCtrl->show();
m_fileinfo = QString::fromUtf8(product->GetName().c_str());
m_fileinfo += GetFileSize(product->GetRelativePath().c_str());
EBusFindAssetTypeByName meshAssetTypeResult("Static Mesh");
AZ::AssetTypeInfoBus::BroadcastResult(meshAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
QString filename(product->GetRelativePath().c_str());
// Find item.
if (product->GetAssetType() == meshAssetTypeResult.GetAssetType())
{
m_ui->m_modelPreviewWidget->show();
m_ui->m_texturePreviewWidget->hide();
m_ui->m_previewCtrl->LoadFile(filename);
int nVertexCount = m_ui->m_previewCtrl->GetVertexCount();
int nFaceCount = m_ui->m_previewCtrl->GetFaceCount();
int nMaxLod = m_ui->m_previewCtrl->GetMaxLod();
int nMtls = m_ui->m_previewCtrl->GetMtlCount();
if (nFaceCount > 0)
{
m_fileinfo += tr("\r\n%1 Faces\r\n%2 Verts\r\n%3 MaxLod\r\n%4 Materials").arg(nFaceCount).arg(nVertexCount).arg(nMaxLod).arg(nMtls);
}
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
updateGeometry();
return true;
}
EBusFindAssetTypeByName textureAssetTypeResult("Texture");
AZ::AssetTypeInfoBus::BroadcastResult(textureAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
if (product->GetAssetType() == textureAssetTypeResult.GetAssetType())
{
// Get full product file path
const char* assetCachePath = AZ::IO::FileIOBase::GetInstance()->GetAlias("@assets@");
AZStd::string productFullPath;
AzFramework::StringFunc::Path::Join(assetCachePath, product->GetRelativePath().c_str(), productFullPath);
if (AZ::IO::FileIOBase::GetInstance()->Exists(productFullPath.c_str()))
{
// Try to display it in modern dds image loader, if no one exists, use the legacy image loader
bool foundPixmap = DisplayTextureProductModern(productFullPath.c_str());
return foundPixmap ? foundPixmap : DisplayTextureLegacy(productFullPath.c_str());
}
else
{
// If we cannot find the product file, means it's not treated as an asset, display its source
return DisplayTextureLegacy(product->GetFullPath().c_str());
}
}
Clear();
return false;
}
void LegacyPreviewer::DisplaySource(const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry* source)
{
using namespace AzToolsFramework::AssetBrowser;
EBusFindAssetTypeByName textureAssetType("Texture");
AZ::AssetTypeInfoBus::BroadcastResult(textureAssetType, &AZ::AssetTypeInfo::GetAssetType);
if (source->GetPrimaryAssetType() == textureAssetType.GetAssetType())
{
m_ui->m_fileInfoCtrl->show();
m_fileinfo = QString::fromUtf8(source->GetName().c_str());
m_fileinfo += GetFileSize(source->GetFullPath().c_str());
const char* fullSourcePath = source->GetFullPath().c_str();
// If it's a source dds file, try to display it using modern way
if (AzFramework::StringFunc::Path::IsExtension(fullSourcePath, "dds", false))
{
if (DisplayTextureProductModern(fullSourcePath))
{
return;
}
}
DisplayTextureLegacy(source->GetFullPath().c_str());
}
else
{
AZStd::vector<const ProductAssetBrowserEntry*> products;
source->GetChildrenRecursively<ProductAssetBrowserEntry>(products);
if (products.empty())
{
Clear();
}
else
{
for (auto* product : products)
{
if (DisplayProduct(product))
{
break;
}
}
}
}
}
QString LegacyPreviewer::GetFileSize(const char* path)
{
QString fileSizeStr;
AZ::u64 fileSizeResult = 0;
if (AZ::IO::FileIOBase::GetInstance()->Size(path, fileSizeResult))
{
static double kb = 1024.0f;
static double mb = kb * 1024.0;
static double gb = mb * 1024.0;
static QString byteStr = "B";
static QString kbStr = "KB";
static QString mbStr = "MB";
static QString gbStr = "GB";
#if AZ_TRAIT_OS_PLATFORM_APPLE
kb = 1000.0;
mb = kb * 1000.0;
gb = mb * 1000.0;
kbStr = "kB";
mbStr = "mB";
gbStr = "gB";
#endif // AZ_TRAIT_OS_PLATFORM_APPLE
if (fileSizeResult < kb)
{
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(fileSizeResult), byteStr);
}
else if (fileSizeResult < mb)
{
double size = fileSizeResult / kb;
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(size, 'f', 2), kbStr);
}
else if (fileSizeResult < gb)
{
double size = fileSizeResult / mb;
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(size, 'f', 2), mbStr);
}
else
{
double size = fileSizeResult / gb;
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(size, 'f', 2), gbStr);
}
}
return fileSizeStr;
}
bool LegacyPreviewer::DisplayTextureLegacy(const char* fullImagePath)
{
m_ui->m_modelPreviewWidget->hide();
m_ui->m_texturePreviewWidget->show();
bool foundPixmap = false;
if (!AZ::IO::FileIOBase::GetInstance()->IsDirectory(fullImagePath))
{
QString strLoadFilename = QString(fullImagePath);
if (CImageUtil::LoadImage(strLoadFilename, m_previewImageSource))
{
m_fileinfo += QStringLiteral("\r\n%1x%2\r\n%3")
.arg(m_previewImageSource.GetWidth())
.arg(m_previewImageSource.GetHeight())
.arg(m_previewImageSource.GetFormatDescription());
m_fileinfoAlphaTexture = m_fileinfo;
UpdateTextureType();
foundPixmap = true;
}
}
if (!foundPixmap)
{
m_ui->m_previewImageCtrl->setPixmap(QPixmap());
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
}
updateGeometry();
return foundPixmap;
}
bool LegacyPreviewer::DisplayTextureProductModern(const char* fullProductImagePath)
{
m_ui->m_modelPreviewWidget->hide();
m_ui->m_texturePreviewWidget->show();
bool foundPixmap = false;
QImage previewImage;
AZStd::string productInfo;
AZStd::string productAlphaInfo;
AzToolsFramework::AssetBrowser::AssetBrowserTexturePreviewRequestsBus::BroadcastResult(foundPixmap, &AzToolsFramework::AssetBrowser::AssetBrowserTexturePreviewRequests::GetProductTexturePreview, fullProductImagePath, previewImage, productInfo, productAlphaInfo);
if (foundPixmap)
{
QPixmap pix = QPixmap::fromImage(previewImage);
m_ui->m_previewImageCtrl->setPixmap(pix);
m_ui->m_previewImageCtrl->updateGeometry();
CImageUtil::QImageToImage(previewImage, m_previewImageSource);
m_fileinfo += QStringLiteral("\r\n%1x%2\r\n%3")
.arg(m_previewImageSource.GetWidth())
.arg(m_previewImageSource.GetHeight())
.arg(m_previewImageSource.GetFormatDescription());
m_fileinfoAlphaTexture = m_fileinfo;
m_fileinfo += QString(productInfo.c_str());
if (productAlphaInfo.empty())
{
// If there is no separate info for alpha, use the image info
m_fileinfoAlphaTexture += QString(productInfo.c_str());
}
else
{
m_fileinfoAlphaTexture += QString(productAlphaInfo.c_str());
}
UpdateTextureType();
}
else
{
m_ui->m_previewImageCtrl->setPixmap(QPixmap());
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
}
updateGeometry();
return foundPixmap;
}
void LegacyPreviewer::UpdateTextureType()
{
m_previewImageUpdated.Copy(m_previewImageSource);
switch (m_textureType)
{
case TextureType::RGB:
{
m_previewImageUpdated.SwapRedAndBlue();
m_previewImageUpdated.FillAlpha();
break;
}
case TextureType::RGBA:
{
m_previewImageUpdated.SwapRedAndBlue();
break;
}
case TextureType::Alpha:
{
for (int h = 0; h < m_previewImageUpdated.GetHeight(); h++)
{
for (int w = 0; w < m_previewImageUpdated.GetWidth(); w++)
{
int a = m_previewImageUpdated.ValueAt(w, h) >> 24;
m_previewImageUpdated.ValueAt(w, h) = RGB(a, a, a) | 0xFF000000;
}
}
break;
}
}
// note that Qt will not deep copy the data, so WE MUST KEEP THE IMAGE DATA AROUND!
QPixmap qtPixmap = QPixmap::fromImage(
QImage(reinterpret_cast<uchar*>(m_previewImageUpdated.GetData()), m_previewImageUpdated.GetWidth(), m_previewImageUpdated.GetHeight(), QImage::Format_ARGB32));
m_ui->m_previewImageCtrl->setPixmap(qtPixmap);
m_ui->m_fileInfoCtrl->setText(WordWrap(m_textureType == TextureType::Alpha? m_fileinfoAlphaTexture: m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
m_ui->m_previewImageCtrl->updateGeometry();
}
bool LegacyPreviewer::FileInfoCompare(const FileInfo& f1, const FileInfo& f2)
{
if ((f1.attrib & _A_SUBDIR) && !(f2.attrib & _A_SUBDIR))
{
return true;
}
if (!(f1.attrib & _A_SUBDIR) && (f2.attrib & _A_SUBDIR))
{
return false;
}
return QString::compare(f1.filename, f2.filename, Qt::CaseInsensitive) < 0;
}
QString LegacyPreviewer::WordWrap(const QString& string, int maxLength)
{
QString result;
int length = 0;
for (auto c : string)
{
if (c == '\n')
{
length = 0;
}
else if (length > maxLength)
{
result.append('\n');
length = 0;
}
else
{
length++;
}
result.append(c);
}
return result;
}
#include <AzAssetBrowser/Preview/moc_LegacyPreviewer.cpp>
@@ -1,100 +0,0 @@
/*
* 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.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <Editor/Util/Image.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzToolsFramework/AssetBrowser/Previewer/Previewer.h>
#include <QWidget>
#include <QScopedPointer>
#endif
namespace Ui
{
class LegacyPreviewerClass;
}
namespace AzToolsFramework
{
namespace AssetBrowser
{
class ProductAssetBrowserEntry;
class SourceAssetBrowserEntry;
class AssetBrowserEntry;
}
}
class QResizeEvent;
class LegacyPreviewer
: public AzToolsFramework::AssetBrowser::Previewer
{
Q_OBJECT
public:
AZ_CLASS_ALLOCATOR(LegacyPreviewer, AZ::SystemAllocator, 0);
explicit LegacyPreviewer(QWidget* parent = nullptr);
~LegacyPreviewer();
//////////////////////////////////////////////////////////////////////////
// AzToolsFramework::AssetBrowser::Previewer
//////////////////////////////////////////////////////////////////////////
void Clear() const override;
void Display(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) override;
const QString& GetName() const override;
static const QString Name;
protected:
void resizeEvent(QResizeEvent * event) override;
private:
struct FileInfo
{
QString filename;
unsigned attrib;
time_t time_create; /* -1 for FAT file systems */
time_t time_access; /* -1 for FAT file systems */
time_t time_write;
_fsize_t size;
};
enum class TextureType
{
RGB,
RGBA,
Alpha
};
QScopedPointer<Ui::LegacyPreviewerClass> m_ui;
CImageEx m_previewImageSource;
CImageEx m_previewImageUpdated;
TextureType m_textureType;
QString m_fileinfo;
QString m_fileinfoAlphaTexture;
bool DisplayProduct(const AzToolsFramework::AssetBrowser::ProductAssetBrowserEntry* product);
void DisplaySource(const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry* source);
QString GetFileSize(const char* path);
bool DisplayTextureLegacy(const char* fullImagePath);
bool DisplayTextureProductModern(const char* fullProductImagePath);
void UpdateTextureType();
static bool FileInfoCompare(const FileInfo& f1, const FileInfo& f2);
//! QLabel word wrap does not break long words such as filenames, so manual word wrap needed
static QString WordWrap(const QString& string, int maxLength);
};
@@ -1,176 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LegacyPreviewerClass</class>
<widget class="QWidget" name="LegacyPreviewerClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>148</width>
<height>282</height>
</rect>
</property>
<property name="windowTitle">
<string>Preview</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="m_texturePreviewWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_4">
<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>
<layout class="QHBoxLayout" name="m_horizontalLayout">
<item>
<spacer name="m_horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="m_comboBoxRGB">
<property name="currentText">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="AzToolsFramework::AspectRatioAwarePixmapWidget" name="m_previewImageCtrl" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="m_modelPreviewWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="CPreviewModelCtrl" name="m_previewCtrl" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="m_fileInfoCtrl">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="m_verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>CPreviewModelCtrl</class>
<extends>QWidget</extends>
<header>Controls/PreviewModelCtrl.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>AzToolsFramework::AspectRatioAwarePixmapWidget</class>
<extends>QWidget</extends>
<header>AzToolsFramework/UI/UICore/AspectRatioAwarePixmapWidget.hxx</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -1,71 +0,0 @@
/*
* 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.
*
*/
#include "EditorDefs.h"
#include "LegacyPreviewerFactory.h"
// AzToolsFramework
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h> // for AssetBrowserEntry::AssetEntryType
#include <AzToolsFramework/AssetBrowser/EBusFindAssetTypeByName.h> // for EBusFindAssetTypeByName
// Editor
#include "LegacyPreviewer.h"
AzToolsFramework::AssetBrowser::Previewer* LegacyPreviewerFactory::CreatePreviewer(QWidget* parent) const
{
return new LegacyPreviewer(parent);
}
bool LegacyPreviewerFactory::IsEntrySupported(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const
{
using namespace AzToolsFramework::AssetBrowser;
EBusFindAssetTypeByName meshAssetTypeResult("Static Mesh");
AZ::AssetTypeInfoBus::BroadcastResult(meshAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
EBusFindAssetTypeByName textureAssetTypeResult("Texture");
AZ::AssetTypeInfoBus::BroadcastResult(textureAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
switch (entry->GetEntryType())
{
case AssetBrowserEntry::AssetEntryType::Source:
{
const auto* source = azrtti_cast < const SourceAssetBrowserEntry * > (entry);
if (source->GetPrimaryAssetType() == textureAssetTypeResult.GetAssetType())
{
return true;
}
AZStd::vector < const ProductAssetBrowserEntry * > products;
source->GetChildrenRecursively < ProductAssetBrowserEntry > (products);
for (auto* product : products)
{
if (product->GetAssetType() == textureAssetTypeResult.GetAssetType() ||
product->GetAssetType() == meshAssetTypeResult.GetAssetType())
{
return true;
}
}
break;
}
case AssetBrowserEntry::AssetEntryType::Product:
const auto* product = azrtti_cast < const ProductAssetBrowserEntry * > (entry);
return product->GetAssetType() == textureAssetTypeResult.GetAssetType() ||
product->GetAssetType() == meshAssetTypeResult.GetAssetType();
}
return false;
}
const QString& LegacyPreviewerFactory::GetName() const
{
return LegacyPreviewer::Name;
}
@@ -1,34 +0,0 @@
/*
* 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.
*
*/
#pragma once
#include <AzCore/Memory/SystemAllocator.h>
#include <AzToolsFramework/AssetBrowser/Previewer/PreviewerFactory.h>
class QString;
class LegacyPreviewerFactory final
: public AzToolsFramework::AssetBrowser::PreviewerFactory
{
public:
AZ_CLASS_ALLOCATOR(LegacyPreviewerFactory, AZ::SystemAllocator, 0);
LegacyPreviewerFactory() = default;
~LegacyPreviewerFactory() = default;
//////////////////////////////////////////////////////////////////////////
// AzToolsFramework::AssetBrowser::PreviewerFactory
//////////////////////////////////////////////////////////////////////////
AzToolsFramework::AssetBrowser::Previewer* CreatePreviewer(QWidget* parent = nullptr) const override;
bool IsEntrySupported(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const override;
const QString& GetName() const override;
};