Open
Description
Allow for exposing default function parameters to GDScript.
The proposed syntax would look like:
#[godot_api]
impl MyType {
#[func(defaults = [ 1 ]]
fn some_func(a: Option<i32>) -> i32 {
a.unwrap_or(1)
}
}
This would map roughly to this in C++:
ClassDB::bind_method(D_METHOD("some_func", "a"), &MyType::some_func, DEFVAL(1));
Ideally the macro would also allow for function calls from Godot to automatically insert the default parameters as well so that Option<T>
is not required, but I'm not sure if that's feasible.
WIP in #380