diff --git a/dcjsonasset/Changes.html b/dcjsonasset/Changes.html index e550fc7..86468b6 100644 --- a/dcjsonasset/Changes.html +++ b/dcjsonasset/Changes.html @@ -146,6 +146,17 @@
All notable changes to this project will be documented in this file.
Version listed here should match with VersionName
field in DcJsonAsset.uplugin
FInstancedStruct
propertyUE introduced FInstancedStruct
with StructUtils plugin since 5.0 which implements lightweight polymorphic serialization. Given a struct hierarchy like this:
// DcJsonAssetTests/Private/DcTestImports3.h
+USTRUCT(BlueprintType)
+struct FDcJsonAssetTestStructShapeBase
+{
+ // ...
+ UPROPERTY(EditAnywhere) FName ShapeName;
+};
+
+USTRUCT(BlueprintType)
+struct FDcJsonAssetTestStructShapeRectangle : public FDcJsonAssetTestStructShapeBase
+{
+ // ...
+ UPROPERTY(EditAnywhere) float Height;
+ UPROPERTY(EditAnywhere) float Width;
+};
+
+USTRUCT(BlueprintType)
+struct FDcJsonAssetTestStructShapeCircle : public FDcJsonAssetTestStructShapeBase
+{
+ // ...
+ UPROPERTY(EditAnywhere) float Radius;
+};
+
+An asset can be loaded from a JSON like this:
+// DcJsonAssetTests/Private/DcTestImports3.h
+UCLASS()
+class UDcJsonAssetTestAssetInstancedStruct : public UDcPrimaryImportedDataAsset
+{
+ GENERATED_BODY()
+public:
+ UPROPERTY(EditAnywhere) FInstancedStruct Instanced1;
+ UPROPERTY(EditAnywhere) FInstancedStruct Instanced2;
+ UPROPERTY(EditAnywhere) FInstancedStruct Instanced3;
+};
+
+// DcJsonAsset/Tests/DcJsonFixture_InstancedStruct.json
+{
+ "$type" : "DcJsonAssetTestAssetInstancedStruct",
+ "Instanced1" : null,
+ "Instanced2" :
+ {
+ "$type" : "DcJsonAssetTestStructShapeRectangle",
+ "ShapeName" : "MyBox",
+ "Height" : 3,
+ "Width" : 4
+ },
+ "Instanced3" :
+ {
+ "$type" : "DcJsonAssetTestStructShapeCircle",
+ "ShapeName" : "MyCircle",
+ "Radius" : 5
+ }
+}
+
In the root JSON object we now check for some other $meta
fields.
$reimport-keep-instance
UE introduced FInstancedStruct
with StructUtils plugin since 5.0 which implements lightweight polymorphic serialization. Given a struct hierarchy like this:
// DcJsonAssetTests/Private/DcTestImports3.h
+USTRUCT(BlueprintType)
+struct FDcJsonAssetTestStructShapeBase
+{
+ // ...
+ UPROPERTY(EditAnywhere) FName ShapeName;
+};
+
+USTRUCT(BlueprintType)
+struct FDcJsonAssetTestStructShapeRectangle : public FDcJsonAssetTestStructShapeBase
+{
+ // ...
+ UPROPERTY(EditAnywhere) float Height;
+ UPROPERTY(EditAnywhere) float Width;
+};
+
+USTRUCT(BlueprintType)
+struct FDcJsonAssetTestStructShapeCircle : public FDcJsonAssetTestStructShapeBase
+{
+ // ...
+ UPROPERTY(EditAnywhere) float Radius;
+};
+
+An asset can be loaded from a JSON like this:
+// DcJsonAssetTests/Private/DcTestImports3.h
+UCLASS()
+class UDcJsonAssetTestAssetInstancedStruct : public UDcPrimaryImportedDataAsset
+{
+ GENERATED_BODY()
+public:
+ UPROPERTY(EditAnywhere) FInstancedStruct Instanced1;
+ UPROPERTY(EditAnywhere) FInstancedStruct Instanced2;
+ UPROPERTY(EditAnywhere) FInstancedStruct Instanced3;
+};
+
+// DcJsonAsset/Tests/DcJsonFixture_InstancedStruct.json
+{
+ "$type" : "DcJsonAssetTestAssetInstancedStruct",
+ "Instanced1" : null,
+ "Instanced2" :
+ {
+ "$type" : "DcJsonAssetTestStructShapeRectangle",
+ "ShapeName" : "MyBox",
+ "Height" : 3,
+ "Width" : 4
+ },
+ "Instanced3" :
+ {
+ "$type" : "DcJsonAssetTestStructShapeCircle",
+ "ShapeName" : "MyCircle",
+ "Radius" : 5
+ }
+}
+
In the root JSON object we now check for some other $meta
fields.
$reimport-keep-instance
All notable changes to this project will be documented in this file.
Version listed here should match with VersionName
field in DcJsonAsset.uplugin
FInstancedStruct
property