Skip to content

Commit 315ba46

Browse files
authored
Merge pull request #1400 from TitanNano/jovan/on_editor_singleton_trait
`__are_oneditor_fields_initalized` needs explicit usage of Singleton trait
2 parents 309881c + 709de87 commit 315ba46

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

godot-macros/src/class/derive_godot_class.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ fn make_onready_init(all_fields: &[Field]) -> TokenStream {
369369

370370
fn make_oneditor_panic_inits(class_name: &Ident, all_fields: &[Field]) -> TokenStream {
371371
// Despite its name OnEditor shouldn't panic in the editor for tool classes.
372-
let is_in_editor = quote! { ::godot::classes::Engine::singleton().is_editor_hint() };
372+
let is_in_editor = quote! { <::godot::classes::Engine as ::godot::obj::Singleton>::singleton().is_editor_hint() };
373373

374374
let are_all_oneditor_fields_valid = quote! { are_all_oneditor_fields_valid };
375375

godot-macros/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,15 @@ use crate::util::{bail, ident, KvParser};
231231
/// [`Export`](../register/property/trait.Export.html):
232232
///
233233
/// ```
234-
/// # use godot::prelude::*;
234+
/// # use godot::prelude::{GodotClass, Node3D, Gd, OnEditor};
235235
/// #[derive(GodotClass)]
236236
/// # #[class(init)]
237237
/// struct MyStruct {
238238
/// #[export]
239239
/// my_field: i64,
240+
///
241+
/// #[export]
242+
/// child: OnEditor<Gd<Node3D>>,
240243
/// }
241244
/// ```
242245
///

itest/rust/src/object_tests/oneditor_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
use godot::classes::notify::NodeNotification;
99
use godot::classes::{INode, Node, RefCounted};
10-
use godot::obj::{Gd, NewAlloc, OnEditor, Singleton};
10+
use godot::obj::{Gd, NewAlloc, OnEditor};
1111
use godot::register::{godot_api, GodotClass};
1212

1313
use crate::framework::{expect_panic, itest};

itest/rust/src/object_tests/property_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use godot::builtin::{
1111
use godot::classes::{INode, IRefCounted, Node, Object, RefCounted, Resource, Texture};
1212
use godot::global::{PropertyHint, PropertyUsageFlags};
1313
use godot::meta::{GodotConvert, PropertyHintInfo, ToGodot};
14-
use godot::obj::{Base, EngineBitfield, EngineEnum, Gd, NewAlloc, NewGd, OnEditor, Singleton};
14+
use godot::obj::{Base, EngineBitfield, EngineEnum, Gd, NewAlloc, NewGd, OnEditor};
1515
use godot::register::property::{Export, Var};
1616
use godot::register::{godot_api, Export, GodotClass, GodotConvert, Var};
1717
use godot::test::itest;

0 commit comments

Comments
 (0)