2c6cfdd7dc
Changed thumbnailer bus to use const pixmap Changed capture request call back to use const pixmap instead of image Replaced scene and pipeline members with constructor parameters Added material preview renderer to editor material system component with new requests and notifications Changed material property inspector details group to persistent heading so the preview image widget would not get destroyed during refreshes. But this was also a backlog task. Changed common preview render camera to use lookat Moved default asset caching to thumbnail renderer Signed-off-by: Guthrie Adams <guthadam@amazon.com>
71 lines
2.3 KiB
C++
71 lines
2.3 KiB
C++
/*
|
|
* 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
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#if !defined(Q_MOC_RUN)
|
|
#include <AzCore/std/containers/unordered_set.h>
|
|
#include <AzCore/std/parallel/binary_semaphore.h>
|
|
#include <AzFramework/Asset/AssetCatalogBus.h>
|
|
#include <AzToolsFramework/Thumbnails/Thumbnail.h>
|
|
#include <AzToolsFramework/Thumbnails/ThumbnailerBus.h>
|
|
#endif
|
|
|
|
namespace ImageProcessingAtom
|
|
{
|
|
namespace Thumbnails
|
|
{
|
|
/**
|
|
* Custom image thumbnail that detects when an asset changes and updates the thumbnail
|
|
*/
|
|
class ImageThumbnail
|
|
: public AzToolsFramework::Thumbnailer::Thumbnail
|
|
, public AzToolsFramework::Thumbnailer::ThumbnailerRendererNotificationBus::Handler
|
|
, public AzFramework::AssetCatalogEventBus::Handler
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
ImageThumbnail(AzToolsFramework::Thumbnailer::SharedThumbnailKey key);
|
|
~ImageThumbnail() override;
|
|
|
|
//! AzToolsFramework::ThumbnailerRendererNotificationBus::Handler overrides...
|
|
void ThumbnailRendered(const QPixmap& thumbnailImage) override;
|
|
void ThumbnailFailedToRender() override;
|
|
|
|
protected:
|
|
void LoadThread() override;
|
|
|
|
private:
|
|
// AzFramework::AssetCatalogEventBus::Handler interface overrides...
|
|
void OnCatalogAssetChanged(const AZ::Data::AssetId& assetId) override;
|
|
|
|
AZStd::binary_semaphore m_renderWait;
|
|
AZStd::unordered_set<AZ::Data::AssetId> m_assetIds;
|
|
};
|
|
|
|
/**
|
|
* Cache configuration for large image thumbnails
|
|
*/
|
|
class ImageThumbnailCache
|
|
: public AzToolsFramework::Thumbnailer::ThumbnailCache<ImageThumbnail>
|
|
{
|
|
public:
|
|
ImageThumbnailCache();
|
|
~ImageThumbnailCache() override;
|
|
|
|
int GetPriority() const override;
|
|
const char* GetProviderName() const override;
|
|
|
|
static constexpr const char* ProviderName = "Image Thumbnails";
|
|
|
|
protected:
|
|
bool IsSupportedThumbnail(AzToolsFramework::Thumbnailer::SharedThumbnailKey key) const override;
|
|
};
|
|
} // namespace Thumbnails
|
|
} // namespace ImageProcessingAtom
|