-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
(I'll work on this when the master branch becomes stable again)
GDExtension supports typed arrays as seen here. However, property hints need to be injected. (PROPERTY_HINT_ARRAY_TYPE, with the hint string being the element type)
It'd be nice if we can automate this conversion.
So this:
REG_PROPERTY()
TypedArray<Node> nodes; // The element type has to be a registered type. (Exposed to ClassDB) Nested typed arrays are valid too.Would correspond to something like this: (Ignoring generated prefixes here for brevity)
Array get_nodes() const { return nodes; } // There's a built-in conversion from TypedArrays to Arrays.
void set_nodes(Array p) { nodes = p; } // There's a built-in conversion from Arrays to TypedArrays.
ClassDB::bind_method(D_METHOD("set_nodes", "nodes"), &set_nodes);
ClassDB::bind_method(D_METHOD("get_nodes"), &get_nodes);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "nodes", PROPERTY_HINT_ARRAY_TYPE, "Node"), "set_nodes", "get_nodes");In GDScript, the user will see the property's type as Array[Node].
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels