Skip to content

Commit

Permalink
UE5 Support (#41)
Browse files Browse the repository at this point in the history
* Update README.md

Added info for UE 5

* Fixed missing articy toolbar buttons. They now live in the Settings menu.

* Removed note about broken UI from Readme

* Guarding UE5 changes with #if's

* Updating Readme so it applies to both UE4 and 5

* Fixing registration order

Co-authored-by: Peter Sabath <[email protected]>
  • Loading branch information
brwarner and peter-sabath authored Aug 19, 2021
1 parent 9e380fe commit 649fac7
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 38 deletions.
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
<img height="344" src="https://www.articy.com/articy-importer/unreal/ad_importer_large.png">
</p>

# ArticyImporter for Unreal Engine 4
# ArticyImporter for Unreal Engine

The Unreal Engine 4 importer allows integrating articy:draft content into Unreal projects and provides a simple C++ and blueprint interface to work with the data. We release this importer as a github open source project that will provide a substantial headstart into incorporating articy:draft data into Unreal projects while still allowing enough flexibility to adjust the importer to personal needs.
The Unreal Engine importer allows integrating articy:draft content into Unreal projects and provides a simple C++ and blueprint interface to work with the data. We release this importer as a github open source project that will provide a substantial headstart into incorporating articy:draft data into Unreal projects while still allowing enough flexibility to adjust the importer to personal needs.

While full support is not guaranteed for this product, we're constantly working on improvemets and would love to hear your suggestions. Feel free to forward us your ideas or even better directly [contribute](https://github.com/ArticySoftware/ArticyImporterForUnreal/blob/master/CONTRIBUTING.md) to the development of the importer.

## Unreal Engine 5 Early Access Support

This version of the plugin compiles for Unreal Engine 5 Early Access 2. Be warned however that UE5 support is not fully tested and you should proceed with caution.

# Table of contents

Expand Down Expand Up @@ -147,15 +150,19 @@ When exporting, chose your Unreal projects **Content** folder as the target for

After every export, going back to Unreal will trigger the ArticyImporter plugin to automatically parse the new file and show a prompt to import the changes. While this option is generally robust, there are certain cases in which more control over the import process is required.

Therefore the articy importer menu, which can be accessed via the level toolbar, enables you to import with more control.
For greater control over your imports, use the Articy Importer Menu. It can be accessed through the Articy Importer button on the Level Toolbar (UE4) or through the Settings menu (UE5).

<p align="center">
<img src="https://www.articy.com/articy-importer/unreal/articywindow.png">
</p>
**Unreal Engine 4**
![](https://www.articy.com/articy-importer/unreal/articywindow.png)

**Unreal Engine 5**
![](docs/ImporterButtonUE5.png)

### Importer Modes

- Full Reimport: This option will always regenerate code and compile it, and afterwards generate the articy assets
- Import Changes: This option will only regenerate code and compile it if necessary, but will always regenerate assets. This is generally faster than a full reimport and is the same as clicking on 'Import' on the prompt Unreal shows you when you've exported.
- Regenerate Assets: This option will only regenerate the articy assets based on the current import data asset and compiled code.
- **Full Reimport**: This option will always regenerate code and compile it, and afterwards generate the articy assets
- **Import Changes**: This option will only regenerate code and compile it if necessary, but will always regenerate assets. This is generally faster than a full reimport and is the same as clicking on 'Import' on the prompt Unreal shows you when you've exported.
- **Regenerate Assets**: This option will only regenerate the articy assets based on the current import data asset and compiled code.

# Using the API

Expand Down Expand Up @@ -284,7 +291,7 @@ store the branch in every button. When you instantiate the button you should pas
If you want to learn more about the flow player and its events you can read the [unity documentation](https://www.articy.com/articy-importer/unity/html/howto_flowplayer.htm) as both implementations are based on the same principles.

## Articy Global Variables Debugger
The Global Variables debugger can be accessed in the toolbar. It shows all global variables while the game is running and lets you search by namespace or variable namewhich makes it easy to follow what is happening inside the game and to debug problems in relation to global variables.
The Global Variables debugger can be accessed in the toolbar at the top of the level editor (UE4) or the Settings menu on the right hand side of the level editor (UE5). It shows all global variables while the game is running and lets you search by namespace or variable namewhich makes it easy to follow what is happening inside the game and to debug problems in relation to global variables.
Furthermore, you can also change the global variables while the game is running, and your game code that listens to variable changes is going to get triggered. This is useful to replicate specific conditions without needing to go through all steps manually.
For example, if your global variables control your quest states, checking a "quest accepted" global variable in the debugger will make your quest system initiate a quest.

Expand Down
5 changes: 4 additions & 1 deletion Source/ArticyEditor/ArticyEditor.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public ArticyEditor(ReadOnlyTargetRules Target) : base(Target)
"EditorWidgets",
"SourceControl",
"GraphEditor",
"ApplicationCore"
"ApplicationCore",
#if UE_5_0_OR_LATER
"ToolMenus",
#endif
}
);

Expand Down
71 changes: 45 additions & 26 deletions Source/ArticyEditor/Private/ArticyEditorModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,22 @@
#include "HAL/FileManager.h"
#include "Widgets/Images/SImage.h"
#include "IDirectoryWatcher.h"
#include "Framework/MultiBox/MultiBoxBuilder.h"
#include "LevelEditor.h"
#include "Customizations/ArticyPinFactory.h"
#include "Customizations/AssetActions/AssetTypeActions_ArticyGV.h"
#include "Customizations/Details/ArticyGVCustomization.h"
#include "Customizations/Details/ArticyPluginSettingsCustomization.h"
#include "Customizations/Details/ArticyIdCustomization.h"
#include "Customizations/Details/ArticyRefCustomization.h"

#if ENGINE_MAJOR_VERSION >= 5
// In UE5, you use the ToolMenus API to extend the UI
#include "ToolMenus.h"
#else
// Otherwise, we have to jack into the level editor module and build a new button in
#include "LevelEditor.h"
#include "Framework/MultiBox/MultiBoxBuilder.h"
#endif

DEFINE_LOG_CATEGORY(LogArticyEditor)

#define LOCTEXT_NAMESPACE "FArticyImporterModule"
Expand All @@ -42,14 +49,14 @@ void FArticyEditorModule::StartupModule()
{
CustomizationManager = MakeShareable(new FArticyEditorCustomizationManager);

RegisterArticyToolbar();
RegisterAssetTypeActions();
RegisterConsoleCommands();
RegisterDefaultArticyIdPropertyWidgetExtensions();
RegisterDetailCustomizations();
RegisterGraphPinFactory();
RegisterPluginSettings();
RegisterPluginCommands();
RegisterArticyToolbar();
// directory watcher has to be changed or removed as the results aren't quite deterministic
//RegisterDirectoryWatcher();
RegisterToolTabs();
Expand Down Expand Up @@ -130,18 +137,48 @@ TArray<UArticyPackage*> FArticyEditorModule::GetPackagesSlow()

void FArticyEditorModule::RegisterArticyToolbar()
{
FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
{/*
TSharedPtr<FExtender> MenuExtender = MakeShareable(new FExtender());
MenuExtender->AddMenuExtension("WindowLayout", EExtensionHook::After, PluginCommands, FMenuExtensionDelegate::CreateRaw(this, &FStyleCheckerModule::AddMenuExtension));
LevelEditorModule.GetMenuExtensibilityManager()->AddExtender(MenuExtender);*/
#if ENGINE_MAJOR_VERSION >= 5
// Grab the appropriate toolbar menu so we can extend it
UToolMenu* Menu = UToolMenus::Get()->ExtendMenu("LevelEditor.LevelEditorToolBar.LevelToolbarQuickSettings");

{
// Create a new section for Articy utilities
FToolMenuSection& Section = Menu->AddSection("ArticyUtilities", LOCTEXT("ArticyUtilities", "Articy Utilities"));

// Add buttons
Section.AddMenuEntryWithCommandList(FArticyEditorCommands::Get().OpenArticyImporter, PluginCommands);
Section.AddMenuEntryWithCommandList(FArticyEditorCommands::Get().OpenArticyGVDebugger, PluginCommands);
}
#else
FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
{
TSharedPtr<FExtender> ToolbarExtender = MakeShareable(new FExtender);
ToolbarExtender->AddToolBarExtension("Settings", EExtensionHook::After, PluginCommands, FToolBarExtensionDelegate::CreateRaw(this, &FArticyEditorModule::AddToolbarExtension));
LevelEditorModule.GetToolBarExtensibilityManager()->AddExtender(ToolbarExtender);
}
#endif
}

// Old toolbar code for UE4
#if ENGINE_MAJOR_VERSION == 4
void FArticyEditorModule::AddToolbarExtension(FToolBarBuilder& Builder)
{
Builder.AddComboButton(FUIAction(), FOnGetContent::CreateRaw(this, &FArticyEditorModule::OnGenerateArticyToolsMenu), FText::FromString(TEXT("Articy Tools")), TAttribute<FText>(), FSlateIcon(FArticyEditorStyle::GetStyleSetName(), "ArticyImporter.ArticyImporter.40"));
//Builder.AddToolBarButton(FArticyEditorCommands::Get().OpenPluginWindow, NAME_None, TAttribute<FText>(), TAttribute<FText>(), FSlateIcon(FArticyEditorStyle::GetStyleSetName(), "ArticyImporter.ArticyImporter.40") );
}

TSharedRef<SWidget> FArticyEditorModule::OnGenerateArticyToolsMenu() const
{
FMenuBuilder MenuBuilder(true, PluginCommands);

MenuBuilder.BeginSection("ArticyTools", LOCTEXT("ArticyTools", "Articy Tools"));
MenuBuilder.AddMenuEntry(FArticyEditorCommands::Get().OpenArticyImporter);
MenuBuilder.AddMenuEntry(FArticyEditorCommands::Get().OpenArticyGVDebugger);
MenuBuilder.EndSection();

return MenuBuilder.MakeWidget();
}
#endif

void FArticyEditorModule::RegisterAssetTypeActions()
{
Expand Down Expand Up @@ -315,24 +352,6 @@ void FArticyEditorModule::TriggerQueuedImport(bool b)
UnqueueImport();
}

void FArticyEditorModule::AddToolbarExtension(FToolBarBuilder& Builder)
{
Builder.AddComboButton(FUIAction(), FOnGetContent::CreateRaw(this, &FArticyEditorModule::OnGenerateArticyToolsMenu), FText::FromString(TEXT("Articy Tools")), TAttribute<FText>(), FSlateIcon(FArticyEditorStyle::GetStyleSetName(), "ArticyImporter.ArticyImporter.40") );
//Builder.AddToolBarButton(FArticyEditorCommands::Get().OpenPluginWindow, NAME_None, TAttribute<FText>(), TAttribute<FText>(), FSlateIcon(FArticyEditorStyle::GetStyleSetName(), "ArticyImporter.ArticyImporter.40") );
}

TSharedRef<SWidget> FArticyEditorModule::OnGenerateArticyToolsMenu() const
{
FMenuBuilder MenuBuilder(true, PluginCommands);

MenuBuilder.BeginSection("ArticyTools", LOCTEXT("ArticyTools", "Articy Tools"));
MenuBuilder.AddMenuEntry(FArticyEditorCommands::Get().OpenArticyImporter);
MenuBuilder.AddMenuEntry(FArticyEditorCommands::Get().OpenArticyGVDebugger);
MenuBuilder.EndSection();

return MenuBuilder.MakeWidget();
}

TSharedRef<SDockTab> FArticyEditorModule::OnSpawnArticyMenuTab(const FSpawnTabArgs& SpawnTabArgs) const
{
float ButtonWidth = 333.f / 1.3f;
Expand Down
6 changes: 5 additions & 1 deletion Source/ArticyEditor/Public/ArticyEditorModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@ class FArticyEditorModule : public IModuleInterface

void UnqueueImport();
void TriggerQueuedImport(bool b);


// Old tool UI hook callbacks required for UE4
#if ENGINE_MAJOR_VERSION == 4
void AddToolbarExtension(FToolBarBuilder& Builder);
TSharedRef<SWidget> OnGenerateArticyToolsMenu() const;
#endif

TSharedRef<class SDockTab> OnSpawnArticyMenuTab(const class FSpawnTabArgs& SpawnTabArgs) const;
TSharedRef<class SDockTab> OnSpawnArticyGVDebuggerTab(const class FSpawnTabArgs& SpawnTabArgs) const;

Expand Down
Binary file added docs/ImporterButtonUE5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 649fac7

Please sign in to comment.