Create custom exports similar to Vector3

Godot Version

v4.3.stable.mono.official [77dcf97d8]

Question

When you export a Vector3 variable you get this nice, compact editing interface in the Inspector.
image
But if I wanted to export three simple integer variables, I get them all on seperate rows.

Is it possible to recreate the Vector3 export style for similar custom objects?

No, but you could export a vector then in the setter set each of your ints from the xyz, there is also export_custom but it isnt well explained.

I was kind of hoping it was possible to recreate it with export_custom or _get_property_list, but have no idea how I would do that and I can’t find any good resources on those.
A setter function sounds pretty good though.

you can make custom plugin :slight_smile:

1 Like

@FarzadBT
But you can do that easily by exporting Vector3 (float) or Vector3i (int), isn’t that what you need? Why would you need custom exports?

@export var exported_vector_float: Vector3
@export var exported_vector_int: Vector3i

obraz

for similar custom objects?

In this case I’m working on a Hex object using Axial coordinate system (from Hexagonal Grids) which has two variables, q and r. Yes it can just be represented with a Vector2i where x is q and y is r, but it gets a bit annoying constantly having to do that conversion in your head everytime. Ideally I’d just like my custom Hex object to have a similar export interface as a Vector2i, except with q and r instead of x and y.