27 lines
927 B
C
Raw Permalink Normal View History

2025-08-30 19:55:46 +08:00
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ThumbnailRendering/DefaultSizedThumbnailRenderer.h"
2025-10-15 18:25:31 +08:00
#include "ShapeAssetThumbnailRenderer.generated.h"
2025-08-30 19:55:46 +08:00
/**
*
*/
UCLASS()
2025-10-15 18:25:31 +08:00
class PROJECTFISHEDITOR_API UShapeAssetThumbnailRenderer : public UDefaultSizedThumbnailRenderer
2025-08-30 19:55:46 +08:00
{
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 */
2025-10-15 18:25:31 +08:00
void DrawBagShape(class UShapeAsset* BagShapeAsset, FCanvas* Canvas, int32 X, int32 Y, uint32 Width, uint32 Height);
2025-08-30 19:55:46 +08:00
/** Get the best fit scale for the bag shape */
float GetBestFitScale(int32 BagWidth, int32 BagHeight, uint32 CanvasWidth, uint32 CanvasHeight) const;
};