From 6a7553b6823451c8582cf31e07fab3123c9f6fbc Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 22 Nov 2021 16:44:20 -0800 Subject: [PATCH] Removes AssetBrowserProductThumbnail.cpp that is unused and duplicated by Code\Framework\AzToolsFramework\AzToolsFramework\AssetBrowser\Thumbnails\ProductThumbnail.cpp Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AssetBrowserProductThumbnail.cpp | 124 ------------------ 1 file changed, 124 deletions(-) delete mode 100644 Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Thumbnails/AssetBrowserProductThumbnail.cpp diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Thumbnails/AssetBrowserProductThumbnail.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Thumbnails/AssetBrowserProductThumbnail.cpp deleted file mode 100644 index 8f042d2648..0000000000 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Thumbnails/AssetBrowserProductThumbnail.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include -#include -#include - -namespace AzToolsFramework -{ - namespace AssetBrowser - { - ////////////////////////////////////////////////////////////////////////// - // ProductThumbnailKey - ////////////////////////////////////////////////////////////////////////// - ProductThumbnailKey::ProductThumbnailKey(const AZ::Data::AssetId& assetId) - : ThumbnailKey() - , m_assetId(assetId) - { - AZ::Data::AssetInfo info; - AZ::Data::AssetCatalogRequestBus::BroadcastResult(info, &AZ::Data::AssetCatalogRequests::GetAssetInfoById, m_assetId); - m_assetType = info.m_assetType; - } - - const AZ::Data::AssetId& ProductThumbnailKey::GetAssetId() const { return m_assetId; } - - const AZ::Data::AssetType& ProductThumbnailKey::GetAssetType() const { return m_assetType; } - - size_t ProductThumbnailKey::GetHash() const - { - return m_assetType.GetHash(); - } - - bool ProductThumbnailKey::Equals(const ThumbnailKey* other) const - { - if (!ThumbnailKey::Equals(other)) - { - return false; - } - // products displayed in Asset Browser have icons based on asset type, so multiple different products with same asset type will have same thumbnail - return m_assetId == azrtti_cast(other)->GetAssetId(); - } - - ////////////////////////////////////////////////////////////////////////// - // ProductThumbnail - ////////////////////////////////////////////////////////////////////////// - static const char* DEFAULT_PRODUCT_ICON_PATH = "Editor/Icons/AssetBrowser/DefaultProduct_16.svg"; - - ProductThumbnail::ProductThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize) - : Thumbnail(key, thumbnailSize) - {} - - void ProductThumbnail::LoadThread() - { - auto productKey = azrtti_cast(m_key.data()); - AZ_Assert(productKey, "Incorrect key type, excpected ProductThumbnailKey"); - - QString iconPath; - AZ::AssetTypeInfoBus::EventResult(iconPath, productKey->GetAssetType(), &AZ::AssetTypeInfo::GetBrowserIcon); - if (!iconPath.isEmpty()) - { - // is it an embedded resource or absolute path? - bool isUsablePath = (iconPath.startsWith(":") || (!AzFramework::StringFunc::Path::IsRelative(iconPath.toUtf8().constData()))); - - if (!isUsablePath) - { - // getting here means it needs resolution. Can we find the real path of the file? This also searches in gems for sources. - bool foundIt = false; - AZStd::string watchFolder; - AZ::Data::AssetInfo assetInfo; - AzToolsFramework::AssetSystemRequestBus::BroadcastResult(foundIt, &AzToolsFramework::AssetSystemRequestBus::Events::GetSourceInfoBySourcePath, iconPath.toUtf8().constData(), assetInfo, watchFolder); - - if (foundIt) - { - // the absolute path is join(watchfolder, relativepath); // since its relative to the watch folder. - AZStd::string finalPath; - AzFramework::StringFunc::Path::Join(watchFolder.c_str(), assetInfo.m_relativePath.c_str(), finalPath); - iconPath = QString::fromUtf8(finalPath.c_str()); - } - } - } - else - { - // no pixmap specified - use default. - iconPath = QString::fromUtf8(DEFAULT_PRODUCT_ICON_PATH); - } - - m_icon = QIcon(iconPath); - - if (m_icon.isNull()) - { - m_state = State::Failed; - } - } - - ////////////////////////////////////////////////////////////////////////// - // ProductThumbnailCache - ////////////////////////////////////////////////////////////////////////// - ProductThumbnailCache::ProductThumbnailCache() - : ThumbnailCache() {} - - ProductThumbnailCache::~ProductThumbnailCache() = default; - - const char* ProductThumbnailCache::GetProviderName() const - { - return ProviderName; - } - - bool ProductThumbnailCache::IsSupportedThumbnail(Thumbnailer::SharedThumbnailKey key) const - { - return azrtti_istypeof(key.data()); - } - - } // namespace AssetBrowser -} // namespace AzToolsFramework - -#include "AssetBrowser/Thumbnails/moc_AssetBrowserProductThumbnail.cpp"