|
|
|
|
@ -10,27 +10,25 @@
|
|
|
|
|
#include <Atom/RPI.Reflect/Model/ModelAsset.h>
|
|
|
|
|
#include <Atom/RPI.Reflect/System/AnyAsset.h>
|
|
|
|
|
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
|
|
|
|
#include <Previewer/CommonThumbnail.h>
|
|
|
|
|
#include <Previewer/CommonThumbnailUtils.h>
|
|
|
|
|
#include <SharedPreview/SharedThumbnail.h>
|
|
|
|
|
#include <SharedPreview/SharedThumbnailUtils.h>
|
|
|
|
|
#include <QtConcurrent/QtConcurrent>
|
|
|
|
|
|
|
|
|
|
namespace AZ
|
|
|
|
|
{
|
|
|
|
|
namespace LyIntegration
|
|
|
|
|
{
|
|
|
|
|
namespace Thumbnails
|
|
|
|
|
{
|
|
|
|
|
static constexpr const int CommonThumbnailSize = 256;
|
|
|
|
|
static constexpr const int SharedThumbnailSize = 256;
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// CommonThumbnail
|
|
|
|
|
// SharedThumbnail
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
CommonThumbnail::CommonThumbnail(AzToolsFramework::Thumbnailer::SharedThumbnailKey key)
|
|
|
|
|
SharedThumbnail::SharedThumbnail(AzToolsFramework::Thumbnailer::SharedThumbnailKey key)
|
|
|
|
|
: Thumbnail(key)
|
|
|
|
|
{
|
|
|
|
|
for (const AZ::Uuid& typeId : GetSupportedThumbnailAssetTypes())
|
|
|
|
|
for (const AZ::Uuid& typeId : SharedPreviewUtils::GetSupportedAssetTypes())
|
|
|
|
|
{
|
|
|
|
|
const AZ::Data::AssetId& assetId = GetAssetId(key, typeId);
|
|
|
|
|
const AZ::Data::AssetId& assetId = SharedPreviewUtils::GetAssetId(key, typeId);
|
|
|
|
|
if (assetId.IsValid())
|
|
|
|
|
{
|
|
|
|
|
m_assetId = assetId;
|
|
|
|
|
@ -41,38 +39,37 @@ namespace AZ
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AZ_Error("CommonThumbnail", false, "Failed to find matching assetId for the thumbnailKey.");
|
|
|
|
|
AZ_Error("SharedThumbnail", false, "Failed to find matching assetId for the thumbnailKey.");
|
|
|
|
|
m_state = State::Failed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommonThumbnail::LoadThread()
|
|
|
|
|
void SharedThumbnail::LoadThread()
|
|
|
|
|
{
|
|
|
|
|
AzToolsFramework::Thumbnailer::ThumbnailerRendererRequestBus::QueueEvent(
|
|
|
|
|
m_typeId, &AzToolsFramework::Thumbnailer::ThumbnailerRendererRequests::RenderThumbnail, m_key,
|
|
|
|
|
CommonThumbnailSize);
|
|
|
|
|
m_typeId, &AzToolsFramework::Thumbnailer::ThumbnailerRendererRequests::RenderThumbnail, m_key, SharedThumbnailSize);
|
|
|
|
|
// wait for response from thumbnail renderer
|
|
|
|
|
m_renderWait.acquire();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CommonThumbnail::~CommonThumbnail()
|
|
|
|
|
SharedThumbnail::~SharedThumbnail()
|
|
|
|
|
{
|
|
|
|
|
AzToolsFramework::Thumbnailer::ThumbnailerRendererNotificationBus::Handler::BusDisconnect();
|
|
|
|
|
AzFramework::AssetCatalogEventBus::Handler::BusDisconnect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommonThumbnail::ThumbnailRendered(const QPixmap& thumbnailImage)
|
|
|
|
|
void SharedThumbnail::ThumbnailRendered(const QPixmap& thumbnailImage)
|
|
|
|
|
{
|
|
|
|
|
m_pixmap = thumbnailImage;
|
|
|
|
|
m_renderWait.release();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommonThumbnail::ThumbnailFailedToRender()
|
|
|
|
|
void SharedThumbnail::ThumbnailFailedToRender()
|
|
|
|
|
{
|
|
|
|
|
m_state = State::Failed;
|
|
|
|
|
m_renderWait.release();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommonThumbnail::OnCatalogAssetChanged([[maybe_unused]] const AZ::Data::AssetId& assetId)
|
|
|
|
|
void SharedThumbnail::OnCatalogAssetChanged([[maybe_unused]] const AZ::Data::AssetId& assetId)
|
|
|
|
|
{
|
|
|
|
|
if (m_assetId == assetId && m_state == State::Ready)
|
|
|
|
|
{
|
|
|
|
|
@ -82,32 +79,31 @@ namespace AZ
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// CommonThumbnailCache
|
|
|
|
|
// SharedThumbnailCache
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
CommonThumbnailCache::CommonThumbnailCache()
|
|
|
|
|
: ThumbnailCache<CommonThumbnail>()
|
|
|
|
|
SharedThumbnailCache::SharedThumbnailCache()
|
|
|
|
|
: ThumbnailCache<SharedThumbnail>()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CommonThumbnailCache::~CommonThumbnailCache() = default;
|
|
|
|
|
SharedThumbnailCache::~SharedThumbnailCache() = default;
|
|
|
|
|
|
|
|
|
|
int CommonThumbnailCache::GetPriority() const
|
|
|
|
|
int SharedThumbnailCache::GetPriority() const
|
|
|
|
|
{
|
|
|
|
|
// Thumbnails override default source thumbnails, so carry higher priority
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char* CommonThumbnailCache::GetProviderName() const
|
|
|
|
|
const char* SharedThumbnailCache::GetProviderName() const
|
|
|
|
|
{
|
|
|
|
|
return ProviderName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CommonThumbnailCache::IsSupportedThumbnail(AzToolsFramework::Thumbnailer::SharedThumbnailKey key) const
|
|
|
|
|
bool SharedThumbnailCache::IsSupportedThumbnail(AzToolsFramework::Thumbnailer::SharedThumbnailKey key) const
|
|
|
|
|
{
|
|
|
|
|
return Thumbnails::IsSupportedThumbnail(key);
|
|
|
|
|
return SharedPreviewUtils::IsSupportedAssetType(key);
|
|
|
|
|
}
|
|
|
|
|
} // namespace Thumbnails
|
|
|
|
|
} // namespace LyIntegration
|
|
|
|
|
} // namespace AZ
|
|
|
|
|
|
|
|
|
|
#include <Previewer/moc_CommonThumbnail.cpp>
|
|
|
|
|
#include <SharedPreview/moc_SharedThumbnail.cpp>
|
|
|
|
|
|