Skip to content

Commit 7ffb106

Browse files
committed
Updated to UE5.2
Added to new nodes: GetClassPathName and GetObjectPathName that return the FTopLevelAssetPath. Fixed compile warnings related to not using ClassPaths(FTopLevelAssetPath) and SoftObjectPath. Use FAppStyle::GetBrush() insted of FEditorStyle::GetBrush. Use #include "AssetRegistry/AssetRegistryModule.h" instead of #include <AssetRegistryModule.h> Use #include "AssetRegistry/ARFilter.h" instead of #include <ARFilter.h> Added #include "TextureResource.h" to ElgEditorBP_PluginManager Added #include "Engine/Texture2D.h" to ElgEditorContext_BP
1 parent 3f6edfc commit 7ffb106

43 files changed

Lines changed: 104 additions & 88 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
54.5 KB
Binary file not shown.
50.6 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Plugins/ElgEditorScripting/Binaries/Win64/UnrealEditor.modules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"BuildId": "19505902",
2+
"BuildId": "25360045",
33
"Modules":
44
{
55
"ElgEditorScripting": "UnrealEditor-ElgEditorScripting.dll"

Plugins/ElgEditorScripting/ElgEditorScripting.uplugin

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
33
"Version": 1,
4-
"VersionName": "1.0.5",
4+
"VersionName": "1.0.6",
55
"FriendlyName": "Elg Editor Utility Widget Scripting",
66
"Description": "Extend the Editor Utility Widget scripting to make it possible to have Events like LevelActorSelected or AssetSelected and many more.",
77
"Category": "Scripting",
@@ -10,7 +10,7 @@
1010
"DocsURL": "ElgSoft.com",
1111
"MarketplaceURL": "",
1212
"SupportURL": "mailto:EditorScripting@ElgSoft.com",
13-
"EngineVersion": "5.0.0",
13+
"EngineVersion": "5.2.0",
1414
"CanContainContent": false,
1515
"Installed": true,
1616
"Modules": [

Plugins/ElgEditorScripting/Source/ElgEditorScripting/ElgEditorScripting.Build.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2022 ElgSoft. All rights reserved.
1+
// Copyright 2019-2023 ElgSoft. All rights reserved.
22

33
using UnrealBuildTool;
44
using System.IO;

Plugins/ElgEditorScripting/Source/ElgEditorScripting/Private/Blueprints/ElgEditorBP_Assets.cpp

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// Copyright 2019-2022 ElgSoft. All rights reserved.
1+
// Copyright 2019-2023 ElgSoft. All rights reserved.
22
// Elg001.ElgEditorScripting - ElgSoft.com
33

44

55
#include "ElgEditorBP_Assets.h"
6-
#include <AssetRegistryModule.h>
6+
#include "AssetRegistry/AssetRegistryModule.h"
77
#include <AssetToolsModule.h>
8-
#include <AssetData.h>
8+
#include "AssetRegistry/AssetData.h"
99
#include "Misc/Paths.h"
1010
#include <Engine/World.h>
1111
#include "HAL\FileManager.h"
@@ -16,7 +16,6 @@
1616
#include <IContentBrowserSingleton.h>
1717
#include <HAL/PlatformFilemanager.h>
1818

19-
#include "ElgEditorBP_UBlueprint.h"
2019
#include <Editor.h>
2120

2221

@@ -35,7 +34,7 @@ void UElgEditorBP_Assets::FixRedirectorsByPath(const FName Path, const bool Recu
3534
FARFilter assetFilter;
3635
assetFilter.bRecursivePaths = RecursivePaths;
3736
assetFilter.PackagePaths.Add(Path);
38-
assetFilter.ClassNames.Add(TEXT("ObjectRedirector"));
37+
assetFilter.ClassPaths.Add(GetClassPathName(UObjectRedirector::StaticClass()));
3938

4039
// Query for a list of assets in the selected paths
4140
TArray<FAssetData> assetList;
@@ -44,12 +43,8 @@ void UElgEditorBP_Assets::FixRedirectorsByPath(const FName Path, const bool Recu
4443
if (assetList.Num() > 0)
4544
{
4645
TArray<UObjectRedirector*> redirectors;
47-
48-
for (const auto& asset : assetList)
49-
{
50-
FString path = asset.ObjectPath.ToString();
51-
52-
FAssetData assetData = assetRegistryModule.Get().GetAssetByObjectPath(*path, false);
46+
for (const auto& asset : assetList) {
47+
FAssetData assetData = assetRegistryModule.Get().GetAssetByObjectPath(asset.GetSoftObjectPath(), false);
5348
if (assetData.IsValid() && assetData.IsRedirector()) {
5449
auto redirector = CastChecked<UObjectRedirector>(assetData.GetAsset());
5550
redirectors.Add(redirector);
@@ -103,7 +98,7 @@ FString UElgEditorBP_Assets::GetAssetDiskPath(const FAssetData& AssetDataStruct)
10398
if (!AssetDataStruct.IsValid()) return "";
10499

105100
const FString PackageName = AssetDataStruct.PackageName.ToString();
106-
const bool bIsWorldAsset = (AssetDataStruct.AssetClass == UWorld::StaticClass()->GetFName());
101+
const bool bIsWorldAsset = (AssetDataStruct.AssetClassPath == GetClassPathName(UWorld::StaticClass()));
107102
const FString Extension = bIsWorldAsset ? FPackageName::GetMapPackageExtension() : FPackageName::GetAssetPackageExtension();
108103
const FString FilePath = FPackageName::LongPackageNameToFilename(PackageName, Extension);
109104
const FString FullFilePath = FPaths::ConvertRelativePathToFull(FilePath);
@@ -149,8 +144,9 @@ FAssetData UElgEditorBP_Assets::GetAssetDataFromPath(const FString& AssetPath)
149144
return AssetData;
150145
}
151146

147+
FSoftObjectPath softObjectPath = FSoftObjectPath(AssetPath);
152148
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
153-
AssetData = AssetRegistryModule.Get().GetAssetByObjectPath(*AssetPath);
149+
AssetData = AssetRegistryModule.Get().GetAssetByObjectPath(softObjectPath);
154150
return AssetData;
155151
}
156152

@@ -168,7 +164,7 @@ FString UElgEditorBP_Assets::GetAssetPathFromObject(const UObject* AssetObject)
168164
if (AssetObject == nullptr) return path;
169165

170166
AssetObject->GetPathName().Split("/", &path, nullptr, ESearchCase::IgnoreCase, ESearchDir::FromEnd);
171-
return FString::Printf(TEXT("%s/%s.%s"), *path, *AssetObject->GetName(), *AssetObject->GetName());
167+
return FString::Printf(TEXT("%s/%s"), *path, *AssetObject->GetName());
172168
}
173169

174170
void UElgEditorBP_Assets::GetAssetDatasByPath(const TArray<FString>& AssetPaths, TArray<FAssetData>& AssetDatas)
@@ -192,13 +188,13 @@ FString UElgEditorBP_Assets::GetAssetName(const FAssetData& AssetDataStruct)
192188
FString UElgEditorBP_Assets::GetAssetPath(const FAssetData& AssetDataStruct)
193189
{
194190
if (!AssetDataStruct.IsValid()) return "";
195-
return AssetDataStruct.ObjectPath.ToString();
191+
return AssetDataStruct.GetSoftObjectPath().ToString();
196192
}
197193

198194
bool UElgEditorBP_Assets::IsAssetUWorldType(const FAssetData& AssetDataStruct)
199195
{
200196
if (!AssetDataStruct.IsValid()) return false;
201-
return (AssetDataStruct.AssetClass == UWorld::StaticClass()->GetFName());
197+
return (AssetDataStruct.AssetClassPath == GetClassPathName(UWorld::StaticClass()));
202198
}
203199

204200
UPackage* UElgEditorBP_Assets::GetPackage(const FAssetData& AssetDataStruct)
@@ -498,6 +494,27 @@ FString UElgEditorBP_Assets::NewAssetPathToDiskPath(const FString& InAssetPath,
498494
return fullFilePath;
499495
}
500496

497+
FTopLevelAssetPath UElgEditorBP_Assets::GetClassPathName(const UClass* InClass)
498+
{
499+
if (InClass) {
500+
return InClass->GetClassPathName();
501+
}
502+
return FTopLevelAssetPath();
503+
}
504+
505+
FTopLevelAssetPath UElgEditorBP_Assets::GetObjectPathName(const UObject* InObject)
506+
{
507+
if (InObject) {
508+
return GetClassPathName(InObject->GetClass());
509+
}
510+
return FTopLevelAssetPath();
511+
}
512+
513+
FString UElgEditorBP_Assets::FileNameToLongPackageName(const FString InFileName)
514+
{
515+
return FPackageName::FilenameToLongPackageName(InFileName);
516+
}
517+
501518
#pragma endregion
502519

503520
#pragma region DiffAssets

Plugins/ElgEditorScripting/Source/ElgEditorScripting/Private/Blueprints/ElgEditorBP_Class.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 ElgSoft. All rights reserved.
1+
// Copyright 2019-2023 ElgSoft. All rights reserved.
22
// Elg001.ElgEditorScripting - ElgSoft.com
33

44
#include "ElgEditorBP_Class.h"

0 commit comments

Comments
 (0)