Add image builder processing bus

This commit is contained in:
abrmich
2021-05-14 12:53:03 -07:00
parent 883786796d
commit d5122b2829
4 changed files with 145 additions and 1 deletions
@@ -13,8 +13,14 @@
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/Asset/AssetCommon.h>
#include <Atom/ImageProcessing/ImageObject.h>
namespace AssetBuilderSDK
{
struct JobProduct;
}
namespace ImageProcessingAtom
{
class ImageProcessingRequests
@@ -35,4 +41,39 @@ namespace ImageProcessingAtom
virtual IImageObjectPtr LoadImagePreview(const AZStd::string& filePath) = 0;
};
using ImageProcessingRequestBus = AZ::EBus<ImageProcessingRequests>;
class ImageBuilderRequests
: public AZ::EBusTraits
{
public:
//////////////////////////////////////////////////////////////////////////
// EBusTraits overrides
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
/////////////////////////////////////////////////////////////////////////
//! Create an image object
virtual IImageObjectPtr CreateImage(
AZ::u32 width,
AZ::u32 height,
AZ::u32 maxMipCount,
EPixelFormat pixelFormat) = 0;
//! Convert an image and save its products to the specified folder
virtual AZStd::vector<AssetBuilderSDK::JobProduct> ConvertImageObject(
IImageObjectPtr imageObject,
const AZStd::string& presetName,
const AZStd::string& platformName,
const AZStd::string& outputDir,
const AZ::Data::AssetId& sourceAssetId,
const AZStd::string& sourceAssetName) = 0;
//! Return whether the specified platform is supported by the image builder
virtual bool DoesSupportPlatform(const AZStd::string& platformId) = 0;
//! Return whether the specified preset requires an image to be square and a power of 2
virtual bool IsPresetFormatSquarePow2(const AZStd::string& presetName, const AZStd::string& platformName) = 0;
};
using ImageBuilderRequestBus = AZ::EBus<ImageBuilderRequests>;
} // namespace ImageProcessingAtom
@@ -13,10 +13,15 @@
#include <AzCore/EBus/EBus.h>
class QString;
namespace ImageProcessingAtom
{
class IImageObject;
}
namespace ImageProcessingAtomEditor
{
typedef AZStd::shared_ptr<ImageProcessingAtom::IImageObject> IImageObjectPtr;
class ImageProcessingEditorRequests
: public AZ::EBusTraits
{