@@ -19,9 +19,9 @@ use godot::classes::resource_loader::CacheMode;
19
19
#[ cfg( feature = "codegen-full" ) ]
20
20
use godot:: classes:: Material ;
21
21
use godot:: classes:: {
22
- BoxMesh , INode , INode2D , IPrimitiveMesh , IRefCounted , IResourceFormatLoader , IRigidBody2D ,
23
- InputEvent , InputEventAction , Node , Node2D , PrimitiveMesh , RefCounted , ResourceFormatLoader ,
24
- ResourceLoader , Viewport , Window ,
22
+ BoxMesh , IEditorPlugin , INode , INode2D , IPrimitiveMesh , IRefCounted , IResourceFormatLoader ,
23
+ IRigidBody2D , InputEvent , InputEventAction , Node , Node2D , Object , PrimitiveMesh , RefCounted ,
24
+ ResourceFormatLoader , ResourceLoader , Viewport , Window ,
25
25
} ;
26
26
use godot:: meta:: ToGodot ;
27
27
use godot:: obj:: { Base , Gd , NewAlloc , NewGd } ;
@@ -773,3 +773,25 @@ impl GetSetTest {
773
773
self . always_get_100
774
774
}
775
775
}
776
+
777
+ // ----------------------------------------------------------------------------------------------------------------------------------------------
778
+
779
+ // There isn't a good way to test editor plugins, but we can at least declare one to ensure that the macro
780
+ // compiles.
781
+ #[ derive( GodotClass ) ]
782
+ #[ class( no_init, base = EditorPlugin , editor_plugin, tool) ]
783
+ struct CustomEditorPlugin ;
784
+
785
+ // Just override EditorPlugin::edit() to verify method is declared with Option<T>.
786
+ // See https://github.com/godot-rust/gdext/issues/494.
787
+ #[ godot_api]
788
+ impl IEditorPlugin for CustomEditorPlugin {
789
+ fn edit ( & mut self , _object : Option < Gd < Object > > ) {
790
+ // Do nothing.
791
+ }
792
+
793
+ // This parameter is non-null.
794
+ fn handles ( & self , _object : Gd < Object > ) -> bool {
795
+ true
796
+ }
797
+ }
0 commit comments