Skip to content

Commit

Permalink
release 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jagt committed Oct 2, 2024
1 parent 4607762 commit d7a7a85
Show file tree
Hide file tree
Showing 31 changed files with 266 additions and 59 deletions.
4 changes: 0 additions & 4 deletions DataConfig/DataConfig.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@
{
"Name": "SQLiteCore",
"Enabled": true
},
{
"Name": "StructUtils",
"Enabled": true
}
]
}
64 changes: 64 additions & 0 deletions DataConfig/DataConfig54.uplugin
Original file line number Diff line number Diff line change
@@ -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
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ FString FDcAutomationBase::CheckUniqueName(const FString& InName)
return InName;
}

uint32 FDcAutomationBase::GetTestFlags() const
FDcAutomationBase::FlagsType FDcAutomationBase::GetTestFlags() const
{
return FLAGS;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -7,6 +11,7 @@ PER_MODULE_BOILERPLATE

#endif

#endif // !UE_VERSION_OLDER_THAN(5, 5, 0)

namespace DcCorePrivate {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -399,16 +400,16 @@ struct FDcReadStateOptional : public FDcBaseReadState

void FormatHighlightSegment(TArray<FString>& OutSegments, DcPropertyHighlight::EFormatSeg SegType) override;
};
static_assert(TIsTriviallyDestructible<FDcReadStateOptional>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcReadStateOptional>::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<FDcReadStateClass>::Value, "need trivial destructible");
static_assert(TIsTriviallyDestructible<FDcReadStateStruct>::Value, "need trivial destructible");
static_assert(TIsTriviallyDestructible<FDcReadStateMap>::Value, "need trivial destructible");
static_assert(TIsTriviallyDestructible<FDcReadStateArray>::Value, "need trivial destructible");
static_assert(TIsTriviallyDestructible<FDcReadStateSet>::Value, "need trivial destructible");
static_assert(TIsTriviallyDestructible<FDcReadStateScalar>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcReadStateClass>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcReadStateStruct>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcReadStateMap>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcReadStateArray>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcReadStateSet>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcReadStateScalar>::Value, "need trivial destructible");


Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ FDcResult FDcPropertyReader::ReadBlob(FDcBlobViewData* OutPtr)
{
*OutPtr = {
(uint8*)ScriptArray.GetRawPtr(),
ScriptArray.Num() * ArrayProperty->Inner->ElementSize
ScriptArray.Num() * DcPropertyUtils::ElementSize(ArrayProperty->Inner)
};
}

Expand All @@ -732,7 +732,7 @@ FDcResult FDcPropertyReader::ReadBlob(FDcBlobViewData* OutPtr)
{
*OutPtr = {
(uint8*)Datum.DataPtr,
Prop->ArrayDim * Prop->ElementSize
Prop->ArrayDim * DcPropertyUtils::ElementSize(Prop)
};
}

Expand All @@ -748,7 +748,7 @@ FDcResult FDcPropertyReader::ReadBlob(FDcBlobViewData* OutPtr)
{
*OutPtr = {
(uint8*)Datum.DataPtr,
StructProperty->ElementSize
DcPropertyUtils::ElementSize(StructProperty)
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -347,7 +348,7 @@ struct FDcWriteStateOptional : public FDcBaseWriteState

void FormatHighlightSegment(TArray<FString>& OutSegments, DcPropertyHighlight::EFormatSeg SegType) override;
};
static_assert(TIsTriviallyDestructible<FDcWriteStateOptional>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcWriteStateOptional>::Value, "need trivial destructible");
#endif // !UE_VERSION_OLDER_THAN(5, 4, 0)

struct FDcWriteStateScalar : public FDcBaseWriteState
Expand Down Expand Up @@ -424,9 +425,9 @@ FDcResult WriteValue(FDcPropertyWriter* Parent, FDcBaseWriteState& State, const
return DcOk();
}

static_assert(TIsTriviallyDestructible<FDcWriteStateClass>::Value, "need trivial destructible");
static_assert(TIsTriviallyDestructible<FDcWriteStateStruct>::Value, "need trivial destructible");
static_assert(TIsTriviallyDestructible<FDcWriteStateMap>::Value, "need trivial destructible");
static_assert(TIsTriviallyDestructible<FDcWriteStateArray>::Value, "need trivial destructible");
static_assert(TIsTriviallyDestructible<FDcWriteStateSet>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcWriteStateClass>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcWriteStateStruct>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcWriteStateMap>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcWriteStateArray>::Value, "need trivial destructible");
static_assert(DcTypeUtils::TIsTriviallyDestructible<FDcWriteStateSet>::Value, "need trivial destructible");

Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ FDcResult FDcPropertyWriter::WriteBlob(const FDcBlobViewData& Value)
FArrayProperty* ArrayProperty = Datum.CastFieldChecked<FArrayProperty>();
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;
Expand All @@ -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;

Expand All @@ -764,8 +764,9 @@ FDcResult FDcPropertyWriter::WriteBlob(const FDcBlobViewData& Value)

FStructProperty* StructProperty = Datum.CastFieldChecked<FStructProperty>();

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@
#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
{
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)
Expand All @@ -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);
Expand Down Expand Up @@ -93,7 +100,7 @@ struct DATACONFIGCORE_API FDcAutomationConsoleRunner
{
TArray<FString> Filters;
TArray<FString> Parameters;
uint32 RequestedTestFilter;
FDcAutomationBase::FlagsType RequestedTestFilter;
};

static FArgs FromCommandlineTokens(const TArray<FString>& Tokens);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -105,5 +109,15 @@ struct TRemoveConst
};


template <typename T>
struct TIsTriviallyDestructible
{
#if UE_VERSION_OLDER_THAN(5, 5, 0)
enum { Value = ::TIsTriviallyDestructible<T>::Value };
#else
enum { Value = std::is_trivially_destructible_v<T> };
#endif
};

} // namespace DcTypeUtils

Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ FORCEINLINE UScriptStruct* CastFieldVariant<UScriptStruct>(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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ DC_TEST("DataConfig.EditorExtra.GameplayAbility")
"CostGameplayEffectClass" : "/DataConfig/DcFixture/DcTestGameplayEffectAlpha",
/// Advanced
"ReplicationPolicy" : "ReplicateYes",
"InstancingPolicy" : "NonInstanced",
"InstancingPolicy" : "InstancedPerActor",
}
)");
FDcJsonReader Reader(Str);
Expand All @@ -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"))
));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit d7a7a85

Please sign in to comment.