Skip to main content

OpenXrInteractionProfileEditorBase

Struct OpenXrInteractionProfileEditorBase 

pub struct OpenXrInteractionProfileEditorBase { /* private fields */ }
Expand description

Godot class OpenXRInteractionProfileEditorBase.

Inherits HBoxContainer.

Related symbols:

See also Godot docs for OpenXRInteractionProfileEditorBase.

§Not instantiable

This class cannot be constructed. Obtain Gd<OpenXrInteractionProfileEditorBase> instances via Godot APIs.

§Final class

This class is final, meaning you cannot inherit from it, and it comes without I* interface trait. It is still possible that other Godot classes inherit from it, but that is limited to the engine itself.

§Godot docs

This is a base class for interaction profile editors used by the OpenXR action map editor. It can be used to create bespoke editors for specific interaction profiles.

Implementations§

§

impl OpenXrInteractionProfileEditorBase

pub fn setup( &mut self, action_map: impl AsArg<Option<Gd<OpenXrActionMap>>>, interaction_profile: impl AsArg<Option<Gd<OpenXrInteractionProfile>>>, )

Setup this editor for the provided action_map and interaction_profile.

Methods from Deref<Target = BoxContainer>§

pub fn add_spacer(&mut self, begin: bool) -> Option<Gd<Control>>

Adds a Control node to the box as a spacer. If begin is true, it will insert the Control node in front of all other children.

pub fn set_alignment(&mut self, alignment: AlignmentMode)

pub fn get_alignment(&self) -> AlignmentMode

pub fn set_vertical(&mut self, vertical: bool)

pub fn is_vertical(&self) -> bool

Methods from Deref<Target = Container>§

pub fn queue_sort(&mut self)

Queue resort of the contained children. This is called automatically anyway, but can be called upon request.

pub fn fit_child_in_rect(&mut self, child: impl AsArg<Gd<Control>>, rect: Rect2)

Fit a child control in a given rect. This is mainly a helper for creating custom container classes.

pub fn notify(&mut self, what: ContainerNotification)

⚠️ Sends a Godot notification to all classes inherited by the object.

Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().

Starts from the highest ancestor (the Object class) and goes down the hierarchy. See also Godot docs for Object::notification().

§Panics

If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must be exclusive.

pub fn notify_reversed(&mut self, what: ContainerNotification)

⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.

See docs of that method, including the panics.

Methods from Deref<Target = Control>§

pub fn accept_event(&mut self)

Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to unhandled_input or unhandled_key_input.

Note: This does not affect the methods in Input, only the way events are propagated.

pub fn get_minimum_size(&self) -> Vector2

Returns the minimum size for this control. See [member custom_minimum_size].

pub fn get_combined_minimum_size(&self) -> Vector2

Returns combined minimum size from [member custom_minimum_size] and get_minimum_size.

pub fn set_anchors_preset(&mut self, preset: LayoutPreset)

To set the default parameters, use set_anchors_preset_ex and its builder methods. See the book for detailed usage instructions. Sets the anchors to a preset from [enum Control.LayoutPreset] enum. This is the code equivalent to using the Layout menu in the 2D editor.

If keep_offsets is true, control’s position will also be updated.

pub fn set_anchors_preset_ex<'ex>( &'ex mut self, preset: LayoutPreset, ) -> ExSetAnchorsPreset<'ex>

Sets the anchors to a preset from [enum Control.LayoutPreset] enum. This is the code equivalent to using the Layout menu in the 2D editor.

If keep_offsets is true, control’s position will also be updated.

pub fn set_offsets_preset(&mut self, preset: LayoutPreset)

To set the default parameters, use set_offsets_preset_ex and its builder methods. See the book for detailed usage instructions. Sets the offsets to a preset from [enum Control.LayoutPreset] enum. This is the code equivalent to using the Layout menu in the 2D editor.

Use parameter resize_mode with constants from [enum Control.LayoutPresetMode] to better determine the resulting size of the Control. Constant size will be ignored if used with presets that change size, e.g. LayoutPreset::LEFT_WIDE.

Use parameter margin to determine the gap between the Control and the edges.

pub fn set_offsets_preset_ex<'ex>( &'ex mut self, preset: LayoutPreset, ) -> ExSetOffsetsPreset<'ex>

Sets the offsets to a preset from [enum Control.LayoutPreset] enum. This is the code equivalent to using the Layout menu in the 2D editor.

Use parameter resize_mode with constants from [enum Control.LayoutPresetMode] to better determine the resulting size of the Control. Constant size will be ignored if used with presets that change size, e.g. LayoutPreset::LEFT_WIDE.

Use parameter margin to determine the gap between the Control and the edges.

pub fn set_anchors_and_offsets_preset(&mut self, preset: LayoutPreset)

To set the default parameters, use set_anchors_and_offsets_preset_ex and its builder methods. See the book for detailed usage instructions. Sets both anchor preset and offset preset. See set_anchors_preset and set_offsets_preset.

pub fn set_anchors_and_offsets_preset_ex<'ex>( &'ex mut self, preset: LayoutPreset, ) -> ExSetAnchorsAndOffsetsPreset<'ex>

Sets both anchor preset and offset preset. See set_anchors_preset and set_offsets_preset.

pub fn set_anchor(&mut self, side: Side, anchor: f32)

To set the default parameters, use set_anchor_ex and its builder methods. See the book for detailed usage instructions. Sets the anchor for the specified [enum Side] to anchor. A setter method for [member anchor_bottom], [member anchor_left], [member anchor_right] and [member anchor_top].

If keep_offset is true, offsets aren’t updated after this operation.

If push_opposite_anchor is true and the opposite anchor overlaps this anchor, the opposite one will have its value overridden. For example, when setting left anchor to 1 and the right anchor has value of 0.5, the right anchor will also get value of 1. If push_opposite_anchor was false, the left anchor would get value 0.5.

pub fn set_anchor_ex<'ex>( &'ex mut self, side: Side, anchor: f32, ) -> ExSetAnchor<'ex>

Sets the anchor for the specified [enum Side] to anchor. A setter method for [member anchor_bottom], [member anchor_left], [member anchor_right] and [member anchor_top].

If keep_offset is true, offsets aren’t updated after this operation.

If push_opposite_anchor is true and the opposite anchor overlaps this anchor, the opposite one will have its value overridden. For example, when setting left anchor to 1 and the right anchor has value of 0.5, the right anchor will also get value of 1. If push_opposite_anchor was false, the left anchor would get value 0.5.

pub fn get_anchor(&self, side: Side) -> f32

Returns the anchor for the specified [enum Side]. A getter method for [member anchor_bottom], [member anchor_left], [member anchor_right] and [member anchor_top].

pub fn set_offset(&mut self, side: Side, offset: f32)

Sets the offset for the specified [enum Side] to offset. A setter method for [member offset_bottom], [member offset_left], [member offset_right] and [member offset_top].

pub fn get_offset(&self, offset: Side) -> f32

Returns the offset for the specified [enum Side]. A getter method for [member offset_bottom], [member offset_left], [member offset_right] and [member offset_top].

pub fn set_anchor_and_offset(&mut self, side: Side, anchor: f32, offset: f32)

To set the default parameters, use set_anchor_and_offset_ex and its builder methods. See the book for detailed usage instructions. Works the same as set_anchor, but instead of keep_offset argument and automatic update of offset, it allows to set the offset yourself (see set_offset).

pub fn set_anchor_and_offset_ex<'ex>( &'ex mut self, side: Side, anchor: f32, offset: f32, ) -> ExSetAnchorAndOffset<'ex>

Works the same as set_anchor, but instead of keep_offset argument and automatic update of offset, it allows to set the offset yourself (see set_offset).

pub fn set_begin(&mut self, position: Vector2)

Sets [member offset_left] and [member offset_top] at the same time. Equivalent of changing [member position].

pub fn set_end(&mut self, position: Vector2)

Sets [member offset_right] and [member offset_bottom] at the same time.

pub fn set_position(&mut self, position: Vector2)

To set the default parameters, use set_position_ex and its builder methods. See the book for detailed usage instructions. Sets the [member position] to given position.

If keep_offsets is true, control’s anchors will be updated instead of offsets.

pub fn set_position_ex<'ex>( &'ex mut self, position: Vector2, ) -> ExSetPosition<'ex>

Sets the [member position] to given position.

If keep_offsets is true, control’s anchors will be updated instead of offsets.

pub fn set_size(&mut self, size: Vector2)

To set the default parameters, use set_size_ex and its builder methods. See the book for detailed usage instructions. Sets the size (see [member size]).

If keep_offsets is true, control’s anchors will be updated instead of offsets.

pub fn set_size_ex<'ex>(&'ex mut self, size: Vector2) -> ExSetSize<'ex>

Sets the size (see [member size]).

If keep_offsets is true, control’s anchors will be updated instead of offsets.

pub fn reset_size(&mut self)

Resets the size to get_combined_minimum_size. This is equivalent to calling set_size(Vector2()) (or any size below the minimum).

pub fn set_custom_minimum_size(&mut self, size: Vector2)

pub fn set_global_position(&mut self, position: Vector2)

To set the default parameters, use set_global_position_ex and its builder methods. See the book for detailed usage instructions. Sets the [member global_position] to given position.

If keep_offsets is true, control’s anchors will be updated instead of offsets.

pub fn set_global_position_ex<'ex>( &'ex mut self, position: Vector2, ) -> ExSetGlobalPosition<'ex>

Sets the [member global_position] to given position.

If keep_offsets is true, control’s anchors will be updated instead of offsets.

pub fn set_rotation(&mut self, radians: f32)

pub fn set_rotation_degrees(&mut self, degrees: f32)

pub fn set_scale(&mut self, scale: Vector2)

pub fn set_pivot_offset(&mut self, pivot_offset: Vector2)

pub fn set_pivot_offset_ratio(&mut self, ratio: Vector2)

pub fn get_begin(&self) -> Vector2

Returns [member offset_left] and [member offset_top]. See also [member position].

pub fn get_end(&self) -> Vector2

Returns [member offset_right] and [member offset_bottom].

pub fn get_position(&self) -> Vector2

pub fn get_size(&self) -> Vector2

pub fn get_rotation(&self) -> f32

pub fn get_rotation_degrees(&self) -> f32

pub fn get_scale(&self) -> Vector2

pub fn get_pivot_offset(&self) -> Vector2

pub fn get_pivot_offset_ratio(&self) -> Vector2

pub fn get_combined_pivot_offset(&self) -> Vector2

Returns the combined value of [member pivot_offset] and [member pivot_offset_ratio], in pixels. The ratio is multiplied by the control’s size.

pub fn get_custom_minimum_size(&self) -> Vector2

pub fn get_parent_area_size(&self) -> Vector2

Returns the width/height occupied in the parent control.

pub fn get_global_position(&self) -> Vector2

pub fn get_screen_position(&self) -> Vector2

Returns the position of this Control in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins.

Equivalent to get_screen_transform().origin (see get_screen_transform).

Example: Show a popup at the mouse position:

popup_menu.position = get_screen_position() + get_screen_transform().basis_xform(get_local_mouse_position())

# The above code is equivalent to:
popup_menu.position = get_screen_transform() * get_local_mouse_position()

popup_menu.reset_size()
popup_menu.popup()

pub fn get_rect(&self) -> Rect2

Returns the position and size of the control in the coordinate system of the containing node. See [member position], [member scale] and [member size].

Note: If [member rotation] is not the default rotation, the resulting size is not meaningful.

Note: Setting [member Viewport.gui_snap_controls_to_pixels] to true can lead to rounding inaccuracies between the displayed control and the returned Rect2.

pub fn get_global_rect(&self) -> Rect2

Returns the position and size of the control relative to the containing canvas. See [member global_position] and [member size].

Note: If the node itself or any parent CanvasItem between the node and the canvas have a non default rotation or skew, the resulting size is likely not meaningful.

Note: Setting [member Viewport.gui_snap_controls_to_pixels] to true can lead to rounding inaccuracies between the displayed control and the returned Rect2.

pub fn set_focus_mode(&mut self, mode: FocusMode)

pub fn get_focus_mode(&self) -> FocusMode

pub fn get_focus_mode_with_override(&self) -> FocusMode

Returns the [member focus_mode], but takes the [member focus_behavior_recursive] into account. If [member focus_behavior_recursive] is set to FocusBehaviorRecursive::DISABLED, or it is set to FocusBehaviorRecursive::INHERITED and its ancestor is set to FocusBehaviorRecursive::DISABLED, then this returns FocusMode::NONE.

pub fn set_focus_behavior_recursive( &mut self, focus_behavior_recursive: FocusBehaviorRecursive, )

pub fn get_focus_behavior_recursive(&self) -> FocusBehaviorRecursive

pub fn has_focus(&self) -> bool

To set the default parameters, use has_focus_ex and its builder methods. See the book for detailed usage instructions. Returns true if this is the current focused control. See [member focus_mode].

If ignore_hidden_focus is true, controls that have their focus hidden will always return false. Hidden focus happens automatically when controls gain focus via mouse input, or manually using grab_focus with hide_focus set to true.

pub fn has_focus_ex<'ex>(&'ex self) -> ExHasFocus<'ex>

Returns true if this is the current focused control. See [member focus_mode].

If ignore_hidden_focus is true, controls that have their focus hidden will always return false. Hidden focus happens automatically when controls gain focus via mouse input, or manually using grab_focus with hide_focus set to true.

pub fn grab_focus(&mut self)

To set the default parameters, use grab_focus_ex and its builder methods. See the book for detailed usage instructions. Steal the focus from another control and become the focused control (see [member focus_mode]).

If hide_focus is true, the control will not visually show its focused state. Has no effect for LineEdit and TextEdit when [member ProjectSettings.gui/common/show_focus_state_on_pointer_event] is set to Control Supports Keyboard Input, or for any control when it is set to Always.

Note: Using this method together with call_deferred makes it more reliable, especially when called inside ready.

pub fn grab_focus_ex<'ex>(&'ex mut self) -> ExGrabFocus<'ex>

Steal the focus from another control and become the focused control (see [member focus_mode]).

If hide_focus is true, the control will not visually show its focused state. Has no effect for LineEdit and TextEdit when [member ProjectSettings.gui/common/show_focus_state_on_pointer_event] is set to Control Supports Keyboard Input, or for any control when it is set to Always.

Note: Using this method together with call_deferred makes it more reliable, especially when called inside ready.

pub fn release_focus(&mut self)

Give up the focus. No other control will be able to receive input.

pub fn find_prev_valid_focus(&self) -> Option<Gd<Control>>

Finds the previous (above in the tree) Control that can receive the focus.

pub fn find_next_valid_focus(&self) -> Option<Gd<Control>>

Finds the next (below in the tree) Control that can receive the focus.

pub fn find_valid_focus_neighbor(&self, side: Side) -> Option<Gd<Control>>

Finds the next Control that can receive the focus on the specified [enum Side].

Note: This is different from get_focus_neighbor, which returns the path of a specified focus neighbor.

pub fn set_h_size_flags(&mut self, flags: SizeFlags)

pub fn get_h_size_flags(&self) -> SizeFlags

pub fn set_stretch_ratio(&mut self, ratio: f32)

pub fn get_stretch_ratio(&self) -> f32

pub fn set_v_size_flags(&mut self, flags: SizeFlags)

pub fn get_v_size_flags(&self) -> SizeFlags

pub fn set_theme(&mut self, theme: impl AsArg<Option<Gd<Theme>>>)

pub fn get_theme(&self) -> Option<Gd<Theme>>

pub fn set_theme_type_variation(&mut self, theme_type: impl AsArg<StringName>)

pub fn get_theme_type_variation(&self) -> StringName

pub fn begin_bulk_theme_override(&mut self)

Prevents *_theme_*_override methods from emitting ControlNotification::THEME_CHANGED until end_bulk_theme_override is called.

pub fn end_bulk_theme_override(&mut self)

Ends a bulk theme override update. See begin_bulk_theme_override.

pub fn add_theme_icon_override( &mut self, name: impl AsArg<StringName>, texture: impl AsArg<Gd<Texture2D>>, )

Creates a local override for a theme icon with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_icon_override.

See also get_theme_icon.

pub fn add_theme_stylebox_override( &mut self, name: impl AsArg<StringName>, stylebox: impl AsArg<Gd<StyleBox>>, )

Creates a local override for a theme StyleBox with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_stylebox_override.

See also get_theme_stylebox.

Example: Modify a property in a StyleBox by duplicating it:

# The snippet below assumes the child node "MyButton" has a StyleBoxFlat assigned.
# Resources are shared across instances, so we need to duplicate it
# to avoid modifying the appearance of all other buttons.
var new_stylebox_normal = $MyButton.get_theme_stylebox("normal").duplicate()
new_stylebox_normal.border_width_top = 3
new_stylebox_normal.border_color = Color(0, 1, 0.5)
$MyButton.add_theme_stylebox_override("normal", new_stylebox_normal)
# Remove the stylebox override.
$MyButton.remove_theme_stylebox_override("normal")

pub fn add_theme_font_override( &mut self, name: impl AsArg<StringName>, font: impl AsArg<Gd<Font>>, )

Creates a local override for a theme Font with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_font_override.

See also get_theme_font.

pub fn add_theme_font_size_override( &mut self, name: impl AsArg<StringName>, font_size: i32, )

Creates a local override for a theme font size with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_font_size_override.

See also get_theme_font_size.

pub fn add_theme_color_override( &mut self, name: impl AsArg<StringName>, color: Color, )

Creates a local override for a theme Color with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_color_override.

See also get_theme_color.

Example: Override a Label’s color and reset it later:

# Given the child Label node "MyLabel", override its font color with a custom value.
$MyLabel.add_theme_color_override("font_color", Color(1, 0.5, 0))
# Reset the font color of the child label.
$MyLabel.remove_theme_color_override("font_color")
# Alternatively it can be overridden with the default value from the Label type.
$MyLabel.add_theme_color_override("font_color", get_theme_color("font_color", "Label"))

pub fn add_theme_constant_override( &mut self, name: impl AsArg<StringName>, constant: i32, )

Creates a local override for a theme constant with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_constant_override.

See also get_theme_constant.

pub fn remove_theme_icon_override(&mut self, name: impl AsArg<StringName>)

Removes a local override for a theme icon with the specified name previously added by add_theme_icon_override or via the Inspector dock.

pub fn remove_theme_stylebox_override(&mut self, name: impl AsArg<StringName>)

Removes a local override for a theme StyleBox with the specified name previously added by add_theme_stylebox_override or via the Inspector dock.

pub fn remove_theme_font_override(&mut self, name: impl AsArg<StringName>)

Removes a local override for a theme Font with the specified name previously added by add_theme_font_override or via the Inspector dock.

pub fn remove_theme_font_size_override(&mut self, name: impl AsArg<StringName>)

Removes a local override for a theme font size with the specified name previously added by add_theme_font_size_override or via the Inspector dock.

pub fn remove_theme_color_override(&mut self, name: impl AsArg<StringName>)

Removes a local override for a theme Color with the specified name previously added by add_theme_color_override or via the Inspector dock.

pub fn remove_theme_constant_override(&mut self, name: impl AsArg<StringName>)

Removes a local override for a theme constant with the specified name previously added by add_theme_constant_override or via the Inspector dock.

pub fn get_theme_icon( &self, name: impl AsArg<StringName>, ) -> Option<Gd<Texture2D>>

To set the default parameters, use get_theme_icon_ex and its builder methods. See the book for detailed usage instructions. Returns an icon from the first matching Theme in the tree if that Theme has an icon item with the specified name and theme_type.

See get_theme_color for details.

pub fn get_theme_icon_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetThemeIcon<'ex>

Returns an icon from the first matching Theme in the tree if that Theme has an icon item with the specified name and theme_type.

See get_theme_color for details.

pub fn get_theme_stylebox( &self, name: impl AsArg<StringName>, ) -> Option<Gd<StyleBox>>

To set the default parameters, use get_theme_stylebox_ex and its builder methods. See the book for detailed usage instructions. Returns a StyleBox from the first matching Theme in the tree if that Theme has a stylebox item with the specified name and theme_type.

See get_theme_color for details.

pub fn get_theme_stylebox_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetThemeStylebox<'ex>

Returns a StyleBox from the first matching Theme in the tree if that Theme has a stylebox item with the specified name and theme_type.

See get_theme_color for details.

pub fn get_theme_font(&self, name: impl AsArg<StringName>) -> Option<Gd<Font>>

To set the default parameters, use get_theme_font_ex and its builder methods. See the book for detailed usage instructions. Returns a Font from the first matching Theme in the tree if that Theme has a font item with the specified name and theme_type.

See get_theme_color for details.

pub fn get_theme_font_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetThemeFont<'ex>

Returns a Font from the first matching Theme in the tree if that Theme has a font item with the specified name and theme_type.

See get_theme_color for details.

pub fn get_theme_font_size(&self, name: impl AsArg<StringName>) -> i32

To set the default parameters, use get_theme_font_size_ex and its builder methods. See the book for detailed usage instructions. Returns a font size from the first matching Theme in the tree if that Theme has a font size item with the specified name and theme_type.

See get_theme_color for details.

pub fn get_theme_font_size_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetThemeFontSize<'ex>

Returns a font size from the first matching Theme in the tree if that Theme has a font size item with the specified name and theme_type.

See get_theme_color for details.

pub fn get_theme_color(&self, name: impl AsArg<StringName>) -> Color

To set the default parameters, use get_theme_color_ex and its builder methods. See the book for detailed usage instructions. Returns a Color from the first matching Theme in the tree if that Theme has a color item with the specified name and theme_type. If theme_type is omitted the class name of the current control is used as the type, or [member theme_type_variation] if it is defined. If the type is a class name its parent classes are also checked, in order of inheritance. If the type is a variation its base types are checked, in order of dependency, then the control’s class name and its parent classes are checked.

For the current control its local overrides are considered first (see add_theme_color_override), then its assigned [member theme]. After the current control, each parent control and its assigned [member theme] are considered; controls without a [member theme] assigned are skipped. If no matching Theme is found in the tree, the custom project Theme (see [member ProjectSettings.gui/theme/custom]) and the default Theme are used (see ThemeDB).

func _ready():
	# Get the font color defined for the current Control's class, if it exists.
	modulate = get_theme_color("font_color")
	# Get the font color defined for the Button class.
	modulate = get_theme_color("font_color", "Button")

pub fn get_theme_color_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetThemeColor<'ex>

Returns a Color from the first matching Theme in the tree if that Theme has a color item with the specified name and theme_type. If theme_type is omitted the class name of the current control is used as the type, or [member theme_type_variation] if it is defined. If the type is a class name its parent classes are also checked, in order of inheritance. If the type is a variation its base types are checked, in order of dependency, then the control’s class name and its parent classes are checked.

For the current control its local overrides are considered first (see add_theme_color_override), then its assigned [member theme]. After the current control, each parent control and its assigned [member theme] are considered; controls without a [member theme] assigned are skipped. If no matching Theme is found in the tree, the custom project Theme (see [member ProjectSettings.gui/theme/custom]) and the default Theme are used (see ThemeDB).

func _ready():
	# Get the font color defined for the current Control's class, if it exists.
	modulate = get_theme_color("font_color")
	# Get the font color defined for the Button class.
	modulate = get_theme_color("font_color", "Button")

pub fn get_theme_constant(&self, name: impl AsArg<StringName>) -> i32

To set the default parameters, use get_theme_constant_ex and its builder methods. See the book for detailed usage instructions. Returns a constant from the first matching Theme in the tree if that Theme has a constant item with the specified name and theme_type.

See get_theme_color for details.

pub fn get_theme_constant_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetThemeConstant<'ex>

Returns a constant from the first matching Theme in the tree if that Theme has a constant item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_icon_override(&self, name: impl AsArg<StringName>) -> bool

Returns true if there is a local override for a theme icon with the specified name in this Control node.

See add_theme_icon_override.

pub fn has_theme_stylebox_override(&self, name: impl AsArg<StringName>) -> bool

Returns true if there is a local override for a theme StyleBox with the specified name in this Control node.

See add_theme_stylebox_override.

pub fn has_theme_font_override(&self, name: impl AsArg<StringName>) -> bool

Returns true if there is a local override for a theme Font with the specified name in this Control node.

See add_theme_font_override.

pub fn has_theme_font_size_override(&self, name: impl AsArg<StringName>) -> bool

Returns true if there is a local override for a theme font size with the specified name in this Control node.

See add_theme_font_size_override.

pub fn has_theme_color_override(&self, name: impl AsArg<StringName>) -> bool

Returns true if there is a local override for a theme Color with the specified name in this Control node.

See add_theme_color_override.

pub fn has_theme_constant_override(&self, name: impl AsArg<StringName>) -> bool

Returns true if there is a local override for a theme constant with the specified name in this Control node.

See add_theme_constant_override.

pub fn has_theme_icon(&self, name: impl AsArg<StringName>) -> bool

To set the default parameters, use has_theme_icon_ex and its builder methods. See the book for detailed usage instructions. Returns true if there is a matching Theme in the tree that has an icon item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_icon_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExHasThemeIcon<'ex>

Returns true if there is a matching Theme in the tree that has an icon item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_stylebox(&self, name: impl AsArg<StringName>) -> bool

To set the default parameters, use has_theme_stylebox_ex and its builder methods. See the book for detailed usage instructions. Returns true if there is a matching Theme in the tree that has a stylebox item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_stylebox_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExHasThemeStylebox<'ex>

Returns true if there is a matching Theme in the tree that has a stylebox item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_font(&self, name: impl AsArg<StringName>) -> bool

To set the default parameters, use has_theme_font_ex and its builder methods. See the book for detailed usage instructions. Returns true if there is a matching Theme in the tree that has a font item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_font_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExHasThemeFont<'ex>

Returns true if there is a matching Theme in the tree that has a font item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_font_size(&self, name: impl AsArg<StringName>) -> bool

To set the default parameters, use has_theme_font_size_ex and its builder methods. See the book for detailed usage instructions. Returns true if there is a matching Theme in the tree that has a font size item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_font_size_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExHasThemeFontSize<'ex>

Returns true if there is a matching Theme in the tree that has a font size item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_color(&self, name: impl AsArg<StringName>) -> bool

To set the default parameters, use has_theme_color_ex and its builder methods. See the book for detailed usage instructions. Returns true if there is a matching Theme in the tree that has a color item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_color_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExHasThemeColor<'ex>

Returns true if there is a matching Theme in the tree that has a color item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_constant(&self, name: impl AsArg<StringName>) -> bool

To set the default parameters, use has_theme_constant_ex and its builder methods. See the book for detailed usage instructions. Returns true if there is a matching Theme in the tree that has a constant item with the specified name and theme_type.

See get_theme_color for details.

pub fn has_theme_constant_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExHasThemeConstant<'ex>

Returns true if there is a matching Theme in the tree that has a constant item with the specified name and theme_type.

See get_theme_color for details.

pub fn get_theme_default_base_scale(&self) -> f32

Returns the default base scale value from the first matching Theme in the tree if that Theme has a valid [member Theme.default_base_scale] value.

See get_theme_color for details.

pub fn get_theme_default_font(&self) -> Option<Gd<Font>>

Returns the default font from the first matching Theme in the tree if that Theme has a valid [member Theme.default_font] value.

See get_theme_color for details.

pub fn get_theme_default_font_size(&self) -> i32

Returns the default font size value from the first matching Theme in the tree if that Theme has a valid [member Theme.default_font_size] value.

See get_theme_color for details.

pub fn get_parent_control(&self) -> Option<Gd<Control>>

Returns the parent control node.

pub fn set_h_grow_direction(&mut self, direction: GrowDirection)

pub fn get_h_grow_direction(&self) -> GrowDirection

pub fn set_v_grow_direction(&mut self, direction: GrowDirection)

pub fn get_v_grow_direction(&self) -> GrowDirection

pub fn set_tooltip_auto_translate_mode(&mut self, mode: AutoTranslateMode)

pub fn get_tooltip_auto_translate_mode(&self) -> AutoTranslateMode

pub fn set_tooltip_text(&mut self, hint: impl AsArg<GString>)

pub fn get_tooltip_text(&self) -> GString

pub fn get_tooltip(&self) -> GString

To set the default parameters, use get_tooltip_ex and its builder methods. See the book for detailed usage instructions. Returns the tooltip text for the position at_position in control’s local coordinates, which will typically appear when the cursor is resting over this control. By default, it returns [member tooltip_text].

This method can be overridden to customize its behavior. See get_tooltip.

Note: If this method returns an empty String and make_custom_tooltip is not overridden, no tooltip is displayed.

pub fn get_tooltip_ex<'ex>(&'ex self) -> ExGetTooltip<'ex>

Returns the tooltip text for the position at_position in control’s local coordinates, which will typically appear when the cursor is resting over this control. By default, it returns [member tooltip_text].

This method can be overridden to customize its behavior. See get_tooltip.

Note: If this method returns an empty String and make_custom_tooltip is not overridden, no tooltip is displayed.

pub fn set_default_cursor_shape(&mut self, shape: CursorShape)

pub fn get_default_cursor_shape(&self) -> CursorShape

pub fn get_cursor_shape(&self) -> CursorShape

To set the default parameters, use get_cursor_shape_ex and its builder methods. See the book for detailed usage instructions. Returns the mouse cursor shape for this control when hovered over position in local coordinates. For most controls, this is the same as [member mouse_default_cursor_shape], but some built-in controls implement more complex logic.

pub fn get_cursor_shape_ex<'ex>(&'ex self) -> ExGetCursorShape<'ex>

Returns the mouse cursor shape for this control when hovered over position in local coordinates. For most controls, this is the same as [member mouse_default_cursor_shape], but some built-in controls implement more complex logic.

pub fn set_focus_neighbor(&mut self, side: Side, neighbor: impl AsArg<NodePath>)

Sets the focus neighbor for the specified [enum Side] to the Control at neighbor node path. A setter method for [member focus_neighbor_bottom], [member focus_neighbor_left], [member focus_neighbor_right] and [member focus_neighbor_top].

pub fn get_focus_neighbor(&self, side: Side) -> NodePath

Returns the focus neighbor for the specified [enum Side]. A getter method for [member focus_neighbor_bottom], [member focus_neighbor_left], [member focus_neighbor_right] and [member focus_neighbor_top].

Note: To find the next Control on the specific [enum Side], even if a neighbor is not assigned, use find_valid_focus_neighbor.

pub fn set_focus_next(&mut self, next: impl AsArg<NodePath>)

pub fn get_focus_next(&self) -> NodePath

pub fn set_focus_previous(&mut self, previous: impl AsArg<NodePath>)

pub fn get_focus_previous(&self) -> NodePath

pub fn force_drag( &mut self, data: &Variant, preview: impl AsArg<Option<Gd<Control>>>, )

Forces drag and bypasses get_drag_data and set_drag_preview by passing data and preview. Drag will start even if the mouse is neither over nor pressed on this control.

The methods can_drop_data and drop_data must be implemented on controls that want to receive drop data.

pub fn accessibility_drag(&mut self)

Starts drag-and-drop operation without using a mouse.

pub fn accessibility_drop(&mut self)

Ends drag-and-drop operation without using a mouse.

pub fn set_accessibility_name(&mut self, name: impl AsArg<GString>)

pub fn get_accessibility_name(&self) -> GString

pub fn set_accessibility_description( &mut self, description: impl AsArg<GString>, )

pub fn get_accessibility_description(&self) -> GString

pub fn set_accessibility_live(&mut self, mode: AccessibilityLiveMode)

pub fn get_accessibility_live(&self) -> AccessibilityLiveMode

pub fn set_accessibility_controls_nodes(&mut self, node_path: &Array<NodePath>)

pub fn get_accessibility_controls_nodes(&self) -> Array<NodePath>

pub fn set_accessibility_described_by_nodes( &mut self, node_path: &Array<NodePath>, )

pub fn get_accessibility_described_by_nodes(&self) -> Array<NodePath>

pub fn set_accessibility_labeled_by_nodes( &mut self, node_path: &Array<NodePath>, )

pub fn get_accessibility_labeled_by_nodes(&self) -> Array<NodePath>

pub fn set_accessibility_flow_to_nodes(&mut self, node_path: &Array<NodePath>)

pub fn get_accessibility_flow_to_nodes(&self) -> Array<NodePath>

pub fn set_mouse_filter(&mut self, filter: MouseFilter)

pub fn get_mouse_filter(&self) -> MouseFilter

pub fn get_mouse_filter_with_override(&self) -> MouseFilter

Returns the [member mouse_filter], but takes the [member mouse_behavior_recursive] into account. If [member mouse_behavior_recursive] is set to MouseBehaviorRecursive::DISABLED, or it is set to MouseBehaviorRecursive::INHERITED and its ancestor is set to MouseBehaviorRecursive::DISABLED, then this returns MouseFilter::IGNORE.

pub fn set_mouse_behavior_recursive( &mut self, mouse_behavior_recursive: MouseBehaviorRecursive, )

pub fn get_mouse_behavior_recursive(&self) -> MouseBehaviorRecursive

pub fn set_force_pass_scroll_events(&mut self, force_pass_scroll_events: bool)

pub fn is_force_pass_scroll_events(&self) -> bool

pub fn set_clip_contents(&mut self, enable: bool)

pub fn is_clipping_contents(&self) -> bool

pub fn grab_click_focus(&mut self)

Creates an InputEventMouseButton that attempts to click the control. If the event is received, the control gains focus.

func _process(delta):
	grab_click_focus() # When clicking another Control node, this node will be clicked instead.

pub fn set_drag_forwarding( &mut self, drag_func: &Callable, can_drop_func: &Callable, drop_func: &Callable, )

Sets the given callables to be used instead of the control’s own drag-and-drop virtual methods. If a callable is empty, its respective virtual method is used as normal.

The arguments for each callable should be exactly the same as their respective virtual methods, which would be:

pub fn set_drag_preview(&mut self, control: impl AsArg<Option<Gd<Control>>>)

Shows the given control at the mouse pointer. A good time to call this method is in get_drag_data. The control must not be in the scene tree. You should not free the control, and you should not keep a reference to the control beyond the duration of the drag. It will be deleted automatically after the drag has ended.

@export var color = Color(1, 0, 0, 1)

func _get_drag_data(position):
	# Use a control that is not in the tree
	var cpb = ColorPickerButton.new()
	cpb.color = color
	cpb.size = Vector2(50, 50)
	set_drag_preview(cpb)
	return color

pub fn is_drag_successful(&self) -> bool

Returns true if a drag operation is successful. Alternative to gui_is_drag_successful.

Best used with NodeNotification::DRAG_END.

pub fn warp_mouse(&mut self, position: Vector2)

Moves the mouse cursor to position, relative to [member position] of this Control.

Note: warp_mouse is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.

pub fn set_shortcut_context(&mut self, node: impl AsArg<Option<Gd<Node>>>)

pub fn get_shortcut_context(&self) -> Option<Gd<Node>>

pub fn update_minimum_size(&mut self)

Invalidates the size cache in this node and in parent nodes up to top level. Intended to be used with get_minimum_size when the return value is changed. Setting [member custom_minimum_size] directly calls this method automatically.

pub fn set_layout_direction(&mut self, direction: LayoutDirection)

pub fn get_layout_direction(&self) -> LayoutDirection

pub fn is_layout_rtl(&self) -> bool

Returns true if the layout is right-to-left. See also [member layout_direction].

pub fn set_auto_translate(&mut self, enable: bool)

pub fn is_auto_translating(&self) -> bool

pub fn set_localize_numeral_system(&mut self, enable: bool)

pub fn is_localizing_numeral_system(&self) -> bool

pub fn notify(&mut self, what: ControlNotification)

⚠️ Sends a Godot notification to all classes inherited by the object.

Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().

Starts from the highest ancestor (the Object class) and goes down the hierarchy. See also Godot docs for Object::notification().

§Panics

If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must be exclusive.

pub fn notify_reversed(&mut self, what: ControlNotification)

⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.

See docs of that method, including the panics.

Methods from Deref<Target = CanvasItem>§

pub fn get_canvas_item(&self) -> Rid

Returns the internal canvas item RID used by the RenderingServer for this node.

pub fn set_visible(&mut self, visible: bool)

pub fn is_visible(&self) -> bool

pub fn is_visible_in_tree(&self) -> bool

Returns true if the node is present in the SceneTree, its [member visible] property is true and all its ancestors are also visible. If any ancestor is hidden, this node will not be visible in the scene tree, and is therefore not drawn (see [method _draw]).

Visibility is checked only in parent nodes that inherit from CanvasItem, CanvasLayer, and Window. If the parent is of any other type (such as Node, AnimationPlayer, or Node3D), it is assumed to be visible.

Note: This method does not take [member visibility_layer] into account, so even if this method returns true, the node might end up not being rendered.

pub fn show(&mut self)

Show the CanvasItem if it’s currently hidden. This is equivalent to setting [member visible] to true.

Note: For controls that inherit Popup, the correct way to make them visible is to call one of the multiple popup*() functions instead.

pub fn hide(&mut self)

Hide the CanvasItem if it’s currently visible. This is equivalent to setting [member visible] to false.

pub fn queue_redraw(&mut self)

Queues the CanvasItem to redraw. During idle time, if CanvasItem is visible, CanvasItemNotification::DRAW is sent and [method _draw] is called. This only occurs once per frame, even if this method has been called multiple times.

pub fn move_to_front(&mut self)

Moves this node below its siblings, usually causing the node to draw on top of its siblings. Does nothing if this node does not have a parent. See also move_child.

pub fn set_as_top_level(&mut self, enable: bool)

pub fn is_set_as_top_level(&self) -> bool

pub fn set_light_mask(&mut self, light_mask: i32)

pub fn get_light_mask(&self) -> i32

pub fn set_modulate(&mut self, modulate: Color)

pub fn get_modulate(&self) -> Color

pub fn set_self_modulate(&mut self, self_modulate: Color)

pub fn get_self_modulate(&self) -> Color

pub fn set_z_index(&mut self, z_index: i32)

pub fn get_z_index(&self) -> i32

pub fn set_z_as_relative(&mut self, enable: bool)

pub fn is_z_relative(&self) -> bool

pub fn set_y_sort_enabled(&mut self, enabled: bool)

pub fn is_y_sort_enabled(&self) -> bool

pub fn set_draw_behind_parent(&mut self, enable: bool)

pub fn is_draw_behind_parent_enabled(&self) -> bool

pub fn draw_line(&mut self, from: Vector2, to: Vector2, color: Color)

To set the default parameters, use draw_line_ex and its builder methods. See the book for detailed usage instructions. Draws a line from a 2D point to another, with a given color and width. It can be optionally antialiased. The from and to positions are defined in local space. See also draw_dashed_line, draw_multiline, and draw_polyline.

If width is negative, then a two-point primitive will be drawn instead of a four-point one. This means that when the CanvasItem is scaled, the line will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

pub fn draw_line_ex<'ex>( &'ex mut self, from: Vector2, to: Vector2, color: Color, ) -> ExDrawLine<'ex>

Draws a line from a 2D point to another, with a given color and width. It can be optionally antialiased. The from and to positions are defined in local space. See also draw_dashed_line, draw_multiline, and draw_polyline.

If width is negative, then a two-point primitive will be drawn instead of a four-point one. This means that when the CanvasItem is scaled, the line will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

pub fn draw_dashed_line(&mut self, from: Vector2, to: Vector2, color: Color)

To set the default parameters, use draw_dashed_line_ex and its builder methods. See the book for detailed usage instructions. Draws a dashed line from a 2D point to another, with a given color and width. The from and to positions are defined in local space. See also draw_line, draw_multiline, and draw_polyline.

If width is negative, then a two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the line parts will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

dash is the length of each dash in pixels, with the gap between each dash being the same length. If aligned is true, the length of the first and last dashes may be shortened or lengthened to allow the line to begin and end at the precise points defined by from and to. Both ends are always symmetrical when aligned is true. If aligned is false, all dashes will have the same length, but the line may appear incomplete at the end due to the dash length not dividing evenly into the line length. Only full dashes are drawn when aligned is false.

If antialiased is true, half transparent “feathers” will be attached to the boundary, making outlines smooth.

Note: antialiased is only effective if width is greater than 0.0.

pub fn draw_dashed_line_ex<'ex>( &'ex mut self, from: Vector2, to: Vector2, color: Color, ) -> ExDrawDashedLine<'ex>

Draws a dashed line from a 2D point to another, with a given color and width. The from and to positions are defined in local space. See also draw_line, draw_multiline, and draw_polyline.

If width is negative, then a two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the line parts will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

dash is the length of each dash in pixels, with the gap between each dash being the same length. If aligned is true, the length of the first and last dashes may be shortened or lengthened to allow the line to begin and end at the precise points defined by from and to. Both ends are always symmetrical when aligned is true. If aligned is false, all dashes will have the same length, but the line may appear incomplete at the end due to the dash length not dividing evenly into the line length. Only full dashes are drawn when aligned is false.

If antialiased is true, half transparent “feathers” will be attached to the boundary, making outlines smooth.

Note: antialiased is only effective if width is greater than 0.0.

pub fn draw_polyline(&mut self, points: &PackedArray<Vector2>, color: Color)

To set the default parameters, use draw_polyline_ex and its builder methods. See the book for detailed usage instructions. Draws interconnected line segments with a uniform color and width and optional antialiasing (supported only for positive width). The points array is defined in local space. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw disconnected lines, use draw_multiline instead. See also draw_polygon.

If width is negative, it will be ignored and the polyline will be drawn using PrimitiveType::LINE_STRIP. This means that when the CanvasItem is scaled, the polyline will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

pub fn draw_polyline_ex<'ex>( &'ex mut self, points: &'ex PackedArray<Vector2>, color: Color, ) -> ExDrawPolyline<'ex>

Draws interconnected line segments with a uniform color and width and optional antialiasing (supported only for positive width). The points array is defined in local space. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw disconnected lines, use draw_multiline instead. See also draw_polygon.

If width is negative, it will be ignored and the polyline will be drawn using PrimitiveType::LINE_STRIP. This means that when the CanvasItem is scaled, the polyline will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

pub fn draw_polyline_colors( &mut self, points: &PackedArray<Vector2>, colors: &PackedArray<Color>, )

To set the default parameters, use draw_polyline_colors_ex and its builder methods. See the book for detailed usage instructions. Draws interconnected line segments with a uniform width, point-by-point coloring, and optional antialiasing (supported only for positive width). Colors assigned to line points match by index between points and colors, i.e. each line segment is filled with a gradient between the colors of the endpoints. The points array is defined in local space. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw disconnected lines, use draw_multiline_colors instead. See also draw_polygon.

If width is negative, it will be ignored and the polyline will be drawn using PrimitiveType::LINE_STRIP. This means that when the CanvasItem is scaled, the polyline will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

pub fn draw_polyline_colors_ex<'ex>( &'ex mut self, points: &'ex PackedArray<Vector2>, colors: &'ex PackedArray<Color>, ) -> ExDrawPolylineColors<'ex>

Draws interconnected line segments with a uniform width, point-by-point coloring, and optional antialiasing (supported only for positive width). Colors assigned to line points match by index between points and colors, i.e. each line segment is filled with a gradient between the colors of the endpoints. The points array is defined in local space. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw disconnected lines, use draw_multiline_colors instead. See also draw_polygon.

If width is negative, it will be ignored and the polyline will be drawn using PrimitiveType::LINE_STRIP. This means that when the CanvasItem is scaled, the polyline will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

pub fn draw_ellipse_arc( &mut self, center: Vector2, major: f32, minor: f32, start_angle: f32, end_angle: f32, point_count: i32, color: Color, )

To set the default parameters, use draw_ellipse_arc_ex and its builder methods. See the book for detailed usage instructions. Draws an unfilled elliptical arc between the given angles with a uniform color and width and optional antialiasing (supported only for positive width). The larger the value of point_count, the smoother the curve. For circular arcs, see draw_arc. See also draw_ellipse.

If width is negative, it will be ignored and the arc will be drawn using PrimitiveType::LINE_STRIP. This means that when the CanvasItem is scaled, the arc will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

The arc is drawn from start_angle towards the value of end_angle so in clockwise direction if start_angle < end_angle and counter-clockwise otherwise. Passing the same angles but in reversed order will produce the same arc. If absolute difference of start_angle and end_angle is greater than @GDScript.TAU radians, then a full ellipse is drawn (i.e. arc will not overlap itself).

pub fn draw_ellipse_arc_ex<'ex>( &'ex mut self, center: Vector2, major: f32, minor: f32, start_angle: f32, end_angle: f32, point_count: i32, color: Color, ) -> ExDrawEllipseArc<'ex>

Draws an unfilled elliptical arc between the given angles with a uniform color and width and optional antialiasing (supported only for positive width). The larger the value of point_count, the smoother the curve. For circular arcs, see draw_arc. See also draw_ellipse.

If width is negative, it will be ignored and the arc will be drawn using PrimitiveType::LINE_STRIP. This means that when the CanvasItem is scaled, the arc will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

The arc is drawn from start_angle towards the value of end_angle so in clockwise direction if start_angle < end_angle and counter-clockwise otherwise. Passing the same angles but in reversed order will produce the same arc. If absolute difference of start_angle and end_angle is greater than @GDScript.TAU radians, then a full ellipse is drawn (i.e. arc will not overlap itself).

pub fn draw_arc( &mut self, center: Vector2, radius: f32, start_angle: f32, end_angle: f32, point_count: i32, color: Color, )

To set the default parameters, use draw_arc_ex and its builder methods. See the book for detailed usage instructions. Draws an unfilled arc between the given angles with a uniform color and width and optional antialiasing (supported only for positive width). The larger the value of point_count, the smoother the curve. center is defined in local space. For elliptical arcs, see draw_ellipse_arc. See also draw_circle.

If width is negative, it will be ignored and the arc will be drawn using PrimitiveType::LINE_STRIP. This means that when the CanvasItem is scaled, the arc will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

The arc is drawn from start_angle towards the value of end_angle so in clockwise direction if start_angle < end_angle and counter-clockwise otherwise. Passing the same angles but in reversed order will produce the same arc. If absolute difference of start_angle and end_angle is greater than @GDScript.TAU radians, then a full circle arc is drawn (i.e. arc will not overlap itself).

pub fn draw_arc_ex<'ex>( &'ex mut self, center: Vector2, radius: f32, start_angle: f32, end_angle: f32, point_count: i32, color: Color, ) -> ExDrawArc<'ex>

Draws an unfilled arc between the given angles with a uniform color and width and optional antialiasing (supported only for positive width). The larger the value of point_count, the smoother the curve. center is defined in local space. For elliptical arcs, see draw_ellipse_arc. See also draw_circle.

If width is negative, it will be ignored and the arc will be drawn using PrimitiveType::LINE_STRIP. This means that when the CanvasItem is scaled, the arc will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

The arc is drawn from start_angle towards the value of end_angle so in clockwise direction if start_angle < end_angle and counter-clockwise otherwise. Passing the same angles but in reversed order will produce the same arc. If absolute difference of start_angle and end_angle is greater than @GDScript.TAU radians, then a full circle arc is drawn (i.e. arc will not overlap itself).

pub fn draw_multiline(&mut self, points: &PackedArray<Vector2>, color: Color)

To set the default parameters, use draw_multiline_ex and its builder methods. See the book for detailed usage instructions. Draws multiple disconnected lines with a uniform width and color. Each line is defined by two consecutive points from points array in local space, i.e. i-th segment consists of points[2 * i], points[2 * i + 1] endpoints. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw interconnected lines, use draw_polyline instead.

If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

Note: antialiased is only effective if width is greater than 0.0.

pub fn draw_multiline_ex<'ex>( &'ex mut self, points: &'ex PackedArray<Vector2>, color: Color, ) -> ExDrawMultiline<'ex>

Draws multiple disconnected lines with a uniform width and color. Each line is defined by two consecutive points from points array in local space, i.e. i-th segment consists of points[2 * i], points[2 * i + 1] endpoints. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw interconnected lines, use draw_polyline instead.

If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

Note: antialiased is only effective if width is greater than 0.0.

pub fn draw_multiline_colors( &mut self, points: &PackedArray<Vector2>, colors: &PackedArray<Color>, )

To set the default parameters, use draw_multiline_colors_ex and its builder methods. See the book for detailed usage instructions. Draws multiple disconnected lines with a uniform width and segment-by-segment coloring. Each segment is defined by two consecutive points from points array in local space and a corresponding color from colors array, i.e. i-th segment consists of points[2 * i], points[2 * i + 1] endpoints and has colors[i] color. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw interconnected lines, use draw_polyline_colors instead.

If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

Note: antialiased is only effective if width is greater than 0.0.

pub fn draw_multiline_colors_ex<'ex>( &'ex mut self, points: &'ex PackedArray<Vector2>, colors: &'ex PackedArray<Color>, ) -> ExDrawMultilineColors<'ex>

Draws multiple disconnected lines with a uniform width and segment-by-segment coloring. Each segment is defined by two consecutive points from points array in local space and a corresponding color from colors array, i.e. i-th segment consists of points[2 * i], points[2 * i + 1] endpoints and has colors[i] color. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw interconnected lines, use draw_polyline_colors instead.

If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

Note: antialiased is only effective if width is greater than 0.0.

pub fn draw_rect(&mut self, rect: Rect2, color: Color)

To set the default parameters, use draw_rect_ex and its builder methods. See the book for detailed usage instructions. Draws a rectangle. If filled is true, the rectangle will be filled with the color specified. If filled is false, the rectangle will be drawn as a stroke with the color and width specified. The rect is specified in local space. See also draw_texture_rect.

If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

If antialiased is true, half transparent “feathers” will be attached to the boundary, making outlines smooth.

Note: width is only effective if filled is false.

Note: Unfilled rectangles drawn with a negative width may not display perfectly. For example, corners may be missing or brighter due to overlapping lines (for a translucent color).

pub fn draw_rect_ex<'ex>( &'ex mut self, rect: Rect2, color: Color, ) -> ExDrawRect<'ex>

Draws a rectangle. If filled is true, the rectangle will be filled with the color specified. If filled is false, the rectangle will be drawn as a stroke with the color and width specified. The rect is specified in local space. See also draw_texture_rect.

If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

If antialiased is true, half transparent “feathers” will be attached to the boundary, making outlines smooth.

Note: width is only effective if filled is false.

Note: Unfilled rectangles drawn with a negative width may not display perfectly. For example, corners may be missing or brighter due to overlapping lines (for a translucent color).

pub fn draw_circle(&mut self, position: Vector2, radius: f32, color: Color)

To set the default parameters, use draw_circle_ex and its builder methods. See the book for detailed usage instructions. Draws a circle, with position defined in local space. See also draw_ellipse, draw_arc, draw_polyline, and draw_polygon.

If filled is true, the circle will be filled with the color specified. If filled is false, the circle will be drawn as a stroke with the color and width specified.

If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

If antialiased is true, half transparent “feathers” will be attached to the boundary, making outlines smooth.

Note: width is only effective if filled is false.

pub fn draw_circle_ex<'ex>( &'ex mut self, position: Vector2, radius: f32, color: Color, ) -> ExDrawCircle<'ex>

Draws a circle, with position defined in local space. See also draw_ellipse, draw_arc, draw_polyline, and draw_polygon.

If filled is true, the circle will be filled with the color specified. If filled is false, the circle will be drawn as a stroke with the color and width specified.

If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

If antialiased is true, half transparent “feathers” will be attached to the boundary, making outlines smooth.

Note: width is only effective if filled is false.

pub fn draw_ellipse( &mut self, position: Vector2, major: f32, minor: f32, color: Color, )

To set the default parameters, use draw_ellipse_ex and its builder methods. See the book for detailed usage instructions. Draws an ellipse with semi-major axis major and semi-minor axis minor. See also draw_circle, draw_ellipse_arc, draw_polyline, and draw_polygon.

If filled is true, the ellipse will be filled with the color specified. If filled is false, the ellipse will be drawn as a stroke with the color and width specified.

If width is negative, then two-point primitives will be drawn instead of four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

If antialiased is true, half transparent “feathers” will be attached to the boundary, making outlines smooth.

Note: width is only effective if filled is false.

pub fn draw_ellipse_ex<'ex>( &'ex mut self, position: Vector2, major: f32, minor: f32, color: Color, ) -> ExDrawEllipse<'ex>

Draws an ellipse with semi-major axis major and semi-minor axis minor. See also draw_circle, draw_ellipse_arc, draw_polyline, and draw_polygon.

If filled is true, the ellipse will be filled with the color specified. If filled is false, the ellipse will be drawn as a stroke with the color and width specified.

If width is negative, then two-point primitives will be drawn instead of four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0.

If antialiased is true, half transparent “feathers” will be attached to the boundary, making outlines smooth.

Note: width is only effective if filled is false.

pub fn draw_texture( &mut self, texture: impl AsArg<Gd<Texture2D>>, position: Vector2, )

To set the default parameters, use draw_texture_ex and its builder methods. See the book for detailed usage instructions. Draws a texture at a given position. The position is defined in local space.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_texture_ex<'ex>( &'ex mut self, texture: impl AsArg<Gd<Texture2D>> + 'ex, position: Vector2, ) -> ExDrawTexture<'ex>

Draws a texture at a given position. The position is defined in local space.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_texture_rect( &mut self, texture: impl AsArg<Gd<Texture2D>>, rect: Rect2, tile: bool, )

To set the default parameters, use draw_texture_rect_ex and its builder methods. See the book for detailed usage instructions. Draws a textured rectangle at a given position, optionally modulated by a color. The rect is defined in local space. If transpose is true, the texture will have its X and Y coordinates swapped. See also draw_rect and draw_texture_rect_region.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_texture_rect_ex<'ex>( &'ex mut self, texture: impl AsArg<Gd<Texture2D>> + 'ex, rect: Rect2, tile: bool, ) -> ExDrawTextureRect<'ex>

Draws a textured rectangle at a given position, optionally modulated by a color. The rect is defined in local space. If transpose is true, the texture will have its X and Y coordinates swapped. See also draw_rect and draw_texture_rect_region.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_texture_rect_region( &mut self, texture: impl AsArg<Gd<Texture2D>>, rect: Rect2, src_rect: Rect2, )

To set the default parameters, use draw_texture_rect_region_ex and its builder methods. See the book for detailed usage instructions. Draws a textured rectangle from a texture’s region (specified by src_rect) at a given position in local space, optionally modulated by a color. If transpose is true, the texture will have its X and Y coordinates swapped. See also draw_texture_rect.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_texture_rect_region_ex<'ex>( &'ex mut self, texture: impl AsArg<Gd<Texture2D>> + 'ex, rect: Rect2, src_rect: Rect2, ) -> ExDrawTextureRectRegion<'ex>

Draws a textured rectangle from a texture’s region (specified by src_rect) at a given position in local space, optionally modulated by a color. If transpose is true, the texture will have its X and Y coordinates swapped. See also draw_texture_rect.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_msdf_texture_rect_region( &mut self, texture: impl AsArg<Gd<Texture2D>>, rect: Rect2, src_rect: Rect2, )

To set the default parameters, use draw_msdf_texture_rect_region_ex and its builder methods. See the book for detailed usage instructions. Draws a textured rectangle region of the multichannel signed distance field texture at a given position, optionally modulated by a color. The rect is defined in local space. See [member FontFile.multichannel_signed_distance_field] for more information and caveats about MSDF font rendering.

If outline is positive, each alpha channel value of pixel in region is set to maximum value of true distance in the outline radius.

Value of the pixel_range should the same that was used during distance field texture generation.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_msdf_texture_rect_region_ex<'ex>( &'ex mut self, texture: impl AsArg<Gd<Texture2D>> + 'ex, rect: Rect2, src_rect: Rect2, ) -> ExDrawMsdfTextureRectRegion<'ex>

Draws a textured rectangle region of the multichannel signed distance field texture at a given position, optionally modulated by a color. The rect is defined in local space. See [member FontFile.multichannel_signed_distance_field] for more information and caveats about MSDF font rendering.

If outline is positive, each alpha channel value of pixel in region is set to maximum value of true distance in the outline radius.

Value of the pixel_range should the same that was used during distance field texture generation.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_lcd_texture_rect_region( &mut self, texture: impl AsArg<Gd<Texture2D>>, rect: Rect2, src_rect: Rect2, )

To set the default parameters, use draw_lcd_texture_rect_region_ex and its builder methods. See the book for detailed usage instructions. Draws a textured rectangle region of the font texture with LCD subpixel anti-aliasing at a given position, optionally modulated by a color. The rect is defined in local space.

Texture is drawn using the following blend operation, blend mode of the CanvasItemMaterial is ignored:

dst.r = texture.r * modulate.r * modulate.a + dst.r * (1.0 - texture.r * modulate.a);
dst.g = texture.g * modulate.g * modulate.a + dst.g * (1.0 - texture.g * modulate.a);
dst.b = texture.b * modulate.b * modulate.a + dst.b * (1.0 - texture.b * modulate.a);
dst.a = modulate.a + dst.a * (1.0 - modulate.a);

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_lcd_texture_rect_region_ex<'ex>( &'ex mut self, texture: impl AsArg<Gd<Texture2D>> + 'ex, rect: Rect2, src_rect: Rect2, ) -> ExDrawLcdTextureRectRegion<'ex>

Draws a textured rectangle region of the font texture with LCD subpixel anti-aliasing at a given position, optionally modulated by a color. The rect is defined in local space.

Texture is drawn using the following blend operation, blend mode of the CanvasItemMaterial is ignored:

dst.r = texture.r * modulate.r * modulate.a + dst.r * (1.0 - texture.r * modulate.a);
dst.g = texture.g * modulate.g * modulate.a + dst.g * (1.0 - texture.g * modulate.a);
dst.b = texture.b * modulate.b * modulate.a + dst.b * (1.0 - texture.b * modulate.a);
dst.a = modulate.a + dst.a * (1.0 - modulate.a);

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_style_box( &mut self, style_box: impl AsArg<Gd<StyleBox>>, rect: Rect2, )

Draws a styled rectangle. The rect is defined in local space.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_primitive( &mut self, points: &PackedArray<Vector2>, colors: &PackedArray<Color>, uvs: &PackedArray<Vector2>, )

To set the default parameters, use draw_primitive_ex and its builder methods. See the book for detailed usage instructions. Draws a custom primitive. 1 point for a point, 2 points for a line, 3 points for a triangle, and 4 points for a quad. If 0 points or more than 4 points are specified, nothing will be drawn and an error message will be printed. The points array is defined in local space. See also draw_line, draw_polyline, draw_polygon, and draw_rect.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_primitive_ex<'ex>( &'ex mut self, points: &'ex PackedArray<Vector2>, colors: &'ex PackedArray<Color>, uvs: &'ex PackedArray<Vector2>, ) -> ExDrawPrimitive<'ex>

Draws a custom primitive. 1 point for a point, 2 points for a line, 3 points for a triangle, and 4 points for a quad. If 0 points or more than 4 points are specified, nothing will be drawn and an error message will be printed. The points array is defined in local space. See also draw_line, draw_polyline, draw_polygon, and draw_rect.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_polygon( &mut self, points: &PackedArray<Vector2>, colors: &PackedArray<Color>, )

To set the default parameters, use draw_polygon_ex and its builder methods. See the book for detailed usage instructions. Draws a solid polygon of any number of points, convex or concave. Unlike draw_colored_polygon, each point’s color can be changed individually. The points array is defined in local space. See also draw_polyline and draw_polyline_colors. If you need more flexibility (such as being able to use bones), use canvas_item_add_triangle_array instead.

Note: If you frequently redraw the same polygon with a large number of vertices, consider pre-calculating the triangulation with triangulate_polygon and using draw_mesh, draw_multimesh, or canvas_item_add_triangle_array.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_polygon_ex<'ex>( &'ex mut self, points: &'ex PackedArray<Vector2>, colors: &'ex PackedArray<Color>, ) -> ExDrawPolygon<'ex>

Draws a solid polygon of any number of points, convex or concave. Unlike draw_colored_polygon, each point’s color can be changed individually. The points array is defined in local space. See also draw_polyline and draw_polyline_colors. If you need more flexibility (such as being able to use bones), use canvas_item_add_triangle_array instead.

Note: If you frequently redraw the same polygon with a large number of vertices, consider pre-calculating the triangulation with triangulate_polygon and using draw_mesh, draw_multimesh, or canvas_item_add_triangle_array.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_colored_polygon( &mut self, points: &PackedArray<Vector2>, color: Color, )

To set the default parameters, use draw_colored_polygon_ex and its builder methods. See the book for detailed usage instructions. Draws a colored polygon of any number of points, convex or concave. The points in the points array are defined in local space. Unlike draw_polygon, a single color must be specified for the whole polygon.

Note: If you frequently redraw the same polygon with a large number of vertices, consider pre-calculating the triangulation with triangulate_polygon and using draw_mesh, draw_multimesh, or canvas_item_add_triangle_array.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_colored_polygon_ex<'ex>( &'ex mut self, points: &'ex PackedArray<Vector2>, color: Color, ) -> ExDrawColoredPolygon<'ex>

Draws a colored polygon of any number of points, convex or concave. The points in the points array are defined in local space. Unlike draw_polygon, a single color must be specified for the whole polygon.

Note: If you frequently redraw the same polygon with a large number of vertices, consider pre-calculating the triangulation with triangulate_polygon and using draw_mesh, draw_multimesh, or canvas_item_add_triangle_array.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_string( &self, font: impl AsArg<Gd<Font>>, pos: Vector2, text: impl AsArg<GString>, )

To set the default parameters, use draw_string_ex and its builder methods. See the book for detailed usage instructions. Draws text using the specified font at the pos in local space (bottom-left corner using the baseline of the font). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Example: Draw “Hello world”, using the project’s default font:

draw_string(ThemeDB.fallback_font, Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, ThemeDB.fallback_font_size)

See also draw_string.

pub fn draw_string_ex<'ex>( &'ex self, font: impl AsArg<Gd<Font>> + 'ex, pos: Vector2, text: impl AsArg<GString> + 'ex, ) -> ExDrawString<'ex>

Draws text using the specified font at the pos in local space (bottom-left corner using the baseline of the font). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Example: Draw “Hello world”, using the project’s default font:

draw_string(ThemeDB.fallback_font, Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, ThemeDB.fallback_font_size)

See also draw_string.

pub fn draw_multiline_string( &self, font: impl AsArg<Gd<Font>>, pos: Vector2, text: impl AsArg<GString>, )

To set the default parameters, use draw_multiline_string_ex and its builder methods. See the book for detailed usage instructions. Breaks text into lines and draws it using the specified font at the pos in local space (top-left corner). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

pub fn draw_multiline_string_ex<'ex>( &'ex self, font: impl AsArg<Gd<Font>> + 'ex, pos: Vector2, text: impl AsArg<GString> + 'ex, ) -> ExDrawMultilineString<'ex>

Breaks text into lines and draws it using the specified font at the pos in local space (top-left corner). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

pub fn draw_string_outline( &self, font: impl AsArg<Gd<Font>>, pos: Vector2, text: impl AsArg<GString>, )

To set the default parameters, use draw_string_outline_ex and its builder methods. See the book for detailed usage instructions. Draws text outline using the specified font at the pos in local space (bottom-left corner using the baseline of the font). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

pub fn draw_string_outline_ex<'ex>( &'ex self, font: impl AsArg<Gd<Font>> + 'ex, pos: Vector2, text: impl AsArg<GString> + 'ex, ) -> ExDrawStringOutline<'ex>

Draws text outline using the specified font at the pos in local space (bottom-left corner using the baseline of the font). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

pub fn draw_multiline_string_outline( &self, font: impl AsArg<Gd<Font>>, pos: Vector2, text: impl AsArg<GString>, )

To set the default parameters, use draw_multiline_string_outline_ex and its builder methods. See the book for detailed usage instructions. Breaks text to the lines and draws text outline using the specified font at the pos in local space (top-left corner). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

pub fn draw_multiline_string_outline_ex<'ex>( &'ex self, font: impl AsArg<Gd<Font>> + 'ex, pos: Vector2, text: impl AsArg<GString> + 'ex, ) -> ExDrawMultilineStringOutline<'ex>

Breaks text to the lines and draws text outline using the specified font at the pos in local space (top-left corner). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

pub fn draw_char( &self, font: impl AsArg<Gd<Font>>, pos: Vector2, char: impl AsArg<GString>, )

To set the default parameters, use draw_char_ex and its builder methods. See the book for detailed usage instructions. Draws a string first character using a custom font. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. pos is defined in local space.

pub fn draw_char_ex<'ex>( &'ex self, font: impl AsArg<Gd<Font>> + 'ex, pos: Vector2, char: impl AsArg<GString> + 'ex, ) -> ExDrawChar<'ex>

Draws a string first character using a custom font. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. pos is defined in local space.

pub fn draw_char_outline( &self, font: impl AsArg<Gd<Font>>, pos: Vector2, char: impl AsArg<GString>, )

To set the default parameters, use draw_char_outline_ex and its builder methods. See the book for detailed usage instructions. Draws a string first character outline using a custom font. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. pos is defined in local space.

pub fn draw_char_outline_ex<'ex>( &'ex self, font: impl AsArg<Gd<Font>> + 'ex, pos: Vector2, char: impl AsArg<GString> + 'ex, ) -> ExDrawCharOutline<'ex>

Draws a string first character outline using a custom font. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. pos is defined in local space.

pub fn draw_mesh( &mut self, mesh: impl AsArg<Gd<Mesh>>, texture: impl AsArg<Option<Gd<Texture2D>>>, )

To set the default parameters, use draw_mesh_ex and its builder methods. See the book for detailed usage instructions. Draws a Mesh in 2D, using the provided texture. See MeshInstance2D for related documentation. The transform is defined in local space.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_mesh_ex<'ex>( &'ex mut self, mesh: impl AsArg<Gd<Mesh>> + 'ex, texture: impl AsArg<Option<Gd<Texture2D>>> + 'ex, ) -> ExDrawMesh<'ex>

Draws a Mesh in 2D, using the provided texture. See MeshInstance2D for related documentation. The transform is defined in local space.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_multimesh( &mut self, multimesh: impl AsArg<Gd<MultiMesh>>, texture: impl AsArg<Option<Gd<Texture2D>>>, )

Draws a MultiMesh in 2D with the provided texture. See MultiMeshInstance2D for related documentation.

Note: Styleboxes, textures, and meshes stored only inside local variables should not be used with this method in GDScript, because the drawing operation doesn’t begin immediately once this method is called. In GDScript, when the function with the local variables ends, the local variables get destroyed before the rendering takes place.

pub fn draw_set_transform(&mut self, position: Vector2)

To set the default parameters, use draw_set_transform_ex and its builder methods. See the book for detailed usage instructions. Sets a custom local transform for drawing via components. Anything drawn afterwards will be transformed by this.

Note: [member FontFile.oversampling] does not take scale into account. This means that scaling up/down will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear blurry or pixelated. To ensure text remains crisp regardless of scale, you can enable MSDF font rendering by enabling [member ProjectSettings.gui/theme/default_font_multichannel_signed_distance_field] (applies to the default project font only), or enabling Multichannel Signed Distance Field in the import options of a DynamicFont for custom fonts. On system fonts, [member SystemFont.multichannel_signed_distance_field] can be enabled in the inspector.

pub fn draw_set_transform_ex<'ex>( &'ex mut self, position: Vector2, ) -> ExDrawSetTransform<'ex>

Sets a custom local transform for drawing via components. Anything drawn afterwards will be transformed by this.

Note: [member FontFile.oversampling] does not take scale into account. This means that scaling up/down will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear blurry or pixelated. To ensure text remains crisp regardless of scale, you can enable MSDF font rendering by enabling [member ProjectSettings.gui/theme/default_font_multichannel_signed_distance_field] (applies to the default project font only), or enabling Multichannel Signed Distance Field in the import options of a DynamicFont for custom fonts. On system fonts, [member SystemFont.multichannel_signed_distance_field] can be enabled in the inspector.

pub fn draw_set_transform_matrix(&mut self, xform: Transform2D)

Sets a custom local transform for drawing via matrix. Anything drawn afterwards will be transformed by this.

pub fn draw_animation_slice( &mut self, animation_length: f64, slice_begin: f64, slice_end: f64, )

To set the default parameters, use draw_animation_slice_ex and its builder methods. See the book for detailed usage instructions. Subsequent drawing commands will be ignored unless they fall within the specified animation slice. This is a faster way to implement animations that loop on background rather than redrawing constantly.

pub fn draw_animation_slice_ex<'ex>( &'ex mut self, animation_length: f64, slice_begin: f64, slice_end: f64, ) -> ExDrawAnimationSlice<'ex>

Subsequent drawing commands will be ignored unless they fall within the specified animation slice. This is a faster way to implement animations that loop on background rather than redrawing constantly.

pub fn draw_end_animation(&mut self)

After submitting all animations slices via draw_animation_slice, this function can be used to revert drawing to its default state (all subsequent drawing commands will be visible). If you don’t care about this particular use case, usage of this function after submitting the slices is not required.

pub fn get_transform(&self) -> Transform2D

Returns the transform matrix of this CanvasItem.

pub fn get_global_transform(&self) -> Transform2D

Returns the global transform matrix of this item, i.e. the combined transform up to the topmost CanvasItem node. The topmost item is a CanvasItem that either has no parent, has non-CanvasItem parent or it has [member top_level] enabled.

pub fn get_global_transform_with_canvas(&self) -> Transform2D

Returns the transform from the local coordinate system of this CanvasItem to the Viewports coordinate system.

pub fn get_viewport_transform(&self) -> Transform2D

Returns the transform of this node, converted from its registered canvas’s coordinate system to its viewport embedder’s coordinate system. See also get_final_transform and get_viewport.

pub fn get_viewport_rect(&self) -> Rect2

Returns this node’s viewport boundaries as a Rect2. See also get_viewport.

pub fn get_canvas_transform(&self) -> Transform2D

Returns the transform of this node, converted from its registered canvas’s coordinate system to its viewport’s coordinate system. See also get_viewport.

pub fn get_screen_transform(&self) -> Transform2D

Returns the transform of this CanvasItem in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins.

Equivalent to get_global_transform_with_canvas if the window is embedded (see [member Viewport.gui_embed_subwindows]).

pub fn get_local_mouse_position(&self) -> Vector2

Returns the mouse’s position in this CanvasItem using the local coordinate system of this CanvasItem.

pub fn get_global_mouse_position(&self) -> Vector2

Returns mouse cursor’s global position relative to the CanvasLayer that contains this node.

Note: For screen-space coordinates (e.g. when using a non-embedded Popup), you can use mouse_get_position.

pub fn get_canvas(&self) -> Rid

Returns the RID of the World2D canvas where this node is registered to, used by the RenderingServer.

pub fn get_canvas_layer_node(&self) -> Option<Gd<CanvasLayer>>

Returns the CanvasLayer that contains this node, or null if the node is not in any CanvasLayer.

pub fn get_world_2d(&self) -> Option<Gd<World2D>>

Returns the World2D this node is registered to.

Usually, this is the same as this node’s viewport (see get_viewport and find_world_2d).

pub fn set_material(&mut self, material: impl AsArg<Option<Gd<Material>>>)

pub fn get_material(&self) -> Option<Gd<Material>>

pub fn set_instance_shader_parameter( &mut self, name: impl AsArg<StringName>, value: &Variant, )

Set the value of a shader uniform for this instance only (per-instance uniform). See also set_shader_parameter to assign a uniform on all instances using the same ShaderMaterial.

Note: For a shader uniform to be assignable on a per-instance basis, it must be defined with instance uniform ... rather than uniform ... in the shader code.

Note: name is case-sensitive and must match the name of the uniform in the code exactly (not the capitalized name in the inspector).

pub fn get_instance_shader_parameter( &self, name: impl AsArg<StringName>, ) -> Variant

Get the value of a shader parameter as set on this instance.

pub fn set_use_parent_material(&mut self, enable: bool)

pub fn get_use_parent_material(&self) -> bool

pub fn set_notify_local_transform(&mut self, enable: bool)

If true, the node will receive CanvasItemNotification::LOCAL_TRANSFORM_CHANGED whenever its local transform changes.

Note: Many canvas items such as Bone2D or CollisionShape2D automatically enable this in order to function correctly.

pub fn is_local_transform_notification_enabled(&self) -> bool

Returns true if the node receives CanvasItemNotification::LOCAL_TRANSFORM_CHANGED whenever its local transform changes. This is enabled with set_notify_local_transform.

pub fn set_notify_transform(&mut self, enable: bool)

If true, the node will receive CanvasItemNotification::TRANSFORM_CHANGED whenever its global transform changes.

Note: Many canvas items such as Camera2D or Light2D automatically enable this in order to function correctly.

pub fn is_transform_notification_enabled(&self) -> bool

Returns true if the node receives CanvasItemNotification::TRANSFORM_CHANGED whenever its global transform changes. This is enabled with set_notify_transform.

pub fn force_update_transform(&mut self)

Forces the node’s transform to update. Fails if the node is not inside the tree. See also get_transform.

Note: For performance reasons, transform changes are usually accumulated and applied once at the end of the frame. The update propagates through CanvasItem children, as well. Therefore, use this method only when you need an up-to-date transform (such as during physics operations).

pub fn make_canvas_position_local(&self, viewport_point: Vector2) -> Vector2

Transforms viewport_point from the viewport’s coordinates to this node’s local coordinates.

For the opposite operation, use get_global_transform_with_canvas.

var viewport_point = get_global_transform_with_canvas() * local_point

pub fn make_input_local( &self, event: impl AsArg<Gd<InputEvent>>, ) -> Gd<InputEvent>

Returns a copy of the given event with its coordinates converted from global space to this CanvasItem’s local space. If not possible, returns the same InputEvent unchanged.

pub fn set_visibility_layer(&mut self, layer: u32)

pub fn get_visibility_layer(&self) -> u32

pub fn set_visibility_layer_bit(&mut self, layer: u32, enabled: bool)

Set/clear individual bits on the rendering visibility layer. This simplifies editing this CanvasItem’s visibility layer.

pub fn get_visibility_layer_bit(&self, layer: u32) -> bool

Returns true if the layer at the given index is set in [member visibility_layer].

pub fn set_texture_filter(&mut self, mode: TextureFilter)

pub fn get_texture_filter(&self) -> TextureFilter

pub fn set_texture_repeat(&mut self, mode: TextureRepeat)

pub fn get_texture_repeat(&self) -> TextureRepeat

pub fn set_clip_children_mode(&mut self, mode: ClipChildrenMode)

pub fn get_clip_children_mode(&self) -> ClipChildrenMode

pub fn notify(&mut self, what: CanvasItemNotification)

⚠️ Sends a Godot notification to all classes inherited by the object.

Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().

Starts from the highest ancestor (the Object class) and goes down the hierarchy. See also Godot docs for Object::notification().

§Panics

If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must be exclusive.

pub fn notify_reversed(&mut self, what: CanvasItemNotification)

⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.

See docs of that method, including the panics.

Methods from Deref<Target = Node>§

pub fn get_node_as<T>(&self, path: impl AsArg<NodePath>) -> Gd<T>
where T: Inherits<Node>,

⚠️ Retrieves the node at path path, panicking if not found or bad type.

§Panics

If the node is not found, or if it does not have type T or inherited.

pub fn try_get_node_as<T>(&self, path: impl AsArg<NodePath>) -> Option<Gd<T>>
where T: Inherits<Node>,

Retrieves the node at path path (fallible).

If the node is not found, or if it does not have type T or inherited, None will be returned.

pub fn get_tree(&self) -> Gd<SceneTree>

⚠️ Assuming the node is inside a scene tree, obtains the latter.

§Panics

If the node is not inside the scene tree. If you’re unsure, use get_tree_or_null().

pub fn get_tree_or_null(&self) -> Option<Gd<SceneTree>>

Fallibly obtains the scene tree containing the node, or None.

pub fn add_sibling(&mut self, sibling: impl AsArg<Gd<Node>>)

To set the default parameters, use add_sibling_ex and its builder methods. See the book for detailed usage instructions. Adds a sibling node to this node’s parent, and moves the added sibling right below this node.

If force_readable_name is true, improves the readability of the added sibling. If not named, the sibling is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to false, which assigns a dummy name featuring @ in both situations.

Use add_child instead of this method if you don’t need the child node to be added below a specific node in the list of children.

Note: If this node is internal, the added sibling will be internal too (see add_child’s internal parameter).

pub fn add_sibling_ex<'ex>( &'ex mut self, sibling: impl AsArg<Gd<Node>> + 'ex, ) -> ExAddSibling<'ex>

Adds a sibling node to this node’s parent, and moves the added sibling right below this node.

If force_readable_name is true, improves the readability of the added sibling. If not named, the sibling is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to false, which assigns a dummy name featuring @ in both situations.

Use add_child instead of this method if you don’t need the child node to be added below a specific node in the list of children.

Note: If this node is internal, the added sibling will be internal too (see add_child’s internal parameter).

pub fn set_name(&mut self, name: impl AsArg<StringName>)

pub fn get_name(&self) -> StringName

pub fn add_child(&mut self, node: impl AsArg<Gd<Node>>)

To set the default parameters, use add_child_ex and its builder methods. See the book for detailed usage instructions. Adds a child node. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node.

If force_readable_name is true, improves the readability of the added node. If not named, the node is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to false, which assigns a dummy name featuring @ in both situations.

If internal is different than InternalMode::DISABLED, the child will be added as internal node. These nodes are ignored by methods like get_children, unless their parameter include_internal is true. It also prevents these nodes being duplicated with their parent. The intended usage is to hide the internal nodes from the user, so the user won’t accidentally delete or modify them. Used by some GUI nodes, e.g. ColorPicker.

Note: If node already has a parent, this method will fail. Use remove_child first to remove node from its current parent. For example:

var child_node = get_child(0)
if child_node.get_parent():
	child_node.get_parent().remove_child(child_node)
add_child(child_node)

If you need the child node to be added below a specific node in the list of children, use add_sibling instead of this method.

Note: If you want a child to be persisted to a PackedScene, you must set [member owner] in addition to calling add_child. This is typically relevant for tool scripts and editor plugins. If add_child is called without setting [member owner], the newly added Node will not be visible in the scene tree, though it will be visible in the 2D/3D view.

pub fn add_child_ex<'ex>( &'ex mut self, node: impl AsArg<Gd<Node>> + 'ex, ) -> ExAddChild<'ex>

Adds a child node. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node.

If force_readable_name is true, improves the readability of the added node. If not named, the node is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to false, which assigns a dummy name featuring @ in both situations.

If internal is different than InternalMode::DISABLED, the child will be added as internal node. These nodes are ignored by methods like get_children, unless their parameter include_internal is true. It also prevents these nodes being duplicated with their parent. The intended usage is to hide the internal nodes from the user, so the user won’t accidentally delete or modify them. Used by some GUI nodes, e.g. ColorPicker.

Note: If node already has a parent, this method will fail. Use remove_child first to remove node from its current parent. For example:

var child_node = get_child(0)
if child_node.get_parent():
	child_node.get_parent().remove_child(child_node)
add_child(child_node)

If you need the child node to be added below a specific node in the list of children, use add_sibling instead of this method.

Note: If you want a child to be persisted to a PackedScene, you must set [member owner] in addition to calling add_child. This is typically relevant for tool scripts and editor plugins. If add_child is called without setting [member owner], the newly added Node will not be visible in the scene tree, though it will be visible in the 2D/3D view.

pub fn remove_child(&mut self, node: impl AsArg<Gd<Node>>)

Removes a child node. The node, along with its children, are not deleted. To delete a node, see queue_free.

Note: When this node is inside the tree, this method sets the [member owner] of the removed node (or its descendants) to null, if their [member owner] is no longer an ancestor (see is_ancestor_of).

pub fn reparent(&mut self, new_parent: impl AsArg<Gd<Node>>)

To set the default parameters, use reparent_ex and its builder methods. See the book for detailed usage instructions. Changes the parent of this Node to the new_parent. The node needs to already have a parent. The node’s [member owner] is preserved if its owner is still reachable from the new location (i.e., the node is still a descendant of the new parent after the operation).

If keep_global_transform is true, the node’s global transform will be preserved if supported. Node2D, Node3D and Control support this argument (but Control keeps only position).

pub fn reparent_ex<'ex>( &'ex mut self, new_parent: impl AsArg<Gd<Node>> + 'ex, ) -> ExReparent<'ex>

Changes the parent of this Node to the new_parent. The node needs to already have a parent. The node’s [member owner] is preserved if its owner is still reachable from the new location (i.e., the node is still a descendant of the new parent after the operation).

If keep_global_transform is true, the node’s global transform will be preserved if supported. Node2D, Node3D and Control support this argument (but Control keeps only position).

pub fn get_child_count(&self) -> i32

To set the default parameters, use get_child_count_ex and its builder methods. See the book for detailed usage instructions. Returns the number of children of this node.

If include_internal is false, internal children are not counted (see add_child’s internal parameter).

pub fn get_child_count_ex<'ex>(&'ex self) -> ExGetChildCount<'ex>

Returns the number of children of this node.

If include_internal is false, internal children are not counted (see add_child’s internal parameter).

pub fn get_children(&self) -> Array<Gd<Node>>

To set the default parameters, use get_children_ex and its builder methods. See the book for detailed usage instructions. Returns all children of this node inside an Array.

If include_internal is false, excludes internal children from the returned array (see add_child’s internal parameter).

pub fn get_children_ex<'ex>(&'ex self) -> ExGetChildren<'ex>

Returns all children of this node inside an Array.

If include_internal is false, excludes internal children from the returned array (see add_child’s internal parameter).

pub fn get_child(&self, idx: i32) -> Option<Gd<Node>>

To set the default parameters, use get_child_ex and its builder methods. See the book for detailed usage instructions. Fetches a child node by its index. Each child node has an index relative to its siblings (see get_index). The first child is at index 0. Negative values can also be used to start from the end of the list. This method can be used in combination with get_child_count to iterate over this node’s children. If no child exists at the given index, this method returns null and an error is generated.

If include_internal is false, internal children are ignored (see add_child’s internal parameter).

# Assuming the following are children of this node, in order:
# First, Middle, Last.

var a = get_child(0).name  # a is "First"
var b = get_child(1).name  # b is "Middle"
var b = get_child(2).name  # b is "Last"
var c = get_child(-1).name # c is "Last"

Note: To fetch a node by NodePath, use get_node_as.

pub fn get_child_ex<'ex>(&'ex self, idx: i32) -> ExGetChild<'ex>

Fetches a child node by its index. Each child node has an index relative to its siblings (see get_index). The first child is at index 0. Negative values can also be used to start from the end of the list. This method can be used in combination with get_child_count to iterate over this node’s children. If no child exists at the given index, this method returns null and an error is generated.

If include_internal is false, internal children are ignored (see add_child’s internal parameter).

# Assuming the following are children of this node, in order:
# First, Middle, Last.

var a = get_child(0).name  # a is "First"
var b = get_child(1).name  # b is "Middle"
var b = get_child(2).name  # b is "Last"
var c = get_child(-1).name # c is "Last"

Note: To fetch a node by NodePath, use get_node_as.

pub fn has_node(&self, path: impl AsArg<NodePath>) -> bool

Returns true if the path points to a valid node. See also get_node_as.

pub fn get_node_or_null(&self, path: impl AsArg<NodePath>) -> Option<Gd<Node>>

Fetches a node by NodePath. Similar to get_node_as, but does not generate an error if path does not point to a valid node.

pub fn get_parent(&self) -> Option<Gd<Node>>

Returns this node’s parent node, or null if the node doesn’t have a parent.

pub fn find_child(&self, pattern: impl AsArg<GString>) -> Option<Gd<Node>>

To set the default parameters, use find_child_ex and its builder methods. See the book for detailed usage instructions. Finds the first descendant of this node whose [member name] matches pattern, returning null if no match is found. The matching is done against node names, not their paths, through match_glob. As such, it is case-sensitive, "*" matches zero or more characters, and "?" matches any single character.

If recursive is false, only this node’s direct children are checked. Nodes are checked in tree order, so this node’s first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. Internal children are also included in the search (see internal parameter in add_child).

If owned is true, only descendants with a valid [member owner] node are checked.

Note: This method can be very slow. Consider storing a reference to the found node in a variable. Alternatively, use get_node_as with unique names (see [member unique_name_in_owner]).

Note: To find all descendant nodes matching a pattern or a class type, see find_children.

pub fn find_child_ex<'ex>( &'ex self, pattern: impl AsArg<GString> + 'ex, ) -> ExFindChild<'ex>

Finds the first descendant of this node whose [member name] matches pattern, returning null if no match is found. The matching is done against node names, not their paths, through match_glob. As such, it is case-sensitive, "*" matches zero or more characters, and "?" matches any single character.

If recursive is false, only this node’s direct children are checked. Nodes are checked in tree order, so this node’s first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. Internal children are also included in the search (see internal parameter in add_child).

If owned is true, only descendants with a valid [member owner] node are checked.

Note: This method can be very slow. Consider storing a reference to the found node in a variable. Alternatively, use get_node_as with unique names (see [member unique_name_in_owner]).

Note: To find all descendant nodes matching a pattern or a class type, see find_children.

pub fn find_children(&self, pattern: impl AsArg<GString>) -> Array<Gd<Node>>

To set the default parameters, use find_children_ex and its builder methods. See the book for detailed usage instructions. Finds all descendants of this node whose names match pattern, returning an empty Array if no match is found. The matching is done against node names, not their paths, through match_glob. As such, it is case-sensitive, "*" matches zero or more characters, and "?" matches any single character.

If type is not empty, only ancestors inheriting from type are included (see is_class).

If recursive is false, only this node’s direct children are checked. Nodes are checked in tree order, so this node’s first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. Internal children are also included in the search (see internal parameter in add_child).

If owned is true, only descendants with a valid [member owner] node are checked.

Note: This method can be very slow. Consider storing references to the found nodes in a variable.

Note: To find a single descendant node matching a pattern, see find_child.

pub fn find_children_ex<'ex>( &'ex self, pattern: impl AsArg<GString> + 'ex, ) -> ExFindChildren<'ex>

Finds all descendants of this node whose names match pattern, returning an empty Array if no match is found. The matching is done against node names, not their paths, through match_glob. As such, it is case-sensitive, "*" matches zero or more characters, and "?" matches any single character.

If type is not empty, only ancestors inheriting from type are included (see is_class).

If recursive is false, only this node’s direct children are checked. Nodes are checked in tree order, so this node’s first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. Internal children are also included in the search (see internal parameter in add_child).

If owned is true, only descendants with a valid [member owner] node are checked.

Note: This method can be very slow. Consider storing references to the found nodes in a variable.

Note: To find a single descendant node matching a pattern, see find_child.

pub fn find_parent(&self, pattern: impl AsArg<GString>) -> Option<Gd<Node>>

Finds the first ancestor of this node whose [member name] matches pattern, returning null if no match is found. The matching is done through match_glob. As such, it is case-sensitive, "*" matches zero or more characters, and "?" matches any single character. See also find_child and find_children.

Note: As this method walks upwards in the scene tree, it can be slow in large, deeply nested nodes. Consider storing a reference to the found node in a variable. Alternatively, use get_node_as with unique names (see [member unique_name_in_owner]).

pub fn has_node_and_resource(&self, path: impl AsArg<NodePath>) -> bool

Returns true if path points to a valid node and its subnames point to a valid Resource, e.g. Area2D/CollisionShape2D:shape. Properties that are not Resource types (such as nodes or other Variant types) are not considered. See also get_node_and_resource.

pub fn get_node_and_resource( &self, path: impl AsArg<NodePath>, ) -> Array<Variant>

Fetches a node and its most nested resource as specified by the NodePath’s subname. Returns an Array of size 3 where:

  • Element 0 is the Node, or null if not found;

  • Element 1 is the subname’s last nested Resource, or null if not found;

  • Element 2 is the remaining NodePath, referring to an existing, non-Resource property (see get_indexed).

Example: Assume that the child’s [member Sprite2D.texture] has been assigned an AtlasTexture:

var a = get_node_and_resource("Area2D/Sprite2D")
print(a[0].name) # Prints Sprite2D
print(a[1])      # Prints <null>
print(a[2])      # Prints ^""

var b = get_node_and_resource("Area2D/Sprite2D:texture:atlas")
print(b[0].name)        # Prints Sprite2D
print(b[1].get_class()) # Prints AtlasTexture
print(b[2])             # Prints ^""

var c = get_node_and_resource("Area2D/Sprite2D:texture:atlas:region")
print(c[0].name)        # Prints Sprite2D
print(c[1].get_class()) # Prints AtlasTexture
print(c[2])             # Prints ^":region"

pub fn is_inside_tree(&self) -> bool

Returns true if this node is currently inside a SceneTree. See also get_tree.

pub fn is_part_of_edited_scene(&self) -> bool

Returns true if the node is part of the scene currently opened in the editor.

pub fn is_ancestor_of(&self, node: impl AsArg<Gd<Node>>) -> bool

Returns true if the given node is a direct or indirect child of this node.

pub fn is_greater_than(&self, node: impl AsArg<Gd<Node>>) -> bool

Returns true if the given node occurs later in the scene hierarchy than this node. A node occurring later is usually processed last.

pub fn get_path(&self) -> NodePath

Returns the node’s absolute path, relative to the [member SceneTree.root]. If the node is not inside the scene tree, this method fails and returns an empty NodePath.

pub fn get_path_to(&self, node: impl AsArg<Gd<Node>>) -> NodePath

To set the default parameters, use get_path_to_ex and its builder methods. See the book for detailed usage instructions. Returns the relative NodePath from this node to the specified node. Both nodes must be in the same SceneTree or scene hierarchy, otherwise this method fails and returns an empty NodePath.

If use_unique_path is true, returns the shortest path accounting for this node’s unique name (see [member unique_name_in_owner]).

Note: If you get a relative path which starts from a unique node, the path may be longer than a normal relative path, due to the addition of the unique node’s name.

pub fn get_path_to_ex<'ex>( &'ex self, node: impl AsArg<Gd<Node>> + 'ex, ) -> ExGetPathTo<'ex>

Returns the relative NodePath from this node to the specified node. Both nodes must be in the same SceneTree or scene hierarchy, otherwise this method fails and returns an empty NodePath.

If use_unique_path is true, returns the shortest path accounting for this node’s unique name (see [member unique_name_in_owner]).

Note: If you get a relative path which starts from a unique node, the path may be longer than a normal relative path, due to the addition of the unique node’s name.

pub fn add_to_group(&mut self, group: impl AsArg<StringName>)

To set the default parameters, use add_to_group_ex and its builder methods. See the book for detailed usage instructions. Adds the node to the group. Groups can be helpful to organize a subset of nodes, for example "enemies" or "collectables". See notes in the description, and the group methods in SceneTree.

If persistent is true, the group will be stored when saved inside a PackedScene. All groups created and displayed in the Groups dock are persistent.

Note: To improve performance, the order of group names is not guaranteed and may vary between project runs. Therefore, do not rely on the group order.

Note: SceneTree’s group methods will not work on this node if not inside the tree (see is_inside_tree).

pub fn add_to_group_ex<'ex>( &'ex mut self, group: impl AsArg<StringName> + 'ex, ) -> ExAddToGroup<'ex>

Adds the node to the group. Groups can be helpful to organize a subset of nodes, for example "enemies" or "collectables". See notes in the description, and the group methods in SceneTree.

If persistent is true, the group will be stored when saved inside a PackedScene. All groups created and displayed in the Groups dock are persistent.

Note: To improve performance, the order of group names is not guaranteed and may vary between project runs. Therefore, do not rely on the group order.

Note: SceneTree’s group methods will not work on this node if not inside the tree (see is_inside_tree).

pub fn remove_from_group(&mut self, group: impl AsArg<StringName>)

Removes the node from the given group. Does nothing if the node is not in the group. See also notes in the description, and the SceneTree’s group methods.

pub fn is_in_group(&self, group: impl AsArg<StringName>) -> bool

Returns true if this node has been added to the given group. See add_to_group and remove_from_group. See also notes in the description, and the SceneTree’s group methods.

pub fn move_child(&mut self, child_node: impl AsArg<Gd<Node>>, to_index: i32)

Moves child_node to the given index. A node’s index is the order among its siblings. If to_index is negative, the index is counted from the end of the list. See also get_child and get_index.

Note: The processing order of several engine callbacks (ready, process, etc.) and notifications sent through propagate_notification is affected by tree order. CanvasItem nodes are also rendered in tree order. See also [member process_priority].

pub fn get_groups(&self) -> Array<StringName>

Returns an Array of group names that the node has been added to.

Note: To improve performance, the order of group names is not guaranteed and may vary between project runs. Therefore, do not rely on the group order.

Note: This method may also return some group names starting with an underscore (_). These are internally used by the engine. To avoid conflicts, do not use custom groups starting with underscores. To exclude internal groups, see the following code snippet:

# Stores the node's non-internal groups only (as an array of StringNames).
var non_internal_groups = []
for group in get_groups():
	if not str(group).begins_with("_"):
		non_internal_groups.push_back(group)

pub fn set_owner(&mut self, owner: impl AsArg<Option<Gd<Node>>>)

pub fn get_owner(&self) -> Option<Gd<Node>>

pub fn get_index(&self) -> i32

To set the default parameters, use get_index_ex and its builder methods. See the book for detailed usage instructions. Returns this node’s order among its siblings. The first node’s index is 0. See also get_child.

If include_internal is false, returns the index ignoring internal children. The first, non-internal child will have an index of 0 (see add_child’s internal parameter).

pub fn get_index_ex<'ex>(&'ex self) -> ExGetIndex<'ex>

Returns this node’s order among its siblings. The first node’s index is 0. See also get_child.

If include_internal is false, returns the index ignoring internal children. The first, non-internal child will have an index of 0 (see add_child’s internal parameter).

pub fn print_tree(&mut self)

Prints the node and its children to the console, recursively. The node does not have to be inside the tree. This method outputs NodePaths relative to this node, and is good for copy/pasting into get_node_as. See also print_tree_pretty.

May print, for example:

.
Menu
Menu/Label
Menu/Camera2D
SplashScreen
SplashScreen/Camera2D

pub fn print_tree_pretty(&mut self)

Prints the node and its children to the console, recursively. The node does not have to be inside the tree. Similar to print_tree, but the graphical representation looks like what is displayed in the editor’s Scene dock. It is useful for inspecting larger trees.

May print, for example:

 ┖╴TheGame
    ┠╴Menu
    ┃  ┠╴Label
    ┃  ┖╴Camera2D
    ┖╴SplashScreen
       ┖╴Camera2D

pub fn get_tree_string(&self) -> GString

Returns the tree as a String. Used mainly for debugging purposes. This version displays the path relative to the current node, and is good for copy/pasting into the get_node_as function. It also can be used in game UI/UX.

May print, for example:

TheGame
TheGame/Menu
TheGame/Menu/Label
TheGame/Menu/Camera2D
TheGame/SplashScreen
TheGame/SplashScreen/Camera2D

pub fn get_tree_string_pretty(&self) -> GString

Similar to get_tree_string, this returns the tree as a String. This version displays a more graphical representation similar to what is displayed in the Scene Dock. It is useful for inspecting larger trees.

May print, for example:

 ┖╴TheGame
    ┠╴Menu
    ┃  ┠╴Label
    ┃  ┖╴Camera2D
    ┖╴SplashScreen
       ┖╴Camera2D

pub fn set_scene_file_path(&mut self, scene_file_path: impl AsArg<GString>)

pub fn get_scene_file_path(&self) -> GString

pub fn propagate_notification(&mut self, what: i32)

Calls notify with what on this node and all of its children, recursively.

pub fn propagate_call(&mut self, method: impl AsArg<StringName>)

To set the default parameters, use propagate_call_ex and its builder methods. See the book for detailed usage instructions. Calls the given method name, passing args as arguments, on this node and all of its children, recursively.

If parent_first is true, the method is called on this node first, then on all of its children. If false, the children’s methods are called first.

pub fn propagate_call_ex<'ex>( &'ex mut self, method: impl AsArg<StringName> + 'ex, ) -> ExPropagateCall<'ex>

Calls the given method name, passing args as arguments, on this node and all of its children, recursively.

If parent_first is true, the method is called on this node first, then on all of its children. If false, the children’s methods are called first.

pub fn set_physics_process(&mut self, enable: bool)

If set to true, enables physics (fixed framerate) processing. When a node is being processed, it will receive a NodeNotification::PHYSICS_PROCESS at a fixed (usually 60 FPS, see [member Engine.physics_ticks_per_second] to change) interval (and the physics_process callback will be called if it exists).

Note: If physics_process is overridden, this will be automatically enabled before ready is called.

pub fn get_physics_process_delta_time(&self) -> f64

Returns the time elapsed (in seconds) since the last physics callback. This value is identical to physics_process’s delta parameter, and is often consistent at run-time, unless [member Engine.physics_ticks_per_second] is changed. See also NodeNotification::PHYSICS_PROCESS.

Note: The returned value will be larger than expected if running at a framerate lower than [member Engine.physics_ticks_per_second] / [member Engine.max_physics_steps_per_frame] FPS. This is done to avoid “spiral of death” scenarios where performance would plummet due to an ever-increasing number of physics steps per frame. This behavior affects both process and physics_process. As a result, avoid using delta for time measurements in real-world seconds. Use the Time singleton’s methods for this purpose instead, such as get_ticks_usec.

pub fn is_physics_processing(&self) -> bool

Returns true if physics processing is enabled (see set_physics_process).

pub fn get_process_delta_time(&self) -> f64

Returns the time elapsed (in seconds) since the last process callback. This value is identical to process’s delta parameter, and may vary from frame to frame. See also NodeNotification::PROCESS.

Note: The returned value will be larger than expected if running at a framerate lower than [member Engine.physics_ticks_per_second] / [member Engine.max_physics_steps_per_frame] FPS. This is done to avoid “spiral of death” scenarios where performance would plummet due to an ever-increasing number of physics steps per frame. This behavior affects both process and physics_process. As a result, avoid using delta for time measurements in real-world seconds. Use the Time singleton’s methods for this purpose instead, such as get_ticks_usec.

pub fn set_process(&mut self, enable: bool)

If set to true, enables processing. When a node is being processed, it will receive a NodeNotification::PROCESS on every drawn frame (and the process callback will be called if it exists).

Note: If process is overridden, this will be automatically enabled before ready is called.

Note: This method only affects the process callback, i.e. it has no effect on other callbacks like physics_process. If you want to disable all processing for the node, set [member process_mode] to ProcessMode::DISABLED.

pub fn set_process_priority(&mut self, priority: i32)

pub fn get_process_priority(&self) -> i32

pub fn set_physics_process_priority(&mut self, priority: i32)

pub fn get_physics_process_priority(&self) -> i32

pub fn is_processing(&self) -> bool

Returns true if processing is enabled (see set_process).

pub fn set_process_input(&mut self, enable: bool)

If set to true, enables input processing.

Note: If input is overridden, this will be automatically enabled before ready is called. Input processing is also already enabled for GUI controls, such as Button and TextEdit.

pub fn is_processing_input(&self) -> bool

Returns true if the node is processing input (see set_process_input).

pub fn set_process_shortcut_input(&mut self, enable: bool)

If set to true, enables shortcut processing for this node.

Note: If shortcut_input is overridden, this will be automatically enabled before ready is called.

pub fn is_processing_shortcut_input(&self) -> bool

Returns true if the node is processing shortcuts (see set_process_shortcut_input).

pub fn set_process_unhandled_input(&mut self, enable: bool)

If set to true, enables unhandled input processing. It enables the node to receive all input that was not previously handled (usually by a Control).

Note: If unhandled_input is overridden, this will be automatically enabled before ready is called. Unhandled input processing is also already enabled for GUI controls, such as Button and TextEdit.

pub fn is_processing_unhandled_input(&self) -> bool

Returns true if the node is processing unhandled input (see set_process_unhandled_input).

pub fn set_process_unhandled_key_input(&mut self, enable: bool)

If set to true, enables unhandled key input processing.

Note: If unhandled_key_input is overridden, this will be automatically enabled before ready is called.

pub fn is_processing_unhandled_key_input(&self) -> bool

Returns true if the node is processing unhandled key input (see set_process_unhandled_key_input).

pub fn set_process_mode(&mut self, mode: ProcessMode)

pub fn get_process_mode(&self) -> ProcessMode

pub fn can_process(&self) -> bool

Returns true if the node can receive processing notifications and input callbacks (NodeNotification::PROCESS, input, etc.) from the SceneTree and Viewport. The returned value depends on [member process_mode]:

If the node is not inside the tree, returns false no matter the value of [member process_mode].

pub fn set_process_thread_group(&mut self, mode: ProcessThreadGroup)

pub fn get_process_thread_group(&self) -> ProcessThreadGroup

pub fn set_process_thread_messages(&mut self, flags: ProcessThreadMessages)

pub fn get_process_thread_messages(&self) -> ProcessThreadMessages

pub fn set_process_thread_group_order(&mut self, order: i32)

pub fn get_process_thread_group_order(&self) -> i32

pub fn queue_accessibility_update(&mut self)

Queues an accessibility information update for this node.

pub fn get_accessibility_element(&self) -> Rid

Returns main accessibility element RID.

Note: This method should be called only during accessibility information updates (NodeNotification::ACCESSIBILITY_UPDATE).

pub fn set_display_folded(&mut self, fold: bool)

If set to true, the node appears folded in the Scene dock. As a result, all of its children are hidden. This method is intended to be used in editor plugins and tools, but it also works in release builds. See also is_displayed_folded.

pub fn is_displayed_folded(&self) -> bool

Returns true if the node is folded (collapsed) in the Scene dock. This method is intended to be used in editor plugins and tools. See also set_display_folded.

pub fn set_process_internal(&mut self, enable: bool)

If set to true, enables internal processing for this node. Internal processing happens in isolation from the normal process calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or processing is disabled for scripting (set_process).

Warning: Built-in nodes rely on internal processing for their internal logic. Disabling it is unsafe and may lead to unexpected behavior. Use this method if you know what you are doing.

pub fn is_processing_internal(&self) -> bool

Returns true if internal processing is enabled (see set_process_internal).

pub fn set_physics_process_internal(&mut self, enable: bool)

If set to true, enables internal physics for this node. Internal physics processing happens in isolation from the normal physics_process calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or physics processing is disabled for scripting (set_physics_process).

Warning: Built-in nodes rely on internal processing for their internal logic. Disabling it is unsafe and may lead to unexpected behavior. Use this method if you know what you are doing.

pub fn is_physics_processing_internal(&self) -> bool

Returns true if internal physics processing is enabled (see set_physics_process_internal).

pub fn set_physics_interpolation_mode(&mut self, mode: PhysicsInterpolationMode)

pub fn get_physics_interpolation_mode(&self) -> PhysicsInterpolationMode

pub fn is_physics_interpolated(&self) -> bool

Returns true if physics interpolation is enabled for this node (see [member physics_interpolation_mode]).

Note: Interpolation will only be active if both the flag is set and physics interpolation is enabled within the SceneTree. This can be tested using is_physics_interpolated_and_enabled.

pub fn is_physics_interpolated_and_enabled(&self) -> bool

Returns true if physics interpolation is enabled (see [member physics_interpolation_mode]) and enabled in the SceneTree.

This is a convenience version of is_physics_interpolated that also checks whether physics interpolation is enabled globally.

See [member SceneTree.physics_interpolation] and [member ProjectSettings.physics/common/physics_interpolation].

pub fn reset_physics_interpolation(&mut self)

When physics interpolation is active, moving a node to a radically different transform (such as placement within a level) can result in a visible glitch as the object is rendered moving from the old to new position over the physics tick.

That glitch can be prevented by calling this method, which temporarily disables interpolation until the physics tick is complete.

The notification NodeNotification::RESET_PHYSICS_INTERPOLATION will be received by the node and all children recursively.

Note: This function should be called after moving the node, rather than before.

pub fn set_auto_translate_mode(&mut self, mode: AutoTranslateMode)

pub fn get_auto_translate_mode(&self) -> AutoTranslateMode

pub fn can_auto_translate(&self) -> bool

Returns true if this node can automatically translate messages depending on the current locale. See [member auto_translate_mode], atr, and atr_n.

pub fn set_translation_domain_inherited(&mut self)

Makes this node inherit the translation domain from its parent node. If this node has no parent, the main translation domain will be used.

This is the default behavior for all nodes. Calling set_translation_domain disables this behavior.

pub fn get_window(&self) -> Option<Gd<Window>>

Returns the Window that contains this node. If the node is in the main window, this is equivalent to getting the root node (get_tree().get_root()).

pub fn get_last_exclusive_window(&self) -> Option<Gd<Window>>

Returns the Window that contains this node, or the last exclusive child in a chain of windows starting with the one that contains this node.

pub fn create_tween(&mut self) -> Gd<Tween>

Creates a new Tween and binds it to this node.

This is the equivalent of doing:

get_tree().create_tween().bind_node(self)

The Tween will start automatically on the next process frame or physics frame (depending on [enum Tween.TweenProcessMode]). See bind_node for more info on Tweens bound to nodes.

Note: The method can still be used when the node is not inside SceneTree. It can fail in an unlikely case of using a custom MainLoop.

pub fn duplicate(&self) -> Option<Gd<Node>>

👎Deprecated:

Use Gd::duplicate_node() or Gd::duplicate_node_ex().

To set the default parameters, use duplicate_ex and its builder methods. See the book for detailed usage instructions. Duplicates the node, returning a new node with all of its properties, signals, groups, and children copied from the original, recursively. The behavior can be tweaked through the flags (see [enum DuplicateFlags]). Internal nodes are not duplicated.

Note: For nodes with a Script attached, if init has been defined with required parameters, the duplicated node will not have a Script.

Note: By default, this method will duplicate only properties marked for serialization (i.e. using @GlobalScope.PROPERTY_USAGE_STORAGE, or in GDScript, @GDScript.@export). If you want to duplicate all properties, use DuplicateFlags::INTERNAL_STATE.

pub fn duplicate_ex<'ex>(&'ex self) -> ExDuplicate<'ex>

👎Deprecated:

Use Gd::duplicate_node() or Gd::duplicate_node_ex().

Duplicates the node, returning a new node with all of its properties, signals, groups, and children copied from the original, recursively. The behavior can be tweaked through the flags (see [enum DuplicateFlags]). Internal nodes are not duplicated.

Note: For nodes with a Script attached, if init has been defined with required parameters, the duplicated node will not have a Script.

Note: By default, this method will duplicate only properties marked for serialization (i.e. using @GlobalScope.PROPERTY_USAGE_STORAGE, or in GDScript, @GDScript.@export). If you want to duplicate all properties, use DuplicateFlags::INTERNAL_STATE.

pub fn replace_by(&mut self, node: impl AsArg<Gd<Node>>)

To set the default parameters, use replace_by_ex and its builder methods. See the book for detailed usage instructions. Replaces this node by the given node. All children of this node are moved to node.

If keep_groups is true, the node is added to the same groups that the replaced node is in (see add_to_group).

Warning: The replaced node is removed from the tree, but it is not deleted. To prevent memory leaks, store a reference to the node in a variable, or use free.

pub fn replace_by_ex<'ex>( &'ex mut self, node: impl AsArg<Gd<Node>> + 'ex, ) -> ExReplaceBy<'ex>

Replaces this node by the given node. All children of this node are moved to node.

If keep_groups is true, the node is added to the same groups that the replaced node is in (see add_to_group).

Warning: The replaced node is removed from the tree, but it is not deleted. To prevent memory leaks, store a reference to the node in a variable, or use free.

pub fn set_scene_instance_load_placeholder(&mut self, load_placeholder: bool)

If set to true, the node becomes an InstancePlaceholder when packed and instantiated from a PackedScene. See also get_scene_instance_load_placeholder.

pub fn get_scene_instance_load_placeholder(&self) -> bool

Returns true if this node is an instance load placeholder. See InstancePlaceholder and set_scene_instance_load_placeholder.

pub fn set_editable_instance( &mut self, node: impl AsArg<Gd<Node>>, is_editable: bool, )

Set to true to allow all nodes owned by node to be available, and editable, in the Scene dock, even if their [member owner] is not the scene root. This method is intended to be used in editor plugins and tools, but it also works in release builds. See also is_editable_instance.

pub fn is_editable_instance(&self, node: impl AsArg<Option<Gd<Node>>>) -> bool

Returns true if node has editable children enabled relative to this node. This method is intended to be used in editor plugins and tools. See also set_editable_instance.

pub fn get_viewport(&self) -> Option<Gd<Viewport>>

Returns the node’s closest Viewport ancestor, if the node is inside the tree. Otherwise, returns null.

pub fn queue_free(&mut self)

Queues this node to be deleted at the end of the current frame. When deleted, all of its children are deleted as well, and all references to the node and its children become invalid.

Unlike with free, the node is not deleted instantly, and it can still be accessed before deletion. It is also safe to call queue_free multiple times. Use is_queued_for_deletion to check if the node will be deleted at the end of the frame.

Note: The node will only be freed after all other deferred calls are finished. Using this method is not always the same as calling free through call_deferred.

pub fn request_ready(&mut self)

Requests ready to be called again the next time the node enters the tree. Does not immediately call ready.

Note: This method only affects the current node. If the node’s children also need to request ready, this method needs to be called for each one of them. When the node and its children enter the tree again, the order of ready callbacks will be the same as normal.

pub fn is_node_ready(&self) -> bool

Returns true if the node is ready, i.e. it’s inside scene tree and all its children are initialized.

request_ready resets it back to false.

pub fn set_multiplayer_authority(&mut self, id: i32)

To set the default parameters, use set_multiplayer_authority_ex and its builder methods. See the book for detailed usage instructions. Sets the node’s multiplayer authority to the peer with the given peer id. The multiplayer authority is the peer that has authority over the node on the network. Defaults to peer ID 1 (the server). Useful in conjunction with rpc_config and the MultiplayerAPI.

If recursive is true, the given peer is recursively set as the authority for all children of this node.

Warning: This does not automatically replicate the new authority to other peers. It is the developer’s responsibility to do so. You may replicate the new authority’s information using [member MultiplayerSpawner.spawn_function], an RPC, or a MultiplayerSynchronizer. Furthermore, the parent’s authority does not propagate to newly added children.

pub fn set_multiplayer_authority_ex<'ex>( &'ex mut self, id: i32, ) -> ExSetMultiplayerAuthority<'ex>

Sets the node’s multiplayer authority to the peer with the given peer id. The multiplayer authority is the peer that has authority over the node on the network. Defaults to peer ID 1 (the server). Useful in conjunction with rpc_config and the MultiplayerAPI.

If recursive is true, the given peer is recursively set as the authority for all children of this node.

Warning: This does not automatically replicate the new authority to other peers. It is the developer’s responsibility to do so. You may replicate the new authority’s information using [member MultiplayerSpawner.spawn_function], an RPC, or a MultiplayerSynchronizer. Furthermore, the parent’s authority does not propagate to newly added children.

pub fn get_multiplayer_authority(&self) -> i32

Returns the peer ID of the multiplayer authority for this node. See set_multiplayer_authority.

pub fn is_multiplayer_authority(&self) -> bool

Returns true if the local system is the multiplayer authority of this node.

pub fn get_multiplayer(&self) -> Option<Gd<MultiplayerApi>>

pub fn rpc_config(&mut self, method: impl AsArg<StringName>, config: &Variant)

Changes the RPC configuration for the given method. config should either be null to disable the feature (as by default), or a Dictionary containing the following entries:

  • rpc_mode: see [enum MultiplayerAPI.RPCMode];

  • transfer_mode: see [enum MultiplayerPeer.TransferMode];

  • call_local: if true, the method will also be called locally;

  • channel: an int representing the channel to send the RPC on.

Note: In GDScript, this method corresponds to the @GDScript.@rpc annotation, with various parameters passed (@rpc(any), @rpc(authority)…). See also the high-level multiplayer tutorial.

pub fn get_node_rpc_config(&self) -> Variant

Returns a Dictionary mapping method names to their RPC configuration defined for this node using rpc_config.

Note: This method only returns the RPC configuration assigned via rpc_config. See get_rpc_config to retrieve the RPCs defined by the Script.

pub fn set_editor_description( &mut self, editor_description: impl AsArg<GString>, )

pub fn get_editor_description(&self) -> GString

pub fn set_unique_name_in_owner(&mut self, enable: bool)

pub fn is_unique_name_in_owner(&self) -> bool

pub fn atr(&self, message: impl AsArg<GString>) -> GString

To set the default parameters, use atr_ex and its builder methods. See the book for detailed usage instructions. Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.

This method works the same as tr, with the addition of respecting the [member auto_translate_mode] state.

If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.

For detailed examples, see Internationalizing games.

pub fn atr_ex<'ex>(&'ex self, message: impl AsArg<GString> + 'ex) -> ExAtr<'ex>

Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.

This method works the same as tr, with the addition of respecting the [member auto_translate_mode] state.

If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.

For detailed examples, see Internationalizing games.

pub fn atr_n( &self, message: impl AsArg<GString>, plural_message: impl AsArg<StringName>, n: i32, ) -> GString

To set the default parameters, use atr_n_ex and its builder methods. See the book for detailed usage instructions. Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.

This method works the same as tr_n, with the addition of respecting the [member auto_translate_mode] state.

If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.

The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.

For detailed examples, see Localization using gettext.

Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with atr.

pub fn atr_n_ex<'ex>( &'ex self, message: impl AsArg<GString> + 'ex, plural_message: impl AsArg<StringName> + 'ex, n: i32, ) -> ExAtrN<'ex>

Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.

This method works the same as tr_n, with the addition of respecting the [member auto_translate_mode] state.

If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.

The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.

For detailed examples, see Localization using gettext.

Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with atr.

pub fn rpc( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Error

Sends a remote procedure call request for the given method to peers on the network (and locally), sending additional arguments to the method called by the RPC. The call request will only be received by nodes with the same NodePath, including the exact same [member name]. Behavior depends on the RPC configuration for the given method (see rpc_config and @GDScript.@rpc). By default, methods are not exposed to RPCs.

May return Error::OK if the call is successful, Error::ERR_INVALID_PARAMETER if the arguments passed in the method do not match, Error::ERR_UNCONFIGURED if the node’s [member multiplayer] cannot be fetched (such as when the node is not inside the tree), Error::ERR_CONNECTION_ERROR if [member multiplayer]’s connection is not available.

Note: You can only safely use RPCs on clients after you received the MultiplayerAPI.connected_to_server signal from the MultiplayerAPI. You also need to keep track of the connection state, either by the MultiplayerAPI signals like MultiplayerAPI.server_disconnected or by checking (get_multiplayer().peer.get_connection_status() == CONNECTION_CONNECTED).

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_rpc( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Error, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn rpc_id( &mut self, peer_id: i64, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Error

Sends a rpc to a specific peer identified by peer_id (see set_target_peer).

May return Error::OK if the call is successful, Error::ERR_INVALID_PARAMETER if the arguments passed in the method do not match, Error::ERR_UNCONFIGURED if the node’s [member multiplayer] cannot be fetched (such as when the node is not inside the tree), Error::ERR_CONNECTION_ERROR if [member multiplayer]’s connection is not available.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_rpc_id( &mut self, peer_id: i64, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Error, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn update_configuration_warnings(&mut self)

Refreshes the warnings displayed for this node in the Scene dock. Use get_configuration_warnings to customize the warning messages to display.

pub fn call_deferred_thread_group( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant

This function is similar to call_deferred except that the call will take place when the node thread group is processed. If the node thread group processes in sub-threads, then the call will be done on that thread, right before NodeNotification::PROCESS or NodeNotification::PHYSICS_PROCESS, the process or physics_process or their internal versions are called.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_call_deferred_thread_group( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn set_deferred_thread_group( &mut self, property: impl AsArg<StringName>, value: &Variant, )

Similar to call_deferred_thread_group, but for setting properties.

pub fn notify_deferred_thread_group(&mut self, what: i32)

Similar to call_deferred_thread_group, but for notifications.

pub fn call_thread_safe( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant

This function ensures that the calling of this function will succeed, no matter whether it’s being done from a thread or not. If called from a thread that is not allowed to call the function, the call will become deferred. Otherwise, the call will go through directly.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_call_thread_safe( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn set_thread_safe( &mut self, property: impl AsArg<StringName>, value: &Variant, )

Similar to call_thread_safe, but for setting properties.

pub fn notify_thread_safe(&mut self, what: i32)

Similar to call_thread_safe, but for notifications.

pub fn notify(&mut self, what: NodeNotification)

⚠️ Sends a Godot notification to all classes inherited by the object.

Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().

Starts from the highest ancestor (the Object class) and goes down the hierarchy. See also Godot docs for Object::notification().

§Panics

If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must be exclusive.

pub fn notify_reversed(&mut self, what: NodeNotification)

⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.

See docs of that method, including the panics.

Methods from Deref<Target = Object>§

pub fn get_script(&self) -> Option<Gd<Script>>

pub fn set_script(&mut self, script: impl AsArg<Option<Gd<Script>>>)

pub fn connect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, ) -> Error

pub fn connect_flags( &mut self, signal: impl AsArg<StringName>, callable: &Callable, flags: ConnectFlags, ) -> Error

pub fn get_class(&self) -> GString

Returns the object’s built-in class name, as a String. See also is_class.

Note: This method ignores class_name declarations. If this object’s script has defined a class_name, the base, built-in class name is returned instead.

pub fn is_class(&self, class: impl AsArg<GString>) -> bool

Returns true if the object inherits from the given class. See also get_class.

var sprite2d = Sprite2D.new()
sprite2d.is_class("Sprite2D") # Returns true
sprite2d.is_class("Node")     # Returns true
sprite2d.is_class("Node3D")   # Returns false

Note: This method ignores class_name declarations in the object’s script.

pub fn set(&mut self, property: impl AsArg<StringName>, value: &Variant)

Assigns value to the given property. If the property does not exist or the given value’s type doesn’t match, nothing happens.

var node = Node2D.new()
node.set("global_scale", Vector2(8, 2.5))
print(node.global_scale) # Prints (8.0, 2.5)

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn get(&self, property: impl AsArg<StringName>) -> Variant

Returns the Variant value of the given property. If the property does not exist, this method returns null.

var node = Node2D.new()
node.rotation = 1.5
var a = node.get("rotation") # a is 1.5

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn set_indexed( &mut self, property_path: impl AsArg<NodePath>, value: &Variant, )

Assigns a new value to the property identified by the property_path. The path should be a NodePath relative to this object, and can use the colon character (:) to access nested properties.

var node = Node2D.new()
node.set_indexed("position", Vector2(42, 0))
node.set_indexed("position:y", -10)
print(node.position) # Prints (42.0, -10.0)

Note: In C#, property_path must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn get_indexed(&self, property_path: impl AsArg<NodePath>) -> Variant

Gets the object’s property indexed by the given property_path. The path should be a NodePath relative to the current object and can use the colon character (:) to access nested properties.

Examples: "position:x" or "material:next_pass:blend_mode".

var node = Node2D.new()
node.position = Vector2(5, -10)
var a = node.get_indexed("position")   # a is Vector2(5, -10)
var b = node.get_indexed("position:y") # b is -10

Note: In C#, property_path must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

Note: This method does not support actual paths to nodes in the SceneTree, only sub-property paths. In the context of nodes, use get_node_and_resource instead.

pub fn get_property_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns the object’s property list as an Array of dictionaries. Each Dictionary contains the following entries:

  • name is the property’s name, as a String;

  • class_name is an empty StringName, unless the property is VariantType::OBJECT and it inherits from a class;

  • type is the property’s type, as an int (see [enum Variant.Type]);

  • hint is how the property is meant to be edited (see [enum PropertyHint]);

  • hint_string depends on the hint (see [enum PropertyHint]);

  • usage is a combination of [enum PropertyUsageFlags].

Note: In GDScript, all class members are treated as properties. In C# and GDExtension, it may be necessary to explicitly mark class members as Godot properties using decorators or attributes.

pub fn get_method_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns this object’s methods and their signatures as an Array of dictionaries. Each Dictionary contains the following entries:

  • name is the name of the method, as a String;

  • args is an Array of dictionaries representing the arguments;

  • default_args is the default arguments as an Array of variants;

  • flags is a combination of [enum MethodFlags];

  • id is the method’s internal identifier int;

  • return is the returned value, as a Dictionary;

Note: The dictionaries of args and return are formatted identically to the results of get_property_list, although not all entries are used.

pub fn property_can_revert(&self, property: impl AsArg<StringName>) -> bool

Returns true if the given property has a custom default value. Use property_get_revert to get the property’s default value.

Note: This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_can_revert] to customize the default value. If [method _property_can_revert] is not implemented, this method returns false.

pub fn property_get_revert(&self, property: impl AsArg<StringName>) -> Variant

Returns the custom default value of the given property. Use property_can_revert to check if the property has a custom default value.

Note: This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_get_revert] to customize the default value. If [method _property_get_revert] is not implemented, this method returns null.

pub fn set_meta(&mut self, name: impl AsArg<StringName>, value: &Variant)

Adds or changes the entry name inside the object’s metadata. The metadata value can be any Variant, although some types cannot be serialized correctly.

If value is null, the entry is removed. This is the equivalent of using remove_meta. See also has_meta and get_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn remove_meta(&mut self, name: impl AsArg<StringName>)

Removes the given entry name from the object’s metadata. See also has_meta, get_meta and set_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta(&self, name: impl AsArg<StringName>) -> Variant

To set the default parameters, use get_meta_ex and its builder methods. See the book for detailed usage instructions. Returns the object’s metadata value for the given entry name. If the entry does not exist, returns default. If default is null, an error is also generated.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetMeta<'ex>

Returns the object’s metadata value for the given entry name. If the entry does not exist, returns default. If default is null, an error is also generated.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn has_meta(&self, name: impl AsArg<StringName>) -> bool

Returns true if a metadata entry is found with the given name. See also get_meta, set_meta and remove_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta_list(&self) -> Array<StringName>

Returns the object’s metadata entry names as an Array of StringNames.

pub fn add_user_signal(&mut self, signal: impl AsArg<GString>)

To set the default parameters, use add_user_signal_ex and its builder methods. See the book for detailed usage instructions. Adds a user-defined signal named signal. Optional arguments for the signal can be added as an Array of dictionaries, each defining a name String and a type int (see [enum Variant.Type]). See also has_user_signal and remove_user_signal.

add_user_signal("hurt", [
	{ "name": "damage", "type": TYPE_INT },
	{ "name": "source", "type": TYPE_OBJECT }
])

pub fn add_user_signal_ex<'ex>( &'ex mut self, signal: impl AsArg<GString> + 'ex, ) -> ExAddUserSignal<'ex>

Adds a user-defined signal named signal. Optional arguments for the signal can be added as an Array of dictionaries, each defining a name String and a type int (see [enum Variant.Type]). See also has_user_signal and remove_user_signal.

add_user_signal("hurt", [
	{ "name": "damage", "type": TYPE_INT },
	{ "name": "source", "type": TYPE_OBJECT }
])

pub fn has_user_signal(&self, signal: impl AsArg<StringName>) -> bool

Returns true if the given user-defined signal name exists. Only signals added with add_user_signal are included. See also remove_user_signal.

pub fn remove_user_signal(&mut self, signal: impl AsArg<StringName>)

Removes the given user signal signal from the object. See also add_user_signal and has_user_signal.

pub fn emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Error

Emits the given signal by name. The signal must exist, so it should be a built-in signal of this class or one of its inherited classes, or a user-defined signal (see add_user_signal). This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

Returns Error::ERR_UNAVAILABLE if signal does not exist or the parameters are invalid.

emit_signal("hit", "sword", 100)
emit_signal("game_over")

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Error, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant

Calls the method on the object and returns the result. This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

var node = Node3D.new()
node.call("rotate", Vector3(1.0, 0.0, 0.0), 1.571)

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant

Calls the method on the object during idle time. Always returns null, not the method’s result.

Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they’ll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly.

This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

var node = Node3D.new()
node.call_deferred("rotate", Vector3(1.0, 0.0, 0.0), 1.571)

For methods that are deferred from the same thread, the order of execution at idle time is identical to the order in which call_deferred was called.

See also call_deferred.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

Note: If you’re looking to delay the function call by a frame, refer to the SceneTree.process_frame and SceneTree.physics_frame signals.

var node = Node3D.new()
# Make a Callable and bind the arguments to the node's rotate() call.
var callable = node.rotate.bind(Vector3(1.0, 0.0, 0.0), 1.571)
# Connect the callable to the process_frame signal, so it gets called in the next process frame.
# CONNECT_ONE_SHOT makes sure it only gets called once instead of every frame.
get_tree().process_frame.connect(callable, CONNECT_ONE_SHOT)
§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn set_deferred( &mut self, property: impl AsArg<StringName>, value: &Variant, )

Assigns value to the given property, at the end of the current frame. This is equivalent to calling set through call_deferred.

var node = Node2D.new()
add_child(node)

node.rotation = 1.5
node.set_deferred("rotation", 3.0)
print(node.rotation) # Prints 1.5

await get_tree().process_frame
print(node.rotation) # Prints 3.0

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn callv( &mut self, method: impl AsArg<StringName>, arg_array: &AnyArray, ) -> Variant

Calls the method on the object and returns the result. Unlike call, this method expects all parameters to be contained inside arg_array.

var node = Node3D.new()
node.callv("rotate", [Vector3(1.0, 0.0, 0.0), 1.571])

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn has_method(&self, method: impl AsArg<StringName>) -> bool

Returns true if the given method name exists in the object.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn get_method_argument_count(&self, method: impl AsArg<StringName>) -> i32

Returns the number of arguments of the given method by name.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn has_signal(&self, signal: impl AsArg<StringName>) -> bool

Returns true if the given signal name exists in the object.

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn get_signal_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns the list of existing signals as an Array of dictionaries.

Note: Due to the implementation, each Dictionary is formatted very similarly to the returned values of get_method_list.

pub fn get_signal_connection_list( &self, signal: impl AsArg<StringName>, ) -> Array<Dictionary<Variant, Variant>>

Returns an Array of connections for the given signal name. Each connection is represented as a Dictionary that contains three entries:

  • signal is a reference to the Signal;

  • callable is a reference to the connected Callable;

  • flags is a combination of [enum ConnectFlags].

pub fn get_incoming_connections(&self) -> Array<Dictionary<Variant, Variant>>

Returns an Array of signal connections received by this object. Each connection is represented as a Dictionary that contains three entries:

  • signal is a reference to the Signal;

  • callable is a reference to the Callable;

  • flags is a combination of [enum ConnectFlags].

pub fn disconnect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, )

Disconnects a signal by name from a given callable. If the connection does not exist, generates an error. Use is_connected to make sure that the connection exists.

pub fn is_connected( &self, signal: impl AsArg<StringName>, callable: &Callable, ) -> bool

Returns true if a connection exists between the given signal name and callable.

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn has_connections(&self, signal: impl AsArg<StringName>) -> bool

Returns true if any connection exists on the given signal name.

Note: In C#, signal must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn set_block_signals(&mut self, enable: bool)

If set to true, the object becomes unable to emit signals. As such, emit_signal and signal connections will not work, until it is set to false.

pub fn is_blocking_signals(&self) -> bool

Returns true if the object is blocking its signals from being emitted. See set_block_signals.

pub fn notify_property_list_changed(&mut self)

Emits the property_list_changed signal. This is mainly used to refresh the editor, so that the Inspector and editor plugins are properly updated.

pub fn set_message_translation(&mut self, enable: bool)

If set to true, allows the object to translate messages with tr and tr_n. Enabled by default. See also can_translate_messages.

pub fn can_translate_messages(&self) -> bool

Returns true if the object is allowed to translate messages with tr and tr_n. See also set_message_translation.

pub fn tr(&self, message: impl AsArg<StringName>) -> GString

To set the default parameters, use tr_ex and its builder methods. See the book for detailed usage instructions. Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.

If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.

For detailed examples, see Internationalizing games.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate.

pub fn tr_ex<'ex>(&'ex self, message: impl AsArg<StringName> + 'ex) -> ExTr<'ex>

Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.

If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.

For detailed examples, see Internationalizing games.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate.

pub fn tr_n( &self, message: impl AsArg<StringName>, plural_message: impl AsArg<StringName>, n: i32, ) -> GString

To set the default parameters, use tr_n_ex and its builder methods. See the book for detailed usage instructions. Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.

If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.

The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.

For detailed examples, see Localization using gettext.

Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with tr.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate_plural.

pub fn tr_n_ex<'ex>( &'ex self, message: impl AsArg<StringName> + 'ex, plural_message: impl AsArg<StringName> + 'ex, n: i32, ) -> ExTrN<'ex>

Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.

If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.

The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.

For detailed examples, see Localization using gettext.

Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with tr.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate_plural.

pub fn get_translation_domain(&self) -> StringName

Returns the name of the translation domain used by tr and tr_n. See also TranslationServer.

pub fn set_translation_domain(&mut self, domain: impl AsArg<StringName>)

Sets the name of the translation domain used by tr and tr_n. See also TranslationServer.

pub fn is_queued_for_deletion(&self) -> bool

Returns true if the queue_free method was called for the object.

pub fn cancel_free(&mut self)

If this method is called during ObjectNotification::PREDELETE, this object will reject being freed and will remain allocated. This is mostly an internal function used for error handling to avoid the user from freeing objects when they are not intended to.

pub fn notify(&mut self, what: ObjectNotification)

⚠️ Sends a Godot notification to all classes inherited by the object.

Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().

Starts from the highest ancestor (the Object class) and goes down the hierarchy. See also Godot docs for Object::notification().

§Panics

If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must be exclusive.

pub fn notify_reversed(&mut self, what: ObjectNotification)

⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.

See docs of that method, including the panics.

Trait Implementations§

§

impl Bounds for OpenXrInteractionProfileEditorBase

§

type Memory = MemManual

Defines the memory strategy of the static type.
§

type Declarer = DeclEngine

Whether this class is a core Godot class provided by the engine, or declared by the user as a Rust struct.
§

impl Debug for OpenXrInteractionProfileEditorBase

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Deref for OpenXrInteractionProfileEditorBase

§

type Target = HBoxContainer

The resulting type after dereferencing.
§

fn deref(&self) -> &<OpenXrInteractionProfileEditorBase as Deref>::Target

Dereferences the value.
§

impl DerefMut for OpenXrInteractionProfileEditorBase

§

fn deref_mut( &mut self, ) -> &mut <OpenXrInteractionProfileEditorBase as Deref>::Target

Mutably dereferences the value.
§

impl GodotClass for OpenXrInteractionProfileEditorBase

§

const INIT_LEVEL: InitLevel = crate::init::InitLevel::Editor

Initialization level, during which this class should be initialized with Godot. Read more
§

type Base = HBoxContainer

The immediate superclass of T. This is always a Godot engine class.
§

fn class_id() -> ClassId

Globally unique class ID, linked to the name under which the class is registered in Godot. Read more
§

fn inherits<Base>() -> bool
where Base: GodotClass,

Returns whether Self inherits from Base. Read more
§

impl Inherits<BoxContainer> for OpenXrInteractionProfileEditorBase

§

const IS_SAME_CLASS: bool = false

True iff Self == Base. Read more
§

impl Inherits<CanvasItem> for OpenXrInteractionProfileEditorBase

§

const IS_SAME_CLASS: bool = false

True iff Self == Base. Read more
§

impl Inherits<Container> for OpenXrInteractionProfileEditorBase

§

const IS_SAME_CLASS: bool = false

True iff Self == Base. Read more
§

impl Inherits<Control> for OpenXrInteractionProfileEditorBase

§

const IS_SAME_CLASS: bool = false

True iff Self == Base. Read more
§

impl Inherits<HBoxContainer> for OpenXrInteractionProfileEditorBase

§

const IS_SAME_CLASS: bool = false

True iff Self == Base. Read more
§

impl Inherits<Node> for OpenXrInteractionProfileEditorBase

§

const IS_SAME_CLASS: bool = false

True iff Self == Base. Read more
§

impl Inherits<Object> for OpenXrInteractionProfileEditorBase

§

const IS_SAME_CLASS: bool = false

True iff Self == Base. Read more
§

impl Inherits<OpenXrInteractionProfileEditorBase> for OpenXrInteractionProfileEditor

§

const IS_SAME_CLASS: bool = false

True iff Self == Base. Read more
§

impl WithSignals for OpenXrInteractionProfileEditorBase

§

type SignalCollection<'c, C: WithSignals> = SignalsOfContainer<'c, C>

The associated struct listing all signals of this class. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Inherits<T> for T
where T: GodotClass,

§

const IS_SAME_CLASS: bool = true

True iff Self == Base. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> UniformObjectDeref<DeclEngine> for T
where T: GodotClass<Declarer = DeclEngine>,

§

type TargetRef<'a> = Gd<T>

§

type TargetMut<'a> = Gd<T>

§

fn object_as_ref<'a>( gd: &'a Gd<T>, ) -> <T as UniformObjectDeref<DeclEngine>>::TargetRef<'a>

§

fn object_as_mut<'a>( gd: &'a mut Gd<T>, ) -> <T as UniformObjectDeref<DeclEngine>>::TargetMut<'a>