9595 VER_UE4_SKINWEIGHT_PROFILE_DATA_LAYOUT_CHANGES = 519 ,
9696 VER_UE4_NON_OUTER_PACKAGE_IMPORT = 520 ,
9797 VER_UE4_26 = 522 ,
98- VER_UE4_27 = 523 , //?? TODO
98+ VER_UE4_27 = 522 ,
9999 // look for NEW_ENGINE_VERSION over the code to find places where version constants should be inserted.
100100 // LATEST_SUPPORTED_UE4_VERSION should be updated too.
101101};
102102
103103int GetUE4CustomVersion (const FArchive & Ar , const FGuid & Guid );
104104
105+
106+ /*
107+ * Rules for writing code for custom versions
108+ * - Each version is a "struct". Ideally could use "enum class", however we're adding some code into it, so "struct" is ideal.
109+ * - Use "enum Type" inside of it.
110+ * - Each enum has members:
111+ * - VersionPlusOne - equals to the recent declared constant + 1, used to correctly set up LatestVersion without explicit
112+ * mentioning of the latest constant name.
113+ * - optional: ForceVersion - use it in a case we're not declaring the latest version as a constant, so LatestVersion value
114+ * will work correctly.
115+ * - There's "static Type Get(const FArchive& Ar)" function, it computes custom version based on Game constant. Needed in order
116+ * to make unversioned packages to work.
117+ * - This function does comparison of game constant with engine number PLUS ONE, so games which are derived from e.g. UE4.25
118+ * will work correctly after using logic "Game < GAME_UE4(26)", i.e. game is using engine smaller than UE4.26. If we'll use
119+ * "Game <= GAME_UE4.25", this WILL work for UE4.25, but not for 4.25-based games which has custom override.
120+ */
121+
105122struct FFrameworkObjectVersion
106123{
107124 enum Type
@@ -124,7 +141,9 @@ struct FFrameworkObjectVersion
124141 // UE4.20, UE4.21 = 34
125142 // UE4.22, UE4.23 = 35
126143 // UE4.24 = 36
127- // UE4.25, UE4.26 = 37
144+ // UE4.25-UE4.27 = 37
145+
146+ ForceVersion = 37 , // the recent version, added here just to force LatestVersion to be correct
128147
129148 VersionPlusOne ,
130149 LatestVersion = VersionPlusOne - 1
@@ -165,10 +184,10 @@ struct FFrameworkObjectVersion
165184 return (Type )35 ;
166185 if (Ar .Game < GAME_UE4 (25 ))
167186 return (Type )36 ;
168- // if (Ar.Game < GAME_UE4(27 ))
187+ if (Ar .Game < GAME_UE4 (28 ))
169188 return (Type )37 ;
170189 // NEW_ENGINE_VERSION
171- // return LatestVersion;
190+ return LatestVersion ;
172191 }
173192};
174193
@@ -195,7 +214,9 @@ struct FEditorObjectVersion
195214 // UE4.23 = 34
196215 // UE4.24 = 37
197216 // UE4.25 = 38
198- // UE4.26 = 40
217+ // UE4.26, UE4.27 = 40
218+
219+ ForceVersion = 40 ,
199220
200221 VersionPlusOne ,
201222 LatestVersion = VersionPlusOne - 1
@@ -243,10 +264,10 @@ struct FEditorObjectVersion
243264 return (Type )37 ;
244265 if (Ar .Game < GAME_UE4 (26 ))
245266 return (Type )38 ;
246- // if (Ar.Game < GAME_UE4(27 ))
267+ if (Ar .Game < GAME_UE4 (28 ))
247268 return (Type )40 ;
248269 // NEW_ENGINE_VERSION
249- // return LatestVersion;
270+ return LatestVersion ;
250271 }
251272};
252273
@@ -278,7 +299,7 @@ struct FSkeletalMeshCustomVersion
278299 SectionIgnoreByReduceAdded = 16 ,
279300 // UE4.23-UE4.25 = 17
280301 SkinWeightProfiles = 17 , //todo: FSkeletalMeshLODModel::Serialize (editor mesh)
281- // UE4.26 = 18
302+ // UE4.26, UE4.27 = 18
282303 RemoveEnableClothLOD = 18 , //todo
283304
284305 VersionPlusOne ,
@@ -316,10 +337,10 @@ struct FSkeletalMeshCustomVersion
316337 return SectionIgnoreByReduceAdded ;
317338 if (Ar .Game < GAME_UE4 (26 ))
318339 return SkinWeightProfiles ;
319- // if (Ar.Game < GAME_UE4(27 ))
340+ if (Ar .Game < GAME_UE4 (28 ))
320341 return RemoveEnableClothLOD ;
321342 // NEW_ENGINE_VERSION
322- // return LatestVersion;
343+ return LatestVersion ;
323344 }
324345};
325346
@@ -333,7 +354,7 @@ struct FCoreObjectVersion
333354 // UE4.15-UE4.21 = 2
334355 // UE4.22-UE4.24 = 3
335356 SkeletalMaterialEditorDataStripping = 3 ,
336- // UE4.25-UE4.26 = 4
357+ // UE4.25-UE4.27 = 4
337358
338359 VersionPlusOne ,
339360 LatestVersion = VersionPlusOne - 1
@@ -353,10 +374,10 @@ struct FCoreObjectVersion
353374 return (Type )2 ;
354375 if (Ar .Game < GAME_UE4 (25 ))
355376 return SkeletalMaterialEditorDataStripping ;
356- // if (Ar.Game < GAME_UE4(27 ))
377+ if (Ar .Game < GAME_UE4 (28 ))
357378 return (Type )4 ;
358379 // NEW_ENGINE_VERSION
359- // return LatestVersion;
380+ return LatestVersion ;
360381 }
361382};
362383
@@ -378,9 +399,12 @@ struct FRenderingObjectVersion
378399 // UE4.22 = 28
379400 // UE4.23 = 31
380401 // UE4.24 = 36
402+ StaticMeshSectionForceOpaqueField = 37 ,
381403 // UE4.25 = 43
382404 // UE4.26 = 44
383- StaticMeshSectionForceOpaqueField = 37 ,
405+ // UE4.27 = 45
406+
407+ ForceVersion = 45 ,
384408
385409 VersionPlusOne ,
386410 LatestVersion = VersionPlusOne - 1
@@ -425,10 +449,12 @@ struct FRenderingObjectVersion
425449 return (Type )36 ;
426450 if (Ar .Game < GAME_UE4 (26 ))
427451 return (Type )43 ;
428- // if (Ar.Game < GAME_UE4(27))
452+ if (Ar .Game < GAME_UE4 (27 ))
429453 return (Type )44 ;
454+ if (Ar .Game < GAME_UE4 (28 ))
455+ return (Type )45 ;
430456 // NEW_ENGINE_VERSION
431- // return LatestVersion;
457+ return LatestVersion ;
432458 }
433459};
434460
@@ -442,7 +468,9 @@ struct FAnimObjectVersion
442468 // UE4.25 = 7
443469 IncreaseBoneIndexLimitPerChunk = 4 ,
444470 UnlimitedBoneInfluences = 5 ,
445- // UE4.26 = 15
471+ // UE4.26, UE4.27 = 15
472+
473+ ForceVersion = 15 ,
446474
447475 VersionPlusOne ,
448476 LatestVersion = VersionPlusOne - 1
@@ -460,11 +488,10 @@ struct FAnimObjectVersion
460488 return StoreMarkerNamesOnSkeleton ;
461489 if (Ar .Game < GAME_UE4 (26 ))
462490 return (Type )7 ;
463- // if (Ar.Game < GAME_UE4(27 ))
491+ if (Ar .Game < GAME_UE4 (28 ))
464492 return (Type )15 ;
465-
466493 // NEW_ENGINE_VERSION
467- // return LatestVersion;
494+ return LatestVersion ;
468495 }
469496};
470497
@@ -481,7 +508,9 @@ struct FAnimPhysObjectVersion
481508 AddLODToCurveMetaData = 12 ,
482509 // UE4.19 = 16
483510 ChangeRetargetSourceReferenceToSoftObjectPtr = 15 ,
484- // UE4.20-UE4.26 = 17
511+ // UE4.20-UE4.27 = 17
512+
513+ ForceVersion = 17 ,
485514
486515 VersionPlusOne ,
487516 LatestVersion = VersionPlusOne - 1
@@ -503,10 +532,10 @@ struct FAnimPhysObjectVersion
503532 return AddLODToCurveMetaData ;
504533 if (Ar .Game < GAME_UE4 (20 ))
505534 return (Type )16 ;
506- // if (Ar.Game < GAME_UE4(27 ))
535+ if (Ar .Game < GAME_UE4 (28 ))
507536 return (Type )17 ;
508537 // NEW_ENGINE_VERSION
509- // return LatestVersion;
538+ return LatestVersion ;
510539 }
511540};
512541
@@ -517,6 +546,9 @@ struct FReleaseObjectVersion
517546 BeforeCustomVersionWasAdded = 0 ,
518547 // UE4.19 = 12
519548 AddSkeletalMeshSectionDisable = 12 ,
549+ // Not used in our code, so for version mapping please refer to "Get()" method below...
550+
551+ ForceVersion = 43 ,
520552
521553 VersionPlusOne ,
522554 LatestVersion = VersionPlusOne - 1
@@ -554,10 +586,12 @@ struct FReleaseObjectVersion
554586 return (Type )28 ;
555587 if (Ar .Game < GAME_UE4 (26 ))
556588 return (Type )30 ;
557- // if (Ar.Game < GAME_UE4(27))
589+ if (Ar .Game < GAME_UE4 (27 ))
558590 return (Type )37 ;
591+ if (Ar .Game < GAME_UE4 (28 ))
592+ return (Type )43 ;
559593 // NEW_ENGINE_VERSION
560- // return LatestVersion;
594+ return LatestVersion ;
561595 }
562596};
563597
@@ -569,6 +603,8 @@ struct FEnterpriseObjectVersion
569603 // UE4.24 = 8
570604 MeshDescriptionBulkDataGuidIsHash = 8 ,
571605
606+ ForceVersion = 10 ,
607+
572608 VersionPlusOne ,
573609 LatestVersion = VersionPlusOne - 1
574610 };
@@ -589,10 +625,10 @@ struct FEnterpriseObjectVersion
589625 return (Type )6 ;
590626 if (Ar .Game < GAME_UE4 (25 ))
591627 return MeshDescriptionBulkDataGuidIsHash ;
592- // if (Ar.Game < GAME_UE4(27 ))
628+ if (Ar .Game < GAME_UE4 (28 ))
593629 return (Type )10 ;
594630 // NEW_ENGINE_VERSION
595- // return LatestVersion;
631+ return LatestVersion ;
596632 }
597633};
598634
0 commit comments