Skip to content

Commit 1be9681

Browse files
committed
Initial revision.
1 parent 54879c7 commit 1be9681

23 files changed

+1027
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Binaries/
2+
Intermediate/

README.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,51 @@
11
# TextAsset
2-
Plugin to demonstrate how to create new content asset types.
2+
3+
Unreal Engine 4 plug-in that adds a text asset and editor for personal notes.
4+
5+
6+
## About
7+
8+
TODO
9+
10+
11+
## Supported Platforms
12+
13+
This plug-in was last built against **Unreal Engine 4.10**. It works on all
14+
platforms.
15+
16+
17+
## Dependencies
18+
19+
This plug-in requires Visual Studio and either a C++ code project or a the full
20+
Unreal Engine 4 source code from GitHub. If you are new to programming in UE4,
21+
please see the official [Programming Guide](https://docs.unrealengine.com/latest/INT/Programming/index.html)!
22+
23+
24+
## Usage
25+
26+
You can use this plug-in as a project plug-in, or an Engine plug-in.
27+
28+
If you use it as a project plug-in, clone this repository into your project's
29+
*/Plugins* directory and compile your game in Visual Studio. A C++ code project
30+
is required for this to work.
31+
32+
If you use it as an Engine plug-in, clone this repository into the
33+
*/Engine/Plugins/Media* directory and compile your game. Full Unreal Engine 4
34+
source code from GitHub (4.9 or higher) is required for this.
35+
36+
After compiling the plug-in, you have to **enable it** in Unreal Editor's
37+
plug-in browser.
38+
39+
TODO
40+
41+
42+
## Support
43+
44+
Please [file an issue](https://github.com/ue4plugins/TextAsset/issues),
45+
submit a [pull request](https://github.com/ue4plugins/TextAsset/pulls?q=is%3Aopen+is%3Apr)
46+
or email us at [email protected]
47+
48+
49+
## References
50+
51+
* [Introduction to UE4 Plugins](https://wiki.unrealengine.com/An_Introduction_to_UE4_Plugins)

Resources/Icon128.png

8.51 KB
Loading
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2+
3+
#include "TextAssetPrivatePCH.h"
4+
5+
6+
/* UTextAsset interface
7+
*****************************************************************************/
8+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2+
3+
#include "TextAssetPrivatePCH.h"
4+
#include "ModuleInterface.h"
5+
6+
7+
/**
8+
* Implements the TextAsset module.
9+
*/
10+
class FTextAssetModule
11+
: public IModuleInterface
12+
{
13+
public:
14+
15+
// IModuleInterface interface
16+
17+
virtual void StartupModule() override { }
18+
virtual void ShutdownModule() override { }
19+
20+
virtual bool SupportsDynamicReloading() override
21+
{
22+
return true;
23+
}
24+
};
25+
26+
27+
IMPLEMENT_MODULE(FTextAssetModule, TextAsset);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2+
3+
#pragma once
4+
5+
6+
/* Private dependencies
7+
*****************************************************************************/
8+
9+
#include "Core.h"
10+
#include "CoreUObject.h"
11+
12+
13+
/* Private includes
14+
*****************************************************************************/
15+
16+
#include "TextAsset.h"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2+
3+
#pragma once
4+
5+
#include "TextAsset.generated.h"
6+
7+
8+
/**
9+
* Implements an asset that can be used to store arbitrary text, such as notes
10+
* or documentation.
11+
*/
12+
UCLASS(BlueprintType, hidecategories=(Object))
13+
class TEXTASSET_API UTextAsset
14+
: public UObject
15+
{
16+
GENERATED_BODY()
17+
18+
public:
19+
20+
/** Holds the stored text. */
21+
UPROPERTY()
22+
FText Text;
23+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2+
3+
namespace UnrealBuildTool.Rules
4+
{
5+
public class TextAsset : ModuleRules
6+
{
7+
public TextAsset(TargetInfo Target)
8+
{
9+
PublicDependencyModuleNames.AddRange(
10+
new string[] {
11+
"Core",
12+
"CoreUObject",
13+
}
14+
);
15+
16+
PrivateIncludePaths.AddRange(
17+
new string[] {
18+
"Runtime/TextAsset/Private",
19+
}
20+
);
21+
}
22+
}
23+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2+
3+
#pragma once
4+
5+
#include "AssetTypeActions_Base.h"
6+
7+
8+
/**
9+
* Implements an action for UTextAsset assets.
10+
*/
11+
class FTextAssetActions
12+
: public FAssetTypeActions_Base
13+
{
14+
public:
15+
16+
/**
17+
* Creates and initializes a new instance.
18+
*
19+
* @param InStyle The style set to use for asset editor toolkits.
20+
*/
21+
FTextAssetActions(const TSharedRef<ISlateStyle>& InStyle);
22+
23+
public:
24+
25+
// FAssetTypeActions_Base overrides
26+
27+
virtual bool CanFilter() override;
28+
virtual uint32 GetCategories() override;
29+
virtual FText GetName() const override;
30+
virtual UClass* GetSupportedClass() const override;
31+
virtual FColor GetTypeColor() const override;
32+
virtual bool HasActions( const TArray<UObject*>& InObjects ) const override;
33+
virtual void OpenAssetEditor( const TArray<UObject*>& InObjects, TSharedPtr<class IToolkitHost> EditWithinLevelEditor = TSharedPtr<IToolkitHost>() ) override;
34+
35+
private:
36+
37+
/** Pointer to the style set to use for toolkits. */
38+
TSharedRef<ISlateStyle> Style;
39+
};

0 commit comments

Comments
 (0)