Move ThumbnailerNullComponent into AzToolsFramework so that it can be used by other tools that need it.
SerializeContextTools will soon rely on this.
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.h>
|
||||
#include <AzToolsFramework/UI/EditorEntityUi/EditorEntityUiSystemComponent.h>
|
||||
#include <AzToolsFramework/Thumbnails/ThumbnailerComponent.h>
|
||||
#include <AzToolsFramework/Thumbnails/ThumbnailerNullComponent.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserComponent.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.h>
|
||||
|
||||
@@ -91,6 +92,7 @@ namespace AzToolsFramework
|
||||
AzToolsFramework::AssetBundleComponent::CreateDescriptor(),
|
||||
AzToolsFramework::SliceDependencyBrowserComponent::CreateDescriptor(),
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerComponent::CreateDescriptor(),
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerNullComponent::CreateDescriptor(),
|
||||
AzToolsFramework::AssetBrowser::AssetBrowserComponent::CreateDescriptor(),
|
||||
AzToolsFramework::EditorInteractionSystemComponent::CreateDescriptor(),
|
||||
AzToolsFramework::Components::EditorComponentAPIComponent::CreateDescriptor(),
|
||||
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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 <AzCore/std/smart_ptr/make_shared.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzToolsFramework/Thumbnails/ThumbnailerNullComponent.h>
|
||||
#include <AzToolsFramework/Thumbnails/ThumbnailContext.h>
|
||||
#include <AzToolsFramework/Thumbnails/MissingThumbnail.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
ThumbnailerNullComponent::ThumbnailerNullComponent() :
|
||||
m_nullThumbnail()
|
||||
{
|
||||
}
|
||||
|
||||
ThumbnailerNullComponent::~ThumbnailerNullComponent() = default;
|
||||
|
||||
void ThumbnailerNullComponent::Activate()
|
||||
{
|
||||
BusConnect();
|
||||
}
|
||||
|
||||
void ThumbnailerNullComponent::Deactivate()
|
||||
{
|
||||
BusDisconnect();
|
||||
}
|
||||
|
||||
void ThumbnailerNullComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<ThumbnailerNullComponent, AZ::Component>();
|
||||
}
|
||||
}
|
||||
|
||||
void ThumbnailerNullComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
{
|
||||
services.push_back(AZ_CRC("ThumbnailerService", 0x65422b97));
|
||||
}
|
||||
|
||||
void ThumbnailerNullComponent::RegisterContext(const char* /*contextName*/)
|
||||
{
|
||||
}
|
||||
|
||||
void ThumbnailerNullComponent::UnregisterContext(const char* /*contextName*/)
|
||||
{
|
||||
}
|
||||
|
||||
bool ThumbnailerNullComponent::HasContext(const char* /*contextName*/) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void ThumbnailerNullComponent::RegisterThumbnailProvider(AzToolsFramework::Thumbnailer::SharedThumbnailProvider /*provider*/, const char* /*contextName*/)
|
||||
{
|
||||
}
|
||||
|
||||
void ThumbnailerNullComponent::UnregisterThumbnailProvider(const char* /*providerName*/, const char* /*contextName*/)
|
||||
{
|
||||
}
|
||||
|
||||
AzToolsFramework::Thumbnailer::SharedThumbnail ThumbnailerNullComponent::GetThumbnail(AzToolsFramework::Thumbnailer::SharedThumbnailKey /*key*/, const char* /*contextName*/)
|
||||
{
|
||||
return m_nullThumbnail;
|
||||
}
|
||||
|
||||
bool ThumbnailerNullComponent::IsLoading(AzToolsFramework::Thumbnailer::SharedThumbnailKey /*thumbnailKey*/, const char* /*contextName*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} // namespace Thumbnailer
|
||||
} // namespace AzToolsFramework
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/Component.h>
|
||||
#include <AzToolsFramework/Thumbnails/ThumbnailerBus.h>
|
||||
|
||||
// ThumbnailerNullComponent is an alternative to ThumbnailerComponent that can be used by tools that don't use Qt.
|
||||
// It doesn't do anything (hence "null"), but it allows the system and editor components that rely on the ThumbnailService
|
||||
// to start up and function.
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
class ThumbnailContext;
|
||||
|
||||
class ThumbnailerNullComponent
|
||||
: public AZ::Component
|
||||
, public AzToolsFramework::Thumbnailer::ThumbnailerRequestsBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(ThumbnailerNullComponent, "{8009D651-3FAA-9815-B99E-AF174A3B29D4}")
|
||||
|
||||
ThumbnailerNullComponent();
|
||||
virtual ~ThumbnailerNullComponent();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AZ::Component
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ThumbnailerRequests
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void RegisterContext(const char* contextName) override;
|
||||
void UnregisterContext(const char* contextName) override;
|
||||
bool HasContext(const char* contextName) const override;
|
||||
void RegisterThumbnailProvider(AzToolsFramework::Thumbnailer::SharedThumbnailProvider provider, const char* contextName) override;
|
||||
void UnregisterThumbnailProvider(const char* providerName, const char* contextName) override;
|
||||
AzToolsFramework::Thumbnailer::SharedThumbnail GetThumbnail(AzToolsFramework::Thumbnailer::SharedThumbnailKey thumbnailKey, const char* contextName) override;
|
||||
bool IsLoading(AzToolsFramework::Thumbnailer::SharedThumbnailKey thumbnailKey, const char* contextName) override;
|
||||
private:
|
||||
AzToolsFramework::Thumbnailer::SharedThumbnail m_nullThumbnail;
|
||||
};
|
||||
} // Thumbnailer
|
||||
} // namespace AzToolsFramework
|
||||
@@ -72,6 +72,8 @@ set(FILES
|
||||
AssetCatalog/PlatformAddressedAssetCatalogManager.cpp
|
||||
Thumbnails/ThumbnailerComponent.cpp
|
||||
Thumbnails/ThumbnailerComponent.h
|
||||
Thumbnails/ThumbnailerNullComponent.cpp
|
||||
Thumbnails/ThumbnailerNullComponent.h
|
||||
Thumbnails/LoadingThumbnail.cpp
|
||||
Thumbnails/LoadingThumbnail.h
|
||||
Thumbnails/MissingThumbnail.cpp
|
||||
|
||||
Reference in New Issue
Block a user