Skip to content

Commit 727e6c0

Browse files
committed
Fixed Value not being updated on instanced objects
Fixes #5
1 parent d31da1e commit 727e6c0

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

AttributesExtension.uplugin

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
3-
"Version": 5,
4-
"VersionName": "1.3b",
3+
"Version": 6,
4+
"VersionName": "1.3c",
55
"FriendlyName": "Attributes Extension",
66
"Description": "A lightweight attributes system for Unreal Engine 4",
77
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/1f0ba37099a14e228a1ce5e4891ed70a",

Source/Attributes/Public/FloatAttr.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct ATTRIBUTES_API FFloatAttr : public FBaseAttr
5454

5555
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess);
5656

57+
void PostSerialize(const FArchive& Ar);
5758
void PostScriptConstruct();
5859

5960
FFloatModifiedMCDelegate& GetOnModified() { return OnModified; }
@@ -71,6 +72,7 @@ struct TStructOpsTypeTraits<FFloatAttr> : public TStructOpsTypeTraitsBase2<FFloa
7172
enum {
7273
WithNetSerializer = true,
7374
WithNetSharedSerialization = true,
75+
WithPostSerialize = true,
7476
WithPostScriptConstruct = true
7577
};
7678
};
@@ -88,3 +90,12 @@ inline bool FFloatAttr::NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutS
8890
bOutSuccess = true;
8991
return true;
9092
}
93+
94+
inline void FFloatAttr::PostSerialize(const FArchive& Ar)
95+
{
96+
// We refresh serialized value for overrided properties or instanced objects
97+
if(Ar.IsLoading())
98+
{
99+
RefreshValue();
100+
}
101+
}

Source/Attributes/Public/Int32Attr.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct ATTRIBUTES_API FInt32Attr : public FBaseAttr
5353

5454
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess);
5555

56+
void PostSerialize(const FArchive& Ar);
5657
void PostScriptConstruct();
5758

5859
FInt32ModifiedMCDelegate& GetOnModified() { return OnModified; }
@@ -70,6 +71,7 @@ struct TStructOpsTypeTraits<FInt32Attr> : public TStructOpsTypeTraitsBase2<FInt3
7071
enum {
7172
WithNetSerializer = true,
7273
WithNetSharedSerialization = true,
74+
WithPostSerialize = true,
7375
WithPostScriptConstruct = true
7476
};
7577
};
@@ -87,3 +89,12 @@ inline bool FInt32Attr::NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutS
8789
bOutSuccess = true;
8890
return true;
8991
}
92+
93+
inline void FInt32Attr::PostSerialize(const FArchive& Ar)
94+
{
95+
// We refresh serialized value for overrided properties or instanced objects
96+
if(Ar.IsLoading())
97+
{
98+
RefreshValue();
99+
}
100+
}

0 commit comments

Comments
 (0)