Skip to content

Commit f6da4cc

Browse files
committed
Add inherited enums
1 parent b9169b3 commit f6da4cc

File tree

8 files changed

+143
-121
lines changed

8 files changed

+143
-121
lines changed

GDExtensionBindgen/LuaError.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ public enum StatusEnum : long
6565

6666
#endregion
6767

68+
#region Inherited Enums
69+
70+
public enum ConnectFlagsEnum : long
71+
{
72+
ConnectDeferred = 1L,
73+
ConnectPersist = 2L,
74+
ConnectOneShot = 4L,
75+
ConnectReferenceCounted = 8L,
76+
}
77+
78+
#endregion
79+
6880
#region Inherited Integer Constants
6981

7082
public const long NotificationPostinitialize = 0L;
@@ -73,14 +85,6 @@ public enum StatusEnum : long
7385

7486
public const long NotificationExtensionReloaded = 2L;
7587

76-
public const long ConnectDeferred = 1L;
77-
78-
public const long ConnectPersist = 2L;
79-
80-
public const long ConnectOneShot = 4L;
81-
82-
public const long ConnectReferenceCounted = 8L;
83-
8488
#endregion
8589

8690
#region Properties

GDExtensionBindgen/LuaObject.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ public class SignalName : RefCounted.SignalName
4646

4747
private static readonly StringName NativeName = "LuaObject";
4848

49+
#region Inherited Enums
50+
51+
public enum ConnectFlagsEnum : long
52+
{
53+
ConnectDeferred = 1L,
54+
ConnectPersist = 2L,
55+
ConnectOneShot = 4L,
56+
ConnectReferenceCounted = 8L,
57+
}
58+
59+
#endregion
60+
4961
#region Inherited Integer Constants
5062

5163
public const long NotificationPostinitialize = 0L;
@@ -54,14 +66,6 @@ public class SignalName : RefCounted.SignalName
5466

5567
public const long NotificationExtensionReloaded = 2L;
5668

57-
public const long ConnectDeferred = 1L;
58-
59-
public const long ConnectPersist = 2L;
60-
61-
public const long ConnectOneShot = 4L;
62-
63-
public const long ConnectReferenceCounted = 8L;
64-
6569
#endregion
6670

6771
#region Methods

GDExtensionBindgen/LuaScript.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ public class SignalName : ScriptExtension.SignalName
4545

4646
private static readonly StringName NativeName = "LuaScript";
4747

48+
#region Inherited Enums
49+
50+
public enum ConnectFlagsEnum : long
51+
{
52+
ConnectDeferred = 1L,
53+
ConnectPersist = 2L,
54+
ConnectOneShot = 4L,
55+
ConnectReferenceCounted = 8L,
56+
}
57+
58+
#endregion
59+
4860
#region Inherited Integer Constants
4961

5062
public const long NotificationPostinitialize = 0L;
@@ -53,14 +65,6 @@ public class SignalName : ScriptExtension.SignalName
5365

5466
public const long NotificationExtensionReloaded = 2L;
5567

56-
public const long ConnectDeferred = 1L;
57-
58-
public const long ConnectPersist = 2L;
59-
60-
public const long ConnectOneShot = 4L;
61-
62-
public const long ConnectReferenceCounted = 8L;
63-
6468
#endregion
6569

6670
#region Inherited Properties

GDExtensionBindgen/LuaScriptLanguage.cs

Lines changed: 53 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -45,84 +45,73 @@ public class SignalName : ScriptLanguageExtension.SignalName
4545

4646
private static readonly StringName NativeName = "LuaScriptLanguage";
4747

48-
#region Inherited Integer Constants
49-
50-
public const long LookupResultScriptLocation = 0L;
51-
52-
public const long LookupResultClass = 1L;
53-
54-
public const long LookupResultClassConstant = 2L;
55-
56-
public const long LookupResultClassProperty = 3L;
57-
58-
public const long LookupResultClassMethod = 4L;
59-
60-
public const long LookupResultClassSignal = 5L;
61-
62-
public const long LookupResultClassEnum = 6L;
63-
64-
public const long LookupResultClassTbdGlobalscope = 7L;
65-
66-
public const long LookupResultClassAnnotation = 8L;
67-
68-
public const long LookupResultLocalConstant = 9L;
69-
70-
public const long LookupResultLocalVariable = 10L;
71-
72-
public const long LookupResultMax = 11L;
73-
74-
public const long LocationLocal = 0L;
75-
76-
public const long LocationParentMask = 256L;
77-
78-
public const long LocationOtherUserCode = 512L;
79-
80-
public const long LocationOther = 1024L;
81-
82-
public const long CodeCompletionKindClass = 0L;
83-
84-
public const long CodeCompletionKindFunction = 1L;
85-
86-
public const long CodeCompletionKindSignal = 2L;
87-
88-
public const long CodeCompletionKindVariable = 3L;
48+
#region Inherited Enums
8949

90-
public const long CodeCompletionKindMember = 4L;
91-
92-
public const long CodeCompletionKindEnum = 5L;
93-
94-
public const long CodeCompletionKindConstant = 6L;
95-
96-
public const long CodeCompletionKindNodePath = 7L;
97-
98-
public const long CodeCompletionKindFilePath = 8L;
50+
public enum LookupResultTypeEnum : long
51+
{
52+
LookupResultScriptLocation = 0L,
53+
LookupResultClass = 1L,
54+
LookupResultClassConstant = 2L,
55+
LookupResultClassProperty = 3L,
56+
LookupResultClassMethod = 4L,
57+
LookupResultClassSignal = 5L,
58+
LookupResultClassEnum = 6L,
59+
LookupResultClassTbdGlobalscope = 7L,
60+
LookupResultClassAnnotation = 8L,
61+
LookupResultLocalConstant = 9L,
62+
LookupResultLocalVariable = 10L,
63+
LookupResultMax = 11L,
64+
}
9965

100-
public const long CodeCompletionKindPlainText = 9L;
66+
public enum CodeCompletionLocationEnum : long
67+
{
68+
LocationLocal = 0L,
69+
LocationParentMask = 256L,
70+
LocationOtherUserCode = 512L,
71+
LocationOther = 1024L,
72+
}
10173

102-
public const long CodeCompletionKindMax = 10L;
74+
public enum CodeCompletionKindEnum : long
75+
{
76+
CodeCompletionKindClass = 0L,
77+
CodeCompletionKindFunction = 1L,
78+
CodeCompletionKindSignal = 2L,
79+
CodeCompletionKindVariable = 3L,
80+
CodeCompletionKindMember = 4L,
81+
CodeCompletionKindEnum = 5L,
82+
CodeCompletionKindConstant = 6L,
83+
CodeCompletionKindNodePath = 7L,
84+
CodeCompletionKindFilePath = 8L,
85+
CodeCompletionKindPlainText = 9L,
86+
CodeCompletionKindMax = 10L,
87+
}
10388

104-
public const long ScriptNameCasingAuto = 0L;
89+
public enum ScriptNameCasingEnum : long
90+
{
91+
ScriptNameCasingAuto = 0L,
92+
ScriptNameCasingPascalCase = 1L,
93+
ScriptNameCasingSnakeCase = 2L,
94+
ScriptNameCasingKebabCase = 3L,
95+
}
10596

106-
public const long ScriptNameCasingPascalCase = 1L;
97+
public enum ConnectFlagsEnum : long
98+
{
99+
ConnectDeferred = 1L,
100+
ConnectPersist = 2L,
101+
ConnectOneShot = 4L,
102+
ConnectReferenceCounted = 8L,
103+
}
107104

108-
public const long ScriptNameCasingSnakeCase = 2L;
105+
#endregion
109106

110-
public const long ScriptNameCasingKebabCase = 3L;
107+
#region Inherited Integer Constants
111108

112109
public const long NotificationPostinitialize = 0L;
113110

114111
public const long NotificationPredelete = 1L;
115112

116113
public const long NotificationExtensionReloaded = 2L;
117114

118-
public const long ConnectDeferred = 1L;
119-
120-
public const long ConnectPersist = 2L;
121-
122-
public const long ConnectOneShot = 4L;
123-
124-
public const long ConnectReferenceCounted = 8L;
125-
126115
#endregion
127116

128117
#region Inherited Methods

GDExtensionBindgen/LuaScriptResourceFormatLoader.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,35 @@ public class SignalName : ResourceFormatLoader.SignalName
4545

4646
private static readonly StringName NativeName = "LuaScriptResourceFormatLoader";
4747

48-
#region Inherited Integer Constants
49-
50-
public const long CacheModeIgnore = 0L;
48+
#region Inherited Enums
5149

52-
public const long CacheModeReuse = 1L;
50+
public enum CacheModeEnum : long
51+
{
52+
CacheModeIgnore = 0L,
53+
CacheModeReuse = 1L,
54+
CacheModeReplace = 2L,
55+
CacheModeIgnoreDeep = 3L,
56+
CacheModeReplaceDeep = 4L,
57+
}
5358

54-
public const long CacheModeReplace = 2L;
59+
public enum ConnectFlagsEnum : long
60+
{
61+
ConnectDeferred = 1L,
62+
ConnectPersist = 2L,
63+
ConnectOneShot = 4L,
64+
ConnectReferenceCounted = 8L,
65+
}
5566

56-
public const long CacheModeIgnoreDeep = 3L;
67+
#endregion
5768

58-
public const long CacheModeReplaceDeep = 4L;
69+
#region Inherited Integer Constants
5970

6071
public const long NotificationPostinitialize = 0L;
6172

6273
public const long NotificationPredelete = 1L;
6374

6475
public const long NotificationExtensionReloaded = 2L;
6576

66-
public const long ConnectDeferred = 1L;
67-
68-
public const long ConnectPersist = 2L;
69-
70-
public const long ConnectOneShot = 4L;
71-
72-
public const long ConnectReferenceCounted = 8L;
73-
7477
#endregion
7578

7679
#region Inherited Methods

GDExtensionBindgen/LuaScriptResourceFormatSaver.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ public class SignalName : ResourceFormatSaver.SignalName
4545

4646
private static readonly StringName NativeName = "LuaScriptResourceFormatSaver";
4747

48+
#region Inherited Enums
49+
50+
public enum ConnectFlagsEnum : long
51+
{
52+
ConnectDeferred = 1L,
53+
ConnectPersist = 2L,
54+
ConnectOneShot = 4L,
55+
ConnectReferenceCounted = 8L,
56+
}
57+
58+
#endregion
59+
4860
#region Inherited Integer Constants
4961

5062
public const long NotificationPostinitialize = 0L;
@@ -53,14 +65,6 @@ public class SignalName : ResourceFormatSaver.SignalName
5365

5466
public const long NotificationExtensionReloaded = 2L;
5567

56-
public const long ConnectDeferred = 1L;
57-
58-
public const long ConnectPersist = 2L;
59-
60-
public const long ConnectOneShot = 4L;
61-
62-
public const long ConnectReferenceCounted = 8L;
63-
6468
#endregion
6569

6670
#region Inherited Methods

GDExtensionBindgen/LuaState.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ public enum LibraryEnum : long
8282

8383
#endregion
8484

85+
#region Inherited Enums
86+
87+
public enum ConnectFlagsEnum : long
88+
{
89+
ConnectDeferred = 1L,
90+
ConnectPersist = 2L,
91+
ConnectOneShot = 4L,
92+
ConnectReferenceCounted = 8L,
93+
}
94+
95+
#endregion
96+
8597
#region Inherited Integer Constants
8698

8799
public const long NotificationPostinitialize = 0L;
@@ -90,14 +102,6 @@ public enum LibraryEnum : long
90102

91103
public const long NotificationExtensionReloaded = 2L;
92104

93-
public const long ConnectDeferred = 1L;
94-
95-
public const long ConnectPersist = 2L;
96-
97-
public const long ConnectOneShot = 4L;
98-
99-
public const long ConnectReferenceCounted = 8L;
100-
101105
#endregion
102106

103107
#region Properties

addons/csharp_gdextension_bindgen/csharp_gdextension_bindgen.gd

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@ func generate_csharp_script(cls_name: StringName):
9999
var enums = PackedStringArray()
100100
for enum_name in ClassDB.class_get_enum_list(cls_name, true):
101101
enums.append(_generate_enum(cls_name, enum_name))
102-
102+
103+
var inherited_enums = PackedStringArray()
104+
if not parent_class_is_extension:
105+
for inherited_class in _get_parent_classes(cls_name):
106+
for enum_name in ClassDB.class_get_enum_list(inherited_class, true):
107+
inherited_enums.append(_generate_enum(inherited_class, enum_name))
108+
103109
# INTEGER CONSTANTS
104110
var integer_constants = PackedStringArray()
105111
for constant_name in ClassDB.class_get_integer_constant_list(cls_name, true):
@@ -111,7 +117,7 @@ func generate_csharp_script(cls_name: StringName):
111117
if not parent_class_is_extension:
112118
for inherited_class in _get_parent_classes(cls_name):
113119
for constant_name in ClassDB.class_get_integer_constant_list(inherited_class, true):
114-
if not ClassDB.class_get_integer_constant_enum(cls_name, constant_name, true).is_empty():
120+
if not ClassDB.class_get_integer_constant_enum(inherited_class, constant_name, true).is_empty():
115121
continue
116122
inherited_integer_constants.append(_generate_integer_constant(inherited_class, constant_name))
117123

@@ -174,6 +180,10 @@ func generate_csharp_script(cls_name: StringName):
174180
regions.append("#region Enums")
175181
regions.append("\n\n".join(enums))
176182
regions.append("#endregion")
183+
if not inherited_enums.is_empty():
184+
regions.append("#region Inherited Enums")
185+
regions.append("\n\n".join(inherited_enums))
186+
regions.append("#endregion")
177187
if not integer_constants.is_empty():
178188
regions.append("#region Integer Constants")
179189
regions.append("\n\n".join(integer_constants))

0 commit comments

Comments
 (0)