@@ -28,10 +28,10 @@ internal static class PropertyMapper
2828 FStrProperty => new RepPropInfo ( name , "string" , arrayDim ) ,
2929 FNameProperty => new RepPropInfo ( name , "name" , arrayDim ) ,
3030 FTextProperty => new RepPropInfo ( name , "text" , arrayDim ) ,
31- FClassProperty => new RepPropInfo ( name , "class_ref" , arrayDim ) ,
31+ FClassProperty cp => MapClassRef ( name , cp , arrayDim ) ,
3232 FSoftObjectProperty => new RepPropInfo ( name , "soft_obj" , arrayDim ) ,
3333 FWeakObjectProperty => new RepPropInfo ( name , "weak_obj" , arrayDim ) ,
34- FObjectProperty => new RepPropInfo ( name , "object" , arrayDim ) ,
34+ FObjectProperty op => MapObject ( name , op , arrayDim ) ,
3535 FInterfaceProperty => new RepPropInfo ( name , "interface" , arrayDim ) ,
3636 FStructProperty sp => MapStruct ( name , sp , arrayDim ) ,
3737 FArrayProperty ap => MapArray ( name , ap , arrayDim ) ,
@@ -47,6 +47,7 @@ private static RepPropInfo MapByte(string name, FByteProperty bp, int arrayDim)
4747 {
4848 var info = new RepPropInfo ( name , "byte" , arrayDim ) { EnumName = bp . Enum . Name } ;
4949 info . Bits = EnumHelper . ComputeMax ( bp . Enum ) ;
50+ info . EnumValues = EnumHelper . GetValues ( bp . Enum ) ;
5051 return info ;
5152 }
5253 return new RepPropInfo ( name , "byte" , arrayDim ) ;
@@ -56,14 +57,57 @@ private static RepPropInfo MapEnum(string name, FEnumProperty ep, int arrayDim)
5657 {
5758 var enumName = ! ep . Enum . IsNull ? ep . Enum . Name : null ;
5859 var info = new RepPropInfo ( name , "byte" , arrayDim ) { EnumName = enumName } ;
59- if ( ! ep . Enum . IsNull ) info . Bits = EnumHelper . ComputeMax ( ep . Enum ) ;
60+ if ( ! ep . Enum . IsNull )
61+ {
62+ info . Bits = EnumHelper . ComputeMax ( ep . Enum ) ;
63+ info . EnumValues = EnumHelper . GetValues ( ep . Enum ) ;
64+ }
6065 return info ;
6166 }
6267
6368 private static RepPropInfo MapStruct ( string name , FStructProperty sp , int arrayDim )
6469 {
6570 var sn = ! sp . Struct . IsNull ? sp . Struct . Name : "Unknown" ;
66- return new RepPropInfo ( name , $ "struct:{ sn } ", arrayDim ) { StructType = sn } ;
71+ var info = new RepPropInfo ( name , $ "struct:{ sn } ", arrayDim ) { StructType = sn } ;
72+ info . StructFields = ExpandStructFields ( sp . Struct ) ;
73+ return info ;
74+ }
75+
76+ private static RepPropInfo MapClassRef ( string name , FClassProperty cp , int arrayDim )
77+ {
78+ var info = new RepPropInfo ( name , "class_ref" , arrayDim ) ;
79+ if ( cp . MetaClass is { IsNull : false } )
80+ info . MetaClass = cp . MetaClass . Name ;
81+ return info ;
82+ }
83+
84+ private static RepPropInfo MapObject ( string name , FObjectProperty op , int arrayDim )
85+ {
86+ var info = new RepPropInfo ( name , "object" , arrayDim ) ;
87+ if ( op . PropertyClass is { IsNull : false } )
88+ info . ObjectClass = op . PropertyClass . Name ;
89+ return info ;
90+ }
91+
92+ private static List < RepPropInfo > ? ExpandStructFields ( FPackageIndex structRef )
93+ {
94+ try
95+ {
96+ if ( structRef . IsNull ) return null ;
97+ var ueStruct = structRef . Load < UStruct > ( ) ;
98+ if ( ueStruct ? . ChildProperties == null || ueStruct . ChildProperties . Length == 0 )
99+ return null ;
100+
101+ var fields = new List < RepPropInfo > ( ) ;
102+ foreach ( var child in ueStruct . ChildProperties )
103+ {
104+ if ( child is not FProperty prop ) continue ;
105+ var mapped = Map ( prop ) ;
106+ if ( mapped != null ) fields . Add ( mapped ) ;
107+ }
108+ return fields . Count > 0 ? fields : null ;
109+ }
110+ catch { return null ; }
67111 }
68112
69113 private static RepPropInfo MapArray ( string name , FArrayProperty ap , int arrayDim )
@@ -93,6 +137,28 @@ private static RepPropInfo MapMap(string name, FMapProperty mp, int arrayDim)
93137
94138internal static class EnumHelper
95139{
140+ public static Dictionary < string , long > ? GetValues ( FPackageIndex enumRef )
141+ {
142+ try
143+ {
144+ var ueEnum = enumRef . Load < UEnum > ( ) ;
145+ if ( ueEnum == null || ueEnum . Names . Length == 0 ) return null ;
146+
147+ var values = new Dictionary < string , long > ( ) ;
148+ foreach ( var ( name , value ) in ueEnum . Names )
149+ {
150+ var s = name . ToString ( ) ;
151+ var pos = s . LastIndexOf ( "::" , StringComparison . Ordinal ) ;
152+ if ( pos >= 0 ) s = s [ ( pos + 2 ) ..] ;
153+ if ( s . Equals ( "MAX" , StringComparison . OrdinalIgnoreCase )
154+ || s . EndsWith ( "_MAX" , StringComparison . OrdinalIgnoreCase ) ) continue ;
155+ values [ s ] = value ;
156+ }
157+ return values . Count > 0 ? values : null ;
158+ }
159+ catch { return null ; }
160+ }
161+
96162 public static int ? ComputeMax ( FPackageIndex enumRef )
97163 {
98164 try
0 commit comments