From d7a7a85bd92fba8077d5adfe5b09b7aadeaa744f Mon Sep 17 00:00:00 2001 From: jagt Date: Wed, 2 Oct 2024 14:02:09 +0800 Subject: [PATCH] release 1.7.0 --- DataConfig/DataConfig.uplugin | 4 -- DataConfig/DataConfig54.uplugin | 64 +++++++++++++++++++ .../DataConfig/Automation/DcAutomation.cpp | 2 +- .../Private/DataConfig/DcCorePrivate.cpp | 5 ++ .../Property/DcPropertyReadStates.cpp | 4 +- .../Property/DcPropertyReadStates.h | 15 +++-- .../DataConfig/Property/DcPropertyReader.cpp | 6 +- .../Property/DcPropertyWriteStates.cpp | 2 +- .../Property/DcPropertyWriteStates.h | 13 ++-- .../DataConfig/Property/DcPropertyWriter.cpp | 9 +-- .../DataConfig/Automation/DcAutomation.h | 13 +++- .../Public/DataConfig/DcVersion.h | 4 +- .../Public/DataConfig/Misc/DcTypeUtils.h | 14 ++++ .../DataConfig/Property/DcPropertyUtils.h | 9 +++ .../DcDeserializeGameplayAbility.cpp | 14 ++-- .../DataConfigEngineExtra.Build.cs | 9 ++- .../SerDe/DcJsonBlueprintLibrary.cpp | 17 ++++- .../DataConfigEngineExtra5.Build.cs | 4 ++ .../SerDe/DcSerDeInstancedStruct.h | 6 ++ .../Extra/SerDe/DcSerDeInlineStruct.cpp | 2 +- .../DataConfig/Extra/Types/DcInlineStruct.cpp | 5 -- .../DataConfig/Extra/Types/DcInlineStruct.h | 4 +- .../DataConfigTests/Private/DcTestProperty.h | 2 +- .../DataConfigTests/Private/DcTestProperty4.h | 2 +- .../DataConfigTests/Private/DcTestRoundtrip.h | 4 +- Misc/Docs/Source/Advanced/Automation.md | 8 +-- Misc/Docs/Source/Advanced/Breaking.md | 5 ++ Misc/Docs/Source/Advanced/UEUpgrades.md | 10 +++ Misc/Docs/Source/Changes.md | 6 ++ Misc/Docs/Source/Integration.md | 20 +++++- Misc/Scripts/make_dataconfig_ue54.py | 43 +++++++++++++ 31 files changed, 266 insertions(+), 59 deletions(-) create mode 100644 DataConfig/DataConfig54.uplugin create mode 100644 Misc/Scripts/make_dataconfig_ue54.py diff --git a/DataConfig/DataConfig.uplugin b/DataConfig/DataConfig.uplugin index 1344b45e..ec76e64b 100644 --- a/DataConfig/DataConfig.uplugin +++ b/DataConfig/DataConfig.uplugin @@ -55,10 +55,6 @@ { "Name": "SQLiteCore", "Enabled": true - }, - { - "Name": "StructUtils", - "Enabled": true } ] } diff --git a/DataConfig/DataConfig54.uplugin b/DataConfig/DataConfig54.uplugin new file mode 100644 index 00000000..1344b45e --- /dev/null +++ b/DataConfig/DataConfig54.uplugin @@ -0,0 +1,64 @@ +{ + "FileVersion" : 3, + "Version" : 1, + "VersionName" : "1.0", + "FriendlyName" : "Data Config", + "Description" : "Serialization framework for Unreal Engine that just works!", + "Category" : "Editor", + "SupportURL" : "", + "EnabledByDefault" : true, + "CanContainContent" : true, + "IsBetaVersion" : false, + "Installed" : false, + "Modules": [ + { + "Name": "DataConfigCore", + "Type": "Runtime", + "LoadingPhase": "None" + }, + { + "Name": "DataConfigExtra", + "Type": "Runtime", + "LoadingPhase": "Default" + }, + { + "Name": "DataConfigEngineExtra", + "Type": "Runtime", + "LoadingPhase": "Default" + }, + { + "Name": "DataConfigEngineExtra5", + "Type": "Editor", + "LoadingPhase": "Default" + }, + { + "Name": "DataConfigTests", + "Type": "Editor", + "LoadingPhase": "Default" + }, + { + "Name": "DataConfigEditorExtra", + "Type": "Editor", + "LoadingPhase": "Default" + }, + { + "Name": "DataConfigTests5", + "Type": "Editor", + "LoadingPhase": "Default" + } + ], + "Plugins": [ + { + "Name": "GameplayAbilities", + "Enabled": true + }, + { + "Name": "SQLiteCore", + "Enabled": true + }, + { + "Name": "StructUtils", + "Enabled": true + } + ] +} diff --git a/DataConfig/Source/DataConfigCore/Private/DataConfig/Automation/DcAutomation.cpp b/DataConfig/Source/DataConfigCore/Private/DataConfig/Automation/DcAutomation.cpp index d041a86c..baff2560 100644 --- a/DataConfig/Source/DataConfigCore/Private/DataConfig/Automation/DcAutomation.cpp +++ b/DataConfig/Source/DataConfigCore/Private/DataConfig/Automation/DcAutomation.cpp @@ -31,7 +31,7 @@ FString FDcAutomationBase::CheckUniqueName(const FString& InName) return InName; } -uint32 FDcAutomationBase::GetTestFlags() const +FDcAutomationBase::FlagsType FDcAutomationBase::GetTestFlags() const { return FLAGS; } diff --git a/DataConfig/Source/DataConfigCore/Private/DataConfig/DcCorePrivate.cpp b/DataConfig/Source/DataConfigCore/Private/DataConfig/DcCorePrivate.cpp index 7cc77fcf..c036de7e 100644 --- a/DataConfig/Source/DataConfigCore/Private/DataConfig/DcCorePrivate.cpp +++ b/DataConfig/Source/DataConfigCore/Private/DataConfig/DcCorePrivate.cpp @@ -1,4 +1,8 @@ #include "DcCorePrivate.h" +#include "Misc/EngineVersionComparison.h" + +#if UE_VERSION_OLDER_THAN(5, 5, 0) +// 5.5 get rids of this boilerplate #if !IS_MONOLITHIC @@ -7,6 +11,7 @@ PER_MODULE_BOILERPLATE #endif +#endif // !UE_VERSION_OLDER_THAN(5, 5, 0) namespace DcCorePrivate { diff --git a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReadStates.cpp b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReadStates.cpp index 4b400f8b..4550501d 100644 --- a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReadStates.cpp +++ b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReadStates.cpp @@ -1304,7 +1304,7 @@ FDcResult FDcReadStateScalar::ReadDataEntry(FDcPropertyReader* Parent, FFieldCla else { OutDatum.Property = ScalarField; - OutDatum.DataPtr = (uint8*)ScalarPtr + (PTRINT)(ScalarField->ElementSize * Index); + OutDatum.DataPtr = (uint8*)ScalarPtr + (PTRINT)(DcPropertyUtils::ElementSize(ScalarField) * Index); ++Index; if (Index == ScalarField->ArrayDim) @@ -1356,7 +1356,7 @@ FDcResult FDcReadStateScalar::PeekReadDataPtr(FDcPropertyReader* Parent, void** << EState::ExpectScalar << EState::ExpectArrayItem << State << Parent->FormatHighlight(); - return ReadOutOk(OutDataPtr, (uint8*)ScalarPtr + (PTRINT)(ScalarField->ElementSize * Index)); + return ReadOutOk(OutDataPtr, (uint8*)ScalarPtr + (PTRINT)(DcPropertyUtils::ElementSize(ScalarField) * Index)); } FDcResult FDcReadStateScalar::ReadArrayRoot(FDcPropertyReader* Parent) diff --git a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReadStates.h b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReadStates.h index e5d73206..66ea36bd 100644 --- a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReadStates.h +++ b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReadStates.h @@ -3,6 +3,7 @@ #include "DataConfig/DcTypes.h" #include "DataConfig/Property/DcPropertyUtils.h" #include "DataConfig/Property/DcPropertyStatesCommon.h" +#include "DataConfig/Misc/DcTypeUtils.h" #include "Misc/EngineVersionComparison.h" enum class EDcPropertyReadType @@ -399,16 +400,16 @@ struct FDcReadStateOptional : public FDcBaseReadState void FormatHighlightSegment(TArray& OutSegments, DcPropertyHighlight::EFormatSeg SegType) override; }; -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); #endif // !UE_VERSION_OLDER_THAN(5, 4, 0) // storage is already POD type, and TArray<> do only bitwise relocate anyway // we'll just needs to assume these types are trivially destructable -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); diff --git a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReader.cpp b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReader.cpp index 3b1394fe..537bddc8 100644 --- a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReader.cpp +++ b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyReader.cpp @@ -717,7 +717,7 @@ FDcResult FDcPropertyReader::ReadBlob(FDcBlobViewData* OutPtr) { *OutPtr = { (uint8*)ScriptArray.GetRawPtr(), - ScriptArray.Num() * ArrayProperty->Inner->ElementSize + ScriptArray.Num() * DcPropertyUtils::ElementSize(ArrayProperty->Inner) }; } @@ -732,7 +732,7 @@ FDcResult FDcPropertyReader::ReadBlob(FDcBlobViewData* OutPtr) { *OutPtr = { (uint8*)Datum.DataPtr, - Prop->ArrayDim * Prop->ElementSize + Prop->ArrayDim * DcPropertyUtils::ElementSize(Prop) }; } @@ -748,7 +748,7 @@ FDcResult FDcPropertyReader::ReadBlob(FDcBlobViewData* OutPtr) { *OutPtr = { (uint8*)Datum.DataPtr, - StructProperty->ElementSize + DcPropertyUtils::ElementSize(StructProperty) }; } diff --git a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriteStates.cpp b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriteStates.cpp index fc95cd5e..1cf55a91 100644 --- a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriteStates.cpp +++ b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriteStates.cpp @@ -1118,7 +1118,7 @@ FDcResult FDcWriteStateScalar::WriteDataEntry(FDcPropertyWriter* Parent, FFieldC else { OutDatum.Property = ScalarField; - OutDatum.DataPtr = (uint8*)ScalarPtr + (PTRINT)(ScalarField->ElementSize * Index); + OutDatum.DataPtr = (uint8*)ScalarPtr + (PTRINT)(DcPropertyUtils::ElementSize(ScalarField) * Index); ++Index; if (Index == ScalarField->ArrayDim) diff --git a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriteStates.h b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriteStates.h index b1babcd7..bf386d55 100644 --- a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriteStates.h +++ b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriteStates.h @@ -4,6 +4,7 @@ #include "DataConfig/Property/DcPropertyStatesCommon.h" #include "DataConfig/Property/DcPropertyDatum.h" #include "DataConfig/Property/DcPropertyUtils.h" +#include "DataConfig/Misc/DcTypeUtils.h" #include "UObject/UnrealType.h" #include "Misc/EngineVersionComparison.h" @@ -347,7 +348,7 @@ struct FDcWriteStateOptional : public FDcBaseWriteState void FormatHighlightSegment(TArray& OutSegments, DcPropertyHighlight::EFormatSeg SegType) override; }; -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); #endif // !UE_VERSION_OLDER_THAN(5, 4, 0) struct FDcWriteStateScalar : public FDcBaseWriteState @@ -424,9 +425,9 @@ FDcResult WriteValue(FDcPropertyWriter* Parent, FDcBaseWriteState& State, const return DcOk(); } -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); -static_assert(TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); +static_assert(DcTypeUtils::TIsTriviallyDestructible::Value, "need trivial destructible"); diff --git a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriter.cpp b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriter.cpp index d4732152..dee80a2b 100644 --- a/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriter.cpp +++ b/DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriter.cpp @@ -734,7 +734,7 @@ FDcResult FDcPropertyWriter::WriteBlob(const FDcBlobViewData& Value) FArrayProperty* ArrayProperty = Datum.CastFieldChecked(); FScriptArrayHelper ScriptArray(ArrayProperty, Datum.DataPtr); - int32 ElementSize = ArrayProperty->Inner->ElementSize; + int32 ElementSize = DcPropertyUtils::ElementSize(ArrayProperty->Inner); int32 NewCount = Value.Num / ElementSize; if (Value.Num % ElementSize != 0) NewCount += 1; @@ -749,7 +749,7 @@ FDcResult FDcPropertyWriter::WriteBlob(const FDcBlobViewData& Value) DC_TRY(GetTopState(this).WriteDataEntry(this, FProperty::StaticClass(), Datum)); DC_TRY(DcPropertyUtils::HeuristicVerifyPointer(Value.DataPtr)); - int FullSize = Prop->ArrayDim * Prop->ElementSize; + int FullSize = Prop->ArrayDim * DcPropertyUtils::ElementSize(Prop); if (Value.Num > FullSize) return DC_FAIL(DcDReadWrite, WriteBlobOverrun) << FullSize << Value.Num; @@ -764,8 +764,9 @@ FDcResult FDcPropertyWriter::WriteBlob(const FDcBlobViewData& Value) FStructProperty* StructProperty = Datum.CastFieldChecked(); - if (Value.Num > StructProperty->ElementSize) - return DC_FAIL(DcDReadWrite, WriteBlobOverrun) << StructProperty->ElementSize << Value.Num; + int32 StructSize = DcPropertyUtils::ElementSize(StructProperty); + if (Value.Num > StructSize) + return DC_FAIL(DcDReadWrite, WriteBlobOverrun) << StructSize << Value.Num; StructProperty->CopySingleValue(Datum.DataPtr, Value.DataPtr); return DcOk(); diff --git a/DataConfig/Source/DataConfigCore/Public/DataConfig/Automation/DcAutomation.h b/DataConfig/Source/DataConfigCore/Public/DataConfig/Automation/DcAutomation.h index 7ec48ef1..7d9a8391 100644 --- a/DataConfig/Source/DataConfigCore/Public/DataConfig/Automation/DcAutomation.h +++ b/DataConfig/Source/DataConfigCore/Public/DataConfig/Automation/DcAutomation.h @@ -6,6 +6,7 @@ #include "DataConfig/Misc/DcTemplateUtils.h" #include "Misc/AutomationTest.h" #include "Misc/AssertionMacros.h" +#include "Misc/EngineVersionComparison.h" #include "Containers/UnrealString.h" class DATACONFIGCORE_API FDcAutomationBase : public FAutomationTestBase @@ -13,7 +14,13 @@ class DATACONFIGCORE_API FDcAutomationBase : public FAutomationTestBase public: static FString CheckUniqueName(const FString& InName); - constexpr static uint32 FLAGS = EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::EngineFilter; +#if UE_VERSION_OLDER_THAN(5, 5, 0) + using FlagsType = uint32; + constexpr static FlagsType FLAGS = EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::EngineFilter; +#else + using FlagsType = EAutomationTestFlags; + constexpr static FlagsType FLAGS = EAutomationTestFlags_ApplicationContextMask | EAutomationTestFlags::EngineFilter; +#endif FDcAutomationBase( const FString& InName, const bool bInComplexTask ) : FAutomationTestBase(InName, bInComplexTask) @@ -22,7 +29,7 @@ class DATACONFIGCORE_API FDcAutomationBase : public FAutomationTestBase bSuppressLogs = true; } - uint32 GetTestFlags() const override; + FlagsType GetTestFlags() const override; uint32 GetRequiredDeviceNum() const override; bool TestOk(const TCHAR* Description, const FDcResult& Result); @@ -93,7 +100,7 @@ struct DATACONFIGCORE_API FDcAutomationConsoleRunner { TArray Filters; TArray Parameters; - uint32 RequestedTestFilter; + FDcAutomationBase::FlagsType RequestedTestFilter; }; static FArgs FromCommandlineTokens(const TArray& Tokens); diff --git a/DataConfig/Source/DataConfigCore/Public/DataConfig/DcVersion.h b/DataConfig/Source/DataConfigCore/Public/DataConfig/DcVersion.h index 5b947dfc..9456bc02 100644 --- a/DataConfig/Source/DataConfigCore/Public/DataConfig/DcVersion.h +++ b/DataConfig/Source/DataConfigCore/Public/DataConfig/DcVersion.h @@ -1,4 +1,4 @@ #pragma once -#define DATA_CONFIG_CORE_VERSION "1.6.2" -#define DATA_CONFIG_CORE_VERSION_NUMBER 10602 +#define DATA_CONFIG_CORE_VERSION "1.7.0" +#define DATA_CONFIG_CORE_VERSION_NUMBER 10700 diff --git a/DataConfig/Source/DataConfigCore/Public/DataConfig/Misc/DcTypeUtils.h b/DataConfig/Source/DataConfigCore/Public/DataConfig/Misc/DcTypeUtils.h index 9712ebfd..830d36bf 100644 --- a/DataConfig/Source/DataConfigCore/Public/DataConfig/Misc/DcTypeUtils.h +++ b/DataConfig/Source/DataConfigCore/Public/DataConfig/Misc/DcTypeUtils.h @@ -3,6 +3,10 @@ #include "DataConfig/DcTypes.h" #include "Misc/EngineVersionComparison.h" +#if UE_VERSION_OLDER_THAN(5, 5, 0) +#include "Templates/IsTriviallyDestructible.h" +#endif + namespace DcTypeUtils { FORCEINLINE bool IsNumericDataEntry(const EDcDataEntry& Entry) @@ -105,5 +109,15 @@ struct TRemoveConst }; +template +struct TIsTriviallyDestructible +{ +#if UE_VERSION_OLDER_THAN(5, 5, 0) + enum { Value = ::TIsTriviallyDestructible::Value }; +#else + enum { Value = std::is_trivially_destructible_v }; +#endif +}; + } // namespace DcTypeUtils diff --git a/DataConfig/Source/DataConfigCore/Public/DataConfig/Property/DcPropertyUtils.h b/DataConfig/Source/DataConfigCore/Public/DataConfig/Property/DcPropertyUtils.h index 19da85b3..35cd8fac 100644 --- a/DataConfig/Source/DataConfigCore/Public/DataConfig/Property/DcPropertyUtils.h +++ b/DataConfig/Source/DataConfigCore/Public/DataConfig/Property/DcPropertyUtils.h @@ -148,6 +148,15 @@ FORCEINLINE UScriptStruct* CastFieldVariant(const FFieldVariant& DATACONFIGCORE_API extern const FName DC_TRANSIENT_PROPERTY; +FORCEINLINE int32 ElementSize(const FProperty* Property) +{ +#if UE_VERSION_OLDER_THAN(5, 5, 0) + return Property->ElementSize; +#else + return Property->GetElementSize(); +#endif +} + struct DATACONFIGCORE_API FDcPropertyBuilder { FProperty* Property; diff --git a/DataConfig/Source/DataConfigEditorExtra/Private/DataConfig/EditorExtra/Deserialize/DcDeserializeGameplayAbility.cpp b/DataConfig/Source/DataConfigEditorExtra/Private/DataConfig/EditorExtra/Deserialize/DcDeserializeGameplayAbility.cpp index 6e43cb00..472aadad 100644 --- a/DataConfig/Source/DataConfigEditorExtra/Private/DataConfig/EditorExtra/Deserialize/DcDeserializeGameplayAbility.cpp +++ b/DataConfig/Source/DataConfigEditorExtra/Private/DataConfig/EditorExtra/Deserialize/DcDeserializeGameplayAbility.cpp @@ -293,7 +293,7 @@ DC_TEST("DataConfig.EditorExtra.GameplayAbility") "CostGameplayEffectClass" : "/DataConfig/DcFixture/DcTestGameplayEffectAlpha", /// Advanced "ReplicationPolicy" : "ReplicateYes", - "InstancingPolicy" : "NonInstanced", + "InstancingPolicy" : "InstancedPerActor", } )"); FDcJsonReader Reader(Str); @@ -302,12 +302,18 @@ DC_TEST("DataConfig.EditorExtra.GameplayAbility") UTEST_OK("Editor Extra UGameplayAbility Deserialize", DcEditorExtra::DeserializeGameplayAbility(TmpAbility, Reader)); UTEST_TRUE("Editor Extra UGameplayAbility Deserialize", TmpAbility->GetReplicationPolicy() == EGameplayAbilityReplicationPolicy::ReplicateYes); - UTEST_TRUE("Editor Extra UGameplayAbility Deserialize", TmpAbility->GetInstancingPolicy() == EGameplayAbilityInstancingPolicy::NonInstanced); + UTEST_TRUE("Editor Extra UGameplayAbility Deserialize", TmpAbility->GetInstancingPolicy() == EGameplayAbilityInstancingPolicy::InstancedPerActor); - UTEST_TRUE("Editor Extra UGameplayAbility Deserialize", TmpAbility->AbilityTags.HasTagExact( +#if UE_VERSION_OLDER_THAN(5, 5, 0) + auto& AbilityTags = TmpAbility->AbilityTags; +#else + auto& AbilityTags = TmpAbility->GetAssetTags(); +#endif // !UE_VERSION_OLDER_THAN(5, 5, 0) + + UTEST_TRUE("Editor Extra UGameplayAbility Deserialize", AbilityTags.HasTagExact( UGameplayTagsManager::Get().RequestGameplayTag(TEXT("DataConfig.Foo.Bar")) )); - UTEST_TRUE("Editor Extra UGameplayAbility Deserialize", TmpAbility->AbilityTags.HasTagExact( + UTEST_TRUE("Editor Extra UGameplayAbility Deserialize", AbilityTags.HasTagExact( UGameplayTagsManager::Get().RequestGameplayTag(TEXT("DataConfig.Foo.Bar.Baz")) )); diff --git a/DataConfig/Source/DataConfigEngineExtra/DataConfigEngineExtra.Build.cs b/DataConfig/Source/DataConfigEngineExtra/DataConfigEngineExtra.Build.cs index efdd04ea..5cc199dd 100644 --- a/DataConfig/Source/DataConfigEngineExtra/DataConfigEngineExtra.Build.cs +++ b/DataConfig/Source/DataConfigEngineExtra/DataConfigEngineExtra.Build.cs @@ -15,9 +15,14 @@ public DataConfigEngineExtra(ReadOnlyTargetRules Target) : base(Target) "DataConfigCore", "DataConfigExtra", #if UE_5_0_OR_LATER - "StructUtils", "DataConfigEngineExtra5", -#endif + +#if UE_5_5_OR_LATER + // pass +#else + "StructUtils", +#endif // UE_5_5_OR_LATER +#endif // UE_5_0_OR_LATER }); if (Target.bBuildEditor == true) diff --git a/DataConfig/Source/DataConfigEngineExtra/Private/DataConfig/EngineExtra/SerDe/DcJsonBlueprintLibrary.cpp b/DataConfig/Source/DataConfigEngineExtra/Private/DataConfig/EngineExtra/SerDe/DcJsonBlueprintLibrary.cpp index a05f8794..6d1e073d 100644 --- a/DataConfig/Source/DataConfigEngineExtra/Private/DataConfig/EngineExtra/SerDe/DcJsonBlueprintLibrary.cpp +++ b/DataConfig/Source/DataConfigEngineExtra/Private/DataConfig/EngineExtra/SerDe/DcJsonBlueprintLibrary.cpp @@ -41,13 +41,18 @@ #include "UObject/Script.h" #endif // ENGINE_MAJOR_VERSION == 5 -#include "Engine/UserDefinedStruct.h" #include "Engine/UserDefinedEnum.h" #include "GameplayTags.h" #if !UE_VERSION_OLDER_THAN(5, 4, 0) #include "UObject/VerseValueProperty.h" #endif // !UE_VERSION_OLDER_THAN(5, 4, 0) +#if UE_VERSION_OLDER_THAN(5, 5, 0) +#include "Engine/UserDefinedStruct.h" +#else +#include "StructUtils/UserDefinedStruct.h" +#endif // UE_VERSION_OLDER_THAN(5, 5, 0) + namespace DcJsonBlueprintLibraryDetails { @@ -206,7 +211,17 @@ static bool _BlueprintLibPropertyPredicate(FProperty* Property) || Property->IsA() || Property->IsA() #if !UE_VERSION_OLDER_THAN(5, 4, 0) + +#if UE_VERSION_OLDER_THAN(5, 5, 0) || Property->IsA() +#else + +#if WITH_VERSE_VM + || Property->IsA() +#endif // WITH_VERSE_VM + +#endif // UE_VERSION_OLDER_THAN(5, 5, 0) + #endif // !UE_VERSION_OLDER_THAN(5, 4, 0) ) return false; diff --git a/DataConfig/Source/DataConfigEngineExtra5/DataConfigEngineExtra5.Build.cs b/DataConfig/Source/DataConfigEngineExtra5/DataConfigEngineExtra5.Build.cs index 95fdeb3f..9dd366da 100644 --- a/DataConfig/Source/DataConfigEngineExtra5/DataConfigEngineExtra5.Build.cs +++ b/DataConfig/Source/DataConfigEngineExtra5/DataConfigEngineExtra5.Build.cs @@ -12,7 +12,11 @@ public DataConfigEngineExtra5(ReadOnlyTargetRules Target) : base(Target) "Engine", "DataConfigCore", "DataConfigExtra", +#if UE_5_5_OR_LATER + // pass +#else "StructUtils", +#endif // UE_5_5_OR_LATER }); } } diff --git a/DataConfig/Source/DataConfigEngineExtra5/Public/DataConfig/EngineExtra/SerDe/DcSerDeInstancedStruct.h b/DataConfig/Source/DataConfigEngineExtra5/Public/DataConfig/EngineExtra/SerDe/DcSerDeInstancedStruct.h index b408d7ae..edb4457a 100644 --- a/DataConfig/Source/DataConfigEngineExtra5/Public/DataConfig/EngineExtra/SerDe/DcSerDeInstancedStruct.h +++ b/DataConfig/Source/DataConfigEngineExtra5/Public/DataConfig/EngineExtra/SerDe/DcSerDeInstancedStruct.h @@ -4,7 +4,13 @@ #include "DataConfig/Deserialize/DcDeserializeTypes.h" #include "DataConfig/Serialize/DcSerializeTypes.h" +#include "Misc/EngineVersionComparison.h" +#if UE_VERSION_OLDER_THAN(5, 5, 0) #include "InstancedStruct.h" +#else +#include "StructUtils/InstancedStruct.h" +#endif // !UE_VERSION_OLDER_THAN(5, 5, 0) + #include "Engine/DataAsset.h" #include "DcSerDeInstancedStruct.generated.h" diff --git a/DataConfig/Source/DataConfigExtra/Private/DataConfig/Extra/SerDe/DcSerDeInlineStruct.cpp b/DataConfig/Source/DataConfigExtra/Private/DataConfig/Extra/SerDe/DcSerDeInlineStruct.cpp index 21c3450f..5a027489 100644 --- a/DataConfig/Source/DataConfigExtra/Private/DataConfig/Extra/SerDe/DcSerDeInlineStruct.cpp +++ b/DataConfig/Source/DataConfigExtra/Private/DataConfig/Extra/SerDe/DcSerDeInlineStruct.cpp @@ -54,7 +54,7 @@ FDcResult TDcInlineStructDeserialize::DcHandlerDeserializeInlineS if (LoadStruct->GetStructureSize() > TInlineStruct::_CLASS_OFFSET) { return DC_FAIL(DcDExtra, InlineStructTooBig) - << TInlineStruct::_CLASS_OFFSET << LoadStruct->GetFName() << LoadStruct->GetStructureSize(); + << (int32)TInlineStruct::_CLASS_OFFSET << LoadStruct->GetFName() << LoadStruct->GetStructureSize(); } LoadStruct->InitializeStruct(&InlineStructPtr->Buffer); diff --git a/DataConfig/Source/DataConfigExtra/Private/DataConfig/Extra/Types/DcInlineStruct.cpp b/DataConfig/Source/DataConfigExtra/Private/DataConfig/Extra/Types/DcInlineStruct.cpp index a1610f00..25366b54 100644 --- a/DataConfig/Source/DataConfigExtra/Private/DataConfig/Extra/Types/DcInlineStruct.cpp +++ b/DataConfig/Source/DataConfigExtra/Private/DataConfig/Extra/Types/DcInlineStruct.cpp @@ -5,8 +5,3 @@ template struct DATACONFIGEXTRA_API TDcInlineStructBase<128>; template struct DATACONFIGEXTRA_API TDcInlineStructBase<256>; template struct DATACONFIGEXTRA_API TDcInlineStructBase<512>; -// compile hack for c++14 constexpr -template constexpr int32 TDcInlineStructBase::_BUFLEN; -template constexpr int32 TDcInlineStructBase::_CLASS_OFFSET; - - diff --git a/DataConfig/Source/DataConfigExtra/Public/DataConfig/Extra/Types/DcInlineStruct.h b/DataConfig/Source/DataConfigExtra/Public/DataConfig/Extra/Types/DcInlineStruct.h index d64a34fd..bd24d4ae 100644 --- a/DataConfig/Source/DataConfigExtra/Public/DataConfig/Extra/Types/DcInlineStruct.h +++ b/DataConfig/Source/DataConfigExtra/Public/DataConfig/Extra/Types/DcInlineStruct.h @@ -11,8 +11,8 @@ template struct TDcInlineStructBase { - constexpr static int32 _BUFLEN = BUFLEN; - constexpr static int32 _CLASS_OFFSET = _BUFLEN - sizeof(void*); + enum : int32 { _BUFLEN = BUFLEN }; + enum : int32 { _CLASS_OFFSET = _BUFLEN - sizeof(void*) }; // [, UScriptStruct*] TAlignedBytes<_BUFLEN, 16u> Buffer; diff --git a/DataConfig/Source/DataConfigTests/Private/DcTestProperty.h b/DataConfig/Source/DataConfigTests/Private/DcTestProperty.h index fa60ff2c..d7334b43 100644 --- a/DataConfig/Source/DataConfigTests/Private/DcTestProperty.h +++ b/DataConfig/Source/DataConfigTests/Private/DcTestProperty.h @@ -73,7 +73,7 @@ struct FDcTestStruct2 UPROPERTY() TSoftObjectPtr SoftObjectField; UPROPERTY() TSoftClassPtr SoftClassField; UPROPERTY() TScriptInterface InterfaceField; - UPROPERTY() TFieldPath FieldPathField; + UPROPERTY() TFieldPath FieldPathField; UPROPERTY() FDcTestDelegate1 DelegateField; UPROPERTY() FDcTestDynMulticastCallback1 DynMulticastField; diff --git a/DataConfig/Source/DataConfigTests/Private/DcTestProperty4.h b/DataConfig/Source/DataConfigTests/Private/DcTestProperty4.h index 275d596c..233c6fea 100644 --- a/DataConfig/Source/DataConfigTests/Private/DcTestProperty4.h +++ b/DataConfig/Source/DataConfigTests/Private/DcTestProperty4.h @@ -59,7 +59,7 @@ struct FDcTestArrayDim1 UPROPERTY() TSoftClassPtr SoftClassArr[2]; UPROPERTY() TScriptInterface InterfaceArr[3]; - UPROPERTY() TFieldPath FieldPathArr[4]; + UPROPERTY() TFieldPath FieldPathArr[4]; UPROPERTY() FDcTestDelegate1 DelegateArr[2]; UPROPERTY() FDcTestDynMulticastCallback1 DynMulticastArr[3]; diff --git a/DataConfig/Source/DataConfigTests/Private/DcTestRoundtrip.h b/DataConfig/Source/DataConfigTests/Private/DcTestRoundtrip.h index 6703224c..6cc25eda 100644 --- a/DataConfig/Source/DataConfigTests/Private/DcTestRoundtrip.h +++ b/DataConfig/Source/DataConfigTests/Private/DcTestRoundtrip.h @@ -11,8 +11,8 @@ struct FDcTestRoundtripStruct1 GENERATED_BODY() // FieldPath - UPROPERTY() TFieldPath FieldPathField; - UPROPERTY() TFieldPath FieldPathField2; + UPROPERTY() TFieldPath FieldPathField; + UPROPERTY() TFieldPath FieldPathField2; void MakeFixture(); }; diff --git a/Misc/Docs/Source/Advanced/Automation.md b/Misc/Docs/Source/Advanced/Automation.md index f9e4c9d0..6f75a0d2 100644 --- a/Misc/Docs/Source/Advanced/Automation.md +++ b/Misc/Docs/Source/Advanced/Automation.md @@ -18,7 +18,7 @@ We provide a standalone, command target that runs tests on core, non editor Data ```shell # UE5 - /Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe -project="%CD%/DataConfig.uplugin" DataConfigHeadless Win64 Debug + /Engine/Build/BatchFiles/RunUBT -project="%CD%/DataConfig.uplugin" DataConfigHeadless Win64 Debug # UE4 /Engine/Binaries/DotNET/UnrealBuildTool.exe -project="%CD%/DataConfig4.uplugin" DataConfigHeadless Win64 Debug @@ -52,7 +52,7 @@ You can build and run the benchmarks with the commands below: ```shell # remember to build in Shipping -/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe -project="%CD%/DataConfig.uplugin" DataConfigHeadless Win64 Shipping +Engine/Build/BatchFiles/RunUBT -project="%CD%/DataConfig.uplugin" DataConfigHeadless Win64 Shipping %CD%/Binaries/Win64/DataConfigHeadless-Win64-Shipping.exe DataConfigBenchmark ```` @@ -82,7 +82,7 @@ target for Linux and run it under WSL2. ```shell # UE5.1 set LINUX_MULTIARCH_ROOT=/v20_clang-13.0.1-centos7 - /Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe -project="%CD%/DataConfig.uplugin" DataConfigHeadless Linux Debug + /Engine/Build/BatchFiles/RunUBT -project="%CD%/DataConfig.uplugin" DataConfigHeadless Linux Debug # UE4 set LINUX_MULTIARCH_ROOT=/v19_clang-11.0.1-centos7 @@ -133,7 +133,7 @@ With the editor target we have a `DcCoreTestsCommandlet` that can be run through ```shell # UE5 # build - /Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe DcProjectEditor Win64 Development %CD%/DcProject5.uproject -NoHotReload -NoEngineChanges + /Engine/Build/BatchFiles/RunUBT DcProjectEditor Win64 Development %CD%/DcProject5.uproject -NoHotReload -NoEngineChanges # run commandlet /Engine/Binaries/Win64/UnrealEditor-Cmd.exe %CD%/DcProject5.uproject DataConfigEditorExtra.DcCoreTestsCommandlet diff --git a/Misc/Docs/Source/Advanced/Breaking.md b/Misc/Docs/Source/Advanced/Breaking.md index 99c256b4..5deefcbb 100644 --- a/Misc/Docs/Source/Advanced/Breaking.md +++ b/Misc/Docs/Source/Advanced/Breaking.md @@ -2,6 +2,11 @@ On this page we'll document breaking changes across versions. +# 1.7.0 + +- UE 5.5 deprecated `StructUtils` plugin, thus we'll need to setup multiple uplugins for UE5. See: [DataConfigXX.uplugin](../Integration.md#dataconfigxxuplugin) + + # 1.6.0 - Added a optional `FName` to `FDcSerializer/FDcDeserializer::AddPredicatedHandler` which can be used to identify an entry so one can replace it later like this: diff --git a/Misc/Docs/Source/Advanced/UEUpgrades.md b/Misc/Docs/Source/Advanced/UEUpgrades.md index 8a9abd86..d701df1b 100644 --- a/Misc/Docs/Source/Advanced/UEUpgrades.md +++ b/Misc/Docs/Source/Advanced/UEUpgrades.md @@ -2,6 +2,16 @@ DataConfig is committed to support multiple UE versions with no deprecations and warnings. On this page we'll document important upgrade and migration info. +# UE5.5 + +- `EAutomationTestFlags` is now a `enum class` type. +- `TIsTriviallyDestructible` is deprecated over `std::is_trivially_destructible_v`. +- `TFieldPath(OtherPropertyType*)` constructor now checks for actual type safety. +- `FProperty::ElementSize` deprecated over `GetElementSize`. +- `StructUtils` plugin is deprecated with all things moved in engine. +- `PER_MODULE_BOILERPLATE` not needed anymore as UBT handles it automatically. +- `FVerseValueProperty` renamed to `FVValueProperty`, also compiled only with `WITH_VERSE_VM` define. + # UE5.4 - New property `Optional` and `VValue` are added. We fully support `Optional` starting by adding `EDcDataEntry::OptionalRoot/OptionalEnd` and then evantually it works with all DataConfig APIs including JSON/MsgPack serialization and property builder. - `FObjectPtrProperty/FClassPtrProperty` are deprecated. It's introduced in 5.0 now removed and alias to `FObjectProperty/FClassProperty` respectively. diff --git a/Misc/Docs/Source/Changes.md b/Misc/Docs/Source/Changes.md index 0250ed6a..1bf15f82 100644 --- a/Misc/Docs/Source/Changes.md +++ b/Misc/Docs/Source/Changes.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## 1.7.0 - 2024-10-2 + +- Initial UE 5.5 support. +- **BREAKING** Separate `DataConfig54.uplugin` and `DataConfig.uplugin`. + - See: [Breaking - 1.7.0](Advanced/Breaking.md#170) + ## 1.6.2 - 2024-5-18 - Misc Shipping configuration build fixes. diff --git a/Misc/Docs/Source/Integration.md b/Misc/Docs/Source/Integration.md index c1236f60..7396d821 100644 --- a/Misc/Docs/Source/Integration.md +++ b/Misc/Docs/Source/Integration.md @@ -2,6 +2,7 @@ At the moment it supports these the engine versions below: +- UE 5.5 - UE 5.4 - UE 5.3 - UE 5.2 @@ -45,14 +46,27 @@ DataConfig now uses separated `uplugin` files for UE4 and UE5 so that we can try git clone https://github.com/slowburn-dev/DataConfig # requires python 3.6+ python ./DataConfig/Misc/Scripts/make_dataconfig_ue4.py +python ./DataConfig/Misc/Scripts/make_dataconfig_ue54.py python ./DataConfig/Misc/Scripts/make_dataconfig_ue5.py ``` -### Manual Steps for UE5 +### `DataConfigXX.uplugin` + +Ultimately we figured that we'll need multiple `.uplugin` files to support acrosss UE versions: + +| Name | Version | +| -------------------- | ------------ | +| DataConfig4.uplugin | 4.25 - 4.27 | +| DataConfig54.uplugin | 5.0 - 5.4 | +| DataConfig5.uplugin | 5.5 - Latest | + +When packaging for each engine version we rename the one we want and delete the rest. + +### Manual Steps for UE5 Latest 1. Get a copy of [DataConfig repository][1]. Then copy `./DataConfig` (where `DataConfig.uplugin` is located) into your project's `Plugins` directory. -2. Delete `DataConfig4.uplugin`. +2. Delete `DataConfig4.uplugin`, and other `DataConfig5X.uplugin`. 3. **Delete `DataConfig/Source/DataConfigHeadless`** folder. **This step is crucial or you your project won't build**. @@ -65,7 +79,7 @@ python ./DataConfig/Misc/Scripts/make_dataconfig_ue5.py 3. **Delete `DataConfig/Source/DataConfigHeadless`** folder. **This step is crucial or you your project won't build**. 4. Additionally delete UE5 specific modules. - + * `DataConfig/Source/DataConfigEngineExtra5` ### Validate integration diff --git a/Misc/Scripts/make_dataconfig_ue54.py b/Misc/Scripts/make_dataconfig_ue54.py new file mode 100644 index 00000000..7476c3e1 --- /dev/null +++ b/Misc/Scripts/make_dataconfig_ue54.py @@ -0,0 +1,43 @@ +import sys +assert sys.version_info.major == 3 and sys.version_info.minor >= 4, "needs python >= 3.4" + +import os +from pathlib import Path +import shutil + +def _copy(src_path, dest_path): + shutil.copy(str(src_path), str(dest_path)) + +def _copytree(src_path, dest_path): + shutil.copytree(str(src_path), str(dest_path), dirs_exist_ok=True) + +root = Path(os.path.abspath(__file__)).parent.parent.parent +plugin = root / "Tmp/UE54/DataConfig" +plugin.mkdir(parents=True, exist_ok=True) + +# copy uplugin +root_uplugin = root / "DataConfig/DataConfig54.uplugin" +plugin_uplugin = plugin / "DataConfig.uplugin" +_copy(root_uplugin, plugin_uplugin) + +# copy sources +root_src = root / "DataConfig/Source" +plugin_src = plugin / "Source" +plugin_src.mkdir(parents=True, exist_ok=True) + +_copytree(root_src / "DataConfigCore", plugin_src / "DataConfigCore") +_copytree(root_src / "DataConfigExtra", plugin_src / "DataConfigExtra") +_copytree(root_src / "DataConfigTests", plugin_src / "DataConfigTests") +_copytree(root_src / "DataConfigTests5", plugin_src / "DataConfigTests5") +# include 5.* for all ue5 plugins, it's fine for older releases as it won't be included in the build +_copytree(root_src / "DataConfigTests54", plugin_src / "DataConfigTests54") +_copytree(root_src / "DataConfigEngineExtra", plugin_src / "DataConfigEngineExtra") +_copytree(root_src / "DataConfigEngineExtra5", plugin_src / "DataConfigEngineExtra5") +_copytree(root_src / "DataConfigEditorExtra", plugin_src / "DataConfigEditorExtra") + +# copy others +_copytree(root / "DataConfig/Content", plugin / "Content") +_copytree(root / "DataConfig/Tests", plugin / "Tests") + +print("copied clean DataConfig UE54 to: %s" % plugin) +os.startfile(str(plugin.parent))