-
-
Notifications
You must be signed in to change notification settings - Fork 260
Open
Labels
c: registerRegister classes, functions and other symbols to GDScriptRegister classes, functions and other symbols to GDScriptquality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internals
Description
When creating an enum such as the following:
#[derive(GodotConvert, Var, Export, Clone, Copy)]
#[godot(via = u8)]
pub enum WeaponType {
Axe,
Sword,
Lance,
}If you then use the enum as an export/var.
#[derive(GodotClass)]
#[class(init, base=Node)]
pub struct MyCustomNode {
base: Base<Node>,
#[export]
weapon_type: WeaponType,
}The generated getter and setter for this uses the Via type instead of the enum. This results in the following code getting sprinkled around in Rust.
let weapon_type = MyCustomNode::from_godot(my_node.bind().get_weapon_type());This can be a lot to type from an ergonomics perspective. It would be nice if there was a way to have the getters and setters use the enum type directly instead of the <T as GodotConvert>::Via type or to have some alternative method or way to go about writing the above.
Metadata
Metadata
Assignees
Labels
c: registerRegister classes, functions and other symbols to GDScriptRegister classes, functions and other symbols to GDScriptquality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internals