33 lines
1.1 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ThumbnailRendering/DefaultSizedThumbnailRenderer.h"
#include "BagConfigThumbnailRenderer.generated.h"
/**
*
*/
UCLASS()
class PROJECTFISHEDITOR_API UBagConfigThumbnailRenderer : public UDefaultSizedThumbnailRenderer
{
GENERATED_BODY()
public:
// UThumbnailRenderer interface
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 class with skills on canvas */
void DrawBag(class UBagConfigAsset* BagConfig, FCanvas* Canvas, int32 X, int32 Y, uint32 Width, uint32 Height);
/** Get the best fit scale for the bag class */
float GetBestFitScale(int32 BagWidth, int32 BagHeight, uint32 CanvasWidth, uint32 CanvasHeight) const;
/** Draw a skill at the specified position */
void DrawSkill(const struct FPlacedSkillInfo& PlacedSkill, FCanvas* Canvas, float StartX, float StartY, float Scale, float SeparatorWidth);
};