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

#include "LODRecipeAssetActions.h"
#include "LODRecipe.h"
#include "LODRecipeEditor.h"

//////////////////////////////////////////////////////////////////////////
// FLODSettingsActions

FLODRecipeAssetActions::FLODRecipeAssetActions(EAssetTypeCategories::Type InAssetCategory)
	:AssetCategory(InAssetCategory)
{

}

bool FLODRecipeAssetActions::CanFilter()
{
	return true;
}

uint32 FLODRecipeAssetActions::GetCategories()
{
	return AssetCategory;
}

FText FLODRecipeAssetActions::GetName() const
{
	return NSLOCTEXT("LODRecipe", "LODRecipeActions_LODRecipe", "LOD Recipe");
}

UClass* FLODRecipeAssetActions::GetSupportedClass() const
{
	return ULODRecipe::StaticClass();
}

FColor FLODRecipeAssetActions::GetTypeColor() const
{
	return FColor::Yellow;
}

void FLODRecipeAssetActions::OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<IToolkitHost> EditWithinLevelEditor)
{
	const EToolkitMode::Type Mode = EditWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone;

	for (auto ObjIt = InObjects.CreateConstIterator(); ObjIt; ++ObjIt)
	{
		if (ULODRecipe* LODRecipe = Cast<ULODRecipe>(*ObjIt))
		{
			TSharedRef<FLODRecipeEditor> LODRecipeEditor(new FLODRecipeEditor());
			LODRecipeEditor->InitLODRecipeEditor(Mode, EditWithinLevelEditor, LODRecipe);
		}
	}
}
