You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: godot-core/src/obj/oneditor.rs
+5-8
Original file line number
Diff line number
Diff line change
@@ -15,19 +15,15 @@ use crate::registry::property::{DirectExport, Export, Var};
15
15
///
16
16
/// Panics during access if uninitialized.
17
17
/// When used inside a node class, `OnEditor` checks if a value has been set before `ready()` is run, and panics otherwise.
18
-
///
19
-
/// `OnEditor<T>` should always be used as a property, preferably in tandem with an `#[export]` or `#[var]`.
20
18
/// Once initialized, it can be used almost as if it was a `T` value itself, due to `Deref`/`DerefMut` impls.
21
19
///
22
-
/// `OnEditor<T>` directly supports two workflows – setting given property via the Editor or doing so via code before the first use.
23
-
/// The latter should be limited to use cases involving builder or factory patterns.
20
+
/// `OnEditor<T>` should always be used as a property, preferably in tandem with an `#[export]` or `#[var]`.
21
+
/// Initializing `OnEditor` values via code before the first use is supported but should be limited to use cases involving builder or factory patterns.
24
22
///
25
23
/// [`Option<Gd<T>>`](std::option) and [`OnReady<Gd<T>>`](crate::obj::onready::OnReady) should be used for any other late initialization logic.
26
24
///
27
25
/// # Using `OnEditor<T>` with `Gd<T>` and `DynGd<T, D>`
28
26
///
29
-
/// Exposing properties to the Godot editor is primary use of the `OnEditor<Gd<T>>`.
30
-
///
31
27
/// ## Example - auto-generated init
32
28
///
33
29
/// ```
@@ -129,8 +125,8 @@ use crate::registry::property::{DirectExport, Export, Var};
129
125
/// #[derive(GodotClass)]
130
126
/// #[class(init, base = Node)]
131
127
/// struct SomeClassThatCanBeInstantiatedInCode {
132
-
/// // Given initial value will be represented by `42` in the editor.
133
-
/// // Will cause panic if not set via the editor or code.
128
+
/// // Uninitialized value will be represented by `42` in the editor.
129
+
/// // Will cause panic if not set via the editor or code before use.
134
130
/// #[export]
135
131
/// #[init(uninit = 42)]
136
132
/// some_primitive: OnEditor<i64>,
@@ -146,6 +142,7 @@ use crate::registry::property::{DirectExport, Export, Var};
0 commit comments