63 lines
1.7 KiB
C++
63 lines
1.7 KiB
C++
// Project Lab - NHTV IGAD
|
|
//////////////////////////////////////////
|
|
// Author: Yoshi van Belkom - 130118
|
|
//////////////////////////////////////////
|
|
|
|
#include "SkillTreeEditorPrivatePCH.h"
|
|
#include "SkillAsset.h"
|
|
#include "AssetToolsModule.h"
|
|
#include "Classes/SkillObject.h"
|
|
#include "Classes/SkillTreeObject.h"
|
|
#include "SkillTreeEditorViewport.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "AssetTypeActions"
|
|
|
|
FSkillAsset::FSkillAsset( EAssetTypeCategories::Type a_assetCategory )
|
|
: m_assetCategory( a_assetCategory )
|
|
{
|
|
}
|
|
|
|
//Gets the name of the asset.
|
|
FText FSkillAsset::GetName() const
|
|
{
|
|
return LOCTEXT( "FSkillName", "Skill" );
|
|
}
|
|
|
|
//Gets the type color of the asset.
|
|
FColor FSkillAsset::GetTypeColor() const
|
|
{
|
|
return FColor::Cyan;
|
|
}
|
|
|
|
//Gets a pointer to the class this asset implements.
|
|
UClass* FSkillAsset::GetSupportedClass() const
|
|
{
|
|
return USkillObject::StaticClass();
|
|
}
|
|
|
|
//Gets the category of this asset.
|
|
uint32 FSkillAsset::GetCategories()
|
|
{
|
|
return m_assetCategory;
|
|
}
|
|
|
|
//Opens an editor with this asset.
|
|
void FSkillAsset::OpenAssetEditor( const TArray<UObject*>& a_objects, TSharedPtr<class IToolkitHost> a_editWithinLevelEditor )
|
|
{
|
|
const EToolkitMode::Type mode = a_editWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone;
|
|
|
|
for ( auto i = a_objects.CreateConstIterator(); i; ++i )
|
|
{
|
|
if ( USkillObject* skill = Cast<USkillObject>( *i ) )
|
|
{
|
|
USkillTreeObject* skillTree = skill->skillTree;
|
|
if( skillTree != NULL )
|
|
{
|
|
TSharedRef<FSkillTreeEditorViewport> newSkillTreeEditor( new FSkillTreeEditorViewport() );
|
|
newSkillTreeEditor->InitSkillTreeEditor( mode, a_editWithinLevelEditor, skillTree, skill );
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
#undef LOCTEXT_NAMESPACE |