Make global scope enums accessible as types in GDScript
Add functions to CoreConstant so enums can be properly deduced. Also add the enums in release builds to make consistent with ClassDB enums and avoid differences in script compilation between debug and release.
This commit is contained in:
parent
28db611f0f
commit
75f16b8167
21 changed files with 355 additions and 87 deletions
|
|
@ -0,0 +1,30 @@
|
|||
func test():
|
||||
var type: Variant.Type
|
||||
type = Variant.Type.TYPE_INT
|
||||
print(type)
|
||||
type = TYPE_FLOAT
|
||||
print(type)
|
||||
|
||||
var direction: ClockDirection
|
||||
direction = ClockDirection.CLOCKWISE
|
||||
print(direction)
|
||||
direction = COUNTERCLOCKWISE
|
||||
print(direction)
|
||||
|
||||
var duper := Duper.new()
|
||||
duper.set_type(Variant.Type.TYPE_INT)
|
||||
duper.set_type(TYPE_FLOAT)
|
||||
duper.set_direction(ClockDirection.CLOCKWISE)
|
||||
duper.set_direction(COUNTERCLOCKWISE)
|
||||
|
||||
class Super:
|
||||
func set_type(type: Variant.Type) -> void:
|
||||
print(type)
|
||||
func set_direction(dir: ClockDirection) -> void:
|
||||
print(dir)
|
||||
|
||||
class Duper extends Super:
|
||||
func set_type(type: Variant.Type) -> void:
|
||||
print(type)
|
||||
func set_direction(dir: ClockDirection) -> void:
|
||||
print(dir)
|
||||
Loading…
Add table
Add a link
Reference in a new issue