Trait IEditorNode3DGizmo
pub trait IEditorNode3DGizmo: GodotClass<Base = EditorNode3DGizmo> + You_forgot_the_attribute__godot_api {
Show 20 methods
// Provided methods
fn init(base: Base<Self::Base>) -> Self { ... }
fn on_notification(&mut self, what: ObjectNotification) { ... }
fn on_get(&self, property: StringName) -> Option<Variant> { ... }
fn on_set(&mut self, property: StringName, value: Variant) -> bool { ... }
fn on_validate_property(&self, property: &mut PropertyInfo) { ... }
fn on_get_property_list(&mut self) -> Vec<PropertyInfo> { ... }
fn on_property_get_revert(&self, property: StringName) -> Option<Variant> { ... }
fn to_string(&self) -> GString { ... }
fn redraw(&mut self) { ... }
fn get_handle_name(&self, id: i32, secondary: bool) -> GString { ... }
fn is_handle_highlighted(&self, id: i32, secondary: bool) -> bool { ... }
fn get_handle_value(&self, id: i32, secondary: bool) -> Variant { ... }
fn begin_handle_action(&mut self, id: i32, secondary: bool) { ... }
fn set_handle(
&mut self,
id: i32,
secondary: bool,
camera: Option<Gd<Camera3D>>,
point: Vector2,
) { ... }
fn commit_handle(
&mut self,
id: i32,
secondary: bool,
restore: Variant,
cancel: bool,
) { ... }
fn subgizmos_intersect_ray(
&self,
camera: Option<Gd<Camera3D>>,
point: Vector2,
) -> i32 { ... }
fn subgizmos_intersect_frustum(
&self,
camera: Option<Gd<Camera3D>>,
frustum: Array<Plane>,
) -> PackedArray<i32> { ... }
fn set_subgizmo_transform(&mut self, id: i32, transform: Transform3D) { ... }
fn get_subgizmo_transform(&self, id: i32) -> Transform3D { ... }
fn commit_subgizmos(
&mut self,
ids: PackedArray<i32>,
restores: Array<Transform3D>,
cancel: bool,
) { ... }
}Expand description
§Interface trait for class EditorNode3DGizmo.
Functions in this trait represent constructors (init) or virtual method callbacks invoked by the engine.
§Related symbols
Base interfaces: > INode3DGizmoIRefCounted > IObject.
(Strike-through means some intermediate Godot classes are marked final, and can thus not be inherited by GDExtension.)
See also Godot docs for EditorNode3DGizmo methods.
Provided Methods§
fn init(base: Base<Self::Base>) -> Self
fn init(base: Base<Self::Base>) -> Self
Godot constructor, accepting an injected base object.
base refers to the base instance of the class, which can either be stored in a Base<T> field or discarded.
This method returns a fully-constructed instance, which will then be moved into a Gd<T> pointer.
If the class has a #[class(init)] attribute, this method will be auto-generated and must not be overridden.
fn on_notification(&mut self, what: ObjectNotification)
fn on_notification(&mut self, what: ObjectNotification)
Called when the object receives a Godot notification.
The type of notification can be identified through what. The enum is designed to hold all possible NOTIFICATION_*
constants that the current class can handle. However, this is not validated in Godot, so an enum variant Unknown exists
to represent integers out of known constants (mistakes or future additions).
This method is named _notification in Godot, but on_notification in Rust. To send notifications, use the
Object::notify method.
See also in Godot docs:
fn on_get(&self, property: StringName) -> Option<Variant>
fn on_get(&self, property: StringName) -> Option<Variant>
Called whenever get() is called or Godot gets the value of a property.
Should return the given property’s value as Some(value), or None if the property should be handled normally.
See also in Godot docs:
fn on_set(&mut self, property: StringName, value: Variant) -> bool
fn on_set(&mut self, property: StringName, value: Variant) -> bool
Called whenever Godot set() is called or Godot sets the value of a property.
Should set property to the given value and return true, or return false to indicate the property
should be handled normally.
See also in Godot docs:
fn on_validate_property(&self, property: &mut PropertyInfo)
fn on_validate_property(&self, property: &mut PropertyInfo)
Called whenever Godot retrieves value of property. Allows to customize existing properties.
Every property info goes through this method, except properties added with on_get_property_list().
Exposed property here is a shared mutable reference obtained (and returned to) from Godot.
See also in the Godot docs:
fn on_get_property_list(&mut self) -> Vec<PropertyInfo>
Available on since_api=4.3 only.
fn on_get_property_list(&mut self) -> Vec<PropertyInfo>
since_api=4.3 only.Called whenever Godot get_property_list() is called, the returned vector here is
appended to the existing list of properties.
This should mainly be used for advanced purposes, such as dynamically updating the property list in the editor.
See also in Godot docs:
fn on_property_get_revert(&self, property: StringName) -> Option<Variant>
fn on_property_get_revert(&self, property: StringName) -> Option<Variant>
Called by Godot to tell if a property has a custom revert or not.
Return None for no custom revert, and return Some(value) to specify the custom revert.
This is a combination of Godot’s Object::_property_get_revert and Object::_property_can_revert. This means that this
function will usually be called twice by Godot to find the revert.
Note that this should be a pure function. That is, it should always return the same value for a property as long as self
remains unchanged. Otherwise, this may lead to unexpected (safe) behavior.
fn to_string(&self) -> GString
fn to_string(&self) -> GString
String representation of the Godot instance.
Override this method to define how the instance is represented as a string.
Used by impl Display for Gd<T>, as well as str() and print() in GDScript.
fn redraw(&mut self)
fn redraw(&mut self)
Override this method to add all the gizmo elements whenever a gizmo update is requested. It’s common to call clear at the beginning of this method and then add visual elements depending on the node’s properties.
fn get_handle_name(&self, id: i32, secondary: bool) -> GString
fn get_handle_name(&self, id: i32, secondary: bool) -> GString
Override this method to return the name of an edited handle (handles must have been previously added by add_handles). Handles can be named for reference to the user when editing.
The secondary argument is true when the requested handle is secondary (see add_handles for more information).
fn is_handle_highlighted(&self, id: i32, secondary: bool) -> bool
fn is_handle_highlighted(&self, id: i32, secondary: bool) -> bool
Override this method to return true whenever the given handle should be highlighted in the editor.
The secondary argument is true when the requested handle is secondary (see add_handles for more information).
fn get_handle_value(&self, id: i32, secondary: bool) -> Variant
fn get_handle_value(&self, id: i32, secondary: bool) -> Variant
Override this method to return the current value of a handle. This value will be requested at the start of an edit and used as the restore argument in commit_handle.
The secondary argument is true when the requested handle is secondary (see add_handles for more information).
fn begin_handle_action(&mut self, id: i32, secondary: bool)
fn set_handle(
&mut self,
id: i32,
secondary: bool,
camera: Option<Gd<Camera3D>>,
point: Vector2,
)
fn set_handle( &mut self, id: i32, secondary: bool, camera: Option<Gd<Camera3D>>, point: Vector2, )
Override this method to update the node properties when the user drags a gizmo handle (previously added with add_handles). The provided point is the mouse position in screen coordinates and the camera can be used to convert it to raycasts.
The secondary argument is true when the edited handle is secondary (see add_handles for more information).
fn commit_handle(
&mut self,
id: i32,
secondary: bool,
restore: Variant,
cancel: bool,
)
fn commit_handle( &mut self, id: i32, secondary: bool, restore: Variant, cancel: bool, )
Override this method to commit a handle being edited (handles must have been previously added by add_handles). This usually means creating an UndoRedo action for the change, using the current handle value as “do” and the restore argument as “undo”.
If the cancel argument is true, the restore value should be directly set, without any UndoRedo action.
The secondary argument is true when the committed handle is secondary (see add_handles for more information).
fn subgizmos_intersect_ray(
&self,
camera: Option<Gd<Camera3D>>,
point: Vector2,
) -> i32
fn subgizmos_intersect_ray( &self, camera: Option<Gd<Camera3D>>, point: Vector2, ) -> i32
Override this method to allow selecting subgizmos using mouse clicks. Given a camera and a point in screen coordinates, this method should return which subgizmo should be selected. The returned value should be a unique subgizmo identifier, which can have any non-negative value and will be used in other virtual methods like get_subgizmo_transform or commit_subgizmos.
fn subgizmos_intersect_frustum(
&self,
camera: Option<Gd<Camera3D>>,
frustum: Array<Plane>,
) -> PackedArray<i32>
fn subgizmos_intersect_frustum( &self, camera: Option<Gd<Camera3D>>, frustum: Array<Plane>, ) -> PackedArray<i32>
Override this method to allow selecting subgizmos using mouse drag box selection. Given a camera and a frustum, this method should return which subgizmos are contained within the frustum. The frustum argument consists of an array with all the Planes that make up the selection frustum. The returned value should contain a list of unique subgizmo identifiers, which can have any non-negative value and will be used in other virtual methods like get_subgizmo_transform or commit_subgizmos.
fn set_subgizmo_transform(&mut self, id: i32, transform: Transform3D)
fn set_subgizmo_transform(&mut self, id: i32, transform: Transform3D)
Override this method to update the node properties during subgizmo editing (see subgizmos_intersect_ray and subgizmos_intersect_frustum). The transform is given in the Node3D’s local coordinate system.
fn get_subgizmo_transform(&self, id: i32) -> Transform3D
fn get_subgizmo_transform(&self, id: i32) -> Transform3D
Override this method to return the current transform of a subgizmo. This transform will be requested at the start of an edit and used as the restore argument in commit_subgizmos.
fn commit_subgizmos(
&mut self,
ids: PackedArray<i32>,
restores: Array<Transform3D>,
cancel: bool,
)
fn commit_subgizmos( &mut self, ids: PackedArray<i32>, restores: Array<Transform3D>, cancel: bool, )
Override this method to commit a group of subgizmos being edited (see subgizmos_intersect_ray and subgizmos_intersect_frustum). This usually means creating an UndoRedo action for the change, using the current transforms as “do” and the restores transforms as “undo”.
If the cancel argument is true, the restores transforms should be directly set, without any UndoRedo action.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.