// Copyright (c) Microsoft Corporation. 
// Licensed under the MIT license.

#pragma once

#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "UObject/Object.h"
#include "SimplygonUE4UI.h"
#include "Engine/SkeletalMesh.h"

#include "LODRecipeMiscSettings.generated.h"

USTRUCT(Blueprintable,BlueprintType)
struct LODRECIPE_API FMorphTargetsToRemove
{
	GENERATED_BODY();

	UPROPERTY()
	TSet<TSoftObjectPtr<UMorphTarget>> MorphTargets;
};

USTRUCT( Blueprintable, BlueprintType )
struct LODRECIPE_API FLODRecipeMiscSettings
{
	GENERATED_BODY();

	/* If true and morph targets exists, Morph targets are applied to LOD based on LOD 0 */
	UPROPERTY(EditAnywhere, Category = "Skeletal Mesh Settings")
	bool bApplyMorphTargets;

	/**/
	UPROPERTY(EditAnywhere, Category = "Skeletal Mesh Settings")
	TMap<TSoftObjectPtr<USkeletalMesh>, FMorphTargetsToRemove> MorphTargetsToRemove;

	/* If true and mesh data for LOD exists, LOD will keep current imported mesh data */
	UPROPERTY(EditAnywhere, Category = "General Settings")
	bool bUseImportedLOD;

	/* Chart aggregator settings to adjust how UVs should be packed when flattening unreal engine materials.*/
	UPROPERTY(EditAnywhere, Category = "Flatten Material Settings")
	FChartAggregatorSettings ChartAggregatorSettings;

	UPROPERTY( EditAnywhere, EditFixedSize, Category = "Billboard Cloud Settings" )
	TArray<bool> UVsToKeep;

	FLODRecipeMiscSettings()
		: bApplyMorphTargets(false)
		, bUseImportedLOD(false)
		, ChartAggregatorSettings()
	    , UVsToKeep( { true, true, true, true, true, true, true, true } )
	{
	}

public:
	const TSet<TSoftObjectPtr<UMorphTarget>>* GetMorphTargetsToRemove(USkeletalMesh* SkeletalMesh) const
	{
		if (MorphTargetsToRemove.Contains(SkeletalMesh))
			return &MorphTargetsToRemove[SkeletalMesh].MorphTargets;

		return nullptr;
	}

	
};
