Godot: export enum, or enum hint for int export

Created on 25 Oct 2017  路  4Comments  路  Source: godotengine/godot

Operating system or device, Godot version, GPU Model and driver (if graphics related):
godot 832a5369ef061a11c3a44ef0b51f667fef676e23

Issue description:

Now that godot has enums, it would be really useful to be able to export either enum variables or
a hint for exported ints, something like,

enum E {x, y, z}
export (int, E) var my_var

currently we have to do

enum E {x, y, z}
export (int, "x", "y", "z") var my_var  # error prone

Steps to reproduce:

Link to minimal example project:

enhancement editor gdscript

Most helpful comment

I would say just export (E).

All 4 comments

I would say just export (E).

Zylann,

That topic is pretty similar, however it doesn't land on a standardization for the enum export format. One of the proposals is to define the enum within the export, but that leaves the enum unusable for any other modules.
I'd agree that

enum E {x, y, z}
export(E) var myE

Is a much cleaner format. It removes the value of the enum to have to type in string hints for exports using that enum.

Thanks

@DevinPentecost yeah, just linking in case we can close it later

Was this page helpful?
0 / 5 - 0 ratings