From 58a7670908611cff875cae51ff77e8e0b0a84454 Mon Sep 17 00:00:00 2001 From: nutti Date: Thu, 2 May 2024 22:22:02 +0900 Subject: [PATCH 1/2] Support Unreal Engine 5.4 --- .circleci/config.yml | 1 + .github/workflows/release.yaml | 2 +- README.md | 2 +- ShortcutAsset/ShortcutAsset.uplugin | 2 +- .../Private/ShortcutAssetActions.cpp | 2 +- .../Private/ShortcutAssetEditorToolkit.cpp | 18 +++++++++++++++--- .../Private/ShortcutAssetUtils.cpp | 8 +++++++- tools/remove_code.sh | 2 +- tools/replace_engine_version.sh | 4 ++-- 9 files changed, 30 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a8671a1..1763b2e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,7 @@ workflows: - unreal-engine-ci matrix: parameters: + # TODO: The container image is not supported for 5.4.0. unreal-engine-version: ["4.27.0", "5.0.0", "5.1.0", "5.2.0", "5.3.0"] version: ["free", "full"] - build-sample: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e487680..69335d2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: unreal_engine_version: - ["4.26.0", "4.27.0", "5.0.0", "5.1.0", "5.2.0", "5.3.0"] + ["4.26.0", "4.27.0", "5.0.0", "5.1.0", "5.2.0", "5.3.0", "5.4.0"] version: ["free", "full"] steps: diff --git a/README.md b/README.md index aa3769d..ec19bb2 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ The **Shortcut** asset supports the following features. This plugin supports on the below environment. -* Unreal Engine Version: 4.27 / 5.0 / 5.1 / 5.2 / 5.3 +* Unreal Engine Version: 4.27 / 5.0 / 5.1 / 5.2 / 5.3 / 5.4 * Development Platforms: Windows / macOS / Linux * Target Build Platforms: All platform diff --git a/ShortcutAsset/ShortcutAsset.uplugin b/ShortcutAsset/ShortcutAsset.uplugin index 9f27e82..8fb42d8 100644 --- a/ShortcutAsset/ShortcutAsset.uplugin +++ b/ShortcutAsset/ShortcutAsset.uplugin @@ -4,7 +4,7 @@ "VersionName": "1.2.0", "FriendlyName": "Shortcut Asset", "Description": "Asset to open the linked asset/directory", - "EngineVersion": "5.3.0", + "EngineVersion": "5.4.0", "Category": "Other", "CreatedBy": "nutti (Colory Games)", "CreatedByURL": "https://github.com/colory-games/UEPlugin-ShortcutAssets", diff --git a/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetActions.cpp b/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetActions.cpp index 84cf005..592e25c 100644 --- a/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetActions.cpp +++ b/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetActions.cpp @@ -151,7 +151,7 @@ void FShortcutAssetActions::OpenAssetEditor(const TArray& InObjects, T TEXT("The link stored in '{0}' is missing.\nDo you want to edit the link?"), {ShortcutAsset->GetName()}); FText TitleText = LOCTEXT("Title", "Missing Link Error"); FText MessageText = FText::AsCultureInvariant(Message); - if (FMessageDialog::Open(EAppMsgType::OkCancel, MessageText, &TitleText) == EAppReturnType::Ok) + if (FMessageDialog::Open(EAppMsgType::OkCancel, MessageText, TitleText) == EAppReturnType::Ok) { UShortcutAssetSubsystem* Subsystem = GEditor->GetEditorSubsystem(); Subsystem->OpenShortcutAssetEditor({ShortcutAsset}); diff --git a/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetEditorToolkit.cpp b/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetEditorToolkit.cpp index 09dfd10..99cfa81 100644 --- a/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetEditorToolkit.cpp +++ b/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetEditorToolkit.cpp @@ -64,9 +64,15 @@ FShortcutAssetEditorToolkit::~FShortcutAssetEditorToolkit() UShortcutAssetSubsystem* Subsystem = GEditor->GetEditorSubsystem(); if (Subsystem) { - TArray ObjectsToEdit; + TArray ObjectsToEdit; OwningAssetEditor->GetObjectsToEdit(ObjectsToEdit); - Subsystem->NotifyShortcutAssetEditorClosed(ObjectsToEdit); + + TArray ObjectsToEditWithObjectPtr; + for (auto& O : ObjectsToEdit) + { + ObjectsToEditWithObjectPtr.Add(O); + } + Subsystem->NotifyShortcutAssetEditorClosed(ObjectsToEditWithObjectPtr); } } @@ -105,7 +111,13 @@ void FShortcutAssetEditorToolkit::RegisterTabSpawners(const TSharedRefRegisterTabSpawner(TabID, FOnSpawnTab::CreateSP(this, &FShortcutAssetEditorToolkit::HandleTabManagerSpawnTab, TabID)) .SetDisplayName(LOCTEXT("ShortcutEditorTabName", "Shortcut Editor")) .SetGroup(WorkspaceMenuCategory.ToSharedRef()) - .SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Viewports")); + .SetIcon(FSlateIcon( +#if UE_VERSION_NEWER_THAN(5, 1, 0) + FAppStyle::GetAppStyleSetName(), "LevelEditor.Tabs.Viewports") +#else + FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Viewports") +#endif + ); // clang-format on } diff --git a/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetUtils.cpp b/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetUtils.cpp index d8a531b..8b536f4 100644 --- a/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetUtils.cpp +++ b/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetUtils.cpp @@ -10,7 +10,9 @@ #include "ShortcutAssetUtils.h" #include "AssetRegistry/AssetRegistryModule.h" +#include "Misc/EngineVersionComparison.h" #include "Misc/MessageDialog.h" +#include "ShortcutAsset.h" #define LOCTEXT_NAMESPACE "ShortcutAsset" @@ -25,7 +27,11 @@ bool ReachFreeVersionLimitation(bool bIsCreateNew) FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); FARFilter Filter; TArray AssetData; +#if UE_VERSION_NEWER_THAN(5, 1, 0) + Filter.ClassPaths.Add(UShortcutAsset::StaticClass()->GetClassPathName()); +#else Filter.ClassNames.Add(UShortcutAsset::StaticClass()->GetFName()); +#endif AssetRegistryModule.Get().GetAssets(Filter, AssetData); if (AssetData.Num() >= MaxAssets) @@ -33,7 +39,7 @@ bool ReachFreeVersionLimitation(bool bIsCreateNew) FText TitleText = LOCTEXT("Title", "Reached Free Version Limitation"); FText MessageText = LOCTEXT("Message", "Free version can only create up to 3 assets.\nDo you want to open the marketplace of this plugin?"); - if (FMessageDialog::Open(EAppMsgType::OkCancel, MessageText, &TitleText) == EAppReturnType::Ok) + if (FMessageDialog::Open(EAppMsgType::OkCancel, MessageText, TitleText) == EAppReturnType::Ok) { FPlatformProcess::LaunchURL( TEXT("https://forums.unrealengine.com/t/how-to-open-a-browser-from-the-game/24346/3"), NULL, NULL); diff --git a/tools/remove_code.sh b/tools/remove_code.sh index 741b058..033e3f4 100644 --- a/tools/remove_code.sh +++ b/tools/remove_code.sh @@ -6,7 +6,7 @@ set -eEu SUPPORTED_VERSIONS=( "4.26.0" "4.27.0" - "5.0.0" "5.1.0" "5.2.0" "5.3.0" + "5.0.0" "5.1.0" "5.2.0" "5.3.0" "5.4.0" ) function usage() { diff --git a/tools/replace_engine_version.sh b/tools/replace_engine_version.sh index 892b6d3..d900191 100644 --- a/tools/replace_engine_version.sh +++ b/tools/replace_engine_version.sh @@ -6,7 +6,7 @@ set -eEu SUPPORTED_VERSIONS=( "4.26.0" "4.27.0" - "5.0.0" "5.1.0" "5.2.0" "5.3.0" + "5.0.0" "5.1.0" "5.2.0" "5.3.0" "5.4.0" ) function usage() { @@ -34,6 +34,6 @@ if [ ${supported} -eq 0 ]; then fi for file in `find ${source_dir} -name "*.uplugin"`; do - sed -i -e "s/\"EngineVersion\": \"5.3.0\",/\"EngineVersion\": \"${engine_version}\",/g" ${file} + sed -i -e "s/\"EngineVersion\": \"5.4.0\",/\"EngineVersion\": \"${engine_version}\",/g" ${file} echo "Replaced engine version in ${file}" done From b258e9925870f312162eb694cf8c3d889dba2484 Mon Sep 17 00:00:00 2001 From: nutti Date: Thu, 2 May 2024 22:26:36 +0900 Subject: [PATCH 2/2] Fix: CI error --- .../Source/ShortcutAsset/Private/ShortcutAssetActions.cpp | 4 ++++ .../Source/ShortcutAsset/Private/ShortcutAssetUtils.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetActions.cpp b/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetActions.cpp index 592e25c..771b778 100644 --- a/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetActions.cpp +++ b/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetActions.cpp @@ -151,7 +151,11 @@ void FShortcutAssetActions::OpenAssetEditor(const TArray& InObjects, T TEXT("The link stored in '{0}' is missing.\nDo you want to edit the link?"), {ShortcutAsset->GetName()}); FText TitleText = LOCTEXT("Title", "Missing Link Error"); FText MessageText = FText::AsCultureInvariant(Message); +#if UE_VERSION_OLDER_THAN(5, 4, 0) + if (FMessageDialog::Open(EAppMsgType::OkCancel, MessageText, &TitleText) == EAppReturnType::Ok) +#else if (FMessageDialog::Open(EAppMsgType::OkCancel, MessageText, TitleText) == EAppReturnType::Ok) +#endif { UShortcutAssetSubsystem* Subsystem = GEditor->GetEditorSubsystem(); Subsystem->OpenShortcutAssetEditor({ShortcutAsset}); diff --git a/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetUtils.cpp b/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetUtils.cpp index 8b536f4..e60fac4 100644 --- a/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetUtils.cpp +++ b/ShortcutAsset/Source/ShortcutAsset/Private/ShortcutAssetUtils.cpp @@ -39,7 +39,11 @@ bool ReachFreeVersionLimitation(bool bIsCreateNew) FText TitleText = LOCTEXT("Title", "Reached Free Version Limitation"); FText MessageText = LOCTEXT("Message", "Free version can only create up to 3 assets.\nDo you want to open the marketplace of this plugin?"); +#if UE_VERSION_OLDER_THAN(5, 4, 0) + if (FMessageDialog::Open(EAppMsgType::OkCancel, MessageText, &TitleText) == EAppReturnType::Ok) +#else if (FMessageDialog::Open(EAppMsgType::OkCancel, MessageText, TitleText) == EAppReturnType::Ok) +#endif { FPlatformProcess::LaunchURL( TEXT("https://forums.unrealengine.com/t/how-to-open-a-browser-from-the-game/24346/3"), NULL, NULL);