|
| 1 | +// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. |
| 2 | + |
| 3 | +#include "TextAssetEditorPrivatePCH.h" |
| 4 | +#include "ContentBrowserModule.h" |
| 5 | + |
| 6 | + |
| 7 | +#define LOCTEXT_NAMESPACE "AssetTypeActions" |
| 8 | + |
| 9 | + |
| 10 | +/* FTextAssetActions constructors |
| 11 | + *****************************************************************************/ |
| 12 | + |
| 13 | +FTextAssetActions::FTextAssetActions(const TSharedRef<ISlateStyle>& InStyle) |
| 14 | + : Style(InStyle) |
| 15 | +{ } |
| 16 | + |
| 17 | + |
| 18 | +/* FAssetTypeActions_Base overrides |
| 19 | + *****************************************************************************/ |
| 20 | + |
| 21 | +bool FTextAssetActions::CanFilter() |
| 22 | +{ |
| 23 | + return true; |
| 24 | +} |
| 25 | + |
| 26 | + |
| 27 | +uint32 FTextAssetActions::GetCategories() |
| 28 | +{ |
| 29 | + return EAssetTypeCategories::Misc; |
| 30 | +} |
| 31 | + |
| 32 | + |
| 33 | +FText FTextAssetActions::GetName() const |
| 34 | +{ |
| 35 | + return NSLOCTEXT("AssetTypeActions", "AssetTypeActions_TextAsset", "Text Asset"); |
| 36 | +} |
| 37 | + |
| 38 | + |
| 39 | +UClass* FTextAssetActions::GetSupportedClass() const |
| 40 | +{ |
| 41 | + return UTextAsset::StaticClass(); |
| 42 | +} |
| 43 | + |
| 44 | + |
| 45 | +FColor FTextAssetActions::GetTypeColor() const |
| 46 | +{ |
| 47 | + return FColor::White; |
| 48 | +} |
| 49 | + |
| 50 | + |
| 51 | +bool FTextAssetActions::HasActions(const TArray<UObject*>& InObjects) const |
| 52 | +{ |
| 53 | + return false; |
| 54 | +} |
| 55 | + |
| 56 | + |
| 57 | +void FTextAssetActions::OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<class IToolkitHost> EditWithinLevelEditor) |
| 58 | +{ |
| 59 | + EToolkitMode::Type Mode = EditWithinLevelEditor.IsValid() |
| 60 | + ? EToolkitMode::WorldCentric |
| 61 | + : EToolkitMode::Standalone; |
| 62 | + |
| 63 | + for (auto ObjIt = InObjects.CreateConstIterator(); ObjIt; ++ObjIt) |
| 64 | + { |
| 65 | + auto TextAsset = Cast<UTextAsset>(*ObjIt); |
| 66 | + |
| 67 | + if (TextAsset != nullptr) |
| 68 | + { |
| 69 | + TSharedRef<FTextAssetEditorToolkit> EditorToolkit = MakeShareable(new FTextAssetEditorToolkit(Style)); |
| 70 | + EditorToolkit->Initialize(TextAsset, Mode, EditWithinLevelEditor); |
| 71 | + } |
| 72 | + } |
| 73 | +} |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | +#undef LOCTEXT_NAMESPACE |
0 commit comments