27 lines
936 B
C++
27 lines
936 B
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "ThumbnailRendering/DefaultSizedThumbnailRenderer.h"
|
|
#include "BagShapeAssetThumbnailRenderer.generated.h"
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UCLASS()
|
|
class PROJECTFISHEDITOR_API UBagShapeAssetThumbnailRenderer : public UDefaultSizedThumbnailRenderer
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
virtual bool CanVisualizeAsset(UObject* Object) override;
|
|
virtual void Draw(UObject* Object, int32 X, int32 Y, uint32 Width, uint32 Height, FRenderTarget* RenderTarget, FCanvas* Canvas, bool bAdditionalViewFamily) override;
|
|
|
|
private:
|
|
/** Draw the bag shape on canvas */
|
|
void DrawBagShape(class UBagShapeAsset* BagShapeAsset, FCanvas* Canvas, int32 X, int32 Y, uint32 Width, uint32 Height);
|
|
|
|
/** Get the best fit scale for the bag shape */
|
|
float GetBestFitScale(int32 BagWidth, int32 BagHeight, uint32 CanvasWidth, uint32 CanvasHeight) const;
|
|
};
|