File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
itest/hot-reload/rust/src Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ struct Reloadable {
28
28
#[ export]
29
29
#[ init( val = Planet :: Earth ) ]
30
30
favorite_planet : Planet ,
31
+
32
+ #[ init( val = NoDefault :: obtain( ) ) ]
33
+ _other_object : Gd < NoDefault > ,
31
34
}
32
35
33
36
#[ godot_api]
@@ -41,10 +44,24 @@ impl Reloadable {
41
44
fn from_string ( s : GString ) -> Gd < Self > {
42
45
Gd :: from_object ( Reloadable {
43
46
favorite_planet : Planet :: from_godot ( s) ,
47
+ _other_object : NoDefault :: obtain ( ) ,
44
48
} )
45
49
}
46
50
}
47
51
52
+ // no_init reloadability - https://github.com/godot-rust/gdext/issues/874.
53
+ #[ derive( GodotClass ) ]
54
+ #[ class( no_init, base=Node ) ]
55
+ struct NoDefault { }
56
+
57
+ #[ godot_api]
58
+ impl NoDefault {
59
+ #[ func]
60
+ fn obtain ( ) -> Gd < Self > {
61
+ Gd :: from_object ( NoDefault { } )
62
+ }
63
+ }
64
+
48
65
// ----------------------------------------------------------------------------------------------------------------------------------------------
49
66
50
67
#[ derive( GodotConvert , Var , Export ) ]
You can’t perform that action at this time.
0 commit comments